summary refs log tree commit diff stats
diff options
context:
space:
mode:
authord-browne <d.browne@hackplex.com>2016-08-10 21:53:30 -0700
committerTingPing <tingping@tingping.se>2016-10-11 09:58:56 -0400
commitebc40fe9c7d5a158601335548e40dd53098ac02c (patch)
tree960ae0ff1ef8e64d3c520d1f4d18882c3069d1a2
parentc0aa47c7a18dbcdf1a2900f251466fdd9c9c4f18 (diff)
Added MHOP command
-rw-r--r--src/common/outbound.c29
1 files changed, 29 insertions, 0 deletions
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
@@ -1338,6 +1338,33 @@ cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 }
 
 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)
 {
 	if (!user->op && !user->me)
@@ -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},