diff libpurple/protocols/gg/gg.c @ 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 bcaa76a01b42
children 66b30e47caec
line wrap: on
line diff
--- 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 */