summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc/irc-protocol.c')
-rw-r--r--src/plugins/irc/irc-protocol.c1865
1 files changed, 971 insertions, 894 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 4e9a6bfd2..8ab2494b4 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -41,6 +41,7 @@
#include "irc-channel.h"
#include "irc-nick.h"
#include "irc-mode.h"
+#include "irc-ignore.h"
/*
@@ -226,23 +227,26 @@ irc_protocol_cmd_invite (struct t_irc_server *server, const char *command,
:nick!user@host INVITE mynick :#channel
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
/* make C compiler happy */
(void) argv_eol;
- weechat_printf_tags (server->buffer,
- "irc_invite,notify_highlight",
- _("%sYou have been invited to %s%s%s by "
- "%s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- (argv[3][0] == ':') ? argv[3] + 1 : argv[3],
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]));
-
+ if (!irc_ignore_check (server, NULL, nick, host))
+ {
+ weechat_printf_tags (server->buffer,
+ "irc_invite,notify_highlight",
+ _("%sYou have been invited to %s%s%s by "
+ "%s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ (argv[3][0] == ':') ? argv[3] + 1 : argv[3],
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
return WEECHAT_RC_OK;
}
@@ -262,7 +266,8 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
/* JOIN message looks like:
:nick!user@host JOIN :#channel
*/
-
+
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
@@ -285,19 +290,22 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
}
}
- weechat_printf_tags (ptr_channel->buffer,
- "irc_join",
- _("%s%s%s %s(%s%s%s)%s has joined %s%s"),
- weechat_prefix ("join"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- irc_protocol_get_address_from_host (argv[0]),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- pos_channel);
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_join",
+ _("%s%s%s %s(%s%s%s)%s has joined %s%s"),
+ weechat_prefix ("join"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ pos_channel);
+ }
/* remove topic and display channel creation date if joining new channel */
if (!ptr_channel->nicks)
@@ -309,11 +317,9 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
}
/* add nick in channel */
- ptr_nick = irc_nick_new (server, ptr_channel,
- irc_protocol_get_nick_from_host (argv[0]),
- 0, 0, 0, 0, 0, 0, 0);
+ ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0, 0);
if (ptr_nick)
- ptr_nick->host = strdup (irc_protocol_get_address_from_host (argv[0]));
+ ptr_nick->host = strdup (address);
return WEECHAT_RC_OK;
}
@@ -329,11 +335,12 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
-
+
/* KICK message looks like:
:nick1!user@host KICK #channel nick2 :kick reason
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
@@ -351,40 +358,43 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
return WEECHAT_RC_ERROR;
}
- if (pos_comment)
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_kick",
- _("%s%s%s%s has kicked %s%s%s from %s%s "
- "%s(%s%s%s)"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- argv[3],
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- argv[2],
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_comment,
- IRC_COLOR_CHAT_DELIMITERS);
- }
- else
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- weechat_printf_tags (ptr_channel->buffer,
- "irc_kick",
- _("%s%s%s%s has kicked %s%s%s from %s%s"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- argv[3],
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- argv[2]);
+ if (pos_comment)
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_kick",
+ _("%s%s%s%s has kicked %s%s%s from %s%s "
+ "%s(%s%s%s)"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ argv[3],
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ argv[2],
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_comment,
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_kick",
+ _("%s%s%s%s has kicked %s%s%s from %s%s"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ argv[3],
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ argv[2]);
+ }
}
if (strcmp (argv[3], server->nick) == 0)
@@ -423,6 +433,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
:nick1!user@host KILL mynick :kill reason
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
@@ -432,27 +443,30 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
- if (pos_comment)
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_kill",
- _("%sYou were killed by %s%s %s(%s%s%s)"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_comment,
- IRC_COLOR_CHAT_DELIMITERS);
- }
- else
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- weechat_printf_tags (ptr_channel->buffer,
- "irc_kill",
- _("%sYou were killed by %s%s"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]));
+ if (pos_comment)
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_kill",
+ _("%sYou were killed by %s%s %s(%s%s%s)"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_comment,
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_kill",
+ _("%sYou were killed by %s%s"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
}
if (strcmp (argv[2], server->nick) == 0)
@@ -489,6 +503,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
:nick!user@host MODE #test +o nick
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
@@ -502,34 +517,40 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
irc_mode_channel_set (server, ptr_channel, pos_modes);
irc_server_sendf (server, "MODE %s", ptr_channel->name);
}
- weechat_printf_tags ((ptr_channel) ?
- ptr_channel->buffer : server->buffer,
- "irc_mode",
- _("%sMode %s%s %s[%s%s%s]%s by %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_modes,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]));
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ weechat_printf_tags ((ptr_channel) ?
+ ptr_channel->buffer : server->buffer,
+ "irc_mode",
+ _("%sMode %s%s %s[%s%s%s]%s by %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ (ptr_channel) ? ptr_channel->name : argv[2],
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_modes,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
}
else
{
- weechat_printf_tags (server->buffer,
- "irc_mode",
- _("%sUser mode %s[%s%s%s]%s by %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_modes,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]));
+ if (!irc_ignore_check (server, NULL, nick, host))
+ {
+ weechat_printf_tags (server->buffer,
+ "irc_mode",
+ _("%sUser mode %s[%s%s%s]%s by %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_modes,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
}
irc_mode_user_set (server, pos_modes);
@@ -546,23 +567,23 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
{
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
- char *old_nick, *new_nick;
+ char *new_nick;
int nick_is_me;
/* NICK message looks like:
:oldnick!user@host NICK :newnick
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
/* make C compiler happy */
(void) argv_eol;
- old_nick = irc_protocol_get_nick_from_host (argv[0]);
new_nick = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
- nick_is_me = (strcmp (old_nick, server->nick) == 0) ? 1 : 0;
+ nick_is_me = (strcmp (nick, server->nick) == 0) ? 1 : 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -571,7 +592,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
{
case IRC_CHANNEL_TYPE_PRIVATE:
/* rename private window if this is with "old nick" */
- if (weechat_strcasecmp (ptr_channel->name, old_nick) == 0)
+ if (weechat_strcasecmp (ptr_channel->name, nick) == 0)
{
free (ptr_channel->name);
ptr_channel->name = strdup (new_nick);
@@ -580,7 +601,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
break;
case IRC_CHANNEL_TYPE_CHANNEL:
/* rename nick in nicklist if found */
- ptr_nick = irc_nick_search (ptr_channel, old_nick);
+ ptr_nick = irc_nick_search (ptr_channel, nick);
if (ptr_nick)
{
/* temporary disable hotlist */
@@ -600,16 +621,19 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
}
else
{
- weechat_printf_tags (ptr_channel->buffer,
- "irc_nick",
- _("%s%s%s%s is now known as "
- "%s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_NICK,
- old_nick,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- new_nick);
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_nick",
+ _("%s%s%s%s is now known as "
+ "%s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ new_nick);
+ }
}
/* enable hotlist */
@@ -633,7 +657,7 @@ int
irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
- char *nick, *host, *pos_args, *pos_end, *pos_usec, tags[128];
+ char *pos_args, *pos_end, *pos_usec, tags[128];
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
struct t_irc_channel *ptr_channel;
@@ -643,20 +667,16 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
:nick!user@host NOTICE mynick :notice text
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
-
+
if (argv[0][0] == ':')
- {
- nick = irc_protocol_get_nick_from_host (argv[0]);
- host = irc_protocol_get_address_from_host (argv[0]);
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
- }
else
- {
- nick = NULL;
- host = NULL;
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
- }
+
+ if (nick && irc_ignore_check (server, NULL, nick, host))
+ return WEECHAT_RC_OK;
if (nick && strncmp (pos_args, "\01VERSION", 8) == 0)
{
@@ -758,7 +778,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
}
}
if (!ptr_channel->topic)
- irc_channel_set_topic (ptr_channel, host);
+ irc_channel_set_topic (ptr_channel, address);
weechat_printf_tags (ptr_channel->buffer,
tags,
@@ -769,7 +789,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
}
else
{
- if (host && host[0])
+ if (address && address[0])
{
weechat_printf_tags (server->buffer,
tags,
@@ -779,7 +799,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
nick,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_HOST,
- host,
+ address,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT,
pos_args);
@@ -821,7 +841,7 @@ int
irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
- char *nick, *host, *pos_comment, *join_string;
+ char *pos_comment, *join_string;
int join_length;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
@@ -830,12 +850,10 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
:nick!user@host PART #channel :part message
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
IRC_PROTOCOL_CHECK_HOST;
- nick = irc_protocol_get_nick_from_host (argv[0]);
- host = irc_protocol_get_address_from_host (argv[0]);
-
pos_comment = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
@@ -846,43 +864,46 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
if (ptr_nick)
{
/* display part message */
- if (pos_comment)
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- weechat_printf_tags (ptr_channel->buffer,
- "irc_part",
- _("%s%s%s %s(%s%s%s)%s has left %s%s "
- "%s(%s%s%s)"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- host,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_comment,
- IRC_COLOR_CHAT_DELIMITERS);
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_part",
- _("%s%s%s %s(%s%s%s)%s has left "
- "%s%s"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- host,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name);
+ if (pos_comment)
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_part",
+ _("%s%s%s %s(%s%s%s)%s has left %s%s "
+ "%s(%s%s%s)"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->name,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_comment,
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_part",
+ _("%s%s%s %s(%s%s%s)%s has left "
+ "%s%s"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->name);
+ }
}
/* part request was issued by local client ? */
@@ -1052,7 +1073,7 @@ int
irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
- char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message;
+ 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 */
struct t_infolist *infolist;
struct t_infolist_item *item;
@@ -1068,12 +1089,10 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
:nick!user@host PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(4);
IRC_PROTOCOL_CHECK_HOST;
- nick = irc_protocol_get_nick_from_host (argv[0]);
- host = irc_protocol_get_address_from_host (argv[0]);
-
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
/* receiver is a channel ? */
@@ -1084,85 +1103,97 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
{
if (strncmp (pos_args, "\01ACTION ", 8) == 0)
{
- pos_args += 8;
- pos_end_01 = strchr (pos_args, '\01');
- if (pos_end_01)
- pos_end_01[0] = '\0';
-
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action,notify_message",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
-
- irc_channel_add_nick_speaking (ptr_channel, nick);
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ pos_args += 8;
+ pos_end_01 = strchr (pos_args, '\01');
+ if (pos_end_01)
+ pos_end_01[0] = '\0';
- if (pos_end_01)
- pos_end_01[0] = '\01';
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_action,notify_message",
+ "%s%s%s %s%s",
+ weechat_prefix ("action"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_args);
+
+ irc_channel_add_nick_speaking (ptr_channel, nick);
+
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
+ }
return WEECHAT_RC_OK;
}
if (strncmp (pos_args, "\01SOUND ", 7) == 0)
{
- pos_args += 7;
- pos_end_01 = strchr (pos_args, '\01');
- if (pos_end_01)
- pos_end_01[0] = '\0';
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ pos_args += 7;
+ pos_end_01 = strchr (pos_args, '\01');
+ if (pos_end_01)
+ pos_end_01[0] = '\0';
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sReceived a CTCP %sSOUND%s \"%s\" "
- "from %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- IRC_COLOR_CHAT,
- pos_args,
- IRC_COLOR_CHAT_NICK,
- nick);
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sReceived a CTCP %sSOUND%s \"%s\" "
+ "from %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ IRC_COLOR_CHAT,
+ pos_args,
+ IRC_COLOR_CHAT_NICK,
+ nick);
- if (pos_end_01)
- pos_end_01[0] = '\01';
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
+ }
return WEECHAT_RC_OK;
}
if (strncmp (pos_args, "\01PING", 5) == 0)
{
- pos_args += 5;
- while (pos_args[0] == ' ')
- pos_args++;
- pos_end_01 = strchr (pos_args, '\01');
- if (pos_end_01)
- pos_end_01[0] = '\0';
- else
- pos_args = NULL;
- if (pos_args && !pos_args[0])
- pos_args = NULL;
- if (pos_args)
- irc_server_sendf (server, "NOTICE %s :\01PING %s\01",
- nick, pos_args);
- else
- irc_server_sendf (server, "NOTICE %s :\01PING\01",
- nick);
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sCTCP %sPING%s received from %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick);
- if (pos_end_01)
- pos_end_01[0] = '\01';
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ pos_args += 5;
+ while (pos_args[0] == ' ')
+ pos_args++;
+ pos_end_01 = strchr (pos_args, '\01');
+ if (pos_end_01)
+ pos_end_01[0] = '\0';
+ else
+ pos_args = NULL;
+ if (pos_args && !pos_args[0])
+ pos_args = NULL;
+ if (pos_args)
+ irc_server_sendf (server, "NOTICE %s :\01PING %s\01",
+ nick, pos_args);
+ else
+ irc_server_sendf (server, "NOTICE %s :\01PING\01",
+ nick);
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sCTCP %sPING%s received from %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
+ }
return WEECHAT_RC_OK;
}
if (strncmp (pos_args, "\01VERSION", 8) == 0)
{
- irc_protocol_reply_version (server, ptr_channel, nick,
- argv_eol[0], pos_args);
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ irc_protocol_reply_version (server, ptr_channel, nick,
+ argv_eol[0], pos_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1172,75 +1203,81 @@ 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'))
{
- pos_args++;
- pos_end_01[0] = '\0';
- pos = strchr (pos_args, ' ');
- if (pos)
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- pos[0] = '\0';
- pos_message = pos + 1;
- while (pos_message[0] == ' ')
+ pos_args++;
+ pos_end_01[0] = '\0';
+ pos = strchr (pos_args, ' ');
+ if (pos)
{
- pos_message++;
+ pos[0] = '\0';
+ pos_message = pos + 1;
+ while (pos_message[0] == ' ')
+ {
+ pos_message++;
+ }
+ if (!pos_message[0])
+ pos_message = NULL;
}
- if (!pos_message[0])
+ else
pos_message = NULL;
- }
- else
- pos_message = NULL;
- if (pos_message)
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sUnknown CTCP %s%s%s "
- "received from %s%s%s: %s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- pos_args,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_message);
- }
- else
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sUnknown CTCP %s%s%s "
- "received from %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- pos_args,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick);
- }
- if (pos_end_01)
- pos_end_01[0] = '\01';
- if (pos)
- pos[0] = ' ';
+ if (pos_message)
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sUnknown CTCP %s%s%s "
+ "received from %s%s%s: %s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ pos_args,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_message);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sUnknown CTCP %s%s%s "
+ "received from %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ pos_args,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
+ if (pos)
+ pos[0] = ' ';
- weechat_hook_signal_send ("irc_ctcp",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
+ weechat_hook_signal_send ("irc_ctcp",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+ }
return WEECHAT_RC_OK;
}
-
+
/* other message */
ptr_nick = irc_nick_search (ptr_channel, nick);
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,notify_message",
- "%s%s",
- irc_nick_as_prefix (ptr_nick,
- (ptr_nick) ? NULL : nick,
- NULL),
- pos_args);
-
- irc_channel_add_nick_speaking (ptr_channel, nick);
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,notify_message",
+ "%s%s",
+ irc_nick_as_prefix (ptr_nick,
+ (ptr_nick) ? NULL : nick,
+ NULL),
+ pos_args);
+
+ irc_channel_add_nick_speaking (ptr_channel, nick);
+ }
}
else
{
@@ -1257,8 +1294,11 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* version asked by another user => answer with WeeChat version */
if (strncmp (pos_args, "\01VERSION", 8) == 0)
{
- irc_protocol_reply_version (server, NULL, nick, argv_eol[0],
- pos_args);
+ if (!irc_ignore_check (server, NULL, nick, host))
+ {
+ irc_protocol_reply_version (server, NULL, nick, argv_eol[0],
+ pos_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1266,37 +1306,40 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* ping request from another user => answer */
if (strncmp (pos_args, "\01PING", 5) == 0)
{
- pos_args += 5;
- while (pos_args[0] == ' ')
+ if (!irc_ignore_check (server, NULL, nick, host))
{
- pos_args++;
+ pos_args += 5;
+ while (pos_args[0] == ' ')
+ {
+ pos_args++;
+ }
+ pos_end_01 = strchr (pos, '\01');
+ if (pos_end_01)
+ pos_end_01[0] = '\0';
+ else
+ pos_args = NULL;
+ if (pos_args && !pos_args[0])
+ pos_args = NULL;
+ if (pos_args)
+ irc_server_sendf (server, "NOTICE %s :\01PING %s\01",
+ nick, pos_args);
+ else
+ irc_server_sendf (server, "NOTICE %s :\01PING\01",
+ nick);
+ weechat_printf_tags (server->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sCTCP %sPING%s received from %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ weechat_hook_signal_send ("irc_ctcp",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
}
- pos_end_01 = strchr (pos, '\01');
- if (pos_end_01)
- pos_end_01[0] = '\0';
- else
- pos_args = NULL;
- if (pos_args && !pos_args[0])
- pos_args = NULL;
- if (pos_args)
- irc_server_sendf (server, "NOTICE %s :\01PING %s\01",
- nick, pos_args);
- else
- irc_server_sendf (server, "NOTICE %s :\01PING\01",
- nick);
- weechat_printf_tags (server->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sCTCP %sPING%s received from %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick);
- weechat_hook_signal_send ("irc_ctcp",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- if (pos_end_01)
- pos_end_01[0] = '\01';
return WEECHAT_RC_OK;
}
@@ -1304,124 +1347,128 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* incoming DCC file */
if (strncmp (pos_args, "\01DCC SEND", 9) == 0)
{
- /* check if DCC SEND is ok, i.e. with 0x01 at end */
- pos_end_01 = strchr (pos_args + 1, '\01');
- if (!pos_end_01)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
-
- dcc_args = weechat_strndup (pos_args + 9, pos_end_01 - pos_args - 9);
-
- if (!dcc_args)
+ if (!irc_ignore_check (server, NULL, nick, host))
{
- weechat_printf (server->buffer,
- _("%s%s: not enough memory for \"%s\" "
- "command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
+ /* check if DCC SEND is ok, i.e. with 0x01 at end */
+ pos_end_01 = strchr (pos_args + 1, '\01');
+ if (!pos_end_01)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* DCC filename */
- pos_file = dcc_args;
- while (pos_file[0] == ' ')
- {
- pos_file++;
- }
+ dcc_args = weechat_strndup (pos_args + 9,
+ pos_end_01 - pos_args - 9);
- /* look for file size */
- pos_size = strrchr (pos_file, ' ');
- if (!pos_size)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_size;
- pos_size++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
+ if (!dcc_args)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: not enough memory for \"%s\" "
+ "command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_port;
- pos_port++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
+ /* DCC filename */
+ pos_file = dcc_args;
+ while (pos_file[0] == ' ')
+ {
+ pos_file++;
+ }
- /* look for DCC IP address */
- pos_addr = strrchr (pos_file, ' ');
- if (!pos_addr)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_addr;
- pos_addr++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
-
- /* add DCC file via xfer plugin */
- infolist = weechat_infolist_new ();
- if (infolist)
- {
- item = weechat_infolist_new_item (infolist);
- if (item)
+ /* look for file size */
+ pos_size = strrchr (pos_file, ' ');
+ if (!pos_size)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_size;
+ pos_size++;
+ while (pos[0] == ' ')
{
- weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
- snprintf (plugin_id, sizeof (plugin_id),
- "%x", (unsigned int)server);
- weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
- weechat_infolist_new_var_string (item, "type", "file_recv");
- weechat_infolist_new_var_string (item, "protocol", "dcc");
- weechat_infolist_new_var_string (item, "remote_nick", nick);
- weechat_infolist_new_var_string (item, "local_nick", server->nick);
- weechat_infolist_new_var_string (item, "filename", pos_file);
- weechat_infolist_new_var_string (item, "size", pos_size);
- weechat_infolist_new_var_string (item, "address", pos_addr);
- weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
- weechat_hook_signal_send ("xfer_add",
- WEECHAT_HOOK_SIGNAL_POINTER,
- infolist);
+ pos--;
}
- weechat_infolist_free (infolist);
- }
-
- weechat_hook_signal_send ("irc_dcc",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
+ pos[1] = '\0';
- free (dcc_args);
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_port;
+ pos_port++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* look for DCC IP address */
+ pos_addr = strrchr (pos_file, ' ');
+ if (!pos_addr)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_addr;
+ pos_addr++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* add DCC file via xfer plugin */
+ infolist = weechat_infolist_new ();
+ if (infolist)
+ {
+ item = weechat_infolist_new_item (infolist);
+ if (item)
+ {
+ weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
+ snprintf (plugin_id, sizeof (plugin_id),
+ "%x", (unsigned int)server);
+ weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
+ weechat_infolist_new_var_string (item, "type", "file_recv");
+ weechat_infolist_new_var_string (item, "protocol", "dcc");
+ weechat_infolist_new_var_string (item, "remote_nick", nick);
+ weechat_infolist_new_var_string (item, "local_nick", server->nick);
+ weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_string (item, "size", pos_size);
+ weechat_infolist_new_var_string (item, "address", pos_addr);
+ weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
+ weechat_hook_signal_send ("xfer_add",
+ WEECHAT_HOOK_SIGNAL_POINTER,
+ infolist);
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ weechat_hook_signal_send ("irc_dcc",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+
+ free (dcc_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1429,101 +1476,105 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* incoming DCC RESUME (asked by receiver) */
if (strncmp (pos_args, "\01DCC RESUME", 11) == 0)
{
- /* check if DCC RESUME is ok, i.e. with 0x01 at end */
- pos_end_01 = strchr (pos_args + 1, '\01');
- if (!pos_end_01)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
-
- dcc_args = weechat_strndup (pos_args + 11, pos_end_01 - pos_args - 11);
-
- if (!dcc_args)
+ if (!irc_ignore_check (server, NULL, nick, host))
{
- weechat_printf (server->buffer,
- _("%s%s: not enough memory for \"%s\" "
- "command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
+ /* check if DCC RESUME is ok, i.e. with 0x01 at end */
+ pos_end_01 = strchr (pos_args + 1, '\01');
+ if (!pos_end_01)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* DCC filename */
- pos_file = dcc_args;
- while (pos_file[0] == ' ')
- {
- pos_file++;
- }
+ dcc_args = weechat_strndup (pos_args + 11,
+ pos_end_01 - pos_args - 11);
- /* look for resume start position */
- pos_start_resume = strrchr (pos_file, ' ');
- if (!pos_start_resume)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_start_resume;
- pos_start_resume++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
+ if (!dcc_args)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: not enough memory for \"%s\" "
+ "command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_port;
- pos_port++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
-
- /* accept resume via xfer plugin */
- infolist = weechat_infolist_new ();
- if (infolist)
- {
- item = weechat_infolist_new_item (infolist);
- if (item)
+ /* DCC filename */
+ pos_file = dcc_args;
+ while (pos_file[0] == ' ')
{
- weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
- snprintf (plugin_id, sizeof (plugin_id),
- "%x", (unsigned int)server);
- weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
- weechat_infolist_new_var_string (item, "type", "file_recv");
- weechat_infolist_new_var_string (item, "filename", pos_file);
- weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
- weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
- weechat_hook_signal_send ("xfer_accept_resume",
- WEECHAT_HOOK_SIGNAL_POINTER,
- infolist);
+ pos_file++;
}
- weechat_infolist_free (infolist);
- }
-
- weechat_hook_signal_send ("irc_dcc",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- free (dcc_args);
+ /* look for resume start position */
+ pos_start_resume = strrchr (pos_file, ' ');
+ if (!pos_start_resume)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_start_resume;
+ pos_start_resume++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_port;
+ pos_port++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* accept resume via xfer plugin */
+ infolist = weechat_infolist_new ();
+ if (infolist)
+ {
+ item = weechat_infolist_new_item (infolist);
+ if (item)
+ {
+ weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
+ snprintf (plugin_id, sizeof (plugin_id),
+ "%x", (unsigned int)server);
+ weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
+ weechat_infolist_new_var_string (item, "type", "file_recv");
+ weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
+ weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
+ weechat_hook_signal_send ("xfer_accept_resume",
+ WEECHAT_HOOK_SIGNAL_POINTER,
+ infolist);
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ weechat_hook_signal_send ("irc_dcc",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+
+ free (dcc_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1531,101 +1582,105 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* incoming DCC ACCEPT (resume accepted by sender) */
if (strncmp (pos_args, "\01DCC ACCEPT", 11) == 0)
{
- /* check if DCC ACCEPT is ok, i.e. with 0x01 at end */
- pos_end_01 = strchr (pos_args + 1, '\01');
- if (!pos_end_01)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
-
- dcc_args = weechat_strndup (pos_args + 11, pos_end_01 - pos_args - 11);
-
- if (!dcc_args)
+ if (!irc_ignore_check (server, NULL, nick, host))
{
- weechat_printf (server->buffer,
- _("%s%s: not enough memory for \"%s\" "
- "command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
+ /* check if DCC ACCEPT is ok, i.e. with 0x01 at end */
+ pos_end_01 = strchr (pos_args + 1, '\01');
+ if (!pos_end_01)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* DCC filename */
- pos_file = dcc_args;
- while (pos_file[0] == ' ')
- {
- pos_file++;
- }
+ dcc_args = weechat_strndup (pos_args + 11,
+ pos_end_01 - pos_args - 11);
- /* look for resume start position */
- pos_start_resume = strrchr (pos_file, ' ');
- if (!pos_start_resume)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_start_resume;
- pos_start_resume++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
+ if (!dcc_args)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: not enough memory for \"%s\" "
+ "command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos = pos_port;
- pos_port++;
- while (pos[0] == ' ')
- {
- pos--;
- }
- pos[1] = '\0';
-
- /* resume file via xfer plugin */
- infolist = weechat_infolist_new ();
- if (infolist)
- {
- item = weechat_infolist_new_item (infolist);
- if (item)
+ /* DCC filename */
+ pos_file = dcc_args;
+ while (pos_file[0] == ' ')
{
- weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
- snprintf (plugin_id, sizeof (plugin_id),
- "%x", (unsigned int)server);
- weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
- weechat_infolist_new_var_string (item, "type", "file_recv");
- weechat_infolist_new_var_string (item, "filename", pos_file);
- weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
- weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
- weechat_hook_signal_send ("xfer_start_resume",
- WEECHAT_HOOK_SIGNAL_POINTER,
- infolist);
+ pos_file++;
}
- weechat_infolist_free (infolist);
- }
-
- weechat_hook_signal_send ("irc_dcc",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- free (dcc_args);
+ /* look for resume start position */
+ pos_start_resume = strrchr (pos_file, ' ');
+ if (!pos_start_resume)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_start_resume;
+ pos_start_resume++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos = pos_port;
+ pos_port++;
+ while (pos[0] == ' ')
+ {
+ pos--;
+ }
+ pos[1] = '\0';
+
+ /* resume file via xfer plugin */
+ infolist = weechat_infolist_new ();
+ if (infolist)
+ {
+ item = weechat_infolist_new_item (infolist);
+ if (item)
+ {
+ weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
+ snprintf (plugin_id, sizeof (plugin_id),
+ "%x", (unsigned int)server);
+ weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
+ weechat_infolist_new_var_string (item, "type", "file_recv");
+ weechat_infolist_new_var_string (item, "filename", pos_file);
+ weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
+ weechat_infolist_new_var_string (item, "start_resume", pos_start_resume);
+ weechat_hook_signal_send ("xfer_start_resume",
+ WEECHAT_HOOK_SIGNAL_POINTER,
+ infolist);
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ weechat_hook_signal_send ("irc_dcc",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+
+ free (dcc_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1633,114 +1688,118 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
/* incoming DCC CHAT */
if (strncmp (pos_args, "\01DCC CHAT", 9) == 0)
{
- /* check if DCC CHAT is ok, i.e. with 0x01 at end */
- pos_end_01 = strchr (pos_args + 1, '\01');
- if (!pos_end_01)
+ if (!irc_ignore_check (server, NULL, nick, host))
{
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
+ /* check if DCC CHAT is ok, i.e. with 0x01 at end */
+ pos_end_01 = strchr (pos_args + 1, '\01');
+ if (!pos_end_01)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
- dcc_args = weechat_strndup (pos_args + 9, pos_end_01 - pos_args - 9);
-
- if (!dcc_args)
- {
- weechat_printf (server->buffer,
- _("%s%s: not enough memory for \"%s\" "
- "command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- return WEECHAT_RC_ERROR;
- }
+ dcc_args = weechat_strndup (pos_args + 9,
+ pos_end_01 - pos_args - 9);
- /* CHAT type */
- pos_file = dcc_args;
- while (pos_file[0] == ' ')
- {
- pos_file++;
- }
-
- /* DCC IP address */
- pos_addr = strchr (pos_file, ' ');
- if (!pos_addr)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos_addr[0] = '\0';
- pos_addr++;
- while (pos_addr[0] == ' ')
- {
+ if (!dcc_args)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: not enough memory for \"%s\" "
+ "command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ return WEECHAT_RC_ERROR;
+ }
+
+ /* CHAT type */
+ pos_file = dcc_args;
+ while (pos_file[0] == ' ')
+ {
+ pos_file++;
+ }
+
+ /* DCC IP address */
+ pos_addr = strchr (pos_file, ' ');
+ if (!pos_addr)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos_addr[0] = '\0';
pos_addr++;
- }
+ while (pos_addr[0] == ' ')
+ {
+ pos_addr++;
+ }
- /* look for DCC port */
- pos_port = strchr (pos_addr, ' ');
- if (!pos_port)
- {
- weechat_printf (server->buffer,
- _("%s%s: cannot parse \"%s\" command"),
- weechat_prefix ("error"), "irc",
- "privmsg");
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
- pos_port[0] = '\0';
- pos_port++;
- while (pos_port[0] == ' ')
- {
+ /* look for DCC port */
+ pos_port = strchr (pos_addr, ' ');
+ if (!pos_port)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot parse \"%s\" command"),
+ weechat_prefix ("error"), "irc",
+ "privmsg");
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
+ pos_port[0] = '\0';
pos_port++;
- }
+ while (pos_port[0] == ' ')
+ {
+ pos_port++;
+ }
- if (weechat_strcasecmp (pos_file, "chat") != 0)
- {
- weechat_printf (server->buffer,
- _("%s%s: unknown DCC CHAT type "
- "received from %s%s%s: \"%s\""),
- weechat_prefix ("error"), "irc",
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_file);
- free (dcc_args);
- return WEECHAT_RC_ERROR;
- }
+ if (weechat_strcasecmp (pos_file, "chat") != 0)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: unknown DCC CHAT type "
+ "received from %s%s%s: \"%s\""),
+ weechat_prefix ("error"), "irc",
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_file);
+ free (dcc_args);
+ return WEECHAT_RC_ERROR;
+ }
- /* add DCC chat via xfer plugin */
- infolist = weechat_infolist_new ();
- if (infolist)
- {
- item = weechat_infolist_new_item (infolist);
- if (item)
+ /* add DCC chat via xfer plugin */
+ infolist = weechat_infolist_new ();
+ if (infolist)
{
- weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
- snprintf (plugin_id, sizeof (plugin_id),
- "%x", (unsigned int)server);
- weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
- weechat_infolist_new_var_string (item, "type", "chat_recv");
- weechat_infolist_new_var_string (item, "remote_nick", nick);
- weechat_infolist_new_var_string (item, "local_nick", server->nick);
- weechat_infolist_new_var_string (item, "address", pos_addr);
- weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
- weechat_hook_signal_send ("xfer_add",
- WEECHAT_HOOK_SIGNAL_POINTER,
- infolist);
+ item = weechat_infolist_new_item (infolist);
+ if (item)
+ {
+ weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name);
+ snprintf (plugin_id, sizeof (plugin_id),
+ "%x", (unsigned int)server);
+ weechat_infolist_new_var_string (item, "plugin_id", plugin_id);
+ weechat_infolist_new_var_string (item, "type", "chat_recv");
+ weechat_infolist_new_var_string (item, "remote_nick", nick);
+ weechat_infolist_new_var_string (item, "local_nick", server->nick);
+ weechat_infolist_new_var_string (item, "address", pos_addr);
+ weechat_infolist_new_var_integer (item, "port", atoi (pos_port));
+ weechat_hook_signal_send ("xfer_add",
+ WEECHAT_HOOK_SIGNAL_POINTER,
+ infolist);
+ }
+ weechat_infolist_free (infolist);
}
- weechat_infolist_free (infolist);
- }
-
- weechat_hook_signal_send ("irc_dcc",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
- free (dcc_args);
+ weechat_hook_signal_send ("irc_dcc",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+
+ free (dcc_args);
+ }
return WEECHAT_RC_OK;
}
@@ -1750,43 +1809,46 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
if (strncmp (pos_args, "\01ACTION ", 8) == 0)
{
- if (!ptr_channel)
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- ptr_channel = irc_channel_new (server,
- IRC_CHANNEL_TYPE_PRIVATE,
- nick, 0);
if (!ptr_channel)
{
- weechat_printf (server->buffer,
- _("%s%s: cannot create new "
- "private buffer \"%s\""),
- weechat_prefix ("error"), "irc",
- nick);
- return WEECHAT_RC_ERROR;
+ ptr_channel = irc_channel_new (server,
+ IRC_CHANNEL_TYPE_PRIVATE,
+ nick, 0);
+ if (!ptr_channel)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot create new "
+ "private buffer \"%s\""),
+ weechat_prefix ("error"), "irc",
+ nick);
+ return WEECHAT_RC_ERROR;
+ }
}
+ if (!ptr_channel->topic)
+ irc_channel_set_topic (ptr_channel, address);
+
+ pos_args += 8;
+ pos_end_01 = strchr (pos, '\01');
+ if (pos_end_01)
+ pos_end_01[0] = '\0';
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,irc_action,notify_private",
+ "%s%s%s %s%s",
+ weechat_prefix ("action"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_args);
+ weechat_hook_signal_send ("irc_pv",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
}
- if (!ptr_channel->topic)
- irc_channel_set_topic (ptr_channel, host);
-
- pos_args += 8;
- pos_end_01 = strchr (pos, '\01');
- if (pos_end_01)
- pos_end_01[0] = '\0';
-
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,irc_action,notify_private",
- "%s%s%s %s%s",
- weechat_prefix ("action"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_args);
- weechat_hook_signal_send ("irc_pv",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
-
- if (pos_end_01)
- pos_end_01[0] = '\01';
}
else
{
@@ -1795,93 +1857,97 @@ 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'))
{
- pos_args++;
- pos_end_01[0] = '\0';
- pos = strchr (pos_args, ' ');
- if (pos)
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- pos[0] = '\0';
- pos_message = pos + 1;
- while (pos_message[0] == ' ')
+ pos_args++;
+ pos_end_01[0] = '\0';
+ pos = strchr (pos_args, ' ');
+ if (pos)
{
- pos_message++;
+ pos[0] = '\0';
+ pos_message = pos + 1;
+ while (pos_message[0] == ' ')
+ {
+ pos_message++;
+ }
+ if (!pos_message[0])
+ pos_message = NULL;
}
- if (!pos_message[0])
+ else
pos_message = NULL;
- }
- else
- pos_message = NULL;
- if (pos_message)
- {
- weechat_printf_tags (server->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sUnknown CTCP %s%s%s "
- "received from %s%s%s: %s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- pos_args,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT,
- pos_message);
- }
- else
- {
- weechat_printf_tags (server->buffer,
- "irc_privmsg,irc_ctcp",
- _("%sUnknown CTCP %s%s%s "
- "received from %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- pos_args,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_NICK,
- nick);
- }
- if (pos_end_01)
- pos_end_01[0] = '\01';
- if (pos)
- pos[0] = ' ';
+ if (pos_message)
+ {
+ weechat_printf_tags (server->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sUnknown CTCP %s%s%s "
+ "received from %s%s%s: %s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ pos_args,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ pos_message);
+ }
+ else
+ {
+ weechat_printf_tags (server->buffer,
+ "irc_privmsg,irc_ctcp",
+ _("%sUnknown CTCP %s%s%s "
+ "received from %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ pos_args,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_NICK,
+ nick);
+ }
+ if (pos_end_01)
+ pos_end_01[0] = '\01';
+ if (pos)
+ pos[0] = ' ';
- weechat_hook_signal_send ("irc_ctcp",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
-
- return WEECHAT_RC_OK;
+ weechat_hook_signal_send ("irc_ctcp",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
+ }
}
else
{
/* private message */
- if (!ptr_channel)
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- ptr_channel = irc_channel_new (server,
- IRC_CHANNEL_TYPE_PRIVATE,
- nick, 0);
if (!ptr_channel)
{
- weechat_printf (server->buffer,
- _("%s%s: cannot create new "
- "private buffer \"%s\""),
- weechat_prefix ("error"),
- "irc", nick);
- return WEECHAT_RC_ERROR;
+ ptr_channel = irc_channel_new (server,
+ IRC_CHANNEL_TYPE_PRIVATE,
+ nick, 0);
+ if (!ptr_channel)
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: cannot create new "
+ "private buffer \"%s\""),
+ weechat_prefix ("error"),
+ "irc", nick);
+ return WEECHAT_RC_ERROR;
+ }
}
+ irc_channel_set_topic (ptr_channel, address);
+
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_privmsg,notify_private",
+ "%s%s",
+ irc_nick_as_prefix (NULL,
+ nick,
+ IRC_COLOR_CHAT_NICK_OTHER),
+ pos_args);
+
+ weechat_hook_signal_send ("irc_pv",
+ WEECHAT_HOOK_SIGNAL_STRING,
+ argv_eol[0]);
}
- irc_channel_set_topic (ptr_channel, host);
-
- weechat_printf_tags (ptr_channel->buffer,
- "irc_privmsg,notify_private",
- "%s%s",
- irc_nick_as_prefix (NULL,
- nick,
- IRC_COLOR_CHAT_NICK_OTHER),
- pos_args);
-
- weechat_hook_signal_send ("irc_pv",
- WEECHAT_HOOK_SIGNAL_STRING,
- argv_eol[0]);
}
}
}
@@ -1897,7 +1963,7 @@ int
irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
- char *nick, *host, *pos_comment;
+ char *pos_comment;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
@@ -1905,12 +1971,10 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
:nick!user@host QUIT :quit message
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(2);
IRC_PROTOCOL_CHECK_HOST;
- nick = irc_protocol_get_nick_from_host (argv[0]);
- host = irc_protocol_get_address_from_host (argv[0]);
-
pos_comment = (argc > 2) ?
((argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]) : NULL;
@@ -1926,38 +1990,43 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
{
if (ptr_nick)
irc_nick_free (ptr_channel, ptr_nick);
- if (pos_comment && pos_comment[0])
- {
- weechat_printf_tags (ptr_channel->buffer,
- "irc_quit",
- _("%s%s%s %s(%s%s%s)%s has quit "
- "%s(%s%s%s)"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- host,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- pos_comment,
- IRC_COLOR_CHAT_DELIMITERS);
- }
- else
+
+ /* display quit message */
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- weechat_printf_tags (ptr_channel->buffer,
- "irc_quit",
- _("%s%s%s %s(%s%s%s)%s has quit"),
- weechat_prefix ("quit"),
- IRC_COLOR_CHAT_NICK,
- nick,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- host,
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT);
+ if (pos_comment && pos_comment[0])
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_quit",
+ _("%s%s%s %s(%s%s%s)%s has quit "
+ "%s(%s%s%s)"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ pos_comment,
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
+ else
+ {
+ weechat_printf_tags (ptr_channel->buffer,
+ "irc_quit",
+ _("%s%s%s %s(%s%s%s)%s has quit"),
+ weechat_prefix ("quit"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT);
+ }
}
}
}
@@ -2050,6 +2119,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
:nick!user@host TOPIC #channel :new topic for channel
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
if (!irc_channel_is_channel (argv[2]))
@@ -2065,38 +2135,41 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
ptr_channel = irc_channel_search (server, argv[2]);
buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
-
- if (pos_topic && pos_topic[0])
- {
- topic_color = irc_color_decode (pos_topic,
- weechat_config_boolean (irc_config_network_colors_receive));
- weechat_printf_tags (buffer,
- "irc_topic",
- _("%s%s%s%s has changed topic for %s%s%s to: "
- "\"%s%s\""),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- argv[2],
- IRC_COLOR_CHAT,
- (topic_color) ? topic_color : pos_topic,
- IRC_COLOR_CHAT);
- if (topic_color)
- free (topic_color);
- }
- else
+
+ if (!irc_ignore_check (server, ptr_channel, nick, host))
{
- weechat_printf_tags (buffer,
- "irc_topic",
- _("%s%s%s%s has unset topic for %s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT,
- IRC_COLOR_CHAT_CHANNEL,
- argv[2]);
+ if (pos_topic && pos_topic[0])
+ {
+ topic_color = irc_color_decode (pos_topic,
+ weechat_config_boolean (irc_config_network_colors_receive));
+ weechat_printf_tags (buffer,
+ "irc_topic",
+ _("%s%s%s%s has changed topic for %s%s%s to: "
+ "\"%s%s\""),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ argv[2],
+ IRC_COLOR_CHAT,
+ (topic_color) ? topic_color : pos_topic,
+ IRC_COLOR_CHAT);
+ if (topic_color)
+ free (topic_color);
+ }
+ else
+ {
+ weechat_printf_tags (buffer,
+ "irc_topic",
+ _("%s%s%s%s has unset topic for %s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT,
+ IRC_COLOR_CHAT_CHANNEL,
+ argv[2]);
+ }
}
if (ptr_channel)
@@ -2117,20 +2190,24 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command,
:nick!user@host WALLOPS :message from admin
*/
+ IRC_PROTOCOL_GET_HOST;
IRC_PROTOCOL_MIN_ARGS(3);
- weechat_printf_tags (server->buffer,
- "irc_wallops",
- _("%sWallops from %s%s %s(%s%s%s)%s: %s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_NICK,
- irc_protocol_get_nick_from_host (argv[0]),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_HOST,
- irc_protocol_get_address_from_host (argv[0]),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT,
- (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]);
+ if (!irc_ignore_check (server, NULL, nick, host))
+ {
+ weechat_printf_tags (server->buffer,
+ "irc_wallops",
+ _("%sWallops from %s%s %s(%s%s%s)%s: %s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_NICK,
+ nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_HOST,
+ address,
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT,
+ (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]);
+ }
return WEECHAT_RC_OK;
}