Use purple_conversation_write_system_message where appropriate

Thu, 22 May 2014 21:04:56 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Thu, 22 May 2014 21:04:56 +0200
changeset 36089
c035b9a63457
parent 36088
4c386387f6f3
child 36090
274a5fd12285

Use purple_conversation_write_system_message where appropriate

finch/gntconv.c file | annotate | diff | comparison | revisions
finch/gntpounce.c file | annotate | diff | comparison | revisions
finch/plugins/gnthistory.c file | annotate | diff | comparison | revisions
libpurple/conversation.c file | annotate | diff | comparison | revisions
libpurple/conversationtypes.c file | annotate | diff | comparison | revisions
libpurple/log.c file | annotate | diff | comparison | revisions
libpurple/plugins/offlinemsg.c file | annotate | diff | comparison | revisions
libpurple/plugins/perl/common/Conversation.xs file | annotate | diff | comparison | revisions
libpurple/plugins/psychic.c file | annotate | diff | comparison | revisions
libpurple/protocols/bonjour/jabber.c file | annotate | diff | comparison | revisions
libpurple/protocols/gg/chat.c file | annotate | diff | comparison | revisions
libpurple/protocols/gg/image-prpl.c file | annotate | diff | comparison | revisions
libpurple/protocols/gg/message-prpl.c file | annotate | diff | comparison | revisions
libpurple/protocols/irc/msgs.c file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/jabber.c file | annotate | diff | comparison | revisions
libpurple/protocols/jabber/message.c file | annotate | diff | comparison | revisions
libpurple/protocols/msn/msg.c file | annotate | diff | comparison | revisions
libpurple/protocols/msn/notification.c file | annotate | diff | comparison | revisions
libpurple/protocols/msn/slpcall.c file | annotate | diff | comparison | revisions
libpurple/protocols/novell/novell.c file | annotate | diff | comparison | revisions
libpurple/protocols/oscar/odc.c file | annotate | diff | comparison | revisions
libpurple/protocols/oscar/oscar.c file | annotate | diff | comparison | revisions
libpurple/protocols/oscar/peer.c file | annotate | diff | comparison | revisions
libpurple/protocols/sametime/sametime.c file | annotate | diff | comparison | revisions
libpurple/protocols/silc/ops.c file | annotate | diff | comparison | revisions
libpurple/protocols/silc/silc.c file | annotate | diff | comparison | revisions
libpurple/protocols/yahoo/libymsg.c file | annotate | diff | comparison | revisions
libpurple/protocols/yahoo/yahoochat.c file | annotate | diff | comparison | revisions
libpurple/server.c file | annotate | diff | comparison | revisions
libpurple/xfer.c file | annotate | diff | comparison | revisions
libpurple/xfer.h file | annotate | diff | comparison | revisions
pidgin/gtkconv.c file | annotate | diff | comparison | revisions
pidgin/gtkmedia.c file | annotate | diff | comparison | revisions
pidgin/gtkpounce.c file | annotate | diff | comparison | revisions
--- a/finch/gntconv.c	Thu May 22 20:20:19 2014 +0200
+++ b/finch/gntconv.c	Thu May 22 21:04:56 2014 +0200
@@ -151,37 +151,43 @@
 			case PURPLE_CMD_STATUS_OK:
 				break;
 			case PURPLE_CMD_STATUS_NOT_FOUND:
-				purple_conversation_write(conv, "", _("No such command."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("No such command."), PURPLE_MESSAGE_NO_LOG);
 				break;
 			case PURPLE_CMD_STATUS_WRONG_ARGS:
-				purple_conversation_write(conv, "", _("Syntax Error:  You typed the wrong number of arguments "
-							"to that command."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("Syntax Error:  You typed the wrong "
+					"number of arguments to that command."),
+					PURPLE_MESSAGE_NO_LOG);
 				break;
 			case PURPLE_CMD_STATUS_FAILED:
-				purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					error ? error : _("Your command failed for an unknown reason."),
+					PURPLE_MESSAGE_NO_LOG);
 				break;
 			case PURPLE_CMD_STATUS_WRONG_TYPE:
 				if(PURPLE_IS_IM_CONVERSATION(conv))
-					purple_conversation_write(conv, "", _("That command only works in chats, not IMs."),
-							PURPLE_MESSAGE_NO_LOG, time(NULL));
+					purple_conversation_write_system_message(conv,
+						_("That command only works in chats, not IMs."),
+						PURPLE_MESSAGE_NO_LOG);
 				else
-					purple_conversation_write(conv, "", _("That command only works in IMs, not chats."),
-							PURPLE_MESSAGE_NO_LOG, time(NULL));
+					purple_conversation_write_system_message(conv,
+						_("That command only works in IMs, not chats."),
+						PURPLE_MESSAGE_NO_LOG);
 				break;
 			case PURPLE_CMD_STATUS_WRONG_PRPL:
-				purple_conversation_write(conv, "", _("That command doesn't work on this protocol."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("That command doesn't work on this protocol."),
+					PURPLE_MESSAGE_NO_LOG);
 				break;
 		}
 		g_free(error);
 	}
 	else if (!purple_account_is_connected(purple_conversation_get_account(ggconv->active_conv)))
 	{
-		purple_conversation_write(ggconv->active_conv, "", _("Message was not sent, because you are not signed on."),
-				PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG, time(NULL));
+		purple_conversation_write_system_message(ggconv->active_conv,
+			_("Message was not sent, because you are not signed on."),
+			PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG);
 	}
 	else
 	{
@@ -371,10 +377,11 @@
 		if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(conv)) &&
 				purple_conversation_get_account(conv) == account) {
 			g_object_set_data(G_OBJECT(conv), "want-to-rejoin", GINT_TO_POINTER(TRUE));
-			purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
-						"longer in this chat. You will be automatically rejoined in the chat when "
-						"the account reconnects."),
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("The account has disconnected and you are no "
+				"longer in this chat. You will be automatically rejoined in the chat when "
+				"the account reconnects."),
+				PURPLE_MESSAGE_NO_LOG);
 		}
 		list = list->next;
 	}
@@ -496,13 +503,13 @@
 		/* Enable logging first so the message below can be logged. */
 		purple_conversation_set_logging(conv, TRUE);
 
-		purple_conversation_write(conv, NULL,
-				_("Logging started. Future messages in this conversation will be logged."),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Logging started. Future messages in this "
+			"conversation will be logged."), 0);
 	} else {
-		purple_conversation_write(conv, NULL,
-				_("Logging stopped. Future messages in this conversation will not be logged."),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Logging stopped. Future messages in this "
+			"conversation will not be logged."), 0);
 
 		/* Disable the logging second, so that the above message can be logged. */
 		purple_conversation_set_logging(conv, FALSE);
@@ -763,8 +770,8 @@
 	char *name, *realname;
 
 	if (!gc) {
-		purple_conversation_write(fc->active_conv, NULL, _("You are not connected."),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(fc->active_conv,
+			_("You are not connected."), 0);
 		return;
 	}
 
@@ -1176,8 +1183,8 @@
 			g_string_append_printf(string, "[ %s ]", str);
 		}
 
-		purple_conversation_write(conv, NULL, string->str,
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			conv, string->str, 0);
 		g_string_free(string, TRUE);
 	}
 
@@ -1333,8 +1340,9 @@
 
 		tmp = g_string_free(str, FALSE);
 	} else {
-		purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version"),
-		                        PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Supported debug options are: plugins version"),
+			PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ERROR);
 		return PURPLE_CMD_RET_OK;
 	}
 
@@ -1389,7 +1397,7 @@
 		g_list_free(text);
 	}
 
-	purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL));
+	purple_conversation_write_system_message(conv, s->str, PURPLE_MESSAGE_NO_LOG);
 	g_string_free(s, TRUE);
 
 	return PURPLE_CMD_RET_OK;
--- a/finch/gntpounce.c	Thu May 22 20:20:19 2014 +0200
+++ b/finch/gntpounce.c	Thu May 22 21:04:56 2014 +0200
@@ -875,12 +875,9 @@
 			if (im == NULL)
 				im = purple_im_conversation_new(account, pouncee);
 
-			pmsg = purple_message_new(pouncee, message, 0);
-
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, message,
-									PURPLE_MESSAGE_SEND, time(NULL));
-
+			pmsg = purple_message_new(pouncee, message, PURPLE_MESSAGE_SEND);
 			purple_serv_send_im(purple_account_get_connection(account), pmsg);
+			purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg);
 		}
 	}
 
--- a/finch/plugins/gnthistory.c	Thu May 22 20:20:19 2014 +0200
+++ b/finch/plugins/gnthistory.c	Thu May 22 21:04:56 2014 +0200
@@ -115,15 +115,15 @@
 
 	header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias,
 			purple_date_format_full(localtime(&((PurpleLog *)logs->data)->time)));
-	purple_conversation_write(c, "", header, mflag, time(NULL));
+	purple_conversation_write_system_message(c, header, mflag);
 	g_free(header);
 
 	if (flags & PURPLE_LOG_READ_NO_NEWLINE)
 		purple_str_strip_char(history, '\n');
-	purple_conversation_write(c, "", history, mflag, time(NULL));
+	purple_conversation_write_system_message(c, history, mflag);
 	g_free(history);
 
-	purple_conversation_write(c, "", "<hr>", mflag, time(NULL));
+	purple_conversation_write_system_message(c, "<hr>", mflag);
 
 	g_list_foreach(logs, (GFunc)purple_log_free, NULL);
 	g_list_free(logs);
--- a/libpurple/conversation.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/conversation.c	Thu May 22 21:04:56 2014 +0200
@@ -759,7 +759,7 @@
 
 	conv = purple_conversations_find_with_account(who, account);
 	if (conv != NULL)
-		purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL));
+		purple_conversation_write_system_message(conv, what, PURPLE_MESSAGE_ERROR);
 	else
 		return FALSE;
 
--- a/libpurple/conversationtypes.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/conversationtypes.c	Thu May 22 21:04:56 2014 +0200
@@ -946,9 +946,8 @@
 			}
 			g_free(alias_esc);
 
-			purple_conversation_write(conv, NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
-					time(NULL));
+			purple_conversation_write_system_message(
+				conv, tmp, PURPLE_MESSAGE_NO_LINKIFY);
 			g_free(tmp);
 		}
 
@@ -1077,9 +1076,8 @@
 			g_free(escaped2);
 		}
 
-		purple_conversation_write(conv, NULL, tmp,
-				PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
-				time(NULL));
+		purple_conversation_write_system_message(conv,
+			tmp, PURPLE_MESSAGE_NO_LINKIFY);
 	}
 }
 
@@ -1158,9 +1156,8 @@
 			}
 			g_free(alias_esc);
 
-			purple_conversation_write(conv, NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
-					time(NULL));
+			purple_conversation_write_system_message(conv,
+				tmp, PURPLE_MESSAGE_NO_LINKIFY);
 			g_free(tmp);
 		}
 
--- a/libpurple/log.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/log.c	Thu May 22 21:04:56 2014 +0200
@@ -942,8 +942,9 @@
 					"Could not create log file %s\n", path);
 
 			if (log->conv != NULL)
-				purple_conversation_write(log->conv, NULL, _("Logging of this conversation failed."),
-										PURPLE_MESSAGE_ERROR, time(NULL));
+				purple_conversation_write_system_message(log->conv,
+					_("Logging of this conversation failed."),
+					PURPLE_MESSAGE_ERROR);
 
 			g_free(path);
 			return;
--- a/libpurple/plugins/offlinemsg.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/plugins/offlinemsg.c	Thu May 22 21:04:56 2014 +0200
@@ -97,11 +97,12 @@
 	g_free(temp);
 
 	conv = offline->conv;
-	if (!g_object_get_data(G_OBJECT(conv), "plugin_pack:offlinemsg"))
-		purple_conversation_write(conv, NULL, _("The rest of the messages will be saved "
-							"as pounces. You can edit/delete the pounce from the `Buddy "
-							"Pounce' dialog."),
-							PURPLE_MESSAGE_SYSTEM, time(NULL));
+	if (!g_object_get_data(G_OBJECT(conv), "plugin_pack:offlinemsg")) {
+		purple_conversation_write_system_message(conv,
+			_("The rest of the messages will be saved "
+			"as pounces. You can edit/delete the pounce from the `Buddy "
+			"Pounce' dialog."), 0);
+	}
 	g_object_set_data(G_OBJECT(conv), "plugin_pack:offlinemsg",
 				GINT_TO_POINTER(OFFLINE_MSG_YES));
 
--- a/libpurple/plugins/perl/common/Conversation.xs	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/plugins/perl/common/Conversation.xs	Thu May 22 21:04:56 2014 +0200
@@ -200,14 +200,6 @@
 	Purple::Account account
 
 void
-purple_conversation_write(conv, who, message, flags, mtime)
-	Purple::Conversation conv
-	const char *who
-	const char *message
-	Purple::MessageFlags flags
-	time_t mtime
-
-void
 purple_conversation_send(conv, message)
 	Purple::Conversation conv
 	const char *message
--- a/libpurple/plugins/psychic.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/plugins/psychic.c	Thu May 22 21:04:56 2014 +0200
@@ -67,10 +67,9 @@
 	 translate it literally.  If you can't find a fitting cultural
 	 reference in your language, consider translating something
 	 like this instead: "You feel a new message coming." */
-      purple_conversation_write(PURPLE_CONVERSATION(im), NULL,
-			      _("You feel a disturbance in the force..."),
-			      PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY,
-			      time(NULL));
+      purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+		_("You feel a disturbance in the force..."),
+		PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY);
     }
 
     /* Necessary because we may be creating a new conversation window. */
--- a/libpurple/protocols/bonjour/jabber.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/bonjour/jabber.c	Thu May 22 21:04:56 2014 +0200
@@ -302,9 +302,9 @@
 
 		conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account));
 		if (conv != NULL)
-			purple_conversation_write(conv, NULL,
-				  _("Unable to send message."),
-				  PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unable to send message."),
+				PURPLE_MESSAGE_ERROR);
 
 		bonjour_jabber_close_conversation(bb->conversation);
 		bb->conversation = NULL;
@@ -348,9 +348,9 @@
 
 		conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account));
 		if (conv != NULL)
-			purple_conversation_write(conv, NULL,
-				  _("Unable to send message."),
-				  PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unable to send message."),
+				PURPLE_MESSAGE_ERROR);
 
 		bonjour_jabber_close_conversation(bb->conversation);
 		bb->conversation = NULL;
@@ -399,7 +399,7 @@
 		conv = purple_conversations_find_im_with_account(bconv->pb->name, bconv->pb->account);
 		if (conv != NULL) {
 			char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name);
-			purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv, tmp, 0);
 			g_free(tmp);
 		}
 	}
@@ -487,9 +487,9 @@
 
 		conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account));
 		if (conv != NULL)
-			purple_conversation_write(conv, NULL,
-				  _("Unable to send the message, the conversation couldn't be started."),
-				  PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unable to send the message, the conversation couldn't be started."),
+				PURPLE_MESSAGE_ERROR);
 
 		bonjour_jabber_close_conversation(bconv);
 		if(bb != NULL)
@@ -552,9 +552,9 @@
 			PurpleConversation *conv;
 			conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account));
 			if (conv != NULL)
-				purple_conversation_write(conv, NULL,
-					  _("Unable to send the message, the conversation couldn't be started."),
-					  PURPLE_MESSAGE_SYSTEM, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("Unable to send the message, the conversation couldn't be started."),
+					PURPLE_MESSAGE_ERROR);
 		}
 
 		close(client_socket);
@@ -597,9 +597,9 @@
 			PurpleConversation *conv;
 			conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bname, bconv->account));
 			if (conv != NULL)
-				purple_conversation_write(conv, NULL,
-					  _("Unable to send the message, the conversation couldn't be started."),
-					  PURPLE_MESSAGE_SYSTEM, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("Unable to send the message, the conversation couldn't be started."),
+					PURPLE_MESSAGE_ERROR);
 		}
 
 		/* We don't want to recieve anything else */
@@ -872,9 +872,9 @@
 
 		conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account));
 		if (conv != NULL)
-			purple_conversation_write(conv, NULL,
-				  _("Unable to send the message, the conversation couldn't be started."),
-				  PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unable to send the message, the conversation couldn't be started."),
+				PURPLE_MESSAGE_ERROR);
 
 		bonjour_jabber_close_conversation(bb->conversation);
 		bb->conversation = NULL;
@@ -893,9 +893,9 @@
 
 		conv = PURPLE_CONVERSATION(purple_conversations_find_im_with_account(bb->name, account));
 		if (conv != NULL)
-			purple_conversation_write(conv, NULL,
-				  _("Unable to send the message, the conversation couldn't be started."),
-				  PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unable to send the message, the conversation couldn't be started."),
+				PURPLE_MESSAGE_ERROR);
 
 		close(source);
 		bonjour_jabber_close_conversation(bb->conversation);
--- a/libpurple/protocols/gg/chat.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/gg/chat.c	Thu May 22 21:04:56 2014 +0200
@@ -148,9 +148,9 @@
 	chat->conv = purple_serv_got_joined_chat(chat->gc, chat->local_id,
 		ggp_chat_get_name_from_id(chat->id));
 	if (chat->previously_joined) {
-		purple_conversation_write(PURPLE_CONVERSATION(chat->conv), NULL,
-			_("You have re-joined the chat"), PURPLE_MESSAGE_SYSTEM,
-			time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(chat->conv),
+			_("You have re-joined the chat"), 0);
 	}
 	chat->previously_joined = TRUE;
 
@@ -283,9 +283,9 @@
 		purple_connection_get_account(chat->gc)));
 
 	if (me == uin) {
-		purple_conversation_write(PURPLE_CONVERSATION(chat->conv), NULL,
-			_("You have left the chat"), PURPLE_MESSAGE_SYSTEM,
-			time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(chat->conv),
+			_("You have left the chat"), 0);
 		purple_serv_got_chat_left(chat->gc, chat->local_id);
 		chat->conv = NULL;
 		chat->left = TRUE;
@@ -521,8 +521,14 @@
 
 	ggp_chat_open_conv(chat);
 	if (who == me) {
-		purple_conversation_write(PURPLE_CONVERSATION(chat->conv),
-			ggp_uin_to_str(who), message, PURPLE_MESSAGE_SEND, time);
+		PurpleMessage *pmsg;
+
+		pmsg = purple_message_new(ggp_uin_to_str(who),
+			message, PURPLE_MESSAGE_SEND);
+		purple_message_set_time(pmsg, time);
+
+		purple_conversation_write_message(
+			PURPLE_CONVERSATION(chat->conv), pmsg);
 	} else {
 		purple_serv_got_chat_in(gc, chat->local_id, ggp_uin_to_str(who),
 			PURPLE_MESSAGE_RECV, message, time);
--- a/libpurple/protocols/gg/image-prpl.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/gg/image-prpl.c	Thu May 22 21:04:56 2014 +0200
@@ -214,9 +214,8 @@
 	if (conv != NULL) {
 		gchar *msg = g_strdup_printf(_("Image delivered to %u."),
 			image_request->sender);
-		purple_conversation_write(conv, "", msg,
-			PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_NOTIFY,
-			time(NULL));
+		purple_conversation_write_system_message(conv, msg,
+			PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_NOTIFY);
 		g_free(msg);
 	}
 }
--- a/libpurple/protocols/gg/message-prpl.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/gg/message-prpl.c	Thu May 22 21:04:56 2014 +0200
@@ -245,11 +245,12 @@
 #endif
 	else if (msg->type == GGP_MESSAGE_GOT_TYPE_MULTILOGON) {
 		PurpleIMConversation *im = ggp_message_get_conv(gc, msg->user);
-		const gchar *me = purple_account_get_username(
-			purple_connection_get_account(gc));
+		PurpleMessage *pmsg;
 
-		purple_conversation_write(PURPLE_CONVERSATION(im), me, msg->text,
-			PURPLE_MESSAGE_SEND, msg->time);
+		pmsg = purple_message_new(NULL, msg->text, PURPLE_MESSAGE_SEND);
+		purple_message_set_time(pmsg, msg->time);
+
+		purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg);
 	} else
 		purple_debug_error("gg", "ggp_message_got_display: "
 			"unexpected message type: %d\n", msg->type);
@@ -493,14 +494,13 @@
 					"<img name=\"" GGP_IMAGE_ID_FORMAT
 					"\">", id));
 			} else if (res == GGP_IMAGE_PREPARE_TOO_BIG) {
-				purple_conversation_write(conv, "",
+				purple_conversation_write_system_message(conv,
 					_("Image is too large, please try "
-					"smaller one."), PURPLE_MESSAGE_ERROR,
-					time(NULL));
+					"smaller one."), PURPLE_MESSAGE_ERROR);
 			} else {
-				purple_conversation_write(conv, "",
+				purple_conversation_write_system_message(conv,
 					_("Image cannot be sent."),
-					PURPLE_MESSAGE_ERROR, time(NULL));
+					PURPLE_MESSAGE_ERROR);
 			}
 
 			g_hash_table_destroy(attribs);
--- a/libpurple/protocols/irc/msgs.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/irc/msgs.c	Thu May 22 21:04:56 2014 +0200
@@ -188,10 +188,9 @@
 	clean = purple_utf8_salvage(end);
 	tmp = g_strdup_printf("%.3s: %s", numeric, clean);
 	g_free(clean);
-	purple_conversation_write(convo, "", tmp,
-				  PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG
-				  |PURPLE_MESSAGE_RAW|PURPLE_MESSAGE_NO_LINKIFY,
-				  time(NULL));
+	purple_conversation_write_system_message(convo, tmp,
+		PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_RAW |
+		PURPLE_MESSAGE_NO_LINKIFY);
 	g_free(tmp);
 	return;
 
--- a/libpurple/protocols/jabber/jabber.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/jabber/jabber.c	Thu May 22 21:04:56 2014 +0200
@@ -3181,8 +3181,8 @@
 
 	description =
 		g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias);
-	purple_conversation_write(conv, NULL, description,
-		PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM, time(NULL));
+	purple_conversation_write_system_message(conv, description,
+		PURPLE_MESSAGE_NOTIFY);
 	g_free(description);
 	return _jabber_send_buzz(js, who, error)  ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
 }
@@ -3211,8 +3211,8 @@
 		purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)");
 
 		if (conv) {
-			purple_conversation_write(conv, username, error, PURPLE_MESSAGE_ERROR,
-			    time(NULL));
+			purple_conversation_write_system_message(conv,
+				error, PURPLE_MESSAGE_ERROR);
 		}
 
 		g_free(error);
@@ -3593,16 +3593,16 @@
 		if (ret) {
 			return PURPLE_CMD_RET_OK;
 		} else {
-			purple_conversation_write(conv, NULL,
+			purple_conversation_write_system_message(conv,
 				_("Failed to specify mood"),
-				PURPLE_MESSAGE_ERROR, time(NULL));
+				PURPLE_MESSAGE_ERROR);
 			return PURPLE_CMD_RET_FAILED;
 		}
 	} else {
 		/* account does not support PEP, can't set a mood */
-		purple_conversation_write(conv, NULL,
+		purple_conversation_write_system_message(conv,
 		    _("Account does not support PEP, can't set mood"),
-		    PURPLE_MESSAGE_ERROR, time(NULL));
+		    PURPLE_MESSAGE_ERROR);
 		return PURPLE_CMD_RET_FAILED;
 	}
 }
--- a/libpurple/protocols/jabber/message.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/jabber/message.c	Thu May 22 21:04:56 2014 +0200
@@ -107,8 +107,8 @@
 					/* At some point when we restructure PurpleConversation,
 					 * this should be able to be implemented by removing the
 					 * user from the conversation like we do with chats now. */
-					purple_conversation_write(PURPLE_CONVERSATION(im), "", buf,
-					                        PURPLE_MESSAGE_SYSTEM, time(NULL));
+					purple_conversation_write_system_message(
+						PURPLE_CONVERSATION(im), buf, 0);
 				}
 			}
 			purple_serv_got_typing_stopped(gc, jm->from);
@@ -941,9 +941,9 @@
 	}
 
 	if (has_too_large_smiley) {
-		purple_conversation_write(conv, NULL,
+		purple_conversation_write_system_message(conv,
 			_("A custom smiley in the message is too large to send."),
-			PURPLE_MESSAGE_ERROR, time(NULL));
+			PURPLE_MESSAGE_ERROR);
 	}
 
 	if (!found_smileys)
--- a/libpurple/protocols/msn/msg.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/msn/msg.c	Thu May 22 21:04:56 2014 +0200
@@ -1162,10 +1162,9 @@
 							"invite, which is not yet "
 							"supported."), from);
 				if (buf) {
-					purple_conversation_write(PURPLE_CONVERSATION(im), NULL, buf,
-							PURPLE_MESSAGE_SYSTEM |
-							PURPLE_MESSAGE_NOTIFY,
-							time(NULL));
+					purple_conversation_write_system_message(
+						PURPLE_CONVERSATION(im), buf,
+						PURPLE_MESSAGE_NOTIFY);
 					g_free(buf);
 				}
 			}
--- a/libpurple/protocols/msn/notification.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/msn/notification.c	Thu May 22 21:04:56 2014 +0200
@@ -1214,8 +1214,8 @@
 			else
 				error = _("Mobile message was not sent because an unknown error occurred.");
 
-			purple_conversation_write(conv, NULL, error,
-			                          PURPLE_MESSAGE_ERROR, time(NULL));
+			purple_conversation_write_system_message(conv, error,
+				PURPLE_MESSAGE_ERROR);
 
 			if ((id = purple_xmlnode_get_attrib(payloadNode, "id")) != NULL) {
 				unsigned int trId = atol(id);
@@ -1229,8 +1229,10 @@
 						char *body_str = msn_message_to_string(msg);
 						char *body_enc = g_markup_escape_text(body_str, -1);
 
-						purple_conversation_write(conv, NULL, body_enc,
-					                          	PURPLE_MESSAGE_RAW, time(NULL));
+						/* TODO: mark outgoing message as not delivered
+						 * (API to be implemented) */
+						purple_conversation_write_system_message(conv,
+							body_enc, PURPLE_MESSAGE_RAW);
 
 						g_free(body_str);
 						g_free(body_enc);
--- a/libpurple/protocols/msn/slpcall.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/msn/slpcall.c	Thu May 22 21:04:56 2014 +0200
@@ -585,10 +585,8 @@
 						_("%s requests to view your "
 						"webcam, but this request is "
 						"not yet supported."), from);
-				purple_conversation_write(PURPLE_CONVERSATION(im), NULL, buf,
-						PURPLE_MESSAGE_SYSTEM |
-						PURPLE_MESSAGE_NOTIFY,
-						time(NULL));
+				purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+					buf, PURPLE_MESSAGE_NOTIFY);
 				g_free(buf);
 			}
 		}
@@ -605,10 +603,8 @@
 				buf = g_strdup_printf(
 						_("%s invited you to view his/her webcam, but "
 						"this is not yet supported."), from);
-				purple_conversation_write(PURPLE_CONVERSATION(im), NULL, buf,
-						PURPLE_MESSAGE_SYSTEM |
-						PURPLE_MESSAGE_NOTIFY,
-						time(NULL));
+				purple_conversation_write_system_message(
+					PURPLE_CONVERSATION(im), buf, PURPLE_MESSAGE_NOTIFY);
 				g_free(buf);
 			}
 		}
--- a/libpurple/protocols/novell/novell.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/novell/novell.c	Thu May 22 21:04:56 2014 +0200
@@ -1913,8 +1913,7 @@
 		gconv = nm_conference_get_data(conference);
 		str = g_strdup_printf(_("%s has been invited to this conversation."),
 							  nm_user_record_get_display_id(user_record));
-		purple_conversation_write(gconv, NULL, str,
-								PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(gconv, str, 0);
 		g_free(str);
 	}
 }
@@ -2115,8 +2114,7 @@
 			}
 			str = g_strdup_printf(_("%s appears to be offline and did not receive"
 									" the message that you just sent."), name);
-			purple_conversation_write(gconv, NULL, str,
-									PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(gconv, str, 0);
 			g_free(str);
 		}
 	}
@@ -2555,8 +2553,7 @@
 	if (chat) {
 		str = g_strdup(_("This conference has been closed."
 						 " No more messages can be sent."));
-		purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, str,
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(PURPLE_CONVERSATION(chat), str, 0);
 		g_free(str);
 	}
 
--- a/libpurple/protocols/oscar/odc.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/oscar/odc.c	Thu May 22 21:04:56 2014 +0200
@@ -64,8 +64,8 @@
 
 		account = purple_connection_get_account(conn->od->gc);
 		im = purple_im_conversation_new(account, conn->bn);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp,
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), tmp, 0);
 		g_free(tmp);
 	}
 
@@ -558,8 +558,8 @@
 		/* Tell the local user that we are connected */
 		account = purple_connection_get_account(gc);
 		im = purple_im_conversation_new(account, conn->bn);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, _("Direct IM established"),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), _("Direct IM established"), 0);
 	}
 
 	if ((frame->type != 0x0001) && (frame->subtype != 0x0006))
@@ -603,7 +603,8 @@
 
 			account = purple_connection_get_account(conn->od->gc);
 			im = purple_im_conversation_new(account, conn->bn);
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(im), tmp, 0);
 			g_free(tmp);
 
 			peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL);
--- a/libpurple/protocols/oscar/oscar.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/oscar/oscar.c	Thu May 22 21:04:56 2014 +0200
@@ -2574,8 +2574,9 @@
 				gchar *buf;
 				buf = g_strdup_printf(_("You have been disconnected from chat "
 										"room %s."), cc->name);
-				purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, buf,
-						PURPLE_MESSAGE_ERROR, time(NULL));
+				purple_conversation_write_system_message(
+					PURPLE_CONVERSATION(chat), buf,
+					PURPLE_MESSAGE_ERROR);
 				g_free(buf);
 			}
 			oscar_chat_kill(gc, cc);
@@ -3126,10 +3127,10 @@
 		im = purple_conversations_find_im_with_account(name, account);
 
 		if (strstr(tmp1, "<img "))
-			purple_conversation_write(PURPLE_CONVERSATION(im), "",
-			                        _("Your IM Image was not sent. "
-			                        "You must be Direct Connected to send IM Images."),
-			                        PURPLE_MESSAGE_ERROR, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+				_("Your IM Image was not sent. "
+				"You must be Direct Connected to send IM Images."),
+				PURPLE_MESSAGE_ERROR);
 
 		buddy = purple_blist_find_buddy(account, name);
 
@@ -4341,11 +4342,12 @@
 
 	buf = purple_strdup_withhtml(message);
 
-	if (strstr(buf, "<img "))
-		purple_conversation_write(PURPLE_CONVERSATION(conv), "",
+	if (strstr(buf, "<img ")) {
+		purple_conversation_write_system_message(PURPLE_CONVERSATION(conv),
 			_("Your IM Image was not sent. "
 			  "You cannot send IM Images in AIM chats."),
-			PURPLE_MESSAGE_ERROR, time(NULL));
+			PURPLE_MESSAGE_ERROR);
+	}
 
 	buf2 = oscar_encode_im(buf, &len, &charset, &charsetstr);
 	/*
@@ -4846,8 +4848,8 @@
 		/* OSCAR_DISCONNECT_LOCAL_CLOSED doesn't write anything to the convo
 		 * window. Let the user know that we cancelled the Direct IM. */
 		im = purple_im_conversation_new(account, name);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, _("You closed the connection."),
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), _("You closed the connection."), 0);
 	}
 }
 
--- a/libpurple/protocols/oscar/peer.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/oscar/peer.c	Thu May 22 21:04:56 2014 +0200
@@ -746,8 +746,8 @@
 		im = purple_im_conversation_new(account, conn->bn);
 		tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for "
 				"Direct IM."), conn->bn, listener_ip, listener_port);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp,
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), tmp, 0);
 		g_free(tmp);
 	}
 	else if (conn->type == OSCAR_CAPABILITY_SENDFILE)
@@ -833,8 +833,8 @@
 			tmp = g_strdup_printf(_("Attempting to connect to %s:%hu."),
 					conn->verifiedip, conn->port);
 			im = purple_im_conversation_new(account, conn->bn);
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(im), tmp, 0);
 			g_free(tmp);
 		}
 
@@ -906,8 +906,8 @@
 			PurpleIMConversation *im;
 			tmp = g_strdup(_("Attempting to connect via proxy server."));
 			im = purple_im_conversation_new(account, conn->bn);
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(im), tmp, 0);
 			g_free(tmp);
 		}
 
--- a/libpurple/protocols/sametime/sametime.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/sametime/sametime.c	Thu May 22 21:04:56 2014 +0200
@@ -1840,7 +1840,7 @@
   PurpleIMConversation *im;
   PurpleBuddy *buddy;
   char *who = from->user_id;
-  char *msg;
+  char *msg, *msg2;
 
   pd = mwSession_getClientData(s);
   acct = purple_connection_get_account(pd->gc);
@@ -1852,11 +1852,15 @@
 
   who = g_strdup_printf(_("Announcement from %s"), who);
   msg = purple_markup_linkify(text);
-
-  purple_conversation_write(PURPLE_CONVERSATION(im), who, msg ? msg : "",
-  		PURPLE_MESSAGE_RECV, time(NULL));
+  if (msg && msg[0])
+	msg2 = g_strdup_printf("%s: %s", who, msg);
+  else
+	msg2 = g_strdup(who);
+
+  purple_conversation_write_system_message(PURPLE_CONVERSATION(im), msg2, 0);
   g_free(who);
   g_free(msg);
+  g_free(msg2);
 }
 
 
--- a/libpurple/protocols/silc/ops.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/silc/ops.c	Thu May 22 21:04:56 2014 +0200
@@ -324,8 +324,8 @@
 			return;
 
 		/* Send to Purple */
-		purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, (const char *)msg,
-					PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(chat), msg, 0);
 		g_free(msg);
 		return;
 	}
@@ -406,8 +406,7 @@
 			return;
 
 		/* Send to Purple */
-		purple_conversation_write(convo, NULL, (const char *)msg,
-					  PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(convo, msg, 0);
 		g_free(msg);
 		return;
 	}
@@ -1145,8 +1144,8 @@
 					   _("Channel founder on <I>%s</I> is <I>%s</I>"),
 					   channel->channel_name, chu->client->nickname);
 
-			    purple_conversation_write(PURPLE_CONVERSATION(chat), NULL, tmp,
-						      PURPLE_MESSAGE_SYSTEM, time(NULL));
+			    purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(chat), tmp, 0);
 			  }
 			}
 
--- a/libpurple/protocols/silc/silc.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/silc/silc.c	Thu May 22 21:04:56 2014 +0200
@@ -1429,7 +1429,8 @@
  err:
 	g_snprintf(tmp, sizeof(tmp),
 		   _("User <I>%s</I> is not present in the network"), im->nick);
-	purple_conversation_write(PURPLE_CONVERSATION(convo), NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+	purple_conversation_write_system_message(
+		PURPLE_CONVERSATION(convo), tmp, 0);
 
  out:
 	if (free_list) {
--- a/libpurple/protocols/yahoo/libymsg.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/yahoo/libymsg.c	Thu May 22 21:04:56 2014 +0200
@@ -927,7 +927,8 @@
 	} else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) {
 		PurpleIMConversation *im = purple_conversations_find_im_with_account(from, account);
 		char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
+		purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+			buf, PURPLE_MESSAGE_NOTIFY);
 		g_free(buf);
 	}
 }
@@ -999,7 +1000,8 @@
 			im = purple_conversations_find_im_with_account(sms->from, account);
 			if (im == NULL)
 				im = purple_im_conversation_new(account, sms->from);
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+				server_msg, 0);
 		}
 		else {
 			purple_notify_error(gc, NULL,
@@ -4473,8 +4475,8 @@
 	PurpleIMConversation *im = purple_conversations_find_im_with_account(sms_cb_data->who, account);
 
 	if (!purple_http_response_is_successful(response)) {
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL,
-				_("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+			_("Can't send SMS. Unable to obtain mobile carrier."), 0);
 
 		g_free(sms_cb_data->who);
 		g_free(sms_cb_data->what);
@@ -4503,9 +4505,8 @@
 		} else {
 			g_hash_table_insert(yd->sms_carrier,
 					g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL,
-					_("Can't send SMS. Unknown mobile carrier."),
-					PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+				_("Can't send SMS. Unknown mobile carrier."), 0);
 		}
 
 		purple_xmlnode_free(validate_data_child);
@@ -4610,7 +4611,8 @@
 			sms_cb_data->who = g_strdup(who);
 			sms_cb_data->what = g_strdup(purple_message_get_contents(pmsg));
 
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, _("Getting mobile carrier to send the SMS."), PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+				_("Getting mobile carrier to send the SMS."), 0);
 
 			yahoo_get_sms_carrier(gc, sms_cb_data);
 
@@ -4619,7 +4621,8 @@
 			return ret;
 		}
 		else if( strcmp(carrier,"Unknown") == 0 ) {
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(im),
+				_("Can't send SMS. Unknown mobile carrier."), 0);
 
 			g_free(msg);
 			g_free(msg2);
--- a/libpurple/protocols/yahoo/yahoochat.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/protocols/yahoo/yahoochat.c	Thu May 22 21:04:56 2014 +0200
@@ -267,8 +267,8 @@
 			}
 
 			tmp = g_strdup_printf(_("%s has declined to join."), who);
-			purple_conversation_write(PURPLE_CONVERSATION(c), NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, time(NULL));
+			purple_conversation_write_system_message(PURPLE_CONVERSATION(c),
+				tmp, PURPLE_MESSAGE_NO_LINKIFY);
 
 			g_free(tmp);
 		}
--- a/libpurple/server.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/server.c	Thu May 22 21:04:56 2014 +0200
@@ -265,9 +265,9 @@
 			char *tmp = g_strdup_printf(_("%s is now known as %s.\n"),
 										escaped, escaped2);
 
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, tmp,
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY,
-					time(NULL));
+			purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(im), tmp,
+				PURPLE_MESSAGE_NO_LINKIFY);
 
 			g_free(tmp);
 			g_free(escaped2);
--- a/libpurple/xfer.c	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/xfer.c	Thu May 22 21:04:56 2014 +0200
@@ -268,12 +268,12 @@
 
 		message_with_img = g_strdup_printf("<img src=\""
 			PURPLE_IMAGE_STORE_PROTOCOL "%u\"> %s", id, escaped);
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL,
-			message_with_img, flags, time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), message_with_img, flags);
 		g_free(message_with_img);
 	} else {
-		purple_conversation_write(PURPLE_CONVERSATION(im), NULL, escaped, flags,
-			time(NULL));
+		purple_conversation_write_system_message(
+			PURPLE_CONVERSATION(im), escaped, flags);
 	}
 	g_free(escaped);
 }
@@ -958,9 +958,10 @@
 		im = purple_conversations_find_im_with_account(priv->who,
 		                                             purple_xfer_get_account(xfer));
 
-		if (im != NULL)
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, msg,
-					PURPLE_MESSAGE_SYSTEM, time(NULL));
+		if (im != NULL) {
+			purple_conversation_write_system_message(
+				PURPLE_CONVERSATION(im), msg, 0);
+		}
 		g_free(msg);
 	}
 
--- a/libpurple/xfer.h	Thu May 22 20:20:19 2014 +0200
+++ b/libpurple/xfer.h	Thu May 22 21:04:56 2014 +0200
@@ -767,7 +767,7 @@
  *
  * Displays a file transfer-related message in the conversation window
  *
- * This is a wrapper around purple_conversation_write
+ * This is a wrapper around purple_conversation_write_system_message
  */
 void purple_xfer_conversation_write(PurpleXfer *xfer, const gchar *message, gboolean is_error);
 
--- a/pidgin/gtkconv.c	Thu May 22 20:20:19 2014 +0200
+++ b/pidgin/gtkconv.c	Thu May 22 21:04:56 2014 +0200
@@ -385,30 +385,35 @@
 	} else if (!g_ascii_strcasecmp(args[0], "unsafe")) {
 		if (purple_debug_is_unsafe()) {
 			purple_debug_set_unsafe(FALSE);
-			purple_conversation_write(conv, NULL, _("Unsafe debugging is now disabled."),
-			                          PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unsafe debugging is now disabled."),
+				PURPLE_MESSAGE_NO_LOG);
 		} else {
 			purple_debug_set_unsafe(TRUE);
-			purple_conversation_write(conv, NULL, _("Unsafe debugging is now enabled."),
-			                          PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Unsafe debugging is now enabled."),
+				PURPLE_MESSAGE_NO_LOG);
 		}
 
 		return PURPLE_CMD_RET_OK;
 	} else if (!g_ascii_strcasecmp(args[0], "verbose")) {
 		if (purple_debug_is_verbose()) {
 			purple_debug_set_verbose(FALSE);
-			purple_conversation_write(conv, NULL, _("Verbose debugging is now disabled."),
-			                          PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Verbose debugging is now disabled."),
+				PURPLE_MESSAGE_NO_LOG);
 		} else {
 			purple_debug_set_verbose(TRUE);
-			purple_conversation_write(conv, NULL, _("Verbose debugging is now enabled."),
-			                          PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_SYSTEM, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("Verbose debugging is now enabled."),
+				PURPLE_MESSAGE_NO_LOG);
 		}
 
 		return PURPLE_CMD_RET_OK;
 	} else {
-		purple_conversation_write(conv, NULL, _("Supported debug options are: plugins version unsafe verbose"),
-		                        PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Supported debug options are: plugins version unsafe verbose"),
+			PURPLE_MESSAGE_NO_LOG);
 		return PURPLE_CMD_RET_OK;
 	}
 
@@ -483,7 +488,7 @@
 		g_list_free(text);
 	}
 
-	purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL));
+	purple_conversation_write_system_message(conv, s->str, PURPLE_MESSAGE_NO_LOG);
 	g_string_free(s, TRUE);
 
 	return PURPLE_CMD_RET_OK;
@@ -524,8 +529,8 @@
 		cmdline = cmd + strlen(prefix);
 
 		if (strcmp(cmdline, "xyzzy") == 0) {
-			purple_conversation_write(conv, "", "Nothing happens",
-					PURPLE_MESSAGE_NO_LOG, time(NULL));
+			purple_conversation_write_system_message(conv,
+				"Nothing happens", PURPLE_MESSAGE_NO_LOG);
 			g_free(cmd);
 			return TRUE;
 		}
@@ -557,36 +562,42 @@
 							spaceslash++;
 
 						if (*spaceslash != '/') {
-							purple_conversation_write(conv, "", _("Unknown command."), PURPLE_MESSAGE_NO_LOG, time(NULL));
+							purple_conversation_write_system_message(conv,
+								_("Unknown command."), PURPLE_MESSAGE_NO_LOG);
 							retval = TRUE;
 						}
 					}
 					break;
 				}
 			case PURPLE_CMD_STATUS_WRONG_ARGS:
-				purple_conversation_write(conv, "", _("Syntax Error:  You typed the wrong number of arguments "
-								    "to that command."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("Syntax Error:  You typed the wrong "
+					"number of arguments to that command."),
+					PURPLE_MESSAGE_NO_LOG);
 				retval = TRUE;
 				break;
 			case PURPLE_CMD_STATUS_FAILED:
-				purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					error ? error : _("Your command failed for an unknown reason."),
+					PURPLE_MESSAGE_NO_LOG);
 				g_free(error);
 				retval = TRUE;
 				break;
 			case PURPLE_CMD_STATUS_WRONG_TYPE:
 				if(PURPLE_IS_IM_CONVERSATION(conv))
-					purple_conversation_write(conv, "", _("That command only works in chats, not IMs."),
-							PURPLE_MESSAGE_NO_LOG, time(NULL));
+					purple_conversation_write_system_message(conv,
+						_("That command only works in chats, not IMs."),
+						PURPLE_MESSAGE_NO_LOG);
 				else
-					purple_conversation_write(conv, "", _("That command only works in IMs, not chats."),
-							PURPLE_MESSAGE_NO_LOG, time(NULL));
+					purple_conversation_write_system_message(conv,
+						_("That command only works in IMs, not chats."),
+						PURPLE_MESSAGE_NO_LOG);
 				retval = TRUE;
 				break;
 			case PURPLE_CMD_STATUS_WRONG_PRPL:
-				purple_conversation_write(conv, "", _("That command doesn't work on this protocol."),
-						PURPLE_MESSAGE_NO_LOG, time(NULL));
+				purple_conversation_write_system_message(conv,
+					_("That command doesn't work on this protocol."),
+					PURPLE_MESSAGE_NO_LOG);
 				retval = TRUE;
 				break;
 		}
@@ -1403,17 +1414,13 @@
 		/* Enable logging first so the message below can be logged. */
 		purple_conversation_set_logging(conv, TRUE);
 
-		purple_conversation_write(conv, NULL,
-								_("Logging started. Future messages in this conversation will be logged."),
-								PURPLE_MESSAGE_SYSTEM,
-								time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Logging started. Future messages in this conversation will be logged."), 0);
 	}
 	else
 	{
-		purple_conversation_write(conv, NULL,
-								_("Logging stopped. Future messages in this conversation will not be logged."),
-								PURPLE_MESSAGE_SYSTEM,
-								time(NULL));
+		purple_conversation_write_system_message(conv,
+			_("Logging stopped. Future messages in this conversation will not be logged."), 0);
 
 		/* Disable the logging second, so that the above message can be logged. */
 		purple_conversation_set_logging(conv, FALSE);
@@ -4615,8 +4622,7 @@
 			matches = g_list_remove(matches, matches->data);
 		}
 
-		purple_conversation_write(conv, NULL, addthis, PURPLE_MESSAGE_NO_LOG,
-								time(NULL));
+		purple_conversation_write_system_message(conv, addthis, PURPLE_MESSAGE_NO_LOG);
 
 		modified = g_strdup_printf("%s%s%s", sub1, partial, sub2);
 		webkit_dom_node_set_node_value(container, modified, NULL);
@@ -8362,10 +8368,11 @@
 		if (!purple_chat_conversation_has_left(PURPLE_CHAT_CONVERSATION(conv)) &&
 				purple_conversation_get_account(conv) == account) {
 			g_object_set_data(G_OBJECT(conv), "want-to-rejoin", GINT_TO_POINTER(TRUE));
-			purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
-						"longer in this chat. You will automatically rejoin the chat when "
-						"the account reconnects."),
-					PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL));
+			purple_conversation_write_system_message(conv,
+				_("The account has disconnected and you are no "
+				"longer in this chat. You will automatically "
+				"rejoin the chat when the account reconnects."),
+				PURPLE_MESSAGE_NO_LOG);
 		}
 		list = list->next;
 	}
--- a/pidgin/gtkmedia.c	Thu May 22 20:20:19 2014 +0200
+++ b/pidgin/gtkmedia.c	Thu May 22 21:04:56 2014 +0200
@@ -522,8 +522,7 @@
 			gtkmedia->priv->screenname,
 			purple_media_get_account(gtkmedia->priv->media));
 	if (conv != NULL)
-		purple_conversation_write(conv, NULL, msg,
-				PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(conv, msg, 0);
 }
 
 typedef struct
@@ -595,8 +594,8 @@
 			gtkmedia->priv->screenname,
 			purple_media_get_account(gtkmedia->priv->media));
 	if (conv != NULL) {
-		purple_conversation_write(conv, NULL, error,
-			PURPLE_MESSAGE_ERROR, time(NULL));
+		purple_conversation_write_system_message(
+			conv, error, PURPLE_MESSAGE_ERROR);
 	} else {
 		purple_notify_error(NULL, NULL, _("Media error"), error,
 			purple_request_cpar_from_conversation(conv));
--- a/pidgin/gtkpounce.c	Thu May 22 20:20:19 2014 +0200
+++ b/pidgin/gtkpounce.c	Thu May 22 21:04:56 2014 +0200
@@ -1487,12 +1487,9 @@
 			if (im == NULL)
 				im = purple_im_conversation_new(account, pouncee);
 
-			pmsg = purple_message_new(pouncee, message, 0);
-
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, message,
-									PURPLE_MESSAGE_SEND, time(NULL));
-
+			pmsg = purple_message_new(pouncee, message, PURPLE_MESSAGE_SEND);
 			purple_serv_send_im(purple_account_get_connection(account), pmsg);
+			purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg);
 		}
 	}
 

mercurial