int time_delta;
public:
+
+ /** Number of unregistered users online right now.
+ * (Unregistered means before USER/NICK/dns)
+ */
+ int unregistered_count;
+
/** List of server names we've seen.
*/
servernamelist servernames;
FOREACH_MOD(I_OnPostCommand,OnPostCommand("QUIT", parameters, pcnt, user, CMD_SUCCESS, original_command));
}
+ if (user->registered != REG_ALL)
+ if (ServerInstance->unregistered_count)
+ ServerInstance->unregistered_count--;
+
DELETE(user);
return CMD_USER_DELETED;
}
int InspIRCd::UnregisteredUserCount()
{
- int c = 0;
-
- for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
- {
- userrec* t = (userrec*)(*i);
- if (t->registered != REG_ALL)
- c++;
- }
-
- return c;
+ return this->unregistered_count;
}
long InspIRCd::ChannelCount()
long InspIRCd::LocalUserCount()
{
- int c = 0;
-
- for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
- {
- userrec* t = (userrec*)(*i);
- if (t->registered == REG_ALL)
- c++;
- }
-
- return c;
+ /* Doesnt count unregistered clients */
+ return (local_users.size() - this->UnregisteredUserCount());
}
-
+
bool InspIRCd::IsChannel(const char *chname)
{
char *c;
modules.resize(255);
factory.resize(255);
+ this->unregistered_count = 0;
+
this->clientlist = new user_hash();
this->chanlist = new chan_hash();
if (reason.length() > MAXQUIT - 1)
reason.resize(MAXQUIT - 1);
-
+
+ if (user->registered != REG_ALL)
+ if (Instance->unregistered_count)
+ Instance->unregistered_count--;
+
if (IS_LOCAL(user))
{
user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason.c_str());
userrec* New;
int j = 0;
+ Instance->unregistered_count++;
+
/*
* fix by brain.
* as these nicknames are 'RFC impossible', we can be sure nobody is going to be
this->ShowMOTD();
+ /* Now registered */
+ if (ServerInstance->unregistered_count)
+ ServerInstance->unregistered_count--;
+
/*
* fix 3 by brain, move registered = 7 below these so that spurious modes and host
* changes dont go out onto the network and produce 'fake direction'.