# HG changeset patch # User John Bailey # Date 1302139757 0 # Node ID 7db33b356d4aad80c717e97ef2acf1c9722c34e1 # Parent 1ae16c9b2164fe4836fb0112b3e5c67583276cce This patch from kkszysiu and tomkiewicz implements full typing notification support for Gadu-Gadu. Fixes #13590. diff -r 1ae16c9b2164 -r 7db33b356d4a ChangeLog --- a/ChangeLog Wed Apr 06 13:36:26 2011 +0000 +++ b/ChangeLog Thu Apr 07 01:29:17 2011 +0000 @@ -30,7 +30,8 @@ images. (Tomasz Wasilczyk) (#13554) * Fix sending inline images to remote users, don't crash when trying to send large (> 256kB) images. (Tomasz Wasilczyk) (#13580) - * Support incoming typing notifications. (Jan Zachorowski) (#13362) + * Support typing notifications. (Jan Zachorowski, Tomasz Wasilczyk, + Krzysztof Klinikowski) (#13362, #13590) * Require libgadu 1.10.1 to avoid using internal libgadu. ICQ: diff -r 1ae16c9b2164 -r 7db33b356d4a libpurple/protocols/gg/gg.c --- a/libpurple/protocols/gg/gg.c Wed Apr 06 13:36:26 2011 +0000 +++ b/libpurple/protocols/gg/gg.c Thu Apr 07 01:29:17 2011 +0000 @@ -1610,7 +1610,7 @@ if (length) serv_got_typing(gc, from, 0, PURPLE_TYPING); else - serv_got_typing(gc, from, 0, PURPLE_NOT_TYPING); + serv_got_typing_stopped(gc, from); g_free(from); } @@ -2241,6 +2241,26 @@ return ret; } +static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) +{ + int dummy_length; // we don't send real length of typed message + + if (state == PURPLE_TYPED) // not supported + return 1; + + if (state == PURPLE_TYPING) + dummy_length = (int)g_random_int(); + else // PURPLE_NOT_TYPING + dummy_length = 0; + + gg_typing_notification( + ((GGPInfo*)gc->proto_data)->session, + ggp_str_to_uin(name), + dummy_length); + + return 1; // wait 1 second before another notification +} + static void ggp_get_info(PurpleConnection *gc, const char *name) { GGPInfo *info = gc->proto_data; @@ -2546,7 +2566,7 @@ ggp_close, /* close */ ggp_send_im, /* send_im */ NULL, /* set_info */ - NULL, /* send_typing */ + ggp_send_typing, /* send_typing */ ggp_get_info, /* get_info */ ggp_set_status, /* set_away */ NULL, /* set_idle */