changeset 31900:7db33b356d4a

This patch from kkszysiu and tomkiewicz implements full typing notification support for Gadu-Gadu. Fixes #13590.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Thu, 07 Apr 2011 01:29:17 +0000
parents 1ae16c9b2164
children 66b30e47caec
files ChangeLog libpurple/protocols/gg/gg.c
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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:
--- 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 */