]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
fixes to /STATS P
[user/henk/code/inspircd.git] / src / inspircd.cpp
index dc7b7942aa97bcad0b1b1a5685df7076f504654a..4250bdc75e9147a8bb1e40a0cca079fa1d4f2550 100644 (file)
@@ -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))