changeset 8129:52cdf2740654

[gaim-migrate @ 8834] I don't think this will cause any problems, but perhaps there's some plugin that relies on this? Doubt it.. Anyhow, we were emitting buddy-away/back/idle/unidle signals before setting the new variables, which didn't let the signal handlers see the new variables. It's possible that a plugin or two out there took advantage of that to access the old values, but if that's something that's important, perhaps we should look into passing them to the signal handlers? committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 17 Jan 2004 09:03:05 +0000
parents 9aafd344230d
children ff88d4cbf4db
files src/blist.c src/server.c
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Sat Jan 17 07:10:20 2004 +0000
+++ b/src/blist.c	Sat Jan 17 09:03:05 2004 +0000
@@ -221,22 +221,23 @@
 void  gaim_blist_update_buddy_status (GaimBuddy *buddy, int status)
 {
 	GaimBlistUiOps *ops;
+	int old_status = buddy->uc;
 
 
 	ops = gaimbuddylist->ui_ops;
 
-	if (buddy->uc != status) {
-		if ((status & UC_UNAVAILABLE) != (buddy->uc & UC_UNAVAILABLE)) {
+	if (old_status != status) {
+		buddy->uc = status;
+		gaim_contact_compute_priority_buddy(gaim_buddy_get_contact(buddy));
+
+		if ((status & UC_UNAVAILABLE) != (old_status & UC_UNAVAILABLE)) {
 			if (status & UC_UNAVAILABLE)
 				gaim_signal_emit(gaim_blist_get_handle(), "buddy-away", buddy);
 			else
 				gaim_signal_emit(gaim_blist_get_handle(), "buddy-back", buddy);
 		}
-
-		buddy->uc = status;
-		gaim_contact_compute_priority_buddy(gaim_buddy_get_contact(buddy));
 	}
-	
+
 	if (ops)
 		ops->update(gaimbuddylist, (GaimBlistNode*)buddy);
 }
--- a/src/server.c	Sat Jan 17 07:10:20 2004 +0000
+++ b/src/server.c	Sat Jan 17 09:03:05 2004 +0000
@@ -1087,6 +1087,7 @@
 	GaimConversation *c;
 	GaimBuddy *b;
 	GSList *buddies;
+	int old_idle;
 
 	account = gaim_connection_get_account(gc);
 	b = gaim_find_buddy(account, name);
@@ -1120,11 +1121,7 @@
 		gaim_blist_save();
 	}
 
-	if (!b->idle && idle) {
-		gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b);
-	} else if (b->idle && !idle) {
-		gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b);
-	}
+	old_idle = b->idle;
 
 	if (gc->login_time_official && gc->login_time)
 		signon += gc->login_time_official - gc->login_time;
@@ -1139,6 +1136,12 @@
 */
 	gaim_blist_update_buddy_status(b, type);
 
+	if (!old_idle && idle) {
+		gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b);
+	} else if (old_idle && !idle) {
+		gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b);
+	}
+
 	if (loggedin) {
 		if (!GAIM_BUDDY_IS_ONLINE(b)) {
 			if (gaim_prefs_get_bool("/core/conversations/im/show_login")) {