diff src/protocols/simple/simple.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 e4a4983752a9
children 91a4cc3ee221
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Tue Jun 20 04:05:56 2006 +0000
+++ b/src/protocols/simple/simple.c	Tue Jun 20 08:17:49 2006 +0000
@@ -1053,7 +1053,7 @@
 	send_sip_response(sip->gc, msg, 200, "OK", NULL);
 }
 
-static int simple_typing(GaimConnection *gc, const char *name, int typing) {
+static unsigned int simple_typing(GaimConnection *gc, const char *name, GaimTypingState state) {
 	struct simple_account_data *sip = gc->proto_data;
 
 	gchar *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@@ -1065,16 +1065,22 @@
 			"<refresh>60</refresh>\n"
 			"</isComposing>";
 	gchar *recv = g_strdup(name);
-	if(typing == GAIM_TYPING) {
+	if(state == GAIM_TYPING) {
 		gchar *msg = g_strdup_printf(xml, "active");
 		simple_send_message(sip, recv, msg, "application/im-iscomposing+xml");
 		g_free(msg);
-	} else {
+	} else /* TODO: Only if (state == GAIM_TYPED) ? */ {
 		gchar *msg = g_strdup_printf(xml, "idle");
 		simple_send_message(sip, recv, msg, "application/im-iscomposing+xml");
 		g_free(msg);
 	}
 	g_free(recv);
+	/*
+	 * TODO: Is this right?  It will cause the core to call
+	 *       serv_send_typing(gc, who, GAIM_TYPING) once every second
+	 *       until the user stops typing.  If that's not desired,
+	 *       then return 0 instead.
+	 */
 	return 1;
 }