]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Allow static build of inspircd without module support
[user/henk/code/inspircd.git] / src / channels.cpp
index d0d8e52c5bc8daaeb1ec102027cb62e51695c888..3f0fc4a36271077bc78b15f056b86a109210c6c7 100644 (file)
@@ -228,7 +228,10 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
                }
                else
                {
-                       if (user->chans.size() >= user->GetClass()->maxchans)
+                       unsigned int maxchans = user->GetClass()->maxchans;
+                       if (!maxchans)
+                               maxchans = ServerInstance->Config->MaxChans;
+                       if (user->chans.size() >= maxchans)
                        {
                                user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
                                return NULL;
@@ -374,7 +377,9 @@ Channel* Channel::ForceChan(Channel* Ptr, User* user, const std::string &privs,
        Ptr->WriteAllExcept(user, false, 0, except_list, "JOIN :%s", Ptr->name.c_str());
 
        /* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
-       std::string ms = ServerInstance->Modes->ModeString(user, Ptr);
+       std::string ms = memb->modes;
+       for(unsigned int i=0; i < memb->modes.length(); i++)
+               ms.append(" ").append(user->nick);
        if ((Ptr->GetUserCounter() > 1) && (ms.length()))
                Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name.c_str(), ms.c_str());
 
@@ -480,16 +485,6 @@ void Channel::PartUser(User *user, std::string &reason)
        this->DelUser(user);
 }
 
-void Channel::ServerKickUser(User* user, const char* reason, const std::string& servername)
-{
-       if (servername.empty() || !ServerInstance->Config->HideWhoisServer.empty())
-               ServerInstance->FakeClient->server = ServerInstance->Config->ServerName;
-       else
-               ServerInstance->FakeClient->server = servername;
-
-       KickUser(ServerInstance->FakeClient, user, reason);
-}
-
 void Channel::KickUser(User *src, User *user, const char* reason)
 {
        if (!src || !user || !reason)
@@ -651,19 +646,19 @@ void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList
 
 void Channel::RawWriteAllExcept(User* user, bool serversource, char status, CUList &except_list, const std::string &out)
 {
-       char statmode = 0;
+       unsigned int minrank = 0;
        if (status)
        {
                ModeHandler* mh = ServerInstance->Modes->FindPrefix(status);
                if (mh)
-                       statmode = mh->GetModeChar();
+                       minrank = mh->GetPrefixRank();
        }
        for (UserMembIter i = userlist.begin(); i != userlist.end(); i++)
        {
-               if ((IS_LOCAL(i->first)) && (except_list.find(i->first) == except_list.end()))
+               if (IS_LOCAL(i->first) && (except_list.find(i->first) == except_list.end()))
                {
-                       /* User doesnt have the status we're after */
-                       if (statmode && !i->second->hasMode(statmode))
+                       /* User doesn't have the status we're after */
+                       if (minrank && i->second->getRank() < minrank)
                                continue;
 
                        i->first->Write(out);