static void chat_window_new_message_cb (EmpathyChat *chat, EmpathyMessage *message, EmpathyChatWindow *window) { EmpathyChatWindowPriv *priv; gboolean has_focus; gboolean needs_urgency; priv = GET_PRIV (window); has_focus = empathy_chat_window_has_focus (window); if (has_focus && priv->current_chat == chat) { return; } if (empathy_chat_get_members_count (chat) > 2) { needs_urgency = empathy_message_should_highlight (message); } else { needs_urgency = TRUE; } if (needs_urgency && !has_focus) { chat_window_set_urgency_hint (window, TRUE); } if (!g_list_find (priv->chats_new_msg, chat)) { priv->chats_new_msg = g_list_prepend (priv->chats_new_msg, chat); chat_window_update_chat_tab (chat); } }
static void theme_irc_append_message (EmpathyChatTextView *view, EmpathyMessage *message) { GtkTextBuffer *buffer; const gchar *name; const gchar *nick_tag; GtkTextIter iter; gchar *tmp; EmpathyContact *contact; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); contact = empathy_message_get_sender (message); name = empathy_contact_get_logged_alias (contact); if (empathy_message_get_tptype (message) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) { tmp = g_strdup_printf (" * %s %s", empathy_contact_get_logged_alias (contact), empathy_message_get_body (message)); empathy_chat_text_view_append_body (view, tmp, EMPATHY_CHAT_TEXT_VIEW_TAG_ACTION); g_free (tmp); return; } if (empathy_contact_is_user (contact)) { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_SELF; } else { if (empathy_message_should_highlight (message)) { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_HIGHLIGHT; } else { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_OTHER; } } gtk_text_buffer_get_end_iter (buffer, &iter); /* The nickname. */ tmp = g_strdup_printf ("%s: ", name); gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, tmp, -1, "cut", nick_tag, NULL); g_free (tmp); /* The text body. */ empathy_chat_text_view_append_body (view, empathy_message_get_body (message), EMPATHY_CHAT_TEXT_VIEW_TAG_BODY); }