diff src/blist.c @ 11935:cb73483c9f63

[gaim-migrate @ 14226] Here are buddy-status-changed and buddy-idle-changed signals, to replace buddy-away, buddy-back, buddy-idle, and buddy-unidle. It it now possible to detect when a buddy goes from one away-state to another away-state without coming back in between. I'm not really sure I like how buddy-idle-changed works here, but it felt better to keep it consistent. It currently only fires on idle and unidle and not on just-more-idle, though that's easy to change if we decide plugins might want to know as idle time increases. I think I got all the doxygen and ChangeLog.API stuff, someone yell if I missed something. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 31 Oct 2005 22:02:30 +0000
parents 700ec4523c04
children 717cbb3115bc
line wrap: on
line diff
--- a/src/blist.c	Mon Oct 31 20:35:59 2005 +0000
+++ b/src/blist.c	Mon Oct 31 22:02:30 2005 +0000
@@ -741,14 +741,10 @@
 		((GaimContact*)((GaimBlistNode*)buddy)->parent)->online--;
 		if (((GaimContact*)((GaimBlistNode*)buddy)->parent)->online == 0)
 			((GaimGroup *)((GaimBlistNode *)buddy)->parent->parent)->online--;
-	} else if (gaim_status_is_available(status) &&
-			   !gaim_status_is_available(old_status)) {
-		gaim_signal_emit(gaim_blist_get_handle(), "buddy-back", buddy);
-
-	} else if (!gaim_status_is_available(status) &&
-			   gaim_status_is_available(old_status)) {
-		gaim_signal_emit(gaim_blist_get_handle(), "buddy-away", buddy);
-
+	} else {
+		gaim_signal_emit(gaim_blist_get_handle(),
+		                 "buddy-status-changed", buddy, old_status,
+		                 status);
 	}
 
 	/*
@@ -2122,10 +2118,9 @@
 GaimPresence *gaim_buddy_get_presence(const GaimBuddy *buddy)
 {
 	g_return_val_if_fail(buddy != NULL, NULL);
- 	return buddy->presence;
+	return buddy->presence;
 }
 
-
 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy)
 {
 	g_return_val_if_fail(buddy != NULL, NULL);
@@ -2548,28 +2543,22 @@
 {
 	void *handle = gaim_blist_get_handle();
 
-	gaim_signal_register(handle, "buddy-away",
-						 gaim_marshal_VOID__POINTER, NULL, 1,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY));
-
-	gaim_signal_register(handle, "buddy-back",
-						 gaim_marshal_VOID__POINTER, NULL, 1,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY));
-
-	gaim_signal_register(handle, "buddy-idle",
-						 gaim_marshal_VOID__POINTER, NULL, 1,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY));
-	gaim_signal_register(handle, "buddy-unidle",
-						 gaim_marshal_VOID__POINTER, NULL, 1,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY));
-	gaim_signal_register(handle, "buddy-idle-updated",
-						 gaim_marshal_VOID__POINTER, NULL, 1,
-						 gaim_value_new(GAIM_TYPE_SUBTYPE,
-										GAIM_SUBTYPE_BLIST_BUDDY));
+	gaim_signal_register(handle, "buddy-status-changed",
+	                     gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL,
+	                     3,
+	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
+	                                    GAIM_SUBTYPE_BLIST_BUDDY),
+	                     gaim_value_new(GAIM_TYPE_POINTER),
+	                     gaim_value_new(GAIM_TYPE_POINTER));
+
+	gaim_signal_register(handle, "buddy-idle-changed",
+	                     gaim_marshal_VOID__POINTER_INT_INT, NULL,
+	                     3,
+	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
+	                                    GAIM_SUBTYPE_BLIST_BUDDY),
+	                     gaim_value_new(GAIM_TYPE_INT),
+	                     gaim_value_new(GAIM_TYPE_INT));
+
 
 	gaim_signal_register(handle, "buddy-signed-on",
 						 gaim_marshal_VOID__POINTER, NULL, 1,