From 7b3f2150387d9e5d9468ad2eaaacef0acc08564d Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 2 May 2004 12:30:01 +0000 Subject: Added oper-override module git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@779 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 107 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 51 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index dc7b7942a..4250bdc75 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1312,7 +1312,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri { int MOD_RESULT = 0; FOREACH_RESULT(OnUserPreJoin(user,NULL,cname)); - if (MOD_RESULT) { + if (MOD_RESULT == 1) { return NULL; } @@ -1350,76 +1350,81 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri { int MOD_RESULT = 0; FOREACH_RESULT(OnUserPreJoin(user,Ptr,cname)); - if (MOD_RESULT) { + if (MOD_RESULT == 1) { return NULL; } - if (strcmp(Ptr->key,"")) + if (MOD_RESULT == 0) { - log(DEBUG,"add_channel: %s has key %s",Ptr->name,Ptr->key); - if (!key) - { - log(DEBUG,"add_channel: no key given in JOIN"); - WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name); - return NULL; - } - else + + if (strcmp(Ptr->key,"")) { - log(DEBUG,"key at %p is %s",key,key); - if (strcasecmp(key,Ptr->key)) + log(DEBUG,"add_channel: %s has key %s",Ptr->name,Ptr->key); + if (!key) { - log(DEBUG,"add_channel: bad key given in JOIN"); - WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name); + log(DEBUG,"add_channel: no key given in JOIN"); + WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name); return NULL; } + else + { + log(DEBUG,"key at %p is %s",key,key); + if (strcasecmp(key,Ptr->key)) + { + log(DEBUG,"add_channel: bad key given in JOIN"); + WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name); + return NULL; + } + } } - } - log(DEBUG,"add_channel: no key"); - - if (Ptr->inviteonly) - { - log(DEBUG,"add_channel: channel is +i"); - if (user->IsInvited(Ptr->name)) - { - /* user was invited to channel */ - /* there may be an optional channel NOTICE here */ - } - else + log(DEBUG,"add_channel: no key"); + + if (Ptr->inviteonly) { - WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name); - return NULL; + log(DEBUG,"add_channel: channel is +i"); + if (user->IsInvited(Ptr->name)) + { + /* user was invited to channel */ + /* there may be an optional channel NOTICE here */ + } + else + { + WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name); + return NULL; + } } - } - log(DEBUG,"add_channel: channel is not +i"); - - if (Ptr->limit) - { - if (usercount(Ptr) == Ptr->limit) + log(DEBUG,"add_channel: channel is not +i"); + + if (Ptr->limit) { - WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name); - return NULL; + if (usercount(Ptr) == Ptr->limit) + { + WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name); + return NULL; + } } - } - - log(DEBUG,"add_channel: about to walk banlist"); - - /* check user against the channel banlist */ - if (Ptr) - { - if (Ptr->bans.size()) + + log(DEBUG,"add_channel: about to walk banlist"); + + /* check user against the channel banlist */ + if (Ptr) { - for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++) + if (Ptr->bans.size()) { - if (match(user->GetFullHost(),i->data)) + for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++) { - WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); - return NULL; + if (match(user->GetFullHost(),i->data)) + { + WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); + return NULL; + } } } } - } + + log(DEBUG,"add_channel: bans checked"); - log(DEBUG,"add_channel: bans checked"); + } if ((Ptr) && (user)) -- cgit v1.2.3