diff src/protocols/msn/switchboard.c @ 5316:d5690ed70085

[gaim-migrate @ 5688] Added experimental support for the text/x-clientinfo content-type being discussed on the forums at hypothetic.org. It may change, but for now, I just want to play with it, and I want us to be able to accept the messages. Ignore what it consists of right now. It'll change. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 06 May 2003 08:54:58 +0000
parents e2e53316a21d
children 8523e6797d47
line wrap: on
line diff
--- a/src/protocols/msn/switchboard.c	Tue May 06 08:53:52 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Tue May 06 08:54:58 2003 +0000
@@ -26,6 +26,32 @@
 static GHashTable *switchboard_commands  = NULL;
 static GHashTable *switchboard_msg_types = NULL;
 
+/**************************************************************************
+ * Utility functions
+ **************************************************************************/
+static gboolean
+__send_clientinfo(MsnSwitchBoard *swboard)
+{
+	MsnMessage *msg;
+
+	msg = msn_message_new();
+	msn_message_set_content_type(msg, "text/x-clientinfo");
+	msn_message_set_charset(msg, NULL);
+	msn_message_set_attr(msg, "User-Agent", NULL);
+	msn_message_set_body(msg, MSN_CLIENTINFO);
+
+	if (!msn_switchboard_send_msg(swboard, msg)) {
+		msn_switchboard_destroy(swboard);
+
+		msn_message_destroy(msg);
+
+		return FALSE;
+	}
+
+	msn_message_destroy(msg);
+
+	return TRUE;
+}
 
 /**************************************************************************
  * Catch-all commands
@@ -60,7 +86,7 @@
 	if (swboard->chat != NULL)
 		gaim_chat_add_user(GAIM_CHAT(swboard->chat), gc->username, NULL);
 
-	return TRUE;
+	return __send_clientinfo(swboard);
 }
 
 static gboolean
@@ -159,7 +185,7 @@
 		}
 	}
 
-	return TRUE;
+	return __send_clientinfo(swboard);
 }
 
 static gboolean
@@ -277,6 +303,20 @@
 	return TRUE;
 }
 
+static gboolean
+__clientinfo_msg(MsnServConn *servconn, const MsnMessage *msg)
+{
+	MsnSession *session = servconn->session;
+	MsnUser *user;
+	GHashTable *clientinfo;
+
+	user = msn_user_new(session, servconn->msg_passport, NULL);
+
+	clientinfo = msn_message_get_hashtable_from_body(msg);
+
+	return TRUE;
+}
+
 /**************************************************************************
  * Connect stuff
  **************************************************************************/
@@ -364,6 +404,8 @@
 		msn_servconn_register_msg_type(servconn, "text/plain", __plain_msg);
 		msn_servconn_register_msg_type(servconn, "text/x-msmsgscontrol",
 									   __control_msg);
+		msn_servconn_register_msg_type(servconn, "text/x-clientinfo",
+									   __clientinfo_msg);
 
 		/* Save these for future use. */
 		switchboard_commands  = servconn->commands;