Mercurial > pidgin
comparison libgaim/protocols/msn/state.c @ 20391:0b0ecee55091
The second msn.tgz from SF Patch #1621854 from Ka-Hing Cheung.
"new version, fixes some crashes because group_id is char * but in some
places it's set to an int (!). skadotnet, I don't understand why you need
`if (!strcmp(type, "MFN")) {` in so many places, so I didn't include most
of them. I also have different versions of some of your fixes because I
already fixed them.
Group manipulations may still not work, at least it's not crashing :-)"
committer: Richard Laager <rlaager@wiktel.com>
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sun, 15 Apr 2007 02:43:47 +0000 |
parents | e354528c4163 |
children |
comparison
equal
deleted
inserted
replaced
20390:d634f88e25d8 | 20391:0b0ecee55091 |
---|---|
37 N_("Available"), | 37 N_("Available"), |
38 N_("Available") | 38 N_("Available") |
39 }; | 39 }; |
40 | 40 |
41 /* Local Function Prototype*/ | 41 /* Local Function Prototype*/ |
42 char * msn_build_psm(char * psmstr,char *mediastr,char * guidstr); | 42 static char *msn_build_psm(const char *psmstr,const char *mediastr, |
43 const char *guidstr); | |
43 | 44 |
44 /* | 45 /* |
45 * WLM media PSM info build prcedure | 46 * WLM media PSM info build prcedure |
46 * | 47 * |
47 * Result can like: | 48 * Result can like: |
48 * <CurrentMedia>\0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0</CurrentMedia>\ | 49 * <CurrentMedia>\0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0</CurrentMedia>\ |
49 * <CurrentMedia>\0Games\01\0Playing {0}\0Game Name\0</CurrentMedia>\ | 50 * <CurrentMedia>\0Games\01\0Playing {0}\0Game Name\0</CurrentMedia>\ |
50 * <CurrentMedia>\0Office\01\0Office Message\0Office App Name\0</CurrentMedia>" | 51 * <CurrentMedia>\0Office\01\0Office Message\0Office App Name\0</CurrentMedia>" |
51 */ | 52 */ |
52 char * | 53 static char * |
53 msn_build_psm(char * psmstr,char *mediastr,char * guidstr) | 54 msn_build_psm(const char *psmstr,const char *mediastr, const char *guidstr) |
54 { | 55 { |
55 xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; | 56 xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; |
56 char *result; | 57 char *result; |
57 int length; | 58 int length; |
58 | 59 |
79 result = xmlnode_to_str(dataNode,&length); | 80 result = xmlnode_to_str(dataNode,&length); |
80 return result; | 81 return result; |
81 } | 82 } |
82 | 83 |
83 /*get the PSM info from the XML string*/ | 84 /*get the PSM info from the XML string*/ |
84 const char * | 85 char * |
85 msn_get_psm(char *xml_str,gsize len) | 86 msn_get_psm(char *xml_str, gsize len) |
86 { | 87 { |
87 xmlnode *payloadNode, *psmNode; | 88 xmlnode *payloadNode, *psmNode; |
88 char *psm_str,*psm; | 89 char *psm_str, *psm; |
89 | 90 |
90 gaim_debug_info("Ma Yuan","msn get PSM\n"); | 91 gaim_debug_info("Ma Yuan","msn get PSM\n"); |
91 payloadNode = xmlnode_from_str(xml_str, len); | 92 payloadNode = xmlnode_from_str(xml_str, len); |
92 if (!payloadNode){ | 93 if (!payloadNode){ |
93 gaim_debug_error("MaYuan","PSM XML parse Error!\n"); | 94 gaim_debug_error("MaYuan","PSM XML parse Error!\n"); |
117 GaimAccount *account = session->account; | 118 GaimAccount *account = session->account; |
118 GaimPresence *presence; | 119 GaimPresence *presence; |
119 GaimStatus *status; | 120 GaimStatus *status; |
120 MsnCmdProc *cmdproc; | 121 MsnCmdProc *cmdproc; |
121 MsnTransaction *trans; | 122 MsnTransaction *trans; |
122 char *payload,*statusline; | 123 char *payload; |
124 const char *statusline; | |
123 | 125 |
124 g_return_if_fail(session != NULL); | 126 g_return_if_fail(session != NULL); |
125 g_return_if_fail(session->notification != NULL); | 127 g_return_if_fail(session->notification != NULL); |
126 | 128 |
127 cmdproc = session->notification->cmdproc; | 129 cmdproc = session->notification->cmdproc; |
131 } | 133 } |
132 /*Get the PSM string from Gaim's Status Line*/ | 134 /*Get the PSM string from Gaim's Status Line*/ |
133 presence = gaim_account_get_presence(account); | 135 presence = gaim_account_get_presence(account); |
134 status = gaim_presence_get_active_status(presence); | 136 status = gaim_presence_get_active_status(presence); |
135 statusline = gaim_status_get_attr_string(status, "message"); | 137 statusline = gaim_status_get_attr_string(status, "message"); |
136 session ->psm = g_strdup(msn_build_psm(statusline,NULL,NULL)); | 138 session ->psm = msn_build_psm(statusline, NULL, NULL); |
137 payload = session->psm; | 139 payload = session->psm; |
138 | 140 |
139 gaim_debug_info("MaYuan","UUX{%s}\n",payload); | 141 gaim_debug_info("MaYuan","UUX{%s}\n",payload); |
140 trans = msn_transaction_new(cmdproc, "UUX","%d",strlen(payload)); | 142 trans = msn_transaction_new(cmdproc, "UUX","%d",strlen(payload)); |
141 msn_transaction_set_payload(trans, payload, strlen(payload)); | 143 msn_transaction_set_payload(trans, payload, strlen(payload)); |