/pidgin/main: c035b9a63457: Use purple_conversation_write_system...

Tomasz Wasilczyk <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: c035b9a6345759d145621fdd8be40aeee01f1d64
Author:	 Tomasz Wasilczyk <[email protected]>
Date:	 2014-05-22 21:04 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/c035b9a63457

Description:

Use purple_conversation_write_system_message where appropriate

diffstat:

 finch/gntconv.c                               |  72 ++++++++++++----------
 finch/gntpounce.c                             |   7 +-
 finch/plugins/gnthistory.c                    |   6 +-
 libpurple/conversation.c                      |   2 +-
 libpurple/conversationtypes.c                 |  15 +--
 libpurple/log.c                               |   5 +-
 libpurple/plugins/offlinemsg.c                |  11 +-
 libpurple/plugins/perl/common/Conversation.xs |   8 --
 libpurple/plugins/psychic.c                   |   7 +-
 libpurple/protocols/bonjour/jabber.c          |  44 ++++++------
 libpurple/protocols/gg/chat.c                 |  22 ++++--
 libpurple/protocols/gg/image-prpl.c           |   5 +-
 libpurple/protocols/gg/message-prpl.c         |  18 ++--
 libpurple/protocols/irc/msgs.c                |   7 +-
 libpurple/protocols/jabber/jabber.c           |  16 ++--
 libpurple/protocols/jabber/message.c          |   8 +-
 libpurple/protocols/msn/msg.c                 |   7 +-
 libpurple/protocols/msn/notification.c        |  10 +-
 libpurple/protocols/msn/slpcall.c             |  12 +--
 libpurple/protocols/novell/novell.c           |   9 +-
 libpurple/protocols/oscar/odc.c               |  11 +-
 libpurple/protocols/oscar/oscar.c             |  24 ++++---
 libpurple/protocols/oscar/peer.c              |  12 +-
 libpurple/protocols/sametime/sametime.c       |  12 ++-
 libpurple/protocols/silc/ops.c                |  11 +-
 libpurple/protocols/silc/silc.c               |   3 +-
 libpurple/protocols/yahoo/libymsg.c           |  21 +++--
 libpurple/protocols/yahoo/yahoochat.c         |   4 +-
 libpurple/server.c                            |   6 +-
 libpurple/xfer.c                              |  15 ++--
 libpurple/xfer.h                              |   2 +-
 pidgin/gtkconv.c                              |  85 ++++++++++++++------------
 pidgin/gtkmedia.c                             |   7 +-
 pidgin/gtkpounce.c                            |   7 +-
 34 files changed, 259 insertions(+), 252 deletions(-)

diffs (truncated from 1264 to 300 lines):

diff --git a/finch/gntconv.c b/finch/gntconv.c
--- a/finch/gntconv.c
+++ b/finch/gntconv.c
@@ -151,37 +151,43 @@ entry_key_pressed(GntWidget *w, FinchCon
 			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 @@ account_signing_off(PurpleConnection *gc
 		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 @@ toggle_logging_cb(GntMenuItem *item, gpo
 		/* 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 @@ create_conv_from_userlist(GntWidget *wid
 	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 @@ finch_chat_add_users(PurpleChatConversat
 			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 @@ debug_command_cb(PurpleConversation *con
 
 		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 @@ help_command_cb(PurpleConversation *conv
 		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;
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -875,12 +875,9 @@ pounce_cb(PurplePounce *pounce, PurplePo
 			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);
 		}
 	}
 
diff --git a/finch/plugins/gnthistory.c b/finch/plugins/gnthistory.c
--- a/finch/plugins/gnthistory.c
+++ b/finch/plugins/gnthistory.c
@@ -115,15 +115,15 @@ static void historize(PurpleConversation
 
 	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);
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -759,7 +759,7 @@ gboolean purple_conversation_present_err
 
 	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;
 
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -946,9 +946,8 @@ purple_chat_conversation_add_users(Purpl
 			}
 			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 @@ purple_chat_conversation_rename_user(Pur
 			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 @@ purple_chat_conversation_remove_users(Pu
 			}
 			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);
 		}
 
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -942,8 +942,9 @@ void purple_log_common_writer(PurpleLog 
 					"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;
diff --git a/libpurple/plugins/offlinemsg.c b/libpurple/plugins/offlinemsg.c
--- a/libpurple/plugins/offlinemsg.c
+++ b/libpurple/plugins/offlinemsg.c
@@ -97,11 +97,12 @@ record_pounce(OfflineMsg *offline)
 	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));
 
diff --git a/libpurple/plugins/perl/common/Conversation.xs b/libpurple/plugins/perl/common/Conversation.xs
--- a/libpurple/plugins/perl/common/Conversation.xs
+++ b/libpurple/plugins/perl/common/Conversation.xs
@@ -200,14 +200,6 @@ purple_conversation_set_account(conv, ac
 	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
diff --git a/libpurple/plugins/psychic.c b/libpurple/plugins/psychic.c
--- a/libpurple/plugins/psychic.c
+++ b/libpurple/plugins/psychic.c
@@ -67,10 +67,9 @@ buddy_typing_cb(PurpleAccount *acct, con
 	 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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.