[telepathy-gabble/master] Add a hook for JingleContents to handle session-info payloads

Will Thompson will.thompson at collabora.co.uk
Wed Apr 1 08:24:49 PDT 2009


---
 src/jingle-content.c |   32 ++++++++++++++++++++++++++++++++
 src/jingle-content.h |   12 ++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/src/jingle-content.c b/src/jingle-content.c
index fe29860..82e50b5 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -1022,3 +1022,35 @@ gabble_jingle_content_is_created_by_us (GabbleJingleContent *c)
   return c->priv->created_by_us;
 }
 
+/**
+ * gabble_jingle_content_handle_info:
+ * @self: a jingle content
+ * @session_info_payload: a child node of a <jingle action='session-info'>
+ *                        stanza
+ * @handled: a location at which to store whether this content handled the
+ *           payload
+ * @error: a location at which to store an error if the content handled the
+ *         payload, but it was malformed.
+ *
+ * Returns: %FALSE if handling @session_info_payload caused an error; %TRUE if
+ *          it was handled successfully or not handled.
+ */
+gboolean
+gabble_jingle_content_handle_info (GabbleJingleContent *self,
+    LmMessageNode *session_info_payload,
+    gboolean *handled,
+    GError **error)
+{
+  GabbleJingleContentHandleInfoFunc f =
+      GABBLE_JINGLE_CONTENT_GET_CLASS (self)->handle_info;
+
+  if (f == NULL)
+    {
+      *handled = FALSE;
+      return TRUE;
+    }
+  else
+    {
+      return f (self, session_info_payload, handled, error);
+    }
+}
diff --git a/src/jingle-content.h b/src/jingle-content.h
index 1bc8a87..2f5eeb6 100644
--- a/src/jingle-content.h
+++ b/src/jingle-content.h
@@ -56,6 +56,11 @@ struct _JingleCandidate {
   int network;
 };
 
+typedef gboolean (*GabbleJingleContentHandleInfoFunc)(GabbleJingleContent *self,
+    LmMessageNode *session_info_payload,
+    gboolean *handled,
+    GError **error);
+
 typedef struct _GabbleJingleContentClass GabbleJingleContentClass;
 
 GType gabble_jingle_content_get_type (void);
@@ -83,6 +88,8 @@ struct _GabbleJingleContentClass {
     void  (*parse_description) (GabbleJingleContent *, LmMessageNode *,
         GError **);
     void  (*produce_description) (GabbleJingleContent *, LmMessageNode *);
+
+    GabbleJingleContentHandleInfoFunc handle_info;
 };
 
 typedef struct _GabbleJingleContentPrivate GabbleJingleContentPrivate;
@@ -120,5 +127,10 @@ gboolean gabble_jingle_content_change_direction (GabbleJingleContent *c,
 void gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self);
 gboolean gabble_jingle_content_is_created_by_us (GabbleJingleContent *c);
 
+gboolean gabble_jingle_content_handle_info (GabbleJingleContent *self,
+    LmMessageNode *session_info_payload,
+    gboolean *handled,
+    GError **error);
+
 #endif /* __JINGLE_CONTENT_H__ */
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list