jdhore avatar jdhore committed 9e940d6

Added m_cycle and added it to all the appropriate locations.

Comments (0)

Files changed (7)

 - 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
 * 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
 ----------------------------
 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";

doc/reference.conf

  * /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
 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";

extensions/Makefile.in

   sno_whois.c			\
   m_42.c			\
   m_adminwall.c			\
+  m_cycle.c			\
   m_findforwards.c		\
   m_force.c			\
   m_identify.c			\

extensions/README

 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>
 

extensions/m_cycle.c

+/*
+ * 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;
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.