# HG changeset patch # User Nathan Walp # Date 1157515133 0 # Node ID 7df4ab213577f57310cf5aa9ff728b78ad9dd6ed # Parent 34a5709ff95130a0440f763918f57b74ccb13f7d [gaim-migrate @ 17177] commit part of 1547648 commit some jabber stuff I did a few days ago and forgot about committer: Tailor Script diff -r 34a5709ff951 -r 7df4ab213577 libgaim/protocols/jabber/buddy.c --- 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, "%s: %s
", _("Resource"), jbr->name); + g_string_append_printf(info_text, "%s: %d
", + _("Priority"), jbr->priority); g_string_append_printf(info_text, "%s: %s%s%s
", _("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"); diff -r 34a5709ff951 -r 7df4ab213577 libgaim/protocols/jabber/chat.c --- 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); diff -r 34a5709ff951 -r 7df4ab213577 libgaim/protocols/jabber/presence.c --- 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) diff -r 34a5709ff951 -r 7df4ab213577 libgaim/protocols/jabber/presence.h --- 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_ */