Mercurial > pidgin.yaz
diff src/protocols/msn/msg.c @ 10225:ecf3ce2e2ab1
[gaim-migrate @ 11357]
This is mostly a patch from Felipe Contreras that eliminates MSN switchboard
errors and fixes MSN buddy icon syncronization, with some tweaks by me.
Thank Felipe if it works, blame me if something broke.
I also fixed a couple of text markup escaping things, fixed a glib warning that
was bugging me, fix a rare SILC crash, and make gtkstatusselector.c compile
(but do nothing) with gtk < 2.4
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 21 Nov 2004 17:48:09 +0000 |
parents | 1a91e814e9d8 |
children | 3016b1b32339 |
line wrap: on
line diff
--- a/src/protocols/msn/msg.c Sun Nov 21 06:16:23 2004 +0000 +++ b/src/protocols/msn/msg.c Sun Nov 21 17:48:09 2004 +0000 @@ -25,11 +25,12 @@ #include "msg.h" MsnMessage * -msn_message_new(void) +msn_message_new(MsnMsgType type) { MsnMessage *msg; msg = g_new0(MsnMessage, 1); + msg->type = type; msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -45,11 +46,11 @@ MsnMessage *msg; char *message_cr; - msg = msn_message_new(); + msg = msn_message_new(MSN_MSG_TEXT); msn_message_set_attr(msg, "User-Agent", "Gaim/" VERSION); msn_message_set_content_type(msg, "text/plain"); msn_message_set_charset(msg, "UTF-8"); - msn_message_set_flag(msg, 'N'); + msn_message_set_flag(msg, 'A'); msn_message_set_attr(msg, "X-MMS-IM-Format", "FN=MS%20Sans%20Serif; EF=; CO=0; PF=0"); @@ -65,7 +66,7 @@ { MsnMessage *msg; - msg = msn_message_new(); + msg = msn_message_new(MSN_MSG_SLP); msn_message_set_attr(msg, "User-Agent", NULL); @@ -226,7 +227,7 @@ g_return_val_if_fail(cmd != NULL, NULL); - msg = msn_message_new(); + msg = msn_message_new(MSN_MSG_UNKNOWN); msg->remote_user = g_strdup(cmd->params[0]); /* msg->size = atoi(cmd->params[2]); */ @@ -612,6 +613,20 @@ return table; } +char * +msn_message_to_string(MsnMessage *msg) +{ + size_t body_len; + const char *body; + + g_return_val_if_fail(msg != NULL, NULL); + g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); + + body = msn_message_get_bin_data(msg, &body_len); + + return g_strndup(body, body_len); +} + void msn_message_show_readable(MsnMessage *msg, const char *info, gboolean text_body)