ServerInstance->Log(DEBUG,"New UUID for user: %s (%s)", uuid, uid.empty() ? "allocated new" : "used remote");
- user_hash::iterator finduuid = Instance->uuidlist->find(uuid);
- if (finduuid == Instance->uuidlist->end())
- (*Instance->uuidlist)[uuid] = this;
+ user_hash::iterator finduuid = Instance->Users->uuidlist->find(uuid);
+ if (finduuid == Instance->Users->uuidlist->end())
+ (*Instance->Users->uuidlist)[uuid] = this;
else
throw CoreException("Duplicate UUID "+std::string(uuid)+" in User constructor");
}
#endif
}
- ServerInstance->uuidlist->erase(uuid);
+ ServerInstance->Users->uuidlist->erase(uuid);
}
char* User::MakeHost()
FOREACH_MOD(I_OnOper, OnOper(this, opertype));
ServerInstance->Log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
strlcpy(this->oper, opertype.c_str(), NICKMAX - 1);
- ServerInstance->all_opers.push_back(this);
+ ServerInstance->Users->all_opers.push_back(this);
opertype_t::iterator iter_opertype = ServerInstance->Config->opertypes.find(this->oper);
if (iter_opertype != ServerInstance->Config->opertypes.end())
this->modes[UM_OPERATOR] = 0;
// remove the user from the oper list. Will remove multiple entries as a safeguard against bug #404
- ServerInstance->all_opers.remove(this);
+ ServerInstance->Users->all_opers.remove(this);
if (AllowedOperCommands)
{
this->ShowMOTD();
/* Now registered */
- if (ServerInstance->unregistered_count)
- ServerInstance->unregistered_count--;
+ if (ServerInstance->Users->unregistered_count)
+ ServerInstance->Users->unregistered_count--;
/* Trigger LUSERS output, give modules a chance too */
int MOD_RESULT = 0;
try
{
//user_hash::iterator newnick;
- user_hash::iterator oldnick = ServerInstance->clientlist->find(this->nick);
+ user_hash::iterator oldnick = ServerInstance->Users->clientlist->find(this->nick);
if (!strcasecmp(this->nick,New))
return oldnick->second;
- if (oldnick == ServerInstance->clientlist->end())
+ if (oldnick == ServerInstance->Users->clientlist->end())
return NULL; /* doesnt exist */
User* olduser = oldnick->second;
- (*(ServerInstance->clientlist))[New] = olduser;
- ServerInstance->clientlist->erase(oldnick);
+ (*(ServerInstance->Users->clientlist))[New] = olduser;
+ ServerInstance->Users->clientlist->erase(oldnick);
return olduser;
}
{
try
{
- int MOD_RESULT = 0;
+ /*
+ * XXX this makes no sense..
+ * why do we do nothing for change on users not REG_ALL?
+ * why do we trigger events twice for everyone previously (and just them now)
+ * i think the first if () needs removing totally, or? -- w00t
+ */
+ if (this->registered != REG_ALL)
+ {
+ int MOD_RESULT = 0;
- this->InvalidateCache();
+ this->InvalidateCache();
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
- if (MOD_RESULT)
- {
- ServerInstance->stats->statsCollisions++;
- return false;
- }
+ if (MOD_RESULT)
+ {
+ ServerInstance->stats->statsCollisions++;
+ return false;
+ }
- if (ServerInstance->XLines->MatchesLine("Q",newnick))
- {
- ServerInstance->stats->statsCollisions++;
- return false;
+ if (ServerInstance->XLines->MatchesLine("Q",newnick))
+ {
+ ServerInstance->stats->statsCollisions++;
+ return false;
+ }
}
-
- if (this->registered == REG_ALL)
+ else
{
std::deque<classbase*> dummy;
Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
void User::SetSockAddr(int protocol_family, const char* ip, int port)
{
+ this->cachedip = "";
+
switch (protocol_family)
{
#ifdef SUPPORT_IP6LINKS
if (this->ip == NULL)
return "";
+ if (!this->cachedip.empty())
+ return this->cachedip.c_str();
+
switch (this->GetProtocolFamily())
{
#ifdef SUPPORT_IP6LINKS
{
strlcpy(&temp[1], buf, sizeof(temp) - 1);
*temp = '0';
+ this->cachedip = temp;
return temp;
}
+
+ this->cachedip = buf;
return buf;
}
break;
{
sockaddr_in* sin = (sockaddr_in*)this->ip;
inet_ntop(sin->sin_family, &sin->sin_addr, buf, sizeof(buf));
+ this->cachedip = buf;
return buf;
}
break;
default:
break;
}
+
+ // Unreachable, probably
return "";
}
std::string wallop("WALLOPS :");
wallop.append(text);
- for (std::vector<User*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++)
+ for (std::vector<User*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
{
User* t = *i;
if (t->IsModeSet('w'))
if (this->ServerInstance->Config->CycleHosts)
this->WriteCommonExcept("%s","QUIT :Changing ident");
- strlcpy(this->ident, newident, IDENTMAX+2);
+ strlcpy(this->ident, newident, IDENTMAX+1);
this->InvalidateCache();
snprintf(formatbuffer,MAXBUF,":%s %s $* :%s", this->GetFullHost(), command, textbuffer);
std::string fmt = formatbuffer;
- for (std::vector<User*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++)
+ for (std::vector<User*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
{
(*i)->Write(fmt);
}