Added m_cycle and added it to all the appropriate locations.

This commit is contained in:
JD Horelick 2010-03-15 15:35:32 -04:00
parent 3c0f833420
commit 853058531a
7 changed files with 108 additions and 1 deletions

3
NEWS
View File

@ -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

View 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
----------------------------

View File

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

View File

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

View 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 \

View 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>

98
extensions/m_cycle.c Normal file
View File

@ -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;
}