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
4005b31d17
14
configure
vendored
14
configure
vendored
@ -240,12 +240,11 @@ if (defined $opt_portable) {
|
||||
|
||||
# Parse --gid=123 or --gid=foo and extract the group id.
|
||||
my @group;
|
||||
if (defined $opt_disable_ownership) {
|
||||
@group = qw(insert-group-here . -1);
|
||||
print_error 'you can not use --disable-ownership and --gid at the same time!' if defined $opt_gid;
|
||||
} elsif (defined $opt_gid) {
|
||||
if (defined $opt_gid) {
|
||||
@group = $opt_gid =~ /^\d+$/ ? getgrgid($opt_gid) : getgrnam($opt_gid);
|
||||
print_error "there is no '$opt_gid' group on this system!" unless @group;
|
||||
} elsif (defined $opt_disable_ownership) {
|
||||
@group = qw(insert-group-here . -1);
|
||||
} else {
|
||||
@group = $opt_system ? getgrnam('irc') : getgrgid($config{GID} // getgid());
|
||||
print_error "you need to specify a group to run as using '--gid [id|name]'!" unless @group;
|
||||
@ -270,12 +269,11 @@ $config{GID} = $group[2];
|
||||
|
||||
# Parse --uid=123 or --uid=foo and extract the user id.
|
||||
my @user;
|
||||
if (defined $opt_disable_ownership) {
|
||||
@user = qw(insert-user-here . -1);
|
||||
print_error 'you can not use --disable-ownership and --uid at the same time!' if defined $opt_uid;
|
||||
} elsif (defined $opt_uid) {
|
||||
if (defined $opt_uid) {
|
||||
@user = $opt_uid =~ /^\d+$/ ? getpwuid($opt_uid) : getpwnam($opt_uid);
|
||||
print_error "there is no '$opt_uid' user on this system!" unless @user;
|
||||
} elsif (defined $opt_disable_ownership) {
|
||||
@user = qw(insert-user-here . -1);
|
||||
} else {
|
||||
@user = $opt_system ? getpwnam('irc') : getpwuid($config{UID} // getuid());
|
||||
print_error "you need to specify a user to run as using '--uid [id|name]'!" unless @user;
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
unsigned int seq = 0;
|
||||
ChanModeReference secretmode;
|
||||
ChanModeReference privatemode;
|
||||
UserModeReference snomaskmode;
|
||||
|
||||
/** Show the list of one or more list modes to a user.
|
||||
* @param user User to send to.
|
||||
@ -59,6 +60,8 @@ private:
|
||||
return !chan->IsModeSet(secretmode) && !chan->IsModeSet(privatemode);
|
||||
}
|
||||
|
||||
std::string GetSnomasks(const User* user);
|
||||
|
||||
public:
|
||||
CommandMode(Module* parent);
|
||||
CmdResult Handle(User* user, const Params& parameters) override;
|
||||
@ -69,6 +72,7 @@ CommandMode::CommandMode(Module* parent)
|
||||
: Command(parent, "MODE", 1)
|
||||
, secretmode(creator, "secret")
|
||||
, privatemode(creator, "private")
|
||||
, snomaskmode(creator, "snomask")
|
||||
{
|
||||
syntax = { "<target> [[(+|-)]<modes> [<mode-parameters>]]" };
|
||||
memset(&sent, 0, sizeof(sent));
|
||||
@ -176,10 +180,9 @@ void CommandMode::DisplayListModes(User* user, Channel* chan, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
static std::string GetSnomasks(const User* user)
|
||||
std::string CommandMode::GetSnomasks(const User* user)
|
||||
{
|
||||
ModeHandler* const snomask = ServerInstance->Modes.FindMode('s', MODETYPE_USER);
|
||||
std::string snomaskstr = snomask->GetUserParameter(user);
|
||||
std::string snomaskstr = snomaskmode->GetUserParameter(user);
|
||||
// snomaskstr is empty if the snomask mode isn't set, otherwise it begins with a '+'.
|
||||
// In the former case output a "+", not an empty string.
|
||||
if (snomaskstr.empty())
|
||||
|
@ -759,7 +759,7 @@ bool ModeParser::DelModeWatcher(ModeWatcher* mw)
|
||||
void ModeHandler::RemoveMode(User* user)
|
||||
{
|
||||
// Remove the mode if it's set on the user
|
||||
if (user->IsModeSet(this->GetModeChar()))
|
||||
if (user->IsModeSet(this))
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_remove(this);
|
||||
|
@ -412,10 +412,8 @@ public:
|
||||
|
||||
ServerInstance->Logs.Debug(MODNAME, "Handling HTTP request for %s", http->GetPath().c_str());
|
||||
|
||||
bool found = true;
|
||||
std::stringstream data;
|
||||
data << "<inspircdstats>";
|
||||
|
||||
if (http->GetPath() == "/stats")
|
||||
{
|
||||
data << Stats::ServerInfo << Stats::General
|
||||
@ -436,21 +434,12 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
data << "</inspircdstats>";
|
||||
}
|
||||
else
|
||||
{
|
||||
data.clear();
|
||||
data.str(std::string());
|
||||
return MOD_RES_PASSTHRU;
|
||||
}
|
||||
data << "</inspircdstats>";
|
||||
|
||||
/* Send the document back to m_httpd */
|
||||
HTTPDocumentResponse response(this, *http, &data, found ? 200 : 404);
|
||||
HTTPDocumentResponse response(this, *http, &data, 200);
|
||||
response.headers.SetHeader("X-Powered-By", MODNAME);
|
||||
response.headers.SetHeader("Content-Type", "text/xml");
|
||||
API->SendResponse(response);
|
||||
|
Loading…
x
Reference in New Issue
Block a user