--- libpurple/protocols/jabber/message.c.orig
+++ libpurple/protocols/jabber/message.c
@@ -64,7 +64,8 @@
PurpleAccount *account;
JabberBuddy *jb;
JabberBuddyResource *jbr;
-
+ char * msgbody;
+
if(!jid)
return;
@@ -115,6 +116,7 @@
serv_got_typing_stopped(gc, jm->from);
}
} else {
+
if (jid->resource) {
/*
* We received a message from a specific resource, so
@@ -156,7 +158,18 @@
jm->body = jabber_google_format_to_html(jm->body);
g_free(tmp);
}
- serv_got_im(gc, jm->from, jm->xhtml ? jm->xhtml : jm->body, 0, jm->sent);
+
+ msgbody = g_strdup (jm->xhtml ? jm->xhtml : jm->body);
+
+ /* Don't throw away the subject line */
+ if (jm->subject != NULL) {
+ char *tmp = msgbody;
+ msgbody = g_strdup_printf("%s
%s", jm->subject, msgbody);
+ g_free(tmp);
+ }
+
+ serv_got_im(gc, jm->from, msgbody, 0, jm->sent);
+ g_free(msgbody);
}
jabber_id_free(jid);
@@ -219,7 +232,8 @@
{
JabberID *jid = jabber_id_new(jm->from);
JabberChat *chat;
-
+ char * msgbody;
+
if(!jid)
return;
@@ -228,6 +242,17 @@
if(!chat)
return;
+ msgbody = g_strdup (jm->xhtml ? jm->xhtml : jm->body);
+
+ /* Don't throw away the subject line */
+ if (jm->subject != NULL) {
+ char *tmp = msgbody;
+ msgbody = g_strdup_printf("%s
%s", jm->subject, msgbody);
+ g_free(tmp);
+ }
+
+ /* The subject line is not the same as the topic! */
+ /*
if(jm->subject) {
purple_conv_chat_set_topic(PURPLE_CONV_CHAT(chat->conv), jid->resource,
jm->subject);
@@ -244,19 +269,20 @@
g_free(tmp2);
g_free(msg);
}
- }
+ } */
if(jm->xhtml || jm->body) {
if(jid->resource)
serv_got_chat_in(jm->js->gc, chat->id, jid->resource,
jm->delayed ? PURPLE_MESSAGE_DELAYED : 0,
- jm->xhtml ? jm->xhtml : jm->body, jm->sent);
+ msgbody, jm->sent);
else if(chat->muc)
purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "",
- jm->xhtml ? jm->xhtml : jm->body,
+ msgbody,
PURPLE_MESSAGE_SYSTEM, jm->sent);
}
+ g_free(msgbody);
jabber_id_free(jid);
}
@@ -282,6 +308,7 @@
static void handle_error(JabberMessage *jm)
{
char *buf;
+ char *msgbody;
if(!jm->body)
return;
@@ -289,10 +316,16 @@
buf = g_strdup_printf(_("Message delivery to %s failed: %s"),
jm->from, jm->error ? jm->error : "");
+ msgbody = (! jm->subject ) ?
+ g_strdup(jm->xhtml ? jm->xhtml : jm->body)
+ : g_strdup_printf("%s
%s",
+ jm->subject, jm->xhtml ? jm->xhtml : jm->body);
+
purple_notify_formatted(jm->js->gc, _("XMPP Message Error"), _("XMPP Message Error"), buf,
- jm->xhtml ? jm->xhtml : jm->body, NULL, NULL);
+ msgbody, NULL, NULL);
g_free(buf);
+ g_free(msgbody);
}
static void handle_buzz(JabberMessage *jm) {