]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Added m_cycle and added it to all the appropriate locations.
authorJD Horelick <redacted>
Mon, 15 Mar 2010 19:35:32 +0000 (15:35 -0400)
committerJD Horelick <redacted>
Mon, 15 Mar 2010 19:35:32 +0000 (15:35 -0400)
NEWS
TODO-SHADOW
doc/example.conf
doc/reference.conf
extensions/Makefile.in
extensions/README
extensions/m_cycle.c [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 640496211d7861dc2bb22c38328874c8e4146fe5..b60320a42a4c6aefc848643fc08c26c260269c44 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ new configuration options
 - general::no_part_messages - If this option is set to no, the ircd will not
   display PART messages/reasons from users.
 
+new commands
+- /CYCLE - server-side /CYCLE, also called /HOP in some clients/servers.
+
 -- shadowircd-6.0.0
 
 new modes
index 7314bed5d33902a9ff4a5b4576f0b57bdb21cdeb..b5b06fd0026b9c710d351402ef89f9aac75e2846 100644 (file)
@@ -7,7 +7,6 @@ Todo list for ShadowIRCd 6.1
 * clean disable/removal of modes on rehash, if possible without being ugly
 * Allow disabling of commands in auth {} blocks.
 * Add default_operhost to /set
-* /cycle
 
 Todo list for ShadowIRCd 6.2
 ----------------------------
index 825bff8bf0ad734bf2e0a9b50e67345e2795e414..c70151c811e4bb0136afa6f7cb8b2e7b063e4de6 100755 (executable)
@@ -32,6 +32,7 @@ loadmodule "extensions/m_identify.so";
 loadmodule "extensions/m_mkpasswd.so";
 loadmodule "extensions/m_webirc.so";
 #loadmodule "extensions/m_adminwall.so";
+#loadmodule "extensions/m_cycle.so";
 #loadmodule "extensions/m_oaccept.so";
 #loadmodule "extensions/m_opme.so";
 #loadmodule "extensions/m_ojoin.so";
index 56d1894a0d297a78ea919f6f7153e34a82f2f0a6..c121af99f22b9da770fdf6fbfe42baf01b0eb554 100755 (executable)
@@ -67,6 +67,7 @@
  * /mkpassword support                               -- m_mkpasswd.so
  * WEBIRC support                                    -- m_webirc.so
  * Send message to all admins network-wide           -- m_adminwall.so
+ * Server-side /CYCLE                                -- m_cycle.so
  * /oaccept - add to target's accept list, oper only -- m_oaccept.so
  * /opme - op self in opless channels, admin only    -- m_opme.so
  * /ojoin - join despite restrictions, admin only    -- m_ojoin.so
@@ -102,6 +103,7 @@ loadmodule "extensions/m_identify.so";
 loadmodule "extensions/m_mkpasswd.so";
 loadmodule "extensions/m_webirc.so";
 #loadmodule "extensions/m_adminwall.so";
+#loadmodule "extensions/m_cycle.so";
 #loadmodule "extensions/m_oaccept.so";
 #loadmodule "extensions/m_opme.so";
 #loadmodule "extensions/m_ojoin.so";
index 7a529499442cc7ab2b63d9ab94a55e13badc2085..d11e41c20752e93ad7d5bd77585323c1fc58af33 100644 (file)
@@ -52,6 +52,7 @@ SRCS =                          \
   sno_whois.c                  \
   m_42.c                       \
   m_adminwall.c                        \
+  m_cycle.c                    \
   m_findforwards.c             \
   m_force.c                    \
   m_identify.c                 \
index 6cc086cd9e0299acbfb49274c0c621a2d363329c..9ba97b1e6d106e22ab408af6101692921931405a 100644 (file)
@@ -19,6 +19,9 @@ m_42.c         - The Answer to Life, the Universe, and Everything.
 m_adminwall.c  - Sends a message to all admins network-wide (umode +a)
                  Syntax: ADMINWALL :<message>
 
+m_cycle - Server-side /CYCLE (also called /HOP in some clients/servers).
+          Syntax: CYCLE <#channel>
+
 m_findforwards.c - Find channels that forward (+f) to a given channel.
                    Syntax: FINDFORWARDS <channel>
 
diff --git a/extensions/m_cycle.c b/extensions/m_cycle.c
new file mode 100644 (file)
index 0000000..a0e8933
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * m_cycle.c: server-side CYCLE
+ *
+ * Copyright (c) 2010 The ShadowIRCd team
+ */
+#include "stdinc.h"
+#include "common.h"
+#include "channel.h"
+#include "client.h"
+#include "hash.h"
+#include "match.h"
+#include "ircd.h"
+#include "numeric.h"
+#include "send.h"
+#include "s_conf.h"
+#include "s_serv.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+#include "packet.h"
+#include "hook.h"
+
+extern struct module **modlist;
+
+static int m_cycle(struct Client *, struct Client *, int, const char **);
+
+struct Message cycle_msgtab = {
+       "CYCLE", 0, 0, 0, MFLG_SLOW,
+       {mg_unreg, {m_cycle, 2}, {m_cycle, 2}, mg_ignore, mg_ignore, {m_cycle, 2}}
+};
+mapi_clist_av1 cycle_clist[] = { &cycle_msgtab, NULL };
+
+DECLARE_MODULE_AV1(cycle, NULL, NULL, cycle_clist, NULL, NULL, "$Revision$");
+
+static int
+m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+{
+       char *p, *name;
+       char *s = LOCAL_COPY(parv[1]);  
+       struct Channel *chptr;
+       struct membership *msptr;
+
+       name = rb_strtok_r(s, ",", &p);
+
+       /* Finish the flood grace period... */
+       if(MyClient(source_p) && !IsFloodDone(source_p))
+               flood_endgrace(source_p);
+
+       while(name)
+       {
+               if((chptr = find_channel(name)) == NULL)
+               {
+                       sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
+                       return 0;
+               }
+
+               msptr = find_channel_membership(chptr, source_p);
+               if(msptr == NULL)
+               {
+                       sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
+                       return 0;
+               }
+
+               if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
+                       check_spambot_warning(source_p, NULL);
+                       
+               if((is_any_op(msptr) || !MyConnect(source_p) ||
+                                ((can_send(chptr, source_p, msptr) > 0 &&
+                                  (source_p->localClient->firsttime +
+                                   ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time()))))
+               {
+                       sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
+                                     ":%s PART %s :Cycling", use_id(source_p), chptr->chname);
+                       sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :Cycling",
+                                            source_p->name, source_p->username,
+                                            source_p->host, chptr->chname);
+               }
+               else
+               {
+                       sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
+                                     ":%s PART %s", use_id(source_p), chptr->chname);
+                       sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
+                                            source_p->name, source_p->username,
+                                            source_p->host, chptr->chname);
+               }
+               
+               remove_user_from_channel(msptr);
+               
+               chptr = NULL;
+               msptr = NULL;
+               
+               name = rb_strtok_r(NULL, ",", &p);
+       }
+       
+       user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);
+
+       return 0;
+}