[Telepathy-commits] [telepathy-gabble/master] set self_jid directly from create_room_identity (and a nice assertion which uncovered the double-setting bug)

Robert McQueen robert.mcqueen at collabora.co.uk
Tue Aug 19 10:53:57 PDT 2008


20080726235115-418b8-42b3f61facbe01672b836dbe833f3fc4817b6f4c.gz
---
 src/muc-channel.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/muc-channel.c b/src/muc-channel.c
index 37bf1e8..a5665dc 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -277,7 +277,7 @@ gabble_muc_channel_init (GabbleMucChannel *obj)
 }
 
 
-static void create_room_identity (GabbleMucChannel *, TpHandle *, GString **);
+static void create_room_identity (GabbleMucChannel *, TpHandle *);
 
 static void _gabble_muc_channel_handle_invited (GabbleMucChannel *chan,
     TpHandle inviter, const gchar *message);
@@ -316,7 +316,7 @@ gabble_muc_channel_constructor (GType type, guint n_props,
   tp_handle_ref (contact_handles, priv->initiator);
 
   /* create our own identity in the room */
-  create_room_identity (self, &self_handle, &priv->self_jid);
+  create_room_identity (self, &self_handle);
   /* this causes us to have one ref to the self handle which is unreffed
    * at the end of this function */
 
@@ -639,8 +639,7 @@ room_properties_update (GabbleMucChannel *chan)
 
 static void
 create_room_identity (GabbleMucChannel *chan,
-                      TpHandle *room_handle,
-                      GString **room_jid)
+                      TpHandle *room_handle)
 {
   GabbleMucChannelPrivate *priv;
   TpBaseConnection *conn;
@@ -652,6 +651,8 @@ create_room_identity (GabbleMucChannel *chan,
   conn = (TpBaseConnection *) priv->conn;
   contact_repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT);
 
+  g_assert (priv->self_jid == NULL);
+
   main_jid = tp_handle_inspect (contact_repo, conn->self_handle);
 
   gabble_decode_jid (main_jid, &username, NULL, NULL);
@@ -666,10 +667,7 @@ create_room_identity (GabbleMucChannel *chan,
           GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
     }
 
-  if (room_jid)
-    {
-      *room_jid = g_string_new (jid);
-    }
+  priv->self_jid = g_string_new (jid);
 
   g_free (jid);
 }
-- 
1.5.6.3




More information about the Telepathy-commits mailing list