[Telepathy-commits] [telepathy-gabble/master] Update MUC members when renaming to avoid nick conflict.

Will Thompson will.thompson at collabora.co.uk
Sun Feb 1 07:52:17 PST 2009


---
 src/muc-channel.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/muc-channel.c b/src/muc-channel.c
index bf3b1a3..84857b4 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -1464,16 +1464,32 @@ _gabble_muc_channel_presence_error (GabbleMucChannel *chan,
         case XMPP_ERROR_CONFLICT:
           if (priv->nick_retry_count < MAX_NICK_RETRIES)
             {
+              TpGroupMixin *mixin = TP_GROUP_MIXIN (chan);
               TpHandleRepoIface *contact_repo;
               TpHandle self_handle;
+              TpIntSet *add_rp = tp_intset_sized_new (1);
+              TpIntSet *remove_rp = tp_intset_sized_new (1);
 
+              /* Add a _ to our jid, and update the group mixin's self handle
+               * and remote pending members appropriately.
+               */
               g_string_append_c (priv->self_jid, '_');
 
               contact_repo = tp_base_connection_get_handles (
                   (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
               self_handle = tp_handle_ensure (contact_repo, priv->self_jid->str,
                   GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
+
+              tp_intset_add (add_rp, self_handle);
+              tp_intset_add (remove_rp, mixin->self_handle);
+
               tp_group_mixin_change_self_handle ((GObject *) chan, self_handle);
+              tp_group_mixin_change_members ((GObject *) chan, NULL, NULL,
+                  remove_rp, NULL, add_rp, 0,
+                  TP_CHANNEL_GROUP_CHANGE_REASON_RENAMED);
+
+              tp_intset_destroy (add_rp);
+              tp_intset_destroy (remove_rp);
               tp_handle_unref (contact_repo, self_handle);
 
               if (send_join_request (chan, priv->password, &tp_error))
-- 
1.5.6.5




More information about the Telepathy-commits mailing list