summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@irssi.org>2007-06-08 18:49:24 +0000
committerjilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-06-08 18:49:24 +0000
commit9d6335735bf1adaf5219c932cd8d3cb31553ca6a (patch)
tree6d3efcf6a7390adb1688e2dcf31288558fccf954
parent10ae40c3688388ef40cf2fb272258bb75970d2cc (diff)
downloadirssi-9d6335735bf1adaf5219c932cd8d3cb31553ca6a.zip
Add support for the ACCEPT command, which is part of the
CALLERID server side ignore system in hybrid7 and derived ircds. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4546 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--docs/help/in/accept.in28
-rw-r--r--docs/help/in/ignore.in2
-rw-r--r--docs/help/in/silence.in2
-rw-r--r--src/fe-common/irc/fe-events-numeric.c13
-rw-r--r--src/fe-common/irc/module-formats.c1
-rw-r--r--src/fe-common/irc/module-formats.h3
-rw-r--r--src/irc/core/irc-commands.c13
7 files changed, 59 insertions, 3 deletions
diff --git a/docs/help/in/accept.in b/docs/help/in/accept.in
new file mode 100644
index 00000000..4d74fe98
--- /dev/null
+++ b/docs/help/in/accept.in
@@ -0,0 +1,28 @@
+
+@SYNTAX:accept@
+MODE <your nick> <+|->g
+
+Works only in some IRC networks.
+
+ACCEPT allows you to specify who you want to receive private messages
+and notices from while you are in callerid (+g) mode.
+When you have user mode +g enabled, messages from other users are blocked and
+the sender is notified; you are also notified but at most once per minute.
+IRC operators and services can usually send through +g.
+
+The accept list is lost when you disconnect.
+Users are automatically removed from the accept list if they quit, split
+or change nick.
+
+The argument is a comma-separated list of nicks to add or (when prefixed
+with a '-') to remove. No output is returned for users successfully added
+or removed.
+If no arguments are given, your accept list is displayed (ACCEPT * on the
+protocol level).
+
+Example:
+ /ACCEPT user1,user2,-user3,-user4 - Adds user1 and user2 and removes
+ user3 and user4.
+
+See also: IGNORE, SILENCE
+
diff --git a/docs/help/in/ignore.in b/docs/help/in/ignore.in
index 16a870af..54685035 100644
--- a/docs/help/in/ignore.in
+++ b/docs/help/in/ignore.in
@@ -40,5 +40,5 @@ Some suggestions for ignoring annoying public aways:
For regular expressions, see `man 7 regex`.
-See also: UNIGNORE
+See also: UNIGNORE, SILENCE, ACCEPT
diff --git a/docs/help/in/silence.in b/docs/help/in/silence.in
index cf9c59e0..d4562cf7 100644
--- a/docs/help/in/silence.in
+++ b/docs/help/in/silence.in
@@ -20,5 +20,5 @@ If you only specify a nickname, you can list the patterns in the
silence list owned by that nickname. If no arguments are given, your
own silence list is displayed.
-See also: IGNORE
+See also: IGNORE, ACCEPT
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index 9d12ed0a..dcf8d5ba 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -195,6 +195,17 @@ static void event_silence_list(IRC_SERVER_REC *server, const char *data)
g_free(params);
}
+static void event_accept_list(IRC_SERVER_REC *server, const char *data)
+{
+ char *params, *accepted;
+
+ g_return_if_fail(data != NULL);
+ g_return_if_fail(server != NULL);
+
+ params = event_get_params(data, 2, NULL, &accepted);
+ printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_ACCEPT_LIST, accepted);
+ g_free(params);
+}
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
{
@@ -583,6 +594,7 @@ void fe_events_numeric_init(void)
signal_add("event 315", (SIGNAL_FUNC) event_end_of_who);
signal_add("event 271", (SIGNAL_FUNC) event_silence_list);
signal_add("event 272", (SIGNAL_FUNC) sig_empty);
+ signal_add("event 281", (SIGNAL_FUNC) event_accept_list);
signal_add("event 367", (SIGNAL_FUNC) event_ban_list);
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
signal_add("event 346", (SIGNAL_FUNC) event_invite_list);
@@ -671,6 +683,7 @@ void fe_events_numeric_deinit(void)
signal_remove("event 315", (SIGNAL_FUNC) event_end_of_who);
signal_remove("event 271", (SIGNAL_FUNC) event_silence_list);
signal_remove("event 272", (SIGNAL_FUNC) sig_empty);
+ signal_remove("event 281", (SIGNAL_FUNC) event_accept_list);
signal_remove("event 367", (SIGNAL_FUNC) event_ban_list);
signal_remove("event 348", (SIGNAL_FUNC) event_eban_list);
signal_remove("event 346", (SIGNAL_FUNC) event_invite_list);
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index 4e1626eb..f1720962 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -161,6 +161,7 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "unsilenced", "Unsilenced {nick $0}", 1, { 0 } },
{ "silence_line", "{nick $0}: silence {ban $1}", 2, { 0, 0 } },
{ "ask_oper_pass", "Operator password:", 0 },
+ { "accept_list", "Accepted users: {hilight $0}", 1, { 0 } },
{ NULL, NULL, 0 }
};
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index ae2e55a9..d38ce686 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -130,7 +130,8 @@ enum {
IRCTXT_SILENCED,
IRCTXT_UNSILENCED,
IRCTXT_SILENCE_LINE,
- IRCTXT_ASK_OPER_PASS
+ IRCTXT_ASK_OPER_PASS,
+ IRCTXT_ACCEPT_LIST
};
extern FORMAT_REC fecommon_irc_formats[];
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index 45fb0090..7f31b59d 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -940,6 +940,17 @@ static void cmd_oper(const char *data, IRC_SERVER_REC *server)
cmd_params_free(free_arg);
}
+/* SYNTAX: ACCEPT [[-]nick,...] */
+static void cmd_accept(const char *data, IRC_SERVER_REC *server)
+{
+ CMD_IRC_SERVER(server);
+
+ if (*data == '\0')
+ irc_send_cmd(server, "ACCEPT *");
+ else
+ irc_send_cmdv(server, "ACCEPT %s", data);
+}
+
/* SYNTAX: UNSILENCE <nick!user@host> */
static void cmd_unsilence(const char *data, IRC_SERVER_REC *server)
{
@@ -1015,6 +1026,7 @@ void irc_commands_init(void)
command_bind_irc("away", NULL, (SIGNAL_FUNC) cmd_away);
/* SYNTAX: ISON <nicks> */
command_bind_irc("ison", NULL, (SIGNAL_FUNC) command_1self);
+ command_bind_irc("accept", NULL, (SIGNAL_FUNC) cmd_accept);
/* SYNTAX: ADMIN [<server>|<nickname>] */
command_bind_irc("admin", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: INFO [<server>] */
@@ -1110,6 +1122,7 @@ void irc_commands_deinit(void)
command_unbind("kill", (SIGNAL_FUNC) command_2self);
command_unbind("away", (SIGNAL_FUNC) cmd_away);
command_unbind("ison", (SIGNAL_FUNC) command_1self);
+ command_unbind("accept", (SIGNAL_FUNC) cmd_accept);
command_unbind("admin", (SIGNAL_FUNC) command_self);
command_unbind("info", (SIGNAL_FUNC) command_self);
command_unbind("knock", (SIGNAL_FUNC) command_self);