Mercurial > pidgin
comparison src/protocols/msn/msg.c @ 19784:bc30c6270d9f
[gaim-migrate @ 16473]
add the Framework of SOAP request
Now can retrieve the Contact via SOAP Request.
so many bug still exist!
commited by MaYuan<mayuan2006@gmail.com>
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Sun, 09 Jul 2006 16:48:25 +0000 |
parents | 5e2a365af01b |
children | 8b4653986e8e |
comparison
equal
deleted
inserted
replaced
19783:995aea35b05c | 19784:bc30c6270d9f |
---|---|
229 } | 229 } |
230 *end = '\0'; | 230 *end = '\0'; |
231 | 231 |
232 elems = g_strsplit(tmp, "\r\n", 0); | 232 elems = g_strsplit(tmp, "\r\n", 0); |
233 | 233 |
234 for (cur = elems; *cur != NULL; cur++) | 234 for (cur = elems; *cur != NULL; cur++){ |
235 { | |
236 const char *key, *value; | 235 const char *key, *value; |
237 | 236 |
238 tokens = g_strsplit(*cur, ": ", 2); | 237 tokens = g_strsplit(*cur, ": ", 2); |
239 | 238 |
240 key = tokens[0]; | 239 key = tokens[0]; |
241 value = tokens[1]; | 240 value = tokens[1]; |
242 | 241 |
243 if (!strcmp(key, "MIME-Version")) | 242 /*if not MIME content ,then return*/ |
244 { | 243 if (!strcmp(key, "MIME-Version")){ |
245 g_strfreev(tokens); | 244 g_strfreev(tokens); |
246 continue; | 245 continue; |
247 } | 246 } |
248 | 247 |
249 if (!strcmp(key, "Content-Type")) | 248 if (!strcmp(key, "Content-Type")){ |
250 { | |
251 char *charset, *c; | 249 char *charset, *c; |
252 | 250 |
253 if ((c = strchr(value, ';')) != NULL) | 251 if ((c = strchr(value, ';')) != NULL){ |
254 { | 252 if ((charset = strchr(c, '=')) != NULL) { |
255 if ((charset = strchr(c, '=')) != NULL) | |
256 { | |
257 charset++; | 253 charset++; |
258 msn_message_set_charset(msg, charset); | 254 msn_message_set_charset(msg, charset); |
259 } | 255 } |
260 | 256 |
261 *c = '\0'; | 257 *c = '\0'; |
262 } | 258 } |
263 | 259 |
264 msn_message_set_content_type(msg, value); | 260 msn_message_set_content_type(msg, value); |
265 } | 261 }else{ |
266 else | |
267 { | |
268 msn_message_set_attr(msg, key, value); | 262 msn_message_set_attr(msg, key, value); |
269 } | 263 } |
270 | 264 |
271 g_strfreev(tokens); | 265 g_strfreev(tokens); |
272 } | 266 } |
278 | 272 |
279 /* Now we *should* be at the body. */ | 273 /* Now we *should* be at the body. */ |
280 content_type = msn_message_get_content_type(msg); | 274 content_type = msn_message_get_content_type(msg); |
281 | 275 |
282 if (content_type != NULL && | 276 if (content_type != NULL && |
283 !strcmp(content_type, "application/x-msnmsgrp2p")) | 277 !strcmp(content_type, "application/x-msnmsgrp2p")){ |
284 { | |
285 MsnSlpHeader header; | 278 MsnSlpHeader header; |
286 MsnSlpFooter footer; | 279 MsnSlpFooter footer; |
287 int body_len; | 280 int body_len; |
288 | 281 |
289 if (payload_len - (tmp - tmp_base) < sizeof(header)) { | 282 if (payload_len - (tmp - tmp_base) < sizeof(header)) { |
321 if (body_len >= 0) { | 314 if (body_len >= 0) { |
322 memcpy(&footer, tmp, sizeof(footer)); | 315 memcpy(&footer, tmp, sizeof(footer)); |
323 tmp += sizeof(footer); | 316 tmp += sizeof(footer); |
324 msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); | 317 msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); |
325 } | 318 } |
326 } | 319 }else{ |
327 else | |
328 { | |
329 if (payload_len - (tmp - tmp_base) > 0) { | 320 if (payload_len - (tmp - tmp_base) > 0) { |
330 msg->body_len = payload_len - (tmp - tmp_base); | 321 msg->body_len = payload_len - (tmp - tmp_base); |
331 msg->body = g_malloc0(msg->body_len + 1); | 322 msg->body = g_malloc0(msg->body_len + 1); |
332 memcpy(msg->body, tmp, msg->body_len); | 323 memcpy(msg->body, tmp, msg->body_len); |
333 } | 324 } |
783 | 774 |
784 gaim_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); | 775 gaim_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); |
785 | 776 |
786 g_string_free(str, TRUE); | 777 g_string_free(str, TRUE); |
787 } | 778 } |
779 |