mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
/SILENCE updates, added /UNSILENCE command.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@706 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
62dee8fdaf
commit
54ee1c6e8c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
@SYNTAX:silence@
|
@SYNTAX:silence@
|
||||||
|
|
||||||
Works only in the Undernet.
|
Works only in the Undernet and Open Projects.
|
||||||
|
|
||||||
SILENCE is similar in many respects to IGNORE, except that it is
|
SILENCE is similar in many respects to IGNORE, except that it is
|
||||||
server-based. What this means is the server will never even send
|
server-based. What this means is the server will never even send
|
||||||
|
@ -241,6 +241,18 @@ static void event_eban_list(const char *data, IRC_SERVER_REC *server)
|
|||||||
g_free(params);
|
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)
|
static void event_invite_list(const char *data, IRC_SERVER_REC *server)
|
||||||
{
|
{
|
||||||
char *params, *channel, *invite;
|
char *params, *channel, *invite;
|
||||||
@ -654,6 +666,10 @@ static void event_motd(const char *data, IRC_SERVER_REC *server)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sig_empty(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void fe_events_numeric_init(void)
|
void fe_events_numeric_init(void)
|
||||||
{
|
{
|
||||||
last_away_nick = NULL;
|
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 366", (SIGNAL_FUNC) event_end_of_names);
|
||||||
signal_add("event 352", (SIGNAL_FUNC) event_who);
|
signal_add("event 352", (SIGNAL_FUNC) event_who);
|
||||||
signal_add("event 315", (SIGNAL_FUNC) event_end_of_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 367", (SIGNAL_FUNC) event_ban_list);
|
||||||
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
|
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
|
||||||
signal_add("event 346", (SIGNAL_FUNC) event_invite_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 366", (SIGNAL_FUNC) event_end_of_names);
|
||||||
signal_remove("event 352", (SIGNAL_FUNC) event_who);
|
signal_remove("event 352", (SIGNAL_FUNC) event_who);
|
||||||
signal_remove("event 315", (SIGNAL_FUNC) event_end_of_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 367", (SIGNAL_FUNC) event_ban_list);
|
||||||
signal_remove("event 348", (SIGNAL_FUNC) event_eban_list);
|
signal_remove("event 348", (SIGNAL_FUNC) event_eban_list);
|
||||||
signal_remove("event 346", (SIGNAL_FUNC) event_invite_list);
|
signal_remove("event 346", (SIGNAL_FUNC) event_invite_list);
|
||||||
|
@ -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)
|
static void channel_sync(CHANNEL_REC *channel)
|
||||||
{
|
{
|
||||||
g_return_if_fail(channel != NULL);
|
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 topic", (SIGNAL_FUNC) event_topic);
|
||||||
signal_add("event error", (SIGNAL_FUNC) event_error);
|
signal_add("event error", (SIGNAL_FUNC) event_error);
|
||||||
signal_add("event wallops", (SIGNAL_FUNC) event_wallops);
|
signal_add("event wallops", (SIGNAL_FUNC) event_wallops);
|
||||||
|
signal_add("event silence", (SIGNAL_FUNC) event_silence);
|
||||||
|
|
||||||
signal_add("default event", (SIGNAL_FUNC) event_received);
|
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 topic", (SIGNAL_FUNC) event_topic);
|
||||||
signal_remove("event error", (SIGNAL_FUNC) event_error);
|
signal_remove("event error", (SIGNAL_FUNC) event_error);
|
||||||
signal_remove("event wallops", (SIGNAL_FUNC) event_wallops);
|
signal_remove("event wallops", (SIGNAL_FUNC) event_wallops);
|
||||||
|
signal_remove("event silence", (SIGNAL_FUNC) event_silence);
|
||||||
|
|
||||||
signal_remove("default event", (SIGNAL_FUNC) event_received);
|
signal_remove("default event", (SIGNAL_FUNC) event_received);
|
||||||
|
|
||||||
|
@ -161,6 +161,10 @@ FORMAT_REC fecommon_irc_formats[] = {
|
|||||||
/* ---- */
|
/* ---- */
|
||||||
{ NULL, "Misc", 0 },
|
{ 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 } },
|
{ "ignored", "Ignoring %_$1%_ from %_$0%_", 2, { 0, 0 } },
|
||||||
{ "unignored", "Unignored %_$0%_", 1, { 0 } },
|
{ "unignored", "Unignored %_$0%_", 1, { 0 } },
|
||||||
{ "ignore_not_found", "%_$0%_ is not being ignored", 1, { 0 } },
|
{ "ignore_not_found", "%_$0%_ is not being ignored", 1, { 0 } },
|
||||||
|
@ -131,6 +131,10 @@ enum {
|
|||||||
|
|
||||||
IRCTXT_FILL_11,
|
IRCTXT_FILL_11,
|
||||||
|
|
||||||
|
IRCTXT_SILENCED,
|
||||||
|
IRCTXT_UNSILENCED,
|
||||||
|
IRCTXT_SILENCE_LINE,
|
||||||
|
|
||||||
IRCTXT_IGNORED,
|
IRCTXT_IGNORED,
|
||||||
IRCTXT_UNIGNORED,
|
IRCTXT_UNIGNORED,
|
||||||
IRCTXT_IGNORE_NOT_FOUND,
|
IRCTXT_IGNORE_NOT_FOUND,
|
||||||
|
@ -821,6 +821,19 @@ static void cmd_oper(const char *data, IRC_SERVER_REC *server)
|
|||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SYNTAX: UNSILENCE <nick!user@host> */
|
||||||
|
static void cmd_unsilence(const char *data, IRC_SERVER_REC *server)
|
||||||
|
{
|
||||||
|
g_return_if_fail(data != NULL);
|
||||||
|
if (!IS_IRC_SERVER(server) || !server->connected)
|
||||||
|
cmd_return_error(CMDERR_NOT_CONNECTED);
|
||||||
|
|
||||||
|
if (*data == '\0')
|
||||||
|
cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
|
||||||
|
irc_send_cmdv(server, "SILENCE -%s", data);
|
||||||
|
}
|
||||||
|
|
||||||
static void command_self(const char *data, IRC_SERVER_REC *server)
|
static void command_self(const char *data, IRC_SERVER_REC *server)
|
||||||
{
|
{
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
@ -932,6 +945,7 @@ void irc_commands_init(void)
|
|||||||
/* SYNTAX: SILENCE [[+|-]<nick!user@host>]
|
/* SYNTAX: SILENCE [[+|-]<nick!user@host>]
|
||||||
SILENCE [<nick>] */
|
SILENCE [<nick>] */
|
||||||
command_bind("silence", NULL, (SIGNAL_FUNC) command_self);
|
command_bind("silence", NULL, (SIGNAL_FUNC) command_self);
|
||||||
|
command_bind("unsilence", NULL, (SIGNAL_FUNC) cmd_unsilence);
|
||||||
command_bind("sconnect", NULL, (SIGNAL_FUNC) cmd_sconnect);
|
command_bind("sconnect", NULL, (SIGNAL_FUNC) cmd_sconnect);
|
||||||
/* SYNTAX: SQUERY <service> [<commands>] */
|
/* SYNTAX: SQUERY <service> [<commands>] */
|
||||||
command_bind("squery", NULL, (SIGNAL_FUNC) command_2self);
|
command_bind("squery", NULL, (SIGNAL_FUNC) command_2self);
|
||||||
@ -1011,6 +1025,7 @@ void irc_commands_deinit(void)
|
|||||||
command_unbind("version", (SIGNAL_FUNC) command_self);
|
command_unbind("version", (SIGNAL_FUNC) command_self);
|
||||||
command_unbind("servlist", (SIGNAL_FUNC) command_self);
|
command_unbind("servlist", (SIGNAL_FUNC) command_self);
|
||||||
command_unbind("silence", (SIGNAL_FUNC) command_self);
|
command_unbind("silence", (SIGNAL_FUNC) command_self);
|
||||||
|
command_unbind("unsilence", (SIGNAL_FUNC) cmd_unsilence);
|
||||||
command_unbind("sconnect", (SIGNAL_FUNC) cmd_sconnect);
|
command_unbind("sconnect", (SIGNAL_FUNC) cmd_sconnect);
|
||||||
command_unbind("squery", (SIGNAL_FUNC) command_2self);
|
command_unbind("squery", (SIGNAL_FUNC) command_2self);
|
||||||
command_unbind("deop", (SIGNAL_FUNC) cmd_deop);
|
command_unbind("deop", (SIGNAL_FUNC) cmd_deop);
|
||||||
|
Loading…
Reference in New Issue
Block a user