]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Update make help, configure, and fix build of empty m_* directories
[user/henk/code/inspircd.git] / src / users.cpp
index 4940df24ebd2d90a03d4543f98a8a27f39225e3d..b361205da7aa1053fc0ca50288d4111c94f6fea7 100644 (file)
@@ -28,11 +28,8 @@ static unsigned long* already_sent = NULL;
 LocalIntExt User::NICKForced("NICKForced", NULL);
 LocalStringExt User::OperQuit("OperQuit", NULL);
 
-static bool dummy_init = Extensible::Register(&User::NICKForced) ^ Extensible::Register(&User::OperQuit);
-
 void InitializeAlreadySent(SocketEngine* SE)
 {
-       (void)dummy_init;
        already_sent = new unsigned long[SE->GetMaxFds()];
        memset(already_sent, 0, SE->GetMaxFds() * sizeof(unsigned long));
 }
@@ -112,9 +109,9 @@ void User::StartDNSLookup()
                UserResolver *res_reverse;
 
                QueryType resolvtype = this->client_sa.sa.sa_family == AF_INET6 ? DNS_QUERY_PTR6 : DNS_QUERY_PTR4;
-               res_reverse = new UserResolver(this->ServerInstance, this, sip, resolvtype, cached);
+               res_reverse = new UserResolver(ServerInstance, this, sip, resolvtype, cached);
 
-               this->ServerInstance->AddResolver(res_reverse, cached);
+               ServerInstance->AddResolver(res_reverse, cached);
        }
        catch (CoreException& e)
        {
@@ -208,7 +205,7 @@ void User::DecrementModes()
        }
 }
 
-User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance)
+User::User(InspIRCd* Instance, const std::string &uid)
 {
        server = Instance->FindServerNamePtr(Instance->Config->ServerName);
        age = ServerInstance->Time();
@@ -719,7 +716,7 @@ void User::FlushWriteBuf()
                        this->bytes_out += n_sent;
                        this->cmds_out++;
                        if (n_sent != old_sendq_length)
-                               this->ServerInstance->SE->WantWrite(this);
+                               ServerInstance->SE->WantWrite(this);
                }
        }
 
@@ -1222,7 +1219,7 @@ void User::Write(const std::string& text)
                this->AddWriteBuf("\r\n");
        }
        ServerInstance->stats->statsSent += text.length() + 2;
-       this->ServerInstance->SE->WantWrite(this);
+       ServerInstance->SE->WantWrite(this);
 }
 
 /** Write()
@@ -1365,8 +1362,8 @@ void User::WriteCommon(const std::string &text)
 
        for (UCListIter v = this->chans.begin(); v != this->chans.end(); v++)
        {
-               CUList* ulist = v->first->GetUsers();
-               for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
+               const UserMembList* ulist = (*v)->GetUsers();
+               for (UserMembList::const_iterator i = ulist->begin(); i != ulist->end(); i++)
                {
                        if ((IS_LOCAL(i->first)) && (already_sent[i->first->fd] != uniq_id))
                        {
@@ -1424,8 +1421,8 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op
 
        for (UCListIter v = this->chans.begin(); v != this->chans.end(); v++)
        {
-               CUList *ulist = v->first->GetUsers();
-               for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
+               const UserMembList* ulist = (*v)->GetUsers();
+               for (UserMembList::const_iterator i = ulist->begin(); i != ulist->end(); i++)
                {
                        if (this != i->first)
                        {
@@ -1457,8 +1454,8 @@ void User::WriteCommonExcept(const std::string &text)
 
        for (UCListIter v = this->chans.begin(); v != this->chans.end(); v++)
        {
-               CUList *ulist = v->first->GetUsers();
-               for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
+               const UserMembList* ulist = (*v)->GetUsers();
+               for (UserMembList::const_iterator i = ulist->begin(); i != ulist->end(); i++)
                {
                        if (this != i->first)
                        {
@@ -1524,7 +1521,7 @@ bool User::SharesChannelWith(User *other)
                /* Eliminate the inner loop (which used to be ~equal in size to the outer loop)
                 * by replacing it with a map::find which *should* be more efficient
                 */
-               if (i->first->HasUser(other))
+               if ((*i)->HasUser(other))
                        return true;
        }
        return false;
@@ -1567,18 +1564,18 @@ void User::DoHostCycle(const std::string &quitline)
 
        for (UCListIter v = this->chans.begin(); v != this->chans.end(); v++)
        {
-               Channel* c = v->first;
+               Channel* c = *v;
                snprintf(buffer, MAXBUF, ":%s JOIN %s", GetFullHost().c_str(), c->name.c_str());
                std::string joinline(buffer);
-               std::string modeline = this->ServerInstance->Modes->ModeString(this, c);
+               std::string modeline = ServerInstance->Modes->ModeString(this, c);
                if (modeline.length() > 0)
                {
                        snprintf(buffer, MAXBUF, ":%s MODE %s +%s", GetFullHost().c_str(), c->name.c_str(), modeline.c_str());
                        modeline = buffer;
                }
 
-               CUList *ulist = c->GetUsers();
-               for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
+               const UserMembList *ulist = c->GetUsers();
+               for (UserMembList::const_iterator i = ulist->begin(); i != ulist->end(); i++)
                {
                        User* u = i->first;
                        if (u == this || !IS_LOCAL(u))
@@ -1670,13 +1667,14 @@ std::string User::ChannelList(User* source)
 
        for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++)
        {
+               Channel* c = *i;
                /* If the target is the same as the sender, let them see all their channels.
                 * If the channel is NOT private/secret OR the user shares a common channel
                 * If the user is an oper, and the <options:operspywhois> option is set.
                 */
-               if ((source == this) || (IS_OPER(source) && ServerInstance->Config->OperSpyWhois) || (((!i->first->IsModeSet('p')) && (!i->first->IsModeSet('s'))) || (i->first->HasUser(source))))
+               if ((source == this) || (IS_OPER(source) && ServerInstance->Config->OperSpyWhois) || (((!c->IsModeSet('p')) && (!c->IsModeSet('s'))) || (c->HasUser(source))))
                {
-                       list.append(i->first->GetPrefixChar(this)).append(i->first->name).append(" ");
+                       list.append(c->GetPrefixChar(this)).append(c->name).append(" ");
                }
        }
 
@@ -1842,13 +1840,14 @@ void User::PurgeEmptyChannels()
        // firstly decrement the count on each channel
        for (UCListIter f = this->chans.begin(); f != this->chans.end(); f++)
        {
-               f->first->RemoveAllPrefixes(this);
-               if (f->first->DelUser(this) == 0)
+               Channel* c = *f;
+               c->RemoveAllPrefixes(this);
+               if (c->DelUser(this) == 0)
                {
                        /* No users left in here, mark it for deletion */
                        try
                        {
-                               to_delete.push_back(f->first);
+                               to_delete.push_back(c);
                        }
                        catch (...)
                        {