comparison src/server.c @ 6245:9083f92e0d58

[gaim-migrate @ 6739] this should really fix the infinite looping in server.c that KingAnt tried to fix. gaim_find_buddy() behaves like it used to now, and gaim_find_buddies() must be used to get all matching buddies committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 20 Jul 2003 16:19:31 +0000
parents 34d553c43e8b
children a21cf07cd8e1
comparison
equal deleted inserted replaced
6244:519028f52516 6245:9083f92e0d58
1017 void serv_got_update(GaimConnection *gc, const char *name, int loggedin, 1017 void serv_got_update(GaimConnection *gc, const char *name, int loggedin,
1018 int evil, time_t signon, time_t idle, int type) 1018 int evil, time_t signon, time_t idle, int type)
1019 { 1019 {
1020 GaimAccount *account; 1020 GaimAccount *account;
1021 struct buddy *b; 1021 struct buddy *b;
1022 GSList *buddies;
1022 1023
1023 account = gaim_connection_get_account(gc); 1024 account = gaim_connection_get_account(gc);
1024 b = gaim_find_buddy(account, name); 1025 b = gaim_find_buddy(account, name);
1025 1026
1026 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options & 1027 if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options &
1127 serv_got_typing_stopped(gc, name); /* obviously not typing */ 1128 serv_got_typing_stopped(gc, name); /* obviously not typing */
1128 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE); 1129 gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE);
1129 gaim_pounce_execute(gc->account, b->name, GAIM_POUNCE_SIGNOFF); 1130 gaim_pounce_execute(gc->account, b->name, GAIM_POUNCE_SIGNOFF);
1130 system_log(log_signoff, gc, b, OPT_LOG_BUDDY_SIGNON); 1131 system_log(log_signoff, gc, b, OPT_LOG_BUDDY_SIGNON);
1131 } 1132 }
1132 } 1133 }
1133 1134
1134 gaim_blist_update_buddy_presence(b, loggedin); 1135 gaim_blist_update_buddy_presence(b, loggedin);
1135 1136
1136 /* 1137 for (buddies = gaim_find_buddies(account, name); buddies; buddies = g_slist_remove(buddies, buddies->data)) {
1137 * Now, update the rest of the buddies in the list. This is weird, by 1138 b = buddies->data;
1138 * the way. Basically we call gaim_find_buddy() until it returns null.
1139 * Calling gaim_find_buddy() with a name sets a static variable. Then
1140 * calling it without a name uses that static reference to return other
1141 * stuff. We can't be sure that the above code didn't call
1142 * gaim_find_buddy() again with another buddy name, so we "reseed" the
1143 * function here.
1144 */
1145 b = gaim_find_buddy(account, name);
1146 while ((b = gaim_find_buddy(gc->account, NULL)) != NULL) {
1147 gaim_blist_update_buddy_presence(b, loggedin); 1139 gaim_blist_update_buddy_presence(b, loggedin);
1148 gaim_blist_update_buddy_idle(b, idle); 1140 gaim_blist_update_buddy_idle(b, idle);
1149 gaim_blist_update_buddy_evil(b, evil); 1141 gaim_blist_update_buddy_evil(b, evil);
1150 gaim_blist_update_buddy_status(b, type); 1142 gaim_blist_update_buddy_status(b, type);
1151 } 1143 }