summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlban Crequy <alban.crequy@collabora.co.uk>2008-04-24 10:39:36 +0000
committerJonny Lamb <jonnylamb@jonnylamb.com>2008-08-11 20:01:09 +0100
commitee5071600089c38bf38928d7ead90159ba073cf1 (patch)
treefa18e4e84b1b93e028afd573f0be0ccc4f2d9654 /src
parent94598b243a809f06dc3abea009b82ff54940a0f0 (diff)
downloadtelepathy-salut-ee5071600089c38bf38928d7ead90159ba073cf1.tar.gz
Effectively send iq and receive the reply
20080424103936-a41c0-32f79b26a9b200e77ca4b91f851c227f6dd35adf.gz
Diffstat (limited to 'src')
-rw-r--r--src/salut-tubes-channel.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/salut-tubes-channel.c b/src/salut-tubes-channel.c
index 9fc43745..b784ab73 100644
--- a/src/salut-tubes-channel.c
+++ b/src/salut-tubes-channel.c
@@ -37,6 +37,7 @@
#include <gibber/gibber-xmpp-stanza.h>
#include <gibber/gibber-namespaces.h>
#include <gibber/gibber-xmpp-error.h>
+#include <gibber/gibber-iq-helper.h>
#define DEBUG_FLAG DEBUG_TUBES
#include "debug.h"
@@ -150,6 +151,7 @@ struct _SalutTubesChannelPrivate
GibberXmppConnection *xmpp_connection;
SalutXmppConnectionManager *xmpp_connection_manager;
ChannelState state;
+ GibberIqHelper *iq_helper;
GHashTable *tubes;
@@ -1750,10 +1752,24 @@ stream_tube_new_connection_cb (SalutTubeIface *tube,
}
static void
+iq_reply_cb (GibberIqHelper *helper,
+ GibberXmppStanza *sent_stanza,
+ GibberXmppStanza *reply_stanza,
+ GObject *object,
+ gpointer user_data)
+{
+ DEBUG ("Got a IQ reply :-)");
+}
+
+
+static void
_send_channel_iq_tube (gpointer key,
gpointer value,
gpointer user_data)
{
+ SalutTubesChannel *self = (SalutTubesChannel *) user_data;
+ SalutTubesChannelPrivate *priv = SALUT_TUBES_CHANNEL_GET_PRIVATE (self);
+
SalutTubeIface *tube = (SalutTubeIface *) value;
guint tube_id = GPOINTER_TO_UINT(key);
TpHandle initiator;
@@ -1773,10 +1789,11 @@ _send_channel_iq_tube (gpointer key,
DEBUG ("called for tube id %d", tube_id);
if (state == TP_TUBE_STATE_REMOTE_PENDING)
{
+ GError *error = NULL;
+
DEBUG ("Tube in remote pending state");
- /*
- GibberXmppStanza *stanza, *reply;
+ GibberXmppStanza *stanza;
const gchar *jid_from, *jid_to;
TpHandleRepoIface *contact_repo;
@@ -1809,12 +1826,18 @@ _send_channel_iq_tube (gpointer key,
GIBBER_NODE_END,
GIBBER_STANZA_END);
- if (!gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
- NULL, NULL, NULL))
+ if (priv->iq_helper == NULL)
+ {
+ priv->iq_helper = gibber_iq_helper_new (priv->xmpp_connection);
+ g_assert (priv->iq_helper);
+ }
+
+ if (!gibber_iq_helper_send_with_reply (priv->iq_helper, stanza,
+ iq_reply_cb, G_OBJECT(self), self, &error))
{
- printf("ERROR\n");
+ DEBUG ("ERROR: '%s'", error->message);
+ g_error_free (error);
}
- */
}
g_free (service);
@@ -1835,7 +1858,7 @@ _send_channel_iq_tubes (SalutTubesChannel *self)
return;
}
- g_hash_table_foreach (priv->tubes, _send_channel_iq_tube, NULL);
+ g_hash_table_foreach (priv->tubes, _send_channel_iq_tube, self);
}