--- a/finch/plugins/gnttinyurl.c Thu Jun 12 22:02:46 2014 +0530
+++ b/finch/plugins/gnttinyurl.c Thu Jun 12 18:45:07 2014 +0200
@@ -297,13 +297,16 @@
-static void wrote_msg(PurpleAccount *account, char *sender, char *message,
- PurpleConversation *conv, PurpleMessageFlags flags)
+static void wrote_msg(PurpleConversation *conv, PurpleMessage *pmsg, + if (purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) urls = g_object_get_data(G_OBJECT(conv), "TinyURLs");
- if ((flags & PURPLE_MESSAGE_SEND) || urls == NULL)
process_urls(conv, urls);
--- a/libpurple/conversation.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/conversation.c Thu Jun 12 18:45:07 2014 +0200
@@ -578,23 +578,19 @@
-_purple_conversation_write_common(PurpleConversation *conv, const char *who,
- const char *message, PurpleMessageFlags flags,
+_purple_conversation_write_common(PurpleConversation *conv, PurpleMessage *pmsg) PurplePluginProtocolInfo *prpl_info = NULL;
PurpleConnection *gc = NULL;
PurpleConversationUiOps *ops;
- char *displayed = NULL;
PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv);
/* int logging_font_options = 0; */
- g_return_if_fail(priv != NULL);
- g_return_if_fail(message != NULL);
+ g_return_if_fail(priv != NULL); + g_return_if_fail(pmsg != NULL); ops = purple_conversation_get_ui_ops(conv);
@@ -611,25 +607,16 @@
!g_list_find(purple_conversations_get_all(), conv))
- displayed = g_strdup(message);
- if (who == NULL || *who == '\0')
- who = purple_conversation_get_name(conv);
+ plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( + purple_conversations_get_handle(), + (PURPLE_IS_IM_CONVERSATION(conv) ? "writing-im-msg" : "writing-chat-msg"),
- GPOINTER_TO_INT(purple_signal_emit_return_1(
- purple_conversations_get_handle(),
- (PURPLE_IS_IM_CONVERSATION(conv) ? "writing-im-msg" : "writing-chat-msg"),
- account, who, &displayed, conv, flags));
+ if (purple_message_is_empty(pmsg))
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
@@ -637,49 +624,72 @@
if (PURPLE_IS_IM_CONVERSATION(conv) ||
!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
- if (flags & PURPLE_MESSAGE_SEND) {
+ if (purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) { b = purple_blist_find_buddy(account,
- purple_account_get_username(account));
+ purple_account_get_username(account)); if (purple_account_get_private_alias(account) != NULL)
alias = purple_account_get_private_alias(account);
- else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b)))
+ else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), + purple_buddy_get_contact_alias(b))) alias = purple_buddy_get_contact_alias(b);
- else if (purple_connection_get_display_name(gc) != NULL)
+ } else if (purple_connection_get_display_name(gc) != NULL) alias = purple_connection_get_display_name(gc);
alias = purple_account_get_username(account);
+ purple_message_set_author_alias(pmsg, alias); - b = purple_blist_find_buddy(account, who);
+ /* TODO: PurpleDude - folks not on the buddy list */ + b = purple_blist_find_buddy(account, + purple_message_get_author(pmsg));
- alias = purple_buddy_get_contact_alias(b);
+ purple_message_set_author_alias(pmsg, + purple_buddy_get_contact_alias(b)); - if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) {
+ if (!(purple_message_get_flags(pmsg) & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { - purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed);
+ purple_log_write((PurpleLog *)log->data, + purple_message_get_flags(pmsg), + purple_message_get_author_alias(pmsg), + purple_message_get_time(pmsg), + purple_message_get_contents(pmsg)); - if (ops && ops->write_conv)
- ops->write_conv(conv, who, alias, displayed, flags, mtime);
+ if (ops && ops->write_conv) { + (purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) ? purple_message_get_recipient(pmsg) : purple_message_get_author(pmsg), + purple_message_get_author_alias(pmsg), + purple_message_get_contents(pmsg), + purple_message_get_flags(pmsg), + purple_message_get_time(pmsg)); - add_message_to_history(conv, who, alias, message, flags, mtime);
+ add_message_to_history(conv, + (purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) ? purple_message_get_recipient(pmsg) : purple_message_get_author(pmsg), + purple_message_get_author_alias(pmsg), + purple_message_get_contents(pmsg), + purple_message_get_flags(pmsg), + purple_message_get_time(pmsg)); purple_signal_emit(purple_conversations_get_handle(),
(PURPLE_IS_IM_CONVERSATION(conv) ? "wrote-im-msg" : "wrote-chat-msg"),
- account, who, displayed, conv, flags);
@@ -698,8 +708,8 @@
void purple_conversation_write_system_message(PurpleConversation *conv,
const gchar *message, PurpleMessageFlags flags)
- _purple_conversation_write_common(conv, NULL, message,
- flags | PURPLE_MESSAGE_SYSTEM, time(NULL));
+ _purple_conversation_write_common(conv, + purple_message_new_system(message, flags)); --- a/libpurple/conversations.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/conversations.c Thu Jun 12 18:45:07 2014 +0200
@@ -284,15 +284,12 @@
**********************************************************************/
purple_signal_register(handle, "writing-im-msg",
- purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT,
- G_TYPE_BOOLEAN, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_POINTER, /* pointer to a string */
- PURPLE_TYPE_IM_CONVERSATION, G_TYPE_UINT);
+ purple_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, + PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE); purple_signal_register(handle, "wrote-im-msg",
- purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
- G_TYPE_NONE, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_STRING, PURPLE_TYPE_IM_CONVERSATION, G_TYPE_UINT);
+ purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, + PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE); purple_signal_register(handle, "sent-attention",
purple_marshal_VOID__POINTER_POINTER_POINTER_UINT,
@@ -331,15 +328,12 @@
G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT);
purple_signal_register(handle, "writing-chat-msg",
- purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT,
- G_TYPE_BOOLEAN, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_POINTER, /* pointer to a string */
- PURPLE_TYPE_CHAT_CONVERSATION, G_TYPE_UINT);
+ purple_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2, + PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE); purple_signal_register(handle, "wrote-chat-msg",
- purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
- G_TYPE_NONE, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_STRING, PURPLE_TYPE_CHAT_CONVERSATION, G_TYPE_UINT);
+ purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, + PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE); purple_signal_register(handle, "sending-chat-msg",
purple_marshal_VOID__POINTER_POINTER_UINT, G_TYPE_NONE,
--- a/libpurple/conversationtypes.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/conversationtypes.c Thu Jun 12 18:45:07 2014 +0200
@@ -55,6 +55,8 @@
char *nick; /* Your nick in this chat. */
gboolean left; /* We left the chat and kept the window open */
GHashTable *users; /* Hash table of the users in the room. */
+ gboolean is_finalizing; /* The object is being destroyed. */ /* Chat Property enums */
@@ -371,13 +373,8 @@
/* Pass this on to either the ops structure or the default write func. */
if (ops != NULL && ops->write_im != NULL)
- _purple_conversation_write_common(conv,
- purple_message_get_author(msg),
- purple_message_get_contents(msg),
- purple_message_get_flags(msg),
- purple_message_get_time(msg));
+ _purple_conversation_write_common(conv, msg); /**************************************************************************
@@ -813,7 +810,7 @@
g_return_if_fail(msg != NULL);
/* Don't display this if the person who wrote it is ignored. */
- if (purple_chat_conversation_is_ignored_user(
+ if (purple_message_get_author(msg) && purple_chat_conversation_is_ignored_user( PURPLE_CHAT_CONVERSATION(conv), purple_message_get_author(msg)))
@@ -840,13 +837,8 @@
/* 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), msg);
- _purple_conversation_write_common(conv,
- purple_message_get_author(msg),
- purple_message_get_contents(msg),
- purple_message_get_flags(msg),
- purple_message_get_time(msg));
+ _purple_conversation_write_common(conv, msg); @@ -1299,7 +1291,8 @@
- g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]);
+ if (!priv->is_finalizing) + g_object_notify_by_pspec(G_OBJECT(chat), chat_properties[CHAT_PROP_LEFT]); purple_conversation_update(PURPLE_CONVERSATION(chat), PURPLE_CONVERSATION_UPDATE_CHATLEFT);
@@ -1474,6 +1467,8 @@
PurpleConnection *gc = purple_conversation_get_connection(PURPLE_CONVERSATION(chat));
PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(chat);
+ priv->is_finalizing = TRUE; --- a/libpurple/internal.h Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/internal.h Thu Jun 12 18:45:07 2014 +0200
@@ -402,10 +402,7 @@
* _purple_conversation_write_common:
* @conv: The conversation.
- * @who: The user who sent the message.
- * @message: The message.
- * @flags: The message flags.
- * @mtime: The time the message was sent.
* Writes to a conversation window.
@@ -415,13 +412,9 @@
* sound playback, etc. depending on whether the conversation is a chat or an
- * This can be used to write generic messages, such as "so and so closed
- * the conversation window."
* See purple_conversation_write_message().
-_purple_conversation_write_common(PurpleConversation *conv, const gchar *who,
- const gchar *message, PurpleMessageFlags flags, time_t mtime);
+_purple_conversation_write_common(PurpleConversation *conv, PurpleMessage *msg); #endif /* _PURPLE_INTERNAL_H_ */
--- a/libpurple/message.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/message.c Thu Jun 12 18:45:07 2014 +0200
@@ -168,6 +168,9 @@
g_return_val_if_fail(priv != NULL, NULL);
+ if (priv->author_alias == NULL) + return purple_message_get_author(msg); return priv->author_alias;
--- a/libpurple/plugins/signals-test.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/plugins/signals-test.c Thu Jun 12 18:45:07 2014 +0200
@@ -293,11 +293,11 @@
-wrote_im_msg_cb(PurpleAccount *account, const char *who, const char *buffer,
- PurpleConversation *conv, PurpleMessageFlags flags, void *data)
+wrote_im_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data) - purple_debug_misc("signals test", "wrote-im-msg (%s, %s, %s)\n",
- purple_account_get_username(account), purple_conversation_get_name(conv), buffer);
+ purple_debug_misc("signals test", "wrote-im-msg (%s, %s)\n", + purple_conversation_get_name(conv), + purple_message_get_contents(msg)); @@ -350,11 +350,11 @@
-wrote_chat_msg_cb(PurpleAccount *account, const char *who, const char *buffer,
- PurpleConversation *conv, PurpleMessageFlags flags, void *data)
+wrote_chat_msg_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer data) purple_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n",
- purple_conversation_get_name(conv), buffer);
+ purple_conversation_get_name(conv), + purple_message_get_contents(msg)); --- a/libpurple/protocols/jabber/message.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/protocols/jabber/message.c Thu Jun 12 18:45:07 2014 +0200
@@ -220,7 +220,7 @@
JabberID *jid = jabber_id_new(jm->from);
- PurpleMessageFlags messageFlags = PURPLE_MESSAGE_RECV;
+ PurpleMessageFlags messageFlags = 0; --- a/libpurple/server.c Thu Jun 12 22:02:46 2014 +0530
+++ b/libpurple/server.c Thu Jun 12 18:45:07 2014 +0200
@@ -935,7 +935,12 @@
purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g),
who, message, chat, flags);
- pmsg = purple_message_new_incoming(who, message, flags, mtime);
+ if (flags & PURPLE_MESSAGE_RECV) + pmsg = purple_message_new_incoming(who, message, flags, mtime); + pmsg = purple_message_new_outgoing(who, message, flags); + purple_message_set_time(pmsg, mtime); purple_conversation_write_message(PURPLE_CONVERSATION(chat), pmsg);
--- a/pidgin/gtkblist.c Thu Jun 12 22:02:46 2014 +0530
+++ b/pidgin/gtkblist.c Thu Jun 12 18:45:07 2014 +0200
@@ -4825,15 +4825,21 @@
-written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message,
- PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node)
+written_msg_update_ui_cb(PurpleConversation *conv, PurpleMessage *msg, PurpleBlistNode *node) PidginBlistNode *ui = purple_blist_node_get_ui_data(node);
- if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) ||
- !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)))
+ if (ui->conv.conv != conv) + if (!pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) + if (!(purple_message_get_flags(msg) & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE;
- if (PURPLE_IS_CHAT_CONVERSATION(conv) && (flag & PURPLE_MESSAGE_NICK))
+ if (PURPLE_IS_CHAT_CONVERSATION(conv) && (purple_message_get_flags(msg) & PURPLE_MESSAGE_NICK)) ui->conv.flags |= PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK;
ui->conv.last_message = time(NULL); /* XXX: for lack of better data */
--- a/pidgin/gtkconv.c Thu Jun 12 22:02:46 2014 +0530
+++ b/pidgin/gtkconv.c Thu Jun 12 18:45:07 2014 +0200
@@ -224,6 +224,11 @@
+ col.red = col.green = col.blue = 0; col = g_array_index(gtkconv->nick_colors, GdkColor,
g_str_hash(name) % gtkconv->nick_colors->len);
@@ -7691,12 +7696,14 @@
-wrote_msg_update_unseen_cb(PurpleAccount *account, const char *who, const char *message,
- PurpleConversation *conv, PurpleMessageFlags flags, gpointer null)
+wrote_msg_update_unseen_cb(PurpleConversation *conv, PurpleMessage *msg, PidginConversation *gtkconv = conv ? PIDGIN_CONVERSATION(conv) : NULL;
+ PurpleMessageFlags flags; if (conv == NULL || (gtkconv && gtkconv->win != hidden_convwin))
+ flags = purple_message_get_flags(msg); if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) {
PidginUnseenState unseen = PIDGIN_UNSEEN_NONE;