pidgin: 79cc69fc: jabber: Treat the presence storm on join...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Feb 19 21:32:32 EST 2011


----------------------------------------------------------------------
Revision: 79cc69fcabf3979bd9662b74e31f5d5e9f71696d
Parent:   feb6784f7ddc856836d0ebe8b7d58d5ef6cf9b54
Author:   thijs at adium.im
Date:     02/19/11 21:25:23
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/79cc69fcabf3979bd9662b74e31f5d5e9f71696d

Changelog: 

jabber: Treat the presence storm on joining a room as not new arrivals.

This helps in Adium, where otherwise all of those joins end up printed out.
Fixes #7501, #a14527

Changes against parent feb6784f7ddc856836d0ebe8b7d58d5ef6cf9b54

  patched  ChangeLog
  patched  libpurple/protocols/jabber/chat.c
  patched  libpurple/protocols/jabber/chat.h
  patched  libpurple/protocols/jabber/presence.c

-------------- next part --------------
============================================================
--- ChangeLog	8290f7a6c090489405c3539ea8784e78df0f141d
+++ ChangeLog	c82516dfde7695454f16f961c9b92fad9ec692f9
@@ -4,6 +4,11 @@ version 2.7.11 (??/??/????):
 	General:
 	* Our bundled libgadu should now build on HP-UX.
 
+	XMPP:
+	* Fix building on platforms with an older glib (inadvertantly broken in
+	  2.7.10).  (#13329)
+	* Don't treat the on-join status storms as 'new arrivals'.  (#a14527)
+
 version 2.7.10 (02/06/2011):
 	General:
 	* Force video sources to all have the same capabilities.  This reduces the
============================================================
--- libpurple/protocols/jabber/chat.c	fc27a39f9c6647917691292ebd144b894517cbd9
+++ libpurple/protocols/jabber/chat.c	67fbff926f732214820637bdb280a711da90ddfa
@@ -237,6 +237,7 @@ static JabberChat *jabber_chat_new(Jabbe
 
 	chat = g_new0(JabberChat, 1);
 	chat->js = js;
+	chat->joined = 0;
 
 	chat->room = g_strdup(room);
 	chat->server = g_strdup(server);
============================================================
--- libpurple/protocols/jabber/chat.h	c5a2c163aa93ab6298be8d97bf8cb14ed1b67d0d
+++ libpurple/protocols/jabber/chat.h	bfb07c9bf7414e80404184138cdbb9e083f254bb
@@ -52,6 +52,7 @@ typedef struct _JabberChat {
 	void *config_dialog_handle;
 	GHashTable *members;
 	gboolean left;
+	time_t joined;
 } JabberChat;
 
 GList *jabber_chat_info(PurpleConnection *gc);
============================================================
--- libpurple/protocols/jabber/presence.c	3527cbdbf16fd3eb136961cb7245b4196312d465
+++ libpurple/protocols/jabber/presence.c	61809afddc76a990afa3967a167a516997fe1cb3
@@ -639,10 +639,14 @@ handle_presence_chat(JabberStream *js, J
 
 		if(!jabber_chat_find_buddy(chat->conv, presence->jid_from->resource))
 			purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource,
-					jid, flags, !presence->delayed);
+					jid, flags, chat->joined > 0 && ((!presence->delayed) || (presence->sent > chat->joined)));
 		else
 			purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), presence->jid_from->resource,
 					flags);
+
+		if (is_our_resource && chat->joined == 0)
+			chat->joined = time(NULL);
+
 	} else if (presence->type == JABBER_PRESENCE_UNAVAILABLE) {
 		gboolean nick_change = FALSE;
 		gboolean kick = FALSE;
@@ -669,8 +673,10 @@ handle_presence_chat(JabberStream *js, J
 			jid = xmlnode_get_attrib(presence->chat_info.item, "jid");
 
 		if (chat->muc) {
-			if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(110)))
+			if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(110))) {
 				is_our_resource = TRUE;
+				chat->joined = 0;
+			}
 
 			if (g_slist_find(presence->chat_info.codes, GINT_TO_POINTER(301))) {
 				/* XXX: We got banned.  YAY! (No GIR, that's bad) */
@@ -1159,9 +1165,6 @@ parse_delay(JabberStream *js, JabberPres
 static void
 parse_delay(JabberStream *js, JabberPresence *presence, xmlnode *delay)
 {
-	/* XXX: compare the time.  Can happen on presence stanzas that aren't
-	 * actually delayed.
-	 */
 	const char *stamp = xmlnode_get_attrib(delay, "stamp");
 	presence->delayed = TRUE;
 	presence->sent = purple_str_to_time(stamp, TRUE, NULL, NULL, NULL);


More information about the Commits mailing list