changeset 10554:0ad82505bde8

[gaim-migrate @ 11931] Buddies can be in more than one group (at least on some protocols), so we should update their status/idle/warning/etc. in all groups. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 29 Jan 2005 18:03:48 +0000
parents 7d165e1eec4d
children 761822c6f7ca
files src/prpl.c
diffstat 1 files changed, 57 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/prpl.c	Fri Jan 28 23:53:26 2005 +0000
+++ b/src/prpl.c	Sat Jan 29 18:03:48 2005 +0000
@@ -227,102 +227,116 @@
 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
 		gboolean idle, time_t idle_time)
 {
-	GaimBuddy *buddy;
-	GaimPresence *presence;
+	GSList *l;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(name    != NULL);
 	g_return_if_fail(gaim_account_is_connected(account));
 
-	if ((buddy = gaim_find_buddy(account, name)) == NULL)
-		return;
+	for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
+	{
+		GaimBuddy *buddy;
+		GaimPresence *presence;
 
-	presence = gaim_buddy_get_presence(buddy);
+		buddy = (GaimBuddy *)l->data;
 
-	gaim_presence_set_idle(presence, idle, idle_time);
+		presence = gaim_buddy_get_presence(buddy);
+
+		gaim_presence_set_idle(presence, idle, idle_time);
+	}
 }
 
 void
 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
 		time_t login_time)
 {
-	GaimBuddy *buddy;
-	GaimPresence *presence;
+	GSList *l;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(name    != NULL);
 
-	if ((buddy = gaim_find_buddy(account, name)) == NULL)
-		return;
+	for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
+	{
+		GaimBuddy *buddy;
+		GaimPresence *presence;
+
+		buddy = (GaimBuddy *)l->data;
 
-	if (login_time == 0)
-		login_time = time(NULL);
+		if (login_time == 0)
+			login_time = time(NULL);
 
-	presence = gaim_buddy_get_presence(buddy);
+		presence = gaim_buddy_get_presence(buddy);
 
-	gaim_presence_set_login_time(presence, login_time);
+		gaim_presence_set_login_time(presence, login_time);
+	}
 }
 
 void
 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
 		const char *status_id, const char *attr_id, ...)
 {
-	GaimBuddy *buddy;
-	GaimPresence *presence;
-	GaimStatus *status;
-	GaimStatus *old_status;
+	GSList *l;
 
 	g_return_if_fail(account   != NULL);
 	g_return_if_fail(name      != NULL);
 	g_return_if_fail(status_id != NULL);
 	g_return_if_fail(gaim_account_is_connected(account));
 
-	buddy = gaim_find_buddy(account, name);
-	if (buddy == NULL)
-		return;
+	for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
+	{
+		GaimBuddy *buddy;
+		GaimPresence *presence;
+		GaimStatus *status;
+		GaimStatus *old_status;
 
-	presence = gaim_buddy_get_presence(buddy);
-	status   = gaim_presence_get_status(presence, status_id);
+		buddy = (GaimBuddy *)l->data;
+		presence = gaim_buddy_get_presence(buddy);
+		status   = gaim_presence_get_status(presence, status_id);
 
-	g_return_if_fail(status != NULL);
+		g_return_if_fail(status != NULL);
 
-	if (attr_id != NULL)
-	{
-		va_list args;
+		if (attr_id != NULL)
+		{
+			va_list args;
 
-		va_start(args, attr_id);
+			va_start(args, attr_id);
 
-		while (attr_id != NULL)
-		{
-			set_value_from_arg(status, attr_id, &args);
+			while (attr_id != NULL)
+			{
+				set_value_from_arg(status, attr_id, &args);
 
-			attr_id = va_arg(args, char *);
+				attr_id = va_arg(args, char *);
+			}
+
+			va_end(args);
 		}
 
-		va_end(args);
+		old_status = gaim_presence_get_active_status(presence);
+		gaim_presence_set_status_active(presence, status_id, TRUE);
+		gaim_blist_update_buddy_status(buddy, old_status);
 	}
-
-	old_status = gaim_presence_get_active_status(presence);
-	gaim_presence_set_status_active(presence, status_id, TRUE);
-	gaim_blist_update_buddy_status(buddy, old_status);
 }
 
 void
 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name,
 		unsigned int level)
 {
-	GaimBuddy *buddy;
-	GaimPresence *presence;
+	GSList *l;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(name    != NULL);
 
-	if ((buddy = gaim_find_buddy(account, name)) == NULL)
-		return;
+	for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
+	{
+		GaimBuddy *buddy;
+		GaimPresence *presence;
 
-	presence = gaim_buddy_get_presence(buddy);
+		buddy = (GaimBuddy *)l->data;
 
-	gaim_presence_set_warning_level(presence, level);
+		presence = gaim_buddy_get_presence(buddy);
+
+		gaim_presence_set_warning_level(presence, level);
+	}
 }
 
 void