comparison src/conversation.c @ 11454:201617d49573

[gaim-migrate @ 13693] This commit includes a number of changes: 1. Aliases are now used consistently in chats. If the prpl uses unique screen names for chats (e.g. Jabber), then aliases are not used at all. 2. The chat list is now colorized to match the colors used in the chat itself. 3. Buddies are bolded in the chat user list. 4. Buddies are sorted above non-buddies in the chat user list. 5. The chat user list is ellipsized when possible (i.e. on GTK+ 2.6.0 or above). 6. I've accepted patch #1178248, by Matt Amato to add "buddy-added" and "buddy-removed" signals. These were used in my implementation of #3 and #4, to update the GUI when users are added or removed from the buddy list. 7. I've added a "blist-node-aliased" signal that is emitted when a buddy, contact, or chat is aliased. 8. Since it was hard to separate and I need it at some point, I'm letting it slip in... I've changed GaimConversation.log to be a GList named logs. This way, we can have multiple logs for a single conversation. This will be necessary to implement unnamed chat logging in some reasonable fasion (see my notes in the TODO file). committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 06 Sep 2005 03:04:07 +0000
parents 17142948653e
children c3cb62d33f53
comparison
equal deleted inserted replaced
11453:d446fcc2c63b 11454:201617d49573
624 GaimAccount *account; 624 GaimAccount *account;
625 GaimConnection *gc; 625 GaimConnection *gc;
626 626
627 account = gaim_conversation_get_account(conv); 627 account = gaim_conversation_get_account(conv);
628 628
629 gaim_log_free(conv->log); 629 g_list_foreach(conv->logs, (GFunc)gaim_log_free, NULL);
630 conv->log = gaim_log_new(GAIM_LOG_CHAT, gaim_conversation_get_name(conv), 630 g_list_free(conv->logs);
631 account, conv, time(NULL)); 631 conv->logs = g_list_append(NULL, gaim_log_new(GAIM_LOG_CHAT, gaim_conversation_get_name(conv),
632 account, conv, time(NULL)));
632 633
633 gc = gaim_account_get_connection(account); 634 gc = gaim_account_get_connection(account);
634 635
635 if ((disp = gaim_connection_get_display_name(gc)) != NULL) 636 if ((disp = gaim_connection_get_display_name(gc)) != NULL)
636 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), disp); 637 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(conv), disp);
682 conv->name = g_strdup(name); 683 conv->name = g_strdup(name);
683 conv->title = g_strdup(name); 684 conv->title = g_strdup(name);
684 conv->send_history = g_list_append(NULL, NULL); 685 conv->send_history = g_list_append(NULL, NULL);
685 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, 686 conv->data = g_hash_table_new_full(g_str_hash, g_str_equal,
686 g_free, NULL); 687 g_free, NULL);
687 conv->log = gaim_log_new(type == GAIM_CONV_TYPE_CHAT ? GAIM_LOG_CHAT : 688 conv->logs = g_list_append(NULL, gaim_log_new(type == GAIM_CONV_TYPE_CHAT ? GAIM_LOG_CHAT :
688 GAIM_LOG_IM, conv->name, account, 689 GAIM_LOG_IM, conv->name, account,
689 conv, time(NULL)); 690 conv, time(NULL)));
690 /* copy features from the connection. */ 691 /* copy features from the connection. */
691 conv->features = gc->flags; 692 conv->features = gc->flags;
692 693
693 694
694 if (type == GAIM_CONV_TYPE_IM) 695 if (type == GAIM_CONV_TYPE_IM)
927 } 928 }
928 929
929 if (ops != NULL && ops->destroy_conversation != NULL) 930 if (ops != NULL && ops->destroy_conversation != NULL)
930 ops->destroy_conversation(conv); 931 ops->destroy_conversation(conv);
931 932
932 gaim_log_free(conv->log); 933 g_list_foreach(conv->logs, (GFunc)gaim_log_free, NULL);
934 g_list_free(conv->logs);
935
933 GAIM_DBUS_UNREGISTER_POINTER(conv); 936 GAIM_DBUS_UNREGISTER_POINTER(conv);
934 g_free(conv); 937 g_free(conv);
935 conv = NULL; 938 conv = NULL;
936 } 939 }
937 940
1271 { 1274 {
1272 GaimPluginProtocolInfo *prpl_info = NULL; 1275 GaimPluginProtocolInfo *prpl_info = NULL;
1273 GaimConnection *gc = NULL; 1276 GaimConnection *gc = NULL;
1274 GaimAccount *account; 1277 GaimAccount *account;
1275 GaimConversationUiOps *ops; 1278 GaimConversationUiOps *ops;
1279 const char *alias = NULL;
1276 GaimConvWindow *win; 1280 GaimConvWindow *win;
1277 GaimBuddy *b; 1281 GaimBuddy *b;
1278 GaimUnseenState unseen; 1282 GaimUnseenState unseen;
1279 /* int logging_font_options = 0; */ 1283 /* int logging_font_options = 0; */
1280 1284
1303 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account))); 1307 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account)));
1304 1308
1305 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM || 1309 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM ||
1306 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { 1310 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1307 1311
1308 if (who == NULL) { 1312 if (flags & GAIM_MESSAGE_SEND) {
1309 if (flags & GAIM_MESSAGE_SEND) { 1313 b = gaim_find_buddy(account,
1310 b = gaim_find_buddy(account, 1314 gaim_account_get_username(account));
1311 gaim_account_get_username(account)); 1315
1312 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) { 1316 if (gaim_account_get_alias(account) != NULL)
1313 if (gaim_account_get_alias(account) != NULL) 1317 alias = account->alias;
1314 who = account->alias; 1318 else if (b != NULL && strcmp(b->name, gaim_buddy_get_contact_alias(b)))
1315 else if (b != NULL && strcmp(b->name, gaim_buddy_get_contact_alias(b))) 1319 alias = gaim_buddy_get_contact_alias(b);
1316 who = gaim_buddy_get_contact_alias(b); 1320 else if (gaim_connection_get_display_name(gc) != NULL)
1317 else if (gaim_connection_get_display_name(gc) != NULL) 1321 alias = gaim_connection_get_display_name(gc);
1318 who = gaim_connection_get_display_name(gc); 1322 else
1319 else 1323 alias = gaim_account_get_username(account);
1320 who = gaim_account_get_username(account);
1321 }
1322 else
1323 who = gaim_account_get_username(account);
1324 }
1325 else {
1326 b = gaim_find_buddy(account,
1327 gaim_conversation_get_name(conv));
1328
1329 if (b != NULL && gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT)
1330 who = gaim_buddy_get_contact_alias(b);
1331 else
1332 who = gaim_conversation_get_name(conv);
1333 }
1334 } 1324 }
1335 else if ((who != NULL) && (*who != '\0') && gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) { 1325 else
1326 {
1327 if (who == NULL || *who == '\0')
1328 who = gaim_conversation_get_name(conv);
1329
1336 b = gaim_find_buddy(account, who); 1330 b = gaim_find_buddy(account, who);
1337 1331
1338 if (b != NULL) 1332 if (b != NULL)
1339 who = gaim_buddy_get_contact_alias(b); 1333 alias = gaim_buddy_get_contact_alias(b);
1334 else
1335 alias = who;
1340 } 1336 }
1341 } 1337 }
1342 } 1338 }
1343 1339
1344 if (gaim_conversation_is_logging(conv)) 1340 if (gaim_conversation_is_logging(conv)) {
1345 gaim_log_write(conv->log, flags, who, mtime, message); 1341 GList *log = conv->logs;
1346 ops->write_conv(conv, who, message, flags, mtime); 1342 while (log != NULL) {
1343 gaim_log_write((GaimLog *)log->data, flags, alias, mtime, message);
1344 log = log->next;
1345 }
1346 }
1347 ops->write_conv(conv, who, alias, message, flags, mtime);
1347 1348
1348 win = gaim_conversation_get_window(conv); 1349 win = gaim_conversation_get_window(conv);
1349 1350
1350 /* Tab highlighting */ 1351 /* Tab highlighting */
1351 if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM) && !(flags & GAIM_MESSAGE_ERROR)) 1352 if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM) && !(flags & GAIM_MESSAGE_ERROR))
1879 GaimMessageFlags flags, time_t mtime) 1880 GaimMessageFlags flags, time_t mtime)
1880 { 1881 {
1881 GaimAccount *account; 1882 GaimAccount *account;
1882 GaimConversation *conv; 1883 GaimConversation *conv;
1883 GaimConnection *gc; 1884 GaimConnection *gc;
1885 GaimPluginProtocolInfo *prpl_info;
1884 1886
1885 g_return_if_fail(chat != NULL); 1887 g_return_if_fail(chat != NULL);
1886 g_return_if_fail(who != NULL); 1888 g_return_if_fail(who != NULL);
1887 g_return_if_fail(message != NULL); 1889 g_return_if_fail(message != NULL);
1888 1890
1889 conv = gaim_conv_chat_get_conversation(chat); 1891 conv = gaim_conv_chat_get_conversation(chat);
1890 gc = gaim_conversation_get_gc(conv); 1892 gc = gaim_conversation_get_gc(conv);
1891 account = gaim_connection_get_account(gc); 1893 account = gaim_connection_get_account(gc);
1894 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
1892 1895
1893 /* Don't display this if the person who wrote it is ignored. */ 1896 /* Don't display this if the person who wrote it is ignored. */
1894 if (gaim_conv_chat_is_user_ignored(chat, who)) 1897 if (gaim_conv_chat_is_user_ignored(chat, who))
1895 return; 1898 return;
1896 1899
1897 if (!(flags & GAIM_MESSAGE_WHISPER)) { 1900 if (!(flags & GAIM_MESSAGE_WHISPER)) {
1898 char *str; 1901 char *str;
1899 const char *nick; 1902 const char *nick;
1900 1903
1901 str = g_strdup(gaim_normalize(account, who)); 1904 str = g_strdup(gaim_normalize(account, who));
1902 nick = gaim_conv_chat_get_nick(chat); 1905
1906 if (prpl_info->options & OPT_PROTO_USE_DISPLAY_NAME_FOR_ME_IN_CHATS)
1907 nick = account->gc->display_name;
1908 else
1909 nick = account->username;
1903 1910
1904 if (!g_utf8_collate(str, gaim_normalize(account, nick))) { 1911 if (!g_utf8_collate(str, gaim_normalize(account, nick))) {
1905 flags |= GAIM_MESSAGE_SEND; 1912 flags |= GAIM_MESSAGE_SEND;
1906 } else { 1913 } else {
1907 flags |= GAIM_MESSAGE_RECV; 1914 flags |= GAIM_MESSAGE_RECV;
1928 1935
1929 common_send(gaim_conv_chat_get_conversation(chat), message); 1936 common_send(gaim_conv_chat_get_conversation(chat), message);
1930 } 1937 }
1931 1938
1932 void 1939 void
1933 gaim_conv_chat_add_user(GaimConvChat *chat, const char *user, const char *extra_msg, 1940 gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
1934 GaimConvChatBuddyFlags flags, gboolean new_arrival) 1941 const char *extra_msg, GaimConvChatBuddyFlags flags,
1942 gboolean new_arrival)
1943 {
1944 GList *users = g_list_append(NULL, (char *)user);
1945 GList *extra_msgs = g_list_append(NULL, (char *)extra_msg);
1946 GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags));
1947
1948 gaim_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival);
1949
1950 g_list_free(users);
1951 g_list_free(extra_msgs);
1952 g_list_free(flags2);
1953 }
1954
1955 void
1956 gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *extra_msgs,
1957 GList *flags, gboolean new_arrivals)
1935 { 1958 {
1936 GaimConversation *conv; 1959 GaimConversation *conv;
1937 GaimConversationUiOps *ops; 1960 GaimConversationUiOps *ops;
1938 GaimConvChatBuddy *cb; 1961 GaimConvChatBuddy *cb;
1939 char tmp[BUF_LONG]; 1962 GaimConnection *gc;
1940 gboolean quiet; 1963 GaimPluginProtocolInfo *prpl_info;
1941 1964 GList *ul, *fl;
1942 g_return_if_fail(chat != NULL); 1965 GList *aliases = NULL;
1943 g_return_if_fail(user != NULL); 1966
1967 g_return_if_fail(chat != NULL);
1968 g_return_if_fail(users != NULL);
1944 1969
1945 conv = gaim_conv_chat_get_conversation(chat); 1970 conv = gaim_conv_chat_get_conversation(chat);
1946 ops = gaim_conversation_get_ui_ops(conv); 1971 ops = gaim_conversation_get_ui_ops(conv);
1947 1972
1948 quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(), 1973 gc = gaim_conversation_get_gc(conv);
1949 "chat-buddy-joining", conv, user, flags)) | 1974 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
1950 gaim_conv_chat_is_user_ignored(chat, user); 1975 return;
1951
1952 cb = gaim_conv_chat_cb_new(user, flags);
1953
1954 gaim_conv_chat_set_users(chat,
1955 g_list_append(gaim_conv_chat_get_users(chat), cb));
1956
1957 if (ops != NULL && ops->chat_add_user != NULL)
1958 ops->chat_add_user(conv, user, new_arrival);
1959
1960 if (!quiet && new_arrival) {
1961 if (extra_msg == NULL)
1962 g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), user);
1963 else
1964 g_snprintf(tmp, sizeof(tmp),
1965 _("%s [<I>%s</I>] entered the room."),
1966 user, extra_msg);
1967
1968 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
1969 }
1970
1971 gaim_signal_emit(gaim_conversations_get_handle(),
1972 "chat-buddy-joined", conv, user, flags);
1973 }
1974
1975 void
1976 gaim_conv_chat_add_users(GaimConvChat *chat, GList *users, GList *flags)
1977 {
1978 GaimConversation *conv;
1979 GaimConversationUiOps *ops;
1980 GaimConvChatBuddy *cb;
1981 GList *ul, *fl;
1982
1983 g_return_if_fail(chat != NULL);
1984 g_return_if_fail(users != NULL);
1985
1986 conv = gaim_conv_chat_get_conversation(chat);
1987 ops = gaim_conversation_get_ui_ops(conv);
1988 1976
1989 ul = users; 1977 ul = users;
1990 fl = flags; 1978 fl = flags;
1991 while ((ul != NULL) && (fl != NULL)) { 1979 while ((ul != NULL) && (fl != NULL)) {
1992 const char *user = (const char *)ul->data; 1980 const char *user = (const char *)ul->data;
1993 GaimConvChatBuddyFlags f = GPOINTER_TO_INT(fl->data); 1981 const char *alias = user;
1982 gboolean quiet;
1983 GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data);
1984 const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL);
1985
1986 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1987 char *tmp;
1988 GaimBuddy *buddy;
1989
1990 if (prpl_info->options & OPT_PROTO_USE_DISPLAY_NAME_FOR_ME_IN_CHATS)
1991 tmp = g_strdup(gaim_normalize(conv->account, gc->display_name));
1992 else
1993 tmp = g_strdup(gaim_normalize(conv->account, conv->account->username));
1994
1995 if (!strcmp(tmp, gaim_normalize(conv->account, user))) {
1996 alias = gaim_account_get_alias(conv->account);
1997 if (alias == NULL)
1998 alias = gaim_connection_get_display_name(gc);
1999 } else {
2000 if ((buddy = gaim_find_buddy(gc->account, user)) != NULL)
2001 alias = gaim_buddy_get_contact_alias(buddy);
2002 }
2003 g_free(tmp);
2004 }
2005
2006 quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(),
2007 "chat-buddy-joining", conv, user, flags)) |
2008 gaim_conv_chat_is_user_ignored(chat, user);
2009
2010 cb = gaim_conv_chat_cb_new(user, flags);
2011 gaim_conv_chat_set_users(chat,
2012 g_list_prepend(gaim_conv_chat_get_users(chat), cb));
2013 aliases = g_list_append(aliases, (char *)alias);
2014
2015 if (!quiet && new_arrivals) {
2016 char *tmp;
2017
2018 if (extra_msg == NULL)
2019 tmp = g_strdup_printf(_("%s entered the room."), alias);
2020 else
2021 tmp = g_strdup_printf(_("%s [<I>%s</I>] entered the room."),
2022 alias, extra_msg);
2023
2024 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
2025 g_free(tmp);
2026 }
1994 2027
1995 gaim_signal_emit(gaim_conversations_get_handle(), 2028 gaim_signal_emit(gaim_conversations_get_handle(),
1996 "chat-buddy-joining", conv, user, f); 2029 "chat-buddy-joined", conv, user, flags);
1997
1998 cb = gaim_conv_chat_cb_new(user, f);
1999 gaim_conv_chat_set_users(chat,
2000 g_list_append(gaim_conv_chat_get_users(chat), cb));
2001
2002 gaim_signal_emit(gaim_conversations_get_handle(),
2003 "chat-buddy-joined", conv, user, f);
2004 ul = ul->next; 2030 ul = ul->next;
2005 fl = fl->next; 2031 fl = fl->next;
2032 if (extra_msgs != NULL)
2033 extra_msgs = extra_msgs->next;
2006 } 2034 }
2007 2035
2008 if (ops != NULL && ops->chat_add_users != NULL) 2036 if (ops != NULL && ops->chat_add_users != NULL)
2009 ops->chat_add_users(conv, users); 2037 ops->chat_add_users(conv, users, aliases);
2038
2039 g_list_free(aliases);
2010 } 2040 }
2011 2041
2012 void 2042 void
2013 gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user, 2043 gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user,
2014 const char *new_user) 2044 const char *new_user)
2015 { 2045 {
2016 GaimConversation *conv; 2046 GaimConversation *conv;
2017 GaimConversationUiOps *ops; 2047 GaimConversationUiOps *ops;
2018 GaimConvChatBuddy *cb; 2048 GaimConvChatBuddy *cb;
2019 GaimConvChatBuddyFlags flags; 2049 GaimConvChatBuddyFlags flags;
2028 ops = gaim_conversation_get_ui_ops(conv); 2058 ops = gaim_conversation_get_ui_ops(conv);
2029 2059
2030 flags = gaim_conv_chat_user_get_flags(chat, old_user); 2060 flags = gaim_conv_chat_user_get_flags(chat, old_user);
2031 cb = gaim_conv_chat_cb_new(new_user, flags); 2061 cb = gaim_conv_chat_cb_new(new_user, flags);
2032 gaim_conv_chat_set_users(chat, 2062 gaim_conv_chat_set_users(chat,
2033 g_list_append(gaim_conv_chat_get_users(chat), cb)); 2063 g_list_prepend(gaim_conv_chat_get_users(chat), cb));
2034 2064
2035 if (ops != NULL && ops->chat_rename_user != NULL) 2065 if (ops != NULL && ops->chat_rename_user != NULL)
2036 ops->chat_rename_user(conv, old_user, new_user); 2066 ops->chat_rename_user(conv, old_user, new_user);
2037 2067
2038 cb = gaim_conv_chat_cb_find(chat, old_user); 2068 cb = gaim_conv_chat_cb_find(chat, old_user);
2059 gaim_conv_chat_is_user_ignored(chat, new_user)) { 2089 gaim_conv_chat_is_user_ignored(chat, new_user)) {
2060 if(its_me) { 2090 if(its_me) {
2061 g_snprintf(tmp, sizeof(tmp), 2091 g_snprintf(tmp, sizeof(tmp),
2062 _("You are now known as %s"), new_user); 2092 _("You are now known as %s"), new_user);
2063 } else { 2093 } else {
2094 GaimConnection *gc = gaim_conversation_get_gc(conv);
2095 GaimPluginProtocolInfo *prpl_info;
2096 const char *old_alias = old_user;
2097 const char *new_alias = new_user;
2098
2099 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
2100 return;
2101
2102 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
2103 GaimBuddy *buddy;
2104
2105 if ((buddy = gaim_find_buddy(gc->account, old_user)) != NULL)
2106 old_alias = gaim_buddy_get_contact_alias(buddy);
2107 if ((buddy = gaim_find_buddy(gc->account, new_user)) != NULL)
2108 new_alias = gaim_buddy_get_contact_alias(buddy);
2109 }
2110
2064 g_snprintf(tmp, sizeof(tmp), 2111 g_snprintf(tmp, sizeof(tmp),
2065 _("%s is now known as %s"), old_user, new_user); 2112 _("%s is now known as %s"), old_alias, new_alias);
2066 } 2113 }
2067 2114
2068 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); 2115 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
2069 } 2116 }
2070 } 2117 }
2075 GaimConversation *conv; 2122 GaimConversation *conv;
2076 GaimConversationUiOps *ops; 2123 GaimConversationUiOps *ops;
2077 GaimConvChatBuddy *cb; 2124 GaimConvChatBuddy *cb;
2078 char tmp[BUF_LONG]; 2125 char tmp[BUF_LONG];
2079 gboolean quiet; 2126 gboolean quiet;
2127 const char *alias = user;
2080 2128
2081 g_return_if_fail(chat != NULL); 2129 g_return_if_fail(chat != NULL);
2082 g_return_if_fail(user != NULL); 2130 g_return_if_fail(user != NULL);
2083 2131
2084 conv = gaim_conv_chat_get_conversation(chat); 2132 conv = gaim_conv_chat_get_conversation(chat);
2100 } 2148 }
2101 2149
2102 /* NOTE: Don't remove them from ignored in case they re-enter. */ 2150 /* NOTE: Don't remove them from ignored in case they re-enter. */
2103 2151
2104 if (!quiet) { 2152 if (!quiet) {
2153 GaimConnection *gc = gaim_conversation_get_gc(conv);
2154 GaimPluginProtocolInfo *prpl_info;
2155
2156 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
2157 return;
2158
2159 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
2160 GaimBuddy *buddy;
2161
2162 if ((buddy = gaim_find_buddy(gc->account, user)) != NULL)
2163 alias = gaim_buddy_get_contact_alias(buddy);
2164 }
2165
2105 if (reason != NULL && *reason != '\0') 2166 if (reason != NULL && *reason != '\0')
2106 g_snprintf(tmp, sizeof(tmp), 2167 g_snprintf(tmp, sizeof(tmp),
2107 _("%s left the room (%s)."), user, reason); 2168 _("%s left the room (%s)."), alias, reason);
2108 else 2169 else
2109 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), user); 2170 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), alias);
2110 2171
2111 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); 2172 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL));
2112 } 2173 }
2113 2174
2114 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left", 2175 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",