summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-01 21:00:59 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-01 21:00:59 +0000
commit54ee1c6e8cdfa2c9f96914dcc80cd75165267e8c (patch)
tree3cf9ff23d5eadc21f1f82d6d8f6527986dde2006 /src/fe-common/irc
parent62dee8fdafe558b638cfc1995841e3ca7e007368 (diff)
downloadirssi-54ee1c6e8cdfa2c9f96914dcc80cd75165267e8c.zip
/SILENCE updates, added /UNSILENCE command.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@706 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c20
-rw-r--r--src/fe-common/irc/fe-events.c11
-rw-r--r--src/fe-common/irc/module-formats.c4
-rw-r--r--src/fe-common/irc/module-formats.h4
4 files changed, 39 insertions, 0 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index ca739c35..4c365a51 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -241,6 +241,18 @@ static void event_eban_list(const char *data, IRC_SERVER_REC *server)
g_free(params);
}
+static void event_silence_list(const char *data, IRC_SERVER_REC *server)
+{
+ char *params, *nick, *mask;
+
+ g_return_if_fail(data != NULL);
+
+ params = event_get_params(data, 3, NULL, &nick, &mask);
+ printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_SILENCE_LINE, nick, mask);
+ g_free(params);
+}
+
+
static void event_invite_list(const char *data, IRC_SERVER_REC *server)
{
char *params, *channel, *invite;
@@ -654,6 +666,10 @@ static void event_motd(const char *data, IRC_SERVER_REC *server)
g_free(params);
}
+static void sig_empty(void)
+{
+}
+
void fe_events_numeric_init(void)
{
last_away_nick = NULL;
@@ -665,6 +681,8 @@ void fe_events_numeric_init(void)
signal_add("event 366", (SIGNAL_FUNC) event_end_of_names);
signal_add("event 352", (SIGNAL_FUNC) event_who);
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 367", (SIGNAL_FUNC) event_ban_list);
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
signal_add("event 346", (SIGNAL_FUNC) event_invite_list);
@@ -721,6 +739,8 @@ void fe_events_numeric_deinit(void)
signal_remove("event 366", (SIGNAL_FUNC) event_end_of_names);
signal_remove("event 352", (SIGNAL_FUNC) event_who);
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 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/fe-events.c b/src/fe-common/irc/fe-events.c
index 9fcd935f..8f4a0a6c 100644
--- a/src/fe-common/irc/fe-events.c
+++ b/src/fe-common/irc/fe-events.c
@@ -402,6 +402,15 @@ static void event_wallops(const char *data, IRC_SERVER_REC *server, const char *
}
}
+static void event_silence(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
+{
+ g_return_if_fail(data != NULL);
+
+ g_return_if_fail(*data == '+' || *data == '-');
+
+ printformat(server, NULL, MSGLEVEL_CRAP, *data == '+' ? IRCTXT_SILENCED : IRCTXT_UNSILENCED, data+1);
+}
+
static void channel_sync(CHANNEL_REC *channel)
{
g_return_if_fail(channel != NULL);
@@ -535,6 +544,7 @@ void fe_events_init(void)
signal_add("event topic", (SIGNAL_FUNC) event_topic);
signal_add("event error", (SIGNAL_FUNC) event_error);
signal_add("event wallops", (SIGNAL_FUNC) event_wallops);
+ signal_add("event silence", (SIGNAL_FUNC) event_silence);
signal_add("default event", (SIGNAL_FUNC) event_received);
@@ -562,6 +572,7 @@ void fe_events_deinit(void)
signal_remove("event topic", (SIGNAL_FUNC) event_topic);
signal_remove("event error", (SIGNAL_FUNC) event_error);
signal_remove("event wallops", (SIGNAL_FUNC) event_wallops);
+ signal_remove("event silence", (SIGNAL_FUNC) event_silence);
signal_remove("default event", (SIGNAL_FUNC) event_received);
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index ab6bf381..bb3b7385 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -161,6 +161,10 @@ FORMAT_REC fecommon_irc_formats[] = {
/* ---- */
{ NULL, "Misc", 0 },
+ { "silenced", "Silenced %_$0%_", 1, { 0 } },
+ { "unsilenced", "Unsilenced %_$0%_", 1, { 0 } },
+ { "silence_line", "%_$0%_: silence %c$1", 2, { 0, 0 } },
+
{ "ignored", "Ignoring %_$1%_ from %_$0%_", 2, { 0, 0 } },
{ "unignored", "Unignored %_$0%_", 1, { 0 } },
{ "ignore_not_found", "%_$0%_ is not being ignored", 1, { 0 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index c85905f0..bef857b0 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -131,6 +131,10 @@ enum {
IRCTXT_FILL_11,
+ IRCTXT_SILENCED,
+ IRCTXT_UNSILENCED,
+ IRCTXT_SILENCE_LINE,
+
IRCTXT_IGNORED,
IRCTXT_UNIGNORED,
IRCTXT_IGNORE_NOT_FOUND,