diff options
Diffstat (limited to 'libempathy/empathy-message.c')
-rw-r--r-- | libempathy/empathy-message.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c index 995f49ab7..6111bcd8c 100644 --- a/libempathy/empathy-message.c +++ b/libempathy/empathy-message.c @@ -633,75 +633,6 @@ empathy_message_is_backlog (EmpathyMessage *message) return priv->is_backlog; } -#define IS_SEPARATOR(ch) (ch == ' ' || ch == ',' || ch == '.' || ch == ':') -gboolean -empathy_message_should_highlight (EmpathyMessage *message) -{ - EmpathyContact *contact; - const gchar *msg, *to; - gchar *cf_msg, *cf_to; - gchar *ch; - gboolean ret_val; - TpChannelTextMessageFlags flags; - - g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE); - - ret_val = FALSE; - - msg = empathy_message_get_body (message); - if (!msg) { - return FALSE; - } - - contact = empathy_message_get_receiver (message); - if (!contact || !empathy_contact_is_user (contact)) { - return FALSE; - } - - to = empathy_contact_get_alias (contact); - if (!to) { - return FALSE; - } - - flags = empathy_message_get_flags (message); - if (flags & TP_CHANNEL_TEXT_MESSAGE_FLAG_SCROLLBACK) { - /* 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; - } - - cf_msg = g_utf8_casefold (msg, -1); - cf_to = g_utf8_casefold (to, -1); - - ch = strstr (cf_msg, cf_to); - if (ch == NULL) { - goto finished; - } - if (ch != cf_msg) { - /* Not first in the message */ - if (!IS_SEPARATOR (*(ch - 1))) { - goto finished; - } - } - - ch = ch + strlen (cf_to); - if (ch >= cf_msg + strlen (cf_msg)) { - ret_val = TRUE; - goto finished; - } - - if (IS_SEPARATOR (*ch)) { - ret_val = TRUE; - goto finished; - } - -finished: - g_free (cf_msg); - g_free (cf_to); - - return ret_val; -} - TpChannelTextMessageType empathy_message_type_from_str (const gchar *type_str) { |