Mercurial > pidgin.yaz
diff 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 |
line wrap: on
line diff
--- a/src/pounce.c Tue Jun 20 04:05:56 2006 +0000 +++ b/src/pounce.c Tue Jun 20 08:17:49 2006 +0000 @@ -206,6 +206,8 @@ add_event_to_xmlnode(child, "return-from-idle"); if (events & GAIM_POUNCE_TYPING) add_event_to_xmlnode(child, "start-typing"); + if (events & GAIM_POUNCE_TYPED) + add_event_to_xmlnode(child, "typed"); if (events & GAIM_POUNCE_TYPING_STOPPED) add_event_to_xmlnode(child, "stop-typing"); if (events & GAIM_POUNCE_MESSAGE_RECEIVED) @@ -411,7 +413,7 @@ else if (!strcmp(element_name, "option")) { if (!strcmp(data->option_type, "on-away")) data->options |= GAIM_POUNCE_OPTION_AWAY; - + g_free(data->option_type); data->option_type = NULL; } @@ -430,6 +432,8 @@ data->events |= GAIM_POUNCE_IDLE_RETURN; else if (!strcmp(data->event_type, "start-typing")) data->events |= GAIM_POUNCE_TYPING; + else if (!strcmp(data->event_type, "typed")) + data->events |= GAIM_POUNCE_TYPED; else if (!strcmp(data->event_type, "stop-typing")) data->events |= GAIM_POUNCE_TYPING_STOPPED; else if (!strcmp(data->event_type, "message-received")) @@ -1059,10 +1063,16 @@ conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); if (conv != NULL) { + GaimTypingState state; GaimPounceEvent event; - event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING - ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); + state = gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)); + if (state == GAIM_TYPED) + event = GAIM_POUNCE_TYPED; + else if (state == GAIM_NOT_TYPING) + event = GAIM_POUNCE_TYPING_STOPPED; + else + event = GAIM_POUNCE_TYPING; gaim_pounce_execute(account, name, event); } @@ -1105,6 +1115,8 @@ gaim_signal_connect(conv_handle, "buddy-typing", handle, GAIM_CALLBACK(buddy_typing_cb), NULL); + gaim_signal_connect(conv_handle, "buddy-typed", + handle, GAIM_CALLBACK(buddy_typing_cb), NULL); gaim_signal_connect(conv_handle, "buddy-typing-stopped", handle, GAIM_CALLBACK(buddy_typing_cb), NULL);