comparison src/prpl.c @ 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 6feef0a9098a
children b75ce371c812
comparison
equal deleted inserted replaced
10553:7d165e1eec4d 10554:0ad82505bde8
225 225
226 void 226 void
227 gaim_prpl_got_user_idle(GaimAccount *account, const char *name, 227 gaim_prpl_got_user_idle(GaimAccount *account, const char *name,
228 gboolean idle, time_t idle_time) 228 gboolean idle, time_t idle_time)
229 { 229 {
230 GaimBuddy *buddy; 230 GSList *l;
231 GaimPresence *presence;
232 231
233 g_return_if_fail(account != NULL); 232 g_return_if_fail(account != NULL);
234 g_return_if_fail(name != NULL); 233 g_return_if_fail(name != NULL);
235 g_return_if_fail(gaim_account_is_connected(account)); 234 g_return_if_fail(gaim_account_is_connected(account));
236 235
237 if ((buddy = gaim_find_buddy(account, name)) == NULL) 236 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
238 return; 237 {
239 238 GaimBuddy *buddy;
240 presence = gaim_buddy_get_presence(buddy); 239 GaimPresence *presence;
241 240
242 gaim_presence_set_idle(presence, idle, idle_time); 241 buddy = (GaimBuddy *)l->data;
242
243 presence = gaim_buddy_get_presence(buddy);
244
245 gaim_presence_set_idle(presence, idle, idle_time);
246 }
243 } 247 }
244 248
245 void 249 void
246 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name, 250 gaim_prpl_got_user_login_time(GaimAccount *account, const char *name,
247 time_t login_time) 251 time_t login_time)
248 { 252 {
249 GaimBuddy *buddy; 253 GSList *l;
250 GaimPresence *presence;
251 254
252 g_return_if_fail(account != NULL); 255 g_return_if_fail(account != NULL);
253 g_return_if_fail(name != NULL); 256 g_return_if_fail(name != NULL);
254 257
255 if ((buddy = gaim_find_buddy(account, name)) == NULL) 258 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
256 return; 259 {
257 260 GaimBuddy *buddy;
258 if (login_time == 0) 261 GaimPresence *presence;
259 login_time = time(NULL); 262
260 263 buddy = (GaimBuddy *)l->data;
261 presence = gaim_buddy_get_presence(buddy); 264
262 265 if (login_time == 0)
263 gaim_presence_set_login_time(presence, login_time); 266 login_time = time(NULL);
267
268 presence = gaim_buddy_get_presence(buddy);
269
270 gaim_presence_set_login_time(presence, login_time);
271 }
264 } 272 }
265 273
266 void 274 void
267 gaim_prpl_got_user_status(GaimAccount *account, const char *name, 275 gaim_prpl_got_user_status(GaimAccount *account, const char *name,
268 const char *status_id, const char *attr_id, ...) 276 const char *status_id, const char *attr_id, ...)
269 { 277 {
270 GaimBuddy *buddy; 278 GSList *l;
271 GaimPresence *presence;
272 GaimStatus *status;
273 GaimStatus *old_status;
274 279
275 g_return_if_fail(account != NULL); 280 g_return_if_fail(account != NULL);
276 g_return_if_fail(name != NULL); 281 g_return_if_fail(name != NULL);
277 g_return_if_fail(status_id != NULL); 282 g_return_if_fail(status_id != NULL);
278 g_return_if_fail(gaim_account_is_connected(account)); 283 g_return_if_fail(gaim_account_is_connected(account));
279 284
280 buddy = gaim_find_buddy(account, name); 285 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
281 if (buddy == NULL) 286 {
282 return; 287 GaimBuddy *buddy;
283 288 GaimPresence *presence;
284 presence = gaim_buddy_get_presence(buddy); 289 GaimStatus *status;
285 status = gaim_presence_get_status(presence, status_id); 290 GaimStatus *old_status;
286 291
287 g_return_if_fail(status != NULL); 292 buddy = (GaimBuddy *)l->data;
288 293 presence = gaim_buddy_get_presence(buddy);
289 if (attr_id != NULL) 294 status = gaim_presence_get_status(presence, status_id);
290 { 295
291 va_list args; 296 g_return_if_fail(status != NULL);
292 297
293 va_start(args, attr_id); 298 if (attr_id != NULL)
294
295 while (attr_id != NULL)
296 { 299 {
297 set_value_from_arg(status, attr_id, &args); 300 va_list args;
298 301
299 attr_id = va_arg(args, char *); 302 va_start(args, attr_id);
303
304 while (attr_id != NULL)
305 {
306 set_value_from_arg(status, attr_id, &args);
307
308 attr_id = va_arg(args, char *);
309 }
310
311 va_end(args);
300 } 312 }
301 313
302 va_end(args); 314 old_status = gaim_presence_get_active_status(presence);
303 } 315 gaim_presence_set_status_active(presence, status_id, TRUE);
304 316 gaim_blist_update_buddy_status(buddy, old_status);
305 old_status = gaim_presence_get_active_status(presence); 317 }
306 gaim_presence_set_status_active(presence, status_id, TRUE);
307 gaim_blist_update_buddy_status(buddy, old_status);
308 } 318 }
309 319
310 void 320 void
311 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name, 321 gaim_prpl_got_user_warning_level(GaimAccount *account, const char *name,
312 unsigned int level) 322 unsigned int level)
313 { 323 {
314 GaimBuddy *buddy; 324 GSList *l;
315 GaimPresence *presence;
316 325
317 g_return_if_fail(account != NULL); 326 g_return_if_fail(account != NULL);
318 g_return_if_fail(name != NULL); 327 g_return_if_fail(name != NULL);
319 328
320 if ((buddy = gaim_find_buddy(account, name)) == NULL) 329 for (l = gaim_find_buddies(account, name); l != NULL; l = l->next)
321 return; 330 {
322 331 GaimBuddy *buddy;
323 presence = gaim_buddy_get_presence(buddy); 332 GaimPresence *presence;
324 333
325 gaim_presence_set_warning_level(presence, level); 334 buddy = (GaimBuddy *)l->data;
335
336 presence = gaim_buddy_get_presence(buddy);
337
338 gaim_presence_set_warning_level(presence, level);
339 }
326 } 340 }
327 341
328 void 342 void
329 gaim_prpl_change_account_status(GaimAccount *account, 343 gaim_prpl_change_account_status(GaimAccount *account,
330 GaimStatus *old_status, GaimStatus *new_status) 344 GaimStatus *old_status, GaimStatus *new_status)