[telepathy-gabble/master] Send <hold/> and <active/> to peer on hold/unhold
Will Thompson
will.thompson at collabora.co.uk
Fri Mar 27 04:28:38 PDT 2009
---
src/jingle-session.c | 25 +++++++++++++++++++++++++
src/jingle-session.h | 2 ++
src/media-channel.c | 16 ++--------------
src/namespaces.h | 1 +
4 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/src/jingle-session.c b/src/jingle-session.c
index 80ea059..7e35fd0 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -1833,3 +1833,28 @@ gabble_set_jingle_session_timeout (guint ms)
{
session_timeout_time = ms;
}
+
+void
+gabble_jingle_session_send_held (GabbleJingleSession *sess,
+ gboolean held)
+{
+ LmMessage *message;
+ LmMessageNode *jingle, *notification;
+
+ if (sess->priv->dialect != JINGLE_DIALECT_V032)
+ {
+ DEBUG ("FIXME: fake hold for Ye Olde Jingle and GTalk.");
+ return;
+ }
+
+ message = gabble_jingle_session_new_message (sess,
+ JINGLE_ACTION_SESSION_INFO, &jingle);
+
+ notification = lm_message_node_add_child (jingle,
+ (held ? "hold" : "active"), NULL);
+ lm_message_node_set_attributes (notification, "xmlns", NS_JINGLE_RTP_INFO,
+ NULL);
+
+ /* This is just informational, so ignoring the reply. */
+ gabble_jingle_session_send (sess, message, NULL, NULL);
+}
diff --git a/src/jingle-session.h b/src/jingle-session.h
index c37e1f0..eaeef83 100644
--- a/src/jingle-session.h
+++ b/src/jingle-session.h
@@ -108,6 +108,8 @@ typedef void (*JingleReplyHandler) (GabbleJingleSession *, gboolean success,
void gabble_jingle_session_send (GabbleJingleSession *sess, LmMessage *msg,
JingleReplyHandler cb, gpointer user_data);
+void gabble_jingle_session_send_held (GabbleJingleSession *sess, gboolean held);
+
/* Only to be used for the test suite */
void gabble_set_jingle_session_timeout (guint seconds);
diff --git a/src/media-channel.c b/src/media-channel.c
index a1cd050..757c38c 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2176,26 +2176,14 @@ session_state_changed_cb (GabbleJingleSession *session,
static void
inform_peer_of_unhold (GabbleMediaChannel *self)
{
- /* FIXME: when we upgrade to current Jingle, signal to the peer that
- * we've taken them off hold, via a session-info message;
- * ignore success or failure, since there's nothing we could really
- * do differently, and the message is only advisory.
- *
- * For now, we don't signal the unhold in the XMPP stream */
- DEBUG ("TODO: tell peer we've taken them off hold");
+ gabble_jingle_session_send_held (self->priv->session, FALSE);
}
static void
inform_peer_of_hold (GabbleMediaChannel *self)
{
- /* FIXME: when we upgrade to current Jingle, signal to the peer that
- * we're putting them on hold, via a session-info message;
- * ignore success or failure, since there's nothing we could really
- * do differently, and the message is only advisory.
- *
- * For now, we don't signal the hold in the XMPP stream */
- DEBUG ("TODO: tell peer we're putting them on hold");
+ gabble_jingle_session_send_held (self->priv->session, TRUE);
}
diff --git a/src/namespaces.h b/src/namespaces.h
index 3d6c03c..4c6f740 100644
--- a/src/namespaces.h
+++ b/src/namespaces.h
@@ -46,6 +46,7 @@
#define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone"
/* XEP-0167 (Jingle RTP) */
#define NS_JINGLE_RTP "urn:xmpp:jingle:apps:rtp:0"
+#define NS_JINGLE_RTP_INFO "urn:xmpp:jingle:apps:rtp:info:1"
/* RTP audio capability in Jingle v0.15 (obsoleted by NS_JINGLE_RTP) */
#define NS_JINGLE_DESCRIPTION_AUDIO \
"http://jabber.org/protocol/jingle/description/audio"
--
1.5.6.5
More information about the telepathy-commits
mailing list