[Telepathy-commits] [telepathy-gabble/master] use IQ's to send IBB data

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon Mar 9 09:04:36 PDT 2009


---
 src/bytestream-ibb.c        |   24 ++++++------------------
 tests/twisted/bytestream.py |    6 +++---
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c
index b92f277..59ef7b6 100644
--- a/src/bytestream-ibb.c
+++ b/src/bytestream-ibb.c
@@ -335,7 +335,7 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
 {
   GabbleBytestreamIBB *self = GABBLE_BYTESTREAM_IBB (iface);
   GabbleBytestreamIBBPrivate *priv = GABBLE_BYTESTREAM_IBB_GET_PRIVATE (self);
-  LmMessage *msg;
+  LmMessage *iq;
   guint sent, stanza_count;
   LmMessageNode *data;
 
@@ -346,24 +346,12 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
       return FALSE;
     }
 
-  msg = lm_message_build (priv->peer_jid, LM_MESSAGE_TYPE_MESSAGE,
+  iq = lm_message_build (priv->peer_jid, LM_MESSAGE_TYPE_IQ,
+      '@', "type", "set",
       '(', "data", "",
         '*', &data,
         '@', "xmlns", NS_IBB,
         '@', "sid", priv->stream_id,
-      ')',
-      '(', "amp", "",
-        '@', "xmlns", NS_AMP,
-        '(', "rule", "",
-          '@', "condition", "deliver-at",
-          '@', "value", "stored",
-          '@', "action", "error",
-        ')',
-        '(', "rule", "",
-          '@', "condition", "match-resource",
-          '@', "value", "exact",
-          '@', "action", "error",
-        ')',
       ')', NULL);
 
   sent = 0;
@@ -395,7 +383,7 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
       lm_message_node_set_attribute (data, "seq", seq);
 
       DEBUG ("send %d bytes", send_now);
-      ret = _gabble_connection_send (priv->conn, msg, &error);
+      ret = _gabble_connection_send (priv->conn, iq, &error);
 
       g_free (encoded);
       g_free (seq);
@@ -405,7 +393,7 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
           DEBUG ("error sending IBB stanza: %s. Close the bytestream",
               error->message);
           g_error_free (error);
-          lm_message_unref (msg);
+          lm_message_unref (iq);
 
           gabble_bytestream_iface_close (GABBLE_BYTESTREAM_IFACE (self), NULL);
           return FALSE;
@@ -417,7 +405,7 @@ gabble_bytestream_ibb_send (GabbleBytestreamIface *iface,
 
   DEBUG ("finished to send %d bytes (%d stanzas needed)", len, stanza_count);
 
-  lm_message_unref (msg);
+  lm_message_unref (iq);
 
   return TRUE;
 }
diff --git a/tests/twisted/bytestream.py b/tests/twisted/bytestream.py
index 00ff624..3bc6735 100644
--- a/tests/twisted/bytestream.py
+++ b/tests/twisted/bytestream.py
@@ -404,10 +404,10 @@ class BytestreamIBB(Bytestream):
         acknowledge_iq(self.stream, event.stanza)
 
     def get_data(self):
-        # wait for IBB stanza. Gabble always use messages
-        ibb_event = self.q.expect('stream-message')
+        # wait for IBB stanza. Gabble always uses IQ
+        ibb_event = self.q.expect('stream-iq', query_ns=ns.IBB)
 
-        data_nodes = xpath.queryForNodes('/message/data[@xmlns="%s"]' % ns.IBB,
+        data_nodes = xpath.queryForNodes('/iq/data[@xmlns="%s"]' % ns.IBB,
             ibb_event.stanza)
         assert data_nodes is not None
         assert len(data_nodes) == 1
-- 
1.5.6.5




More information about the telepathy-commits mailing list