cmd_down added
[NeonServV5.git] / cmd_neonserv_down.c
diff --git a/cmd_neonserv_down.c b/cmd_neonserv_down.c
new file mode 100644 (file)
index 0000000..1eff93f
--- /dev/null
@@ -0,0 +1,18 @@
+
+/*
+* no arguments
+*/
+
+static CMD_BIND(neonserv_cmd_down) {
+    struct ChanUser *chanuser = getChanUser(user, chan);
+    if(!chanuser) {
+        reply(getTextBot(), user, "NS_NOT_ON_CHANNEL_YOU", chan->name);
+        return;
+    }
+    if((chanuser->flags & CHANUSERFLAG_OPPED)) {
+        putsock(client, "MODE %s -ov %s %s", chan->name, user->nick, user->nick);
+    } else if((chanuser->flags & CHANUSERFLAG_VOICED)) {
+        putsock(client, "MODE %s -v %s", chan->name, user->nick);
+    } else
+        reply(getTextBot(), user, "NS_DOWN_ALREADY", chan->name);
+}