typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
extern user_hash clientlist;
-const char* OneToEither[] = { "PRIVMSG", "NOTICE", NULL };
-const char* OneToMany[] = { "NICK", "QUIT", "JOIN", "PART", "MODE", "INVITE", "KICK", "KILL", NULL };
-const char* OneToOne[] = { "REHASH", "DIE", "TRACE", "WHOIS", NULL };
-
class TreeServer;
class TreeSocket;
ServerState LinkState;
std::string InboundServerName;
std::string InboundDescription;
+ int num_lost_users;
+ int num_lost_servers;
public:
}
// Now we've whacked the kids, whack self
log(DEBUG,"Deleted %s",Current->GetName().c_str());
+ num_lost_servers++;
bool quittingpeople = true;
while (quittingpeople)
{
{
log(DEBUG,"Quitting user %s of server %s",u->second->nick,u->second->server);
Srv->QuitUser(u->second,Current->GetName()+" "+std::string(Srv->GetServerName()));
+ num_lost_users++;
quittingpeople = true;
break;
}
{
std::deque<std::string> params;
params.push_back(Current->GetName());
- params.push_back(":"+reason);
+ params.push_back(reason);
DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName());
if (Current->GetParent() == TreeRoot)
{
- Srv->SendOpers("Server \002"+Current->GetName()+"\002 SQUIT: "+reason);
+ Srv->SendOpers("Server \002"+Current->GetName()+"\002 split: "+reason);
}
else
{
Srv->SendOpers("Server \002"+Current->GetName()+"\002 split from server \002"+Current->GetParent()->GetName()+"\002 with reason: "+reason);
}
+ num_lost_servers = 0;
+ num_lost_users = 0;
SquitServer(Current);
Current->Tidy();
Current->GetParent()->DelChild(Current);
delete Current;
+ WriteOpers("Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
}
else
{
bool ProcessLine(std::string line)
{
- Srv->SendToModeMask("o",WM_AND,"inbound-line: '"+line+"'");
+ Srv->Log(DEBUG,"inbound-line: '"+line+"'");
std::deque<std::string> params = this->Split(line);
std::string command = "";
{
std::deque<std::string> params;
params.push_back(quitserver);
- params.push_back(":Remote host closed the connection");
+ params.push_back("Remote host closed the connection");
DoOneToAllButSender(Srv->GetServerName(),"SQUIT",params,quitserver);
Squit(s,"Remote host closed the connection");
}
std::string FullLine = ":" + prefix + " " + command;
for (unsigned int x = 0; x < params.size(); x++)
{
- FullLine = FullLine + " " + params[x];
+ if (!strchr(params[x].c_str(),' '))
+ {
+ FullLine = FullLine + " " + params[x];
+ }
+ else
+ {
+ FullLine = FullLine + " :" + params[x];
+ }
}
for (unsigned int x = 0; x < TreeRoot->ChildCount(); x++)
{
std::string FullLine = ":" + prefix + " " + command;
for (unsigned int x = 0; x < params.size(); x++)
{
- FullLine = FullLine + " " + params[x];
+ if (!strchr(params[x].c_str(),' '))
+ {
+ FullLine = FullLine + " " + params[x];
+ }
+ else
+ {
+ FullLine = FullLine + " :" + params[x];
+ }
}
for (unsigned int x = 0; x < TreeRoot->ChildCount(); x++)
{
std::string FullLine = ":" + prefix + " " + command;
for (unsigned int x = 0; x < params.size(); x++)
{
- FullLine = FullLine + " " + params[x];
+ if (!strchr(params[x].c_str(),' '))
+ {
+ FullLine = FullLine + " " + params[x];
+ }
+ else
+ {
+ FullLine = FullLine + " :" + params[x];
+ }
}
if (Route->GetSocket())
{
std::deque<std::string> params;
params.clear();
params.push_back(d->nick);
- params.push_back(":"+text);
+ params.push_back(text);
DoOneToOne(user->nick,"PRIVMSG",params,d->server);
}
}
+ else
+ {
+ if (std::string(user->server) == Srv->GetServerName())
+ {
+ chanrec *c = (chanrec*)dest;
+ std::deque<std::string> params;
+ params.push_back(c->name);
+ params.push_back(text);
+ DoOneToMany(user->nick,"PRIVMSG",params);
+ }
+ }
}
virtual void OnUserJoin(userrec* user, chanrec* channel)