/pidgin/main: 5e1693f7c0d5: Remove whisper completely, fix flags...

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu May 22 13:37:36 EDT 2014


Changeset: 5e1693f7c0d5837f252a1f469ddfbfbfdcee37fc
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-22 19:26 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/5e1693f7c0d5

Description:

Remove whisper completely, fix flags property in PurpleMessage

diffstat:

 finch/plugins/gntgf.c         |   3 ---
 libpurple/conversation.h      |   2 --
 libpurple/conversationtypes.c |   2 +-
 libpurple/log.c               |   7 +------
 libpurple/message.c           |  12 ++++++------
 pidgin/gtkconv.c              |  17 +----------------
 6 files changed, 9 insertions(+), 34 deletions(-)

diffs (139 lines):

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/libpurple/conversation.h b/libpurple/conversation.h
--- a/libpurple/conversation.h
+++ b/libpurple/conversation.h
@@ -112,7 +112,6 @@ typedef enum
  *                              conversations).
  * @PURPLE_MESSAGE_NICK:        Contains your nick.
  * @PURPLE_MESSAGE_NO_LOG:      Do not log.
- * @PURPLE_MESSAGE_WHISPER:     Whispered message.
  * @PURPLE_MESSAGE_ERROR:       Error message.
  * @PURPLE_MESSAGE_DELAYED:     Delayed message.
  * @PURPLE_MESSAGE_RAW:         "Raw" message - don't apply formatting
@@ -132,7 +131,6 @@ typedef enum /*< flags >*/
 	PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010,
 	PURPLE_MESSAGE_NICK        = 0x0020,
 	PURPLE_MESSAGE_NO_LOG      = 0x0040,
-	PURPLE_MESSAGE_WHISPER     = 0x0080,
 	PURPLE_MESSAGE_ERROR       = 0x0200,
 	PURPLE_MESSAGE_DELAYED     = 0x0400,
 	PURPLE_MESSAGE_RAW         = 0x0800,
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -822,7 +822,7 @@ chat_conversation_write_message(PurpleCo
 		mtime = time(NULL);
 	}
 
-	if (!(flags & PURPLE_MESSAGE_WHISPER)) {
+	if (TRUE) {
 		const char *str;
 
 		str = purple_normalize(account, who);
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -1467,9 +1467,6 @@ static gsize html_logger_write(PurpleLog
 			written += fprintf(data->file, "<font size=\"2\">(%s)</font> %s<br/>\n", date, msg_fixed);
 		else if (type & PURPLE_MESSAGE_ERROR)
 			written += fprintf(data->file, "<font color=\"#FF0000\"><font size=\"2\">(%s)</font><b> %s</b></font><br/>\n", date, msg_fixed);
-		else if (type & PURPLE_MESSAGE_WHISPER)
-			written += fprintf(data->file, "<font color=\"#6C2585\"><font size=\"2\">(%s)</font><b> %s:</b></font> %s<br/>\n",
-					date, escaped_from, msg_fixed);
 		else if (type & PURPLE_MESSAGE_AUTO_RESP) {
 			if (type & PURPLE_MESSAGE_SEND)
 				written += fprintf(data->file, _("<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, escaped_from, msg_fixed);
@@ -1625,9 +1622,7 @@ static gsize txt_logger_write(PurpleLog 
 			/* This shouldn't happen */
 			g_free(stripped);
 			return written;
-		} else if (type & PURPLE_MESSAGE_WHISPER)
-			written += fprintf(data->file, "(%s) *%s* %s", date, from, stripped);
-		else
+		} else
 			written += fprintf(data->file, "(%s) %s%s %s\n", date, from ? from : "",
 					from ? ":" : "", stripped);
 	}
diff --git a/libpurple/message.c b/libpurple/message.c
--- a/libpurple/message.c
+++ b/libpurple/message.c
@@ -24,6 +24,7 @@
 #include "glibcompat.h"
 
 #include "debug.h"
+#include "enums.h"
 #include "message.h"
 
 #define PURPLE_MESSAGE_GET_PRIVATE(obj) \
@@ -201,7 +202,7 @@ purple_message_get_property(GObject *obj
 			g_value_set_uint64(value, priv->msgtime);
 			break;
 		case PROP_FLAGS:
-			g_value_set_uint(value, priv->flags);
+			g_value_set_flags(value, priv->flags);
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec);
@@ -229,7 +230,7 @@ purple_message_set_property(GObject *obj
 			priv->msgtime = g_value_get_uint64(value);
 			break;
 		case PROP_FLAGS:
-			priv->flags = g_value_get_uint(value);
+			priv->flags = g_value_get_flags(value);
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec);
@@ -264,11 +265,10 @@ purple_message_class_init(PurpleMessageC
 	properties[PROP_TIME] = g_param_spec_uint64("time",
 		"Time", "Message time",
 		0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	/* XXX: it should be spec_enum, but PurpleMessageFlags isn't
-	 * gobjectified (yet) */
-	properties[PROP_FLAGS] = g_param_spec_uint("flags",
+	properties[PROP_FLAGS] = g_param_spec_flags("flags",
 		"Flags", "Bitwise set of #PurpleMessageFlags flags",
-		0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+		PURPLE_TYPE_MESSAGE_FLAGS, 0,
+		G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
 	g_object_class_install_properties(gobj_class, PROP_LAST, properties);
 }
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -6899,22 +6899,7 @@ pidgin_conv_write_conv(PurpleConversatio
 			str_embed_direction_chars(&alias_escaped);
 
 		str = g_malloc(1024);
-		if (flags & PURPLE_MESSAGE_WHISPER) {
-			/* If we're whispering, it's not an autoresponse. */
-			if (purple_message_meify(new_message, -1 )) {
-				g_snprintf(str, 1024, "***%s", alias_escaped);
-				tag_start_offset += 3;
-				tagname = "whisper-action-name";
-			}
-			else {
-				g_snprintf(str, 1024, "*%s*:", alias_escaped);
-				tag_start_offset += 1;
-#if 0
-				tag_end_offset = 2;
-#endif
-				tagname = "whisper-name";
-			}
-		} else {
+		if (TRUE) { /* XXX: reduce numer of indentations */
 			if (purple_message_meify(new_message, -1)) {
 				if (flags & PURPLE_MESSAGE_AUTO_RESP) {
 					g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped);



More information about the Commits mailing list