comparison src/blist.c @ 11935:cb73483c9f63

[gaim-migrate @ 14226] Here are buddy-status-changed and buddy-idle-changed signals, to replace buddy-away, buddy-back, buddy-idle, and buddy-unidle. It it now possible to detect when a buddy goes from one away-state to another away-state without coming back in between. I'm not really sure I like how buddy-idle-changed works here, but it felt better to keep it consistent. It currently only fires on idle and unidle and not on just-more-idle, though that's easy to change if we decide plugins might want to know as idle time increases. I think I got all the doxygen and ChangeLog.API stuff, someone yell if I missed something. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 31 Oct 2005 22:02:30 +0000
parents 700ec4523c04
children 717cbb3115bc
comparison
equal deleted inserted replaced
11934:525cf7ecd919 11935:cb73483c9f63
739 gaim_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); 739 gaim_blist_node_set_int(&buddy->node, "last_seen", time(NULL));
740 gaim_signal_emit(gaim_blist_get_handle(), "buddy-signed-off", buddy); 740 gaim_signal_emit(gaim_blist_get_handle(), "buddy-signed-off", buddy);
741 ((GaimContact*)((GaimBlistNode*)buddy)->parent)->online--; 741 ((GaimContact*)((GaimBlistNode*)buddy)->parent)->online--;
742 if (((GaimContact*)((GaimBlistNode*)buddy)->parent)->online == 0) 742 if (((GaimContact*)((GaimBlistNode*)buddy)->parent)->online == 0)
743 ((GaimGroup *)((GaimBlistNode *)buddy)->parent->parent)->online--; 743 ((GaimGroup *)((GaimBlistNode *)buddy)->parent->parent)->online--;
744 } else if (gaim_status_is_available(status) && 744 } else {
745 !gaim_status_is_available(old_status)) { 745 gaim_signal_emit(gaim_blist_get_handle(),
746 gaim_signal_emit(gaim_blist_get_handle(), "buddy-back", buddy); 746 "buddy-status-changed", buddy, old_status,
747 747 status);
748 } else if (!gaim_status_is_available(status) &&
749 gaim_status_is_available(old_status)) {
750 gaim_signal_emit(gaim_blist_get_handle(), "buddy-away", buddy);
751
752 } 748 }
753 749
754 /* 750 /*
755 * This function used to only call the following two functions if one of 751 * This function used to only call the following two functions if one of
756 * the above signals had been triggered, but that's not good, because 752 * the above signals had been triggered, but that's not good, because
2120 } 2116 }
2121 2117
2122 GaimPresence *gaim_buddy_get_presence(const GaimBuddy *buddy) 2118 GaimPresence *gaim_buddy_get_presence(const GaimBuddy *buddy)
2123 { 2119 {
2124 g_return_val_if_fail(buddy != NULL, NULL); 2120 g_return_val_if_fail(buddy != NULL, NULL);
2125 return buddy->presence; 2121 return buddy->presence;
2126 } 2122 }
2127
2128 2123
2129 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy) 2124 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy)
2130 { 2125 {
2131 g_return_val_if_fail(buddy != NULL, NULL); 2126 g_return_val_if_fail(buddy != NULL, NULL);
2132 2127
2546 void 2541 void
2547 gaim_blist_init(void) 2542 gaim_blist_init(void)
2548 { 2543 {
2549 void *handle = gaim_blist_get_handle(); 2544 void *handle = gaim_blist_get_handle();
2550 2545
2551 gaim_signal_register(handle, "buddy-away", 2546 gaim_signal_register(handle, "buddy-status-changed",
2552 gaim_marshal_VOID__POINTER, NULL, 1, 2547 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL,
2553 gaim_value_new(GAIM_TYPE_SUBTYPE, 2548 3,
2554 GAIM_SUBTYPE_BLIST_BUDDY)); 2549 gaim_value_new(GAIM_TYPE_SUBTYPE,
2555 2550 GAIM_SUBTYPE_BLIST_BUDDY),
2556 gaim_signal_register(handle, "buddy-back", 2551 gaim_value_new(GAIM_TYPE_POINTER),
2557 gaim_marshal_VOID__POINTER, NULL, 1, 2552 gaim_value_new(GAIM_TYPE_POINTER));
2558 gaim_value_new(GAIM_TYPE_SUBTYPE, 2553
2559 GAIM_SUBTYPE_BLIST_BUDDY)); 2554 gaim_signal_register(handle, "buddy-idle-changed",
2560 2555 gaim_marshal_VOID__POINTER_INT_INT, NULL,
2561 gaim_signal_register(handle, "buddy-idle", 2556 3,
2562 gaim_marshal_VOID__POINTER, NULL, 1, 2557 gaim_value_new(GAIM_TYPE_SUBTYPE,
2563 gaim_value_new(GAIM_TYPE_SUBTYPE, 2558 GAIM_SUBTYPE_BLIST_BUDDY),
2564 GAIM_SUBTYPE_BLIST_BUDDY)); 2559 gaim_value_new(GAIM_TYPE_INT),
2565 gaim_signal_register(handle, "buddy-unidle", 2560 gaim_value_new(GAIM_TYPE_INT));
2566 gaim_marshal_VOID__POINTER, NULL, 1, 2561
2567 gaim_value_new(GAIM_TYPE_SUBTYPE,
2568 GAIM_SUBTYPE_BLIST_BUDDY));
2569 gaim_signal_register(handle, "buddy-idle-updated",
2570 gaim_marshal_VOID__POINTER, NULL, 1,
2571 gaim_value_new(GAIM_TYPE_SUBTYPE,
2572 GAIM_SUBTYPE_BLIST_BUDDY));
2573 2562
2574 gaim_signal_register(handle, "buddy-signed-on", 2563 gaim_signal_register(handle, "buddy-signed-on",
2575 gaim_marshal_VOID__POINTER, NULL, 1, 2564 gaim_marshal_VOID__POINTER, NULL, 1,
2576 gaim_value_new(GAIM_TYPE_SUBTYPE, 2565 gaim_value_new(GAIM_TYPE_SUBTYPE,
2577 GAIM_SUBTYPE_BLIST_BUDDY)); 2566 GAIM_SUBTYPE_BLIST_BUDDY));