Mercurial > pidgin.yaz
changeset 14463:7df4ab213577
[gaim-migrate @ 17177]
commit part of 1547648
commit some jabber stuff I did a few days ago and forgot about
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 06 Sep 2006 03:58:53 +0000 |
parents | 34a5709ff951 |
children | a9f8d3964d62 |
files | libgaim/protocols/jabber/buddy.c libgaim/protocols/jabber/chat.c libgaim/protocols/jabber/presence.c libgaim/protocols/jabber/presence.h |
diffstat | 4 files changed, 22 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/protocols/jabber/buddy.c Wed Sep 06 03:12:05 2006 +0000 +++ b/libgaim/protocols/jabber/buddy.c Wed Sep 06 03:58:53 2006 +0000 @@ -658,6 +658,8 @@ purdy = gaim_strdup_withhtml(jbr->status); g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Resource"), jbr->name); + g_string_append_printf(info_text, "<b>%s:</b> %d<br/>", + _("Priority"), jbr->priority); g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>", _("Status"), jabber_buddy_state_get_name(jbr->state), purdy ? ": " : "", @@ -1190,7 +1192,7 @@ JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); xmlnode *presence; JabberBuddyState state; - const char *msg; + char *msg; int priority; account = gaim_connection_get_account(js->gc); @@ -1200,6 +1202,8 @@ gaim_status_to_jabber(status, &state, &msg, &priority); presence = jabber_presence_create(state, msg, priority); + g_free(msg); + xmlnode_set_attrib(presence, "to", who); if(invisible) { xmlnode_set_attrib(presence, "type", "invisible");
--- a/libgaim/protocols/jabber/chat.c Wed Sep 06 03:12:05 2006 +0000 +++ b/libgaim/protocols/jabber/chat.c Wed Sep 06 03:58:53 2006 +0000 @@ -205,7 +205,7 @@ GaimPresence *gpresence; GaimStatus *status; JabberBuddyState state; - const char *msg; + char *msg; int priority; room = g_hash_table_lookup(data, "room"); @@ -265,6 +265,7 @@ full_jid = g_strdup_printf("%s/%s", room_jid, handle); xmlnode_set_attrib(presence, "to", full_jid); g_free(full_jid); + g_free(msg); x = xmlnode_new_child(presence, "x"); xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); @@ -618,7 +619,7 @@ GaimPresence *gpresence; GaimStatus *status; JabberBuddyState state; - const char *msg; + char *msg; int priority; if(!chat->muc) { @@ -637,6 +638,7 @@ full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); xmlnode_set_attrib(presence, "to", full_jid); g_free(full_jid); + g_free(msg); jabber_send(chat->js, presence); xmlnode_free(presence);
--- a/libgaim/protocols/jabber/presence.c Wed Sep 06 03:12:05 2006 +0000 +++ b/libgaim/protocols/jabber/presence.c Wed Sep 06 03:58:53 2006 +0000 @@ -66,7 +66,7 @@ JabberBuddyResource *jbr; if((jb = jabber_buddy_find(js, my_base_jid, TRUE))) { JabberBuddyState state; - const char *msg; + char *msg; int priority; gaim_status_to_jabber(gstatus, &state, &msg, &priority); @@ -81,6 +81,8 @@ } else { gaim_prpl_got_user_status(js->gc->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL); } + + g_free(msg); } } g_free(my_base_jid); @@ -95,7 +97,6 @@ int primitive; xmlnode *presence, *x, *photo; char *stripped = NULL; - const char *msg; JabberBuddyState state; int priority; @@ -111,10 +112,8 @@ gc = gaim_account_get_connection(account); js = gc->proto_data; - gaim_status_to_jabber(status, &state, &msg, &priority); + gaim_status_to_jabber(status, &state, &stripped, &priority); - if(msg) - gaim_markup_html_to_xhtml(msg, NULL, &stripped); presence = jabber_presence_create(state, stripped, priority); g_free(stripped); @@ -604,9 +603,10 @@ xmlnode_free(presence); } -void gaim_status_to_jabber(const GaimStatus *status, JabberBuddyState *state, const char **msg, int *priority) +void gaim_status_to_jabber(const GaimStatus *status, JabberBuddyState *state, char **msg, int *priority) { const char *status_id = NULL; + const char *formatted_msg = NULL; if(state) *state = JABBER_BUDDY_STATE_UNKNOWN; if(msg) *msg = NULL; @@ -621,11 +621,14 @@ } if(msg) { - *msg = gaim_status_get_attr_string(status, "message"); + formatted_msg = gaim_status_get_attr_string(status, "message"); /* if the message is blank, then there really isn't a message */ - if(*msg && !**msg) - *msg = NULL; + if(formatted_msg && !*formatted_msg) + formatted_msg = NULL; + + if(formatted_msg) + gaim_markup_html_to_xhtml(formatted_msg, NULL, msg); } if(priority)
--- a/libgaim/protocols/jabber/presence.h Wed Sep 06 03:12:05 2006 +0000 +++ b/libgaim/protocols/jabber/presence.h Wed Sep 06 03:58:53 2006 +0000 @@ -32,6 +32,6 @@ void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type); void jabber_presence_fake_to_self(JabberStream *js, const GaimStatus *status); -void gaim_status_to_jabber(const GaimStatus *status, JabberBuddyState *state, const char **msg, int *priority); +void gaim_status_to_jabber(const GaimStatus *status, JabberBuddyState *state, char **msg, int *priority); #endif /* _GAIM_JABBER_PRESENCE_H_ */