Mercurial > pidgin
comparison src/list.c @ 5068:b37d7d09ec83
[gaim-migrate @ 5419]
logout icons
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Mon, 07 Apr 2003 23:17:27 +0000 |
| parents | 18ec87e54201 |
| children | 74139d2562f5 |
comparison
equal
deleted
inserted
replaced
| 5067:bc40b13c83a0 | 5068:b37d7d09ec83 |
|---|---|
| 120 buddy->uc = status; | 120 buddy->uc = status; |
| 121 if (ops) | 121 if (ops) |
| 122 ops->update(gaimbuddylist, (GaimBlistNode*)buddy); | 122 ops->update(gaimbuddylist, (GaimBlistNode*)buddy); |
| 123 } | 123 } |
| 124 | 124 |
| 125 static gboolean presence_update_timeout_cb(struct buddy *buddy) { | |
| 126 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; | |
| 127 | |
| 128 if(buddy->present == GAIM_BUDDY_SIGNING_ON) | |
| 129 buddy->present = GAIM_BUDDY_ONLINE; | |
| 130 else if(buddy->present == GAIM_BUDDY_SIGNING_OFF) | |
| 131 buddy->present = GAIM_BUDDY_OFFLINE; | |
| 132 | |
| 133 buddy->timer = 0; | |
| 134 | |
| 135 if (ops) | |
| 136 ops->update(gaimbuddylist, (GaimBlistNode*)buddy); | |
| 137 | |
| 138 return FALSE; | |
| 139 } | |
| 140 | |
| 125 void gaim_blist_update_buddy_presence(struct buddy *buddy, int presence) { | 141 void gaim_blist_update_buddy_presence(struct buddy *buddy, int presence) { |
| 126 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; | 142 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; |
| 127 | 143 gboolean do_timer = FALSE; |
| 128 if (!buddy->present && presence) | 144 |
| 129 buddy->present = 2; | 145 if (!GAIM_BUDDY_IS_ONLINE(buddy) && presence) { |
| 130 else if (buddy->present != 2 || !presence) | 146 buddy->present = GAIM_BUDDY_SIGNING_ON; |
| 131 buddy->present = presence; | 147 do_timer = TRUE; |
| 148 } else if(GAIM_BUDDY_IS_ONLINE(buddy) && !presence) { | |
| 149 buddy->present = GAIM_BUDDY_SIGNING_OFF; | |
| 150 do_timer = TRUE; | |
| 151 } | |
| 152 | |
| 153 if(do_timer) { | |
| 154 if(buddy->timer > 0) | |
| 155 g_source_remove(buddy->timer); | |
| 156 buddy->timer = g_timeout_add(10000, (GSourceFunc)presence_update_timeout_cb, buddy); | |
| 157 } | |
| 158 | |
| 132 if (ops) | 159 if (ops) |
| 133 ops->update(gaimbuddylist, (GaimBlistNode*)buddy); | 160 ops->update(gaimbuddylist, (GaimBlistNode*)buddy); |
| 134 } | 161 } |
| 135 | 162 |
| 136 | 163 |
| 482 return; | 509 return; |
| 483 while (group) { | 510 while (group) { |
| 484 buddy = group->child; | 511 buddy = group->child; |
| 485 while (buddy) { | 512 while (buddy) { |
| 486 if (account == ((struct buddy*)buddy)->account) { | 513 if (account == ((struct buddy*)buddy)->account) { |
| 487 ((struct buddy*)buddy)->present = 0; | 514 ((struct buddy*)buddy)->present = GAIM_BUDDY_OFFLINE; |
| 488 if(ops) | 515 if(ops) |
| 489 ops->remove(gaimbuddylist, buddy); | 516 ops->remove(gaimbuddylist, buddy); |
| 490 } | 517 } |
| 491 buddy = buddy->next; | 518 buddy = buddy->next; |
| 492 } | 519 } |
| 1417 return 0; | 1444 return 0; |
| 1418 | 1445 |
| 1419 for(node = group->node.child; node; node = node->next) { | 1446 for(node = group->node.child; node; node = node->next) { |
| 1420 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | 1447 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
| 1421 struct buddy *b = (struct buddy *)node; | 1448 struct buddy *b = (struct buddy *)node; |
| 1422 if(b->present) | 1449 if(GAIM_BUDDY_IS_ONLINE(b)) |
| 1423 count++; | 1450 count++; |
| 1424 } | 1451 } |
| 1425 } | 1452 } |
| 1426 | 1453 |
| 1427 return count; | 1454 return count; |
