summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-09-04 12:55:25 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-09-04 12:55:25 +0000
commit06463e59373f2fe974eb0042d0cabd6593826698 (patch)
treefe19fb50624c4bc9d777f68ff5ba7c8785265a8c /src
parentd80c8e9e575239553719b4991b40e2dca6e6478e (diff)
downloadweechat-06463e59373f2fe974eb0042d0cabd6593826698.zip
Added /ignore and /unignore commands
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c184
-rw-r--r--src/common/command.h3
-rw-r--r--src/common/completion.c85
-rw-r--r--src/common/weechat.c3
-rw-r--r--src/common/weeconfig.c50
-rw-r--r--src/common/weeconfig.h5
-rw-r--r--src/irc/Makefile.am1
-rw-r--r--src/irc/irc-channel.c8
-rw-r--r--src/irc/irc-commands.c2
-rw-r--r--src/irc/irc-ignore.c475
-rw-r--r--src/irc/irc-nick.c5
-rw-r--r--src/irc/irc-recv.c2991
-rw-r--r--src/irc/irc-server.c438
-rw-r--r--src/irc/irc.h145
14 files changed, 2723 insertions, 1672 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 073ed2a82..d47bb9265 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -72,6 +72,16 @@ t_weechat_command weechat_commands[] =
{ "help", N_("display help about commands"),
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
0, 1, weechat_cmd_help, NULL },
+ { "ignore", N_("ignore IRC messages and/or hosts"),
+ N_("[mask [[type | command] [channel [server]]]]"),
+ N_(" mask: nick or host mask to ignore\n"
+ " type: type of message to ignore (action, ctcp, dcc, pv)\n"
+ "command: IRC command\n"
+ "channel: name of channel for ignore\n"
+ " server: name of server for ignore\n\n"
+ "For each argument, '*' means all.\n"
+ "Without argument, /ignore command lists all defined ignore."),
+ 0, 4, weechat_cmd_ignore, NULL },
{ "key", N_("bind/unbind keys"),
N_("[key function/command] [unbind key] [functions] [reset -yes]"),
N_("key: bind this key to an internal function or a command (beginning by \"/\")\n"
@@ -81,17 +91,17 @@ t_weechat_command weechat_commands[] =
0, MAX_ARGS, NULL, weechat_cmd_key },
{ "perl", N_("list/load/unload Perl scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
- N_("filename: Perl script (file) to load\n"
+ N_("filename: Perl script (file) to load\n\n"
"Without argument, /perl command lists all loaded Perl scripts."),
0, 2, weechat_cmd_perl, NULL },
{ "python", N_("list/load/unload Python scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
- N_("filename: Python script (file) to load\n"
+ N_("filename: Python script (file) to load\n\n"
"Without argument, /python command lists all loaded Python scripts."),
0, 2, weechat_cmd_python, NULL },
{ "ruby", N_("list/load/unload Ruby scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
- N_("filename: Ruby script (file) to load\n"
+ N_("filename: Ruby script (file) to load\n\n"
"Without argument, /ruby command lists all loaded Ruby scripts."),
0, 2, weechat_cmd_ruby, NULL },
{ "server", N_("list, add or remove servers"),
@@ -121,6 +131,17 @@ t_weechat_command weechat_commands[] =
{ "unalias", N_("remove an alias"),
N_("alias_name"), N_("alias_name: name of alias to remove"),
1, 1, NULL, weechat_cmd_unalias },
+ { "unignore", N_("unignore IRC messages and/or hosts"),
+ N_("[number | [mask [[type | command] [channel [server]]]]]"),
+ N_(" number: # of ignore to unignore (number is displayed by list of ignore)\n"
+ " mask: nick or host mask to unignore\n"
+ " type: type of message to unignore (action, ctcp, dcc, pv)\n"
+ "command: IRC command\n"
+ "channel: name of channel for unignore\n"
+ " server: name of server for unignore\n\n"
+ "For each argument, '*' means all.\n"
+ "Without argument, /unignore command lists all defined ignore."),
+ 0, 4, weechat_cmd_unignore, NULL },
{ "window", N_("manage windows"),
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
N_("list: list opened windows (no parameter implies this list)\n"
@@ -874,6 +895,11 @@ weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
"%s", SERVER(buffer)->name);
gui_printf (NULL, ")\n");
}
+ else
+ {
+ gui_printf (NULL, _("not connected"));
+ gui_printf (NULL, "\n");
+ }
}
/*
@@ -1352,6 +1378,93 @@ weechat_cmd_help (int argc, char **argv)
}
/*
+ * weechat_cmd_ignore_display: display an ignore entry
+ */
+
+void
+weechat_cmd_ignore_display (char *text, t_irc_ignore *ptr_ignore)
+{
+ if (text)
+ gui_printf (NULL, "%s ", text);
+
+ gui_printf (NULL, _("on"));
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", ptr_ignore->server_name);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "/");
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->channel_name);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
+ gui_printf (NULL, _(" ignoring "));
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->type);
+ gui_printf (NULL, _(" from "));
+ gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s\n", ptr_ignore->mask);
+}
+
+/*
+ * weechat_cmd_ignore: ignore IRC commands and/or hosts
+ */
+
+int
+weechat_cmd_ignore (int argc, char **argv)
+{
+ t_irc_ignore *ptr_ignore;
+ int i;
+
+ ptr_ignore = NULL;
+ switch (argc)
+ {
+ case 0:
+ /* List all ignore */
+ if (irc_ignore)
+ {
+ gui_printf (NULL, "\n");
+ gui_printf (NULL, _("List of ignore:\n"));
+ i = 0;
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ i++;
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf (NULL, "%d", i);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
+ weechat_cmd_ignore_display (NULL, ptr_ignore);
+ }
+ }
+ else
+ {
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, _("No ignore defined.\n"));
+ }
+ return 0;
+ break;
+ case 1:
+ ptr_ignore = ignore_add (argv[0], "*", "*",
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 2:
+ ptr_ignore = ignore_add (argv[0], argv[1], "*",
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 3:
+ ptr_ignore = ignore_add (argv[0], argv[1], argv[2],
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 4:
+ ptr_ignore = ignore_add (argv[0], argv[1], argv[2], argv[3]);
+ break;
+ }
+ if (ptr_ignore)
+ {
+ gui_printf (NULL, "\n");
+ weechat_cmd_ignore_display (_("New ignore:"), ptr_ignore);
+ return 0;
+ }
+ else
+ return -1;
+}
+
+/*
* weechat_cmd_key_display: display a key binding
*/
@@ -2410,7 +2523,7 @@ weechat_cmd_set (char *arguments)
{
section_displayed = 0;
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -2520,6 +2633,69 @@ weechat_cmd_unalias (char *arguments)
}
/*
+ * weechat_cmd_unignore: unignore IRC commands and/or hosts
+ */
+
+int
+weechat_cmd_unignore (int argc, char **argv)
+{
+ char *error;
+ int number, ret;
+
+ ret = 0;
+ switch (argc)
+ {
+ case 0:
+ /* List all ignore */
+ weechat_cmd_ignore (argc, argv);
+ return 0;
+ break;
+ case 1:
+ error = NULL;
+ number = strtol (argv[0], &error, 10);
+ if ((error) && (error[0] == '\0'))
+ ret = ignore_search_free_by_number (number);
+ else
+ ret = ignore_search_free (argv[0], "*", "*",
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 2:
+ ret = ignore_search_free (argv[0], argv[1], "*",
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 3:
+ ret = ignore_search_free (argv[0], argv[1], argv[2],
+ (SERVER(gui_current_window->buffer)) ?
+ SERVER(gui_current_window->buffer)->name : "*");
+ break;
+ case 4:
+ ret = ignore_search_free (argv[0], argv[1], argv[2], argv[3]);
+ break;
+ }
+
+ if (ret)
+ {
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", ret);
+ if (ret > 1)
+ gui_printf (NULL, _("ignore were removed.\n"));
+ else
+ gui_printf (NULL, _("ignore was removed.\n"));
+ }
+ else
+ {
+ irc_display_prefix (NULL, PREFIX_ERROR);
+ gui_printf (NULL, _("%s no ignore found\n"),
+ WEECHAT_ERROR);
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
* weechat_cmd_window: manage windows
*/
diff --git a/src/common/command.h b/src/common/command.h
index 35c19bc5e..698290750 100644
--- a/src/common/command.h
+++ b/src/common/command.h
@@ -69,6 +69,8 @@ extern int weechat_cmd_connect (int, char **);
extern int weechat_cmd_debug (int, char **);
extern int weechat_cmd_disconnect (int, char **);
extern int weechat_cmd_help (int, char **);
+extern void weechat_cmd_ignore_display (char *, t_irc_ignore *);
+extern int weechat_cmd_ignore (int, char **);
extern int weechat_cmd_key (char *);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_python (int, char **);
@@ -77,6 +79,7 @@ extern int weechat_cmd_save (int, char **);
extern int weechat_cmd_server (int, char **);
extern int weechat_cmd_set (char *);
extern int weechat_cmd_unalias (char *);
+extern int weechat_cmd_unignore (int, char **);
extern int weechat_cmd_unset (char *);
extern int weechat_cmd_window (int, char **);
diff --git a/src/common/completion.c b/src/common/completion.c
index 41be8e894..a8c56461b 100644
--- a/src/common/completion.c
+++ b/src/common/completion.c
@@ -102,6 +102,7 @@ completion_build_list (t_completion *completion, void *channel)
int i, j;
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
+ t_irc_nick *ptr_nick;
char *pos, option_name[256], *string;
t_weechat_alias *ptr_alias;
t_config_option *option;
@@ -201,6 +202,88 @@ completion_build_list (t_completion *completion, void *channel)
}
return;
}
+ if (ascii_strcasecmp (completion->base_command, "ignore") == 0)
+ {
+ /* arg 1: nicks of current channel and "*" */
+ if (completion->base_command_arg == 1)
+ {
+ weelist_add (&completion->completion_list,
+ &completion->last_completion,
+ "*");
+ if (channel)
+ {
+ if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
+ {
+ for (ptr_nick = ((t_irc_channel *)channel)->nicks; ptr_nick;
+ ptr_nick = ptr_nick->next_nick)
+ {
+ weelist_add (&completion->completion_list,
+ &completion->last_completion,
+ ptr_nick->nick);
+ }
+ }
+ if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
+ {
+ weelist_add (&completion->completion_list,
+ &completion->last_completion,
+ ((t_irc_channel *)channel)->name);
+ }
+ }
+ return;
+ }
+
+ /* arg 2: type / command and "*" */
+ if (completion->base_command_arg == 2)
+ {
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ "*");
+ i = 0;
+ while (ignore_types[i])
+ {
+ weelist_add (&completion->completion_list,
+ &completion->last_completion,
+ ignore_types[i]);
+ i++;
+ }
+ i = 0;
+ while (irc_commands[i].command_name)
+ {
+ if (irc_commands[i].recv_function)
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ irc_commands[i].command_name);
+ i++;
+ }
+ return;
+ }
+
+ /* arg 3: channel and "*" */
+ if (completion->base_command_arg == 3)
+ {
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ "*");
+ if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ ((t_irc_channel *)channel)->name);
+ return;
+ }
+
+ /* arg 4: server */
+ if (completion->base_command_arg == 4)
+ {
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ "*");
+ if (SERVER(gui_current_window->buffer))
+ weelist_add(&completion->completion_list,
+ &completion->last_completion,
+ SERVER(gui_current_window->buffer)->name);
+ return;
+ }
+ }
if (ascii_strcasecmp (completion->base_command, "key") == 0)
{
if (completion->base_command_arg == 1)
@@ -254,7 +337,7 @@ completion_build_list (t_completion *completion, void *channel)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
diff --git a/src/common/weechat.c b/src/common/weechat.c
index f0ed84597..b5c275508 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -844,6 +844,9 @@ wee_dump (int crash)
wee_log_printf ("\n");
gui_buffer_print_log (ptr_buffer);
}
+
+ wee_log_printf ("\n");
+ ignore_print_log ();
wee_log_printf ("\n");
wee_log_printf ("****** End of dump ******\n");
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 2b181d1ae..6aeb9761f 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -55,6 +55,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
{ CONFIG_SECTION_PROXY, "proxy" },
{ CONFIG_SECTION_KEYS, "keys" },
{ CONFIG_SECTION_ALIAS, "alias" },
+ { CONFIG_SECTION_IGNORE, "ignore" },
{ CONFIG_SECTION_SERVER, "server" }
};
@@ -758,7 +759,7 @@ t_config_option weechat_options_server[] =
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
{ weechat_options_look, weechat_options_colors, weechat_options_history,
weechat_options_log, weechat_options_irc, weechat_options_dcc,
- weechat_options_proxy, NULL, NULL, weechat_options_server
+ weechat_options_proxy, NULL, NULL, NULL, weechat_options_server
};
@@ -795,7 +796,7 @@ config_get_section (t_config_option *ptr_option)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1090,7 +1091,7 @@ config_option_search (char *option_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1254,7 +1255,7 @@ config_default_values ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1428,6 +1429,21 @@ config_read ()
if (alias_new (line, pos))
weelist_add (&index_commands, &last_index_command, line);
}
+ else if (section == CONFIG_SECTION_IGNORE)
+ {
+ /* create new ignore */
+ if (ascii_strcasecmp (line, "ignore") != 0)
+ gui_printf (NULL,
+ _("%s %s, line %d: invalid option \"%s\"\n"),
+ WEECHAT_WARNING, filename, line_number, line);
+ else
+ {
+ if (!ignore_add_from_config (pos))
+ gui_printf (NULL,
+ _("%s %s, line %d: invalid ignore options \"%s\"\n"),
+ WEECHAT_WARNING, filename, line_number, pos);
+ }
+ }
else
{
option_number = -1;
@@ -1571,7 +1587,7 @@ config_create_default ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1623,7 +1639,6 @@ config_create_default ()
}
/* default aliases */
- /* TODO: remove comments when missing commands will be ok */
fprintf (file, "\n[alias]\n");
fprintf (file, "SAY=msg *\n");
fprintf (file, "BYE=quit\n");
@@ -1633,12 +1648,10 @@ config_create_default ()
fprintf (file, "CL=clear\n");
fprintf (file, "CLOSE=buffer close\n");
fprintf (file, "CHAT=dcc chat\n");
- fprintf (file, "# GET=dcc get\n");
- fprintf (file, "# IG=ignore\n");
+ fprintf (file, "IG=ignore\n");
fprintf (file, "J=join\n");
fprintf (file, "K=kick\n");
fprintf (file, "KB=kickban\n");
- fprintf (file, "# KN=knockout\n");
fprintf (file, "LEAVE=part\n");
fprintf (file, "M=msg\n");
fprintf (file, "MUB=unban *\n");
@@ -1646,12 +1659,14 @@ config_create_default ()
fprintf (file, "Q=query\n");
fprintf (file, "T=topic\n");
fprintf (file, "UB=unban\n");
- fprintf (file, "# UNIG=unignore\n");
+ fprintf (file, "UNIG=unignore\n");
fprintf (file, "W=who\n");
fprintf (file, "WC=part\n");
fprintf (file, "WI=whois\n");
fprintf (file, "WW=whowas\n");
+ /* no ignore by default */
+
/* default server is freenode */
fprintf (file, "\n[server]\n");
fprintf (file, "server_name=freenode\n");
@@ -1730,6 +1745,7 @@ config_write (char *config_name)
time_t current_time;
t_irc_server *ptr_server;
t_weechat_alias *ptr_alias;
+ t_irc_ignore *ptr_ignore;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
@@ -1765,7 +1781,7 @@ config_write (char *config_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
- && (i != CONFIG_SECTION_SERVER))
+ && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1842,6 +1858,18 @@ config_write (char *config_name)
ptr_alias->alias_name, ptr_alias->alias_command + 1);
}
+ /* ignore section */
+ fprintf (file, "\n[ignore]\n");
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ fprintf (file, "ignore=%s,%s,%s,%s\n",
+ ptr_ignore->mask,
+ ptr_ignore->type,
+ ptr_ignore->channel_name,
+ ptr_ignore->server_name);
+ }
+
/* server section */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index b760a8857..27119cc0b 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -35,8 +35,9 @@
#define CONFIG_SECTION_PROXY 6
#define CONFIG_SECTION_KEYS 7
#define CONFIG_SECTION_ALIAS 8
-#define CONFIG_SECTION_SERVER 9
-#define CONFIG_NUMBER_SECTIONS 10
+#define CONFIG_SECTION_IGNORE 9
+#define CONFIG_SECTION_SERVER 10
+#define CONFIG_NUMBER_SECTIONS 11
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
#define OPTION_TYPE_INT 2 /* values: from min to max */
diff --git a/src/irc/Makefile.am b/src/irc/Makefile.am
index 50bd43cc6..d916bf345 100644
--- a/src/irc/Makefile.am
+++ b/src/irc/Makefile.am
@@ -27,4 +27,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
irc-channel.c \
irc-nick.c \
irc-dcc.c \
+ irc-ignore.c \
irc-display.c
diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c
index 6aec9902f..86028f952 100644
--- a/src/irc/irc-channel.c
+++ b/src/irc/irc-channel.c
@@ -143,7 +143,10 @@ t_irc_channel *
channel_search (t_irc_server *server, char *channel_name)
{
t_irc_channel *ptr_channel;
-
+
+ if (!server || !channel_name)
+ return NULL;
+
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -162,6 +165,9 @@ string_is_channel (char *string)
{
char first_char[2];
+ if (!string)
+ return 0;
+
first_char[0] = string[0];
first_char[1] = '\0';
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index 8d745090a..c9fafd06b 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -384,8 +384,6 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "406", N_("was no such nick"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
- { "406", N_("was no such nick"),
- "", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "407", N_("was no such nick"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "409", N_("no origin"),
diff --git a/src/irc/irc-ignore.c b/src/irc/irc-ignore.c
new file mode 100644
index 000000000..bf29d0684
--- /dev/null
+++ b/src/irc/irc-ignore.c
@@ -0,0 +1,475 @@
+/*
+ * Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* irc-ignore.c: manages IRC ignore list */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "../common/weechat.h"
+#include "irc.h"
+#include "../common/command.h"
+
+
+char *ignore_types[] =
+{ IGNORE_ACTION, IGNORE_CTCP, IGNORE_DCC, IGNORE_PRIVATE, NULL };
+
+t_irc_ignore *irc_ignore = NULL;
+t_irc_ignore *last_irc_ignore = NULL;
+
+
+/*
+ * ignore_check_mask: returns 1 is mask1 and mask2 are the same host
+ * anyone or both strings may have user and/or host after
+ */
+
+int
+ignore_check_mask (char *mask1, char *mask2)
+{
+ char *m1, *m2, *pos;
+ int match;
+
+ if (!mask1 || !mask1[0] || !mask2 || !mask2[0])
+ return 0;
+
+ m1 = strdup (mask1);
+ m2 = strdup (mask2);
+
+ pos = strchr (m1, '!');
+ if (!pos)
+ {
+ /* remove '!' from m2 */
+ pos = strchr (m2, '!');
+ if (pos)
+ pos[0] = '\0';
+ }
+ pos = strchr (m2, '!');
+ if (!pos)
+ {
+ /* remove '!' from m1 */
+ pos = strchr (m1, '!');
+ if (pos)
+ pos[0] = '\0';
+ }
+
+ /* TODO: use regexp to match both masks */
+ match = ascii_strcasecmp (m1, m2);
+
+ free (m1);
+ free (m2);
+
+ return (match == 0);
+}
+
+/*
+ * ignore_match: check if pointed ignore matches with arguments
+ */
+
+int
+ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_name, char *server_name)
+{
+ /* check mask */
+ if ((strcmp (mask, "*") != 0) && (strcmp (ptr_ignore->mask, "*") != 0)
+ && (!ignore_check_mask (ptr_ignore->mask, mask)))
+ return 0;
+
+ /* mask is matching, go on with type */
+ if ((strcmp (type, "*") != 0) && (strcmp (ptr_ignore->type, "*") != 0)
+ && (ascii_strcasecmp (ptr_ignore->type, type) != 0))
+ return 0;
+
+ /* mask and type matching, go on with server */
+ if (server_name && server_name[0])
+ {
+ if ((strcmp (server_name, "*") != 0) && (strcmp (ptr_ignore->server_name, "*") != 0)
+ && (ascii_strcasecmp (ptr_ignore->server_name, server_name) != 0))
+ return 0;
+ }
+ else
+ {
+ if (strcmp (ptr_ignore->server_name, "*") != 0)
+ return 0;
+ }
+
+ /* mask, type and server matching, go on with channel */
+ if (channel_name && channel_name[0])
+ {
+ if ((strcmp (channel_name, "*") != 0) && (strcmp (ptr_ignore->channel_name, "*") != 0)
+ && (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) != 0))
+ return 0;
+ }
+ else
+ {
+ if (strcmp (ptr_ignore->channel_name, "*") != 0)
+ return 0;
+ }
+
+ /* all is matching => we find a ignore! */
+ return 1;
+}
+
+/*
+ * ignore_check: check if an ignore is set for arguments
+ * returns 1 if at least one ignore exists (message should NOT be displayed)
+ * 0 if no ignore found (message will be displayed)
+ */
+
+int
+ignore_check (char *mask, char *type, char *channel_name, char *server_name)
+{
+ t_irc_ignore *ptr_ignore;
+
+ if (!mask || !mask[0] || !type || !type[0])
+ return 0;
+
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
+ return 1;
+ }
+
+ /* no ignore found */
+ return 0;
+}
+
+/*
+ * ignore_search: search for an ignore
+ */
+
+t_irc_ignore *
+ignore_search (char *mask, char *type, char *channel_name, char *server_name)
+{
+ t_irc_ignore *ptr_ignore;
+
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ if ((ascii_strcasecmp (ptr_ignore->mask, mask) == 0)
+ && (ascii_strcasecmp (ptr_ignore->type, type) == 0)
+ && (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) == 0)
+ && (ascii_strcasecmp (ptr_ignore->server_name, server_name) == 0))
+ return ptr_ignore;
+ }
+
+ /* ignore not found */
+ return NULL;
+}
+
+/*
+ * ignore_add: add an ignore in list
+ */
+
+t_irc_ignore *
+ignore_add (char *mask, char *type, char *channel_name, char *server_name)
+{
+ int i, type_index;
+ t_irc_command *command_ptr;
+ t_irc_ignore *new_ignore;
+
+ if (!mask || !mask[0] || !type || !type[0] || !channel_name || !channel_name[0]
+ || !server_name || !server_name[0])
+ {
+ gui_printf (NULL,
+ _("%s too few arguments for ignore\n"),
+ WEECHAT_ERROR);
+ return NULL;
+ }
+
+#ifdef DEBUG
+ wee_log_printf ("Adding ignore: mask:'%s', type:'%s', channel:'%s', server:'%s'\n",
+ mask, type, channel_name, server_name);
+#endif
+
+ type_index = -1;
+ command_ptr = NULL;
+
+ if ((strcmp (mask, "*") == 0) && (strcmp (type, "*") == 0))
+ {
+ irc_display_prefix (NULL, PREFIX_ERROR);
+ gui_printf (NULL,
+ _("%s mask or type/command should be non generic value for ignore\n"),
+ WEECHAT_ERROR);
+ return NULL;
+ }
+
+ if (ignore_search (mask, type, channel_name, server_name))
+ {
+ irc_display_prefix (NULL, PREFIX_ERROR);
+ gui_printf (NULL,
+ _("%s ignore already exists\n"),
+ WEECHAT_ERROR);
+ return NULL;
+ }
+
+ if (strcmp (type, "*") != 0)
+ {
+ /* look for type in pre-defined ignore types */
+ for (i = 0; ignore_types[i]; i++)
+ {
+ if (ascii_strcasecmp (type, ignore_types[i]) == 0)
+ {
+ type_index = i;
+ break;
+ }
+ }
+
+ /* not a pre-defined ignore type, so it MUST be an IRC command */
+ if (type_index < 0)
+ {
+ for (i = 0; irc_commands[i].command_name; i++)
+ {
+ if (irc_commands[i].recv_function &&
+ (ascii_strcasecmp (type, irc_commands[i].command_name) == 0))
+ {
+ command_ptr = &irc_commands[i];
+ break;
+ }
+ }
+ }
+
+ /* not a pre-defined command and not an IRC command => error */
+ if ((type_index < 0) && (!command_ptr))
+ {
+ irc_display_prefix (NULL, PREFIX_ERROR);
+ gui_printf (NULL,
+ _("%s unknown type or IRC command \"%s\" for ignore\n"),
+ WEECHAT_ERROR, type);
+ return NULL;
+ }
+ }
+
+ /* create new ignore */
+ new_ignore = (t_irc_ignore *) malloc (sizeof (t_irc_ignore));
+ if (new_ignore)
+ {
+ new_ignore->mask = strdup (mask);
+ new_ignore->type = strdup (type);
+ new_ignore->server_name = strdup (server_name);
+ new_ignore->channel_name = strdup (channel_name);
+
+ /* add new ignore to queue */
+ new_ignore->prev_ignore = last_irc_ignore;
+ new_ignore->next_ignore = NULL;
+ if (irc_ignore)
+ last_irc_ignore->next_ignore = new_ignore;
+ else
+ irc_ignore = new_ignore;
+ last_irc_ignore = new_ignore;
+ }
+ else
+ {
+ irc_display_prefix (NULL, PREFIX_ERROR);
+ gui_printf (NULL,
+ _("%s not enough memory to create ignore\n"),
+ WEECHAT_ERROR);
+ return NULL;
+ }
+
+ return new_ignore;
+}
+
+/*
+ * ignore_add_from_config: add an ignore to list, read from config file
+ * (comma serparated values)
+ */
+
+t_irc_ignore *
+ignore_add_from_config (char *string)
+{
+ t_irc_ignore *new_ignore;
+ char *string2;
+ char *pos_mask, *pos_type, *pos_channel, *pos_server;
+
+ if (!string || !string[0])
+ return NULL;
+
+ new_ignore = NULL;
+ string2 = strdup (string);
+
+ pos_mask = string2;
+ pos_type = strchr (pos_mask, ',');
+ if (pos_type)
+ {
+ pos_type[0] = '\0';
+ pos_type++;
+ pos_channel = strchr (pos_type, ',');
+ if (pos_channel)
+ {
+ pos_channel[0] = '\0';
+ pos_channel++;
+ pos_server = strchr (pos_channel, ',');
+ if (pos_server)
+ {
+ pos_server[0] = '\0';
+ pos_server++;
+ new_ignore = ignore_add (pos_mask, pos_type, pos_channel, pos_server);
+ }
+ }
+ }
+
+ free (string2);
+ return new_ignore;
+}
+
+/*
+ * ignore_free: free an ignore
+ */
+
+void
+ignore_free (t_irc_ignore *ptr_ignore)
+{
+ t_irc_ignore *new_irc_ignore;
+
+ /* free data */
+ if (ptr_ignore->mask)
+ free (ptr_ignore->mask);
+ if (ptr_ignore->type)
+ free (ptr_ignore->type);
+ if (ptr_ignore->channel_name)
+ free (ptr_ignore->channel_name);
+ if (ptr_ignore->server_name)
+ free (ptr_ignore->server_name);
+
+ /* remove ignore from queue */
+ if (last_irc_ignore == ptr_ignore)
+ last_irc_ignore = ptr_ignore->prev_ignore;
+ if (ptr_ignore->prev_ignore)
+ {
+ (ptr_ignore->prev_ignore)->next_ignore = ptr_ignore->next_ignore;
+ new_irc_ignore = irc_ignore;
+ }
+ else
+ new_irc_ignore = ptr_ignore->next_ignore;
+
+ if (ptr_ignore->next_ignore)
+ (ptr_ignore->next_ignore)->prev_ignore = ptr_ignore->prev_ignore;
+
+ free (ptr_ignore);
+ irc_ignore = new_irc_ignore;
+}
+
+/*
+ * ignore_free_all: free all ignores
+ */
+
+void
+ignore_free_all ()
+{
+ while (irc_ignore)
+ ignore_free (irc_ignore);
+}
+
+/*
+ * ignore_search_free: search and free ignore(s)
+ * return: number of ignore found and deleted
+ * 0 if no ignore found
+ */
+
+int
+ignore_search_free (char *mask, char *type, char *channel_name, char *server_name)
+{
+ int found;
+ t_irc_ignore *ptr_ignore, *next_ignore;
+
+ found = 0;
+ ptr_ignore = irc_ignore;
+ while (ptr_ignore)
+ {
+ if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
+ {
+ found++;
+ if (found == 1)
+ gui_printf (NULL, "\n");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
+ next_ignore = ptr_ignore->next_ignore;
+ ignore_free (ptr_ignore);
+ ptr_ignore = next_ignore;
+ }
+ else
+ ptr_ignore = ptr_ignore->next_ignore;
+ }
+
+ return found;
+}
+
+/*
+ * ignore_search_free_by_number: search and free ignore(s) by number
+ * return: 1 if ignore found and deleted
+ * 0 if ignore not found
+ */
+
+int
+ignore_search_free_by_number (int number)
+{
+ int i;
+ t_irc_ignore *ptr_ignore;
+
+ if (number < 1)
+ return 0;
+
+ i = 0;
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ i++;
+ if (i == number)
+ {
+ gui_printf (NULL, "\n");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
+ ignore_free (ptr_ignore);
+ return 1;
+ }
+ }
+
+ /* ignore number not found */
+ return 0;
+}
+
+/*
+ * ignore_print_log: print ignore list in log (usually for crash dump)
+ */
+
+void
+ignore_print_log ()
+{
+ t_irc_ignore *ptr_ignore;
+
+ wee_log_printf ("[ignore list]\n");
+
+ for (ptr_ignore = irc_ignore; ptr_ignore;
+ ptr_ignore = ptr_ignore->next_ignore)
+ {
+ wee_log_printf ("\n");
+ wee_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
+ wee_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
+ wee_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
+ wee_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
+ wee_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
+ wee_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
+ wee_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
+ }
+}
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c
index 37d4aaf6c..9d20d4ca8 100644
--- a/src/irc/irc-nick.c
+++ b/src/irc/irc-nick.c
@@ -314,7 +314,10 @@ t_irc_nick *
nick_search (t_irc_channel *channel, char *nickname)
{
t_irc_nick *ptr_nick;
-
+
+ if (!nickname)
+ return NULL;
+
for (ptr_nick = channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index eecefc12d..6976881a2 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -43,6 +43,9 @@
#include "../plugins/plugins.h"
+int command_ignored;
+
+
/*
* irc_is_highlight: returns 1 if given message contains highlight (with given nick
* or at least one of string in "irc_higlight" setting
@@ -77,13 +80,15 @@ irc_is_highlight (char *message, char *nick)
pos = msg;
while (pos[0])
{
- pos[0] = tolower (pos[0]);
+ if ((pos[0] >= 'A') && (pos[0] <= 'Z'))
+ pos[0] += ('a' - 'A');
pos++;
}
pos = highlight;
while (pos[0])
{
- pos[0] = tolower (pos[0]);
+ if ((pos[0] >= 'A') && (pos[0] <= 'Z'))
+ pos[0] += ('a' - 'A');
pos++;
}
@@ -142,7 +147,8 @@ irc_recv_command (t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
{
int i, cmd_found, return_code;
-
+ char *pos, *nick;
+
if (command == NULL)
return -2;
@@ -160,11 +166,24 @@ irc_recv_command (t_irc_server *server, char *entire_line,
/* command not found */
if (cmd_found < 0)
return -3;
-
+
if (irc_commands[i].recv_function != NULL)
{
- return_code = (int) (irc_commands[i].recv_function) (server, host, arguments);
- plugin_event_msg (irc_commands[i].command_name, server->name, entire_line);
+ command_ignored = ignore_check (host, irc_commands[i].command_name, NULL, server->name);
+ if (host)
+ pos = strchr (host, '!');
+ else
+ pos = NULL;
+ if (pos)
+ pos[0] = '\0';
+ nick = (host) ? strdup (host) : NULL;
+ if (pos)
+ pos[0] = '!';
+ return_code = (int) (irc_commands[i].recv_function) (server, host, nick, arguments);
+ if (nick)
+ free (nick);
+ if (!command_ignored)
+ plugin_event_msg (irc_commands[i].command_name, server->name, entire_line);
return return_code;
}
@@ -176,7 +195,7 @@ irc_recv_command (t_irc_server *server, char *entire_line,
*/
int
-irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_error (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
int first;
@@ -186,6 +205,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
if (strncmp (arguments, "Closing Link", 12) == 0)
{
@@ -247,13 +267,9 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_invite (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_invite (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos, *pos_channel;
-
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
+ char *pos_channel;
pos_channel = strchr (arguments, ' ');
if (pos_channel)
@@ -265,15 +281,20 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *arguments)
if (pos_channel[0] == ':')
pos_channel++;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf (server->buffer, _("You have been invited to "));
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL,
- "%s ", pos_channel);
- gui_printf (server->buffer, _("by"));
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
- " %s\n", host);
- hotlist_add (HOTLIST_HIGHLIGHT, server->buffer);
- gui_draw_buffer_status (gui_current_window->buffer, 1);
+ command_ignored |= ignore_check (host, "invite", pos_channel, server->name);
+
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, _("You have been invited to "));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL,
+ "%s ", pos_channel);
+ gui_printf (server->buffer, _("by"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
+ " %s\n", nick);
+ hotlist_add (HOTLIST_HIGHLIGHT, server->buffer);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ }
}
else
{
@@ -292,11 +313,13 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments)
{
t_irc_channel *ptr_channel;
char *pos;
+ command_ignored |= ignore_check (host, "join", arguments, server->name);
+
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
@@ -311,24 +334,24 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
}
}
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
- irc_display_prefix (ptr_channel->buffer, PREFIX_JOIN);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
- "%s ", host);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- "(");
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_HOST,
- "%s", pos + 1);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- ")");
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" has joined "));
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
- "%s\n", arguments);
- (void) nick_new (ptr_channel, host, 0, 0, 0, 0, 0);
+ if (!command_ignored)
+ {
+ pos = strchr (host, '!');
+ irc_display_prefix (ptr_channel->buffer, PREFIX_JOIN);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
+ "%s ", nick);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ "(");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_HOST,
+ "%s", (pos) ? pos + 1 : "");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ ")");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ _(" has joined "));
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
+ "%s\n", arguments);
+ }
+ (void) nick_new (ptr_channel, nick, 0, 0, 0, 0, 0);
gui_draw_buffer_nick (ptr_channel->buffer, 1);
gui_draw_buffer_status (ptr_channel->buffer, 1);
return 0;
@@ -339,16 +362,12 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos, *pos_nick, *pos_comment;
+ char *pos_nick, *pos_comment;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
pos_nick = strchr (arguments, ' ');
if (pos_nick)
{
@@ -367,7 +386,9 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
if (pos_comment[0] == ':')
pos_comment++;
}
-
+
+ command_ignored |= ignore_check (host, "kick", arguments, server->name);
+
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
@@ -377,30 +398,33 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
WEECHAT_ERROR, arguments, "kick");
return -1;
}
-
- irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
- "%s", host);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" has kicked "));
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
- "%s", pos_nick);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" from "));
- if (pos_comment)
+
+ if (!command_ignored)
{
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
- "%s ", arguments);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- "(");
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", nick);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ _(" has kicked "));
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", pos_nick);
gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- "%s", pos_comment);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- ")\n");
+ _(" from "));
+ if (pos_comment)
+ {
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
+ "%s ", arguments);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ "(");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ "%s", pos_comment);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ ")\n");
+ }
+ else
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
+ "%s\n", arguments);
}
- else
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
- "%s\n", arguments);
}
else
{
@@ -437,15 +461,11 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_kill (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_kill (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos, *pos_host2, *pos_comment;
+ char *pos_host2, *pos_comment;
t_irc_channel *ptr_channel;
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
pos_host2 = strchr (arguments, ' ');
if (pos_host2)
{
@@ -468,27 +488,31 @@ irc_cmd_recv_kill (t_irc_server *server, char *host, char *arguments)
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
- irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
- "%s", host);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" has killed "));
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
- "%s", arguments);
- if (pos_comment)
+ if (!command_ignored
+ && !ignore_check (host, "kill", ptr_channel->name, server->name))
{
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", nick);
gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" from server"));
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- " (");
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- "%s", pos_comment);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
- ")\n");
+ _(" has killed "));
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", arguments);
+ if (pos_comment)
+ {
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ _(" from server"));
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ " (");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ "%s", pos_comment);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
+ ")\n");
+ }
+ else
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ _(" from server\n"));
}
- else
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _(" from server\n"));
}
}
else
@@ -817,7 +841,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
*/
int
-irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_mode (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos_parm;
t_irc_channel *ptr_channel;
@@ -832,11 +856,6 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
return -1;
}
- /* keep only nick name from host */
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
pos = strchr (arguments, ' ');
if (!pos)
{
@@ -865,7 +884,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, arguments);
if (ptr_channel)
{
- irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
+ irc_get_channel_modes (ptr_channel, arguments, nick, pos, pos_parm);
gui_draw_buffer_status (ptr_channel->buffer, 1);
}
else
@@ -880,15 +899,18 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
else
{
/* nickname modes */
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
- "%s", (pos[0] == ':') ? pos + 1 : pos);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("mode changed by"));
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s\n", host);
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", (pos[0] == ':') ? pos + 1 : pos);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("mode changed by"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s\n", nick);
+ }
}
return 0;
}
@@ -898,9 +920,8 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
int nick_is_me;
@@ -917,11 +938,6 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
return -1;
}
- /* keep only nick name from host */
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
/* change nickname in any opened private window */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
@@ -940,33 +956,37 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
- ptr_nick = nick_search (ptr_channel, host);
+ ptr_nick = nick_search (ptr_channel, nick);
if (ptr_nick)
{
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0;
if (nick_is_me)
gui_add_hotlist = 0;
nick_change (ptr_channel, ptr_nick, arguments);
- irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
- if (nick_is_me)
+ if (!command_ignored
+ && !ignore_check (host, "nick", ptr_channel->name, server->name))
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ if (nick_is_me)
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ _("You are "));
+ else
+ {
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_NICK,
+ "%s", nick);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _(" is "));
+ }
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
- _("You are "));
- else
- {
+ _("now known as "));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
- "%s", host);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _(" is "));
+ "%s\n",
+ arguments);
}
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- _("now known as "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK,
- "%s\n",
- arguments);
if (gui_buffer_has_nicklist (ptr_channel->buffer))
gui_draw_buffer_nick (ptr_channel->buffer, 1);
gui_add_hotlist = 1;
@@ -998,7 +1018,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *host2, *pos, *pos2, *pos_usec;
struct timeval tv;
@@ -1010,12 +1030,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
{
pos = strchr (host, '!');
if (pos)
- {
- pos[0] = '\0';
host2 = pos + 1;
- }
- else
- host2 = NULL;
}
pos = strchr (arguments, ' ');
@@ -1036,80 +1051,84 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
WEECHAT_ERROR, "notice");
return -1;
}
- if (strncmp (pos, "\01VERSION", 8) == 0)
- {
- pos += 9;
- pos2 = strchr (pos, '\01');
- if (pos2)
- pos2[0] = '\0';
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
- }
- else
+
+ if (!command_ignored)
{
- if (strncmp (pos, "\01PING", 5) == 0)
+ if (strncmp (pos, "\01VERSION", 8) == 0)
{
- pos += 5;
- while (pos[0] == ' ')
- pos++;
- pos_usec = strchr (pos, ' ');
- if (pos_usec)
- {
- pos_usec[0] = '\0';
- pos_usec++;
- pos2 = strchr (pos_usec, '\01');
- if (pos2)
- {
- pos2[0] = '\0';
-
- gettimeofday (&tv, &tz);
- sec1 = atol (pos);
- usec1 = atol (pos_usec);
- sec2 = tv.tv_sec;
- usec2 = tv.tv_usec;
-
- difftime = ((sec2 * 1000000) + usec2) - ((sec1 * 1000000) + usec1);
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "PING ");
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT,
- _(": %ld.%ld seconds\n"),
- difftime / 1000000,
- (difftime % 1000000) / 1000);
- }
- }
+ pos += 9;
+ pos2 = strchr (pos, '\01');
+ if (pos2)
+ pos2[0] = '\0';
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", nick);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
}
else
{
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- if (host)
+ if (strncmp (pos, "\01PING", 5) == 0)
{
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", host);
- if (host2)
+ pos += 5;
+ while (pos[0] == ' ')
+ pos++;
+ pos_usec = strchr (pos, ' ');
+ if (pos_usec)
{
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_HOST, "%s", host2);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, ")");
+ pos_usec[0] = '\0';
+ pos_usec++;
+ pos2 = strchr (pos_usec, '\01');
+ if (pos2)
+ {
+ pos2[0] = '\0';
+
+ gettimeofday (&tv, &tz);
+ sec1 = atol (pos);
+ usec1 = atol (pos_usec);
+ sec2 = tv.tv_sec;
+ usec2 = tv.tv_usec;
+
+ difftime = ((sec2 * 1000000) + usec2) - ((sec1 * 1000000) + usec1);
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "PING ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", nick);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT,
+ _(": %ld.%ld seconds\n"),
+ difftime / 1000000,
+ (difftime % 1000000) / 1000);
+ }
}
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": ");
}
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos);
- if ((host) && (ascii_strcasecmp (host, "nickserv") != 0) &&
- (ascii_strcasecmp (host, "chanserv") != 0) &&
- (ascii_strcasecmp (host, "memoserv") != 0))
+ else
{
- hotlist_add (HOTLIST_PRIVATE, server->buffer);
- gui_draw_buffer_status (gui_current_window->buffer, 1);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ if (host)
+ {
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
+ if (host2)
+ {
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, " (");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_HOST, "%s", host2);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, ")");
+ }
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": ");
+ }
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos);
+ if ((nick) && (ascii_strcasecmp (nick, "nickserv") != 0) &&
+ (ascii_strcasecmp (nick, "chanserv") != 0) &&
+ (ascii_strcasecmp (nick, "memoserv") != 0))
+ {
+ hotlist_add (HOTLIST_PRIVATE, server->buffer);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ }
}
}
}
@@ -1121,7 +1140,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos_args;
t_irc_channel *ptr_channel;
@@ -1148,15 +1167,11 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
pos_args++;
}
- /* keep only nick name from host */
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
ptr_channel = channel_search (server, arguments);
if (ptr_channel)
{
- ptr_nick = nick_search (ptr_channel, host);
+ command_ignored |= ignore_check (host, "part", ptr_channel->name, server->name);
+ ptr_nick = nick_search (ptr_channel, nick);
if (ptr_nick)
{
if (strcmp (ptr_nick->nick, server->nick) == 0)
@@ -1172,30 +1187,34 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
/* remove nick from nick list and display message */
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_HOST, "%s", pos+1);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _(" has left "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%s", ptr_channel->name);
- if (pos_args && pos_args[0])
+ if (!command_ignored)
{
+ pos = strchr (host, '!');
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, " (");
+ COLOR_WIN_CHAT_NICK, "%s ", nick);
gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, "%s", pos_args);
+ COLOR_WIN_CHAT_DARK, "(");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_HOST, "%s", (pos) ? pos + 1 : "");
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _(" has left "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%s", ptr_channel->name);
+ if (pos_args && pos_args[0])
+ {
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, " (");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, "%s", pos_args);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, ")");
+ }
+ gui_printf (ptr_channel->buffer, "\n");
}
- gui_printf (ptr_channel->buffer, "\n");
if (gui_buffer_has_nicklist (ptr_channel->buffer))
gui_draw_buffer_nick (ptr_channel->buffer, 1);
@@ -1220,11 +1239,13 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_ping (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_ping (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
- (void)host;
+ /* make gcc happy */
+ (void) host;
+ (void) nick;
pos = strrchr (arguments, ' ');
if (pos)
pos[0] = '\0';
@@ -1237,14 +1258,16 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_pong (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments)
{
struct timeval tv;
struct timezone tz;
int old_lag;
- (void)host;
- (void)arguments;
+ /* make gcc happy */
+ (void) host;
+ (void) nick;
+ (void) arguments;
if (server->lag_check_time.tv_sec != 0)
{
@@ -1268,7 +1291,7 @@ irc_cmd_recv_pong (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
@@ -1286,13 +1309,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
return -1;
}
- /* keep only nick name from host */
pos = strchr (host, '!');
if (pos)
- {
- pos[0] = '\0';
- host2 = pos+1;
- }
+ host2 = pos + 1;
else
host2 = host;
@@ -1314,51 +1333,60 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
if (strncmp (pos, "\01ACTION ", 8) == 0)
{
+ command_ignored |= ignore_check (host, "action", ptr_channel->name, server->name);
pos += 8;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
- if (irc_is_highlight (pos, server->nick))
+ if (!command_ignored)
{
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
- COLOR_WIN_CHAT_HIGHLIGHT,
- "%s", host);
- if ( (cfg_look_infobar)
- && (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != gui_current_window->buffer) )
- gui_infobar_printf (cfg_look_infobar_delay_highlight,
- COLOR_WIN_INFOBAR_HIGHLIGHT,
- _("On %s: * %s %s"),
- ptr_channel->name,
- host, pos);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
+ if (irc_is_highlight (pos, server->nick))
+ {
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
+ COLOR_WIN_CHAT_HIGHLIGHT,
+ "%s", nick);
+ if ( (cfg_look_infobar)
+ && (cfg_look_infobar_delay_highlight > 0)
+ && (ptr_channel->buffer != gui_current_window->buffer) )
+ gui_infobar_printf (cfg_look_infobar_delay_highlight,
+ COLOR_WIN_INFOBAR_HIGHLIGHT,
+ _("On %s: * %s %s"),
+ ptr_channel->name,
+ nick, pos);
+ }
+ else
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG,
+ COLOR_WIN_CHAT_NICK, "%s", nick);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, " %s\n", pos);
}
- else
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG,
- COLOR_WIN_CHAT_NICK, "%s", host);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, " %s\n", pos);
return 0;
}
if (strncmp (pos, "\01SOUND ", 7) == 0)
{
+ command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name);
pos += 7;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
- gui_printf (ptr_channel->buffer,
- _("Received a CTCP SOUND \"%s\" from "),
- pos);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK,
- "%s\n", host);
+ if (!command_ignored)
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
+ gui_printf (ptr_channel->buffer,
+ _("Received a CTCP SOUND \"%s\" from "),
+ pos);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_NICK,
+ "%s\n", nick);
+ }
return 0;
}
if (strncmp (pos, "\01PING", 5) == 0)
{
+ command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name);
pos += 5;
while (pos[0] == ' ')
pos++;
@@ -1371,10 +1399,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
- host, pos);
+ nick, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
- host);
+ nick);
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "CTCP ");
@@ -1383,7 +1411,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK, " %s\n", host);
+ COLOR_WIN_CHAT_NICK, " %s\n", nick);
return 0;
}
@@ -1391,6 +1419,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
+ command_ignored |= ignore_check (host, "ctcp", ptr_channel->name, server->name);
pos++;
pos2[0] = '\0';
pos2 = strchr (pos, ' ');
@@ -1403,47 +1432,54 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (!pos2[0])
pos2 = NULL;
}
- irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("Unknown CTCP "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("received from"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK, " %s", host);
- if (pos2)
+ if (!command_ignored)
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, ": %s\n", pos2);
- else
- gui_printf (ptr_channel->buffer, "\n");
+ COLOR_WIN_CHAT, _("Unknown CTCP "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_NICK, " %s", nick);
+ if (pos2)
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ else
+ gui_printf (ptr_channel->buffer, "\n");
+ }
return 0;
}
/* other message */
- ptr_nick = nick_search (ptr_channel, host);
- if (irc_is_highlight (pos, server->nick))
+ command_ignored |= ignore_check (host, "privmsg", ptr_channel->name, server->name);
+ if (!command_ignored)
{
- irc_display_nick (ptr_channel->buffer, ptr_nick,
- (ptr_nick) ? NULL : host,
- MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
- 1, -1, 0);
- if ( (cfg_look_infobar)
- && (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != gui_current_window->buffer) )
- gui_infobar_printf (cfg_look_infobar_delay_highlight,
- COLOR_WIN_INFOBAR_HIGHLIGHT,
- _("On %s: %s> %s"),
- ptr_channel->name,
- host, pos);
+ ptr_nick = nick_search (ptr_channel, nick);
+ if (irc_is_highlight (pos, server->nick))
+ {
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
+ (ptr_nick) ? NULL : nick,
+ MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
+ 1, -1, 0);
+ if ( (cfg_look_infobar)
+ && (cfg_look_infobar_delay_highlight > 0)
+ && (ptr_channel->buffer != gui_current_window->buffer) )
+ gui_infobar_printf (cfg_look_infobar_delay_highlight,
+ COLOR_WIN_INFOBAR_HIGHLIGHT,
+ _("On %s: %s> %s"),
+ ptr_channel->name,
+ nick, pos);
+ }
+ else
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
+ (ptr_nick) ? NULL : nick,
+ MSG_TYPE_NICK, 1, 1, 0);
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG,
+ COLOR_WIN_CHAT, "%s\n", pos);
}
- else
- irc_display_nick (ptr_channel->buffer, ptr_nick,
- (ptr_nick) ? NULL : host,
- MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG,
- COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
@@ -1457,10 +1493,6 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
pos = strchr (arguments, ' ');
if (pos)
{
@@ -1474,80 +1506,88 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* version asked by another user => answer with WeeChat version */
if (strncmp (pos, "\01VERSION", 8) == 0)
{
- pos2 = strchr (pos + 8, ' ');
- if (pos2)
- {
- while (pos2[0] == ' ')
- pos2++;
- if (pos2[0] == '\01')
- pos2 = NULL;
- else if (!pos2[0])
- pos2 = NULL;
- }
-
- buf = (struct utsname *) malloc (sizeof (struct utsname));
- if (buf && (uname (buf) == 0))
+ command_ignored |= ignore_check (host, "ctcp", NULL, server->name);
+ if (!command_ignored)
{
- server_sendf (server,
- "NOTICE %s :%sVERSION %s v%s"
- " compiled on %s, running "
- "%s %s / %s%s",
- host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
- &buf->sysname,
- &buf->release, &buf->machine, "\01\r\n");
- free (buf);
- }
- else
- server_sendf (server,
- "NOTICE %s :%sVERSION %s v%s"
- " compiled on %s%s",
- host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
- "\01\r\n");
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL, "VERSION ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("received from"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, " %s", host);
- if (pos2)
+ pos2 = strchr (pos + 8, ' ');
+ if (pos2)
+ {
+ while (pos2[0] == ' ')
+ pos2++;
+ if (pos2[0] == '\01')
+ pos2 = NULL;
+ else if (!pos2[0])
+ pos2 = NULL;
+ }
+
+ buf = (struct utsname *) malloc (sizeof (struct utsname));
+ if (buf && (uname (buf) == 0))
+ {
+ server_sendf (server,
+ "NOTICE %s :%sVERSION %s v%s"
+ " compiled on %s, running "
+ "%s %s / %s%s",
+ nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
+ &buf->sysname,
+ &buf->release, &buf->machine, "\01\r\n");
+ free (buf);
+ }
+ else
+ server_sendf (server,
+ "NOTICE %s :%sVERSION %s v%s"
+ " compiled on %s%s",
+ nick, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
+ "\01\r\n");
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, ": %s\n", pos2);
- else
- gui_printf (server->buffer, "\n");
+ COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "VERSION ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, " %s", nick);
+ if (pos2)
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ else
+ gui_printf (server->buffer, "\n");
+ }
return 0;
}
/* ping request from another user => answer */
if (strncmp (pos, "\01PING", 5) == 0)
{
- pos += 5;
- while (pos[0] == ' ')
- pos++;
- pos2 = strchr (pos, '\01');
- if (pos2)
- pos2[0] = '\0';
- else
- pos = NULL;
- if (pos && !pos[0])
- pos = NULL;
- if (pos)
- server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
- host, pos);
- else
- server_sendf (server, "NOTICE %s :\01PING\01\r\n",
- host);
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL, "PING ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("received from"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, " %s\n", host);
+ command_ignored |= ignore_check (host, "ctcp", NULL, server->name);
+ if (!command_ignored)
+ {
+ pos += 5;
+ while (pos[0] == ' ')
+ pos++;
+ pos2 = strchr (pos, '\01');
+ if (pos2)
+ pos2[0] = '\0';
+ else
+ pos = NULL;
+ if (pos && !pos[0])
+ pos = NULL;
+ if (pos)
+ server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
+ nick, pos);
+ else
+ server_sendf (server, "NOTICE %s :\01PING\01\r\n",
+ nick);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "PING ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, " %s\n", nick);
+ }
return 0;
}
@@ -1566,62 +1606,67 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
pos2[0] = '\0';
- /* DCC filename */
- pos_file = pos + 9;
- while (pos_file[0] == ' ')
- pos_file++;
-
- /* look for file size */
- pos_size = strrchr (pos_file, ' ');
- if (!pos_size)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos2 = pos_size;
- pos_size++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
+ command_ignored |= ignore_check (host, "dcc", NULL, server->name);
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
+ if (!command_ignored)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos2 = pos_port;
- pos_port++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
-
- /* look for DCC IP address */
- pos_addr = strrchr (pos_file, ' ');
- if (!pos_addr)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
+ /* DCC filename */
+ pos_file = pos + 9;
+ while (pos_file[0] == ' ')
+ pos_file++;
+
+ /* look for file size */
+ pos_size = strrchr (pos_file, ' ');
+ if (!pos_size)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_size;
+ pos_size++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_port;
+ pos_port++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ /* look for DCC IP address */
+ pos_addr = strrchr (pos_file, ' ');
+ if (!pos_addr)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_addr;
+ pos_addr++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
+ atoi (pos_port), nick, -1, pos_file, NULL,
+ strtoul (pos_size, NULL, 10));
}
- pos2 = pos_addr;
- pos_addr++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
-
- dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
- atoi (pos_port), host, -1, pos_file, NULL,
- strtoul (pos_size, NULL, 10));
return 0;
}
@@ -1640,45 +1685,50 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
pos2[0] = '\0';
- /* DCC filename */
- pos_file = pos + 11;
- while (pos_file[0] == ' ')
- pos_file++;
-
- /* look for resume start position */
- pos_start_resume = strrchr (pos_file, ' ');
- if (!pos_start_resume)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos2 = pos_start_resume;
- pos_start_resume++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
+ command_ignored |= ignore_check (host, "dcc", NULL, server->name);
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
+ if (!command_ignored)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
+ /* DCC filename */
+ pos_file = pos + 11;
+ while (pos_file[0] == ' ')
+ pos_file++;
+
+ /* look for resume start position */
+ pos_start_resume = strrchr (pos_file, ' ');
+ if (!pos_start_resume)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_start_resume;
+ pos_start_resume++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_port;
+ pos_port++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ dcc_accept_resume (server, pos_file, atoi (pos_port),
+ strtoul (pos_start_resume, NULL, 10));
}
- pos2 = pos_port;
- pos_port++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
-
- dcc_accept_resume (server, pos_file, atoi (pos_port),
- strtoul (pos_start_resume, NULL, 10));
return 0;
}
@@ -1697,45 +1747,50 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
pos2[0] = '\0';
- /* DCC filename */
- pos_file = pos + 11;
- while (pos_file[0] == ' ')
- pos_file++;
-
- /* look for resume start position */
- pos_start_resume = strrchr (pos_file, ' ');
- if (!pos_start_resume)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos2 = pos_start_resume;
- pos_start_resume++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
+ command_ignored |= ignore_check (host, "dcc", NULL, server->name);
- /* look for DCC port */
- pos_port = strrchr (pos_file, ' ');
- if (!pos_port)
+ if (!command_ignored)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
+ /* DCC filename */
+ pos_file = pos + 11;
+ while (pos_file[0] == ' ')
+ pos_file++;
+
+ /* look for resume start position */
+ pos_start_resume = strrchr (pos_file, ' ');
+ if (!pos_start_resume)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_start_resume;
+ pos_start_resume++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ /* look for DCC port */
+ pos_port = strrchr (pos_file, ' ');
+ if (!pos_port)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos2 = pos_port;
+ pos_port++;
+ while (pos2[0] == ' ')
+ pos2--;
+ pos2[1] = '\0';
+
+ dcc_start_resume (server, pos_file, atoi (pos_port),
+ strtoul (pos_start_resume, NULL, 10));
}
- pos2 = pos_port;
- pos_port++;
- while (pos2[0] == ' ')
- pos2--;
- pos2[1] = '\0';
-
- dcc_start_resume (server, pos_file, atoi (pos_port),
- strtoul (pos_start_resume, NULL, 10));
return 0;
}
@@ -1754,105 +1809,115 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
pos2[0] = '\0';
- /* CHAT type */
- pos_file = pos + 9;
- while (pos_file[0] == ' ')
- pos_file++;
+ command_ignored |= ignore_check (host, "dcc", NULL, server->name);
- /* DCC IP address */
- pos_addr = strchr (pos_file, ' ');
- if (!pos_addr)
+ if (!command_ignored)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos_addr[0] = '\0';
- pos_addr++;
- while (pos_addr[0] == ' ')
+ /* CHAT type */
+ pos_file = pos + 9;
+ while (pos_file[0] == ' ')
+ pos_file++;
+
+ /* DCC IP address */
+ pos_addr = strchr (pos_file, ' ');
+ if (!pos_addr)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos_addr[0] = '\0';
pos_addr++;
-
- /* look for DCC port */
- pos_port = strchr (pos_addr, ' ');
- if (!pos_port)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot parse \"%s\" command\n"),
- WEECHAT_ERROR, "privmsg");
- return -1;
- }
- pos_port[0] = '\0';
- pos_port++;
- while (pos_port[0] == ' ')
+ while (pos_addr[0] == ' ')
+ pos_addr++;
+
+ /* look for DCC port */
+ pos_port = strchr (pos_addr, ' ');
+ if (!pos_port)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "privmsg");
+ return -1;
+ }
+ pos_port[0] = '\0';
pos_port++;
-
- if (ascii_strcasecmp (pos_file, "chat") != 0)
- {
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s unknown DCC CHAT type received from "),
- WEECHAT_ERROR);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
- "%s", host);
- gui_printf (server->buffer, ": \"%s\"\n", pos_file);
- return -1;
+ while (pos_port[0] == ' ')
+ pos_port++;
+
+ if (ascii_strcasecmp (pos_file, "chat") != 0)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s unknown DCC CHAT type received from "),
+ WEECHAT_ERROR);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
+ "%s", nick);
+ gui_printf (server->buffer, ": \"%s\"\n", pos_file);
+ return -1;
+ }
+
+ dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
+ atoi (pos_port), nick, -1, NULL, NULL, 0);
}
-
- dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
- atoi (pos_port), host, -1, NULL, NULL, 0);
-
return 0;
}
/* private message received => display it */
- ptr_channel = channel_search (server, host);
+ ptr_channel = channel_search (server, nick);
if (strncmp (pos, "\01ACTION ", 8) == 0)
{
- if (!ptr_channel)
+ command_ignored |= ignore_check (host, "action", NULL, server->name);
+ command_ignored |= ignore_check (host, "pv", NULL, server->name);
+
+ if (!command_ignored)
{
- ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot create new private window \"%s\"\n"),
- WEECHAT_ERROR, host);
- return -1;
+ ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, nick);
+ return -1;
+ }
}
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
+ pos += 8;
+ pos2 = strchr (pos, '\01');
+ if (pos2)
+ pos2[0] = '\0';
+ irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
+ if (irc_is_highlight (pos, server->nick))
+ {
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
+ COLOR_WIN_CHAT_HIGHLIGHT,
+ "%s", nick);
+ if ( (cfg_look_infobar)
+ && (cfg_look_infobar_delay_highlight > 0)
+ && (ptr_channel->buffer != gui_current_window->buffer) )
+ gui_infobar_printf (cfg_look_infobar_delay_highlight,
+ COLOR_WIN_INFOBAR_HIGHLIGHT,
+ _("On %s: * %s %s"),
+ ptr_channel->name,
+ nick, pos);
+ }
+ else
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG,
+ COLOR_WIN_CHAT_NICK, "%s", nick);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, " %s\n", pos);
}
- if (!ptr_channel->topic)
- ptr_channel->topic = strdup (host2);
-
- pos += 8;
- pos2 = strchr (pos, '\01');
- if (pos2)
- pos2[0] = '\0';
- irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
- if (irc_is_highlight (pos, server->nick))
- {
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
- COLOR_WIN_CHAT_HIGHLIGHT,
- "%s", host);
- if ( (cfg_look_infobar)
- && (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != gui_current_window->buffer) )
- gui_infobar_printf (cfg_look_infobar_delay_highlight,
- COLOR_WIN_INFOBAR_HIGHLIGHT,
- _("On %s: * %s %s"),
- ptr_channel->name,
- host, pos);
- }
- else
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG,
- COLOR_WIN_CHAT_NICK, "%s", host);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, " %s\n", pos);
}
else
{
@@ -1860,78 +1925,88 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
- pos++;
- pos2[0] = '\0';
- pos2 = strchr (pos, ' ');
- if (pos2)
+ command_ignored |= ignore_check (host, "ctcp", NULL, server->name);
+
+ if (!command_ignored)
{
+ pos++;
pos2[0] = '\0';
- pos2++;
- while (pos2[0] == ' ')
+ pos2 = strchr (pos, ' ');
+ if (pos2)
+ {
+ pos2[0] = '\0';
pos2++;
- if (!pos2[0])
- pos2 = NULL;
- }
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("Unknown CTCP "));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("received from"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, " %s", host);
- if (pos2)
+ while (pos2[0] == ' ')
+ pos2++;
+ if (!pos2[0])
+ pos2 = NULL;
+ }
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, ": %s\n", pos2);
- else
- gui_printf (server->buffer, "\n");
+ COLOR_WIN_CHAT, _("Unknown CTCP "));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("received from"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, " %s", nick);
+ if (pos2)
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ else
+ gui_printf (server->buffer, "\n");
+ }
return 0;
}
else
{
- if (!ptr_channel)
+ command_ignored |= ignore_check (host, "pv", NULL, server->name);
+
+ if (!command_ignored)
{
- ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- gui_printf_nolog (server->buffer,
- _("%s cannot create new private window \"%s\"\n"),
- WEECHAT_ERROR, host);
- return -1;
+ ptr_channel = channel_new (server, CHAT_PRIVATE, nick, 0);
+ if (!ptr_channel)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot create new private window \"%s\"\n"),
+ WEECHAT_ERROR, nick);
+ return -1;
+ }
}
- }
- if (!ptr_channel->topic)
- ptr_channel->topic = strdup (host2);
-
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_NICK,
- COLOR_WIN_CHAT_DARK, "<");
- if (irc_is_highlight (pos, server->nick))
- {
+ if (!ptr_channel->topic)
+ ptr_channel->topic = strdup (host2);
+
gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
- COLOR_WIN_CHAT_HIGHLIGHT,
- "%s", host);
- if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->buffer != gui_current_window->buffer) )
- gui_infobar_printf (cfg_look_infobar_delay_highlight,
- COLOR_WIN_INFOBAR_HIGHLIGHT,
- _("Private %s> %s"),
- host, pos);
- }
- else
+ MSG_TYPE_NICK,
+ COLOR_WIN_CHAT_DARK, "<");
+ if (irc_is_highlight (pos, server->nick))
+ {
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
+ COLOR_WIN_CHAT_HIGHLIGHT,
+ "%s", nick);
+ if ( (cfg_look_infobar_delay_highlight > 0)
+ && (ptr_channel->buffer != gui_current_window->buffer) )
+ gui_infobar_printf (cfg_look_infobar_delay_highlight,
+ COLOR_WIN_INFOBAR_HIGHLIGHT,
+ _("Private %s> %s"),
+ nick, pos);
+ }
+ else
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_NICK,
+ COLOR_WIN_NICK_PRIVATE,
+ "%s", nick);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
- COLOR_WIN_NICK_PRIVATE,
- "%s", host);
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_NICK,
- COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_type_color (ptr_channel->buffer,
- MSG_TYPE_MSG,
- COLOR_WIN_CHAT, "%s\n", pos);
+ COLOR_WIN_CHAT_DARK, "> ");
+ gui_printf_type_color (ptr_channel->buffer,
+ MSG_TYPE_MSG,
+ COLOR_WIN_CHAT, "%s\n", pos);
+ }
}
}
}
@@ -1952,7 +2027,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
@@ -1968,41 +2043,41 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
return -1;
}
- /* keep only nick name from host */
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
-
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == CHAT_PRIVATE)
ptr_nick = NULL;
else
- ptr_nick = nick_search (ptr_channel, host);
+ ptr_nick = nick_search (ptr_channel, nick);
- if (ptr_nick || (strcmp (ptr_channel->name, host) == 0))
+ if (ptr_nick || (strcmp (ptr_channel->name, nick) == 0))
{
if (ptr_nick)
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->buffer, PREFIX_QUIT);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_HOST, "%s", pos + 1);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, ") ");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("has quit"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, "%s",
- arguments);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, ")\n");
+ if (!command_ignored
+ && !ignore_check (host, "quit", ptr_channel->name, server->name))
+ {
+ pos = strchr (host, '!');
+ irc_display_prefix (ptr_channel->buffer, PREFIX_QUIT);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_NICK, "%s ", nick);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, "(");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_HOST, "%s", (pos) ? pos + 1 : "");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, ") ");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("has quit"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, " (");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, "%s",
+ arguments);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, ")\n");
+ }
if (gui_buffer_has_nicklist (ptr_channel->buffer))
gui_draw_buffer_nick (ptr_channel->buffer, 1);
gui_draw_buffer_status (ptr_channel->buffer, 1);
@@ -2017,10 +2092,11 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *nick, char *arguments)
{
/* make gcc happy */
(void) host;
+ (void) nick;
/* skip nickname if at beginning of server message */
if (strncmp (server->nick, arguments, strlen (server->nick)) == 0)
@@ -2034,8 +2110,11 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *arguments)
arguments++;
/* display server message */
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", arguments);
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", arguments);
+ }
return 0;
}
@@ -2044,7 +2123,7 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
int first;
@@ -2052,42 +2131,46 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- if (pos)
+ if (!command_ignored)
{
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
- pos++;
- }
- else
- pos = arguments;
-
- irc_display_prefix (server->buffer, PREFIX_ERROR);
- first = 1;
-
- while (pos && pos[0])
- {
- pos2 = strchr (pos, ' ');
- if ((pos[0] == ':') || (!pos2))
+ pos = strchr (arguments, ' ');
+ if (pos)
{
- if (pos[0] == ':')
+ pos[0] = '\0';
+ pos++;
+ while (pos[0] == ' ')
pos++;
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- "%s%s\n", (first) ? "" : ": ", pos);
- pos = NULL;
}
else
+ pos = arguments;
+
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ first = 1;
+
+ while (pos && pos[0])
{
- pos2[0] = '\0';
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%s%s\n",
- (first) ? "" : " ", pos);
- first = 0;
- pos = pos2 + 1;
+ pos2 = strchr (pos, ' ');
+ if ((pos[0] == ':') || (!pos2))
+ {
+ if (pos[0] == ':')
+ pos++;
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ "%s%s\n", (first) ? "" : ": ", pos);
+ pos = NULL;
+ }
+ else
+ {
+ pos2[0] = '\0';
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%s%s\n",
+ (first) ? "" : " ", pos);
+ first = 0;
+ pos = pos2 + 1;
+ }
}
}
return 0;
@@ -2098,19 +2181,14 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_topic (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
t_gui_buffer *buffer;
/* make gcc happy */
- (void) host;
-
- /* keep only nick name from host */
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
+ (void) nick;
if (!string_is_channel (arguments))
{
@@ -2134,31 +2212,36 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
pos = NULL;
}
+ command_ignored |= ignore_check (host, "topic", arguments, server->name);
+
ptr_channel = channel_search (server, arguments);
buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
- irc_display_prefix (buffer, PREFIX_INFO);
- gui_printf_color (buffer,
- COLOR_WIN_CHAT_NICK, "%s",
- host);
- if (pos)
- {
- gui_printf_color (buffer,
- COLOR_WIN_CHAT, _(" has changed topic for "));
- gui_printf_color (buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s",
- arguments);
- gui_printf_color (buffer,
- COLOR_WIN_CHAT, _(" to: \"%s\"\n"),
- pos);
- }
- else
+ if (!command_ignored)
{
+ irc_display_prefix (buffer, PREFIX_INFO);
gui_printf_color (buffer,
- COLOR_WIN_CHAT, _(" has unset topic for "));
- gui_printf_color (buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s\n",
- arguments);
+ COLOR_WIN_CHAT_NICK, "%s",
+ host);
+ if (pos)
+ {
+ gui_printf_color (buffer,
+ COLOR_WIN_CHAT, _(" has changed topic for "));
+ gui_printf_color (buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s",
+ arguments);
+ gui_printf_color (buffer,
+ COLOR_WIN_CHAT, _(" to: \"%s\"\n"),
+ pos);
+ }
+ else
+ {
+ gui_printf_color (buffer,
+ COLOR_WIN_CHAT, _(" has unset topic for "));
+ gui_printf_color (buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s\n",
+ arguments);
+ }
}
if (ptr_channel)
@@ -2180,14 +2263,11 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
- /* make gcc happy */
- (void) host;
-
pos = strchr (arguments, ' ');
if (pos)
pos[0] = '\0';
@@ -2197,7 +2277,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
server->nick = strdup (arguments);
}
- irc_cmd_recv_server_msg (server, host, arguments);
+ irc_cmd_recv_server_msg (server, host, nick, arguments);
/* connection to IRC server is ok! */
server->is_connected = 1;
@@ -2246,13 +2326,14 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_301 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_message;
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
pos_nick = strchr (arguments, ' ');
if (pos_nick)
@@ -2269,11 +2350,14 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT, _(" is away: %s\n"), pos_message);
+ if (!command_ignored)
+ {
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (gui_current_window->buffer,
+ COLOR_WIN_CHAT, _(" is away: %s\n"), pos_message);
+ }
}
}
return 0;
@@ -2284,50 +2368,54 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_302 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_302 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_host, *ptr_next;
/* make gcc happy */
(void) host;
+ (void) nick;
- arguments = strchr (arguments, ' ');
- if (arguments)
+ if (!command_ignored)
{
- while (arguments[0] == ' ')
- arguments++;
- if (arguments[0] == ':')
- arguments++;
- while (arguments)
+ arguments = strchr (arguments, ' ');
+ if (arguments)
{
- pos_host = strchr (arguments, '=');
- if (pos_host)
+ while (arguments[0] == ' ')
+ arguments++;
+ if (arguments[0] == ':')
+ arguments++;
+ while (arguments)
{
- pos_host[0] = '\0';
- pos_host++;
-
- ptr_next = strchr (pos_host, ' ');
- if (ptr_next)
+ pos_host = strchr (arguments, '=');
+ if (pos_host)
{
- ptr_next[0] = '\0';
- ptr_next++;
- while (ptr_next[0] == ' ')
+ pos_host[0] = '\0';
+ pos_host++;
+
+ ptr_next = strchr (pos_host, ' ');
+ if (ptr_next)
+ {
+ ptr_next[0] = '\0';
ptr_next++;
+ while (ptr_next[0] == ' ')
+ ptr_next++;
+ }
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", arguments);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "=");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_HOST, "%s\n", pos_host);
}
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", arguments);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "=");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_HOST, "%s\n", pos_host);
+ else
+ ptr_next = NULL;
+ arguments = ptr_next;
+ if (arguments && !arguments[0])
+ arguments = NULL;
}
- else
- ptr_next = NULL;
- arguments = ptr_next;
- if (arguments && !arguments[0])
- arguments = NULL;
}
}
return 0;
@@ -2338,42 +2426,46 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_303 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *ptr_next;
/* make gcc happy */
(void) host;
+ (void) nick;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("Users online: "));
-
- arguments = strchr (arguments, ' ');
- if (arguments)
+ if (!command_ignored)
{
- while (arguments[0] == ' ')
- arguments++;
- if (arguments[0] == ':')
- arguments++;
- while (arguments)
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("Users online: "));
+
+ arguments = strchr (arguments, ' ');
+ if (arguments)
{
- ptr_next = strchr (arguments, ' ');
- if (ptr_next)
+ while (arguments[0] == ' ')
+ arguments++;
+ if (arguments[0] == ':')
+ arguments++;
+ while (arguments)
{
- ptr_next[0] = '\0';
- ptr_next++;
- while (ptr_next[0] == ' ')
+ ptr_next = strchr (arguments, ' ');
+ if (ptr_next)
+ {
+ ptr_next[0] = '\0';
ptr_next++;
+ while (ptr_next[0] == ' ')
+ ptr_next++;
+ }
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s ", arguments);
+ arguments = ptr_next;
+ if (arguments && !arguments[0])
+ arguments = NULL;
}
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s ", arguments);
- arguments = ptr_next;
- if (arguments && !arguments[0])
- arguments = NULL;
}
+ gui_printf (server->buffer, "\n");
}
- gui_printf (server->buffer, "\n");
return 0;
}
@@ -2382,21 +2474,25 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_305 (t_irc_server *server, char *host, char *nick, char *arguments)
{
/* make gcc happy */
(void) host;
+ (void) nick;
- arguments = strchr (arguments, ' ');
- if (arguments)
+ if (!command_ignored)
{
- while (arguments[0] == ' ')
- arguments++;
- if (arguments[0] == ':')
- arguments++;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", arguments);
+ arguments = strchr (arguments, ' ');
+ if (arguments)
+ {
+ while (arguments[0] == ' ')
+ arguments++;
+ if (arguments[0] == ':')
+ arguments++;
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", arguments);
+ }
}
server->is_away = 0;
server->away_time = 0;
@@ -2408,21 +2504,25 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_306 (t_irc_server *server, char *host, char *nick, char *arguments)
{
/* make gcc happy */
(void) host;
+ (void) nick;
- arguments = strchr (arguments, ' ');
- if (arguments)
+ if (!command_ignored)
{
- while (arguments[0] == ' ')
- arguments++;
- if (arguments[0] == ':')
- arguments++;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", arguments);
+ arguments = strchr (arguments, ' ');
+ if (arguments)
+ {
+ while (arguments[0] == ' ')
+ arguments++;
+ if (arguments[0] == ':')
+ arguments++;
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", arguments);
+ }
}
server->is_away = 1;
server->away_time = time (NULL);
@@ -2434,38 +2534,42 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_307 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_307 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_msg;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_msg = strchr (pos_nick, ' ');
- if (pos_msg)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_msg[0] = '\0';
- pos_msg++;
- while (pos_msg[0] == ' ')
- pos_msg++;
- if (pos_msg[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_msg = strchr (pos_nick, ' ');
+ if (pos_msg)
+ {
+ pos_msg[0] = '\0';
pos_msg++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n",
- pos_msg);
+ while (pos_msg[0] == ' ')
+ pos_msg++;
+ if (pos_msg[0] == ':')
+ pos_msg++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n",
+ pos_msg);
+ }
}
}
return 0;
@@ -2476,60 +2580,64 @@ irc_cmd_recv_307 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_311 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_311 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_user, *pos_host, *pos_realname;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_user = strchr (pos_nick, ' ');
- if (pos_user)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_user[0] = '\0';
- pos_user++;
- while (pos_user[0] == ' ')
- pos_user++;
- pos_host = strchr (pos_user, ' ');
- if (pos_host)
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_user = strchr (pos_nick, ' ');
+ if (pos_user)
{
- pos_host[0] = '\0';
- pos_host++;
- while (pos_host[0] == ' ')
- pos_host++;
- pos_realname = strchr (pos_host, ' ');
- if (pos_realname)
+ pos_user[0] = '\0';
+ pos_user++;
+ while (pos_user[0] == ' ')
+ pos_user++;
+ pos_host = strchr (pos_user, ' ');
+ if (pos_host)
{
- pos_realname[0] = '\0';
- pos_realname++;
- while (pos_realname[0] == ' ')
- pos_realname++;
- if (pos_realname[0] == '*')
- pos_realname++;
- while (pos_realname[0] == ' ')
- pos_realname++;
- if (pos_realname[0] == ':')
+ pos_host[0] = '\0';
+ pos_host++;
+ while (pos_host[0] == ' ')
+ pos_host++;
+ pos_realname = strchr (pos_host, ' ');
+ if (pos_realname)
+ {
+ pos_realname[0] = '\0';
pos_realname++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] (");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_HOST, "%s@%s",
- pos_user, pos_host);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, ": %s\n", pos_realname);
+ while (pos_realname[0] == ' ')
+ pos_realname++;
+ if (pos_realname[0] == '*')
+ pos_realname++;
+ while (pos_realname[0] == ' ')
+ pos_realname++;
+ if (pos_realname[0] == ':')
+ pos_realname++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] (");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_HOST, "%s@%s",
+ pos_user, pos_host);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, ")");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos_realname);
+ }
}
}
}
@@ -2542,50 +2650,54 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_312 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_312 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_server, *pos_serverinfo;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_server = strchr (pos_nick, ' ');
- if (pos_server)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_server[0] = '\0';
- pos_server++;
- while (pos_server[0] == ' ')
- pos_server++;
- pos_serverinfo = strchr (pos_server, ' ');
- if (pos_serverinfo)
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_server = strchr (pos_nick, ' ');
+ if (pos_server)
{
- pos_serverinfo[0] = '\0';
- pos_serverinfo++;
- while (pos_serverinfo[0] == ' ')
+ pos_server[0] = '\0';
+ pos_server++;
+ while (pos_server[0] == ' ')
+ pos_server++;
+ pos_serverinfo = strchr (pos_server, ' ');
+ if (pos_serverinfo)
+ {
+ pos_serverinfo[0] = '\0';
pos_serverinfo++;
- if (pos_serverinfo[0] == ':')
+ while (pos_serverinfo[0] == ' ')
pos_serverinfo++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s ", pos_server);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s", pos_serverinfo);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, ")\n");
+ if (pos_serverinfo[0] == ':')
+ pos_serverinfo++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s ", pos_server);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "(");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s", pos_serverinfo);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, ")\n");
+ }
}
}
}
@@ -2597,37 +2709,41 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_313 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_313 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_message;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_message = strchr (pos_nick, ' ');
- if (pos_message)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_message[0] = '\0';
- pos_message++;
- while (pos_message[0] == ' ')
- pos_message++;
- if (pos_message[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_message = strchr (pos_nick, ' ');
+ if (pos_message)
+ {
+ pos_message[0] = '\0';
pos_message++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", pos_message);
+ while (pos_message[0] == ' ')
+ pos_message++;
+ if (pos_message[0] == ':')
+ pos_message++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", pos_message);
+ }
}
}
return 0;
@@ -2638,62 +2754,66 @@ irc_cmd_recv_313 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_314 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_user, *pos_host, *pos_realname;
/* make gcc happy */
(void) host;
-
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ (void) nick;
+
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_user = strchr (pos_nick, ' ');
- if (pos_user)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_user[0] = '\0';
- pos_user++;
- while (pos_user[0] == ' ')
- pos_user++;
- pos_host = strchr (pos_user, ' ');
- if (pos_host)
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_user = strchr (pos_nick, ' ');
+ if (pos_user)
{
- pos_host[0] = '\0';
- pos_host++;
- while (pos_host[0] == ' ')
- pos_host++;
- pos_realname = strchr (pos_host, ' ');
- if (pos_realname)
+ pos_user[0] = '\0';
+ pos_user++;
+ while (pos_user[0] == ' ')
+ pos_user++;
+ pos_host = strchr (pos_user, ' ');
+ if (pos_host)
{
- pos_realname[0] = '\0';
- pos_realname++;
- while (pos_realname[0] == ' ')
- pos_realname++;
- pos_realname = strchr (pos_realname, ' ');
+ pos_host[0] = '\0';
+ pos_host++;
+ while (pos_host[0] == ' ')
+ pos_host++;
+ pos_realname = strchr (pos_host, ' ');
if (pos_realname)
{
pos_realname[0] = '\0';
pos_realname++;
while (pos_realname[0] == ' ')
pos_realname++;
- if (pos_realname[0] == ':')
+ pos_realname = strchr (pos_realname, ' ');
+ if (pos_realname)
+ {
+ pos_realname[0] = '\0';
pos_realname++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_HOST,
- "%s@%s", pos_user, pos_host);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- " was %s\n", pos_realname);
+ while (pos_realname[0] == ' ')
+ pos_realname++;
+ if (pos_realname[0] == ':')
+ pos_realname++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, " (");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_HOST,
+ "%s@%s", pos_user, pos_host);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, ")");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ " was %s\n", pos_realname);
+ }
}
}
}
@@ -2707,13 +2827,14 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_315 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_315 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
/* make gcc happy */
(void) host;
+ (void) nick;
/* skip nickname if at beginning of server message */
if (strncmp (server->nick, arguments, strlen (server->nick)) == 0)
@@ -2734,11 +2855,17 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *arguments)
ptr_channel->checking_away--;
return 0;
}
- gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", arguments);
- gui_printf (server->buffer, " %s\n", pos);
+ if (!command_ignored)
+ {
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", arguments);
+ gui_printf (server->buffer, " %s\n", pos);
+ }
}
else
- gui_printf (server->buffer, "%s\n", arguments);
+ {
+ if (!command_ignored)
+ gui_printf (server->buffer, "%s\n", arguments);
+ }
return 0;
}
@@ -2747,7 +2874,7 @@ irc_cmd_recv_315 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_317 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_317 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_idle, *pos_signon, *pos_message;
int idle_time, day, hour, min, sec;
@@ -2755,85 +2882,89 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_idle = strchr (pos_nick, ' ');
- if (pos_idle)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_idle[0] = '\0';
- pos_idle++;
- while (pos_idle[0] == ' ')
- pos_idle++;
- pos_signon = strchr (pos_idle, ' ');
- if (pos_signon)
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_idle = strchr (pos_nick, ' ');
+ if (pos_idle)
{
- pos_signon[0] = '\0';
- pos_signon++;
- while (pos_signon[0] == ' ')
- pos_signon++;
- pos_message = strchr (pos_signon, ' ');
- if (pos_message)
+ pos_idle[0] = '\0';
+ pos_idle++;
+ while (pos_idle[0] == ' ')
+ pos_idle++;
+ pos_signon = strchr (pos_idle, ' ');
+ if (pos_signon)
{
- pos_message[0] = '\0';
+ pos_signon[0] = '\0';
+ pos_signon++;
+ while (pos_signon[0] == ' ')
+ pos_signon++;
+ pos_message = strchr (pos_signon, ' ');
+ if (pos_message)
+ {
+ pos_message[0] = '\0';
- idle_time = atoi (pos_idle);
- day = idle_time / (60 * 60 * 24);
- hour = (idle_time % (60 * 60 * 24)) / (60 * 60);
- min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
- sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
+ idle_time = atoi (pos_idle);
+ day = idle_time / (60 * 60 * 24);
+ hour = (idle_time % (60 * 60 * 24)) / (60 * 60);
+ min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
+ sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("idle: "));
- if (day > 0)
- {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("idle: "));
+ if (day > 0)
+ {
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%d ", day);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ (day > 1) ? _("days") : _("day"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ ", ");
+ }
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
- "%d ", day);
+ "%02d ", hour);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
- (day > 1) ? _("days") : _("day"));
+ (hour > 1) ? _("hours") : _("hour"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ " %02d ", min);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ (min > 1) ? _("minutes") : _("minute"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ " %02d ", sec);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ (sec > 1) ? _("seconds") : _("second"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
", ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("signon at: "));
+ datetime = (time_t)(atol (pos_signon));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%s", ctime (&datetime));
}
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%02d ", hour);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- (hour > 1) ? _("hours") : _("hour"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- " %02d ", min);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- (min > 1) ? _("minutes") : _("minute"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- " %02d ", sec);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- (sec > 1) ? _("seconds") : _("second"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- ", ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("signon at: "));
- datetime = (time_t)(atol (pos_signon));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%s", ctime (&datetime));
}
}
}
@@ -2846,37 +2977,41 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_318 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_318 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_message;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_message = strchr (pos_nick, ' ');
- if (pos_message)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_message[0] = '\0';
- pos_message++;
- while (pos_message[0] == ' ')
- pos_message++;
- if (pos_message[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_message = strchr (pos_nick, ' ');
+ if (pos_message)
+ {
+ pos_message[0] = '\0';
pos_message++;
+ while (pos_message[0] == ' ')
+ pos_message++;
+ if (pos_message[0] == ':')
+ pos_message++;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", pos_message);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", pos_message);
+ }
}
}
return 0;
@@ -2887,76 +3022,80 @@ irc_cmd_recv_318 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_319 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_channel, *pos;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_channel = strchr (pos_nick, ' ');
- if (pos_channel)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_channel[0] = '\0';
- pos_channel++;
- while (pos_channel[0] == ' ')
- pos_channel++;
- if (pos_channel[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_channel = strchr (pos_nick, ' ');
+ if (pos_channel)
+ {
+ pos_channel[0] = '\0';
pos_channel++;
+ while (pos_channel[0] == ' ')
+ pos_channel++;
+ if (pos_channel[0] == ':')
+ pos_channel++;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, _("Channels: "));
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, _("Channels: "));
- while (pos_channel && pos_channel[0])
- {
- if (pos_channel[0] == '@')
+ while (pos_channel && pos_channel[0])
{
- gui_printf_color (server->buffer,
- COLOR_WIN_NICK_OP, "@");
- pos_channel++;
- }
- else
- {
- if (pos_channel[0] == '%')
+ if (pos_channel[0] == '@')
{
gui_printf_color (server->buffer,
- COLOR_WIN_NICK_HALFOP, "%");
+ COLOR_WIN_NICK_OP, "@");
pos_channel++;
}
else
- if (pos_channel[0] == '+')
+ {
+ if (pos_channel[0] == '%')
{
gui_printf_color (server->buffer,
- COLOR_WIN_NICK_VOICE, "+");
+ COLOR_WIN_NICK_HALFOP, "%");
pos_channel++;
}
- }
- pos = strchr (pos_channel, ' ');
- if (pos)
- {
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
+ else
+ if (pos_channel[0] == '+')
+ {
+ gui_printf_color (server->buffer,
+ COLOR_WIN_NICK_VOICE, "+");
+ pos_channel++;
+ }
+ }
+ pos = strchr (pos_channel, ' ');
+ if (pos)
+ {
+ pos[0] = '\0';
pos++;
+ while (pos[0] == ' ')
+ pos++;
+ }
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%s%s",
+ pos_channel,
+ (pos && pos[0]) ? " " : "\n");
+ pos_channel = pos;
}
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%s%s",
- pos_channel,
- (pos && pos[0]) ? " " : "\n");
- pos_channel = pos;
}
}
}
@@ -2968,37 +3107,41 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_320 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_320 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_message;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_message = strchr (pos_nick, ' ');
- if (pos_message)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_message[0] = '\0';
- pos_message++;
- while (pos_message[0] == ' ')
- pos_message++;
- if (pos_message[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_message = strchr (pos_nick, ' ');
+ if (pos_message)
+ {
+ pos_message[0] = '\0';
pos_message++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", pos_message);
+ while (pos_message[0] == ' ')
+ pos_message++;
+ if (pos_message[0] == ':')
+ pos_message++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", pos_message);
+ }
}
}
return 0;
@@ -3009,26 +3152,30 @@ irc_cmd_recv_320 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_321 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_321 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- if (pos)
+ if (!command_ignored)
{
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
+ pos = strchr (arguments, ' ');
+ if (pos)
+ {
+ pos[0] = '\0';
pos++;
- }
- else
- pos = arguments;
+ while (pos[0] == ' ')
+ pos++;
+ }
+ else
+ pos = arguments;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf (server->buffer, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
+ }
return 0;
}
@@ -3037,26 +3184,30 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_322 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_322 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- if (pos)
+ if (!command_ignored)
{
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
+ pos = strchr (arguments, ' ');
+ if (pos)
+ {
+ pos[0] = '\0';
pos++;
- }
- else
- pos = arguments;
+ while (pos[0] == ' ')
+ pos++;
+ }
+ else
+ pos = arguments;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf (server->buffer, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
+ }
return 0;
}
@@ -3065,26 +3216,30 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_323 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- if (pos)
+ if (!command_ignored)
{
- pos[0] = '\0';
- pos++;
- while (pos[0] == ' ')
+ pos = strchr (arguments, ' ');
+ if (pos)
+ {
+ pos[0] = '\0';
pos++;
- }
- else
- pos = arguments;
+ while (pos[0] == ' ')
+ pos++;
+ }
+ else
+ pos = arguments;
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf (server->buffer, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
+ }
return 0;
}
@@ -3093,23 +3248,24 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_324 (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos_chan, *pos, *pos_parm;
+ char *pos_channel, *pos, *pos_parm;
t_irc_channel *ptr_channel;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_chan = strchr (arguments, ' ');
- if (pos_chan)
+ pos_channel = strchr (arguments, ' ');
+ if (pos_channel)
{
- pos_chan[0] = '\0';
- pos_chan++;
- while (pos_chan[0] == ' ')
- pos_chan++;
+ pos_channel[0] = '\0';
+ pos_channel++;
+ while (pos_channel[0] == ' ')
+ pos_channel++;
- pos = strchr (pos_chan, ' ');
+ pos = strchr (pos_channel, ' ');
if (pos)
{
pos[0] = '\0';
@@ -3125,7 +3281,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
while (pos_parm[0] == ' ')
pos_parm++;
}
- ptr_channel = channel_search (server, pos_chan);
+ ptr_channel = channel_search (server, pos_channel);
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
@@ -3141,11 +3297,12 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_329 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_329 (t_irc_server *server, char *host, char *nick, char *arguments)
{
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
(void) arguments;
return 0;
@@ -3156,22 +3313,43 @@ irc_cmd_recv_329 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_331 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos;
+ t_irc_channel *ptr_channel;
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- if (pos)
- pos[0] = '\0';
- irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT, _("No topic set for "));
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s\n", arguments);
+ if (!command_ignored)
+ {
+ pos = strchr (arguments, ' ');
+ if (pos)
+ pos[0] = '\0';
+ ptr_channel = channel_search (server, arguments);
+ if (ptr_channel)
+ {
+ command_ignored |= ignore_check (host, "331", ptr_channel->name, server->name);
+ if (!command_ignored)
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("No topic set for "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s\n", arguments);
+ }
+ }
+ else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s channel \"%s\" not found for \"%s\" command\n"),
+ WEECHAT_ERROR, arguments, "331");
+ return -1;
+ }
+ }
return 0;
}
@@ -3180,13 +3358,14 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_332 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
t_irc_channel *ptr_channel;
/* make gcc happy */
(void) host;
+ (void) nick;
pos = strchr (arguments, ' ');
if (pos)
@@ -3209,13 +3388,17 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
free (ptr_channel->topic);
ptr_channel->topic = strdup (pos2);
- irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("Topic for "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL, "%s", pos);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _(" is: \"%s\"\n"), pos2);
+ command_ignored |= ignore_check (host, "332", ptr_channel->name, server->name);
+ if (!command_ignored)
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("Topic for "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL, "%s", pos);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _(" is: \"%s\"\n"), pos2);
+ }
gui_draw_buffer_title (ptr_channel->buffer, 1);
}
@@ -3245,7 +3428,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_333 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_channel, *pos_nick, *pos_date;
t_irc_channel *ptr_channel;
@@ -3253,6 +3436,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
pos_channel = strchr (arguments, ' ');
if (pos_channel)
@@ -3277,14 +3461,18 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos_channel);
if (ptr_channel)
{
- irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("Topic set by "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- datetime = (time_t)(atol (pos_date));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, ", %s", ctime (&datetime));
+ command_ignored |= ignore_check (host, "333", ptr_channel->name, server->name);
+ if (!command_ignored)
+ {
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("Topic set by "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ datetime = (time_t)(atol (pos_date));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, ", %s", ctime (&datetime));
+ }
}
else
{
@@ -3329,13 +3517,13 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_341 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_341 (t_irc_server *server, char *host, char *nick, char *arguments)
{
- char *pos, *pos_nick, *pos_channel;
+ char *pos_nick, *pos_channel;
- pos = strchr (host, '!');
- if (pos)
- pos[0] = '\0';
+ /* make gcc happy */
+ (void) host;
+ (void) nick;
pos_nick = strchr (arguments, ' ');
if (pos_nick)
@@ -3391,13 +3579,14 @@ irc_cmd_recv_341 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_351 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_351 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
pos = strchr (arguments, ' ');
if (pos)
@@ -3415,11 +3604,14 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *arguments)
pos2 += 2;
}
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- if (pos2)
- gui_printf (server->buffer, "%s %s\n", pos, pos2);
- else
- gui_printf (server->buffer, "%s\n", pos);
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ if (pos2)
+ gui_printf (server->buffer, "%s %s\n", pos, pos2);
+ else
+ gui_printf (server->buffer, "%s\n", pos);
+ }
return 0;
}
@@ -3428,7 +3620,7 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_352 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
char *pos_attr, *pos_hopcount, *pos_realname;
@@ -3437,6 +3629,7 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
pos_channel = strchr (arguments, ' ');
if (pos_channel)
@@ -3495,6 +3688,8 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
while (pos_realname[0] == ' ')
pos_realname++;
+ command_ignored |= ignore_check (host, "352", pos_channel, server->name);
+
ptr_channel = channel_search (server, pos_channel);
if (ptr_channel && (ptr_channel->checking_away > 0))
{
@@ -3505,34 +3700,37 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
return 0;
}
- irc_display_prefix (server->buffer,
- PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK,
- "%s ", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- _("on"));
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- " %s", pos_channel);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- " %s %s ",
- pos_attr, pos_hopcount);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_HOST,
- "%s@%s",
- pos_user, pos_host);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK,
- " (");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT,
- "%s", pos_realname);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK,
- ")\n");
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer,
+ PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK,
+ "%s ", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ _("on"));
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ " %s", pos_channel);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ " %s %s ",
+ pos_attr, pos_hopcount);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_HOST,
+ "%s@%s",
+ pos_user, pos_host);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK,
+ " (");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT,
+ "%s", pos_realname);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK,
+ ")\n");
+ }
}
}
}
@@ -3549,7 +3747,7 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos_nick;
int is_chanowner, is_chanadmin, is_op, is_halfop, has_voice;
@@ -3557,6 +3755,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
pos = strstr (arguments, " = ");
if (pos)
@@ -3659,7 +3858,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_366 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
t_irc_channel *ptr_channel;
@@ -3668,6 +3867,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
pos = strchr (arguments, ' ');
if (pos)
@@ -3687,90 +3887,97 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos);
if (ptr_channel)
{
-
- /* display users on channel */
- irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
- _("Nicks "));
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
- "%s", ptr_channel->name);
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "[");
+ command_ignored |= ignore_check (host, "366", ptr_channel->name, server->name);
- for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
+ if (!command_ignored)
{
- irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
- MSG_TYPE_MSG, 0, 0, 1);
- if (ptr_nick != ptr_channel->last_nick)
- gui_printf (ptr_channel->buffer, " ");
- }
- gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "]\n");
-
- /* display number of nicks, ops, halfops & voices on the channel */
- nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice,
- &num_normal);
- irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, _("Channel "));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%s", ptr_channel->name);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%d ", num_nicks);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- (num_nicks > 1) ? _("nicks") : _("nick"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%d ", num_op);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- (num_op > 1) ? _("ops") : _("op"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- ", ");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%d ", num_halfop);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- (num_halfop > 1) ? _("halfops") : _("halfop"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- ", ");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
+ /* display users on channel */
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
+ _("Nicks "));
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
+ "%s", ptr_channel->name);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, ": ");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "[");
+
+ for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
+ {
+ irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
+ MSG_TYPE_MSG, 0, 0, 1);
+ if (ptr_nick != ptr_channel->last_nick)
+ gui_printf (ptr_channel->buffer, " ");
+ }
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "]\n");
+
+ /* display number of nicks, ops, halfops & voices on the channel */
+ nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice,
+ &num_normal);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, _("Channel "));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%s", ptr_channel->name);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT, ": ");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%d ", num_nicks);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ (num_nicks > 1) ? _("nicks") : _("nick"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, " (");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%d ", num_op);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ (num_op > 1) ? _("ops") : _("op"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ ", ");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%d ", num_halfop);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ (num_halfop > 1) ? _("halfops") : _("halfop"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ ", ");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
"%d ", num_voice);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- (num_voice > 1) ? _("voices") : _("voice"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- ", ");
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_CHANNEL,
- "%d ", num_normal);
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT,
- _("normal"));
- gui_printf_color (ptr_channel->buffer,
- COLOR_WIN_CHAT_DARK, ")\n");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ (num_voice > 1) ? _("voices") : _("voice"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ ", ");
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_CHANNEL,
+ "%d ", num_normal);
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT,
+ _("normal"));
+ gui_printf_color (ptr_channel->buffer,
+ COLOR_WIN_CHAT_DARK, ")\n");
+ }
irc_cmd_send_mode (server, ptr_channel->name);
if (cfg_irc_away_check > 0)
channel_check_away (server, ptr_channel);
}
else
{
- irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT_CHANNEL, pos);
- gui_printf_color (gui_current_window->buffer,
- COLOR_WIN_CHAT, ": %s\n", pos2);
+ if (!command_ignored)
+ {
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
+ COLOR_WIN_CHAT_CHANNEL, pos);
+ gui_printf_color (gui_current_window->buffer,
+ COLOR_WIN_CHAT, ": %s\n", pos2);
+ }
return 0;
}
}
@@ -3783,7 +3990,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_367 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_367 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_channel, *pos_ban, *pos_user, *pos_date, *pos;
t_irc_channel *ptr_channel;
@@ -3792,6 +3999,7 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
/* look for channel */
pos_channel = strchr (arguments, ' ');
@@ -3865,26 +4073,30 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos_channel);
buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
- irc_display_prefix (buffer, PREFIX_INFO);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_channel);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (buffer, COLOR_WIN_CHAT_HOST, "%s ", pos_ban);
- gui_printf (buffer, _("banned by"));
- pos = strchr (pos_user, '!');
- if (pos)
- {
- pos[0] = '\0';
- gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, " %s ", pos_user);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (buffer, COLOR_WIN_CHAT_HOST, "%s", pos + 1);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, ")");
- }
- else
- gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, " %s", pos_user);
- datetime = (time_t)(atol (pos_date));
- gui_printf_nolog (buffer, ", %s", ctime (&datetime));
+ command_ignored |= ignore_check (host, "367", pos_channel, server->name);
+ if (!command_ignored)
+ {
+ irc_display_prefix (buffer, PREFIX_INFO);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_channel);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (buffer, COLOR_WIN_CHAT_HOST, "%s ", pos_ban);
+ gui_printf (buffer, _("banned by"));
+ pos = strchr (pos_user, '!');
+ if (pos)
+ {
+ pos[0] = '\0';
+ gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, " %s ", pos_user);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "(");
+ gui_printf_color (buffer, COLOR_WIN_CHAT_HOST, "%s", pos + 1);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, ")");
+ }
+ else
+ gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, " %s", pos_user);
+ datetime = (time_t)(atol (pos_date));
+ gui_printf_nolog (buffer, ", %s", ctime (&datetime));
+ }
return 0;
}
@@ -3893,7 +4105,7 @@ irc_cmd_recv_367 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_368 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_368 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_channel, *pos_msg;
t_irc_channel *ptr_channel;
@@ -3901,6 +4113,7 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
+ (void) nick;
pos_channel = strchr (arguments, ' ');
if (!pos_channel)
@@ -3934,13 +4147,17 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos_channel);
buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
+
+ command_ignored |= ignore_check (host, "368", pos_channel, server->name);
- irc_display_prefix (buffer, PREFIX_INFO);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_channel);
- gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_nolog (buffer, "%s\n", pos_msg);
-
+ if (!command_ignored)
+ {
+ irc_display_prefix (buffer, PREFIX_INFO);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_channel);
+ gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_nolog (buffer, "%s\n", pos_msg);
+ }
return 0;
}
@@ -3949,10 +4166,12 @@ irc_cmd_recv_368 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_433 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char hostname[128];
-
+
+ /* Note: this IRC command can not be ignored */
+
if (!server->is_connected)
{
if (strcmp (server->nick, server->nick1) == 0)
@@ -4011,7 +4230,8 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
server->nick);
}
else
- return irc_cmd_recv_error (server, host, arguments);
+ return irc_cmd_recv_error (server, host, nick, arguments);
+
return 0;
}
@@ -4020,34 +4240,37 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_438 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_438 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos2;
/* make gcc happy */
(void) server;
(void) host;
+ (void) nick;
- pos = strchr (arguments, ' ');
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- if (pos)
+ if (!command_ignored)
{
- pos[0] = '\0';
- pos++;
-
- pos2 = strstr (pos, " :");
- if (pos2)
+ pos = strchr (arguments, ' ');
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ if (pos)
{
- pos2[0] = '\0';
- pos2 += 2;
- gui_printf (server->buffer, "%s (%s => %s)\n", pos2, arguments, pos);
+ pos[0] = '\0';
+ pos++;
+
+ pos2 = strstr (pos, " :");
+ if (pos2)
+ {
+ pos2[0] = '\0';
+ pos2 += 2;
+ gui_printf (server->buffer, "%s (%s => %s)\n", pos2, arguments, pos);
+ }
+ else
+ gui_printf (server->buffer, "%s (%s)\n", pos, arguments);
}
else
- gui_printf (server->buffer, "%s (%s)\n", pos, arguments);
+ gui_printf (server->buffer, "%s\n", arguments);
}
- else
- gui_printf (server->buffer, "%s\n", arguments);
-
return 0;
}
@@ -4056,37 +4279,41 @@ irc_cmd_recv_438 (t_irc_server *server, char *host, char *arguments)
*/
int
-irc_cmd_recv_671 (t_irc_server *server, char *host, char *arguments)
+irc_cmd_recv_671 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_message;
/* make gcc happy */
(void) host;
+ (void) nick;
- pos_nick = strchr (arguments, ' ');
- if (pos_nick)
+ if (!command_ignored)
{
- while (pos_nick[0] == ' ')
- pos_nick++;
- pos_message = strchr (pos_nick, ' ');
- if (pos_message)
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
{
- pos_message[0] = '\0';
- pos_message++;
- while (pos_message[0] == ' ')
- pos_message++;
- if (pos_message[0] == ':')
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+ pos_message = strchr (pos_nick, ' ');
+ if (pos_message)
+ {
+ pos_message[0] = '\0';
pos_message++;
-
- irc_display_prefix (server->buffer, PREFIX_SERVER);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->buffer,
- COLOR_WIN_CHAT, "%s\n", pos_message);
+ while (pos_message[0] == ' ')
+ pos_message++;
+ if (pos_message[0] == ':')
+ pos_message++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_NICK, "%s", pos_nick);
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT_DARK, "] ");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, "%s\n", pos_message);
+ }
}
}
return 0;
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 6645f0129..5f0fe45bd 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -900,12 +900,12 @@ void
convbase64_8x3_to_6x4(char *from, char* to)
{
- unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- to[0] = base64_table [ (from[0] & 0xfc) >> 2 ];
- to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ];
- to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ];
- to[3] = base64_table [ from[2] & 0x3f ];
+ to[0] = base64_table [ (from[0] & 0xfc) >> 2 ];
+ to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ];
+ to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ];
+ to[3] = base64_table [ from[2] & 0x3f ];
}
/*
@@ -916,91 +916,92 @@ void
base64encode(char *from, char *to)
{
- char *f, *t;
- int from_len;
+ char *f, *t;
+ int from_len;
- from_len = strlen(from);
+ from_len = strlen(from);
- f = from;
- t = to;
+ f = from;
+ t = to;
- while(from_len >= 3)
+ while(from_len >= 3)
{
- convbase64_8x3_to_6x4(f, t);
- f += 3 * sizeof(*f);
- t += 4 * sizeof(*t);
- from_len -= 3;
+ convbase64_8x3_to_6x4(f, t);
+ f += 3 * sizeof(*f);
+ t += 4 * sizeof(*t);
+ from_len -= 3;
}
- if (from_len > 0)
+ if (from_len > 0)
{
- char rest[3] = { 0, 0, 0 };
- switch(from_len)
+ char rest[3] = { 0, 0, 0 };
+ switch(from_len)
{
case 1 :
- rest[0] = f[0];
- convbase64_8x3_to_6x4(rest, t);
- t[2] = t[3] = '=';
- break;
+ rest[0] = f[0];
+ convbase64_8x3_to_6x4(rest, t);
+ t[2] = t[3] = '=';
+ break;
case 2 :
- rest[0] = f[0];
- rest[1] = f[1];
- convbase64_8x3_to_6x4(rest, t);
- t[3] = '=';
- break;
+ rest[0] = f[0];
+ rest[1] = f[1];
+ convbase64_8x3_to_6x4(rest, t);
+ t[3] = '=';
+ break;
}
- t[4] = 0;
+ t[4] = 0;
}
}
/*
* pass_httpproxy: establish connection/authentification to an http proxy
- * return :
- * - 0 if connexion throw proxy was successful
- * - 1 if connexion fails
+ * return :
+ * - 0 if connexion throw proxy was successful
+ * - 1 if connexion fails
*/
+
int
pass_httpproxy(int sock, char *address, int port)
{
- char buffer[256];
- char authbuf[128]; // seems to be enougth to store username + password
- char authbuf_base64[196]; // enougth to store base64 encoded authbuf
- int n, m;
+ char buffer[256];
+ char authbuf[128]; // seems to be enougth to store username + password
+ char authbuf_base64[196]; // enougth to store base64 encoded authbuf
+ int n, m;
- if (strlen(cfg_proxy_username) > 0)
+ if (strlen(cfg_proxy_username) > 0)
{
- // authentification
- snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password);
- base64encode(authbuf, authbuf_base64);
- n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", address, port, authbuf_base64);
+ // authentification
+ snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password);
+ base64encode(authbuf, authbuf_base64);
+ n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", address, port, authbuf_base64);
}
- else
+ else
{
- // no authentification
- n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port);
+ // no authentification
+ n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port);
}
- m = send (sock, buffer, n, 0);
- if (n != m)
- return 1;
+ m = send (sock, buffer, n, 0);
+ if (n != m)
+ return 1;
- n = recv(sock, buffer, sizeof(buffer), 0);
+ n = recv(sock, buffer, sizeof(buffer), 0);
- /* success result must be like : "HTTP/1.0 200 OK" */
- if (n < 12)
- return 1;
+ /* success result must be like : "HTTP/1.0 200 OK" */
+ if (n < 12)
+ return 1;
- if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3))
- return 1;
+ if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3))
+ return 1;
- return 0;
+ return 0;
}
/*
* resolve: resolve hostname on its IP address
* (works with ipv4 and ipv6)
- * return :
+ * return :
* - 0 if resolution was successful
* - 1 if resolution fails
*/
@@ -1042,207 +1043,210 @@ resolve (char *hostname, char *ip, int *version)
/*
* pass_socks4proxy: establish connection/authentification throw a socks4 proxy
- * return :
- * - 0 if connexion throw proxy was successful
- * - 1 if connexion fails
+ * return :
+ * - 0 if connexion throw proxy was successful
+ * - 1 if connexion fails
*/
+
int
pass_socks4proxy(int sock, char *address, int port, char *username)
{
- /*
- * socks4 protocol is explain here:
- * http://archive.socks.permeo.com/protocol/socks4.protocol
- *
- */
+ /*
+ * socks4 protocol is explain here:
+ * http://archive.socks.permeo.com/protocol/socks4.protocol
+ *
+ */
- struct s_socks4
- {
- char version; /* 1 byte */ /* socks version : 4 or 5 */
- char method; /* 1 byte */ /* socks method : connect (1) or bind (2) */
- unsigned short port; /* 2 bytes */ /* destination port */
- unsigned long address; /* 4 bytes */ /* destination address */
- char user[64]; /* username (64 characters seems to be enought) */
- } socks4;
- unsigned char buffer[24];
- char ip_addr[NI_MAXHOST];
-
- socks4.version = 4;
- socks4.method = 1;
- socks4.port = htons (port);
- resolve(address, ip_addr, NULL);
- socks4.address = inet_addr (ip_addr);
- strncpy (socks4.user, username, sizeof(socks4.user) - 1);
+ struct s_socks4
+ {
+ char version; /* 1 byte */ /* socks version : 4 or 5 */
+ char method; /* 1 byte */ /* socks method : connect (1) or bind (2) */
+ unsigned short port; /* 2 bytes */ /* destination port */
+ unsigned long address; /* 4 bytes */ /* destination address */
+ char user[64]; /* username (64 characters seems to be enought) */
+ } socks4;
+ unsigned char buffer[24];
+ char ip_addr[NI_MAXHOST];
+
+ socks4.version = 4;
+ socks4.method = 1;
+ socks4.port = htons (port);
+ resolve(address, ip_addr, NULL);
+ socks4.address = inet_addr (ip_addr);
+ strncpy (socks4.user, username, sizeof(socks4.user) - 1);
- send (sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0);
- recv (sock, buffer, sizeof(buffer), 0);
+ send (sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0);
+ recv (sock, buffer, sizeof(buffer), 0);
- if (buffer[0] == 0 && buffer[1] == 90)
- return 0;
+ if (buffer[0] == 0 && buffer[1] == 90)
+ return 0;
- return 1;
+ return 1;
}
/*
* pass_socks5proxy: establish connection/authentification throw a socks5 proxy
- * return :
- * - 0 if connexion throw proxy was successful
- * - 1 if connexion fails
+ * return :
+ * - 0 if connexion throw proxy was successful
+ * - 1 if connexion fails
*/
+
int
pass_socks5proxy(int sock, char *address, int port)
{
- /*
- * socks5 protocol is explained in RFC 1928
- * socks5 authentication with username/pass is explained in RFC 1929
- */
+ /*
+ * socks5 protocol is explained in RFC 1928
+ * socks5 authentication with username/pass is explained in RFC 1929
+ */
- struct s_sock5
- {
- char version; /* 1 byte */ /* socks version : 4 or 5 */
- char nmethods; /* 1 byte */ /* size in byte(s) of field 'method', here 1 byte */
- char method; /* 1-255 bytes */ /* socks method : noauth (0), auth(user/pass) (2), ... */
- } socks5;
- unsigned char buffer[288];
- int username_len, password_len, addr_len, addr_buffer_len;
- unsigned char *addr_buffer;
+ struct s_sock5
+ {
+ char version; /* 1 byte */ /* socks version : 4 or 5 */
+ char nmethods; /* 1 byte */ /* size in byte(s) of field 'method', here 1 byte */
+ char method; /* 1-255 bytes */ /* socks method : noauth (0), auth(user/pass) (2), ... */
+ } socks5;
+ unsigned char buffer[288];
+ int username_len, password_len, addr_len, addr_buffer_len;
+ unsigned char *addr_buffer;
- socks5.version = 5;
- socks5.nmethods = 1;
+ socks5.version = 5;
+ socks5.nmethods = 1;
- if (strlen(cfg_proxy_username) > 0)
- /* with authentication */
- socks5.method = 2;
- else
- /* without authentication */
- socks5.method = 0;
+ if (strlen(cfg_proxy_username) > 0)
+ /* with authentication */
+ socks5.method = 2;
+ else
+ /* without authentication */
+ socks5.method = 0;
- send (sock, (char *) &socks5, sizeof(socks5), 0);
- /* server socks5 must respond with 2 bytes */
- if (recv (sock, buffer, 2, 0) != 2)
- return 1;
+ send (sock, (char *) &socks5, sizeof(socks5), 0);
+ /* server socks5 must respond with 2 bytes */
+ if (recv (sock, buffer, 2, 0) != 2)
+ return 1;
- if (strlen(cfg_proxy_username) > 0)
+ if (strlen(cfg_proxy_username) > 0)
{
- /* with authentication */
- /* -> socks server must respond with :
- * - socks version (buffer[0]) = 5 => socks5
- * - socks method (buffer[1]) = 2 => authentication
- */
-
- //if (!(buffer[0] == 5 && buffer[1] == 2))
- if (buffer[0] != 5 || buffer[1] != 2)
- return 1;
-
- /* authentication as in RFC 1929 */
- username_len = strlen(cfg_proxy_username);
- password_len = strlen(cfg_proxy_password);
+ /* with authentication */
+ /* -> socks server must respond with :
+ * - socks version (buffer[0]) = 5 => socks5
+ * - socks method (buffer[1]) = 2 => authentication
+ */
+
+ //if (!(buffer[0] == 5 && buffer[1] == 2))
+ if (buffer[0] != 5 || buffer[1] != 2)
+ return 1;
+
+ /* authentication as in RFC 1929 */
+ username_len = strlen(cfg_proxy_username);
+ password_len = strlen(cfg_proxy_password);
- /* make username/password buffer */
- buffer[0] = 1;
- buffer[1] = (unsigned char) username_len;
- memcpy(buffer + 2, cfg_proxy_username, username_len);
- buffer[2 + username_len] = (unsigned char) password_len;
- memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len);
+ /* make username/password buffer */
+ buffer[0] = 1;
+ buffer[1] = (unsigned char) username_len;
+ memcpy(buffer + 2, cfg_proxy_username, username_len);
+ buffer[2 + username_len] = (unsigned char) password_len;
+ memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len);
- send (sock, buffer, 3 + username_len + password_len, 0);
+ send (sock, buffer, 3 + username_len + password_len, 0);
- /* server socks5 must respond with 2 bytes */
- if (recv (sock, buffer, 2, 0) != 2)
- return 1;
+ /* server socks5 must respond with 2 bytes */
+ if (recv (sock, buffer, 2, 0) != 2)
+ return 1;
- /* buffer[1] = auth state, must be 0 for success */
- if (buffer[1] != 0)
- return 1;
+ /* buffer[1] = auth state, must be 0 for success */
+ if (buffer[1] != 0)
+ return 1;
}
- else
+ else
{
- /* without authentication */
- /* -> socks server must respond with :
- * - socks version (buffer[0]) = 5 => socks5
- * - socks method (buffer[1]) = 0 => no authentication
- */
- if (!(buffer[0] == 5 && buffer[1] == 0))
- return 1;
+ /* without authentication */
+ /* -> socks server must respond with :
+ * - socks version (buffer[0]) = 5 => socks5
+ * - socks method (buffer[1]) = 0 => no authentication
+ */
+ if (!(buffer[0] == 5 && buffer[1] == 0))
+ return 1;
}
- /* authentication successful then giving address/port to connect */
- addr_len = strlen(address);
- addr_buffer_len = 4 + 1 + addr_len + 2;
- addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer));
- if (!addr_buffer)
- return 1;
- addr_buffer[0] = 5; /* version 5 */
- addr_buffer[1] = 1; /* command: 1 for connect */
- addr_buffer[2] = 0; /* reserved */
- addr_buffer[3] = 3; /* address type : ipv4 (1), domainname (3), ipv6 (4) */
- addr_buffer[4] = (unsigned char) addr_len;
- memcpy (addr_buffer + 5, address, addr_len); /* server address */
- *((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */
-
- send (sock, addr_buffer, addr_buffer_len, 0);
- free(addr_buffer);
-
- /* dialog with proxy server */
- if (recv (sock, buffer, 4, 0) != 4)
- return 1;
+ /* authentication successful then giving address/port to connect */
+ addr_len = strlen(address);
+ addr_buffer_len = 4 + 1 + addr_len + 2;
+ addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer));
+ if (!addr_buffer)
+ return 1;
+ addr_buffer[0] = 5; /* version 5 */
+ addr_buffer[1] = 1; /* command: 1 for connect */
+ addr_buffer[2] = 0; /* reserved */
+ addr_buffer[3] = 3; /* address type : ipv4 (1), domainname (3), ipv6 (4) */
+ addr_buffer[4] = (unsigned char) addr_len;
+ memcpy (addr_buffer + 5, address, addr_len); /* server address */
+ *((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */
+
+ send (sock, addr_buffer, addr_buffer_len, 0);
+ free(addr_buffer);
+
+ /* dialog with proxy server */
+ if (recv (sock, buffer, 4, 0) != 4)
+ return 1;
- if (!(buffer[0] == 5 && buffer[1] == 0))
- return 1;
+ if (!(buffer[0] == 5 && buffer[1] == 0))
+ return 1;
- switch(buffer[3]) {
- /* buffer[3] = address type */
- case 1 :
- /* ipv4
- * server socks return server bound address and port
- * address of 4 bytes and port of 2 bytes (= 6 bytes)
- */
- if (recv (sock, buffer, 6, 0) != 6)
- return 1;
- break;
- case 3:
- /* domainname
- * server socks return server bound address and port
- */
- /* reading address length */
- if (recv (sock, buffer, 1, 0) != 1)
- return 1;
- addr_len = buffer[0];
- /* reading address + port = addr_len + 2 */
- if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2))
- return 1;
- break;
- case 4 :
- /* ipv6
- * server socks return server bound address and port
- * address of 16 bytes and port of 2 bytes (= 18 bytes)
- */
- if (recv (sock, buffer, 18, 0) != 18)
- return 1;
- break;
- default:
- return 1;
- }
+ switch(buffer[3]) {
+ /* buffer[3] = address type */
+ case 1 :
+ /* ipv4
+ * server socks return server bound address and port
+ * address of 4 bytes and port of 2 bytes (= 6 bytes)
+ */
+ if (recv (sock, buffer, 6, 0) != 6)
+ return 1;
+ break;
+ case 3:
+ /* domainname
+ * server socks return server bound address and port
+ */
+ /* reading address length */
+ if (recv (sock, buffer, 1, 0) != 1)
+ return 1;
+ addr_len = buffer[0];
+ /* reading address + port = addr_len + 2 */
+ if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2))
+ return 1;
+ break;
+ case 4 :
+ /* ipv6
+ * server socks return server bound address and port
+ * address of 16 bytes and port of 2 bytes (= 18 bytes)
+ */
+ if (recv (sock, buffer, 18, 0) != 18)
+ return 1;
+ break;
+ default:
+ return 1;
+ }
- return 0;
+ return 0;
}
/*
* pass_proxy: establish connection/authentification to a proxy
- * return :
- * - 0 if connexion throw proxy was successful
- * - 1 if connexion fails
+ * return :
+ * - 0 if connexion throw proxy was successful
+ * - 1 if connexion fails
*/
+
int
pass_proxy(int sock, char *address, int port, char *username)
{
- if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "http") == 0)
- return pass_httpproxy(sock, address, port);
- if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0)
- return pass_socks4proxy(sock, address, port, username);
- if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0)
- return pass_socks5proxy(sock, address, port);
-
- return 1;
+ if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "http") == 0)
+ return pass_httpproxy(sock, address, port);
+ if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0)
+ return pass_socks4proxy(sock, address, port, username);
+ if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0)
+ return pass_socks5proxy(sock, address, port);
+
+ return 1;
}
/*
@@ -1586,6 +1590,9 @@ server_search (char *servername)
{
t_irc_server *ptr_server;
+ if (!servername)
+ return NULL;
+
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -1624,6 +1631,9 @@ server_name_already_exists (char *name)
{
t_irc_server *ptr_server;
+ if (!name)
+ return 0;
+
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
if (strcmp (ptr_server->name, name) == 0)
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 96b39e71e..2fb0255f1 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -203,7 +203,7 @@ struct t_irc_command
/* function called when user enters cmd */
int (*cmd_function_1arg)(t_irc_server *, char *);
/* function called when user enters cmd */
- int (*recv_function)(t_irc_server *, char *, char *);
+ int (*recv_function)(t_irc_server *, char *, char *, char *);
/* function called when cmd is received */
};
@@ -218,7 +218,7 @@ struct t_irc_message
t_irc_message *next_message; /* link to next message */
};
-/* DCC */
+/* DCC types */
typedef struct t_irc_dcc t_irc_dcc;
@@ -251,6 +251,30 @@ struct t_irc_dcc
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
};
+/* ignore types */
+
+/* pre-defined ignore types, all other types are made with IRC commands */
+/* for example: part join quit notice invite ... */
+
+#define IGNORE_ACTION "action"
+#define IGNORE_CTCP "ctcp"
+#define IGNORE_DCC "dcc"
+#define IGNORE_PRIVATE "pv"
+
+typedef struct t_irc_ignore t_irc_ignore;
+
+struct t_irc_ignore
+{
+ char *mask; /* nickname or mask */
+ char *type; /* type of ignore */
+ char *channel_name; /* name of channel, "*" == all */
+ char *server_name; /* name of server, "*" == all */
+ t_irc_ignore *prev_ignore; /* pointer to previous ignore */
+ t_irc_ignore *next_ignore; /* pointer to next ignore */
+};
+
+/* variables */
+
extern t_irc_command irc_commands[];
extern t_irc_server *irc_servers;
extern t_irc_message *recv_msgq, *msgq_last_msg;
@@ -258,6 +282,9 @@ extern int check_away;
extern t_irc_dcc *dcc_list;
extern char *dcc_status_string[6];
extern char *channel_modes;
+extern char *ignore_types[];
+extern t_irc_ignore *irc_ignore;
+extern t_irc_ignore *irc_last_ignore;
/* server functions (irc-server.c) */
@@ -414,57 +441,67 @@ extern int irc_cmd_send_who (t_irc_server *, char *);
extern int irc_cmd_send_whois (t_irc_server *, char *);
extern int irc_cmd_send_whowas (t_irc_server *, char *);
/* IRC commands executed when received from server */
-extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_invite (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_kick (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_kill (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_mode (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_topic (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_302 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_303 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_305 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_306 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_307 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_314 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_315 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_341 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_365 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_367 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_368 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_438 (t_irc_server *, char *, char *);
-extern int irc_cmd_recv_671 (t_irc_server *, char *, char *);
+extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_kick (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_kill (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_mode (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_nick (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_notice (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_part (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_ping (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_pong (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_quit (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_004 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_305 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_306 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_307 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_311 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_312 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_313 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_314 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_315 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_317 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_318 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_319 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_320 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_321 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_322 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_323 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_324 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_329 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_331 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_332 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_333 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_341 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_351 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_352 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_353 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_365 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_366 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_367 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_368 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_433 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_438 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_671 (t_irc_server *, char *, char *, char *);
+
+/* ignore functions (irc-ignore.c) */
+
+extern int ignore_check (char *, char *, char *, char *);
+extern t_irc_ignore *ignore_add (char *, char *, char *, char *);
+extern t_irc_ignore *ignore_add_from_config (char *);
+extern void ignore_free_all ();
+extern int ignore_search_free (char *, char *, char *, char *);
+extern int ignore_search_free_by_number (int);
+extern void ignore_print_log ();
#endif /* irc.h */