/soc/2013/ankitkv/gobjectification: 50f361d39a1e: Merged default...

Ankit Vani a at nevitus.org
Fri May 23 17:08:01 EDT 2014


Changeset: 50f361d39a1ea79db772a78d2ff9091a64bef4a7
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-05-24 02:32 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/50f361d39a1e

Description:

Merged default branch

diffstat:

 finch/gntconv.c                                        |  109 +--
 finch/gntmedia.c                                       |    2 +-
 finch/gntpounce.c                                      |    9 +-
 finch/gntsound.c                                       |   10 +-
 finch/plugins/gntgf.c                                  |    3 -
 finch/plugins/gnthistory.c                             |    6 +-
 libpurple/Makefile.am                                  |    2 +
 libpurple/connection.c                                 |   24 +
 libpurple/connection.h                                 |   29 +-
 libpurple/conversation.c                               |   50 +-
 libpurple/conversation.h                               |   54 +-
 libpurple/conversations.c                              |   20 +-
 libpurple/conversationtypes.c                          |   90 +-
 libpurple/core.c                                       |    5 +
 libpurple/dbus-define-api.h                            |    1 -
 libpurple/idle.c                                       |    3 +-
 libpurple/internal.h                                   |   59 ++
 libpurple/log.c                                        |   12 +-
 libpurple/message.c                                    |  404 +++++++++++++++++
 libpurple/message.h                                    |  143 ++++++
 libpurple/plugins/codeinline.c                         |   35 +-
 libpurple/plugins/offlinemsg.c                         |   26 +-
 libpurple/plugins/perl/common/Conversation.xs          |   17 -
 libpurple/plugins/perl/common/Server.xs                |   21 -
 libpurple/plugins/psychic.c                            |    7 +-
 libpurple/plugins/signals-test.c                       |   22 +-
 libpurple/plugins/statenotify.c                        |    5 +-
 libpurple/plugins/tcl/tcl_cmds.c                       |   13 +-
 libpurple/protocol.c                                   |   16 +-
 libpurple/protocol.h                                   |   28 +-
 libpurple/protocols.c                                  |    8 +-
 libpurple/protocols/bonjour/bonjour.c                  |    8 +-
 libpurple/protocols/bonjour/jabber.c                   |   54 +-
 libpurple/protocols/gg/avatar.c                        |   13 +-
 libpurple/protocols/gg/chat.c                          |   33 +-
 libpurple/protocols/gg/chat.h                          |    3 +-
 libpurple/protocols/gg/edisc.c                         |    2 +-
 libpurple/protocols/gg/gg.c                            |   10 +-
 libpurple/protocols/gg/image-prpl.c                    |    5 +-
 libpurple/protocols/gg/message-prpl.c                  |   35 +-
 libpurple/protocols/gg/message-prpl.h                  |    3 +-
 libpurple/protocols/gg/oauth/oauth-purple.c            |   12 +-
 libpurple/protocols/gg/pubdir-prpl.c                   |   12 +-
 libpurple/protocols/gg/roster.c                        |    2 +-
 libpurple/protocols/gg/tcpsocket.c                     |    5 +
 libpurple/protocols/irc/cmds.c                         |   36 +-
 libpurple/protocols/irc/irc.c                          |   20 +-
 libpurple/protocols/irc/msgs.c                         |   69 +-
 libpurple/protocols/jabber/auth.c                      |   10 +-
 libpurple/protocols/jabber/auth_cyrus.c                |   10 +-
 libpurple/protocols/jabber/chat.c                      |   14 +-
 libpurple/protocols/jabber/jabber.c                    |   41 +-
 libpurple/protocols/jabber/message.c                   |   45 +-
 libpurple/protocols/jabber/message.h                   |    5 +-
 libpurple/protocols/jabber/presence.c                  |   27 +-
 libpurple/protocols/msn/msg.c                          |   11 +-
 libpurple/protocols/msn/msn.c                          |   44 +-
 libpurple/protocols/msn/notification.c                 |   10 +-
 libpurple/protocols/msn/session.c                      |    3 +-
 libpurple/protocols/msn/slpcall.c                      |   12 +-
 libpurple/protocols/msn/switchboard.c                  |    6 +-
 libpurple/protocols/msn/userlist.c                     |   42 +-
 libpurple/protocols/mxit/actions.c                     |   10 +-
 libpurple/protocols/mxit/login.c                       |    5 +-
 libpurple/protocols/mxit/multimx.c                     |   18 +-
 libpurple/protocols/mxit/multimx.h                     |    2 +-
 libpurple/protocols/mxit/mxit.c                        |    8 +-
 libpurple/protocols/novell/novell.c                    |   34 +-
 libpurple/protocols/null/nullprpl.c                    |  113 +----
 libpurple/protocols/oscar/odc.c                        |   11 +-
 libpurple/protocols/oscar/oscar.c                      |   39 +-
 libpurple/protocols/oscar/oscarcommon.h                |    4 +-
 libpurple/protocols/oscar/peer.c                       |   12 +-
 libpurple/protocols/sametime/sametime.c                |   52 +-
 libpurple/protocols/silc/chat.c                        |    5 +-
 libpurple/protocols/silc/ops.c                         |   41 +-
 libpurple/protocols/silc/silc.c                        |   56 +-
 libpurple/protocols/silc/silcpurple.h                  |    2 +-
 libpurple/protocols/simple/simple.c                    |    6 +-
 libpurple/protocols/yahoo/yahoo_doodle.c               |    4 +-
 libpurple/protocols/yahoo/yahoochat.c                  |   23 +-
 libpurple/protocols/yahoo/yahoochat.h                  |    2 +-
 libpurple/protocols/yahoo/ycht.c                       |    2 +-
 libpurple/protocols/yahoo/ymsg.c                       |   63 +-
 libpurple/protocols/yahoo/ymsg.h                       |    2 +-
 libpurple/protocols/zephyr/zephyr.c                    |   19 +-
 libpurple/purple-socket.c                              |   81 +++-
 libpurple/server.c                                     |   53 +-
 libpurple/server.h                                     |    6 +-
 libpurple/sound.c                                      |    2 +
 libpurple/xfer.c                                       |   15 +-
 libpurple/xfer.h                                       |    2 +-
 pidgin/gtkconv.c                                       |  129 ++---
 pidgin/gtkmedia.c                                      |    7 +-
 pidgin/gtkpounce.c                                     |    9 +-
 pidgin/gtksound.c                                      |   13 +-
 pidgin/plugins/cap/cap.c                               |    9 +-
 pidgin/plugins/cap/cap.h                               |    2 +-
 pidgin/plugins/imgupload.c                             |    6 +-
 pidgin/plugins/musicmessaging/musicmessaging.c         |   27 +-
 pidgin/plugins/notify.c                                |    7 +-
 pidgin/plugins/screencap.c                             |    3 +-
 pidgin/plugins/unity.c                                 |    7 +-
 pidgin/themes/Contents/Resources/Content.html          |    2 +-
 pidgin/themes/Contents/Resources/Incoming/Content.html |    2 +-
 po/POTFILES.in                                         |    2 +
 106 files changed, 1639 insertions(+), 1113 deletions(-)

diffs (truncated from 6046 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_PROTOCOL:
-				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);
@@ -764,8 +771,8 @@ create_conv_from_userlist(GntWidget *wid
 	char *name, *realname = NULL;
 
 	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;
 	}
 
@@ -1084,39 +1091,6 @@ finch_write_common(PurpleConversation *c
 }
 
 static void
-finch_write_chat(PurpleChatConversation *chat, const char *who, const char *message,
-		PurpleMessageFlags flags, time_t mtime)
-{
-	purple_conversation_write(PURPLE_CONVERSATION(chat), who, message, flags, mtime);
-}
-
-static void
-finch_write_im(PurpleIMConversation *im, const char *who, const char *message,
-		PurpleMessageFlags flags, time_t mtime)
-{
-	PurpleConversation *conv = PURPLE_CONVERSATION(im);
-	PurpleAccount *account = purple_conversation_get_account(conv);
-	if (flags & PURPLE_MESSAGE_SEND)
-	{
-		who = purple_connection_get_display_name(purple_account_get_connection(account));
-		if (!who)
-			who = purple_account_get_private_alias(account);
-		if (!who)
-			who = purple_account_get_username(account);
-	}
-	else if (flags & PURPLE_MESSAGE_RECV)
-	{
-		PurpleBuddy *buddy;
-		who = purple_conversation_get_name(conv);
-		buddy = purple_blist_find_buddy(account, who);
-		if (buddy)
-			who = purple_buddy_get_contact_alias(buddy);
-	}
-
-	purple_conversation_write(conv, who, message, flags, mtime);
-}
-
-static void
 finch_write_conv(PurpleConversation *conv, const char *who, const char *alias,
 		const char *message, PurpleMessageFlags flags, time_t mtime)
 {
@@ -1171,8 +1145,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);
 	}
 
@@ -1254,8 +1228,8 @@ static PurpleConversationUiOps conv_ui_o
 {
 	finch_create_conversation,
 	finch_destroy_conversation,
-	finch_write_chat,
-	finch_write_im,
+	NULL, /* write_chat */
+	NULL, /* write_im */
 	finch_write_conv,
 	finch_chat_add_users,
 	finch_chat_rename_user,
@@ -1330,8 +1304,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;
 	}
 
@@ -1386,7 +1361,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/gntmedia.c b/finch/gntmedia.c
--- a/finch/gntmedia.c
+++ b/finch/gntmedia.c
@@ -374,7 +374,7 @@ static void
 gntmedia_message_cb(FinchMedia *gntmedia, const char *msg, PurpleConversation *conv)
 {
 	if (PURPLE_IS_IM_CONVERSATION(conv)) {
-		purple_conversation_write_message(conv, NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_conversation_write_system_message(conv, msg, 0);
 	}
 }
 
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -868,15 +868,16 @@ pounce_cb(PurplePounce *pounce, PurplePo
 
 		if (message != NULL)
 		{
+			PurpleMessage *pmsg;
+
 			im = purple_conversations_find_im_with_account(pouncee, account);
 
 			if (im == NULL)
 				im = purple_im_conversation_new(account, pouncee);
 
-			purple_conversation_write(PURPLE_CONVERSATION(im), NULL, message,
-									PURPLE_MESSAGE_SEND, time(NULL));
-
-			purple_serv_send_im(purple_account_get_connection(account), (char *)pouncee, (char *)message, 0);
+			pmsg = purple_message_new_outgoing(pouncee, message, 0);
+			purple_serv_send_im(purple_account_get_connection(account), pmsg);
+			purple_conversation_write_message(PURPLE_CONVERSATION(im), pmsg);
 		}
 	}
 
diff --git a/finch/gntsound.c b/finch/gntsound.c
--- a/finch/gntsound.c
+++ b/finch/gntsound.c
@@ -204,11 +204,11 @@ im_msg_received_cb(PurpleAccount *accoun
 }
 
 static void
-im_msg_sent_cb(PurpleAccount *account, const char *receiver,
-			   const char *message, PurpleSoundEventID event)
+im_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg,
+	PurpleSoundEventID event)
 {
 	PurpleIMConversation *im = purple_conversations_find_im_with_account(
-			receiver, account);
+		purple_message_get_recipient(msg), account);
 	play_conv_event(PURPLE_CONVERSATION(im), event);
 }
 
@@ -230,8 +230,8 @@ chat_user_left_cb(PurpleChatConversation
 }
 
 static void
-chat_msg_sent_cb(PurpleAccount *account, const char *message,
-				 int id, PurpleSoundEventID event)
+chat_msg_sent_cb(PurpleAccount *account, PurpleMessage *msg, int id,
+	PurpleSoundEventID event)
 {
 	PurpleConnection *conn = purple_account_get_connection(account);
 	PurpleChatConversation *chat = NULL;
diff --git a/finch/plugins/gntgf.c b/finch/plugins/gntgf.c
--- a/finch/plugins/gntgf.c
+++ b/finch/plugins/gntgf.c
@@ -254,9 +254,6 @@ received_chat_msg(PurpleAccount *account
 	const char *nick;
 	PurpleConversation *conv = PURPLE_CONVERSATION(chat);
 
-	if (flags & PURPLE_MESSAGE_WHISPER)
-		return;
-
 	nick = purple_chat_conversation_get_nick(chat);
 
 	if (g_utf8_collate(sender, nick) == 0)
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/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -83,6 +83,7 @@ purple_coresources = \
 	media.c \
 	mediamanager.c \
 	memorypool.c \
+	message.c \



More information about the Commits mailing list