From 9de580a85b2df665beba14ea0fad3a223f73cd97 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 21 Aug 2008 10:53:12 +0200 Subject: [PATCH] Fix missing self nick display with /msg command --- src/plugins/irc/irc-command.c | 40 ++++++++++++++++------------------- src/plugins/irc/irc-input.c | 36 +++++++++---------------------- 2 files changed, 28 insertions(+), 48 deletions(-) diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 76aaa3ad6..f6515546c 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -1812,7 +1812,10 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, string = irc_color_decode (argv_eol[2], weechat_config_boolean (irc_config_network_colors_receive)); weechat_printf (ptr_channel->buffer, - "%s", + "%s%s", + irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL, + (ptr_nick) ? NULL : ptr_server->nick, + IRC_COLOR_CHAT_NICK_SELF), (string) ? string : argv_eol[2]); if (string) free (string); @@ -1828,28 +1831,21 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, targets[i]); if (ptr_channel) { - ptr_nick = irc_nick_search (ptr_channel, - ptr_server->nick); - if (ptr_nick) - { - string = irc_color_decode (argv_eol[2], - weechat_config_boolean (irc_config_network_colors_receive)); - weechat_printf (ptr_channel->buffer, - "%s", - (string) ? - string : argv_eol[2]); - if (string) - free (string); - } + if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) + ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick); else - { - weechat_printf (ptr_server->buffer, - _("%s%s: nick \"%s\" not " - "found for \"%s\" command"), - weechat_prefix ("error"), - "irc", ptr_server->nick, - "msg"); - } + ptr_nick = NULL; + string = irc_color_decode (argv_eol[2], + weechat_config_boolean (irc_config_network_colors_receive)); + weechat_printf (ptr_channel->buffer, + "%s%s", + irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL, + (ptr_nick) ? NULL : ptr_server->nick, + IRC_COLOR_CHAT_NICK_SELF), + (string) ? + string : argv_eol[2]); + if (string) + free (string); } irc_server_sendf (ptr_server, "PRIVMSG %s :%s", targets[i], argv_eol[2]); diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index 1e76901e5..ad1989c82 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -48,33 +48,17 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text) if (ptr_channel) { - if (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) - { - weechat_printf (buffer, - "%s%s", - irc_nick_as_prefix (NULL, ptr_server->nick, - IRC_COLOR_CHAT_NICK_SELF), - (text_decoded) ? text_decoded : text); - } - else - { + if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) ptr_nick = irc_nick_search (ptr_channel, ptr_server->nick); - if (ptr_nick) - { - weechat_printf (buffer, - "%s%s", - irc_nick_as_prefix (ptr_nick, NULL, - IRC_COLOR_CHAT_NICK_SELF), - (text_decoded) ? text_decoded : text); - } - else - { - weechat_printf (ptr_server->buffer, - _("%s%s: cannot find nick for sending " - "message"), - weechat_prefix ("error"), "irc"); - } - } + else + ptr_nick = NULL; + + weechat_printf (buffer, + "%s%s", + irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL, + (ptr_nick) ? NULL : ptr_server->nick, + IRC_COLOR_CHAT_NICK_SELF), + (text_decoded) ? text_decoded : text); } if (text_decoded)