[telepathy-gabble/master] Add gabble_connection_get_full_jid()

Will Thompson will.thompson at collabora.co.uk
Tue Jun 9 10:01:38 PDT 2009


---
 src/connection.c |   17 +++++++++++++++++
 src/connection.h |    2 ++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index e0d3703..32e348d 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -973,6 +973,23 @@ OUT:
   return result;
 }
 
+/**
+ * gabble_connection_get_full_jid:
+ *
+ * Returns: the full jid (including resource) of this connection, which must be
+ *          freed by the caller.
+ */
+gchar *
+gabble_connection_get_full_jid (GabbleConnection *conn)
+{
+  TpBaseConnection *base = TP_BASE_CONNECTION (conn);
+  TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base,
+      TP_HANDLE_TYPE_CONTACT);
+  TpHandle self = tp_base_connection_get_self_handle (base);
+  const gchar *bare_jid = tp_handle_inspect (contact_handles, self);
+
+  return g_strconcat (bare_jid, "/", conn->priv->resource, NULL);
+}
 
 /**
  * _gabble_connection_send
diff --git a/src/connection.h b/src/connection.h
index cd060ac..4fe8d0c 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -225,6 +225,8 @@ GType gabble_connection_get_type (void);
   (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_CONNECTION, \
                               GabbleConnectionClass))
 
+gchar *gabble_connection_get_full_jid (GabbleConnection *conn);
+
 gboolean _gabble_connection_set_properties_from_account (
     GabbleConnection *conn, const gchar *account, GError **error);
 gboolean _gabble_connection_send (GabbleConnection *conn, LmMessage *msg,
-- 
1.5.6.5




More information about the telepathy-commits mailing list