Mercurial > pidgin.yaz
diff src/protocols/msn/msg.c @ 10345:2e01c503aa4f
[gaim-migrate @ 11556]
Patch 1078151 from Felipe Contreras to fix some more MSN bugs:
"User Dislpay messages, and other less used, did not set
an slpcall, so the callback that should not be called,
was called (in some very special cases)."
...
"Here it goes the real real one, as far as I can tell.
Cleaning + organizing + documentation + hard bug fix = big
patch." -- Felipe Contreras
I also fixed drag-and-drop to conversation window file transfers (which
I had broken when I fixed some other dnd thing), made the debug output
of the autoreconnect plugin more useful, and stopped the message
notification plugin notifying you for messages sent by ignored users.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 11 Dec 2004 20:01:58 +0000 |
parents | f776e117c17b |
children | bcfea6c3d5c9 |
line wrap: on
line diff
--- a/src/protocols/msn/msg.c Sat Dec 11 00:06:06 2004 +0000 +++ b/src/protocols/msn/msg.c Sat Dec 11 20:01:58 2004 +0000 @@ -32,6 +32,10 @@ msg = g_new0(MsnMessage, 1); msg->type = type; +#ifdef MSN_DEBUG_MSG + gaim_debug_info("msn", "message new (%p)(%d)\n", msg, type); +#endif + msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -40,6 +44,78 @@ return msg; } +void +msn_message_destroy(MsnMessage *msg) +{ + g_return_if_fail(msg != NULL); + + if (msg->ref_count > 0) + { + msn_message_unref(msg); + + return; + } + +#ifdef MSN_DEBUG_MSG + gaim_debug_info("msn", "message destroy (%p)\n", msg); +#endif + + if (msg->remote_user != NULL) + g_free(msg->remote_user); + + if (msg->body != NULL) + g_free(msg->body); + + if (msg->content_type != NULL) + g_free(msg->content_type); + + if (msg->charset != NULL) + g_free(msg->charset); + + g_hash_table_destroy(msg->attr_table); + g_list_free(msg->attr_list); + + g_free(msg); +} + +MsnMessage * +msn_message_ref(MsnMessage *msg) +{ + g_return_val_if_fail(msg != NULL, NULL); + + msg->ref_count++; + +#ifdef MSN_DEBUG_MSG + gaim_debug_info("msn", "message ref (%p)[%d]\n", msg, msg->ref_count); +#endif + + return msg; +} + +MsnMessage * +msn_message_unref(MsnMessage *msg) +{ + g_return_val_if_fail(msg != NULL, NULL); + + if (msg->ref_count <= 0) + return NULL; + + msg->ref_count--; + +#ifdef MSN_DEBUG_MSG + gaim_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count); +#endif + + if (msg->ref_count == 0) + { + msn_message_destroy(msg); + + return NULL; + } + + return msg; +} + MsnMessage * msn_message_new_plain(const char *message) { @@ -241,66 +317,6 @@ return msg; } -void -msn_message_destroy(MsnMessage *msg) -{ - g_return_if_fail(msg != NULL); - - if (msg->ref_count > 0) - { - msn_message_unref(msg); - - return; - } - - if (msg->remote_user != NULL) - g_free(msg->remote_user); - - if (msg->body != NULL) - g_free(msg->body); - - if (msg->content_type != NULL) - g_free(msg->content_type); - - if (msg->charset != NULL) - g_free(msg->charset); - - g_hash_table_destroy(msg->attr_table); - g_list_free(msg->attr_list); - - g_free(msg); -} - -MsnMessage * -msn_message_ref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - msg->ref_count++; - - return msg; -} - -MsnMessage * -msn_message_unref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - if (msg->ref_count <= 0) - return NULL; - - msg->ref_count--; - - if (msg->ref_count == 0) - { - msn_message_destroy(msg); - - return NULL; - } - - return msg; -} - char * msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) { @@ -691,7 +707,7 @@ g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); -#ifdef DEBUG_SLP_VERBOSE +#ifdef MSN_DEBUG_SLP_VERBOSE if (body != NULL) { if (text_body)