cpw.qulogic.msnp16: 9fef6a10: Support receiving UBN and sending UUN, w...

qulogic at pidgin.im qulogic at pidgin.im
Tue Dec 15 04:02:12 EST 2009


-----------------------------------------------------------------
Revision: 9fef6a1023cfc012f2c5dc46dfa21df2e0491547
Ancestor: ea447a3b0bf88e871a71c1a9e011267d0d657ba5
Author: qulogic at pidgin.im
Date: 2009-12-15T08:12:52
Branch: im.pidgin.cpw.qulogic.msnp16
URL: http://d.pidgin.im/viewmtn/revision/info/9fef6a1023cfc012f2c5dc46dfa21df2e0491547

Modified files:
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/notification.h

ChangeLog: 

Support receiving UBN and sending UUN, which seem to have been added way
back in MSNP13 for shared folders and stuff, but is used for a few things
in MSNP16 now. Thanks to ZoRaNaX's list of stuff for this (even though it's
old).

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/notification.c	b52231e2b5d104e7863c831c5e4101044cbf6613
+++ libpurple/protocols/msn/notification.c	6e4e2cf50a80efcbf789b2c98d98f0632cae5bcc
@@ -1902,6 +1902,61 @@ void msn_notification_send_uux_private_e
 	g_free(payload);
 }
 
+static void
+ubn_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
+			 size_t len)
+{
+	/* Do Nothing, right now. */
+	if (payload != NULL)
+		purple_debug_info("msn", "UBN payload:\n%s\n", payload);
+}
+
+static void
+ubn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+{
+	purple_debug_misc("msn", "UBN received from %s.\n", cmd->params[0]);
+	cmdproc->last_cmd->payload_cb  = ubn_cmd_post;
+	cmd->payload_len = atoi(cmd->params[2]);
+}
+
+static void
+uun_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
+			 size_t len)
+{
+	/* Do Nothing, right now. */
+	if (payload != NULL)
+		purple_debug_info("msn", "UUN payload:\n%s\n", payload);
+}
+
+static void
+uun_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
+{
+	if (strcmp(cmd->params[1], "OK") != 0) {
+		purple_debug_misc("msn", "UUN received.\n");
+		cmdproc->last_cmd->payload_cb = uun_cmd_post;
+		cmd->payload_len = atoi(cmd->params[1]);
+	}
+	else
+		purple_debug_misc("msn", "UUN OK received.\n");
+}
+
+void
+msn_notification_send_uun(MsnSession *session, const char *user,
+                          MsnUnifiedNotificationType type, const char *payload)
+{
+	MsnTransaction *trans;
+	MsnCmdProc *cmdproc;
+	size_t len = strlen(payload);
+
+	cmdproc = session->notification->cmdproc;
+	purple_debug_misc("msn", "Sending UUN command %d to %s with payload: %s\n",
+	                  type, user, payload);
+	trans = msn_transaction_new(cmdproc, "UUN", "%s %d %" G_GSIZE_FORMAT,
+	                            user, type, len);
+	msn_transaction_set_payload(trans, payload, len);
+	msn_cmdproc_send_trans(cmdproc, trans);
+}
+
 /**************************************************************************
  * Message Types
  **************************************************************************/
@@ -2358,6 +2413,9 @@ msn_notification_init(void)
 	msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd);
 	msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd);
 
+	msn_table_add_cmd(cbs_table, NULL, "UBN", ubn_cmd);
+	msn_table_add_cmd(cbs_table, NULL, "UUN", uun_cmd);
+
 	msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd);
 
 	msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd);
============================================================
--- libpurple/protocols/msn/notification.h	b550588da37b9e73ba6766554ab245ee896f67a8
+++ libpurple/protocols/msn/notification.h	04735b220807dcb0924d3eab5f60d61697973651
@@ -60,6 +60,15 @@ typedef void (*MsnFqyCb)(MsnSession *ses
 
 typedef void (*MsnFqyCb)(MsnSession *session, const char *passport, MsnNetwork network, gpointer data);
 
+/* Type used for msn_notification_send_uun */
+typedef enum {
+	MSN_UNIFIED_NOTIFICATION_SHARED_FOLDERS = 1,
+	MSN_UNIFIED_NOTIFICATION_UNKNOWN1 = 2,
+	MSN_UNIFIED_NOTIFICATION_P2P = 3,
+	MSN_UNIFIED_NOTIFICATION_MPOP = 4
+
+} MsnUnifiedNotificationType;
+
 #include "state.h"
 void uum_send_msg(MsnSession *session,MsnMessage *msg);
 
@@ -88,6 +97,11 @@ void msn_notification_send_uux_private_e
 
 void msn_notification_send_uux_private_endpointdata(MsnSession *session);
 
+void msn_notification_send_uun(MsnSession *session,
+                               const char *user,
+                               MsnUnifiedNotificationType type,
+                               const char *payload);
+
 /**
  * Closes a notification.
  *


More information about the Commits mailing list