changeset 31881:bcaa76a01b42

Gadu-Gadu: Support receiving typing indications. Fixes #13362. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author quantifier666@gmail.com
date Fri, 25 Mar 2011 11:45:06 +0000
parents df4f9ffb699f
children 1c84c02a26bf
files libpurple/protocols/gg/gg.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg.c	Fri Mar 25 04:56:36 2011 +0000
+++ b/libpurple/protocols/gg/gg.c	Fri Mar 25 11:45:06 2011 +0000
@@ -1603,6 +1603,17 @@
 	}
 }
 
+static void ggp_typing_notification_handler(PurpleConnection *gc, uin_t uin, int length) {
+    gchar *from;
+
+    from = g_strdup_printf("%u", uin);
+    if (length)
+	serv_got_typing(gc, from, 0, PURPLE_TYPING);
+    else
+	serv_got_typing(gc, from, 0, PURPLE_NOT_TYPING);
+    g_free(from);
+}
+
 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond)
 {
 	PurpleConnection *gc = _gc;
@@ -1716,6 +1727,10 @@
 		case GG_EVENT_PUBDIR50_SEARCH_REPLY:
 			ggp_pubdir_reply_handler(gc, ev->event.pubdir50);
 			break;
+		case GG_EVENT_TYPING_NOTIFICATION:
+			ggp_typing_notification_handler(gc, ev->event.typing_notification.uin,
+				ev->event.typing_notification.length);
+			break;
 		default:
 			purple_debug_error("gg",
 				"unsupported event type=%d\n", ev->type);
@@ -2021,7 +2036,8 @@
 	status = purple_presence_get_active_status(presence);
 
 	glp->encoding = GG_ENCODING_UTF8;
-	glp->protocol_features = (GG_FEATURE_STATUS80|GG_FEATURE_DND_FFC);
+	glp->protocol_features = (GG_FEATURE_STATUS80|GG_FEATURE_DND_FFC
+		|GG_FEATURE_TYPING_NOTIFICATION);
 
 	glp->async = 1;
 	glp->status = ggp_to_gg_status(status, &glp->status_descr);