mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Merge branch 'insp3' into master.
This commit is contained in:
commit
9fbcb685e8
@ -102,8 +102,7 @@ EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = YES
|
||||
EXCLUDE_PATTERNS = */.git/* \
|
||||
*/doxygen/* \
|
||||
*/coremods/* \
|
||||
*/modules/* \
|
||||
*/src/* \
|
||||
*/vendor/*
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
|
@ -1566,7 +1566,13 @@
|
||||
# requirekey - If enabled, overriding on join requires a channel #
|
||||
# key of "override" to be specified. #
|
||||
# #
|
||||
#<override noisy="yes" requirekey="no">
|
||||
# timeout: The time period after which to automatically remove #
|
||||
# the override user mode. If not set then it will not #
|
||||
# be removed automatically. #
|
||||
# #
|
||||
#<override noisy="yes"
|
||||
# requirekey="no"
|
||||
# timeout="30m">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Oper levels module: Gives each oper a level and prevents actions
|
||||
|
@ -174,7 +174,7 @@ private:
|
||||
struct timespec TIME;
|
||||
|
||||
/** A 64k buffer used to read socket data into
|
||||
* NOTE: update ValidateNetBufferSize if you change this
|
||||
* Update the range of <performance:netbuffersize> if you change this
|
||||
*/
|
||||
char ReadBuffer[65535];
|
||||
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
* Sends a standard reply to the specified user if they have the specified cap
|
||||
* or a notice if they do not.
|
||||
* @param user The user to send the reply to.
|
||||
* @param cap The capability that determines the type of message to send.
|
||||
* @param command The command that the reply relates to.
|
||||
* @param code A machine readable code for this reply.
|
||||
* @param args A variable number of context parameters and a human readable description of this reply.
|
||||
|
@ -29,7 +29,7 @@ namespace IRCv3
|
||||
|
||||
/** Format a unix timestamp into the format used by server-time.
|
||||
* @param secs UNIX timestamp to format.
|
||||
* @params millisecs Number of milliseconds to format.
|
||||
* @param millisecs Number of milliseconds to format.
|
||||
* @return Time in server-time format, as a string.
|
||||
*/
|
||||
inline std::string FormatTime(time_t secs, long millisecs = 0)
|
||||
|
@ -255,7 +255,7 @@ public:
|
||||
/* Builder for the ERR_CHANOPRIVSNEEDED numeric. */
|
||||
class Numerics::ChannelPrivilegesNeeded : public Numeric::Numeric
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelPrivilegesNeeded(Channel* chan, unsigned int rank, const std::string& message)
|
||||
: Numeric(ERR_CHANOPRIVSNEEDED)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
const std::string& param = (newaccount.empty() ? joinhook.asterisk : newaccount);
|
||||
msg.PushParamRef(param);
|
||||
ClientProtocol::Event accountevent(accountprotoev, msg);
|
||||
IRCv3::WriteNeighborsWithCap(user, accountevent, cap_accountnotify);
|
||||
IRCv3::WriteNeighborsWithCap(user, accountevent, cap_accountnotify, true);
|
||||
}
|
||||
|
||||
void OnUserAway(User* user) override
|
||||
|
@ -35,6 +35,56 @@
|
||||
#include "modules/invite.h"
|
||||
#include "modules/isupport.h"
|
||||
|
||||
class UnsetTimer final
|
||||
: public Timer
|
||||
{
|
||||
private:
|
||||
ModeHandler& overridemode;
|
||||
LocalUser* user;
|
||||
|
||||
public:
|
||||
UnsetTimer(LocalUser* u, unsigned long timeout, ModeHandler& om)
|
||||
: Timer(timeout, false)
|
||||
, overridemode(om)
|
||||
, user(u)
|
||||
{
|
||||
ServerInstance->Timers.AddTimer(this);
|
||||
}
|
||||
|
||||
bool Tick() override
|
||||
{
|
||||
if (!user->quitting && user->IsModeSet(overridemode))
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_remove(&overridemode);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, nullptr, user, changelist);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class Override final
|
||||
: public SimpleUserMode
|
||||
{
|
||||
public:
|
||||
SimpleExtItem<UnsetTimer> ext;
|
||||
unsigned long timeout;
|
||||
|
||||
Override(Module* Creator)
|
||||
: SimpleUserMode(Creator, "override", 'O', true)
|
||||
, ext(Creator, "override-timer", ExtensionType::USER)
|
||||
{
|
||||
}
|
||||
|
||||
ModeAction OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change)
|
||||
{
|
||||
ModeAction res = SimpleUserMode::OnModeChange(source, dest, channel, change);
|
||||
if (change.adding && res == MODEACTION_ALLOW && IS_LOCAL(dest) && timeout)
|
||||
ext.Set(dest, new UnsetTimer(IS_LOCAL(dest), timeout, *this));
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleOverride final
|
||||
: public Module
|
||||
, public ISupport::EventListener
|
||||
@ -42,7 +92,7 @@ class ModuleOverride final
|
||||
private:
|
||||
bool RequireKey;
|
||||
bool NoisyOverride;
|
||||
SimpleUserMode ou;
|
||||
Override ou;
|
||||
ChanModeReference topiclock;
|
||||
ChanModeReference inviteonly;
|
||||
ChanModeReference key;
|
||||
@ -78,7 +128,7 @@ public:
|
||||
ModuleOverride()
|
||||
: Module(VF_VENDOR, "Allows server operators to be given privileges that allow them to ignore various channel-level restrictions.")
|
||||
, ISupport::EventListener(this)
|
||||
, ou(this, "override", 'O')
|
||||
, ou(this)
|
||||
, topiclock(this, "topiclock")
|
||||
, inviteonly(this, "inviteonly")
|
||||
, key(this, "key")
|
||||
@ -98,6 +148,7 @@ public:
|
||||
auto tag = ServerInstance->Config->ConfValue("override");
|
||||
NoisyOverride = tag->getBool("noisy");
|
||||
RequireKey = tag->getBool("requirekey");
|
||||
ou.timeout = tag->getDuration("timeout", 0);
|
||||
}
|
||||
|
||||
void OnBuildISupport(ISupport::TokenMap& tokens) override
|
||||
|
Loading…
x
Reference in New Issue
Block a user