diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd_kill.cpp | 2 | ||||
-rw-r--r-- | src/cmd_nick.cpp | 12 | ||||
-rw-r--r-- | src/cmd_pass.cpp | 2 | ||||
-rw-r--r-- | src/cmd_quit.cpp | 4 | ||||
-rw-r--r-- | src/cmd_user.cpp | 6 | ||||
-rw-r--r-- | src/cmd_whois.cpp | 2 | ||||
-rw-r--r-- | src/command_parse.cpp | 4 | ||||
-rw-r--r-- | src/dnsqueue.cpp | 8 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 19 | ||||
-rw-r--r-- | src/message.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_alias.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_blockamsg.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 52 | ||||
-rw-r--r-- | src/userprocess.cpp | 14 | ||||
-rw-r--r-- | src/users.cpp | 12 |
15 files changed, 71 insertions, 72 deletions
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index ba9ac9dc7..0084da9dc 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -65,7 +65,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) clientlist.erase(iter); } - if (u->registered == 7) + if (u->registered == REG_ALL) { purge_empty_chans(u); } diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 17dfa626e..c13040af5 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -79,7 +79,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0])); if (MOD_RESULT) return; - if (user->registered == 7) + if (user->registered == REG_ALL) WriteCommon(user,"NICK %s",parameters[0]); strlcpy(user->nick, parameters[0], NICKMAX - 1); FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick)); @@ -109,7 +109,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) return; } - if (user->registered == 7) + if (user->registered == REG_ALL) { int MOD_RESULT = 0; FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0])); @@ -134,9 +134,9 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) log(DEBUG,"new nick set: %s",user->nick); - if (user->registered < 3) + if (user->registered < REG_NICKUSER) { - user->registered = (user->registered | 2); + user->registered = (user->registered | REG_NICK); // dont attempt to look up the dns until they pick a nick... because otherwise their pointer WILL change // and unless we're lucky we'll get a duff one later on. //user->dns_done = (!lookup_dns(user->nick)); @@ -165,13 +165,13 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) #endif } } - if (user->registered == 3) + if (user->registered == REG_NICKUSER) { /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ FOREACH_MOD(I_OnUserRegister,OnUserRegister(user)); //ConnectUser(user,NULL); } - if (user->registered == 7) + if (user->registered == REG_ALL) { FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick)); } diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp index 0f3665222..1b972efeb 100644 --- a/src/cmd_pass.cpp +++ b/src/cmd_pass.cpp @@ -22,7 +22,7 @@ void cmd_pass::Handle (const char** parameters, int pcnt, userrec *user) { // Check to make sure they havnt registered -- Fix by FCS - if (user->registered == 7) + if (user->registered == REG_ALL) { WriteServ(user->fd,"462 %s :You may not reregister",user->nick); return; diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp index 5011d230e..dfa33e91c 100644 --- a/src/cmd_quit.cpp +++ b/src/cmd_quit.cpp @@ -52,7 +52,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user) user_hash::iterator iter = clientlist.find(user->nick); char reason[MAXBUF]; - if (user->registered == 7) + if (user->registered == REG_ALL) { /* theres more to do here, but for now just close the socket */ if (pcnt == 1) @@ -109,7 +109,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user) clientlist.erase(iter); } - if (user->registered == 7) { + if (user->registered == REG_ALL) { purge_empty_chans(user); } if (user->fd > -1) diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp index f493f76c1..67b7c9492 100644 --- a/src/cmd_user.cpp +++ b/src/cmd_user.cpp @@ -29,7 +29,7 @@ extern FactoryList factory; void cmd_user::Handle (const char** parameters, int pcnt, userrec *user) { - if (user->registered < 3) + if (user->registered < REG_NICKUSER) { if (!isident(parameters[0])) { // This kinda Sucks, According to the RFC thou, its either this, @@ -43,7 +43,7 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user) */ snprintf(user->ident, IDENTMAX+1, "~%s", parameters[0]); strlcpy(user->fullname,parameters[3],MAXGECOS); - user->registered = (user->registered | 1); + user->registered = (user->registered | REG_USER); } } else @@ -52,7 +52,7 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user) return; } /* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */ - if (user->registered == 3) + if (user->registered == REG_NICKUSER) { /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ FOREACH_MOD(I_OnUserRegister,OnUserRegister(user)); diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index 1f4a402b2..b8a288a04 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -43,7 +43,7 @@ const char* Spacify(char* n) void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick) { // bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER - if (dest->registered == 7) + if (dest->registered == REG_ALL) { WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); if ((user == dest) || (*user->oper)) diff --git a/src/command_parse.cpp b/src/command_parse.cpp index b5ee19c1c..a90b7e4e3 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -242,7 +242,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str()); return; } - if ((user->registered == 7) && (!*user->oper) && (cm->second->IsDisabled())) + if ((user->registered == REG_ALL) && (!*user->oper) && (cm->second->IsDisabled())) { /* command is disabled! */ WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command.c_str()); @@ -257,7 +257,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) WriteServ(user->fd,"461 %s %s :Not enough parameters", user->nick, command.c_str()); return; } - if ((user->registered == 7) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass)) + if ((user->registered == REG_ALL) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass)) { /* ikky /stats counters */ cm->second->use_count++; diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index fb0e0bd75..51a7e1964 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -106,12 +106,12 @@ public: usr = Find(u); if (usr) { - if (usr->registered > 3) + if (usr->registered > REG_NICKUSER) { usr->dns_done = true; return true; } - if ((hostname != "") && (usr->registered != 7)) + if ((hostname != "") && (usr->registered != REG_ALL)) { if ((std::string(inet_ntoa(usr->ip4)) == ip) && (hostname.length() < 65)) { @@ -166,7 +166,7 @@ public: if (usr) { user_fd_to_dns[usr->fd] = NULL; - if ((usr->registered > 3) || (hostname == "")) + if ((usr->registered > REG_NICKUSER) || (hostname == "")) { WriteServ(usr->fd,"NOTICE Auth :*** Could not resolve your hostname -- Using your IP address instead"); usr->dns_done = true; @@ -243,7 +243,7 @@ void ZapThisDns(int fd) #ifdef THREADED_DNS /* if (fd_ref_table[fd]) { - if (fd_ref_table[fd]->registered >= 3) + if (fd_ref_table[fd]->registered >= REG_NICKUSER) { log(DEBUG,"Joining thread for user %d",fd); if (pthread_join(fd_ref_table[fd]->dnsthread, NULL)) diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 39294cbb3..5f236b668 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -699,7 +699,7 @@ void WriteCommon(userrec *u, char* text, ...) return; } - if (u->registered != 7) + if (u->registered != REG_ALL) { log(DEFAULT,"*** BUG *** WriteCommon on an unregistered user"); return; @@ -750,7 +750,7 @@ void WriteCommon_NoFormat(userrec *u, const char* text) return; } - if (u->registered != 7) + if (u->registered != REG_ALL) { log(DEFAULT,"*** BUG *** WriteCommon on an unregistered user"); return; @@ -806,7 +806,7 @@ void WriteCommonExcept(userrec *u, char* text, ...) return; } - if (u->registered != 7) + if (u->registered != REG_ALL) { log(DEFAULT,"*** BUG *** WriteCommon on an unregistered user"); return; @@ -894,7 +894,7 @@ void WriteCommonExcept_NoFormat(userrec *u, const char* text) return; } - if (u->registered != 7) + if (u->registered != REG_ALL) { log(DEFAULT,"*** BUG *** WriteCommon on an unregistered user"); return; @@ -1425,7 +1425,7 @@ void send_error(char *s) for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++) { userrec* t = (userrec*)(*i); - if (t->registered == 7) + if (t->registered == REG_ALL) { WriteServ(t->fd,"NOTICE %s :%s",t->nick,s); } @@ -1485,7 +1485,7 @@ int registered_usercount(void) for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) { - if (i->second->registered == 7) c++; + c += (i->second->registered == REG_ALL); } return c; @@ -1497,8 +1497,7 @@ int usercount_invisible(void) for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) { - if ((i->second->registered == 7) && (i->second->modes[UM_INVISIBLE])) - c++; + c += ((i->second->registered == REG_ALL) && (i->second->modes[UM_INVISIBLE])); } return c; @@ -1523,7 +1522,7 @@ int usercount_unknown(void) for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++) { userrec* t = (userrec*)(*i); - if (t->registered != 7) + if (t->registered != REG_ALL) c++; } @@ -1542,7 +1541,7 @@ long local_count() for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++) { userrec* t = (userrec*)(*i); - if (t->registered == 7) + if (t->registered == REG_ALL) c++; } diff --git a/src/message.cpp b/src/message.cpp index a3ca865bf..23d29bd41 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -63,7 +63,7 @@ extern ServerConfig* Config; int common_channels(userrec *u, userrec *u2) { /* TODO: We need to get rid of this arbitary '7' and make bitmask enums for it */ - if ((!u) || (!u2) || (u->registered != 7) || (u2->registered != 7)) + if ((!u) || (!u2) || (u->registered != REG_ALL) || (u2->registered != REG_ALL)) return 0; /* Outer loop */ diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 869bc6a1f..93df8e031 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -96,7 +96,7 @@ class ModuleAlias : public Module * and if theyre not registered yet, we dont want * to know either */ - if ((validated) || (user->registered != 7)) + if ((validated) || (user->registered != REG_ALL)) return 0; for (unsigned int i = 0; i < Aliases.size(); i++) diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 0ddaddd34..fdbc33839 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -97,7 +97,7 @@ public: virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated) { // Don't do anything with unregistered users, or remote ones. - if(!user || (user->registered != 7) || !IS_LOCAL(user)) + if(!user || (user->registered != REG_ALL) || !IS_LOCAL(user)) return 0; // We want case insensitive command comparison. diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 3f2bde805..c32a25ef7 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1502,7 +1502,7 @@ class TreeSocket : public InspSocket clientlist[tempnick]->server = FindServerNamePtr(source.c_str()); strlcpy(clientlist[tempnick]->ident, params[4].c_str(),IDENTMAX); strlcpy(clientlist[tempnick]->fullname, params[7].c_str(),MAXGECOS); - clientlist[tempnick]->registered = 7; + clientlist[tempnick]->registered = REG_ALL; clientlist[tempnick]->signon = age; for (std::string::iterator v = params[5].begin(); v != params[5].end(); v++) @@ -1714,7 +1714,7 @@ class TreeSocket : public InspSocket int iterations = 0; for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++, iterations++) { - if (u->second->registered == 7) + if (u->second->registered == REG_ALL) { snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),inet_ntoa(u->second->ip4),u->second->fullname); this->WriteLine(data); @@ -2172,7 +2172,7 @@ class TreeSocket : public InspSocket if (params.size() == 1) { userrec* x = Srv->FindNick(params[0]); - if ((x) && (x->fd > -1)) + if ((x) && (IS_LOCAL(x))) { userrec* x = Srv->FindNick(params[0]); log(DEBUG,"Got IDLE"); @@ -2198,14 +2198,14 @@ class TreeSocket : public InspSocket { std::string who_did_the_whois = params[0]; userrec* who_to_send_to = Srv->FindNick(who_did_the_whois); - if ((who_to_send_to) && (who_to_send_to->fd > -1)) + if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) { log(DEBUG,"Got final IDLE"); // an incoming reply to a whois we sent out std::string nick_whoised = prefix; unsigned long signon = atoi(params[1].c_str()); unsigned long idle = atoi(params[2].c_str()); - if ((who_to_send_to) && (who_to_send_to->fd > -1)) + if ((who_to_send_to) && (IS_LOCAL(who_to_send_to->fd))) do_whois(who_to_send_to,u,signon,idle,nick_whoised.c_str()); } else @@ -3477,7 +3477,7 @@ class ModuleSpanningTree : public Module int HandleTime(const char** parameters, int pcnt, userrec* user) { - if ((user->fd > -1) && (pcnt)) + if ((IS_LOCAL(user)) && (pcnt)) { TreeServer* found = FindServerMask(parameters[0]); if (found) @@ -3501,7 +3501,7 @@ class ModuleSpanningTree : public Module int HandleRemoteWhois(const char** parameters, int pcnt, userrec* user) { - if ((user->fd > -1) && (pcnt > 1)) + if ((IS_LOCAL(user)) && (pcnt > 1)) { userrec* remote = Srv->FindNick(parameters[1]); if ((remote) && (remote->fd < 0)) @@ -3746,7 +3746,7 @@ class ModuleSpanningTree : public Module virtual void OnUserInvite(userrec* source,userrec* dest,chanrec* channel) { - if (source->fd > -1) + if (IS_LOCAL(source)) { std::deque<std::string> params; params.push_back(dest->nick); @@ -3765,7 +3765,7 @@ class ModuleSpanningTree : public Module virtual void OnWallops(userrec* user, const std::string &text) { - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; params.push_back(":"+text); @@ -3778,7 +3778,7 @@ class ModuleSpanningTree : public Module if (target_type == TYPE_USER) { userrec* d = (userrec*)dest; - if ((d->fd < 0) && (user->fd > -1)) + if ((d->fd < 0) && (IS_LOCAL(user))) { std::deque<std::string> params; params.clear(); @@ -3789,7 +3789,7 @@ class ModuleSpanningTree : public Module } else if (target_type == TYPE_CHANNEL) { - if (user->fd > -1) + if (IS_LOCAL(user)) { chanrec *c = (chanrec*)dest; std::string cname = c->name; @@ -3808,7 +3808,7 @@ class ModuleSpanningTree : public Module } else if (target_type == TYPE_SERVER) { - if (user->fd > -1) + if (IS_LOCAL(user)) { char* target = (char*)dest; std::deque<std::string> par; @@ -3826,7 +3826,7 @@ class ModuleSpanningTree : public Module // route private messages which are targetted at clients only to the server // which needs to receive them userrec* d = (userrec*)dest; - if ((d->fd < 0) && (user->fd > -1)) + if ((d->fd < 0) && (IS_LOCAL(user))) { std::deque<std::string> params; params.clear(); @@ -3837,7 +3837,7 @@ class ModuleSpanningTree : public Module } else if (target_type == TYPE_CHANNEL) { - if (user->fd > -1) + if (IS_LOCAL(user)) { chanrec *c = (chanrec*)dest; std::string cname = c->name; @@ -3856,7 +3856,7 @@ class ModuleSpanningTree : public Module } else if (target_type == TYPE_SERVER) { - if (user->fd > -1) + if (IS_LOCAL(user)) { char* target = (char*)dest; std::deque<std::string> par; @@ -3876,7 +3876,7 @@ class ModuleSpanningTree : public Module virtual void OnUserJoin(userrec* user, chanrec* channel) { // Only do this for local users - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; params.clear(); @@ -3905,7 +3905,7 @@ class ModuleSpanningTree : public Module virtual void OnChangeHost(userrec* user, const std::string &newhost) { // only occurs for local clients - if (user->registered != 7) + if (user->registered != REG_ALL) return; std::deque<std::string> params; params.push_back(newhost); @@ -3915,7 +3915,7 @@ class ModuleSpanningTree : public Module virtual void OnChangeName(userrec* user, const std::string &gecos) { // only occurs for local clients - if (user->registered != 7) + if (user->registered != REG_ALL) return; std::deque<std::string> params; params.push_back(gecos); @@ -3924,7 +3924,7 @@ class ModuleSpanningTree : public Module virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage) { - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; params.push_back(channel->name); @@ -3937,7 +3937,7 @@ class ModuleSpanningTree : public Module virtual void OnUserConnect(userrec* user) { char agestr[MAXBUF]; - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; snprintf(agestr,MAXBUF,"%lu",(unsigned long)user->age); @@ -3963,7 +3963,7 @@ class ModuleSpanningTree : public Module virtual void OnUserQuit(userrec* user, const std::string &reason) { - if ((user->fd > -1) && (user->registered == 7)) + if ((IS_LOCAL(user)) && (user->registered == REG_ALL)) { std::deque<std::string> params; params.push_back(":"+reason); @@ -3980,7 +3980,7 @@ class ModuleSpanningTree : public Module virtual void OnUserPostNick(userrec* user, const std::string &oldnick) { - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; params.push_back(user->nick); @@ -3990,7 +3990,7 @@ class ModuleSpanningTree : public Module virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { - if ((source) && (source->fd > -1)) + if ((source) && (IS_LOCAL(source->fd))) { std::deque<std::string> params; params.push_back(chan->name); @@ -4038,7 +4038,7 @@ class ModuleSpanningTree : public Module // locally. virtual void OnOper(userrec* user, const std::string &opertype) { - if (user->fd > -1) + if (IS_LOCAL(user)) { std::deque<std::string> params; params.push_back(opertype); @@ -4048,7 +4048,7 @@ class ModuleSpanningTree : public Module void OnLine(userrec* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason) { - if (source->fd > -1) + if (IS_LOCAL(source)) { char type[8]; snprintf(type,8,"%cLINE",linetype); @@ -4114,7 +4114,7 @@ class ModuleSpanningTree : public Module virtual void OnMode(userrec* user, void* dest, int target_type, const std::string &text) { - if ((user->fd > -1) && (user->registered == 7)) + if ((IS_LOCAL(user)) && (user->registered == REG_ALL)) { if (target_type == TYPE_USER) { diff --git a/src/userprocess.cpp b/src/userprocess.cpp index c4c43ca16..1c3d7a965 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -147,7 +147,7 @@ void ProcessUser(userrec* cu) if (!current->AddBuffer(data)) { // AddBuffer returned false, theres too much data in the user's buffer and theyre up to no good. - if (current->registered == 7) + if (current->registered == REG_ALL) { // Make sure they arn't flooding long lines. if (TIME > current->reset_due) @@ -184,7 +184,7 @@ void ProcessUser(userrec* cu) if (current->recvq.length() > (unsigned)Config->NetBufferSize) { - if (current->registered == 7) + if (current->registered == REG_ALL) { kill_link(current,"RecvQ exceeded"); } @@ -218,7 +218,7 @@ void ProcessUser(userrec* cu) if ((++floodlines > current->flood) && (current->flood != 0)) { - if (current->registered == 7) + if (current->registered == REG_ALL) { log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); @@ -340,7 +340,7 @@ void DoBackgroundUserStuff(time_t TIME) * registration timeout -- didnt send USER/NICK/HOST * in the time specified in their connection class. */ - if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7)) + if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != REG_ALL)) { log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick); ZapThisDns(curr->fd); @@ -352,7 +352,7 @@ void DoBackgroundUserStuff(time_t TIME) * user has signed on with USER/NICK/PASS, and dns has completed, all the modules * say this user is ok to proceed, fully connect them. */ - if ((TIME > curr->signon) && (curr->registered == 3) && (AllModulesReportReady(curr))) + if ((TIME > curr->signon) && (curr->registered == REG_NICKUSER) && (AllModulesReportReady(curr))) { curr->dns_done = true; ZapThisDns(curr->fd); @@ -365,7 +365,7 @@ void DoBackgroundUserStuff(time_t TIME) /* Somebody blatted this user in OnCheckReady (!) */ continue; - if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr))) + if ((curr->dns_done) && (curr->registered == REG_NICKUSER) && (AllModulesReportReady(curr))) { log(DEBUG,"dns done, registered=3, and modules ready, OK"); FullConnectUser(curr,&GlobalGoners); @@ -378,7 +378,7 @@ void DoBackgroundUserStuff(time_t TIME) continue; // It's time to PING this user. Send them a ping. - if ((TIME > curr->nping) && (curr->registered == 7)) + if ((TIME > curr->nping) && (curr->registered == REG_ALL)) { // This user didn't answer the last ping, remove them if (!curr->lastping) diff --git a/src/users.cpp b/src/users.cpp index 553819d49..cd613fb05 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -220,7 +220,7 @@ userrec::~userrec() delete x; } #ifdef THREADED_DNS - if ((IS_LOCAL(this)) && (!dns_done) && (registered >= 3)) + if ((IS_LOCAL(this)) && (!dns_done) && (registered >= REG_NICKUSER)) { pthread_kill(this->dnsthread, SIGTERM); } @@ -572,7 +572,7 @@ void kill_link(userrec *user,const char* r) if (IS_LOCAL(user)) Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason); - if (user->registered == 7) + if (user->registered == REG_ALL) { purge_empty_chans(user); FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,reason)); @@ -610,7 +610,7 @@ void kill_link(userrec *user,const char* r) * In the current implementation, we only show local quits, as we only show local connects. With * the proposed implmentation of snomasks however, this will likely change in the (near?) future. */ - if (user->registered == 7) + if (user->registered == REG_ALL) { if (IS_LOCAL(user)) WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason); @@ -742,7 +742,7 @@ void AddClient(int socket, int port, bool iscached, in_addr ip4) /* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */ strcpy(_new->ident, "unknown"); - _new->registered = 0; + _new->registered = REG_NONE; _new->signon = TIME + Config->dns_timeout; _new->lastping = 1; _new->ip4 = ip4; @@ -946,7 +946,7 @@ void FullConnectUser(userrec* user, CullList* Goners) */ FOREACH_MOD(I_OnUserConnect,OnUserConnect(user)); FOREACH_MOD(I_OnGlobalConnect,OnGlobalConnect(user)); - user->registered = 7; + user->registered = REG_ALL; WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,inet_ntoa(user->ip4)); } @@ -1011,7 +1011,7 @@ void force_nickchange(userrec* user,const char* newnick) strlcpy(nick,newnick,MAXBUF-1); } - if (user->registered == 7) + if (user->registered == REG_ALL) { const char* pars[1]; pars[0] = nick; |