]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Don't send out UID for users that are quitting, because the QUIT won't be sent and...
[user/henk/code/inspircd.git] / src / channels.cpp
index 4435b3324cb6205cfae8f3a538615b7a796d7f20..99b118d0dc90e1cb15c0d8e100fa2af2cd0c2803 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -34,27 +34,22 @@ Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : Serv
 void Channel::SetMode(char mode,bool mode_on)
 {
        modes[mode-65] = mode_on;
-       if (!mode_on)
-               this->SetModeParam(mode,"",false);
 }
 
-
-void Channel::SetModeParam(char mode,const char* parameter,bool mode_on)
+void Channel::SetMode(char mode, std::string parameter)
 {
        CustomModeList::iterator n = custom_mode_params.find(mode);
-
-       if (mode_on)
+       // always erase, even if changing, so that the map gets the new value
+       if (n != custom_mode_params.end())
+               custom_mode_params.erase(n);
+       if (parameter.empty())
        {
-               if (n == custom_mode_params.end())
-                       custom_mode_params[mode] = strdup(parameter);
+               modes[mode-65] = false;
        }
        else
        {
-               if (n != custom_mode_params.end())
-               {
-                       free(n->second);
-                       custom_mode_params.erase(n);
-               }
+               custom_mode_params[mode] = parameter;
+               modes[mode-65] = true;
        }
 }
 
@@ -393,13 +388,10 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                                        }
                                }
 
-                               if (Ptr->bans.size())
+                               if (Ptr->IsBanned(user) && !can_bypass)
                                {
-                                       if (Ptr->IsBanned(user) && !can_bypass)
-                                       {
-                                               user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), Ptr->name.c_str());
-                                               return NULL;
-                                       }
+                                       user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), Ptr->name.c_str());
+                                       return NULL;
                                }
 
                                /*