Added MHOP command

This commit is contained in:
d-browne 2016-08-10 21:53:30 -07:00 committed by TingPing
parent c0aa47c7a1
commit ebc40fe9c7

View File

@ -1337,6 +1337,33 @@ cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[])
return FALSE;
}
static int
mhop_cb (struct User *user, multidata *data)
{
if (!user->hop)
{
data->nicks[data->i] = user->nick;
data->i++;
}
return TRUE;
}
static int
cmd_mhop (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
char **nicks = g_new0 (char *, sess->total - sess->hops);
multidata data;
data.nicks = nicks;
data.i = 0;
tree_foreach (sess->usertree, (tree_traverse_func *)mhop_cb, &data);
send_channel_modes (sess, tbuf, nicks, 0, data.i, '+', 'h', 0);
g_free (nicks);
return TRUE;
}
static int
mkick_cb (struct User *user, multidata *data)
{
@ -3970,6 +3997,8 @@ const struct commands xc_cmds[] = {
N_("ME <action>, sends the action to the current channel (actions are written in the 3rd person, like /me jumps)")},
{"MENU", cmd_menu, 0, 0, 1, "MENU [-eX] [-i<ICONFILE>] [-k<mod>,<key>] [-m] [-pX] [-r<X,group>] [-tX] {ADD|DEL} <path> [command] [unselect command]\n"
" See http://hexchat.readthedocs.org/en/latest/plugins.html#controlling-the-gui for more details."},
{"MHOP", cmd_mhop, 1, 1, 1,
N_("MHOP, Mass hop's all users in the current channel (needs chanop)")},
{"MKICK", cmd_mkick, 1, 1, 1,
N_("MKICK, Mass kicks everyone except you in the current channel (needs chanop)")},
{"MODE", cmd_mode, 1, 0, 1, 0},