[empathy] EmpathyMessage: remove flags, they are useless



commit 864a9b3129b14146ba0d2e893da99ced1960a678
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Wed Oct 2 16:53:43 2013 -0400

    EmpathyMessage: remove flags, they are useless

 libempathy-gtk/empathy-chat.c |    4 +---
 libempathy/empathy-message.c  |   37 ++-----------------------------------
 libempathy/empathy-message.h  |    2 --
 3 files changed, 3 insertions(+), 40 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index a9f1bb8..c6cc8e0 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1434,7 +1434,6 @@ chat_should_highlight (EmpathyChat *chat,
 {
        EmpathyChatPriv *priv = GET_PRIV (chat);
        const gchar   *msg;
-       TpChannelTextMessageFlags flags;
 
        g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
 
@@ -1451,8 +1450,7 @@ chat_should_highlight (EmpathyChat *chat,
                return FALSE;
        }
 
-       flags = empathy_message_get_flags (message);
-       if (flags & TP_CHANNEL_TEXT_MESSAGE_FLAG_SCROLLBACK) {
+       if (empathy_message_is_backlog (message)) {
                /* FIXME: Ideally we shouldn't highlight scrollback messages only if they
                 * have already been received by the user before (and so are in the logs) */
                return FALSE;
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index d6f30a6..ab683c7 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -46,7 +46,6 @@ typedef struct {
        gboolean                  is_backlog;
        guint                     id;
        gboolean                  incoming;
-       TpChannelTextMessageFlags flags;
 } EmpathyMessagePriv;
 
 static void empathy_message_finalize   (GObject            *object);
@@ -73,7 +72,6 @@ enum {
        PROP_ORIGINAL_TIMESTAMP,
        PROP_IS_BACKLOG,
        PROP_INCOMING,
-       PROP_FLAGS,
        PROP_TP_MESSAGE,
 };
 
@@ -168,15 +166,6 @@ empathy_message_class_init (EmpathyMessageClass *class)
                                                               G_PARAM_CONSTRUCT_ONLY));
 
        g_object_class_install_property (object_class,
-                                        PROP_FLAGS,
-                                        g_param_spec_uint ("flags",
-                                                              "Flags",
-                                                              "The TpChannelTextMessageFlags of this 
message",
-                                                              0, G_MAXUINT, 0,
-                                                              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
-                                                              G_PARAM_CONSTRUCT_ONLY));
-
-       g_object_class_install_property (object_class,
                                         PROP_TP_MESSAGE,
                                         g_param_spec_object ("tp-message",
                                                               "TpMessage",
@@ -265,9 +254,6 @@ message_get_property (GObject    *object,
        case PROP_INCOMING:
                g_value_set_boolean (value, priv->incoming);
                break;
-       case PROP_FLAGS:
-               g_value_set_uint (value, priv->flags);
-               break;
        case PROP_TP_MESSAGE:
                g_value_set_object (value, priv->tp_message);
                break;
@@ -325,9 +311,6 @@ message_set_property (GObject      *object,
        case PROP_INCOMING:
                priv->incoming = g_value_get_boolean (value);
                break;
-       case PROP_FLAGS:
-               priv->flags = g_value_get_uint (value);
-               break;
        case PROP_TP_MESSAGE:
                priv->tp_message = g_value_dup_object (value);
                break;
@@ -686,31 +669,19 @@ empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2)
        return FALSE;
 }
 
-TpChannelTextMessageFlags
-empathy_message_get_flags (EmpathyMessage *self)
-{
-       EmpathyMessagePriv *priv = GET_PRIV (self);
-
-       g_return_val_if_fail (EMPATHY_IS_MESSAGE (self), 0);
-
-       return priv->flags;
-}
-
 EmpathyMessage *
 empathy_message_new_from_tp_message (TpMessage *tp_msg,
                                     gboolean incoming)
 {
        EmpathyMessage *message;
        gchar *body;
-       TpChannelTextMessageFlags flags;
        gint64 timestamp;
        gint64 original_timestamp;
        const GHashTable *part = tp_message_peek (tp_msg, 0);
-       gboolean is_backlog;
 
        g_return_val_if_fail (TP_IS_MESSAGE (tp_msg), NULL);
 
-       body = tp_message_to_text (tp_msg, &flags);
+       body = tp_message_to_text (tp_msg, NULL);
 
        timestamp = tp_message_get_sent_timestamp (tp_msg);
        if (timestamp == 0)
@@ -719,9 +690,6 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg,
        original_timestamp = tp_asv_get_int64 (part,
                "original-message-received", NULL);
 
-       is_backlog = (flags & TP_CHANNEL_TEXT_MESSAGE_FLAG_SCROLLBACK) ==
-               TP_CHANNEL_TEXT_MESSAGE_FLAG_SCROLLBACK;
-
        message = g_object_new (EMPATHY_TYPE_MESSAGE,
                "body", body,
                "token", tp_message_get_token (tp_msg),
@@ -729,8 +697,7 @@ empathy_message_new_from_tp_message (TpMessage *tp_msg,
                "type", tp_message_get_message_type (tp_msg),
                "timestamp", timestamp,
                "original-timestamp", original_timestamp,
-               "flags", flags,
-               "is-backlog", is_backlog,
+               "is-backlog", tp_message_is_scrollback (tp_msg),
                "incoming", incoming,
                "tp-message", tp_msg,
                NULL);
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index db38ddf..ba115b6 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -81,8 +81,6 @@ const gchar *            empathy_message_type_to_str       (TpChannelTextMessage
 
 gboolean                 empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2);
 
-TpChannelTextMessageFlags empathy_message_get_flags        (EmpathyMessage           *message);
-
 G_END_DECLS
 
 #endif /* __EMPATHY_MESSAGE_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]