[telepathy-gabble/master] Update the presence cache from the cache in muc channels

Sjoerd Simons sjoerd.simons at collabora.co.uk
Thu Jan 7 08:03:08 PST 2010


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

diff --git a/src/muc-channel.c b/src/muc-channel.c
index 82ec4ca..11eff43 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -2151,9 +2151,22 @@ handle_fill_presence (WockyMuc *muc,
 {
   GabbleMucChannel *self = GABBLE_MUC_CHANNEL (user_data);
   GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (self);
+  TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
+      (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT);
+  TpHandle self_handle;
 
+  self_handle = tp_handle_ensure (contact_repo, priv->self_jid->str,
+      GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
   gabble_presence_add_status_and_vcard (priv->conn->self_presence, stanza);
 
+  /* Sync the presence we send over the wire with what is in our presence cache
+   */
+  gabble_presence_cache_update (priv->conn->presence_cache, self_handle,
+      NULL,
+      priv->conn->self_presence->status,
+      priv->conn->self_presence->status_message,
+      0);
+
   g_signal_emit (self, signals[PRE_PRESENCE], 0, (LmMessage *) stanza);
 }
 
@@ -2199,6 +2212,7 @@ update_roster_presence (GabbleMucChannel *gmuc,
     TpHandleSet *owners,
     GHashTable *omap)
 {
+  GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (gmuc);
   TpHandle owner = 0;
   TpHandle handle = tp_handle_ensure (contact_repo, member->from,
       GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL);
@@ -2213,6 +2227,9 @@ update_roster_presence (GabbleMucChannel *gmuc,
         tp_handle_set_add (owners, owner);
     }
 
+  gabble_presence_parse_presence_message (priv->conn->presence_cache,
+      handle, member->from, (LmMessage *) member->presence_stanza);
+
   tp_handle_set_add (members, handle);
   g_hash_table_insert (omap,
       GUINT_TO_POINTER (handle),
@@ -2358,6 +2375,9 @@ handle_presence (GObject *source,
         }
     }
 
+  gabble_presence_parse_presence_message (priv->conn->presence_cache,
+    handle, who->from, (LmMessage *) who->presence_stanza);
+
   /* add the member in quesion */
   tp_handle_set_add (handles, handle);
   tp_group_mixin_change_members (data, "", tp_handle_set_peek (handles),
-- 
1.5.6.5




More information about the telepathy-commits mailing list