summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-02 12:30:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-05-02 12:30:01 +0000
commit7b3f2150387d9e5d9468ad2eaaacef0acc08564d (patch)
treeb8640a7ef9ad3b440b050914a8ad936cfb29e294 /src/inspircd.cpp
parent7d0fc076616482c78d197cfda9d5bd7e075d43d0 (diff)
Added oper-override module
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@779 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp107
1 files changed, 56 insertions, 51 deletions
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))