Mercurial > pidgin.yaz
comparison src/pounce.c @ 13842:a9ff4499d9ce
[gaim-migrate @ 16295]
Hopefully improve the typing notification code so it's a lot easier
to understand. This also creates a distinction between the signals
emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages
(by adding a gaim-typed signal). And the gaim-not-typing signal
should work in all cases.
Most of this is stuff I changed last week during work, thanks to
Meebo
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 20 Jun 2006 08:17:49 +0000 |
parents | dd1996c9f3b6 |
children | 8bda65b88e49 |
comparison
equal
deleted
inserted
replaced
13841:f3d4a9902ead | 13842:a9ff4499d9ce |
---|---|
204 add_event_to_xmlnode(child, "idle"); | 204 add_event_to_xmlnode(child, "idle"); |
205 if (events & GAIM_POUNCE_IDLE_RETURN) | 205 if (events & GAIM_POUNCE_IDLE_RETURN) |
206 add_event_to_xmlnode(child, "return-from-idle"); | 206 add_event_to_xmlnode(child, "return-from-idle"); |
207 if (events & GAIM_POUNCE_TYPING) | 207 if (events & GAIM_POUNCE_TYPING) |
208 add_event_to_xmlnode(child, "start-typing"); | 208 add_event_to_xmlnode(child, "start-typing"); |
209 if (events & GAIM_POUNCE_TYPED) | |
210 add_event_to_xmlnode(child, "typed"); | |
209 if (events & GAIM_POUNCE_TYPING_STOPPED) | 211 if (events & GAIM_POUNCE_TYPING_STOPPED) |
210 add_event_to_xmlnode(child, "stop-typing"); | 212 add_event_to_xmlnode(child, "stop-typing"); |
211 if (events & GAIM_POUNCE_MESSAGE_RECEIVED) | 213 if (events & GAIM_POUNCE_MESSAGE_RECEIVED) |
212 add_event_to_xmlnode(child, "message-received"); | 214 add_event_to_xmlnode(child, "message-received"); |
213 | 215 |
409 data->pouncee = g_strdup(buffer); | 411 data->pouncee = g_strdup(buffer); |
410 } | 412 } |
411 else if (!strcmp(element_name, "option")) { | 413 else if (!strcmp(element_name, "option")) { |
412 if (!strcmp(data->option_type, "on-away")) | 414 if (!strcmp(data->option_type, "on-away")) |
413 data->options |= GAIM_POUNCE_OPTION_AWAY; | 415 data->options |= GAIM_POUNCE_OPTION_AWAY; |
414 | 416 |
415 g_free(data->option_type); | 417 g_free(data->option_type); |
416 data->option_type = NULL; | 418 data->option_type = NULL; |
417 } | 419 } |
418 else if (!strcmp(element_name, "event")) { | 420 else if (!strcmp(element_name, "event")) { |
419 if (!strcmp(data->event_type, "sign-on")) | 421 if (!strcmp(data->event_type, "sign-on")) |
428 data->events |= GAIM_POUNCE_IDLE; | 430 data->events |= GAIM_POUNCE_IDLE; |
429 else if (!strcmp(data->event_type, "return-from-idle")) | 431 else if (!strcmp(data->event_type, "return-from-idle")) |
430 data->events |= GAIM_POUNCE_IDLE_RETURN; | 432 data->events |= GAIM_POUNCE_IDLE_RETURN; |
431 else if (!strcmp(data->event_type, "start-typing")) | 433 else if (!strcmp(data->event_type, "start-typing")) |
432 data->events |= GAIM_POUNCE_TYPING; | 434 data->events |= GAIM_POUNCE_TYPING; |
435 else if (!strcmp(data->event_type, "typed")) | |
436 data->events |= GAIM_POUNCE_TYPED; | |
433 else if (!strcmp(data->event_type, "stop-typing")) | 437 else if (!strcmp(data->event_type, "stop-typing")) |
434 data->events |= GAIM_POUNCE_TYPING_STOPPED; | 438 data->events |= GAIM_POUNCE_TYPING_STOPPED; |
435 else if (!strcmp(data->event_type, "message-received")) | 439 else if (!strcmp(data->event_type, "message-received")) |
436 data->events |= GAIM_POUNCE_MESSAGE_RECEIVED; | 440 data->events |= GAIM_POUNCE_MESSAGE_RECEIVED; |
437 | 441 |
1057 GaimConversation *conv; | 1061 GaimConversation *conv; |
1058 | 1062 |
1059 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); | 1063 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); |
1060 if (conv != NULL) | 1064 if (conv != NULL) |
1061 { | 1065 { |
1066 GaimTypingState state; | |
1062 GaimPounceEvent event; | 1067 GaimPounceEvent event; |
1063 | 1068 |
1064 event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING | 1069 state = gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)); |
1065 ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); | 1070 if (state == GAIM_TYPED) |
1071 event = GAIM_POUNCE_TYPED; | |
1072 else if (state == GAIM_NOT_TYPING) | |
1073 event = GAIM_POUNCE_TYPING_STOPPED; | |
1074 else | |
1075 event = GAIM_POUNCE_TYPING; | |
1066 | 1076 |
1067 gaim_pounce_execute(account, name, event); | 1077 gaim_pounce_execute(account, name, event); |
1068 } | 1078 } |
1069 } | 1079 } |
1070 | 1080 |
1103 handle, GAIM_CALLBACK(buddy_state_cb), | 1113 handle, GAIM_CALLBACK(buddy_state_cb), |
1104 GINT_TO_POINTER(GAIM_POUNCE_SIGNOFF)); | 1114 GINT_TO_POINTER(GAIM_POUNCE_SIGNOFF)); |
1105 | 1115 |
1106 gaim_signal_connect(conv_handle, "buddy-typing", | 1116 gaim_signal_connect(conv_handle, "buddy-typing", |
1107 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); | 1117 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); |
1118 gaim_signal_connect(conv_handle, "buddy-typed", | |
1119 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); | |
1108 gaim_signal_connect(conv_handle, "buddy-typing-stopped", | 1120 gaim_signal_connect(conv_handle, "buddy-typing-stopped", |
1109 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); | 1121 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); |
1110 | 1122 |
1111 gaim_signal_connect(conv_handle, "received-im-msg", | 1123 gaim_signal_connect(conv_handle, "received-im-msg", |
1112 handle, GAIM_CALLBACK(received_message_cb), NULL); | 1124 handle, GAIM_CALLBACK(received_message_cb), NULL); |