/** If you make a change which breaks the protocol, increment this.
* If you completely change the protocol, completely change the number.
+ *
+ * IMPORTANT: If you make changes, document your changes here, without fail:
+ * http://www.inspircd.org/wiki/List_of_protocol_changes_between_versions
+ *
+ * Failure to document your protocol changes will result in a painfully
+ * painful death by pain. You have been warned.
*/
-const long ProtocolVersion = 1101;
+const long ProtocolVersion = 1102;
/*
* The server list in InspIRCd is maintained as two structures
if (numusers)
buffer.append(list).append("\r\n");
+ /* Sorry for the hax. Because newly created channels assume +nt,
+ * if this channel doesnt have +nt, explicitly send -n and -t for the missing modes.
+ */
+ bool inverted = false;
+ if (!c->IsModeSet('n'))
+ {
+ modes.append("-n");
+ inverted = true;
+ }
+ if (!c->IsModeSet('t'))
+ {
+ modes.append("-t");
+ inverted = true;
+ }
+ if (inverted)
+ {
+ modes.append("+");
+ }
+
for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++)
{
modes.append("b");
}
return true;
}
+ else if (command == "OPERNOTICE")
+ {
+ std::string sourceserv = this->myhost;
+
+ if (this->InboundServerName != "")
+ sourceserv = this->InboundServerName;
+
+ if (params.size() >= 1)
+ Instance->WriteOpers("*** From " + sourceserv + ": " + params[0]);
+
+ return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
+ }
+ else if (command == "MODENOTICE")
+ {
+ std::string sourceserv = this->myhost;
+ if (this->InboundServerName != "")
+ sourceserv = this->InboundServerName;
+ if (params.size() >= 2)
+ {
+ Instance->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s", sourceserv.c_str(), params[1].c_str());
+ }
+
+ return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
+ }
+ else if (command == "SNONOTICE")
+ {
+ std::string sourceserv = this->myhost;
+ if (this->InboundServerName != "")
+ sourceserv = this->InboundServerName;
+ if (params.size() >= 2)
+ {
+ Instance->SNO->WriteToSnoMask(*(params[0].c_str()), "From " + sourceserv + ": "+ params[1]);
+ }
+
+ return Utils->DoOneToAllButSenderRaw(line, sourceserv, prefix, command, params);
+ }
else if (command == "ENDBURST")
{
this->bursting = false;
{
sourceserv = this->InboundServerName;
}
+ if ((!who) && (command == "MODE"))
+ {
+ if (Utils->IsServer(prefix))
+ {
+ const char* modelist[127];
+ for (size_t i = 0; i < params.size(); i++)
+ modelist[i] = params[i].c_str();
+
+ userrec* fake = new userrec(Instance);
+ fake->SetFd(FD_MAGIC_NUMBER);
+
+ this->Instance->SendMode(modelist, params.size(), fake);
+
+ delete fake;
+
+ /* Hot potato! pass it on! */
+ return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params);
+ }
+ }
if (who)
{
if ((command == "NICK") && (params.size() > 0))
Link MyLink;
SpanningTreeUtilities* Utils;
public:
- ServernameResolver(SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD), MyLink(x), Utils(Util)
+ ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, me), MyLink(x), Utils(Util)
{
/* Nothing in here, folks */
}
Link MyLink;
SpanningTreeUtilities* Utils;
public:
- SecurityIPResolver(SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD), MyLink(x), Utils(U)
+ SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, me), MyLink(x), Utils(U)
{
}
{
std::string Type = Conf->ReadValue("bind","type",j);
std::string IP = Conf->ReadValue("bind","address",j);
- int Port = Conf->ReadInteger("bind","port",j,true);
+ std::string Port = Conf->ReadValue("bind","port",j);
if (Type == "servers")
{
- ServerInstance->Log(DEBUG,"m_spanningtree: Binding server port %s:%d", IP.c_str(), Port);
- if (IP == "*")
- {
- IP = "";
- }
- TreeSocket* listener = new TreeSocket(this, ServerInstance, IP.c_str(),Port,true,10);
- if (listener->GetState() == I_LISTENING)
+ irc::portparser portrange(Port, false);
+ int portno = -1;
+ while ((portno = portrange.GetToken()))
{
- ServerInstance->Log(DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), Port);
- Bindings.push_back(listener);
- }
- else
- {
- ServerInstance->Log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port %d",Port);
- listener->Close();
- DELETE(listener);
+ ServerInstance->Log(DEBUG,"m_spanningtree: Binding server port %s:%d", IP.c_str(), portno);
+ if (IP == "*")
+ IP = "";
+
+ TreeSocket* listener = new TreeSocket(this, ServerInstance, IP.c_str(), portno, true, 10);
+ if (listener->GetState() == I_LISTENING)
+ {
+ ServerInstance->Log(DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), portno);
+ Bindings.push_back(listener);
+ }
+ else
+ {
+ ServerInstance->Log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port %s:%d",IP.c_str(), portno);
+ listener->Close();
+ DELETE(listener);
+ }
+ ServerInstance->Log(DEBUG,"Done with this binding");
}
- ServerInstance->Log(DEBUG,"Done with this binding");
}
}
}
{
try
{
- SecurityIPResolver* sr = new SecurityIPResolver(this, ServerInstance, L.IPAddr, L);
+ SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L);
ServerInstance->AddResolver(sr);
}
catch (ModuleException& e)
if (n_users > max_global)
max_global = n_users;
- user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick,n_users-ServerInstance->InvisibleUserCount(),ServerInstance->InvisibleUserCount(),this->CountServs());
+ unsigned int ulined_count = 0;
+ unsigned int ulined_local_count = 0;
+
+ /* If ulined are hidden and we're not an oper, count the number of ulined servers hidden,
+ * locally and globally (locally means directly connected to us)
+ */
+ if ((Utils->HideULines) && (!*user->oper))
+ {
+ for (server_hash::iterator q = Utils->serverlist.begin(); q != Utils->serverlist.end(); q++)
+ {
+ if (ServerInstance->ULine(q->second->GetName().c_str()))
+ {
+ ulined_count++;
+ if (q->second->GetParent() == Utils->TreeRoot)
+ ulined_local_count++;
+ }
+ }
+ }
+
+ user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick,n_users-ServerInstance->InvisibleUserCount(),ServerInstance->InvisibleUserCount(),ulined_count ? this->CountServs() - ulined_count : this->CountServs());
if (ServerInstance->OperCount())
user->WriteServ("252 %s %d :operator(s) online",user->nick,ServerInstance->OperCount());
if (ServerInstance->UnregisteredUserCount())
user->WriteServ("253 %s %d :unknown connections",user->nick,ServerInstance->UnregisteredUserCount());
if (ServerInstance->ChannelCount())
user->WriteServ("254 %s %d :channels formed",user->nick,ServerInstance->ChannelCount());
- user->WriteServ("254 %s :I have %d clients and %d servers",user->nick,ServerInstance->LocalUserCount(),this->CountLocalServs());
+ user->WriteServ("254 %s :I have %d clients and %d servers",user->nick,ServerInstance->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs());
user->WriteServ("265 %s :Current Local Users: %d Max: %d",user->nick,ServerInstance->LocalUserCount(),max_local);
user->WriteServ("266 %s :Current Global Users: %d Max: %d",user->nick,n_users,max_global);
return;
{
try
{
- ServernameResolver* snr = new ServernameResolver(Utils, ServerInstance,x->IPAddr, *x);
+ ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x);
ServerInstance->AddResolver(snr);
}
catch (ModuleException& e)
params.push_back(ConvToStr(channel->age));
params.push_back(std::string(channel->GetAllPrefixChars(user))+","+std::string(user->nick));
Utils->DoOneToMany(ServerInstance->Config->ServerName,"FJOIN",params);
+ if (channel->GetUserCounter() == 1)
+ {
+ /* First user in, sync the modes for the channel */
+ params.pop_back();
+ /* This is safe, all inspircd servers default to +nt */
+ params.push_back("+nt");
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params);
+ }
}
}
{
/* Server-set lines */
char data[MAXBUF];
- snprintf(data,MAXBUF,"%c %s %s %lu %lu :%s", linetype, host.c_str(), ServerInstance->Config->ServerName, ServerInstance->Time(false), duration, reason.c_str());
+ snprintf(data,MAXBUF,"%c %s %s %lu %lu :%s", linetype, host.c_str(), ServerInstance->Config->ServerName, (unsigned long)ServerInstance->Time(false),
+ (unsigned long)duration, reason.c_str());
std::deque<std::string> params;
params.push_back(data);
Utils->DoOneToMany(ServerInstance->Config->ServerName, "ADDLINE", params);
params->insert(params->begin() + 1,ConvToStr(ourTS));
Utils->DoOneToMany(ServerInstance->Config->ServerName,"FMODE",*params);
}
+ else if (event->GetEventID() == "send_mode_explicit")
+ {
+ if (params->size() < 2)
+ return;
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"MODE",*params);
+ }
+ else if (event->GetEventID() == "send_opers")
+ {
+ if (params->size() < 1)
+ return;
+ (*params)[0] = ":" + (*params)[0];
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"OPERNOTICE",*params);
+ }
+ else if (event->GetEventID() == "send_modeset")
+ {
+ if (params->size() < 2)
+ return;
+ (*params)[1] = ":" + (*params)[1];
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"MODENOTICE",*params);
+ }
+ else if (event->GetEventID() == "send_snoset")
+ {
+ if (params->size() < 2)
+ return;
+ (*params)[1] = ":" + (*params)[1];
+ Utils->DoOneToMany(ServerInstance->Config->ServerName,"SNONOTICE",*params);
+ }
else if (event->GetEventID() == "send_push")
{
if (params->size() < 2)