--- a/finch/gntconv.c Thu May 22 19:36:16 2014 +0200
+++ b/finch/gntconv.c Thu May 22 20:20:19 2014 +0200
@@ -1083,18 +1083,23 @@
-finch_write_chat(PurpleChatConversation *chat, const char *who, const char *message,
- PurpleMessageFlags flags, time_t mtime)
+finch_write_chat(PurpleChatConversation *chat, PurpleMessage *msg) - purple_conversation_write(PURPLE_CONVERSATION(chat), who, message, flags, mtime);
+ purple_conversation_write(PURPLE_CONVERSATION(chat), + purple_message_get_who(msg), + purple_message_get_contents(msg), + purple_message_get_flags(msg), + purple_message_get_time(msg)); -finch_write_im(PurpleIMConversation *im, const char *who, const char *message,
- PurpleMessageFlags flags, time_t mtime)
+finch_write_im(PurpleIMConversation *im, PurpleMessage *msg) PurpleConversation *conv = PURPLE_CONVERSATION(im);
PurpleAccount *account = purple_conversation_get_account(conv);
+ PurpleMessageFlags flags = purple_message_get_flags(msg); + const gchar *who = purple_message_get_who(msg); if (flags & PURPLE_MESSAGE_SEND)
who = purple_connection_get_display_name(purple_account_get_connection(account));
@@ -1112,7 +1117,8 @@
who = purple_buddy_get_contact_alias(buddy);
- purple_conversation_write(conv, who, message, flags, mtime);
+ purple_conversation_write(conv, who, purple_message_get_contents(msg), + flags, purple_message_get_time(msg)); --- a/libpurple/conversation.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/conversation.c Thu May 22 20:20:19 2014 +0200
@@ -144,8 +144,8 @@
err = purple_serv_send_im(gc, msg);
- if ((err > 0) && (displayed != NULL)) /* TODO: use msg! */
- purple_conversation_write_message(conv, NULL, displayed, msgflags, time(NULL));
+ if ((err > 0) && (displayed != NULL)) + purple_conversation_write_message(conv, msg); purple_signal_emit(purple_conversations_get_handle(),
"sent-im-msg", account, msg);
@@ -683,8 +683,7 @@
-purple_conversation_write_message(PurpleConversation *conv, const char *who,
- const char *message, PurpleMessageFlags flags, time_t mtime)
+purple_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) PurpleConversationClass *klass = NULL;
@@ -693,7 +692,7 @@
klass = PURPLE_CONVERSATION_GET_CLASS(conv);
if (klass && klass->write_message)
- klass->write_message(conv, who, message, flags, mtime);
+ klass->write_message(conv, msg); void purple_conversation_write_system_message(PurpleConversation *conv,
--- a/libpurple/conversation.h Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/conversation.h Thu May 22 20:20:19 2014 +0200
@@ -142,6 +142,7 @@
/**************************************************************************/
/** PurpleConversation */
@@ -179,8 +180,7 @@
struct _PurpleConversationClass {
GObjectClass parent_class;
- void (*write_message)(PurpleConversation *conv, const char *who,
- const char *message, PurpleMessageFlags flags, time_t mtime);
+ void (*write_message)(PurpleConversation *conv, PurpleMessage *msg); void (*_purple_reserved1)(void);
@@ -250,13 +250,8 @@
void (*create_conversation)(PurpleConversation *conv);
void (*destroy_conversation)(PurpleConversation *conv);
- void (*write_chat)(PurpleChatConversation *chat, const char *who,
- const char *message, PurpleMessageFlags flags,
- void (*write_im)(PurpleIMConversation *im, const char *who,
- const char *message, PurpleMessageFlags flags,
+ void (*write_chat)(PurpleChatConversation *chat, PurpleMessage *msg); + void (*write_im)(PurpleIMConversation *im, PurpleMessage *msg); void (*write_conv)(PurpleConversation *conv,
@@ -512,8 +507,7 @@
* Writes to a chat or an IM.
void purple_conversation_write_message(PurpleConversation *conv,
- const char *who, const char *message,
- PurpleMessageFlags flags, time_t mtime);
* purple_conversation_write_system_message:
--- a/libpurple/conversationtypes.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/conversationtypes.c Thu May 22 20:20:19 2014 +0200
@@ -353,25 +353,29 @@
-im_conversation_write_message(PurpleConversation *conv, const char *who, const char *message,
- PurpleMessageFlags flags, time_t mtime)
+im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) PurpleConversationUiOps *ops;
PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
g_return_if_fail(im != NULL);
- g_return_if_fail(message != NULL);
+ g_return_if_fail(msg != NULL); ops = purple_conversation_get_ui_ops(conv);
- if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV)
+ if (purple_message_get_flags(msg) & PURPLE_MESSAGE_RECV) purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
/* Pass this on to either the ops structure or the default write func. */
if (ops != NULL && ops->write_im != NULL)
- ops->write_im(im, who, message, flags, mtime);
- purple_conversation_write(conv, who, message, flags, mtime);
+ ops->write_im(im, msg); + purple_conversation_write(conv, + purple_message_get_who(msg), + purple_message_get_contents(msg), + purple_message_get_flags(msg), + purple_message_get_time(msg)); /**************************************************************************
@@ -797,43 +801,37 @@
-chat_conversation_write_message(PurpleConversation *conv, const char *who, const char *message,
- PurpleMessageFlags flags, time_t mtime)
+chat_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) PurpleConversationUiOps *ops;
PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv);
+ PurpleMessageFlags flags; g_return_if_fail(priv != NULL);
- g_return_if_fail(who != NULL);
- g_return_if_fail(message != NULL);
+ g_return_if_fail(msg != NULL); account = purple_conversation_get_account(conv);
/* Don't display this if the person who wrote it is ignored. */
- if (purple_chat_conversation_is_ignored_user(PURPLE_CHAT_CONVERSATION(conv), who))
+ if (purple_chat_conversation_is_ignored_user( + PURPLE_CHAT_CONVERSATION(conv), purple_message_get_who(msg)))
- purple_debug_error("conversation",
- "purple_conv_chat_write ignoring negative timestamp\n");
- /* TODO: Would be more appropriate to use a value that indicates
- that the timestamp is unknown, and surface that in the UI. */
- str = purple_normalize(account, who);
+ /* XXX: this should not be necessary */ + if (purple_strequal(purple_normalize(account, who), priv->nick)) { + flags |= PURPLE_MESSAGE_SEND; - if (purple_strequal(str, priv->nick)) {
- flags |= PURPLE_MESSAGE_SEND;
- flags |= PURPLE_MESSAGE_RECV;
- if (purple_utf8_has_word(message, priv->nick))
- flags |= PURPLE_MESSAGE_NICK;
+ flags = purple_message_get_flags(msg); + if (flags & PURPLE_MESSAGE_RECV) { + if (purple_utf8_has_word(purple_message_get_contents(msg), priv->nick)) { + flags |= PURPLE_MESSAGE_NICK; + purple_message_set_flags(msg, flags); @@ -841,9 +839,14 @@
/* Pass this on to either the ops structure or the default write func. */
if (ops != NULL && ops->write_chat != NULL)
- ops->write_chat(PURPLE_CHAT_CONVERSATION(conv), who, message, flags, mtime);
- purple_conversation_write(conv, who, message, flags, mtime);
+ ops->write_chat(PURPLE_CHAT_CONVERSATION(conv), msg); + purple_conversation_write(conv, + purple_message_get_who(msg), + purple_message_get_contents(msg), + purple_message_get_flags(msg), + purple_message_get_time(msg)); --- a/libpurple/plugins/offlinemsg.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/plugins/offlinemsg.c Thu May 22 20:20:19 2014 +0200
@@ -105,8 +105,9 @@
g_object_set_data(G_OBJECT(conv), "plugin_pack:offlinemsg",
GINT_TO_POINTER(OFFLINE_MSG_YES));
- purple_conversation_write_message(conv, offline->who, offline->message,
- PURPLE_MESSAGE_SEND, time(NULL));
+ /* TODO: use a reference to a PurpleMessage */ + purple_conversation_write_message(conv, purple_message_new(offline->who, + offline->message, PURPLE_MESSAGE_SEND)); --- a/libpurple/plugins/perl/common/Conversation.xs Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/plugins/perl/common/Conversation.xs Thu May 22 20:20:19 2014 +0200
@@ -47,7 +47,6 @@
@@ -209,14 +208,6 @@
-purple_conversation_write_message(conv, who, message, flags, mtime)
- Purple::Conversation conv
- Purple::MessageFlags flags
purple_conversation_send(conv, message)
Purple::Conversation conv
--- a/libpurple/protocols/irc/cmds.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/protocols/irc/cmds.c Thu May 22 20:20:19 2014 +0200
@@ -189,8 +189,9 @@
purple_connection_get_display_name(gc),
PURPLE_MESSAGE_SEND, action, time(NULL));
- purple_conversation_write_message(convo, purple_connection_get_display_name(gc),
- action, PURPLE_MESSAGE_SEND, time(NULL));
+ purple_conversation_write_message(convo, purple_message_new( + purple_connection_get_display_name(gc), action, @@ -502,8 +503,8 @@
gc = purple_account_get_connection(irc->account);
irc_cmd_privmsg(irc, cmd, target, args);
purple_conversation_write_message(PURPLE_CONVERSATION(im),
- purple_connection_get_display_name(gc), args[1],
- PURPLE_MESSAGE_SEND, time(NULL));
+ purple_message_new(purple_connection_get_display_name(gc), + args[1], PURPLE_MESSAGE_SEND)); @@ -582,8 +583,9 @@
buf = g_strdup(_("No topic is set"));
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), target, buf,
- PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write_message(PURPLE_CONVERSATION(chat), + purple_message_new(target, buf, + PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG)); --- a/libpurple/protocols/irc/msgs.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/protocols/irc/msgs.c Thu May 22 20:20:19 2014 +0200
@@ -593,8 +593,8 @@
msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), from,
- msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message( + PURPLE_CONVERSATION(chat), msg, 0); @@ -799,9 +799,9 @@
convo = purple_conversations_find_with_account(args[1], irc->account);
- purple_conversation_write_message(convo, args[1],
- PURPLE_IS_IM_CONVERSATION(convo) ? _("User is not logged in") : _("no such channel"),
- PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write_system_message(convo, + PURPLE_IS_IM_CONVERSATION(convo) ? _("User is not logged in") : _("no such channel"), + PURPLE_MESSAGE_NO_LOG); if ((gc = purple_account_get_connection(irc->account)) == NULL)
@@ -823,8 +823,8 @@
chat = purple_conversations_find_chat_with_account(args[1], irc->account);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[1], args[2],
- PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), args[2], + PURPLE_MESSAGE_NO_LOG); if ((gc = purple_account_get_connection(irc->account)) == NULL)
@@ -841,8 +841,8 @@
/*g_slist_remove(irc->gc->buddy_chats, chat);
purple_conversation_set_account(chat, NULL);*/
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[1], args[2],
- PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), + args[2], PURPLE_MESSAGE_NO_LOG); @@ -1008,7 +1008,7 @@
if (!purple_utf8_strcasecmp(purple_connection_get_display_name(gc), args[1])) {
buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat));
@@ -1036,7 +1036,7 @@
escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL;
buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); @@ -1221,7 +1221,7 @@
(args[1] && *args[1]) ? ": " : "",
(escaped && *escaped) ? escaped : "");
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), channel, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), msg, 0); purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat));
--- a/libpurple/protocols/jabber/presence.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/protocols/jabber/presence.c Thu May 22 20:20:19 2014 +0200
@@ -789,9 +789,12 @@
- purple_conversation_write_message(PURPLE_CONVERSATION(chat->conv), presence->jid_from->resource,
- presence->status, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ gchar *msg = g_strdup_printf("%s: %s", + presence->jid_from->resource, + purple_conversation_write_system_message(PURPLE_CONVERSATION(chat->conv), msg, 0); purple_serv_got_chat_left(js->gc, chat->id);
jabber_chat_destroy(chat);
--- a/libpurple/protocols/silc/ops.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/protocols/silc/ops.c Thu May 22 20:20:19 2014 +0200
@@ -560,8 +560,8 @@
g_snprintf(buf, sizeof(buf),
_("%s has changed the topic of <I>%s</I> to: %s"),
client_entry->nickname, channel->channel_name, tmp2);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), client_entry->nickname,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message( + PURPLE_CONVERSATION(chat), buf, 0); purple_chat_conversation_set_topic(chat,
client_entry->nickname, tmp);
} else if (idtype == SILC_ID_SERVER) {
@@ -569,8 +569,8 @@
g_snprintf(buf, sizeof(buf),
_("%s has changed the topic of <I>%s</I> to: %s"),
server_entry->server_name, channel->channel_name, tmp2);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), server_entry->server_name,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message( + PURPLE_CONVERSATION(chat), buf, 0); purple_chat_conversation_set_topic(chat,
server_entry->server_name, tmp);
} else if (idtype == SILC_ID_CHANNEL) {
@@ -578,8 +578,8 @@
g_snprintf(buf, sizeof(buf),
_("%s has changed the topic of <I>%s</I> to: %s"),
channel->channel_name, channel->channel_name, tmp2);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), channel->channel_name,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message( + PURPLE_CONVERSATION(chat), buf, 0); purple_chat_conversation_set_topic(chat,
channel->channel_name, tmp);
@@ -649,8 +649,7 @@
_("<I>%s</I> removed all channel <I>%s</I> modes"), name,
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), channel->channel_name,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); case SILC_NOTIFY_TYPE_CUMODE_CHANGE:
@@ -690,8 +689,7 @@
_("<I>%s</I> removed all <I>%s's</I> modes"), name,
client_entry2->nickname);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), channel->channel_name,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), buf, 0); purple_chat_user_set_flags(purple_chat_conversation_find_user(
chat, client_entry2->nickname), flags);
@@ -720,8 +718,8 @@
_("You have been kicked off <I>%s</I> by <I>%s</I> (%s)"),
channel->channel_name, client_entry2->nickname,
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), client_entry->nickname,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat));
/* Remove user from channel */
@@ -765,8 +763,8 @@
chu->channel->channel_name, sg->account);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), client_entry->nickname,
- buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
+ purple_conversation_write_system_message( + PURPLE_CONVERSATION(chat), buf, 0); purple_serv_got_chat_left(gc, purple_chat_conversation_get_id(chat));
silc_hash_table_list_reset(&htl);
--- a/libpurple/protocols/silc/silc.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/protocols/silc/silc.c Thu May 22 20:20:19 2014 +0200
@@ -1412,8 +1412,9 @@
silc_mime_partial_free(list);
- purple_conversation_write_message(PURPLE_CONVERSATION(convo), conn->local_entry->nickname,
- im->message, 0, time(NULL));
+ purple_conversation_write_message(PURPLE_CONVERSATION(convo), + purple_message_new(conn->local_entry->nickname, + im->message, PURPLE_MESSAGE_SEND)); @@ -1421,8 +1422,8 @@
silc_client_send_private_message(client, conn, client_entry, im->flags,
sg->sha1hash, (unsigned char *)im->message, im->message_len);
- purple_conversation_write_message(PURPLE_CONVERSATION(convo), conn->local_entry->nickname,
- im->message, 0, time(NULL));
+ purple_conversation_write_message(PURPLE_CONVERSATION(convo), purple_message_new( + conn->local_entry->nickname, im->message, PURPLE_MESSAGE_SEND)); @@ -1605,8 +1606,8 @@
buf = g_strdup(_("No topic is set"));
- purple_conversation_write_message(conv, purple_account_get_username(purple_connection_get_account(gc)), buf,
- PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write_system_message(conv, + buf, PURPLE_MESSAGE_NO_LOG); @@ -1712,8 +1713,9 @@
args[1], PURPLE_MESSAGE_SEND);
ret = silcpurple_send_im(gc, msg);
- purple_conversation_write_message(PURPLE_CONVERSATION(im), purple_connection_get_display_name(gc),
- args[1], PURPLE_MESSAGE_SEND, time(NULL));
+ purple_conversation_write_message(PURPLE_CONVERSATION(im), + purple_message_new(purple_connection_get_display_name(gc), + args[1], PURPLE_MESSAGE_SEND)); --- a/libpurple/server.c Thu May 22 19:36:16 2014 +0200
+++ b/libpurple/server.c Thu May 22 20:20:19 2014 +0200
@@ -538,6 +538,7 @@
g_return_if_fail(msg != NULL);
@@ -599,7 +600,10 @@
im = purple_im_conversation_new(account, name);
- purple_conversation_write_message(PURPLE_CONVERSATION(im), name, message, flags, mtime);
+ pmsg = purple_message_new(name, message, flags); + purple_message_set_time(pmsg, mtime); + purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg); @@ -672,10 +676,7 @@
PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP);
purple_serv_send_im(gc, msg);
- purple_conversation_write_message(PURPLE_CONVERSATION(im), NULL, away_msg,
- PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP,
+ purple_conversation_write_message(PURPLE_CONVERSATION(im), msg); @@ -878,6 +879,7 @@
PurpleChatConversation *chat = NULL;
g_return_if_fail(who != NULL);
g_return_if_fail(message != NULL);
@@ -935,7 +937,9 @@
purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g),
who, message, chat, flags);
- purple_conversation_write_message(PURPLE_CONVERSATION(chat), who, message, flags, mtime);
+ pmsg = purple_message_new(who, message, flags); + purple_message_set_time(pmsg, mtime); + purple_conversation_write_message(PURPLE_CONVERSATION(chat), pmsg); --- a/pidgin/gtkconv.c Thu May 22 19:36:16 2014 +0200
+++ b/pidgin/gtkconv.c Thu May 22 20:20:19 2014 +0200
@@ -6198,12 +6198,11 @@
-pidgin_conv_write_im(PurpleIMConversation *im, const char *who,
- const char *message, PurpleMessageFlags flags,
+pidgin_conv_write_im(PurpleIMConversation *im, PurpleMessage *msg) PidginConversation *gtkconv;
PurpleConversation *conv = PURPLE_CONVERSATION(im);
+ PurpleMessageFlags flags = purple_message_get_flags(msg); gtkconv = PIDGIN_CONVERSATION(conv);
@@ -6218,7 +6217,9 @@
- purple_conversation_write(conv, who, message, flags, mtime);
+ purple_conversation_write(conv, purple_message_get_who(msg), + purple_message_get_contents(msg), flags, + purple_message_get_time(msg));