Mercurial > pidgin.yaz
comparison src/pounce.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 | c9bd6decdec4 |
children | 06065a4847ff |
comparison
equal
deleted
inserted
replaced
11934:525cf7ecd919 | 11935:cb73483c9f63 |
---|---|
947 { | 947 { |
948 gaim_pounce_execute(buddy->account, buddy->name, event); | 948 gaim_pounce_execute(buddy->account, buddy->name, event); |
949 } | 949 } |
950 | 950 |
951 static void | 951 static void |
952 buddy_status_changed_cb(GaimBuddy *buddy, GaimStatus *old_status, | |
953 GaimStatus *status) | |
954 { | |
955 gboolean old_available, available; | |
956 | |
957 available = gaim_status_is_available(status); | |
958 old_available = gaim_status_is_available(old_status); | |
959 | |
960 if (available && !old_available) | |
961 gaim_pounce_execute(buddy->account, buddy->name, | |
962 GAIM_POUNCE_AWAY_RETURN); | |
963 else if (!available && old_available) | |
964 gaim_pounce_execute(buddy->account, buddy->name, | |
965 GAIM_POUNCE_AWAY); | |
966 } | |
967 | |
968 static void | |
969 buddy_idle_changed_cb(GaimBuddy *buddy, gboolean old_idle, gboolean idle) | |
970 { | |
971 if (idle && !old_idle) | |
972 gaim_pounce_execute(buddy->account, buddy->name, | |
973 GAIM_POUNCE_IDLE); | |
974 else if (!idle && old_idle) | |
975 gaim_pounce_execute(buddy->account, buddy->name, | |
976 GAIM_POUNCE_IDLE_RETURN); | |
977 } | |
978 | |
979 static void | |
952 buddy_typing_cb(GaimAccount *account, const char *name, void *data) | 980 buddy_typing_cb(GaimAccount *account, const char *name, void *data) |
953 { | 981 { |
954 GaimConversation *conv; | 982 GaimConversation *conv; |
955 | 983 |
956 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); | 984 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); |
981 void *conv_handle = gaim_conversations_get_handle(); | 1009 void *conv_handle = gaim_conversations_get_handle(); |
982 | 1010 |
983 pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, | 1011 pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, |
984 g_free, free_pounce_handler); | 1012 g_free, free_pounce_handler); |
985 | 1013 |
986 gaim_signal_connect(blist_handle, "buddy-idle", | 1014 gaim_signal_connect(blist_handle, "buddy-idle-changed", |
987 handle, GAIM_CALLBACK(buddy_state_cb), | 1015 handle, GAIM_CALLBACK(buddy_idle_changed_cb), NULL); |
988 GINT_TO_POINTER(GAIM_POUNCE_IDLE)); | 1016 gaim_signal_connect(blist_handle, "buddy-status-changed", |
989 gaim_signal_connect(blist_handle, "buddy-unidle", | 1017 handle, GAIM_CALLBACK(buddy_status_changed_cb), NULL); |
990 handle, GAIM_CALLBACK(buddy_state_cb), | |
991 GINT_TO_POINTER(GAIM_POUNCE_IDLE_RETURN)); | |
992 gaim_signal_connect(blist_handle, "buddy-away", | |
993 handle, GAIM_CALLBACK(buddy_state_cb), | |
994 GINT_TO_POINTER(GAIM_POUNCE_AWAY)); | |
995 gaim_signal_connect(blist_handle, "buddy-back", | |
996 handle, GAIM_CALLBACK(buddy_state_cb), | |
997 GINT_TO_POINTER(GAIM_POUNCE_AWAY_RETURN)); | |
998 gaim_signal_connect(blist_handle, "buddy-signed-on", | 1018 gaim_signal_connect(blist_handle, "buddy-signed-on", |
999 handle, GAIM_CALLBACK(buddy_state_cb), | 1019 handle, GAIM_CALLBACK(buddy_state_cb), |
1000 GINT_TO_POINTER(GAIM_POUNCE_SIGNON)); | 1020 GINT_TO_POINTER(GAIM_POUNCE_SIGNON)); |
1001 gaim_signal_connect(blist_handle, "buddy-signed-off", | 1021 gaim_signal_connect(blist_handle, "buddy-signed-off", |
1002 handle, GAIM_CALLBACK(buddy_state_cb), | 1022 handle, GAIM_CALLBACK(buddy_state_cb), |