mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
/SET kick_first_on_kickban for /KICKBAN and /KNOCKOUT - patch by
Jakub Jankowski <shasta@irc.pl> git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1469 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c61edaf7c9
commit
4a2c02a6af
@ -695,7 +695,7 @@ static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
|
|||||||
WI_ITEM_REC *item)
|
WI_ITEM_REC *item)
|
||||||
{
|
{
|
||||||
IRC_CHANNEL_REC *chanrec;
|
IRC_CHANNEL_REC *chanrec;
|
||||||
char *channel, *nicks, *reason, *str;
|
char *channel, *nicks, *reason, *kickcmd, *bancmd;
|
||||||
char **nicklist, *spacenicks;
|
char **nicklist, *spacenicks;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
|
||||||
@ -720,15 +720,20 @@ static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
|
|||||||
spacenicks = g_strjoinv(" ", nicklist);
|
spacenicks = g_strjoinv(" ", nicklist);
|
||||||
g_strfreev(nicklist);
|
g_strfreev(nicklist);
|
||||||
|
|
||||||
str = g_strdup_printf("%s %s", chanrec->name, spacenicks);
|
kickcmd = g_strdup_printf("%s %s %s", chanrec->name, nicks, reason);
|
||||||
signal_emit("command ban", 3, str, server, channel);
|
bancmd = g_strdup_printf("%s %s", chanrec->name, spacenicks);
|
||||||
g_free(str);
|
|
||||||
|
|
||||||
str = g_strdup_printf("%s %s %s", chanrec->name, nicks, reason);
|
|
||||||
signal_emit("command kick", 3, str, server, channel);
|
|
||||||
g_free(str);
|
|
||||||
|
|
||||||
g_free(spacenicks);
|
g_free(spacenicks);
|
||||||
|
|
||||||
|
if (settings_get_bool("kick_first_on_kickban")) {
|
||||||
|
signal_emit("command kick", 3, kickcmd, server, channel);
|
||||||
|
signal_emit("command ban", 3, bancmd, server, channel);
|
||||||
|
} else {
|
||||||
|
signal_emit("command ban", 3, bancmd, server, channel);
|
||||||
|
signal_emit("command kick", 3, kickcmd, server, channel);
|
||||||
|
}
|
||||||
|
g_free(kickcmd);
|
||||||
|
g_free(bancmd);
|
||||||
|
|
||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +784,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
|
|||||||
IRC_CHANNEL_REC *channel)
|
IRC_CHANNEL_REC *channel)
|
||||||
{
|
{
|
||||||
KNOCKOUT_REC *rec;
|
KNOCKOUT_REC *rec;
|
||||||
char *nicks, *reason, *timeoutstr, *str;
|
char *nicks, *reason, *timeoutstr, *kickcmd, *bancmd;
|
||||||
char **nicklist, *spacenicks, *banmasks;
|
char **nicklist, *spacenicks, *banmasks;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
int timeleft;
|
int timeleft;
|
||||||
@ -813,15 +818,21 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
|
|||||||
banmasks = ban_get_masks(channel, spacenicks, 0);
|
banmasks = ban_get_masks(channel, spacenicks, 0);
|
||||||
g_free(spacenicks);
|
g_free(spacenicks);
|
||||||
|
|
||||||
if (*banmasks != '\0') {
|
kickcmd = g_strdup_printf("%s %s %s", channel->name, nicks, reason);
|
||||||
str = g_strdup_printf("%s %s", channel->name, banmasks);
|
bancmd = *banmasks == '\0'? NULL :
|
||||||
signal_emit("command ban", 3, str, server, channel);
|
g_strdup_printf("%s %s", channel->name, banmasks);
|
||||||
g_free(str);
|
|
||||||
|
if (settings_get_bool("kick_first_on_kickban")) {
|
||||||
|
signal_emit("command kick", 3, kickcmd, server, channel);
|
||||||
|
if (bancmd != NULL)
|
||||||
|
signal_emit("command ban", 3, bancmd, server, channel);
|
||||||
|
} else {
|
||||||
|
if (bancmd != NULL)
|
||||||
|
signal_emit("command ban", 3, bancmd, server, channel);
|
||||||
|
signal_emit("command kick", 3, kickcmd, server, channel);
|
||||||
}
|
}
|
||||||
|
g_free(kickcmd);
|
||||||
str = g_strdup_printf("%s %s %s", channel->name, nicks, reason);
|
g_free_not_null(bancmd);
|
||||||
signal_emit("command kick", 3, str, server, channel);
|
|
||||||
g_free(str);
|
|
||||||
|
|
||||||
if (*banmasks == '\0')
|
if (*banmasks == '\0')
|
||||||
g_free(banmasks);
|
g_free(banmasks);
|
||||||
@ -983,6 +994,7 @@ void irc_commands_init(void)
|
|||||||
settings_add_str("misc", "part_message", "");
|
settings_add_str("misc", "part_message", "");
|
||||||
settings_add_int("misc", "knockout_time", 300);
|
settings_add_int("misc", "knockout_time", 300);
|
||||||
settings_add_str("misc", "wall_format", "[Wall/$0] $1-");
|
settings_add_str("misc", "wall_format", "[Wall/$0] $1-");
|
||||||
|
settings_add_bool("misc", "kick_first_on_kickban", FALSE);
|
||||||
|
|
||||||
knockout_tag = g_timeout_add(KNOCKOUT_TIMECHECK, (GSourceFunc) knockout_timeout, NULL);
|
knockout_tag = g_timeout_add(KNOCKOUT_TIMECHECK, (GSourceFunc) knockout_timeout, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user