Mercurial > pidgin.yaz
comparison finch/gntblist.c @ 21977:05c2ef19e2fa
Blink the buddies that signed on/off recently for six seconds.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 04 Jan 2008 16:45:11 +0000 |
parents | e3e64d1e4869 |
children | 0503cd74cb56 |
comparison
equal
deleted
inserted
replaced
21976:a86c035be695 | 21977:05c2ef19e2fa |
---|---|
81 /* These are the menuitems that get regenerated */ | 81 /* These are the menuitems that get regenerated */ |
82 GntMenuItem *accounts; | 82 GntMenuItem *accounts; |
83 GntMenuItem *plugins; | 83 GntMenuItem *plugins; |
84 } FinchBlist; | 84 } FinchBlist; |
85 | 85 |
86 typedef struct | |
87 { | |
88 gpointer row; /* the row in the GntTree */ | |
89 guint signed_timer; /* used when 'recently' signed on/off */ | |
90 } FinchBlistNode; | |
91 | |
86 typedef enum | 92 typedef enum |
87 { | 93 { |
88 STATUS_PRIMITIVE = 0, | 94 STATUS_PRIMITIVE = 0, |
89 STATUS_SAVED_POPULAR, | 95 STATUS_SAVED_POPULAR, |
90 STATUS_SAVED_ALL, | 96 STATUS_SAVED_ALL, |
129 static int color_available; | 135 static int color_available; |
130 static int color_away; | 136 static int color_away; |
131 static int color_offline; | 137 static int color_offline; |
132 static int color_idle; | 138 static int color_idle; |
133 | 139 |
140 static FinchBlistNode * | |
141 create_finch_blist_node(PurpleBlistNode *node, gpointer row) | |
142 { | |
143 FinchBlistNode *fnode = node->ui_data; | |
144 if (!fnode) { | |
145 fnode = g_new0(FinchBlistNode, 1); | |
146 fnode->signed_timer = 0; | |
147 node->ui_data = fnode; | |
148 } | |
149 fnode->row = row; | |
150 return fnode; | |
151 } | |
152 | |
153 static void | |
154 reset_blist_node_ui_data(PurpleBlistNode *node) | |
155 { | |
156 FinchBlistNode *fnode = node->ui_data; | |
157 if (fnode == NULL) | |
158 return; | |
159 if (fnode->signed_timer) | |
160 purple_timeout_remove(fnode->signed_timer); | |
161 g_free(fnode); | |
162 node->ui_data = NULL; | |
163 } | |
164 | |
134 static int | 165 static int |
135 get_display_color(PurpleBlistNode *node) | 166 get_display_color(PurpleBlistNode *node) |
136 { | 167 { |
137 PurpleBuddy *buddy; | 168 PurpleBuddy *buddy; |
138 int color = 0; | 169 int color = 0; |
155 } | 186 } |
156 | 187 |
157 return color; | 188 return color; |
158 } | 189 } |
159 | 190 |
191 static GntTextFormatFlags | |
192 get_blist_node_flag(PurpleBlistNode *node) | |
193 { | |
194 GntTextFormatFlags flag = 0; | |
195 FinchBlistNode *fnode = node->ui_data; | |
196 | |
197 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) | |
198 flag |= GNT_TEXT_FLAG_BOLD; | |
199 | |
200 if (fnode && fnode->signed_timer) | |
201 flag |= GNT_TEXT_FLAG_BLINK; | |
202 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | |
203 node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact *)node); | |
204 fnode = node->ui_data; | |
205 if (fnode && fnode->signed_timer) | |
206 flag |= GNT_TEXT_FLAG_BLINK; | |
207 } | |
208 | |
209 return flag; | |
210 } | |
211 | |
212 static void | |
213 blist_update_row_flags(PurpleBlistNode *node) | |
214 { | |
215 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, get_blist_node_flag(node)); | |
216 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), node, get_display_color(node)); | |
217 } | |
218 | |
160 static gboolean | 219 static gboolean |
161 is_contact_online(PurpleContact *contact) | 220 is_contact_online(PurpleContact *contact) |
162 { | 221 { |
163 PurpleBlistNode *node; | 222 PurpleBlistNode *node; |
164 for (node = ((PurpleBlistNode*)contact)->child; node; node = node->next) { | 223 for (node = ((PurpleBlistNode*)contact)->child; node; node = node->next) { |
215 | 274 |
216 if (ggblist == NULL || node->ui_data == NULL) | 275 if (ggblist == NULL || node->ui_data == NULL) |
217 return; | 276 return; |
218 | 277 |
219 gnt_tree_remove(GNT_TREE(ggblist->tree), node); | 278 gnt_tree_remove(GNT_TREE(ggblist->tree), node); |
220 node->ui_data = NULL; | 279 reset_blist_node_ui_data(node); |
221 if (ggblist->tagged) | 280 if (ggblist->tagged) |
222 ggblist->tagged = g_list_remove(ggblist->tagged, node); | 281 ggblist->tagged = g_list_remove(ggblist->tagged, node); |
223 | 282 |
224 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 283 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
225 PurpleContact *contact = (PurpleContact*)node->parent; | 284 PurpleContact *contact = (PurpleContact*)node->parent; |
232 PurpleGroup *group = (PurpleGroup*)node->parent; | 291 PurpleGroup *group = (PurpleGroup*)node->parent; |
233 if ((group->currentsize < 1 && !purple_prefs_get_bool(PREF_ROOT "/emptygroups")) || | 292 if ((group->currentsize < 1 && !purple_prefs_get_bool(PREF_ROOT "/emptygroups")) || |
234 (!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group))) | 293 (!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group))) |
235 node_remove(list, node->parent); | 294 node_remove(list, node->parent); |
236 for (node = node->child; node; node = node->next) | 295 for (node = node->child; node; node = node->next) |
237 node->ui_data = NULL; | 296 reset_blist_node_ui_data(node); |
238 } else { | 297 } else { |
239 for (node = node->child; node; node = node->next) | 298 for (node = node->child; node; node = node->next) |
240 node_remove(list, node); | 299 node_remove(list, node); |
241 } | 300 } |
242 | 301 |
259 | 318 |
260 if (node->ui_data != NULL) { | 319 if (node->ui_data != NULL) { |
261 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, | 320 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
262 0, get_display_name(node)); | 321 0, get_display_name(node)); |
263 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); | 322 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); |
264 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), node, get_display_color(node)); | 323 blist_update_row_flags(node); |
265 } | 324 } |
266 | 325 |
267 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 326 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
268 PurpleBuddy *buddy = (PurpleBuddy*)node; | 327 PurpleBuddy *buddy = (PurpleBuddy*)node; |
269 if (purple_account_is_connected(buddy->account) && | 328 if (purple_account_is_connected(buddy->account) && |
270 (PURPLE_BUDDY_IS_ONLINE(buddy) || purple_prefs_get_bool(PREF_ROOT "/showoffline"))) | 329 (PURPLE_BUDDY_IS_ONLINE(buddy) || purple_prefs_get_bool(PREF_ROOT "/showoffline"))) |
271 add_node((PurpleBlistNode*)buddy, list->ui_data); | 330 add_node((PurpleBlistNode*)buddy, list->ui_data); |
272 else | |
273 node_remove(purple_get_blist(), node); | |
274 | 331 |
275 node_update(list, node->parent); | 332 node_update(list, node->parent); |
276 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | 333 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
277 add_chat((PurpleChat *)node, list->ui_data); | 334 add_chat((PurpleChat *)node, list->ui_data); |
278 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 335 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
279 PurpleContact *contact = (PurpleContact*)node; | 336 PurpleContact *contact = (PurpleContact*)node; |
280 if ((!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) || | 337 if ((!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) || |
281 contact->currentsize < 1) | 338 contact->currentsize < 1) |
282 node_remove(purple_get_blist(), node); | 339 /* nothing */; |
283 else { | 340 else { |
284 if (node->ui_data == NULL) { | 341 if (node->ui_data == NULL) { |
285 /* The core seems to expect the UI to add the buddies. */ | 342 /* The core seems to expect the UI to add the buddies. */ |
286 for (node = node->child; node; node = node->next) | 343 for (node = node->child; node; node = node->next) |
287 add_node(node, list->ui_data); | 344 add_node(node, list->ui_data); |
522 add_group(PurpleGroup *group, FinchBlist *ggblist) | 579 add_group(PurpleGroup *group, FinchBlist *ggblist) |
523 { | 580 { |
524 PurpleBlistNode *node = (PurpleBlistNode *)group; | 581 PurpleBlistNode *node = (PurpleBlistNode *)group; |
525 if (node->ui_data) | 582 if (node->ui_data) |
526 return; | 583 return; |
527 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, | 584 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, |
528 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL); | 585 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL)); |
529 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), node, | 586 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), node, |
530 !purple_blist_node_get_bool(node, "collapsed")); | 587 !purple_blist_node_get_bool(node, "collapsed")); |
531 } | 588 } |
532 | 589 |
533 static const char * | 590 static const char * |
537 char status[8] = " "; | 594 char status[8] = " "; |
538 const char *name = NULL; | 595 const char *name = NULL; |
539 | 596 |
540 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) | 597 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
541 node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); /* XXX: this can return NULL?! */ | 598 node = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node); /* XXX: this can return NULL?! */ |
542 | 599 |
543 if (node == NULL) | 600 if (node == NULL) |
544 return NULL; | 601 return NULL; |
545 | 602 |
546 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) | 603 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
547 { | 604 { |
548 PurpleBuddy *buddy = (PurpleBuddy *)node; | 605 PurpleBuddy *buddy = (PurpleBuddy *)node; |
549 PurpleStatusPrimitive prim; | 606 PurpleStatusPrimitive prim; |
550 PurplePresence *presence; | 607 PurplePresence *presence; |
551 PurpleStatus *now; | 608 PurpleStatus *now; |
552 gboolean ascii = gnt_ascii_only(); | 609 gboolean ascii = gnt_ascii_only(); |
553 | 610 |
554 presence = purple_buddy_get_presence(buddy); | 611 presence = purple_buddy_get_presence(buddy); |
555 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) | 612 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) |
556 strncpy(status, ascii ? ":" : "☎", sizeof(status) - 1); | 613 strncpy(status, ascii ? ":" : "☎", sizeof(status) - 1); |
557 else { | 614 else { |
558 now = purple_presence_get_active_status(presence); | 615 now = purple_presence_get_active_status(presence); |
599 return; | 656 return; |
600 | 657 |
601 group = purple_chat_get_group(chat); | 658 group = purple_chat_get_group(chat); |
602 add_node((PurpleBlistNode*)group, ggblist); | 659 add_node((PurpleBlistNode*)group, ggblist); |
603 | 660 |
604 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, | 661 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, |
605 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), | 662 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
606 group, NULL); | 663 group, NULL)); |
607 } | 664 } |
608 | 665 |
609 static void | 666 static void |
610 add_contact(PurpleContact *contact, FinchBlist *ggblist) | 667 add_contact(PurpleContact *contact, FinchBlist *ggblist) |
611 { | 668 { |
621 return; | 678 return; |
622 | 679 |
623 group = (PurpleGroup*)node->parent; | 680 group = (PurpleGroup*)node->parent; |
624 add_node((PurpleBlistNode*)group, ggblist); | 681 add_node((PurpleBlistNode*)group, ggblist); |
625 | 682 |
626 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, | 683 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, |
627 gnt_tree_create_row(GNT_TREE(ggblist->tree), name), | 684 gnt_tree_create_row(GNT_TREE(ggblist->tree), name), |
628 group, NULL); | 685 group, NULL)); |
629 | 686 |
630 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); | 687 gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); |
631 } | 688 } |
632 | 689 |
633 static void | 690 static void |
634 add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) | 691 add_buddy(PurpleBuddy *buddy, FinchBlist *ggblist) |
635 { | 692 { |
636 PurpleContact *contact; | 693 PurpleContact *contact; |
637 PurpleBlistNode *node = (PurpleBlistNode *)buddy; | 694 PurpleBlistNode *node = (PurpleBlistNode *)buddy; |
638 int color = 0; | 695 |
639 if (node->ui_data) | 696 if (node->ui_data) |
640 return; | 697 return; |
641 | 698 |
642 if (!purple_account_is_connected(buddy->account)) | 699 if (!purple_account_is_connected(buddy->account)) |
643 return; | 700 return; |
645 contact = (PurpleContact*)node->parent; | 702 contact = (PurpleContact*)node->parent; |
646 if (!contact) /* When a new buddy is added and show-offline is set */ | 703 if (!contact) /* When a new buddy is added and show-offline is set */ |
647 return; | 704 return; |
648 add_node((PurpleBlistNode*)contact, ggblist); | 705 add_node((PurpleBlistNode*)contact, ggblist); |
649 | 706 |
650 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, | 707 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, |
651 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), | 708 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
652 contact, NULL); | 709 contact, NULL)); |
653 | 710 |
654 color = get_display_color((PurpleBlistNode*)buddy); | 711 blist_update_row_flags((PurpleBlistNode*)buddy); |
655 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), buddy, color); | |
656 if (buddy == purple_contact_get_priority_buddy(contact)) | 712 if (buddy == purple_contact_get_priority_buddy(contact)) |
657 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), contact, color); | 713 blist_update_row_flags((PurpleBlistNode*)contact); |
658 } | 714 } |
659 | 715 |
660 #if 0 | 716 #if 0 |
661 static void | 717 static void |
662 buddy_signed_on(PurpleBuddy *buddy, FinchBlist *ggblist) | 718 buddy_signed_on(PurpleBuddy *buddy, FinchBlist *ggblist) |
1562 } | 1618 } |
1563 | 1619 |
1564 static void | 1620 static void |
1565 update_node_display(PurpleBlistNode *node, FinchBlist *ggblist) | 1621 update_node_display(PurpleBlistNode *node, FinchBlist *ggblist) |
1566 { | 1622 { |
1567 GntTextFormatFlags flag = 0; | 1623 GntTextFormatFlags flag = get_blist_node_flag(node); |
1568 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) | |
1569 flag |= GNT_TEXT_FLAG_BOLD; | |
1570 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, flag); | 1624 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), node, flag); |
1571 } | 1625 } |
1572 | 1626 |
1573 static void | 1627 static void |
1574 update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist) | 1628 update_buddy_display(PurpleBuddy *buddy, FinchBlist *ggblist) |
1575 { | 1629 { |
1576 PurpleContact *contact; | 1630 PurpleContact *contact; |
1577 GntTextFormatFlags bflag = 0, cflag = 0; | |
1578 int color = 0; | |
1579 | 1631 |
1580 contact = purple_buddy_get_contact(buddy); | 1632 contact = purple_buddy_get_contact(buddy); |
1581 | 1633 |
1582 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy)); | 1634 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy)); |
1583 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact)); | 1635 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact)); |
1584 | 1636 |
1585 if (ggblist->tagged && g_list_find(ggblist->tagged, buddy)) | 1637 blist_update_row_flags((PurpleBlistNode *)buddy); |
1586 bflag |= GNT_TEXT_FLAG_BOLD; | 1638 if (buddy == purple_contact_get_priority_buddy(contact)) |
1587 if (ggblist->tagged && g_list_find(ggblist->tagged, contact)) | 1639 blist_update_row_flags((PurpleBlistNode *)contact); |
1588 cflag |= GNT_TEXT_FLAG_BOLD; | |
1589 | 1640 |
1590 if (ggblist->tnode == (PurpleBlistNode*)buddy) | 1641 if (ggblist->tnode == (PurpleBlistNode*)buddy) |
1591 draw_tooltip(ggblist); | 1642 draw_tooltip(ggblist); |
1592 | |
1593 color = get_display_color((PurpleBlistNode*)buddy); | |
1594 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), buddy, color); | |
1595 if (buddy == purple_contact_get_priority_buddy(contact)) | |
1596 gnt_tree_set_row_color(GNT_TREE(ggblist->tree), contact, color); | |
1597 | |
1598 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, bflag); | |
1599 if (buddy == purple_contact_get_priority_buddy(contact)) | |
1600 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, cflag); | |
1601 | |
1602 if (buddy != purple_contact_get_priority_buddy(contact)) | |
1603 update_buddy_display(purple_contact_get_priority_buddy(contact), ggblist); | |
1604 } | 1643 } |
1605 | 1644 |
1606 static void | 1645 static void |
1607 buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *now, FinchBlist *ggblist) | 1646 buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *now, FinchBlist *ggblist) |
1608 { | 1647 { |
1647 purple_signals_disconnect_by_handle(finch_blist_get_handle()); | 1686 purple_signals_disconnect_by_handle(finch_blist_get_handle()); |
1648 purple_get_blist()->ui_data = NULL; | 1687 purple_get_blist()->ui_data = NULL; |
1649 | 1688 |
1650 node = purple_blist_get_root(); | 1689 node = purple_blist_get_root(); |
1651 while (node) { | 1690 while (node) { |
1652 node->ui_data = NULL; | 1691 reset_blist_node_ui_data(node); |
1653 node = purple_blist_node_next(node, TRUE); | 1692 node = purple_blist_node_next(node, TRUE); |
1654 } | 1693 } |
1655 | 1694 |
1656 if (ggblist->typing) | 1695 if (ggblist->typing) |
1657 g_source_remove(ggblist->typing); | 1696 g_source_remove(ggblist->typing); |
1760 | 1799 |
1761 sel = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)); | 1800 sel = gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)); |
1762 gnt_tree_remove_all(GNT_TREE(ggblist->tree)); | 1801 gnt_tree_remove_all(GNT_TREE(ggblist->tree)); |
1763 node = purple_blist_get_root(); | 1802 node = purple_blist_get_root(); |
1764 for (; node; node = purple_blist_node_next(node, TRUE)) | 1803 for (; node; node = purple_blist_node_next(node, TRUE)) |
1765 node->ui_data = NULL; | 1804 reset_blist_node_ui_data(node); |
1766 populate_buddylist(); | 1805 populate_buddylist(); |
1767 gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel); | 1806 gnt_tree_set_selected(GNT_TREE(ggblist->tree), sel); |
1768 draw_tooltip(ggblist); | 1807 draw_tooltip(ggblist); |
1769 } | 1808 } |
1770 | 1809 |
2120 action, (GDestroyNotify)purple_plugin_action_free); | 2159 action, (GDestroyNotify)purple_plugin_action_free); |
2121 } | 2160 } |
2122 } | 2161 } |
2123 } | 2162 } |
2124 | 2163 |
2164 static gboolean | |
2165 buddy_recent_signed_on_off(gpointer data) | |
2166 { | |
2167 PurpleBlistNode *node = data; | |
2168 FinchBlistNode *fnode = node->ui_data; | |
2169 PurpleBuddy *buddy = (PurpleBuddy*)node; | |
2170 | |
2171 purple_timeout_remove(fnode->signed_timer); | |
2172 fnode->signed_timer = 0; | |
2173 | |
2174 if (!purple_account_is_connected(buddy->account) || | |
2175 (!PURPLE_BUDDY_IS_ONLINE(buddy) && !purple_prefs_get_bool(PREF_ROOT "/showoffline"))) { | |
2176 node_remove(purple_get_blist(), node); | |
2177 } else { | |
2178 update_node_display(node, ggblist); | |
2179 if (node->parent && PURPLE_BLIST_NODE_IS_CONTACT(node->parent)) | |
2180 update_node_display(node->parent, ggblist); | |
2181 } | |
2182 | |
2183 return FALSE; | |
2184 } | |
2185 | |
2186 static gboolean | |
2187 buddy_signed_on_off_cb(gpointer data) | |
2188 { | |
2189 PurpleBlistNode *node = data; | |
2190 FinchBlistNode *fnode = node->ui_data; | |
2191 if (!ggblist || !fnode) | |
2192 return FALSE; | |
2193 | |
2194 if (fnode->signed_timer) | |
2195 purple_timeout_remove(fnode->signed_timer); | |
2196 fnode->signed_timer = purple_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data); | |
2197 update_node_display(node, ggblist); | |
2198 if (node->parent && PURPLE_BLIST_NODE_IS_CONTACT(node->parent)) | |
2199 update_node_display(node->parent, ggblist); | |
2200 return FALSE; | |
2201 } | |
2202 | |
2203 static void | |
2204 buddy_signed_on_off(PurpleBuddy* buddy, gpointer null) | |
2205 { | |
2206 g_idle_add(buddy_signed_on_off_cb, buddy); | |
2207 } | |
2208 | |
2125 static void | 2209 static void |
2126 reconstruct_plugins_menu() | 2210 reconstruct_plugins_menu() |
2127 { | 2211 { |
2128 GntWidget *sub; | 2212 GntWidget *sub; |
2129 GntMenuItem *plg; | 2213 GntMenuItem *plg; |
2511 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", finch_blist_get_handle(), | 2595 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", finch_blist_get_handle(), |
2512 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | 2596 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); |
2513 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", finch_blist_get_handle(), | 2597 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", finch_blist_get_handle(), |
2514 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); | 2598 PURPLE_CALLBACK(reconstruct_plugins_menu), NULL); |
2515 | 2599 |
2600 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_blist_get_handle(), | |
2601 PURPLE_CALLBACK(buddy_signed_on_off), ggblist); | |
2602 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_blist_get_handle(), | |
2603 PURPLE_CALLBACK(buddy_signed_on_off), ggblist); | |
2604 | |
2516 #if 0 | 2605 #if 0 |
2517 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", finch_blist_get_handle(), | |
2518 PURPLE_CALLBACK(buddy_signed_on), ggblist); | |
2519 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", finch_blist_get_handle(), | |
2520 PURPLE_CALLBACK(buddy_signed_off), ggblist); | |
2521 | |
2522 /* These I plan to use to indicate unread-messages etc. */ | 2606 /* These I plan to use to indicate unread-messages etc. */ |
2523 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", finch_blist_get_handle(), | 2607 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", finch_blist_get_handle(), |
2524 PURPLE_CALLBACK(received_im_msg), list); | 2608 PURPLE_CALLBACK(received_im_msg), list); |
2525 purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", finch_blist_get_handle(), | 2609 purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", finch_blist_get_handle(), |
2526 PURPLE_CALLBACK(sent_im_msg), NULL); | 2610 PURPLE_CALLBACK(sent_im_msg), NULL); |