[ekiga] Simplified loudmouth's chat code



commit 0becacfb5ba683365ea384c3f80beac030e4a21e
Author: Julien Puydt <jpuydt gnome org>
Date:   Sun Dec 13 17:50:12 2009 +0100

    Simplified loudmouth's chat code
    
    It now works better... except for a bug it triggers in the view code

 plugins/loudmouth/loudmouth-chat-simple.cpp |    2 ++
 plugins/loudmouth/loudmouth-presentity.cpp  |   10 ++++++++--
 plugins/loudmouth/loudmouth-presentity.h    |    2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plugins/loudmouth/loudmouth-chat-simple.cpp b/plugins/loudmouth/loudmouth-chat-simple.cpp
index f691e3e..0f884a1 100644
--- a/plugins/loudmouth/loudmouth-chat-simple.cpp
+++ b/plugins/loudmouth/loudmouth-chat-simple.cpp
@@ -43,10 +43,12 @@ LM::SimpleChat::SimpleChat (Ekiga::ServiceCore& core_,
 			    PresentityPtr presentity_):
   core(core_), presentity(presentity_)
 {
+  presentity->has_chat = true;
 }
 
 LM::SimpleChat::~SimpleChat ()
 {
+  presentity->has_chat = false;
 }
 
 const std::string
diff --git a/plugins/loudmouth/loudmouth-presentity.cpp b/plugins/loudmouth/loudmouth-presentity.cpp
index c7f990a..f3f07b0 100644
--- a/plugins/loudmouth/loudmouth-presentity.cpp
+++ b/plugins/loudmouth/loudmouth-presentity.cpp
@@ -43,7 +43,7 @@
 
 LM::Presentity::Presentity (LmConnection* connection_,
 			    LmMessageNode* item_):
-  connection(connection_), item(item_)
+  connection(connection_), item(item_), has_chat(false)
 {
   lm_connection_ref (connection);
   lm_message_node_ref (item);
@@ -173,7 +173,13 @@ LM::Presentity::populate_menu (Ekiga::MenuBuilder& builder)
     builder.add_action ("stop", _("Stop getting his/her status"), boost::bind (&LM::Presentity::stop_to, this));
   }
 
-  builder.add_action ("chat", _("Start chat"), boost::ref (chat_requested));
+  if ( !has_chat) {
+
+    builder.add_action ("chat", _("Start chat"), boost::ref (chat_requested));
+  } else {
+
+    builder.add_action ("chat", _("Continue chat"), boost::ref (chat_requested));
+  }
 
   builder.add_action ("remove", _("_Remove"),
 		      boost::bind (&LM::Presentity::remove_presentity, this));
diff --git a/plugins/loudmouth/loudmouth-presentity.h b/plugins/loudmouth/loudmouth-presentity.h
index a764266..a50def4 100644
--- a/plugins/loudmouth/loudmouth-presentity.h
+++ b/plugins/loudmouth/loudmouth-presentity.h
@@ -74,6 +74,8 @@ namespace LM
     void push_presence (const std::string resource,
 			LmMessageNode* presence);
 
+    bool has_chat;
+
     boost::signal0<void> chat_requested;
 
   private:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]