changeset 17347:aa8e70fa1edc

Add, but do not use, incomplete functions for using typing notifications.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sat, 02 Jun 2007 21:46:22 +0000
parents 73720427b132
children d8903e1320a9
files libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h
diffstat 2 files changed, 57 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Sat Jun 02 20:57:11 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Sat Jun 02 21:46:22 2007 +0000
@@ -736,7 +736,7 @@
 }
 
 /**
- * Handle an incoming message.
+ * Handle an incoming instant message.
  *
  * @param session The session
  * @param msg Message from the server, containing 'f' (userid from) and 'msg'.
@@ -764,6 +764,54 @@
     return 0;
 }
 
+/**
+ * Handle an incoming action message.
+ *
+ * @param session
+ * @param msg
+ *
+ * @return 0
+ *
+ * INCOMPLETE
+ */
+int 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"));
+	return 0;
+}
+
+/** 
+ * Handle when our user starts or stops typing to another user.
+ *
+ * @param gc
+ * @param name The buddy name to which our user is typing to
+ * @param state PURPLE_TYPING, PURPLE_TYPED, PURPLE_NOT_TYPING
+ *
+ * NOT CURRENTLY USED OR COMPLETE
+ */
+unsigned int msim_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
+{
+	char *typing_str;
+
+	switch (state)
+	{	
+		case PURPLE_TYPING: 
+			typing_str = "%typing%"; 
+			break;
+
+		case PURPLE_TYPED:
+		case PURPLE_NOT_TYPING:
+		default:
+			typing_str = "%stoptyping%";
+			break;
+	}
+
+	purple_debug_info("msim", "msim_send_typing(%s): %d\n", name, state);
+	//msim_send_action(name, typing_str);
+	return 0;
+}
 
 /**
  * Process a message. 
@@ -822,6 +870,8 @@
                 return msim_status(session, msg);
             case MSIM_BM_INSTANT:
                 return msim_incoming_im(session, msg);
+			case MSIM_BM_ACTION:
+				return msim_incoming_action(session, msg);
             default:
                 /* Not really an IM, but show it for informational 
                  * purposes during development. */
@@ -851,7 +901,7 @@
 }
 
 /**
- * Process a message reply from the server.
+ * Process a persistance message reply from the server.
  *
  * @param session 
  * @param msg Message reply from server.
@@ -1552,7 +1602,7 @@
     msim_close,        /* close */
     msim_send_im,      /* send_im */
     NULL,              /* set_info */
-    NULL,              /* send_typing */
+    msim_send_typing,  /* send_typing */
     NULL,              /* get_info */
     NULL,              /* set_away */
     NULL,              /* set_idle */
--- a/libpurple/protocols/myspace/myspace.h	Sat Jun 02 20:57:11 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Sat Jun 02 21:46:22 2007 +0000
@@ -163,6 +163,7 @@
 gchar *msim_compute_login_response(gchar nonce[2 * NONCE_SIZE],
 		        gchar *email, gchar *password, guint *response_len);
 
+
 int msim_send_im(PurpleConnection *gc, const char *who,
 		const char *message, PurpleMessageFlags flags);
 int msim_send_im_by_userid(MsimSession *session, const gchar *userid, 
@@ -172,6 +173,9 @@
 void msim_incoming_im_cb(MsimSession *session, MsimMessage *userinfo, 
 		gpointer data);
 int msim_incoming_im(MsimSession *session, MsimMessage *msg);
+int msim_incoming_action(MsimSession *session, MsimMessage *msg);
+
+unsigned int msim_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state);
 
 int msim_process_reply(MsimSession *session, MsimMessage *msg);
 int msim_process(PurpleConnection *gc, MsimMessage *msg);