From ebc40fe9c7d5a158601335548e40dd53098ac02c Mon Sep 17 00:00:00 2001 From: d-browne Date: Wed, 10 Aug 2016 21:53:30 -0700 Subject: Added MHOP command --- src/common/outbound.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/common') diff --git a/src/common/outbound.c b/src/common/outbound.c index 53ebe276..61626821 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -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 , 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] [-k,] [-m] [-pX] [-r] [-tX] {ADD|DEL} [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}, -- cgit 1.4.1