[ekiga] Loudmouth: worked on the dialect's LM::Handler implementation



commit a8ede967628cdc310ce470be2cc65bd650696371
Author: Julien Puydt <jpuydt free fr>
Date:   Sun Jan 5 17:40:45 2014 +0100

    Loudmouth: worked on the dialect's LM::Handler implementation
    
    I just got a single FIXME down and wrote more comments than code,
    but it lays the path for future enhancements

 plugins/loudmouth/loudmouth-dialect.cpp |   28 +++++++++++++++++++++-------
 plugins/loudmouth/loudmouth-dialect.h   |    5 ++++-
 2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/plugins/loudmouth/loudmouth-dialect.cpp b/plugins/loudmouth/loudmouth-dialect.cpp
index cba4784..29ff9bd 100644
--- a/plugins/loudmouth/loudmouth-dialect.cpp
+++ b/plugins/loudmouth/loudmouth-dialect.cpp
@@ -170,14 +170,24 @@ LmHandlerResult
 LM::Dialect::handle_iq (LmConnection* /*connection*/,
                        LmMessage* /*message*/)
 {
-  return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; // FIXME: implement properly
+  /* We should never get an iq request from the server, but only
+   * answers to what we asked
+   */
+  return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
 }
 
 LmHandlerResult
 LM::Dialect::handle_message (LmConnection* /*connection*/,
-                            LmMessage* /*message*/)
+                            LmMessage* message)
 {
-  return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; // FIXME: implement properly
+  LmHandlerResult result = LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+
+  if (lm_message_get_sub_type (message) == LM_MESSAGE_SUB_TYPE_GROUPCHAT) {
+
+    // FIXME: here we should find the multiple chat which is supposed to receive it, and push it through
+  }
+
+  return result;
 }
 
 LmHandlerResult
@@ -195,7 +205,7 @@ LM::Dialect::handle_presence (LmConnection* /*connection*/,
       bool found_100 = false;
       bool found_110 = false;
       bool found_210 = false;
-      for (LmMessageNode* child = lm_message_node_children (lm_message_get_node (message));
+      for (LmMessageNode* child = lm_message_get_node (message)->children;
           child != NULL;
           child = child->next) {
 
@@ -204,7 +214,7 @@ LM::Dialect::handle_presence (LmConnection* /*connection*/,
          const gchar* code = lm_message_node_get_attribute (child, "code");
          if (code != NULL) {
 
-           if (g_strcmp0 (code, '100') == 0)
+           if (g_strcmp0 (code, "100") == 0)
              found_100 = true;
            if (g_strcmp0 (code, "110") == 0)
              found_110 = true;
@@ -219,6 +229,9 @@ LM::Dialect::handle_presence (LmConnection* /*connection*/,
        * - if we found a code 110, that means we managed to enter a
        * multiple chat
        *
+       * - if we get a code 201, then the room was created on our
+       * - behalf and we should configure it
+       *
        * - if we found a code 210, then we managed to enter a multiple
        * chat, but the server had to assign us another nick (because
        * of a collision for example)
@@ -262,6 +275,7 @@ LM::Dialect::handle_presence (LmConnection* /*connection*/,
        * much according to this idea.
        */
     }
-
-    return result;
   }
+
+  return result;
+}
diff --git a/plugins/loudmouth/loudmouth-dialect.h b/plugins/loudmouth/loudmouth-dialect.h
index aff221f..0dba5e6 100644
--- a/plugins/loudmouth/loudmouth-dialect.h
+++ b/plugins/loudmouth/loudmouth-dialect.h
@@ -37,12 +37,15 @@
 #define __LOUDMOUTH_DIALECT_H__
 
 #include "dialect-impl.h"
+
+#include "loudmouth-handler.h"
 #include "loudmouth-chat-simple.h"
 
 namespace LM
 {
   class Dialect:
-    public Ekiga::DialectImpl<SimpleChat>
+    public Ekiga::DialectImpl<SimpleChat>,
+    public LM::Handler
   {
   public:
 


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