#include "protocolinterface.h"
ModuleSpanningTree::ModuleSpanningTree()
+ : KeepNickTS(false)
{
Utils = new SpanningTreeUtilities(this);
commands = new SpanningTreeCommands(this);
loopCall = false;
// update our local user count
- Utils->TreeRoot->SetUserCount(ServerInstance->Users->local_users.size());
+ Utils->TreeRoot->SetUserCount(ServerInstance->Users->LocalUserCount());
}
void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
{
bool ipvalid = true;
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
{
ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
return;
}
- QueryType start_type = DNS_QUERY_A;
- start_type = DNS_QUERY_AAAA;
+ QueryType start_type = DNS_QUERY_AAAA;
if (strchr(x->IPAddr.c_str(),':'))
{
in6_addr n;
for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++)
{
Link* x = *i;
- if (InspIRCd::Match(x->Name.c_str(),parameters[0]))
+ if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map))
{
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name)))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
{
RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str());
return MOD_RES_DENY;
return;
parameterlist params;
- params.push_back(gecos);
+ params.push_back(":" + gecos);
Utils->DoOneToMany(user->uuid,"FNAME",params);
}
/** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick!
*/
- if (irc::string(user->nick.c_str()) != assign(oldnick))
+ if ((irc::string(user->nick.c_str()) != assign(oldnick)) && (!this->KeepNickTS))
user->age = ServerInstance->Time();
params.push_back(ConvToStr(user->age));
Utils->DoOneToMany(user->uuid,"NICK",params);
+ this->KeepNickTS = false;
}
else if (!loopCall && user->nick == user->uuid)
{
{
ServerInstance->PI->SendMetaData(NULL, "modules", "-" + mod->ModuleSourceFile);
+restart:
unsigned int items = Utils->TreeRoot->ChildCount();
for(unsigned int x = 0; x < items; x++)
{
{
sock->SendError("SSL module unloaded");
sock->Close();
+ // XXX: The list we're iterating is modified by TreeSocket::Squit() which is called by Close()
+ goto restart;
}
}
+
+ for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i)
+ {
+ TreeSocket* sock = i->first;
+ if (sock->GetIOHook() == mod)
+ sock->Close();
+ }
}
// note: the protocol does not allow direct umode +o except
parameterlist params;
if (!awaymsg.empty())
{
- params.push_back(ConvToStr(user->awaytime));
+ params.push_back(ConvToStr(ServerInstance->Time()));
params.push_back(":" + awaymsg);
}
Utils->DoOneToMany(user->uuid, "AWAY", params);
return MOD_RES_PASSTHRU;
}
+void ModuleSpanningTree::OnRequest(Request& request)
+{
+ if (!strcmp(request.id, "rehash"))
+ Utils->Rehash();
+}
+
void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector<TranslateType> &translate)
{
TreeSocket* s = (TreeSocket*)opaque;