diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index e983781..71bfe88 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1197,6 +1197,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, { char *pos_args, *pos_end_01, *pos, *pos_message; char *dcc_args, *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */ + const char *remote_nick; struct t_infolist *infolist; struct t_infolist_item *item; char plugin_id[128]; @@ -1442,7 +1443,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, return WEECHAT_RC_OK; } - + /* ping request from another user => answer */ if (strncmp (pos_args, "\01PING", 5) == 0) { @@ -1951,17 +1952,21 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, } /* private message received => display it */ - ptr_channel = irc_channel_search (server, nick); + if (strcmp (server->nick, nick) == 0) + remote_nick = argv[2]; + else + remote_nick = nick; + ptr_channel = irc_channel_search (server, remote_nick); if (strncmp (pos_args, "\01ACTION ", 8) == 0) { - if (!irc_ignore_check (server, ptr_channel, nick, host)) + if (!irc_ignore_check (server, ptr_channel, remote_nick, host)) { if (!ptr_channel) { ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_PRIVATE, - nick, 0, 0); + remote_nick, 0, 0); if (!ptr_channel) { weechat_printf (server->buffer, @@ -1969,7 +1974,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, "private buffer \"%s\""), irc_buffer_get_server_prefix (server, "error"), - IRC_PLUGIN_NAME, nick); + IRC_PLUGIN_NAME, remote_nick); return WEECHAT_RC_ERROR; } } @@ -2005,7 +2010,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, if ((pos_args[0] == '\01') && pos_end_01 && (pos_end_01[1] == '\0')) { - if (!irc_ignore_check (server, ptr_channel, nick, host)) + if (!irc_ignore_check (server, ptr_channel, remote_nick, host)) { pos_args++; pos_end_01[0] = '\0'; @@ -2067,13 +2072,13 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, else { /* private message */ - if (!irc_ignore_check (server, ptr_channel, nick, host)) + if (!irc_ignore_check (server, ptr_channel, remote_nick, host)) { if (!ptr_channel) { ptr_channel = irc_channel_new (server, IRC_CHANNEL_TYPE_PRIVATE, - nick, 0, 0); + remote_nick, 0, 0); if (!ptr_channel) { weechat_printf (server->buffer, @@ -2081,7 +2086,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, "private buffer \"%s\""), irc_buffer_get_server_prefix (server, "error"), - IRC_PLUGIN_NAME, nick); + IRC_PLUGIN_NAME, remote_nick); return WEECHAT_RC_ERROR; } } @@ -2092,7 +2097,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, "%s%s", irc_nick_as_prefix (NULL, nick, - IRC_COLOR_CHAT_NICK_OTHER), + (strcmp (server->nick, nick) == 0) ? + IRC_COLOR_CHAT_NICK_SELF : IRC_COLOR_CHAT_NICK_OTHER), pos_args); weechat_hook_signal_send ("irc_pv",