Merge branch 'insp4' into master.

This commit is contained in:
Sadie Powell 2024-09-19 13:29:47 +01:00
commit 0a7a1a2bc1
6 changed files with 24 additions and 17 deletions

View File

@ -36,7 +36,7 @@ public:
/** Deleter that queues an object for deletion at the end of the current main loop iteration. */
struct Deleter final
{
void operator()(Cullable* item);
void operator()(Cullable* item) const;
};
/** Dummy class to help ensure all superclasses get culled. */

View File

@ -444,7 +444,7 @@ public:
void UpdateTime();
};
inline void Cullable::Deleter::operator()(Cullable* item)
inline void Cullable::Deleter::operator()(Cullable* item) const
{
if (item)
ServerInstance->GlobalCulls.AddItem(item);

View File

@ -144,14 +144,20 @@ public:
if (i->second >= threshold)
{
// If an IPv6 address begins with a colon then expand it
// slightly to avoid breaking the server protocol.
std::string maskstr = mask.str();
if (maskstr[0] == ':')
maskstr.insert(maskstr.begin(), 1, '0');
// Create Z-line for set duration.
auto* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, mask.str());
auto* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, maskstr);
if (!ServerInstance->XLines->AddLine(zl, nullptr))
{
delete zl;
return;
}
std::string maskstr = mask.str();
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}",
zl->source, maskstr, Duration::ToString(zl->duration),
Time::ToString(zl->expiry), zl->reason);

View File

@ -63,6 +63,7 @@ struct ISupportAction final
class CoreModInfo final
: public Module
{
private:
CommandAdmin cmdadmin;
CommandCommands cmdcommands;
CommandInfo cmdinfo;
@ -88,14 +89,12 @@ class CoreModInfo final
if (!needparam || mh->NeedsParam(true))
modestr.push_back(mh->GetModeChar());
}
std::sort(modestr.begin(), modestr.end());
return modestr;
}
void OnServiceChange(const ServiceProvider& prov)
void Rebuild004()
{
if (prov.service != SERVICE_MODE)
return;
std::vector<std::string>& params = numeric004.GetParams();
params.erase(params.begin()+2, params.end());
@ -107,6 +106,7 @@ class CoreModInfo final
numeric004.push(CreateModeList(MODETYPE_CHANNEL));
numeric004.push(CreateModeList(MODETYPE_CHANNEL, true));
}
public:
CoreModInfo()
: Module(VF_CORE | VF_VENDOR, "Provides the ADMIN, COMMANDS, INFO, MODULES, MOTD, TIME, SERVLIST, and VERSION commands")
@ -165,6 +165,8 @@ public:
cmdadmin.admindesc = tag->getString("description");
cmdadmin.adminemail = tag->getString("email", "noreply@" + ServerInstance->Config->GetServerName(), 1);
Rebuild004();
cmdversion.BuildNumerics();
ServerInstance->AtomicActions.AddAction(new ISupportAction(isupport));
}
@ -217,12 +219,14 @@ public:
void OnServiceAdd(ServiceProvider& service) override
{
OnServiceChange(service);
if (service.service == SERVICE_MODE)
Rebuild004();
}
void OnServiceDel(ServiceProvider& service) override
{
OnServiceChange(service);
if (service.service == SERVICE_MODE)
Rebuild004();
}
void Prioritize() override

View File

@ -33,7 +33,6 @@
#include "inspircd.h"
#include "timeutils.h"
#include <iostream>
class JSONMethod final
: public Log::Method
, public Timer

View File

@ -23,8 +23,6 @@
#include "inspircd.h"
#include <iostream>
#include <windows.h>
static SERVICE_STATUS_HANDLE g_ServiceStatusHandle;
@ -193,7 +191,7 @@ void InstallService()
CloseServiceHandle(InspServiceHandle);
CloseServiceHandle(SCMHandle);
std::cout << "Service installed." << std::endl;
fmt::println("Service installed.");
}
catch(const CWin32Exception& e)
{
@ -203,7 +201,7 @@ void InstallService()
if(SCMHandle)
CloseServiceHandle(SCMHandle);
std::cout << "Service installation failed: " << e.what() << std::endl;
fmt::println("Service installation failed: {}", e.what());
}
}
@ -229,7 +227,7 @@ void UninstallService()
CloseServiceHandle(InspServiceHandle);
CloseServiceHandle(SCMHandle);
std::cout << "Service removed." << std::endl;
fmt::println("Service removed.");
}
catch(const CWin32Exception& e)
{
@ -239,7 +237,7 @@ void UninstallService()
if(SCMHandle)
CloseServiceHandle(SCMHandle);
std::cout << "Service deletion failed: " << e.what() << std::endl;
fmt::println("Service deletion failed: {}", e.what());
}
}