changeset 19775:0af038b3b7fe

[gaim-migrate @ 17014] add Change the PSM string Currently read from Gaim Status Line Thanks for Chris's Code committed by Ma Yuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Thu, 24 Aug 2006 14:21:43 +0000
parents ea23c4c010cf
children 509383ef25f8
files src/protocols/msn/state.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/state.c	Wed Aug 23 17:01:31 2006 +0000
+++ b/src/protocols/msn/state.c	Thu Aug 24 14:21:43 2006 +0000
@@ -108,19 +108,32 @@
 	return psm;
 }
 
+/* set the MSN's PSM info,Currently Read from the status Line 
+ * Thanks for Cris Code
+ */
 void
 msn_set_psm(MsnSession *session)
 {
+	GaimAccount *account = session->account;
+	GaimPresence *presence;
+	GaimStatus *status;
 	MsnCmdProc *cmdproc;
 	MsnTransaction *trans;
-	char *payload;
+	char *payload,*statusline;
+
+	g_return_if_fail(session != NULL);
+	g_return_if_fail(session->notification != NULL);
 
 	cmdproc = session->notification->cmdproc;
 	/*prepare PSM info*/
 	if(session->psm){
 		g_free(session->psm);
 	}
-	session ->psm = g_strdup(msn_build_psm("Hello",NULL,NULL));
+	/*Get the PSM string from Gaim's Status Line*/
+	presence = gaim_account_get_presence(account);
+	status = gaim_presence_get_active_status(presence);
+	statusline = gaim_status_get_attr_string(status, "message");
+	session ->psm = g_strdup(msn_build_psm(statusline,NULL,NULL));
 	payload = session->psm;
 
 	gaim_debug_info("MaYuan","UUX{%s}\n",payload);
@@ -166,6 +179,7 @@
 
 		g_free(msnobj_str);
 	}
+	msn_set_psm(session);
 }
 
 const char *