comparison src/protocols/msn/msg.c @ 9198:ab6636c5a136

[gaim-migrate @ 9993] Updated all the copyright headers for all the *.[ch] files -- all 63. No fun, but I receive great satisfaction in knowing that you all have to recompile this, again. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 03:42:55 +0000
parents 502707ca1836
children 1843023b8189
comparison
equal deleted inserted replaced
9197:ec417d2f9666 9198:ab6636c5a136
1 /** 1 /**
2 * @file msg.c Message functions 2 * @file msg.c Message functions
3 * 3 *
4 * gaim 4 * gaim
5 * 5 *
6 * Copyright (C) 2003-2004 Christian Hammond <chipx86@gnupdate.org> 6 * Gaim is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
7 * 9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 13 * (at your option) any later version.
94 msg->msnslp_header.length = GUINT32_FROM_LE(header.length); 96 msg->msnslp_header.length = GUINT32_FROM_LE(header.length);
95 msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); 97 msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags);
96 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); 98 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id);
97 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); 99 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id);
98 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); 100 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size);
99 101
100 /* Import the body. */ 102 /* Import the body. */
101 /* msg->body_len = msg->msnslp_header.length; */ 103 /* msg->body_len = msg->msnslp_header.length; */
102 msg->body_len = len - (tmp - body); 104 msg->body_len = len - (tmp - body);
103 105
104 if (msg->body_len > 0) 106 if (msg->body_len > 0)
105 msg->body = g_memdup(tmp, msg->body_len); 107 msg->body = g_memdup(tmp, msg->body_len);
106 108
107 tmp += msg->body_len; 109 tmp += msg->body_len;
108 } 110 }
194 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); 196 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id);
195 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); 197 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size);
196 198
197 /* Import the body. */ 199 /* Import the body. */
198 msg->body_len = payload_len - (tmp - tmp_base) - sizeof(footer); 200 msg->body_len = payload_len - (tmp - tmp_base) - sizeof(footer);
199 201
200 if (msg->body_len > 0) 202 if (msg->body_len > 0)
201 msg->body = g_memdup(tmp, msg->body_len); 203 msg->body = g_memdup(tmp, msg->body_len);
202 204
203 tmp += msg->body_len; 205 tmp += msg->body_len;
204 206
281 if (msg->ref_count <= 0) 283 if (msg->ref_count <= 0)
282 return NULL; 284 return NULL;
283 285
284 msg->ref_count--; 286 msg->ref_count--;
285 287
286 if (msg->ref_count == 0) 288 if (msg->ref_count == 0)
287 { 289 {
288 msn_message_destroy(msg); 290 msn_message_destroy(msg);
289 291
290 return NULL; 292 return NULL;
291 } 293 }
329 tmp += body_len; 331 tmp += body_len;
330 } 332 }
331 333
332 if (ret_size != NULL) 334 if (ret_size != NULL)
333 *ret_size = tmp - base; 335 *ret_size = tmp - base;
334 336
335 return base; 337 return base;
336 } 338 }
337 339
338 char * 340 char *
339 msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) 341 msn_message_gen_payload(MsnMessage *msg, size_t *ret_size)
649 651
650 g_string_append_printf(str, "%s: %s\r\n", key, value); 652 g_string_append_printf(str, "%s: %s\r\n", key, value);
651 } 653 }
652 654
653 g_string_append(str, "\r\n"); 655 g_string_append(str, "\r\n");
654 656
655 body = msn_message_get_bin_data(msg, &body_len); 657 body = msn_message_get_bin_data(msg, &body_len);
656 658
657 if (msg->msnslp_message) 659 if (msg->msnslp_message)
658 { 660 {
659 g_string_append_printf(str, "%u ", msg->msnslp_header.session_id); 661 g_string_append_printf(str, "%u ", msg->msnslp_header.session_id);
692 g_string_append(str, "\r\n"); 694 g_string_append(str, "\r\n");
693 } 695 }
694 g_string_append(str, "\r\n"); 696 g_string_append(str, "\r\n");
695 } 697 }
696 } 698 }
697 699
698 g_string_append_printf(str, "%u ", msg->msnslp_footer.value); 700 g_string_append_printf(str, "%u ", msg->msnslp_footer.value);
699 g_string_append(str, "\r\n"); 701 g_string_append(str, "\r\n");
700 } 702 }
701 else 703 else
702 { 704 {
706 g_string_append(str, "\r\n"); 708 g_string_append(str, "\r\n");
707 } 709 }
708 } 710 }
709 711
710 gaim_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); 712 gaim_debug_info("msn", "Message %s:\n{%s}\n", info, str->str);
711 713
712 g_string_free(str, TRUE); 714 g_string_free(str, TRUE);
713 } 715 }