]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-theme-adium.c
local-xmpp-assistant-widget: increase row-spacing
[empathy.git] / libempathy-gtk / empathy-theme-adium.c
index 42c0914c83c94f66582b1ea1558e2e84a156caf6..98df46b79a9de43ee019f56544b9a46e0a461e33 100644 (file)
@@ -132,13 +132,15 @@ typedef struct {
        guint type;
        EmpathyMessage *msg;
        char *str;
+       gboolean should_highlight;
 } QueuedItem;
 
 static QueuedItem *
 queue_item (GQueue *queue,
            guint type,
            EmpathyMessage *msg,
-           const char *str)
+           const char *str,
+           gboolean should_highlight)
 {
        QueuedItem *item = g_slice_new0 (QueuedItem);
 
@@ -146,6 +148,7 @@ queue_item (GQueue *queue,
        if (msg != NULL)
                item->msg = g_object_ref (msg);
        item->str = g_strdup (str);
+       item->should_highlight = should_highlight;
 
        g_queue_push_tail (queue, item);
 
@@ -775,14 +778,15 @@ theme_adium_remove_all_focus_marks (EmpathyThemeAdium *theme)
 
 static void
 theme_adium_append_message (EmpathyChatView *view,
-                           EmpathyMessage  *msg)
+                           EmpathyMessage  *msg,
+                           gboolean         should_highlight)
 {
        EmpathyThemeAdium     *theme = EMPATHY_THEME_ADIUM (view);
        EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
        EmpathyContact        *sender;
        TpMessage             *tp_msg;
        TpAccount             *account;
-       gchar                 *body_escaped;
+       gchar                 *body_escaped, *name_escaped;
        const gchar           *name;
        const gchar           *contact_id;
        EmpathyAvatar         *avatar;
@@ -797,7 +801,7 @@ theme_adium_append_message (EmpathyChatView *view,
        gboolean               action;
 
        if (priv->pages_loading != 0) {
-               queue_item (&priv->message_queue, QUEUED_MESSAGE, msg, NULL);
+               queue_item (&priv->message_queue, QUEUED_MESSAGE, msg, NULL, should_highlight);
                return;
        }
 
@@ -816,6 +820,8 @@ theme_adium_append_message (EmpathyChatView *view,
        contact_id = empathy_contact_get_id (sender);
        action = (empathy_message_get_tptype (msg) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION);
 
+       name_escaped = g_markup_escape_text (name, -1);
+
        /* If this is a /me probably */
        if (action) {
                gchar *str;
@@ -823,7 +829,7 @@ theme_adium_append_message (EmpathyChatView *view,
                if (priv->data->version >= 4 || !priv->data->custom_template) {
                        str = g_strdup_printf ("<span class='actionMessageUserName'>%s</span>"
                                               "<span class='actionMessageBody'>%s</span>",
-                                              name, body_escaped);
+                                              name_escaped, body_escaped);
                } else {
                        str = g_strdup_printf ("*%s*", body_escaped);
                }
@@ -884,7 +890,7 @@ theme_adium_append_message (EmpathyChatView *view,
        } else {
                g_string_append (message_classes, " incoming");
        }
-       if (empathy_message_should_highlight (msg)) {
+       if (should_highlight) {
                g_string_append (message_classes, " mention");
        }
        if (empathy_message_get_tptype (msg) == TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY) {
@@ -948,7 +954,7 @@ theme_adium_append_message (EmpathyChatView *view,
        }
 
        theme_adium_append_html (theme, func, html, body_escaped,
-                                avatar_filename, name, contact_id,
+                                avatar_filename, name_escaped, contact_id,
                                 service_name, message_classes->str,
                                 timestamp, is_backlog, empathy_contact_is_user (sender));
 
@@ -961,6 +967,7 @@ theme_adium_append_message (EmpathyChatView *view,
        priv->last_is_backlog = is_backlog;
 
        g_free (body_escaped);
+       g_free (name_escaped);
        g_string_free (message_classes, TRUE);
 }
 
@@ -972,7 +979,7 @@ theme_adium_append_event (EmpathyChatView *view,
        gchar *str_escaped;
 
        if (priv->pages_loading != 0) {
-               queue_item (&priv->message_queue, QUEUED_EVENT, NULL, str);
+               queue_item (&priv->message_queue, QUEUED_EVENT, NULL, str, FALSE);
                return;
        }
 
@@ -1002,7 +1009,7 @@ theme_adium_edit_message (EmpathyChatView *view,
        GError *error = NULL;
 
        if (priv->pages_loading != 0) {
-               queue_item (&priv->message_queue, QUEUED_EDIT, message, NULL);
+               queue_item (&priv->message_queue, QUEUED_EDIT, message, NULL, FALSE);
                return;
        }
 
@@ -1342,7 +1349,8 @@ theme_adium_load_finished_cb (WebKitWebView  *view,
                switch (item->type)
                {
                        case QUEUED_MESSAGE:
-                               theme_adium_append_message (chat_view, item->msg);
+                               theme_adium_append_message (chat_view, item->msg,
+                                       item->should_highlight);
                                break;
 
                        case QUEUED_EDIT: