X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/212380e3f42f585dc1ea927402252eb943f91f7b..b2c208be091670e3c5259eba77187bae6ac6eece:/modules/m_knock.c?ds=sidebyside diff --git a/modules/m_knock.c b/modules/m_knock.c index ed7c3590..e85cce39 100644 --- a/modules/m_knock.c +++ b/modules/m_knock.c @@ -20,16 +20,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_knock.c 752 2006-02-11 20:55:03Z jilles $ + * $Id: m_knock.c 3570 2007-09-09 19:19:23Z jilles $ */ #include "stdinc.h" -#include "sprintf_irc.h" -#include "tools.h" #include "channel.h" #include "client.h" #include "hash.h" -#include "irc_string.h" +#include "match.h" #include "ircd.h" #include "numeric.h" #include "send.h" @@ -47,10 +45,9 @@ struct Message knock_msgtab = { }; mapi_clist_av1 knock_clist[] = { &knock_msgtab, NULL }; -DECLARE_MODULE_AV1(knock, NULL, NULL, knock_clist, NULL, NULL, "$Revision: 752 $"); +DECLARE_MODULE_AV1(knock, NULL, NULL, knock_clist, NULL, NULL, "$Revision: 3570 $"); /* m_knock - * parv[0] = sender prefix * parv[1] = channel * * The KNOCK command has the following syntax: @@ -82,13 +79,6 @@ m_knock(struct Client *client_p, struct Client *source_p, int parc, const char * if((p = strchr(name, ','))) *p = '\0'; - if(!IsChannelName(name)) - { - sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, - form_str(ERR_NOSUCHCHANNEL), name); - return 0; - } - if((chptr = find_channel(name)) == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, @@ -106,7 +96,7 @@ m_knock(struct Client *client_p, struct Client *source_p, int parc, const char * if(!((chptr->mode.mode & MODE_INVITEONLY) || (*chptr->mode.key) || (chptr->mode.limit && - dlink_list_length(&chptr->members) >= (unsigned long)chptr->mode.limit))) + rb_dlink_list_length(&chptr->members) >= (unsigned long)chptr->mode.limit))) { sendto_one_numeric(source_p, ERR_CHANOPEN, form_str(ERR_CHANOPEN), name); @@ -125,8 +115,8 @@ m_knock(struct Client *client_p, struct Client *source_p, int parc, const char * if(MyClient(source_p)) { /* don't allow a knock if the user is banned */ - if(is_banned(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN || - is_quieted(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN) + if(is_banned(chptr, source_p, NULL, NULL, NULL, NULL) == CHFL_BAN || + is_quieted(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN) { sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), name); @@ -138,13 +128,13 @@ m_knock(struct Client *client_p, struct Client *source_p, int parc, const char * * allow one knock per channel per knock_delay_channel */ if(!IsOper(source_p) && - (source_p->localClient->last_knock + ConfigChannel.knock_delay) > CurrentTime) + (source_p->localClient->last_knock + ConfigChannel.knock_delay) > rb_current_time()) { sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), me.name, source_p->name, name, "user"); return 0; } - else if((chptr->last_knock + ConfigChannel.knock_delay_channel) > CurrentTime) + else if((chptr->last_knock + ConfigChannel.knock_delay_channel) > rb_current_time()) { sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), me.name, source_p->name, name, "channel"); @@ -152,16 +142,17 @@ m_knock(struct Client *client_p, struct Client *source_p, int parc, const char * } /* ok, we actually can send the knock, tell client */ - source_p->localClient->last_knock = CurrentTime; + source_p->localClient->last_knock = rb_current_time(); sendto_one(source_p, form_str(RPL_KNOCKDLVR), me.name, source_p->name, name); } - chptr->last_knock = CurrentTime; + chptr->last_knock = rb_current_time(); if(ConfigChannel.use_knock) - sendto_channel_local(ONLY_CHANOPS, chptr, form_str(RPL_KNOCK), + sendto_channel_local(chptr->mode.mode & MODE_FREEINVITE ? ALL_MEMBERS : ONLY_CHANOPS, + chptr, form_str(RPL_KNOCK), me.name, name, name, source_p->name, source_p->username, source_p->host);