changeset 17308:1277a0f82304

Add untested implementation of msim_incoming_action().
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Tue, 05 Jun 2007 03:20:59 +0000
parents e64bcff3b674
children 25a55b52855a
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Tue Jun 05 02:42:46 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Tue Jun 05 03:20:59 2007 +0000
@@ -721,15 +721,38 @@
  *
  * @return TRUE if successful.
  *
- * INCOMPLETE
+ * UNTESTED
  */
 gboolean msim_incoming_action(MsimSession *session, MsimMessage *msg)
 {
-	/* TODO: process */
-	purple_debug_info("msim", "msim_incoming_action: action <%s> from <%d>\n",
-			msim_msg_get_string(msg, "msg"), msim_msg_get_integer(msg, "f"));
+	gchar *msg_text, *username;
+	gboolean rc;
+
+	msg_text = msim_msg_get_string(msg, "msg");
+	username = msim_msg_get_string(msg, "_username");
+
+	purple_debug_info("msim", "msim_incoming_action: action <%s> from <%d>\n", msg_text, username);
 
-	return FALSE;
+	if (strcmp(msg_text, "%typing%") == 0)
+	{
+		/* TODO: find out if msim repeatedly sends typing messages, so we can give it a timeout. */
+		serv_got_typing(session->gc, username, 0, PURPLE_TYPING);
+		rc = TRUE;
+	} else if (strcmp(msg_text, "%stoptyping%") == 0) {
+		serv_got_typing_stopped(session->gc, username);
+		rc = TRUE;
+	} else {
+		/* TODO: make a function, msim_unrecognized(), that logs all unhandled msgs to file. */
+		purple_debug_info("msim", "msim_incoming_action: for %s, unknown msg %s\n",
+				username, msg_text);
+		rc = FALSE;
+	}
+
+
+	g_free(msg_text);
+	g_free(username);
+
+	return rc;
 }
 
 /**