/pidgin/main: f72e153dd417: Drop finch_write_common in favor of ...
Tomasz Wasilczyk <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: f72e153dd417042546df472e45255180bfac14fd Author: Tomasz Wasilczyk <[email protected]> Date: 2014-06-12 21:18 +0200 Branch: default URL: https://hg.pidgin.im/pidgin/main/rev/f72e153dd417 Description: Drop finch_write_common in favor of finch_write_conv diffstat: finch/gntconv.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-) diffs (110 lines): diff --git a/finch/gntconv.c b/finch/gntconv.c --- a/finch/gntconv.c +++ b/finch/gntconv.c @@ -60,8 +60,6 @@ #include "config.h" -static void finch_write_common(PurpleConversation *conv, const char *who, - const char *message, PurpleMessageFlags flags, time_t mtime); static void generate_send_to_menu(FinchConv *ggc); static void generate_e2ee_menu(FinchConv *ggc); @@ -309,8 +307,8 @@ update_buddy_typing(PurpleAccount *accou static void chat_left_cb(PurpleConversation *conv, gpointer null) { - finch_write_common(conv, NULL, _("You have left this chat."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); + purple_conversation_write_system_message(conv, + _("You have left this chat."), 0); } static void @@ -986,13 +984,13 @@ finch_destroy_conversation(PurpleConvers } static void -finch_write_common(PurpleConversation *conv, const char *who, const char *message, - PurpleMessageFlags flags, time_t mtime) +finch_write_conv(PurpleConversation *conv, PurpleMessage *msg) { FinchConv *ggconv = FINCH_CONV(conv); char *strip, *newline; GntTextFormatFlags fl = 0; int pos; + PurpleMessageFlags flags = purple_message_get_flags(msg); g_return_if_fail(ggconv != NULL); @@ -1014,6 +1012,7 @@ finch_write_common(PurpleConversation *c /* Unnecessary to print the timestamp for delayed message */ if (purple_prefs_get_bool("/finch/conversations/timestamps")) { + time_t mtime = purple_message_get_time(msg); if (!mtime) time(&mtime); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), @@ -1026,15 +1025,16 @@ finch_write_common(PurpleConversation *c gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD); - if (who && *who && (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) && + if (purple_message_get_author(msg) && (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) && !(flags & PURPLE_MESSAGE_NOTIFY)) { char * name = NULL; GntTextFormatFlags msgflags = GNT_TEXT_FLAG_NORMAL; gboolean me = FALSE; + gchar *msg_text = g_strdup(purple_message_get_contents(msg)); - if (purple_message_meify((char*)message, -1)) { - name = g_strdup_printf("*** %s", who); + if (purple_message_meify(msg_text, -1)) { + name = g_strdup_printf("*** %s", purple_message_get_author(msg)); if (!(flags & PURPLE_MESSAGE_SEND) && (flags & PURPLE_MESSAGE_NICK)) msgflags = gnt_color_pair(color_message_highlight); @@ -1042,7 +1042,7 @@ finch_write_common(PurpleConversation *c msgflags = gnt_color_pair(color_message_action); me = TRUE; } else { - name = g_strdup_printf("%s", who); + name = g_strdup_printf("%s", purple_message_get_author(msg)); if (flags & PURPLE_MESSAGE_SEND) msgflags = gnt_color_pair(color_message_send); else if (flags & PURPLE_MESSAGE_NICK) @@ -1050,6 +1050,7 @@ finch_write_common(PurpleConversation *c else msgflags = gnt_color_pair(color_message_receive); } + purple_message_set_contents(msg, msg_text); /* might be "meified" */ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), name, msgflags); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), me ? " " : ": ", GNT_TEXT_FLAG_NORMAL); @@ -1061,7 +1062,7 @@ finch_write_common(PurpleConversation *c fl |= GNT_TEXT_FLAG_BOLD; /* XXX: Remove this workaround when textview can parse messages. */ - newline = purple_strdup_withhtml(message); + newline = purple_strdup_withhtml(purple_message_get_contents(msg)); strip = purple_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); @@ -1089,16 +1090,6 @@ finch_write_common(PurpleConversation *c } } -static void -finch_write_conv(PurpleConversation *conv, PurpleMessage *msg) -{ - finch_write_common(conv, - purple_message_get_author_alias(msg), - purple_message_get_contents(msg), - purple_message_get_flags(msg), - purple_message_get_time(msg)); -} - static const char * chat_flag_text(PurpleChatUserFlags flags) {