#include "bancache.h"
#include "commands/cmd_whowas.h"
-/* XXX: Used for speeding up WriteCommon operations */
-unsigned long uniq_id = 1;
+static unsigned long uniq_id = 1;
static unsigned long* already_sent = NULL;
-LocalIntExt User::NICKForced("NICKForced", NULL);
-LocalStringExt User::OperQuit("OperQuit", NULL);
-
void InitializeAlreadySent(SocketEngine* SE)
{
already_sent = new unsigned long[SE->GetMaxFds()];
this->InvalidateCache();
- NICKForced.set(this, 1);
+ ServerInstance->NICKForced.set(this, 1);
FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (this, newnick));
- NICKForced.set(this, 0);
+ ServerInstance->NICKForced.set(this, 0);
if (MOD_RESULT == MOD_RES_DENY)
{
{
std::vector<std::string> parameters;
parameters.push_back(newnick);
- NICKForced.set(this, 1);
+ ServerInstance->NICKForced.set(this, 1);
bool result = (ServerInstance->Parser->CallHandler("NICK", parameters, this) == CMD_SUCCESS);
- NICKForced.set(this, 0);
+ ServerInstance->NICKForced.set(this, 0);
return result;
}
char textbuffer[MAXBUF];
va_list argsPtr;
- if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+ if (this->registered != REG_ALL || quitting)
return;
int len = snprintf(textbuffer,MAXBUF,":%s ",this->GetFullHost().c_str());
char textbuffer[MAXBUF];
va_list argsPtr;
- if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+ if (this->registered != REG_ALL || quitting)
return;
int len = snprintf(textbuffer,MAXBUF,":%s ",this->GetFullHost().c_str());
void User::WriteCommonRaw(const std::string &line, bool include_self)
{
- if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+ if (this->registered != REG_ALL || quitting)
return;
if (!already_sent)
if (!ServerInstance->Config->CycleHosts)
return;
- uniq_id++;
+ unsigned int silent_id = ++uniq_id;
+ unsigned int seen_id = ++uniq_id;
if (!already_sent)
InitializeAlreadySent(ServerInstance->SE);
User* u = i->first;
if (IS_LOCAL(u) && !u->quitting)
{
- already_sent[u->fd] = uniq_id;
if (i->second)
+ {
+ already_sent[u->fd] = seen_id;
u->Write(quitline);
+ }
+ else
+ {
+ already_sent[u->fd] = silent_id;
+ }
}
}
for (UCListIter v = include_c.begin(); v != include_c.end(); ++v)
User* u = i->first;
if (u == this || !IS_LOCAL(u))
continue;
+ if (already_sent[u->fd] == silent_id)
+ continue;
- if (already_sent[i->first->fd] != uniq_id)
+ if (already_sent[u->fd] != seen_id)
{
u->Write(quitline);
- already_sent[i->first->fd] = uniq_id;
+ already_sent[i->first->fd] = seen_id;
}
u->Write(joinline);
if (modeline.length() > 0)