mirror of
https://github.com/anope/anope.git
synced 2026-07-03 03:43:12 +02:00
Allow userless command sources
This commit is contained in:
+29
-3
@@ -33,11 +33,23 @@ struct CommandInfo
|
||||
Anope::string permission;
|
||||
};
|
||||
|
||||
/* The source for a command */
|
||||
struct CoreExport CommandSource
|
||||
struct CommandReply
|
||||
{
|
||||
/* User executing the command */
|
||||
virtual void SendMessage(const BotInfo *source, const Anope::string &msg) = 0;
|
||||
};
|
||||
|
||||
/* The source for a command */
|
||||
class CoreExport CommandSource
|
||||
{
|
||||
/* The nick executing the command */
|
||||
Anope::string nick;
|
||||
/* User executing the command, may be NULL */
|
||||
User *u;
|
||||
public:
|
||||
/* The account executing the command */
|
||||
NickCore *nc;
|
||||
/* Where the reply should go */
|
||||
CommandReply *reply;
|
||||
/* Channel the command was executed on (fantasy) */
|
||||
Channel *c;
|
||||
/* The service this command is on */
|
||||
@@ -49,8 +61,20 @@ struct CoreExport CommandSource
|
||||
/* The permission of the command being executed */
|
||||
Anope::string permission;
|
||||
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply);
|
||||
|
||||
const Anope::string &GetNick() const;
|
||||
User *GetUser() const;
|
||||
AccessGroup AccessFor(ChannelInfo *ci) const;
|
||||
bool IsFounder(ChannelInfo *ci) const;
|
||||
|
||||
void Reply(const char *message, ...);
|
||||
void Reply(const Anope::string &message);
|
||||
|
||||
bool HasCommand(const Anope::string &cmd);
|
||||
bool HasPriv(const Anope::string &cmd);
|
||||
bool IsServicesOper() const;
|
||||
bool IsOper() const;
|
||||
};
|
||||
|
||||
/** Every services command is a class, inheriting from Command.
|
||||
@@ -118,4 +142,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
|
||||
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
|
||||
};
|
||||
|
||||
extern void RunCommand(CommandSource &source, const Anope::string &message);
|
||||
|
||||
#endif // COMMANDS_H
|
||||
|
||||
+2
-2
@@ -81,11 +81,11 @@ class CoreExport ListFormatter
|
||||
*/
|
||||
class CoreExport InfoFormatter
|
||||
{
|
||||
User *user;
|
||||
NickCore *nc;
|
||||
std::vector<std::pair<Anope::string, Anope::string> > replies;
|
||||
unsigned longest;
|
||||
public:
|
||||
InfoFormatter(User *u);
|
||||
InfoFormatter(NickCore *nc);
|
||||
void Process(std::vector<Anope::string> &);
|
||||
Anope::string &operator[](const Anope::string &key);
|
||||
};
|
||||
|
||||
+2
-1
@@ -50,6 +50,7 @@ class CoreExport Log
|
||||
public:
|
||||
const BotInfo *bi;
|
||||
const User *u;
|
||||
const NickCore *nc;
|
||||
Command *c;
|
||||
Channel *chan;
|
||||
const ChannelInfo *ci;
|
||||
@@ -63,7 +64,7 @@ class CoreExport Log
|
||||
Log(LogType type = LOG_NORMAL, const Anope::string &category = "", const BotInfo *bi = NULL);
|
||||
|
||||
/* LOG_COMMAND/OVERRIDE/ADMIN */
|
||||
Log(LogType type, const User *u, Command *c, const ChannelInfo *ci = NULL);
|
||||
Log(LogType type, const CommandSource &source, Command *c, const ChannelInfo *ci = NULL);
|
||||
|
||||
/* LOG_CHANNEL */
|
||||
Log(const User *u, Channel *c, const Anope::string &category = "");
|
||||
|
||||
+19
-19
@@ -499,25 +499,25 @@ class CoreExport Module : public Extensible
|
||||
virtual EventReturn OnExceptionAdd(Exception *ex) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called before an exception is deleted
|
||||
* @param u The user who is deleting it
|
||||
* @param source The source deleting it
|
||||
* @param ex The exceotion
|
||||
*/
|
||||
virtual void OnExceptionDel(User *u, Exception *ex) { }
|
||||
virtual void OnExceptionDel(CommandSource &source, Exception *ex) { }
|
||||
|
||||
/** Called before a XLine is added
|
||||
* @param u The user adding the XLine
|
||||
* @param source The source of the XLine
|
||||
* @param x The XLine
|
||||
* @param xlm The xline manager it was added to
|
||||
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
|
||||
*/
|
||||
virtual EventReturn OnAddXLine(User *u, const XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; }
|
||||
virtual EventReturn OnAddXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called before a XLine is deleted
|
||||
* @param u The user deleting the XLine
|
||||
* @param source The source of the XLine
|
||||
* @param x The XLine
|
||||
* @param xlm The xline manager it was deleted from
|
||||
*/
|
||||
virtual void OnDelXLine(User *u, const XLine *x, XLineManager *xlm) { }
|
||||
virtual void OnDelXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { }
|
||||
|
||||
/** Called when a user is checked for whether they are a services oper
|
||||
* @param u The user
|
||||
@@ -558,31 +558,31 @@ class CoreExport Module : public Extensible
|
||||
|
||||
/** Called when access is deleted from a channel
|
||||
* @param ci The channel
|
||||
* @param u The user who removed the access
|
||||
* @param source The source of the command
|
||||
* @param access The access entry being removed
|
||||
*/
|
||||
virtual void OnAccessDel(ChannelInfo *ci, User *u, ChanAccess *access) { }
|
||||
virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { }
|
||||
|
||||
/** Called when access is added
|
||||
* @param ci The channel
|
||||
* @param u The user who added the access
|
||||
* @param source The source of the command
|
||||
* @param access The access changed
|
||||
*/
|
||||
virtual void OnAccessAdd(ChannelInfo *ci, User *u, ChanAccess *access) { }
|
||||
virtual void OnAccessAdd(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { }
|
||||
|
||||
/** Called when the access list is cleared
|
||||
* @param ci The channel
|
||||
* @param u The user who cleared the access
|
||||
*/
|
||||
virtual void OnAccessClear(ChannelInfo *ci, User *u) { }
|
||||
virtual void OnAccessClear(ChannelInfo *ci, CommandSource &source) { }
|
||||
|
||||
/** Called when a level for a channel is changed
|
||||
* @param u The user changing the level
|
||||
* @param source The source of the command
|
||||
* @param ci The channel the level was changed on
|
||||
* @param priv The privilege changed
|
||||
* @param what The new level
|
||||
*/
|
||||
virtual void OnLevelChange(User *u, ChannelInfo *ci, const Anope::string &priv, int16_t what) { }
|
||||
virtual void OnLevelChange(CommandSource &source, ChannelInfo *ci, const Anope::string &priv, int16_t what) { }
|
||||
|
||||
/** Called right before a channel is dropped
|
||||
* @param ci The channel
|
||||
@@ -625,18 +625,18 @@ class CoreExport Module : public Extensible
|
||||
virtual void OnChannelDelete(Channel *c) { }
|
||||
|
||||
/** Called after adding an akick to a channel
|
||||
* @param u The user adding the akick
|
||||
* @param source The source of the command
|
||||
* @param ci The channel
|
||||
* @param ak The akick
|
||||
*/
|
||||
virtual void OnAkickAdd(User *u, ChannelInfo *ci, const AutoKick *ak) { }
|
||||
virtual void OnAkickAdd(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { }
|
||||
|
||||
/** Called before removing an akick from a channel
|
||||
* @param u The user removing the akick
|
||||
* @param source The source of the command
|
||||
* @param ci The channel
|
||||
* @param ak The akick
|
||||
*/
|
||||
virtual void OnAkickDel(User *u, ChannelInfo *ci, const AutoKick *ak) { }
|
||||
virtual void OnAkickDel(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { }
|
||||
|
||||
/** Called after a user join a channel when we decide whether to kick them or not
|
||||
* @param u The user
|
||||
@@ -669,10 +669,10 @@ class CoreExport Module : public Extensible
|
||||
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called when a nick is dropped
|
||||
* @param u The user dropping the nick
|
||||
* @param source The source of the command
|
||||
* @param na The nick
|
||||
*/
|
||||
virtual void OnNickDrop(User *u, NickAlias *na) { }
|
||||
virtual void OnNickDrop(CommandSource &source, NickAlias *na) { }
|
||||
|
||||
/** Called when a nick is forbidden
|
||||
* @param na The nick alias of the forbidden nick
|
||||
|
||||
+5
-4
@@ -12,6 +12,7 @@
|
||||
#include "modes.h"
|
||||
#include "extensible.h"
|
||||
#include "serialize.h"
|
||||
#include "commands.h"
|
||||
|
||||
extern CoreExport Anope::insensitive_map<User *> UserListByNick;
|
||||
extern CoreExport Anope::map<User *> UserListByUID;
|
||||
@@ -37,7 +38,7 @@ typedef std::list<ChannelContainer *> UChannelList;
|
||||
|
||||
|
||||
/* Online user and channel data. */
|
||||
class CoreExport User : public virtual Base, public Extensible
|
||||
class CoreExport User : public virtual Base, public Extensible, public CommandReply
|
||||
{
|
||||
protected:
|
||||
Anope::string vident;
|
||||
@@ -161,7 +162,7 @@ class CoreExport User : public virtual Base, public Extensible
|
||||
* @param ... any number of parameters
|
||||
*/
|
||||
void SendMessage(const BotInfo *source, const char *fmt, ...);
|
||||
virtual void SendMessage(const BotInfo *source, Anope::string msg);
|
||||
void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override;
|
||||
|
||||
/** Collide a nick
|
||||
* See the comment in users.cpp
|
||||
@@ -194,13 +195,13 @@ class CoreExport User : public virtual Base, public Extensible
|
||||
* @param CheckNick True to check if the user is identified to the nickname they are on too
|
||||
* @return true or false
|
||||
*/
|
||||
virtual bool IsIdentified(bool CheckNick = false) const;
|
||||
bool IsIdentified(bool CheckNick = false) const;
|
||||
|
||||
/** Check if the user is recognized for their nick (on the nicks access list)
|
||||
* @param CheckSecure Only returns true if the user has secure off
|
||||
* @return true or false
|
||||
*/
|
||||
virtual bool IsRecognized(bool CheckSecure = true) const;
|
||||
bool IsRecognized(bool CheckSecure = true) const;
|
||||
|
||||
/** Check if the user is a services oper
|
||||
* @return true if they are an oper
|
||||
|
||||
@@ -27,8 +27,6 @@ class CommandBSAssign : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &nick = params[1];
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
source.Reply(BOT_ASSIGN_READONLY);
|
||||
@@ -49,13 +47,14 @@ class CommandBSAssign : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (ci->botflags.HasFlag(BS_NOBOT) || (!ci->AccessFor(u).HasPriv("ASSIGN") && !u->HasPriv("botserv/administration")))
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
if (ci->botflags.HasFlag(BS_NOBOT) || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration")))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bi->HasFlag(BI_PRIVATE) && !u->HasCommand("botserv/assign/private"))
|
||||
if (bi->HasFlag(BI_PRIVATE) && !source.HasCommand("botserv/assign/private"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -67,10 +66,10 @@ class CommandBSAssign : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("ASSIGN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << bi->nick;
|
||||
bool override = !access.HasPriv("ASSIGN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << bi->nick;
|
||||
|
||||
bi->Assign(u, ci);
|
||||
bi->Assign(source.GetUser(), ci);
|
||||
source.Reply(_("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), ci->name.c_str());
|
||||
}
|
||||
|
||||
@@ -96,8 +95,6 @@ class CommandBSUnassign : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
source.Reply(BOT_ASSIGN_READONLY);
|
||||
@@ -111,7 +108,8 @@ class CommandBSUnassign : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv("ASSIGN"))
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -129,10 +127,10 @@ class CommandBSUnassign : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("ASSIGN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << ci->bi->nick;
|
||||
bool override = !access.HasPriv("ASSIGN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << ci->bi->nick;
|
||||
|
||||
ci->bi->UnAssign(u, ci);
|
||||
ci->bi->UnAssign(source.GetUser(), ci);
|
||||
source.Reply(_("There is no bot assigned to %s anymore."), ci->name.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class BadwordsDelCallback : public NumberList
|
||||
public:
|
||||
BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), Deleted(0), override(false)
|
||||
{
|
||||
if (!ci->AccessFor(source.u).HasPriv("BADWORDS") && source.u->HasPriv("botserv/administration"))
|
||||
if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration"))
|
||||
this->override = true;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class BadwordsDelCallback : public NumberList
|
||||
if (!Number || Number > ci->GetBadWordCount())
|
||||
return;
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "DEL " << ci->GetBadWord(Number - 1)->word;
|
||||
++Deleted;
|
||||
ci->EraseBadWord(Number - 1);
|
||||
}
|
||||
@@ -54,8 +54,8 @@ class CommandBSBadwords : public Command
|
||||
private:
|
||||
void DoList(CommandSource &source, ChannelInfo *ci, const Anope::string &word)
|
||||
{
|
||||
bool override = !ci->AccessFor(source.u).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "LIST";
|
||||
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
|
||||
ListFormatter list;
|
||||
|
||||
list.addColumn("Number").addColumn("Word").addColumn("Type");
|
||||
@@ -163,8 +163,8 @@ class CommandBSBadwords : public Command
|
||||
}
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(source.u).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "ADD " << realword;
|
||||
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ADD " << realword;
|
||||
ci->AddBadWord(realword, bwtype);
|
||||
|
||||
source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str());
|
||||
@@ -199,8 +199,8 @@ class CommandBSBadwords : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(source.u).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "DEL " << badword->word;
|
||||
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "DEL " << badword->word;
|
||||
|
||||
source.Reply(_("\002%s\002 deleted from %s bad words list."), badword->word.c_str(), ci->name.c_str());
|
||||
|
||||
@@ -212,8 +212,8 @@ class CommandBSBadwords : public Command
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
bool override = !ci->AccessFor(source.u).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, this, ci) << "CLEAR";
|
||||
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "CLEAR";
|
||||
|
||||
ci->ClearBadWords();
|
||||
source.Reply(_("Bad words list is now empty."));
|
||||
@@ -233,7 +233,6 @@ class CommandBSBadwords : public Command
|
||||
{
|
||||
const Anope::string &cmd = params[1];
|
||||
const Anope::string &word = params.size() > 2 ? params[2] : "";
|
||||
User *u = source.u;
|
||||
bool need_args = cmd.equals_ci("LIST") || cmd.equals_ci("CLEAR");
|
||||
|
||||
if (!need_args && word.empty())
|
||||
@@ -249,8 +248,7 @@ class CommandBSBadwords : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("BADWORDS") && (!need_args || !u->HasPriv("botserv/administration")))
|
||||
if (!source.AccessFor(ci).HasPriv("BADWORDS") && (!need_args || !source.HasPriv("botserv/administration")))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -94,7 +94,7 @@ class CommandBSBot : public Command
|
||||
|
||||
BotInfo *bi = new BotInfo(nick, user, host, real);
|
||||
|
||||
Log(LOG_ADMIN, source.u, this) << "ADD " << bi->GetMask() << " " << bi->realname;
|
||||
Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname;
|
||||
|
||||
source.Reply(_("%s!%s@%s (%s) added to the bot list."), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
|
||||
|
||||
@@ -253,7 +253,7 @@ class CommandBSBot : public Command
|
||||
}
|
||||
|
||||
source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)"), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str());
|
||||
Log(LOG_ADMIN, source.u, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
|
||||
Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname;
|
||||
|
||||
FOREACH_MOD(I_OnBotChange, OnBotChange(bi));
|
||||
return;
|
||||
@@ -284,7 +284,7 @@ class CommandBSBot : public Command
|
||||
|
||||
FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi));
|
||||
|
||||
Log(LOG_ADMIN, source.u, this) << "DEL " << bi->nick;
|
||||
Log(LOG_ADMIN, source, this) << "DEL " << bi->nick;
|
||||
|
||||
source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str());
|
||||
bi->destroy();
|
||||
@@ -302,7 +302,6 @@ class CommandBSBot : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string &cmd = params[0];
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
@@ -313,7 +312,7 @@ class CommandBSBot : public Command
|
||||
if (cmd.equals_ci("ADD"))
|
||||
{
|
||||
// ADD nick user host real - 5
|
||||
if (!u->HasCommand("botserv/bot/add"))
|
||||
if (!source.HasCommand("botserv/bot/add"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -336,7 +335,7 @@ class CommandBSBot : public Command
|
||||
{
|
||||
// CHANGE oldn newn user host real - 6
|
||||
// but only oldn and newn are required
|
||||
if (!u->HasCommand("botserv/bot/change"))
|
||||
if (!source.HasCommand("botserv/bot/change"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -353,7 +352,7 @@ class CommandBSBot : public Command
|
||||
else if (cmd.equals_ci("DEL"))
|
||||
{
|
||||
// DEL nick
|
||||
if (!u->HasCommand("botserv/bot/del"))
|
||||
if (!source.HasCommand("botserv/bot/del"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSBotList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
unsigned count = 0;
|
||||
ListFormatter list;
|
||||
|
||||
@@ -34,7 +33,7 @@ class CommandBSBotList : public Command
|
||||
{
|
||||
BotInfo *bi = it->second;
|
||||
|
||||
if (u->HasCommand("botserv/botlist") || !bi->HasFlag(BI_PRIVATE))
|
||||
if (source.HasCommand("botserv/botlist") || !bi->HasFlag(BI_PRIVATE))
|
||||
{
|
||||
++count;
|
||||
ListFormatter::ListEntry entry;
|
||||
|
||||
@@ -26,8 +26,6 @@ class CommandBSSay : public Command
|
||||
{
|
||||
const Anope::string &text = params[1];
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -35,7 +33,7 @@ class CommandBSSay : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("SAY"))
|
||||
if (!source.AccessFor(ci).HasPriv("SAY"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -63,7 +61,7 @@ class CommandBSSay : public Command
|
||||
ci->bi->lastmsg = Anope::CurTime;
|
||||
|
||||
// XXX need a way to find if someone is overriding this
|
||||
Log(LOG_COMMAND, u, this, ci) << text;
|
||||
Log(LOG_COMMAND, source, this, ci) << text;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +86,6 @@ class CommandBSAct : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
Anope::string message = params[1];
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
@@ -98,7 +95,7 @@ class CommandBSAct : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("SAY"))
|
||||
if (!source.AccessFor(ci).HasPriv("SAY"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -124,7 +121,7 @@ class CommandBSAct : public Command
|
||||
ci->bi->lastmsg = Anope::CurTime;
|
||||
|
||||
// XXX Need to be able to find if someone is overriding this.
|
||||
Log(LOG_COMMAND, u, this, ci) << message;
|
||||
Log(LOG_COMMAND, source, this, ci) << message;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,10 +59,9 @@ class CommandBSInfo : public Command
|
||||
{
|
||||
const Anope::string &query = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
const BotInfo *bi = findbot(query);
|
||||
ChannelInfo *ci;
|
||||
InfoFormatter info(u);
|
||||
InfoFormatter info(source.nc);
|
||||
|
||||
if (bi)
|
||||
{
|
||||
@@ -79,7 +78,7 @@ class CommandBSInfo : public Command
|
||||
for (unsigned i = 0; i < replies.size(); ++i)
|
||||
source.Reply(replies[i]);
|
||||
|
||||
if (u->HasPriv("botserv/administration"))
|
||||
if (source.HasPriv("botserv/administration"))
|
||||
{
|
||||
std::vector<Anope::string> buf;
|
||||
this->send_bot_channels(buf, bi);
|
||||
@@ -90,7 +89,7 @@ class CommandBSInfo : public Command
|
||||
}
|
||||
else if ((ci = cs_findchan(query)))
|
||||
{
|
||||
if (!ci->AccessFor(u).HasPriv("FOUNDER") && !u->HasPriv("botserv/administration"))
|
||||
if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("botserv/administration"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -99,8 +98,8 @@ class CommandBSInfo : public Command
|
||||
source.Reply(CHAN_INFO_HEADER, ci->name.c_str());
|
||||
info[_("Bot nick")] = ci->bi ? ci->bi->nick : "not assigned yet";
|
||||
|
||||
Anope::string enabled = translate(u, _("Enabled"));
|
||||
Anope::string disabled = translate(u, _("Disabled"));
|
||||
Anope::string enabled = translate(source.nc, _("Enabled"));
|
||||
Anope::string disabled = translate(source.nc, _("Disabled"));
|
||||
|
||||
if (ci->botflags.HasFlag(BS_KICK_BADWORDS))
|
||||
{
|
||||
@@ -203,11 +202,11 @@ class CommandBSInfo : public Command
|
||||
info[_("AMSG kicker")] = disabled;
|
||||
|
||||
Anope::string flags;
|
||||
CheckOptStr(flags, BS_DONTKICKOPS, _("Ops protection"), ci->botflags, u->Account());
|
||||
CheckOptStr(flags, BS_DONTKICKVOICES, _("Voices protection"), ci->botflags, u->Account());
|
||||
CheckOptStr(flags, BS_FANTASY, _("Fantasy"), ci->botflags, u->Account());
|
||||
CheckOptStr(flags, BS_GREET, _("Greet"), ci->botflags, u->Account());
|
||||
CheckOptStr(flags, BS_NOBOT, _("No bot"), ci->botflags, u->Account());
|
||||
CheckOptStr(flags, BS_DONTKICKOPS, _("Ops protection"), ci->botflags, source.nc);
|
||||
CheckOptStr(flags, BS_DONTKICKVOICES, _("Voices protection"), ci->botflags, source.nc);
|
||||
CheckOptStr(flags, BS_FANTASY, _("Fantasy"), ci->botflags, source.nc);
|
||||
CheckOptStr(flags, BS_GREET, _("Greet"), ci->botflags, source.nc);
|
||||
CheckOptStr(flags, BS_NOBOT, _("No bot"), ci->botflags, source.nc);
|
||||
|
||||
info[_("Options")] = flags.empty() ? _("None") : flags;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ class CommandBSKick : public Command
|
||||
const Anope::string &value = params[2];
|
||||
const Anope::string &ttb = params.size() > 3 ? params[3] : "";
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
|
||||
if (readonly)
|
||||
@@ -41,14 +40,14 @@ class CommandBSKick : public Command
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (!value.equals_ci("ON") && !value.equals_ci("OFF"))
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (!ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("botserv/administration"))
|
||||
else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("botserv/administration"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!ci->bi)
|
||||
source.Reply(BOT_NOT_ASSIGNED);
|
||||
else
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << option << " " << value;
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << option << " " << value;
|
||||
|
||||
if (option.equals_ci("BADWORDS"))
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetDontKickOps : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,8 @@ class CommandBSSetDontKickOps : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv("SET"))
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -46,16 +46,16 @@ class CommandBSSetDontKickOps : public Command
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to enable dontkickops";
|
||||
bool override = !access.HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops";
|
||||
|
||||
ci->botflags.SetFlag(BS_DONTKICKOPS);
|
||||
source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str());
|
||||
}
|
||||
else if (params[1].equals_ci("OFF"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to disable dontkickops";
|
||||
bool override = !access.HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops";
|
||||
|
||||
ci->botflags.UnsetFlag(BS_DONTKICKOPS);
|
||||
source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str());
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetDontKickVoices : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,8 @@ class CommandBSSetDontKickVoices : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv("SET"))
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -46,16 +46,16 @@ class CommandBSSetDontKickVoices : public Command
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to enable dontkickvoices";
|
||||
bool override = !access.HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices";
|
||||
|
||||
ci->botflags.SetFlag(BS_DONTKICKVOICES);
|
||||
source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str());
|
||||
}
|
||||
else if (params[1].equals_ci("OFF"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to disable dontkickvoices";
|
||||
bool override = !access.HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices";
|
||||
|
||||
ci->botflags.UnsetFlag(BS_DONTKICKVOICES);
|
||||
source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str());
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetFantasy : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
@@ -34,7 +33,7 @@ class CommandBSSetFantasy : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -48,16 +47,16 @@ class CommandBSSetFantasy : public Command
|
||||
|
||||
if (value.equals_ci("ON"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to enable fantasy";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy";
|
||||
|
||||
ci->botflags.SetFlag(BS_FANTASY);
|
||||
source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str());
|
||||
}
|
||||
else if (value.equals_ci("OFF"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to disable fantasy";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy";
|
||||
|
||||
ci->botflags.UnsetFlag(BS_FANTASY);
|
||||
source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str());
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetGreet : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
@@ -34,7 +33,7 @@ class CommandBSSetGreet : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasPriv("botserv/administration") && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -48,16 +47,16 @@ class CommandBSSetGreet : public Command
|
||||
|
||||
if (value.equals_ci("ON"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to enable greets";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
|
||||
|
||||
ci->botflags.SetFlag(BS_GREET);
|
||||
source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str());
|
||||
}
|
||||
else if (value.equals_ci("OFF"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to disable greets";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
|
||||
|
||||
ci->botflags.UnsetFlag(BS_GREET);
|
||||
source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str());
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetNoBot : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
@@ -34,7 +33,7 @@ class CommandBSSetNoBot : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasCommand("botserv/set/nobot"))
|
||||
if (!source.HasCommand("botserv/set/nobot"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -42,18 +41,18 @@ class CommandBSSetNoBot : public Command
|
||||
|
||||
if (value.equals_ci("ON"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to enable nobot";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot";
|
||||
|
||||
ci->botflags.SetFlag(BS_NOBOT);
|
||||
if (ci->bi)
|
||||
ci->bi->UnAssign(u, ci);
|
||||
ci->bi->UnAssign(source.GetUser(), ci);
|
||||
source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str());
|
||||
}
|
||||
else if (value.equals_ci("OFF"))
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
Log(override ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to disable nobot";
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot";
|
||||
|
||||
ci->botflags.UnsetFlag(BS_NOBOT);
|
||||
source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str());
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandBSSetPrivate : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
BotInfo *bi = findbot(params[0]);
|
||||
const Anope::string &value = params[1];
|
||||
|
||||
@@ -34,7 +33,7 @@ class CommandBSSetPrivate : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasCommand("botserv/set/private"))
|
||||
if (!source.HasCommand("botserv/set/private"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -90,8 +90,6 @@ class CommandCSAccess : public Command
|
||||
{
|
||||
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string mask = params[2];
|
||||
int level = ACCESS_INVALID;
|
||||
|
||||
@@ -112,7 +110,7 @@ class CommandCSAccess : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
const ChanAccess *highest = u_access.Highest();
|
||||
|
||||
AccessChanAccess tmp_access(NULL);
|
||||
@@ -123,7 +121,7 @@ class CommandCSAccess : public Command
|
||||
|
||||
if ((!highest || *highest <= tmp_access) && !u_access.Founder)
|
||||
{
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
override = true;
|
||||
else
|
||||
{
|
||||
@@ -150,7 +148,7 @@ class CommandCSAccess : public Command
|
||||
if (mask.equals_ci(access->mask))
|
||||
{
|
||||
/* Don't allow lowering from a level >= u_level */
|
||||
if ((!highest || *access >= *highest) && !u_access.Founder && !u->HasPriv("chanserv/access/modify"))
|
||||
if ((!highest || *access >= *highest) && !u_access.Founder && !source.HasPriv("chanserv/access/modify"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -172,15 +170,15 @@ class CommandCSAccess : public Command
|
||||
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->creator = u->nick;
|
||||
access->creator = source.GetNick();
|
||||
access->level = level;
|
||||
access->last_seen = 0;
|
||||
access->created = Anope::CurTime;
|
||||
ci->AddAccess(access);
|
||||
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, access));
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, source, access));
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to add " << mask << " with level " << level;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level;
|
||||
source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level);
|
||||
|
||||
return;
|
||||
@@ -188,8 +186,6 @@ class CommandCSAccess : public Command
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &mask = params[2];
|
||||
|
||||
if (!ci->GetAccessCount())
|
||||
@@ -208,7 +204,7 @@ class CommandCSAccess : public Command
|
||||
public:
|
||||
AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), Deleted(0), Denied(false), override(false)
|
||||
{
|
||||
if (!ci->AccessFor(source.u).HasPriv("ACCESS_CHANGE") && source.u->HasPriv("chanserv/access/modify"))
|
||||
if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify"))
|
||||
this->override = true;
|
||||
}
|
||||
|
||||
@@ -220,7 +216,7 @@ class CommandCSAccess : public Command
|
||||
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "to delete " << Nicks;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks;
|
||||
|
||||
if (Deleted == 1)
|
||||
source.Reply(_("Deleted 1 entry from %s access list."), ci->name.c_str());
|
||||
@@ -234,14 +230,12 @@ class CommandCSAccess : public Command
|
||||
if (!Number || Number > ci->GetAccessCount())
|
||||
return;
|
||||
|
||||
User *user = source.u;
|
||||
|
||||
ChanAccess *access = ci->GetAccess(Number - 1);
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(user);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
const ChanAccess *u_highest = u_access.Highest();
|
||||
|
||||
if ((!u_highest || *u_highest <= *access) && !u_access.Founder && !this->override && !access->mask.equals_ci(user->Account()->display))
|
||||
if ((!u_highest || *u_highest <= *access) && !u_access.Founder && !this->override && !access->mask.equals_ci(source.nc->display))
|
||||
{
|
||||
Denied = true;
|
||||
return;
|
||||
@@ -253,7 +247,7 @@ class CommandCSAccess : public Command
|
||||
else
|
||||
Nicks = access->mask;
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, user, access));
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, access));
|
||||
|
||||
ci->EraseAccess(Number - 1);
|
||||
}
|
||||
@@ -263,7 +257,7 @@ class CommandCSAccess : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
const ChanAccess *highest = u_access.Highest();
|
||||
|
||||
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
|
||||
@@ -271,15 +265,15 @@ class CommandCSAccess : public Command
|
||||
ChanAccess *access = ci->GetAccess(i - 1);
|
||||
if (mask.equals_ci(access->mask))
|
||||
{
|
||||
if (!access->mask.equals_ci(u->Account()->display) && !u_access.Founder && (!highest || *highest <= *access) && !u->HasPriv("chanserv/access/modify"))
|
||||
if (!access->mask.equals_ci(source.nc->display) && !u_access.Founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str());
|
||||
bool override = !u_access.Founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(u->Account()->display);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to delete " << access->mask;
|
||||
bool override = !u_access.Founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask;
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, access));
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, access));
|
||||
ci->EraseAccess(access);
|
||||
}
|
||||
return;
|
||||
@@ -420,20 +414,18 @@ class CommandCSAccess : public Command
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (!IsFounder(u, ci) && !u->HasPriv("chanserv/access/modify"))
|
||||
if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u));
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, source));
|
||||
|
||||
ci->ClearAccess();
|
||||
|
||||
source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str());
|
||||
|
||||
bool override = !IsFounder(u, ci);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to clear the access list";
|
||||
bool override = !source.IsFounder(ci);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list";
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -456,7 +448,6 @@ class CommandCSAccess : public Command
|
||||
const Anope::string &nick = params.size() > 2 ? params[2] : "";
|
||||
const Anope::string &s = params.size() > 3 ? params[3] : "";
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -469,16 +460,16 @@ class CommandCSAccess : public Command
|
||||
bool is_del = cmd.equals_ci("DEL");
|
||||
|
||||
bool has_access = false;
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
has_access = true;
|
||||
else if (is_list && ci->AccessFor(u).HasPriv("ACCESS_LIST"))
|
||||
else if (is_list && source.AccessFor(ci).HasPriv("ACCESS_LIST"))
|
||||
has_access = true;
|
||||
else if (ci->AccessFor(u).HasPriv("ACCESS_CHANGE"))
|
||||
else if (source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
|
||||
has_access = true;
|
||||
else if (is_del)
|
||||
{
|
||||
const NickAlias *na = findnick(nick);
|
||||
if (na && na->nc == u->Account())
|
||||
if (na && na->nc == source.nc)
|
||||
has_access = true;
|
||||
}
|
||||
|
||||
@@ -575,8 +566,6 @@ class CommandCSLevels : public Command
|
||||
{
|
||||
void DoSet(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &what = params[2];
|
||||
const Anope::string &lev = params[3];
|
||||
|
||||
@@ -607,10 +596,10 @@ class CommandCSLevels : public Command
|
||||
else
|
||||
{
|
||||
ci->SetLevel(p->name, level);
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, p->name, level));
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(source, ci, p->name, level));
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to set " << p->name << " to level " << level;
|
||||
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << p->name << " to level " << level;
|
||||
|
||||
if (level == ACCESS_FOUNDER)
|
||||
source.Reply(_("Level for %s on channel %s changed to founder only."), p->name.c_str(), ci->name.c_str());
|
||||
@@ -622,8 +611,6 @@ class CommandCSLevels : public Command
|
||||
|
||||
void DoDisable(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &what = params[2];
|
||||
|
||||
/* Don't allow disabling of the founder level. It would be hard to change it back if you dont have access to use this command */
|
||||
@@ -633,10 +620,10 @@ class CommandCSLevels : public Command
|
||||
if (p != NULL)
|
||||
{
|
||||
ci->SetLevel(p->name, ACCESS_INVALID);
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, p->name, ACCESS_INVALID));
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(source, ci, p->name, ACCESS_INVALID));
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to disable " << p->name;
|
||||
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable " << p->name;
|
||||
|
||||
source.Reply(_("\002%s\002 disabled on channel %s."), p->name.c_str(), ci->name.c_str());
|
||||
return;
|
||||
@@ -684,13 +671,11 @@ class CommandCSLevels : public Command
|
||||
|
||||
void DoReset(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
reset_levels(ci);
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(u, ci, "ALL", 0));
|
||||
FOREACH_MOD(I_OnLevelChange, OnLevelChange(source, ci, "ALL", 0));
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to reset all levels";
|
||||
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to reset all levels";
|
||||
|
||||
source.Reply(_("Access levels for \002%s\002 reset to defaults."), ci->name.c_str());
|
||||
return;
|
||||
@@ -712,8 +697,6 @@ class CommandCSLevels : public Command
|
||||
const Anope::string &what = params.size() > 2 ? params[2] : "";
|
||||
const Anope::string &s = params.size() > 3 ? params[3] : "";
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -726,7 +709,7 @@ class CommandCSLevels : public Command
|
||||
*/
|
||||
if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty()))
|
||||
this->OnSyntaxError(source, cmd);
|
||||
else if (!ci->AccessFor(u).HasPriv("FOUNDER") && !u->HasPriv("chanserv/access/modify"))
|
||||
else if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (cmd.equals_ci("SET"))
|
||||
this->DoSet(source, ci, params);
|
||||
@@ -757,7 +740,7 @@ class CommandCSLevels : public Command
|
||||
const Privilege &p = privs[i];
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Name"] = p.name;
|
||||
entry["Description"] = translate(source.u, p.desc.c_str());
|
||||
entry["Description"] = translate(source.nc, p.desc.c_str());
|
||||
list.addEntry(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,6 @@ class CommandCSAKick : public Command
|
||||
{
|
||||
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string mask = params[2];
|
||||
Anope::string reason = params.size() > 3 ? params[3] : "";
|
||||
const NickAlias *na = findnick(mask);
|
||||
@@ -86,7 +84,7 @@ class CommandCSAKick : public Command
|
||||
* or whether the mask matches a user with higher/equal access - Viper */
|
||||
if (ci->HasFlag(CI_PEACE) && nc)
|
||||
{
|
||||
AccessGroup nc_access = ci->AccessFor(nc), u_access = ci->AccessFor(u);
|
||||
AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
|
||||
if (nc == ci->GetFounder() || nc_access >= u_access)
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
@@ -101,7 +99,7 @@ class CommandCSAKick : public Command
|
||||
{
|
||||
User *u2 = it->second;
|
||||
|
||||
AccessGroup nc_access = ci->AccessFor(nc), u_access = ci->AccessFor(u);
|
||||
AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
|
||||
Entry entry_mask(CMODE_BEGIN, mask);
|
||||
|
||||
if ((ci->AccessFor(u2).HasPriv("FOUNDER") || nc_access >= u_access) && entry_mask.Matches(u2))
|
||||
@@ -117,7 +115,7 @@ class CommandCSAKick : public Command
|
||||
{
|
||||
na = it->second;
|
||||
|
||||
AccessGroup nc_access = ci->AccessFor(na->nc), u_access = ci->AccessFor(u);
|
||||
AccessGroup nc_access = ci->AccessFor(na->nc), u_access = source.AccessFor(ci);
|
||||
if (na->nc && (na->nc == ci->GetFounder() || nc_access >= u_access))
|
||||
{
|
||||
Anope::string buf = na->nick + "!" + na->last_usermask;
|
||||
@@ -147,14 +145,14 @@ class CommandCSAKick : public Command
|
||||
}
|
||||
|
||||
if (nc)
|
||||
akick = ci->AddAkick(u->nick, nc, reason);
|
||||
akick = ci->AddAkick(source.GetNick(), nc, reason);
|
||||
else
|
||||
akick = ci->AddAkick(u->nick, mask, reason);
|
||||
akick = ci->AddAkick(source.GetNick(), mask, reason);
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason;
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason;
|
||||
|
||||
FOREACH_MOD(I_OnAkickAdd, OnAkickAdd(u, ci, akick));
|
||||
FOREACH_MOD(I_OnAkickAdd, OnAkickAdd(source, ci, akick));
|
||||
|
||||
source.Reply(_("\002%s\002 added to %s autokick list."), mask.c_str(), ci->name.c_str());
|
||||
|
||||
@@ -163,8 +161,6 @@ class CommandCSAKick : public Command
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &mask = params[2];
|
||||
unsigned i, end;
|
||||
|
||||
@@ -190,8 +186,8 @@ class CommandCSAKick : public Command
|
||||
|
||||
~AkickDelCallback()
|
||||
{
|
||||
bool override = !ci->AccessFor(source.u).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "to delete " << Deleted << (Deleted == 1 ? " entry" : " entries");
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Deleted << (Deleted == 1 ? " entry" : " entries");
|
||||
|
||||
if (!Deleted)
|
||||
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
|
||||
@@ -206,7 +202,7 @@ class CommandCSAKick : public Command
|
||||
if (!Number || Number > ci->GetAkickCount())
|
||||
return;
|
||||
|
||||
FOREACH_MOD(I_OnAkickDel, OnAkickDel(source.u, ci, ci->GetAkick(Number - 1)));
|
||||
FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(Number - 1)));
|
||||
|
||||
++Deleted;
|
||||
ci->EraseAkick(Number - 1);
|
||||
@@ -234,10 +230,10 @@ class CommandCSAKick : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to delete " << mask;
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
|
||||
|
||||
FOREACH_MOD(I_OnAkickDel, OnAkickDel(u, ci, ci->GetAkick(i)));
|
||||
FOREACH_MOD(I_OnAkickDel, OnAkickDel(source, ci, ci->GetAkick(i)));
|
||||
|
||||
ci->EraseAkick(i);
|
||||
|
||||
@@ -370,7 +366,6 @@ class CommandCSAKick : public Command
|
||||
|
||||
void DoEnforce(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
Channel *c = ci->c;
|
||||
int count = 0;
|
||||
|
||||
@@ -388,17 +383,16 @@ class CommandCSAKick : public Command
|
||||
++count;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ENFORCE, affects " << count << " users";
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ENFORCE, affects " << count << " users";
|
||||
|
||||
source.Reply(_("AKICK ENFORCE for \002%s\002 complete; \002%d\002 users were affected."), ci->name.c_str(), count);
|
||||
}
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
bool override = !ci->AccessFor(u).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to clear the akick list";
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the akick list";
|
||||
|
||||
ci->ClearAkick();
|
||||
source.Reply(_("Channel %s akick list has been cleared."), ci->name.c_str());
|
||||
@@ -422,8 +416,6 @@ class CommandCSAKick : public Command
|
||||
Anope::string cmd = params[1];
|
||||
Anope::string mask = params.size() > 2 ? params[2] : "";
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -433,7 +425,7 @@ class CommandCSAKick : public Command
|
||||
|
||||
if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL")))
|
||||
this->OnSyntaxError(source, cmd);
|
||||
else if (!ci->AccessFor(u).HasPriv("AKICK") && !u->HasPriv("chanserv/access/modify"))
|
||||
else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && readonly)
|
||||
source.Reply(_("Sorry, channel autokick list modification is temporarily disabled."));
|
||||
|
||||
@@ -52,14 +52,13 @@ class CommandCSAppendTopic : public Command
|
||||
{
|
||||
const Anope::string &newtopic = params[1];
|
||||
|
||||
User *u = source.u;
|
||||
Channel *c = findchan(params[0]);;
|
||||
|
||||
if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (!c->ci)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
|
||||
else if (!c->ci->AccessFor(u).HasPriv("TOPIC") && !u->HasCommand("chanserv/topic"))
|
||||
else if (!source.AccessFor(c->ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
@@ -74,12 +73,12 @@ class CommandCSAppendTopic : public Command
|
||||
|
||||
bool has_topiclock = c->ci->HasFlag(CI_TOPICLOCK);
|
||||
c->ci->UnsetFlag(CI_TOPICLOCK);
|
||||
c->ChangeTopic(u->nick, topic, Anope::CurTime);
|
||||
c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
|
||||
if (has_topiclock)
|
||||
c->ci->SetFlag(CI_TOPICLOCK);
|
||||
|
||||
bool override = !c->ci->AccessFor(u).HasPriv("TOPIC");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, c->ci) << "to append: " << topic;
|
||||
bool override = !source.AccessFor(c->ci).HasPriv("TOPIC");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci) << "to append: " << topic;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ class CommandCSBan : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
User *u = source.u;
|
||||
Channel *c = ci->c;
|
||||
User *u = source.GetUser();
|
||||
User *u2 = finduser(target);
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
|
||||
@@ -66,7 +66,7 @@ class CommandCSBan : public Command
|
||||
get_idealban(ci, u2, mask);
|
||||
|
||||
// XXX need a way to detect if someone is overriding
|
||||
Log(LOG_COMMAND, u, this, ci) << "for " << mask;
|
||||
Log(LOG_COMMAND, source, this, ci) << "for " << mask;
|
||||
|
||||
c->SetMode(NULL, CMODE_BAN, mask);
|
||||
|
||||
@@ -74,15 +74,15 @@ class CommandCSBan : public Command
|
||||
if (!c->FindUser(u2))
|
||||
return;
|
||||
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !ci->AccessFor(u).HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), u->nick.c_str());
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !source.AccessFor(ci).HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
|
||||
}
|
||||
}
|
||||
else if (u_access.HasPriv("FOUNDER"))
|
||||
{
|
||||
Log(LOG_COMMAND, u, this, ci) << "for " << target;
|
||||
Log(LOG_COMMAND, source, this, ci) << "for " << target;
|
||||
|
||||
c->SetMode(NULL, CMODE_BAN, target);
|
||||
|
||||
@@ -106,7 +106,7 @@ class CommandCSBan : public Command
|
||||
|
||||
++kicked;
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), u->nick.c_str());
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ class CommandCSClearUsers : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
Channel *c = findchan(chan);
|
||||
Anope::string modebuf;
|
||||
|
||||
@@ -40,13 +39,13 @@ class CommandCSClearUsers : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!c->ci->AccessFor(u).HasPriv("FOUNDER") && !u->HasCommand("chanserv/clearusers"))
|
||||
else if (!source.AccessFor(c->ci).HasPriv("FOUNDER") && !source.HasCommand("chanserv/clearusers"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
Anope::string buf = "CLEARUSERS command from " + u->nick + " (" + u->Account()->display + ")";
|
||||
Anope::string buf = "CLEARUSERS command from " + source.GetNick() + " (" + source.nc->display + ")";
|
||||
|
||||
for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
|
||||
{
|
||||
@@ -55,8 +54,8 @@ class CommandCSClearUsers : public Command
|
||||
c->Kick(NULL, uc->user, "%s", buf.c_str());
|
||||
}
|
||||
|
||||
bool override = !c->ci->AccessFor(u).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, c->ci);
|
||||
bool override = !source.AccessFor(c->ci).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, c->ci);
|
||||
|
||||
source.Reply(_("All users have been kicked from \002%s\002."), chan.c_str());
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
const Anope::string &target = params[1];
|
||||
Anope::string what = params.size() > 2 ? params[2] : "";
|
||||
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("SET"))
|
||||
if (!source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, target.c_str());
|
||||
return;
|
||||
}
|
||||
if (!IsFounder(u, ci) || !IsFounder(u, target_ci))
|
||||
if (!source.IsFounder(ci) || !source.IsFounder(target_ci))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
target_ci->c->CheckModes();
|
||||
|
||||
ChannelMode *cm;
|
||||
if (u->FindChannel(target_ci->c) != NULL)
|
||||
if (u && u->FindChannel(target_ci->c) != NULL)
|
||||
{
|
||||
/* On most ircds you do not receive the admin/owner mode till its registered */
|
||||
if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER)))
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_COMMAND, u, this, ci) << "to clone " << (what.empty() ? "everything from it" : what) << " to " << target_ci->name;
|
||||
Log(LOG_COMMAND, source, this, ci) << "to clone " << (what.empty() ? "everything from it" : what) << " to " << target_ci->name;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ class CommandCSDrop : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE?
|
||||
@@ -41,20 +39,20 @@ class CommandCSDrop : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (ci->HasFlag(CI_SUSPENDED) && !u->HasCommand("chanserv/drop"))
|
||||
if (ci->HasFlag(CI_SUSPENDED) && !source.HasCommand("chanserv/drop"))
|
||||
{
|
||||
source.Reply(CHAN_X_SUSPENDED, chan.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER")) && !u->HasCommand("chanserv/drop"))
|
||||
if ((ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER"));
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")";
|
||||
bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")";
|
||||
|
||||
FOREACH_MOD(I_OnChanDrop, OnChanDrop(ci));
|
||||
|
||||
@@ -71,10 +69,9 @@ class CommandCSDrop : public Command
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
if (u->IsServicesOper())
|
||||
if (source.IsServicesOper())
|
||||
source.Reply(_("Unregisters the named channel. Only \002Services Operators\002\n"
|
||||
"can drop a channel for which they have not identified."));
|
||||
else
|
||||
|
||||
@@ -122,14 +122,13 @@ class CommandCSEnforce : public Command
|
||||
{
|
||||
const Anope::string &what = params.size() > 1 ? params[1] : "";
|
||||
|
||||
User *u = source.u;
|
||||
Channel *c = findchan(params[0]);
|
||||
|
||||
if (!c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (!c->ci)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
|
||||
else if (!c->ci->AccessFor(u).HasPriv("AKICK"))
|
||||
else if (!source.AccessFor(c->ci).HasPriv("AKICK"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ struct EntryMsg : Serializable
|
||||
|
||||
EntryMsg(ChannelInfo *c, const Anope::string &cname, const Anope::string &cmessage, time_t ct = Anope::CurTime)
|
||||
{
|
||||
|
||||
this->ci = c;
|
||||
this->creator = cname;
|
||||
this->message = cmessage;
|
||||
@@ -128,8 +127,6 @@ class CommandEntryMessage : public Command
|
||||
|
||||
void DoAdd(CommandSource &source, ChannelInfo *ci, const Anope::string &message)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
|
||||
if (messages == NULL)
|
||||
{
|
||||
@@ -141,16 +138,14 @@ class CommandEntryMessage : public Command
|
||||
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
(*messages)->push_back(new EntryMsg(ci, source.u->nick, message));
|
||||
Log(IsFounder(u, ci) ? LOG_COMMAND : LOG_OVERRIDE, u, this, ci) << "to add a message";
|
||||
(*messages)->push_back(new EntryMsg(ci, source.GetNick(), message));
|
||||
Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message";
|
||||
source.Reply(_("Entry message added to \002%s\002"), ci->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const Anope::string &message)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
|
||||
if (messages == NULL)
|
||||
{
|
||||
@@ -173,7 +168,7 @@ class CommandEntryMessage : public Command
|
||||
(*messages)->erase((*messages)->begin() + i - 1);
|
||||
if ((*messages)->empty())
|
||||
ci->Shrink("cs_entrymsg");
|
||||
Log(IsFounder(u, ci) ? LOG_COMMAND : LOG_OVERRIDE, u, this, ci) << "to remove a message";
|
||||
Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
|
||||
source.Reply(_("Entry message \002%i\002 for \002%s\002 deleted."), i, ci->name.c_str());
|
||||
}
|
||||
else
|
||||
@@ -188,8 +183,6 @@ class CommandEntryMessage : public Command
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
EntryMessageList *messages = ci->GetExt<EntryMessageList *>("cs_entrymsg");
|
||||
if (messages != NULL)
|
||||
{
|
||||
@@ -199,7 +192,7 @@ class CommandEntryMessage : public Command
|
||||
ci->Shrink("cs_entrymsg");
|
||||
}
|
||||
|
||||
Log(IsFounder(u, ci) ? LOG_COMMAND : LOG_OVERRIDE, u, this, ci) << "to remove all messages";
|
||||
Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove all messages";
|
||||
source.Reply(_("Entry messages for \002%s\002 have been cleared."), ci->name.c_str());
|
||||
}
|
||||
|
||||
@@ -215,8 +208,6 @@ class CommandEntryMessage : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -224,7 +215,7 @@ class CommandEntryMessage : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsFounder(u, ci) || u->HasCommand("chanserv/set"))
|
||||
if (source.IsFounder(ci) || source.HasCommand("chanserv/set"))
|
||||
{
|
||||
if (params[1].equals_ci("LIST"))
|
||||
this->DoList(source, ci);
|
||||
|
||||
@@ -102,12 +102,12 @@ class CSStats : public Module
|
||||
|
||||
void DoStats(CommandSource &source, const bool is_global, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (!source.u || !source.c)
|
||||
if (!source.c)
|
||||
return;
|
||||
|
||||
Anope::string display;
|
||||
if (params.empty())
|
||||
display = source.u->Account()->display;
|
||||
display = source.nc->display;
|
||||
else if (const NickAlias *na = findnick(params[0]))
|
||||
display = na->nc->display;
|
||||
else
|
||||
|
||||
@@ -131,7 +131,7 @@ class CSTop : public Module
|
||||
|
||||
void DoTop(CommandSource &source, const std::vector<Anope::string> ¶ms, bool is_global, int limit = 1)
|
||||
{
|
||||
if (!source.u || !source.c || !source.c->ci)
|
||||
if (!source.c || !source.c->ci)
|
||||
return;
|
||||
|
||||
Anope::string channel;
|
||||
@@ -204,4 +204,4 @@ void CommandCSGTop10::Execute(CommandSource &source, const std::vector<Anope::st
|
||||
}
|
||||
|
||||
|
||||
MODULE_INIT(CSTop)
|
||||
MODULE_INIT(CSTop)
|
||||
|
||||
@@ -75,8 +75,6 @@ class CommandCSFlags : public Command
|
||||
{
|
||||
void DoModify(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string mask = params.size() > 2 ? params[2] : "";
|
||||
Anope::string flags = params.size() > 3 ? params[3] : "";
|
||||
|
||||
@@ -86,7 +84,7 @@ class CommandCSFlags : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
if (mask.find_first_of("!*@") == Anope::string::npos && !findnick(mask))
|
||||
{
|
||||
@@ -141,7 +139,7 @@ class CommandCSFlags : public Command
|
||||
{
|
||||
if (!u_access.HasPriv(it->first))
|
||||
{
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
override = true;
|
||||
else
|
||||
continue;
|
||||
@@ -161,7 +159,7 @@ class CommandCSFlags : public Command
|
||||
continue;
|
||||
else if (!u_access.HasPriv(it->first))
|
||||
{
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
override = true;
|
||||
else
|
||||
{
|
||||
@@ -181,9 +179,9 @@ class CommandCSFlags : public Command
|
||||
{
|
||||
if (current != NULL)
|
||||
{
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, current));
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, current));
|
||||
ci->EraseAccess(current);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to delete " << mask;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
|
||||
source.Reply(_("\002%s\002 removed from the %s access list."), mask.c_str(), ci->name.c_str());
|
||||
}
|
||||
else
|
||||
@@ -199,7 +197,7 @@ class CommandCSFlags : public Command
|
||||
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->creator = u->nick;
|
||||
access->creator = source.GetNick();
|
||||
access->last_seen = current ? current->last_seen : 0;
|
||||
access->created = Anope::CurTime;
|
||||
access->flags = current_flags;
|
||||
@@ -209,9 +207,9 @@ class CommandCSFlags : public Command
|
||||
|
||||
ci->AddAccess(access);
|
||||
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, access));
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, source, access));
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to modify " << mask << "'s flags to " << access->Serialize();
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->Serialize();
|
||||
source.Reply(_("Access for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->Serialize().c_str());
|
||||
|
||||
return;
|
||||
@@ -259,7 +257,7 @@ class CommandCSFlags : public Command
|
||||
entry["Mask"] = access->mask;
|
||||
entry["Flags"] = FlagsChanAccess::DetermineFlags(access);
|
||||
entry["Creator"] = access->creator;
|
||||
entry["Created"] = do_strftime(access->created, source.u->Account(), true);
|
||||
entry["Created"] = do_strftime(access->created, source.nc, true);
|
||||
list.addEntry(entry);
|
||||
}
|
||||
|
||||
@@ -282,20 +280,18 @@ class CommandCSFlags : public Command
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (!IsFounder(u, ci) && !u->HasPriv("chanserv/access/modify"))
|
||||
if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
ci->ClearAccess();
|
||||
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u));
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, source));
|
||||
|
||||
source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str());
|
||||
|
||||
bool override = !IsFounder(u, ci);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to clear the access list";
|
||||
bool override = !source.IsFounder(ci);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list";
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -315,7 +311,6 @@ class CommandCSFlags : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &cmd = params[1];
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(chan);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -325,11 +320,11 @@ class CommandCSFlags : public Command
|
||||
|
||||
bool is_list = cmd.equals_ci("LIST");
|
||||
bool has_access = false;
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
has_access = true;
|
||||
else if (is_list && ci->AccessFor(u).HasPriv("ACCESS_LIST"))
|
||||
else if (is_list && source.AccessFor(ci).HasPriv("ACCESS_LIST"))
|
||||
has_access = true;
|
||||
else if (ci->AccessFor(u).HasPriv("ACCESS_CHANGE"))
|
||||
else if (source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
|
||||
has_access = true;
|
||||
|
||||
if (!has_access)
|
||||
@@ -379,7 +374,7 @@ class CommandCSFlags : public Command
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(it->second);
|
||||
if (p == NULL)
|
||||
continue;
|
||||
source.Reply(" %c - %s", it->first, translate(source.u->Account(), p->desc.c_str()));
|
||||
source.Reply(" %c - %s", it->first, translate(source.nc, p->desc.c_str()));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -26,7 +26,6 @@ class CommandCSGetKey : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -34,8 +33,7 @@ class CommandCSGetKey : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("GETKEY") && !u->HasCommand("chanserv/getkey"))
|
||||
if (!source.AccessFor(ci).HasPriv("GETKEY") && !source.HasCommand("chanserv/getkey"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -48,8 +46,8 @@ class CommandCSGetKey : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("GETKEY");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci);
|
||||
bool override = !source.AccessFor(ci).HasPriv("GETKEY");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
|
||||
|
||||
source.Reply(_("Key for channel \002%s\002 is \002%s\002."), chan.c_str(), key.c_str());
|
||||
return;
|
||||
|
||||
@@ -40,7 +40,7 @@ class CommandCSInfo : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
NickCore *nc = source.nc;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -48,14 +48,14 @@ class CommandCSInfo : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
bool has_auspex = u->IsIdentified() && u->HasPriv("chanserv/auspex");
|
||||
bool has_auspex = source.HasPriv("chanserv/auspex");
|
||||
bool show_all = false;
|
||||
|
||||
/* Should we show all fields? Only for sadmins and identified users */
|
||||
if (has_auspex || ci->AccessFor(u).HasPriv("INFO"))
|
||||
if (has_auspex || source.AccessFor(ci).HasPriv("INFO"))
|
||||
show_all = true;
|
||||
|
||||
InfoFormatter info(u);
|
||||
InfoFormatter info(nc);
|
||||
|
||||
source.Reply(CHAN_INFO_HEADER, chan.c_str());
|
||||
if (ci->GetFounder())
|
||||
@@ -82,21 +82,21 @@ class CommandCSInfo : public Command
|
||||
info["Ban type"] = stringify(ci->bantype);
|
||||
|
||||
Anope::string optbuf;
|
||||
CheckOptStr(optbuf, CI_KEEPTOPIC, _("Topic Retention"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_PEACE, _("Peace"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_PRIVATE, _("Private"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_RESTRICTED, _("Restricted Access"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_SECURE, _("Secure"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_SECUREFOUNDER, _("Secure Founder"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_SECUREOPS, _("Secure Ops"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_KEEPTOPIC, _("Topic Retention"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_PEACE, _("Peace"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_PRIVATE, _("Private"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_RESTRICTED, _("Restricted Access"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_SECURE, _("Secure"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_SECUREFOUNDER, _("Secure Founder"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_SECUREOPS, _("Secure Ops"), ci, nc);
|
||||
if (ci->HasFlag(CI_SIGNKICK))
|
||||
CheckOptStr(optbuf, CI_SIGNKICK, _("Signed kicks"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_SIGNKICK, _("Signed kicks"), ci, nc);
|
||||
else
|
||||
CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, _("Signed kicks"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_TOPICLOCK, _("Topic Lock"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_PERSIST, _("Persistant"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_NO_EXPIRE, _("No expire"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_STATS, _("Chanstats"), ci, u->Account());
|
||||
CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, _("Signed kicks"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_TOPICLOCK, _("Topic Lock"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_PERSIST, _("Persistant"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_NO_EXPIRE, _("No expire"), ci, nc);
|
||||
CheckOptStr(optbuf, CI_STATS, _("Chanstats"), ci, nc);
|
||||
|
||||
info["Options"] = optbuf.empty() ? _("None") : optbuf;
|
||||
info["Mode lock"] = ci->GetMLockAsString(true);
|
||||
|
||||
@@ -26,7 +26,7 @@ class CommandCSInvite : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
Channel *c = findchan(chan);
|
||||
|
||||
if (!c)
|
||||
@@ -42,7 +42,7 @@ class CommandCSInvite : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("INVITE") && !u->HasCommand("chanserv/invite"))
|
||||
if (!source.AccessFor(ci).HasPriv("INVITE") && !source.HasCommand("chanserv/invite"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -52,12 +52,12 @@ class CommandCSInvite : public Command
|
||||
if (params.size() == 1)
|
||||
u2 = u;
|
||||
else
|
||||
u2 = finduser(params[1]);
|
||||
|
||||
if (!u2)
|
||||
{
|
||||
if (!(u2 = finduser(params[1])))
|
||||
{
|
||||
source.Reply(NICK_X_NOT_IN_USE, params[1].c_str());
|
||||
return;
|
||||
}
|
||||
source.Reply(NICK_X_NOT_IN_USE, params.size() > 1 ? params[1].c_str() : source.GetNick().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->FindUser(u2))
|
||||
@@ -69,17 +69,17 @@ class CommandCSInvite : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
bool override = !ci->AccessFor(u).HasPriv("INVITE");
|
||||
bool override = !source.AccessFor(ci).HasPriv("INVITE");
|
||||
|
||||
ircdproto->SendInvite(ci->WhoSends(), c, u2);
|
||||
if (u2 != u)
|
||||
{
|
||||
source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "for " << u2->nick;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
|
||||
}
|
||||
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class CommandCSKick : public Command
|
||||
const Anope::string &target = params[1];
|
||||
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
|
||||
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
Channel *c = findchan(params[0]);
|
||||
User *u2 = finduser(target);
|
||||
@@ -45,7 +45,7 @@ class CommandCSKick : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
if (!u_access.HasPriv("KICK"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
@@ -61,17 +61,17 @@ class CommandCSKick : public Command
|
||||
else
|
||||
{
|
||||
// XXX
|
||||
Log(LOG_COMMAND, u, this, ci) << "for " << u2->nick;
|
||||
Log(LOG_COMMAND, source, this, ci) << "for " << u2->nick;
|
||||
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), u->nick.c_str());
|
||||
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
|
||||
}
|
||||
}
|
||||
else if (u_access.HasPriv("FOUNDER"))
|
||||
{
|
||||
Log(LOG_COMMAND, u, this, ci) << "for " << target;
|
||||
Log(LOG_COMMAND, source, this, ci) << "for " << target;
|
||||
|
||||
int matched = 0, kicked = 0;
|
||||
for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;)
|
||||
@@ -90,7 +90,7 @@ class CommandCSKick : public Command
|
||||
|
||||
++kicked;
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK")))
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), u->nick.c_str());
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ class CommandCSList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string pattern = params[0];
|
||||
unsigned nchans;
|
||||
bool is_servadmin = u->HasCommand("chanserv/list");
|
||||
bool is_servadmin = source.HasCommand("chanserv/list");
|
||||
int count = 0, from = 0, to = 0;
|
||||
bool suspended = false, channoexpire = false;
|
||||
|
||||
|
||||
@@ -28,11 +28,10 @@ public:
|
||||
{
|
||||
const Anope::string &channel = params[0];
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(channel);
|
||||
if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
|
||||
else if (!ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("chanserv/set"))
|
||||
else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/set"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (params.size() == 1)
|
||||
{
|
||||
@@ -108,7 +107,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("SET");
|
||||
bool override = !source.AccessFor(ci).HasPriv("SET");
|
||||
|
||||
for (unsigned i = ci->log_settings->size(); i > 0; --i)
|
||||
{
|
||||
@@ -120,13 +119,13 @@ public:
|
||||
{
|
||||
log->destroy();
|
||||
ci->log_settings->erase(ci->log_settings->begin() + i - 1);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
|
||||
source.Reply(_("Logging for command %s on %s with log method %s%s%s has been removed."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
log->extra = extra;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra;
|
||||
source.Reply(_("Logging changed for command %s on %s, now using log method %s%s%s."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
|
||||
}
|
||||
return;
|
||||
@@ -141,10 +140,10 @@ public:
|
||||
log->method = method;
|
||||
log->extra = extra;
|
||||
log->created = Anope::CurTime;
|
||||
log->creator = u->nick;
|
||||
log->creator = source.GetNick();
|
||||
|
||||
ci->log_settings->push_back(log);
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
|
||||
|
||||
source.Reply(_("Logging is now active for command %s on %s, using log method %s%s%s."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
|
||||
}
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
|
||||
class CommandCSMode : public Command
|
||||
{
|
||||
bool CanSet(User *u, ChannelInfo *ci, ChannelMode *cm)
|
||||
bool CanSet(CommandSource &source, ChannelInfo *ci, ChannelMode *cm)
|
||||
{
|
||||
if (!u || !ci || !cm || cm->Type != MODE_STATUS)
|
||||
if (!ci || !cm || cm->Type != MODE_STATUS)
|
||||
return false;
|
||||
|
||||
const Anope::string accesses[] = { "VOICE", "HALFOP", "OPDEOP", "PROTECT", "OWNER", "" };
|
||||
const ChannelModeName modes[] = { CMODE_VOICE, CMODE_HALFOP, CMODE_OP, CMODE_PROTECT, CMODE_OWNER };
|
||||
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
|
||||
AccessGroup access = ci->AccessFor(u);
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
unsigned short u_level = 0;
|
||||
|
||||
for (int i = 0; !accesses[i].empty(); ++i)
|
||||
@@ -42,11 +42,11 @@ class CommandCSMode : public Command
|
||||
|
||||
void DoLock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
const Anope::string &subcommand = params[2];
|
||||
const Anope::string ¶m = params.size() > 3 ? params[3] : "";
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("MODE");
|
||||
bool override = !source.AccessFor(ci).HasPriv("MODE");
|
||||
|
||||
if (subcommand.equals_ci("ADD") && !param.empty())
|
||||
{
|
||||
@@ -75,7 +75,7 @@ class CommandCSMode : public Command
|
||||
source.Reply(_("Unknown mode character %c ignored."), modes[i]);
|
||||
break;
|
||||
}
|
||||
else if (!cm->CanSet(u))
|
||||
else if (u && !cm->CanSet(u))
|
||||
{
|
||||
source.Reply(_("You may not (un)lock mode %c."), modes[i]);
|
||||
break;
|
||||
@@ -86,11 +86,11 @@ class CommandCSMode : public Command
|
||||
source.Reply(_("Missing parameter for mode %c."), cm->ModeChar);
|
||||
else
|
||||
{
|
||||
ci->SetMLock(cm, adding, mode_param, u->nick);
|
||||
ci->SetMLock(cm, adding, mode_param, source.GetNick());
|
||||
if (!mode_param.empty())
|
||||
mode_param = " " + mode_param;
|
||||
source.Reply(_("%c%c%s locked on %s"), adding ? '+' : '-', cm->ModeChar, mode_param.c_str(), ci->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to lock " << (adding ? '+' : '-') << cm->ModeChar << mode_param;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << (adding ? '+' : '-') << cm->ModeChar << mode_param;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class CommandCSMode : public Command
|
||||
source.Reply(_("Unknown mode character %c ignored."), modes[i]);
|
||||
break;
|
||||
}
|
||||
else if (!cm->CanSet(u))
|
||||
else if (u && !cm->CanSet(u))
|
||||
{
|
||||
source.Reply(_("You may not (un)lock mode %c."), modes[i]);
|
||||
break;
|
||||
@@ -141,7 +141,7 @@ class CommandCSMode : public Command
|
||||
if (!mode_param.empty())
|
||||
mode_param = " " + mode_param;
|
||||
source.Reply(_("%c%c%s has been unlocked from %s."), adding == 1 ? '+' : '-', cm->ModeChar, mode_param.c_str(), ci->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->ModeChar << mode_param;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->ModeChar << mode_param;
|
||||
}
|
||||
else
|
||||
source.Reply(_("%c%c is not locked on %s."), adding == 1 ? '+' : '-', cm->ModeChar, ci->name.c_str());
|
||||
@@ -172,7 +172,7 @@ class CommandCSMode : public Command
|
||||
entry["Mode"] = Anope::printf("%c%c", ml->set ? '+' : '-', cm->ModeChar);
|
||||
entry["Param"] = ml->param;
|
||||
entry["Creator"] = ml->setter;
|
||||
entry["Created"] = do_strftime(ml->created, source.u->Account(), false);
|
||||
entry["Created"] = do_strftime(ml->created, source.nc, false);
|
||||
list.addEntry(entry);
|
||||
}
|
||||
|
||||
@@ -191,13 +191,13 @@ class CommandCSMode : public Command
|
||||
|
||||
void DoSet(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
|
||||
spacesepstream sep(params.size() > 3 ? params[3] : "");
|
||||
Anope::string modes = params[2], param;
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("MODE");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to set " << params[2];
|
||||
bool override = !source.AccessFor(ci).HasPriv("MODE");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << params[2];
|
||||
|
||||
int adding = -1;
|
||||
for (size_t i = 0; i < modes.length(); ++i)
|
||||
@@ -216,7 +216,7 @@ class CommandCSMode : public Command
|
||||
for (unsigned j = 0; j < ModeManager::ChannelModes.size(); ++j)
|
||||
{
|
||||
ChannelMode *cm = ModeManager::ChannelModes[j];
|
||||
if (cm->CanSet(u))
|
||||
if (!u || cm->CanSet(u))
|
||||
{
|
||||
if (cm->Type == MODE_REGULAR || (!adding && cm->Type == MODE_PARAM))
|
||||
{
|
||||
@@ -232,7 +232,7 @@ class CommandCSMode : public Command
|
||||
if (adding == -1)
|
||||
break;
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]);
|
||||
if (!cm || !cm->CanSet(u))
|
||||
if (!cm || (u && !cm->CanSet(u)))
|
||||
continue;
|
||||
switch (cm->Type)
|
||||
{
|
||||
@@ -255,13 +255,13 @@ class CommandCSMode : public Command
|
||||
if (!sep.GetToken(param))
|
||||
break;
|
||||
|
||||
if (!this->CanSet(u, ci, cm))
|
||||
if (!this->CanSet(source, ci, cm))
|
||||
{
|
||||
source.Reply(_("You do not have access to set mode %c."), cm->ModeChar);
|
||||
break;
|
||||
}
|
||||
|
||||
AccessGroup u_access = ci->AccessFor(u);
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
if (str_is_wildcard(param))
|
||||
{
|
||||
@@ -343,12 +343,11 @@ class CommandCSMode : public Command
|
||||
{
|
||||
const Anope::string &subcommand = params[1];
|
||||
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
|
||||
if (!ci || !ci->c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (!ci->AccessFor(u).HasPriv("MODE") && !u->HasPriv("chanserv/set"))
|
||||
else if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasPriv("chanserv/set"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (subcommand.equals_ci("LOCK"))
|
||||
this->DoLock(source, ci, params);
|
||||
|
||||
@@ -17,7 +17,7 @@ class CommandModeBase : public Command
|
||||
{
|
||||
void do_mode(CommandSource &source, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, const Anope::string &level, const Anope::string &levelself)
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
User *u2 = finduser(nick);
|
||||
Channel *c = findchan(chan);
|
||||
|
||||
@@ -42,9 +42,9 @@ class CommandModeBase : public Command
|
||||
}
|
||||
|
||||
bool is_same = u == u2;
|
||||
AccessGroup u_access = ci->AccessFor(u), u2_access = ci->AccessFor(u2);
|
||||
AccessGroup u_access = source.AccessFor(ci), u2_access = ci->AccessFor(u2);
|
||||
|
||||
if (is_same ? !ci->AccessFor(u).HasPriv(levelself) : !ci->AccessFor(u).HasPriv(level))
|
||||
if (is_same ? !source.AccessFor(ci).HasPriv(levelself) : !source.AccessFor(ci).HasPriv(level))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!set && !is_same && ci->HasFlag(CI_PEACE) && u2_access >= u_access)
|
||||
source.Reply(ACCESS_DENIED);
|
||||
@@ -59,7 +59,7 @@ class CommandModeBase : public Command
|
||||
else
|
||||
c->RemoveMode(NULL, cm, u2->nick);
|
||||
|
||||
Log(LOG_COMMAND, u, com, ci) << "for " << u2->nick;
|
||||
Log(LOG_COMMAND, source, com, ci) << "for " << u2->nick;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,15 +76,13 @@ class CommandModeBase : public Command
|
||||
*/
|
||||
void do_util(CommandSource &source, Command *com, ChannelMode *cm, const Anope::string &chan, const Anope::string &nick, bool set, const Anope::string &level, const Anope::string &levelself)
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
|
||||
if (chan.empty())
|
||||
if (chan.empty() && u)
|
||||
for (UChannelList::iterator it = u->chans.begin(); it != u->chans.end(); ++it)
|
||||
do_mode(source, com, cm, (*it)->chan->name, u->nick, set, level, levelself);
|
||||
else
|
||||
else if (!chan.empty())
|
||||
do_mode(source, com, cm, chan, !nick.empty() ? nick : u->nick, set, level, levelself);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -27,13 +27,14 @@ class CommandCSRegister : public Command
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
|
||||
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
NickCore *nc = source.nc;
|
||||
Channel *c = findchan(params[0]);
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
|
||||
if (readonly)
|
||||
source.Reply(_("Sorry, channel registration is temporarily disabled."));
|
||||
else if (u->Account()->HasFlag(NI_UNCONFIRMED))
|
||||
else if (nc->HasFlag(NI_UNCONFIRMED))
|
||||
source.Reply(_("You must confirm your account before you can register a channel."));
|
||||
else if (chan[0] == '&')
|
||||
source.Reply(_("Local channels cannot be registered."));
|
||||
@@ -45,19 +46,19 @@ class CommandCSRegister : public Command
|
||||
source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str());
|
||||
else if (c && !c->HasUserStatus(u, CMODE_OP))
|
||||
source.Reply(_("You must be a channel operator to register the channel."));
|
||||
else if (Config->CSMaxReg && u->Account()->channelcount >= Config->CSMaxReg && !u->HasPriv("chanserv/no-register-limit"))
|
||||
source.Reply(u->Account()->channelcount > Config->CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config->CSMaxReg);
|
||||
else if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !source.HasPriv("chanserv/no-register-limit"))
|
||||
source.Reply(nc->channelcount > Config->CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config->CSMaxReg);
|
||||
else
|
||||
{
|
||||
ci = new ChannelInfo(chan);
|
||||
ci->SetFounder(u->Account());
|
||||
ci->SetFounder(nc);
|
||||
if (!chdesc.empty())
|
||||
ci->desc = chdesc;
|
||||
|
||||
for (ChannelInfo::ModeList::iterator it = def_mode_locks.begin(), it_end = def_mode_locks.end(); it != it_end; ++it)
|
||||
{
|
||||
ModeLock *ml = new ModeLock(*it->second);
|
||||
ml->setter = u->nick;
|
||||
ml->setter = source.GetNick();
|
||||
ml->ci = ci;
|
||||
ci->mode_locks->insert(std::make_pair(it->first, ml));
|
||||
}
|
||||
@@ -71,8 +72,8 @@ class CommandCSRegister : public Command
|
||||
else
|
||||
ci->last_topic_setter = source.owner->nick;
|
||||
|
||||
Log(LOG_COMMAND, u, this, ci);
|
||||
source.Reply(_("Channel \002%s\002 registered under your nickname: %s"), chan.c_str(), u->nick.c_str());
|
||||
Log(LOG_COMMAND, source, this, ci);
|
||||
source.Reply(_("Channel \002%s\002 registered under your account: %s"), chan.c_str(), nc->display.c_str());
|
||||
|
||||
/* Implement new mode lock */
|
||||
if (c)
|
||||
@@ -80,7 +81,7 @@ class CommandCSRegister : public Command
|
||||
c->CheckModes();
|
||||
|
||||
ChannelMode *cm;
|
||||
if (u->FindChannel(c) != NULL)
|
||||
if (u && u->FindChannel(c) != NULL)
|
||||
{
|
||||
/* On most ircds you do not receive the admin/owner mode till its registered */
|
||||
if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER)))
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSASetNoexpire : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSASetNoexpire : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -155,8 +155,8 @@ class CommandOSSeen : public Command
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
Log(LOG_ADMIN, source.u, this) << "CLEAR and removed " << counter << " nicks that were added after " << do_strftime(time, NULL, true);
|
||||
source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, do_strftime(time, source.u->Account(), true).c_str());
|
||||
Log(LOG_ADMIN, source, this) << "CLEAR and removed " << counter << " nicks that were added after " << do_strftime(time, NULL, true);
|
||||
source.Reply(_("Database cleared, removed %lu nicks that were added after %s"), counter, do_strftime(time, source.nc, true).c_str());
|
||||
}
|
||||
else
|
||||
this->SendSyntax(source);
|
||||
@@ -190,7 +190,6 @@ class CommandSeen : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string &target = params[0];
|
||||
User *u = source.u;
|
||||
|
||||
if (target.length() > Config->NickLen)
|
||||
{
|
||||
@@ -204,9 +203,9 @@ class CommandSeen : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.equals_ci(u->nick))
|
||||
if (target.equals_ci(source.GetNick()))
|
||||
{
|
||||
source.Reply(_("You might see yourself in the mirror, %s."), u->nick.c_str());
|
||||
source.Reply(_("You might see yourself in the mirror, %s."), source.GetNick().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -224,8 +223,8 @@ class CommandSeen : public Command
|
||||
else
|
||||
onlinestatus = Anope::printf(_(" but %s mysteriously dematerialized."), target.c_str());
|
||||
|
||||
Anope::string timebuf = duration(Anope::CurTime - info->last, u->Account());
|
||||
Anope::string timebuf2 = do_strftime(info->last, u->Account(), true);
|
||||
Anope::string timebuf = duration(Anope::CurTime - info->last, source.nc);
|
||||
Anope::string timebuf2 = do_strftime(info->last, source.nc, true);
|
||||
|
||||
if (info->type == NEW)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetBanType : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetBanType : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetChanstats : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (!ci)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetChanstats : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetDescription : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetDescription : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetFounder : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,13 +31,13 @@ class CommandCSSetFounder : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER")))
|
||||
if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -52,13 +51,13 @@ class CommandCSSetFounder : public Command
|
||||
}
|
||||
|
||||
NickCore *nc = na->nc;
|
||||
if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !u->HasPriv("chanserv/no-register-limit"))
|
||||
if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !source.HasPriv("chanserv/no-register-limit"))
|
||||
{
|
||||
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display;
|
||||
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display;
|
||||
|
||||
ci->SetFounder(nc);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetKeepTopic : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetKeepTopic : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -86,7 +86,7 @@ class CommandCSSetMisc : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
return;
|
||||
}
|
||||
else if (source.permission.empty() && !ci->AccessFor(source.u).HasPriv("SET"))
|
||||
else if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetPeace : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetPeace : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetPersist : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetPersist : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetPrivate : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetPrivate : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,6 @@ class CommandCSSetRestricted : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -31,7 +30,7 @@ class CommandCSSetRestricted : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetSecure : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetSecure : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetSecureFounder : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -33,7 +32,7 @@ class CommandCSSetSecureFounder : public Command
|
||||
}
|
||||
|
||||
|
||||
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER"))
|
||||
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetSecureOps : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetSecureOps : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetSignKick : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetSignKick : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetSuccessor : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,13 +31,13 @@ class CommandCSSetSuccessor : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !ci->AccessFor(u).HasPriv("FOUNDER"))
|
||||
if (source.permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -65,7 +64,7 @@ class CommandCSSetSuccessor : public Command
|
||||
else
|
||||
nc = NULL;
|
||||
|
||||
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, u, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "(none)") << " to " << (nc ? nc->display : "(none)");
|
||||
Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the successor from " << (ci->successor ? ci->successor->display : "(none)") << " to " << (nc ? nc->display : "(none)");
|
||||
|
||||
ci->successor = nc;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandCSSetTopicLock : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ class CommandCSSetTopicLock : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.permission.empty() && !ci->AccessFor(u).HasPriv("SET"))
|
||||
if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
|
||||
@@ -79,7 +79,6 @@ class CommandCSSuspend : public Command
|
||||
Anope::string reason = params.size() > 2 ? params[2] : "";
|
||||
time_t expiry_secs = Config->CSSuspendExpire;
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
if (!expiry.empty() && expiry[0] != '+')
|
||||
{
|
||||
@@ -107,7 +106,7 @@ class CommandCSSuspend : public Command
|
||||
}
|
||||
|
||||
ci->SetFlag(CI_SUSPENDED);
|
||||
ci->Extend("suspend_by", new ExtensibleString(u->nick));
|
||||
ci->Extend("suspend_by", new ExtensibleString(source.GetNick()));
|
||||
if (!reason.empty())
|
||||
ci->Extend("suspend_reason", new ExtensibleString(reason));
|
||||
|
||||
@@ -133,7 +132,7 @@ class CommandCSSuspend : public Command
|
||||
ci->Extend("cs_suspend_expire", cs);
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, u, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? do_strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? do_strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str());
|
||||
|
||||
FOREACH_MOD(I_OnChanSuspend, OnChanSuspend(ci));
|
||||
@@ -168,7 +167,6 @@ class CommandCSUnSuspend : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
@@ -189,7 +187,7 @@ class CommandCSUnSuspend : public Command
|
||||
|
||||
Anope::string *by = ci->GetExt<ExtensibleString *>("suspend_by"), *reason = ci->GetExt<ExtensibleString *>("suspend_reason");
|
||||
if (by != NULL)
|
||||
Log(LOG_ADMIN, u, this, ci) << " which was suspended by " << *by << " for: " << (reason && !reason->empty() ? *reason : "No reason");
|
||||
Log(LOG_ADMIN, source, this, ci) << " which was suspended by " << *by << " for: " << (reason && !reason->empty() ? *reason : "No reason");
|
||||
|
||||
ci->UnsetFlag(CI_SUSPENDED);
|
||||
ci->Shrink("suspend_by");
|
||||
|
||||
@@ -22,14 +22,13 @@ class CommandCSSync : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
|
||||
if (ci == NULL)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
|
||||
else if (ci->c == NULL)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (!ci->AccessFor(u).HasPriv("ACCESS_CHANGE"))
|
||||
else if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ class CommandCSTBan : public Command
|
||||
source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str());
|
||||
else if (!c->ci)
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, c->name.c_str());
|
||||
else if (!c->ci->AccessFor(source.u).HasPriv("BAN"))
|
||||
else if (!source.AccessFor(c->ci).HasPriv("BAN"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!(u2 = finduser(nick)))
|
||||
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
|
||||
|
||||
@@ -26,7 +26,6 @@ class CommandCSTopic : public Command
|
||||
{
|
||||
const Anope::string &topic = params.size() > 1 ? params[1] : "";
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
@@ -37,18 +36,18 @@ class CommandCSTopic : public Command
|
||||
|
||||
if (!ci->c)
|
||||
source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str());
|
||||
else if (!ci->AccessFor(u).HasPriv("TOPIC") && !u->HasCommand("chanserv/topic"))
|
||||
else if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
bool has_topiclock = ci->HasFlag(CI_TOPICLOCK);
|
||||
ci->UnsetFlag(CI_TOPICLOCK);
|
||||
ci->c->ChangeTopic(u->nick, topic, Anope::CurTime);
|
||||
ci->c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
|
||||
if (has_topiclock)
|
||||
ci->SetFlag(CI_TOPICLOCK);
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("TOPIC");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
|
||||
bool override = !source.AccessFor(ci).HasPriv("TOPIC");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ class CommandCSUnban : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
if (ci == NULL)
|
||||
{
|
||||
@@ -39,13 +37,13 @@ class CommandCSUnban : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("UNBAN"))
|
||||
if (!source.AccessFor(ci).HasPriv("UNBAN"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
User *u2 = u;
|
||||
User *u2 = source.GetUser();
|
||||
if (params.size() > 1)
|
||||
u2 = finduser(params[1]);
|
||||
|
||||
@@ -55,8 +53,8 @@ class CommandCSUnban : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
common_unban(ci, u2, u == u2);
|
||||
if (u2 == u)
|
||||
common_unban(ci, u2, source.GetUser() == u2);
|
||||
if (u2 == source.GetUser())
|
||||
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
|
||||
else
|
||||
source.Reply(_("\002%s\002 has been unbanned from \002%s\002."), u2->nick.c_str(), ci->c->name.c_str());
|
||||
|
||||
@@ -24,7 +24,9 @@ class CommandCSUp : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
if (params.empty())
|
||||
for (UChannelList::iterator it = u->chans.begin(); it != u->chans.end(); ++it)
|
||||
@@ -79,7 +81,9 @@ class CommandCSDown : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
if (params.empty())
|
||||
for (UChannelList::iterator it = u->chans.begin(); it != u->chans.end(); ++it)
|
||||
|
||||
+20
-24
@@ -201,7 +201,6 @@ class XOPBase : public Command
|
||||
private:
|
||||
void DoAdd(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms, XOPType level)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string mask = params.size() > 2 ? params[2] : "";
|
||||
|
||||
@@ -221,13 +220,13 @@ class XOPBase : public Command
|
||||
tmp_access.ci = ci;
|
||||
tmp_access.type = level;
|
||||
|
||||
AccessGroup access = ci->AccessFor(u);
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
const ChanAccess *highest = access.Highest();
|
||||
bool override = false;
|
||||
|
||||
if ((!access.Founder && !access.HasPriv("ACCESS_CHANGE")) || ((!highest || *highest <= tmp_access) && !access.Founder))
|
||||
{
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
override = true;
|
||||
else
|
||||
{
|
||||
@@ -254,7 +253,7 @@ class XOPBase : public Command
|
||||
|
||||
if (a->mask.equals_ci(mask))
|
||||
{
|
||||
if ((!highest || *a >= *highest) && !access.Founder && !u->HasPriv("chanserv/access/modify"))
|
||||
if ((!highest || *a >= *highest) && !access.Founder && !source.HasPriv("chanserv/access/modify"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -277,22 +276,21 @@ class XOPBase : public Command
|
||||
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
|
||||
acc->ci = ci;
|
||||
acc->mask = mask;
|
||||
acc->creator = u->nick;
|
||||
acc->creator = source.GetNick();
|
||||
acc->type = level;
|
||||
acc->last_seen = 0;
|
||||
acc->created = Anope::CurTime;
|
||||
ci->AddAccess(acc);
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to add " << mask;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask;
|
||||
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, u, acc));
|
||||
FOREACH_MOD(I_OnAccessAdd, OnAccessAdd(ci, source, acc));
|
||||
source.Reply(_("\002%s\002 added to %s %s list."), acc->mask.c_str(), ci->name.c_str(), source.command.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms, XOPType level)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
NickCore *nc = source.nc;
|
||||
const Anope::string &mask = params.size() > 2 ? params[2] : "";
|
||||
|
||||
if (mask.empty())
|
||||
@@ -317,13 +315,13 @@ class XOPBase : public Command
|
||||
tmp_access.ci = ci;
|
||||
tmp_access.type = level;
|
||||
|
||||
AccessGroup access = ci->AccessFor(u);
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
const ChanAccess *highest = access.Highest();
|
||||
bool override = false;
|
||||
|
||||
if ((!mask.equals_ci(u->Account()->display) && !access.HasPriv("ACCESS_CHANGE") && !access.Founder) || ((!highest || tmp_access >= *highest) && !access.Founder))
|
||||
if ((!mask.equals_ci(nc->display) && !access.HasPriv("ACCESS_CHANGE") && !access.Founder) || ((!highest || tmp_access >= *highest) && !access.Founder))
|
||||
{
|
||||
if (u->HasPriv("chanserv/access/modify"))
|
||||
if (source.HasPriv("chanserv/access/modify"))
|
||||
override = true;
|
||||
else
|
||||
{
|
||||
@@ -355,7 +353,7 @@ class XOPBase : public Command
|
||||
source.Reply(_("No matching entries on %s %s list."), ci->name.c_str(), source.command.c_str());
|
||||
else
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source.u, c, ci) << "to delete " << Nicks;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks;
|
||||
|
||||
if (Deleted == 1)
|
||||
source.Reply(_("Deleted one entry from %s %s list."), ci->name.c_str(), source.command.c_str());
|
||||
@@ -380,7 +378,7 @@ class XOPBase : public Command
|
||||
else
|
||||
Nicks = caccess->mask;
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source.u, caccess));
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, caccess));
|
||||
|
||||
ci->EraseAccess(Number - 1);
|
||||
}
|
||||
@@ -396,11 +394,11 @@ class XOPBase : public Command
|
||||
|
||||
if (a->mask.equals_ci(mask) && XOPChanAccess::DetermineLevel(a) == level)
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to delete " << a->mask;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->mask;
|
||||
|
||||
source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str());
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, a));
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, a));
|
||||
ci->EraseAccess(a);
|
||||
|
||||
return;
|
||||
@@ -413,13 +411,12 @@ class XOPBase : public Command
|
||||
|
||||
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms, XOPType level)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params.size() > 2 ? params[2] : "";
|
||||
|
||||
AccessGroup access = ci->AccessFor(u);
|
||||
AccessGroup access = source.AccessFor(ci);
|
||||
|
||||
if (!access.HasPriv("ACCESS_LIST") && !u->HasCommand("chanserv/access/list"))
|
||||
if (!access.HasPriv("ACCESS_LIST") && !source.HasCommand("chanserv/access/list"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -497,7 +494,6 @@ class XOPBase : public Command
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci, XOPType level)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (readonly)
|
||||
{
|
||||
@@ -511,14 +507,14 @@ class XOPBase : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->AccessFor(u).HasPriv("FOUNDER") && !u->HasPriv("chanserv/access/modify"))
|
||||
if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
bool override = !ci->AccessFor(u).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to clear the access list";
|
||||
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list";
|
||||
|
||||
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
|
||||
{
|
||||
@@ -527,7 +523,7 @@ class XOPBase : public Command
|
||||
ci->EraseAccess(i - 1);
|
||||
}
|
||||
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, u));
|
||||
FOREACH_MOD(I_OnAccessClear, OnAccessClear(ci, source));
|
||||
|
||||
source.Reply(_("Channel %s %s list has been cleared."), ci->name.c_str(), source.command.c_str());
|
||||
|
||||
|
||||
@@ -25,15 +25,14 @@ class CommandGLGlobal : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &msg = params[0];
|
||||
|
||||
if (!global)
|
||||
source.Reply("No global reference, is gl_main loaded?");
|
||||
else
|
||||
{
|
||||
Log(LOG_ADMIN, u, this);
|
||||
global->SendGlobal(findbot(Config->Global), u->nick, msg);
|
||||
Log(LOG_ADMIN, source, this);
|
||||
global->SendGlobal(findbot(Config->Global), source.GetNick(), msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ class CommandHelp : public Command
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
const BotInfo *bi = source.owner;
|
||||
|
||||
if (params.empty())
|
||||
@@ -48,7 +47,7 @@ class CommandHelp : public Command
|
||||
service_reference<Command> c("Command", info.name);
|
||||
if (!c)
|
||||
continue;
|
||||
if (!Config->HidePrivilegedCommands || info.permission.empty() || u->HasCommand(info.permission))
|
||||
if (!Config->HidePrivilegedCommands || info.permission.empty() || source.HasCommand(info.permission))
|
||||
{
|
||||
source.command = c_name;
|
||||
c->OnServHelp(source);
|
||||
@@ -75,7 +74,7 @@ class CommandHelp : public Command
|
||||
if (!c)
|
||||
continue;
|
||||
|
||||
if (Config->HidePrivilegedCommands && !info.permission.empty() && !u->HasCommand(info.permission))
|
||||
if (Config->HidePrivilegedCommands && !info.permission.empty() && !source.HasCommand(info.permission))
|
||||
continue;
|
||||
|
||||
const Anope::string &subcommand = params.size() > max ? params[max] : "";
|
||||
@@ -91,14 +90,14 @@ class CommandHelp : public Command
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), info.permission.c_str());
|
||||
}
|
||||
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->IsIdentified())
|
||||
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !source.nc)
|
||||
{
|
||||
if (info.permission.empty())
|
||||
source.Reply(" ");
|
||||
source.Reply( _("You need to be identified to use this command."));
|
||||
}
|
||||
/* User doesn't have the proper permission to use this command */
|
||||
else if (!info.permission.empty() && !u->HasCommand(info.permission))
|
||||
else if (!info.permission.empty() && !source.HasCommand(info.permission))
|
||||
{
|
||||
source.Reply(_("You cannot use this command."));
|
||||
}
|
||||
|
||||
@@ -24,12 +24,11 @@ class CommandHSDel : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &nick = params[0];
|
||||
NickAlias *na = findnick(nick);
|
||||
if (na)
|
||||
{
|
||||
Log(LOG_ADMIN, u, this) << "for user " << na->nick;
|
||||
Log(LOG_ADMIN, source, this) << "for user " << na->nick;
|
||||
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
|
||||
na->RemoveVhost();
|
||||
source.Reply(_("Vhost for \002%s\002 removed."), nick.c_str());
|
||||
@@ -60,7 +59,6 @@ class CommandHSDelAll : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string &nick = params[0];
|
||||
User *u = source.u;
|
||||
NickAlias *na = findnick(nick);
|
||||
if (na)
|
||||
{
|
||||
@@ -71,7 +69,7 @@ class CommandHSDelAll : public Command
|
||||
na = *it;
|
||||
na->RemoveVhost();
|
||||
}
|
||||
Log(LOG_ADMIN, u, this) << "for all nicks in group " << nc->display;
|
||||
Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->display;
|
||||
source.Reply(_("vhosts for group \002%s\002 have been removed."), nc->display.c_str());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -37,15 +37,14 @@ class CommandHSGroup : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (na && u->Account() == na->nc && na->HasVhost())
|
||||
NickAlias *na = findnick(source.GetNick());
|
||||
if (na && source.nc == na->nc && na->HasVhost())
|
||||
{
|
||||
this->Sync(na);
|
||||
if (!na->GetVhostIdent().empty())
|
||||
source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002@\002%s\002"), u->Account()->display.c_str(), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str());
|
||||
source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002@\002%s\002"), source.nc->display.c_str(), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str());
|
||||
else
|
||||
source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002"), u->Account()->display.c_str(), na->GetVhostHost().c_str());
|
||||
source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002"), source.nc->display.c_str(), na->GetVhostHost().c_str());
|
||||
}
|
||||
else
|
||||
source.Reply(HOST_NOT_ASSIGNED);
|
||||
|
||||
@@ -24,7 +24,10 @@ class CommandHSOff : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
const NickAlias *na = findnick(u->nick);
|
||||
|
||||
if (!na || !na->HasVhost())
|
||||
@@ -32,7 +35,7 @@ class CommandHSOff : public Command
|
||||
else
|
||||
{
|
||||
ircdproto->SendVhostDel(u);
|
||||
Log(LOG_COMMAND, u, this) << "to disable their vhost";
|
||||
Log(LOG_COMMAND, source, this) << "to disable their vhost";
|
||||
source.Reply(_("Your vhost was removed and the normal cloaking restored."));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ class CommandHSOn : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
const NickAlias *na = findnick(u->nick);
|
||||
if (na && u->Account() == na->nc && na->HasVhost())
|
||||
{
|
||||
@@ -32,7 +35,7 @@ class CommandHSOn : public Command
|
||||
source.Reply(_("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str());
|
||||
else
|
||||
source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str());
|
||||
Log(LOG_COMMAND, u, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
|
||||
Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost();
|
||||
ircdproto->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost());
|
||||
if (ircd->vhost)
|
||||
u->vhost = na->GetVhostHost();
|
||||
|
||||
@@ -87,13 +87,13 @@ class CommandHSRequest : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
NickAlias *na = findnick(u->nick);
|
||||
if (na == NULL)
|
||||
na = findnick(u->Account()->display);
|
||||
if (!na)
|
||||
User *u = source.GetUser();
|
||||
NickAlias *na = findnick(source.GetNick());
|
||||
if (!na || na->nc != source.nc)
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
Anope::string rawhostmask = params[0];
|
||||
|
||||
@@ -163,7 +163,7 @@ class CommandHSRequest : public Command
|
||||
|
||||
source.Reply(_("Your vHost has been requested"));
|
||||
req_send_memos(source, user, host);
|
||||
Log(LOG_COMMAND, u, this, NULL) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host;
|
||||
Log(LOG_COMMAND, source, this) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -190,7 +190,6 @@ class CommandHSActivate : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
|
||||
@@ -198,14 +197,14 @@ class CommandHSActivate : public Command
|
||||
HostRequest *req = na ? na->GetExt<HostRequest *>("hs_request") : NULL;
|
||||
if (req)
|
||||
{
|
||||
na->SetVhost(req->ident, req->host, u->nick, req->time);
|
||||
na->SetVhost(req->ident, req->host, source.GetNick(), req->time);
|
||||
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
|
||||
|
||||
if (HSRequestMemoUser && memoserv)
|
||||
memoserv->Send(Config->HostServ, na->nick, _("[auto memo] Your requested vHost has been approved."), true);
|
||||
|
||||
source.Reply(_("vHost for %s has been activated"), na->nick.c_str());
|
||||
Log(LOG_COMMAND, u, this, NULL) << "for " << na->nick << " for vhost " << (!req->ident.empty() ? req->ident + "@" : "") << req->host;
|
||||
Log(LOG_COMMAND, source, this) << "for " << na->nick << " for vhost " << (!req->ident.empty() ? req->ident + "@" : "") << req->host;
|
||||
na->Shrink("hs_request");
|
||||
}
|
||||
else
|
||||
@@ -234,7 +233,6 @@ class CommandHSReject : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &reason = params.size() > 1 ? params[1] : "";
|
||||
@@ -257,7 +255,7 @@ class CommandHSReject : public Command
|
||||
}
|
||||
|
||||
source.Reply(_("vHost for %s has been rejected"), nick.c_str());
|
||||
Log(LOG_COMMAND, u, this, NULL) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "") << ")";
|
||||
Log(LOG_COMMAND, source, this, NULL) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "") << ")";
|
||||
}
|
||||
else
|
||||
source.Reply(_("No request for nick %s found."), nick.c_str());
|
||||
@@ -400,7 +398,7 @@ void req_send_memos(CommandSource &source, const Anope::string &vIdent, const An
|
||||
if (!na)
|
||||
continue;
|
||||
|
||||
Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.u->GetMask().c_str());
|
||||
Anope::string message = Anope::printf(_("[auto memo] vHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str());
|
||||
|
||||
memoserv->Send(Config->HostServ, na->nick, message, true);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandHSSet : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
|
||||
@@ -80,9 +79,9 @@ class CommandHSSet : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
|
||||
Log(LOG_ADMIN, source, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
|
||||
|
||||
na->SetVhost(user, host, u->nick);
|
||||
na->SetVhost(user, host, source.GetNick());
|
||||
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
|
||||
if (!user.empty())
|
||||
source.Reply(_("VHost for \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str());
|
||||
@@ -126,7 +125,6 @@ class CommandHSSetAll : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string nick = params[0];
|
||||
|
||||
@@ -182,9 +180,9 @@ class CommandHSSetAll : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, u, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
|
||||
Log(LOG_ADMIN, source, this) << "to set the vhost of " << na->nick << " to " << (!user.empty() ? user + "@" : "") << host;
|
||||
|
||||
na->SetVhost(user, host, u->nick);
|
||||
na->SetVhost(user, host, source.GetNick());
|
||||
this->Sync(na);
|
||||
FOREACH_MOD(I_OnSetVhost, OnSetVhost(na));
|
||||
if (!user.empty())
|
||||
|
||||
@@ -28,7 +28,6 @@ class CommandMSCancel : public Command
|
||||
if (!memoserv)
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nname = params[0];
|
||||
|
||||
@@ -46,7 +45,7 @@ class CommandMSCancel : public Command
|
||||
else
|
||||
na = findnick(nname);
|
||||
for (int i = mi->memos->size() - 1; i >= 0; --i)
|
||||
if (mi->GetMemo(i)->HasFlag(MF_UNREAD) && u->Account()->display.equals_ci(mi->GetMemo(i)->sender))
|
||||
if (mi->GetMemo(i)->HasFlag(MF_UNREAD) && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
|
||||
{
|
||||
if (ischan)
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(i)));
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandMSCheck : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &recipient = params[0];
|
||||
|
||||
@@ -44,7 +43,7 @@ class CommandMSCheck : public Command
|
||||
|
||||
for (int i = mi->memos->size() - 1; i >= 0; --i)
|
||||
{
|
||||
if (u->Account()->display.equals_ci(mi->GetMemo(i)->sender))
|
||||
if (source.nc->display.equals_ci(mi->GetMemo(i)->sender))
|
||||
{
|
||||
found = true; /* Yes, we've found the memo */
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class MemoDelCallback : public NumberList
|
||||
if (ci)
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(Number - 1)));
|
||||
else
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.u->Account(), mi, mi->GetMemo(Number - 1)));
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(Number - 1)));
|
||||
|
||||
mi->Del(Number - 1);
|
||||
source.Reply(_("Memo %d has been deleted."), Number);
|
||||
@@ -49,7 +49,6 @@ class CommandMSDel : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
MemoInfo *mi;
|
||||
ChannelInfo *ci = NULL;
|
||||
@@ -71,7 +70,7 @@ class CommandMSDel : public Command
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
return;
|
||||
}
|
||||
else if (!ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (!source.AccessFor(ci).HasPriv("MEMO"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -79,7 +78,7 @@ class CommandMSDel : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
mi = const_cast<MemoInfo *>(&u->Account()->memos);
|
||||
mi = const_cast<MemoInfo *>(&source.nc->memos);
|
||||
if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST")))
|
||||
this->OnSyntaxError(source, numstr);
|
||||
else if (mi->memos->empty())
|
||||
@@ -102,7 +101,7 @@ class CommandMSDel : public Command
|
||||
if (ci)
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(mi->memos->size() - 1)));
|
||||
else
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, mi->GetMemo(mi->memos->size() - 1)));
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(mi->memos->size() - 1)));
|
||||
mi->Del(mi->memos->size() - 1);
|
||||
source.Reply(_("Memo %d has been deleted."), mi->memos->size() + 1);
|
||||
}
|
||||
@@ -114,7 +113,7 @@ class CommandMSDel : public Command
|
||||
if (ci)
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(i)));
|
||||
else
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(u->Account(), mi, mi->GetMemo(i)));
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(source.nc, mi, mi->GetMemo(i)));
|
||||
mi->GetMemo(i)->destroy();
|
||||
}
|
||||
mi->memos->clear();
|
||||
|
||||
@@ -29,7 +29,6 @@ class CommandMSIgnore : public Command
|
||||
if (!memoserv)
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string channel = params[0];
|
||||
Anope::string command = (params.size() > 1 ? params[1] : "");
|
||||
@@ -39,7 +38,7 @@ class CommandMSIgnore : public Command
|
||||
{
|
||||
param = command;
|
||||
command = channel;
|
||||
channel = u->nick;
|
||||
channel = source.GetNick();
|
||||
}
|
||||
|
||||
bool ischan;
|
||||
@@ -47,7 +46,7 @@ class CommandMSIgnore : public Command
|
||||
ChannelInfo *ci = cs_findchan(channel);
|
||||
if (!mi)
|
||||
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str());
|
||||
else if (ischan && !ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (ischan && !source.AccessFor(ci).HasPriv("MEMO"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (command.equals_ci("ADD") && !param.empty())
|
||||
{
|
||||
|
||||
@@ -24,15 +24,14 @@ class CommandMSInfo : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
NickCore *nc = source.nc;
|
||||
const MemoInfo *mi;
|
||||
const NickAlias *na = NULL;
|
||||
ChannelInfo *ci = NULL;
|
||||
const Anope::string &nname = !params.empty() ? params[0] : "";
|
||||
int hardmax = 0;
|
||||
|
||||
if (!nname.empty() && nname[0] != '#' && u->HasPriv("memoserv/info"))
|
||||
if (!nname.empty() && nname[0] != '#' && source.HasPriv("memoserv/info"))
|
||||
{
|
||||
na = findnick(nname);
|
||||
if (!na)
|
||||
@@ -51,7 +50,7 @@ class CommandMSInfo : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, nname.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (!source.AccessFor(ci).HasPriv("MEMO"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -66,11 +65,11 @@ class CommandMSInfo : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
mi = &u->Account()->memos;
|
||||
hardmax = u->Account()->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
|
||||
mi = &nc->memos;
|
||||
hardmax = nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (!nname.empty() && (ci || na->nc != u->Account()))
|
||||
if (!nname.empty() && (ci || na->nc != nc))
|
||||
{
|
||||
if (mi->memos->empty())
|
||||
source.Reply(_("%s currently has no memos."), nname.c_str());
|
||||
@@ -127,7 +126,7 @@ class CommandMSInfo : public Command
|
||||
source.Reply(_("%s is not notified of new memos."), nname.c_str());
|
||||
}
|
||||
}
|
||||
else /* !nname || (!ci || na->nc == u->Account()) */
|
||||
else /* !nname || (!ci || na->nc == nc) */
|
||||
{
|
||||
if (mi->memos->empty())
|
||||
source.Reply(_("You currently have no memos."));
|
||||
@@ -156,14 +155,14 @@ class CommandMSInfo : public Command
|
||||
|
||||
if (!mi->memomax)
|
||||
{
|
||||
if (!u->IsServicesOper() && hardmax)
|
||||
if (!source.IsServicesOper() && hardmax)
|
||||
source.Reply(_("Your memo limit is \0020\002; you will not receive any new memos. You cannot change this limit."));
|
||||
else
|
||||
source.Reply(_("Your memo limit is \0020\002; you will not receive any new memos."));
|
||||
}
|
||||
else if (mi->memomax > 0)
|
||||
{
|
||||
if (!u->IsServicesOper() && hardmax)
|
||||
if (!source.IsServicesOper() && hardmax)
|
||||
source.Reply(_("Your memo limit is \002%d\002, and may not be changed."), mi->memomax);
|
||||
else
|
||||
source.Reply(_("Your memo limit is \002%d\002."), mi->memomax);
|
||||
@@ -172,11 +171,11 @@ class CommandMSInfo : public Command
|
||||
source.Reply(_("You have no limit on the number of memos you may keep."));
|
||||
|
||||
/* Ripped too. But differently because of a seg fault (loughs) */
|
||||
if (u->Account()->HasFlag(NI_MEMO_RECEIVE) && u->Account()->HasFlag(NI_MEMO_SIGNON))
|
||||
if (nc->HasFlag(NI_MEMO_RECEIVE) && nc->HasFlag(NI_MEMO_SIGNON))
|
||||
source.Reply(_("You will be notified of new memos at logon and when they arrive."));
|
||||
else if (u->Account()->HasFlag(NI_MEMO_RECEIVE))
|
||||
else if (nc->HasFlag(NI_MEMO_RECEIVE))
|
||||
source.Reply(_("You will be notified when new memos arrive."));
|
||||
else if (u->Account()->HasFlag(NI_MEMO_SIGNON))
|
||||
else if (nc->HasFlag(NI_MEMO_SIGNON))
|
||||
source.Reply(_("You will be notified of new memos at logon."));
|
||||
else
|
||||
source.Reply(_("You will not be notified of new memos."));
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandMSList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string param = !params.empty() ? params[0] : "", chan;
|
||||
ChannelInfo *ci = NULL;
|
||||
@@ -41,7 +40,7 @@ class CommandMSList : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (!source.AccessFor(ci).HasPriv("MEMO"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -49,7 +48,7 @@ class CommandMSList : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
mi = &u->Account()->memos;
|
||||
mi = &source.nc->memos;
|
||||
|
||||
if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW"))
|
||||
this->OnSyntaxError(source, param);
|
||||
@@ -131,7 +130,7 @@ class CommandMSList : public Command
|
||||
std::vector<Anope::string> replies;
|
||||
list.Process(replies);
|
||||
|
||||
source.Reply(_("Memos for %s."), ci ? ci->name.c_str() : u->nick.c_str());
|
||||
source.Reply(_("Memos for %s."), ci ? ci->name.c_str() : source.GetNick().c_str());
|
||||
for (unsigned i = 0; i < replies.size(); ++i)
|
||||
source.Reply(replies[i]);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Ano
|
||||
Anope::string text = Anope::printf(translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str());
|
||||
|
||||
/* Send notification */
|
||||
memoserv->Send(source.u->nick, m->sender, text, true);
|
||||
memoserv->Send(source.GetNick(), m->sender, text, true);
|
||||
|
||||
/* Notify recepient of the memo that a notification has
|
||||
been sent to the sender */
|
||||
@@ -78,7 +78,7 @@ class MemoListCallback : public NumberList
|
||||
|
||||
/* Check if a receipt notification was requested */
|
||||
if (m->HasFlag(MF_RECEIPT))
|
||||
rsend_notify(source, mi, m, ci ? ci->name : source.u->nick);
|
||||
rsend_notify(source, mi, m, ci ? ci->name : source.GetNick());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,7 +93,6 @@ class CommandMSRead : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
MemoInfo *mi;
|
||||
ChannelInfo *ci = NULL;
|
||||
@@ -110,7 +109,7 @@ class CommandMSRead : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (!source.AccessFor(ci).HasPriv("MEMO"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -118,7 +117,7 @@ class CommandMSRead : public Command
|
||||
mi = &ci->memos;
|
||||
}
|
||||
else
|
||||
mi = const_cast<MemoInfo *>(&u->Account()->memos);
|
||||
mi = const_cast<MemoInfo *>(&source.nc->memos);
|
||||
|
||||
if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && !numstr.is_number_only()))
|
||||
this->OnSyntaxError(source, numstr);
|
||||
|
||||
@@ -28,20 +28,19 @@ class CommandMSRSend : public Command
|
||||
if (!memoserv)
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &text = params[1];
|
||||
const NickAlias *na = NULL;
|
||||
|
||||
/* prevent user from rsend to themselves */
|
||||
if ((na = findnick(nick)) && na->nc == u->Account())
|
||||
if ((na = findnick(nick)) && na->nc == source.nc)
|
||||
{
|
||||
source.Reply(_("You can not request a receipt when sending a memo to yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->MSMemoReceipt == 1 && !u->IsServicesOper())
|
||||
if (Config->MSMemoReceipt == 1 && !source.IsServicesOper())
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (Config->MSMemoReceipt > 2 || Config->MSMemoReceipt == 0)
|
||||
{
|
||||
@@ -50,7 +49,7 @@ class CommandMSRSend : public Command
|
||||
}
|
||||
else
|
||||
{
|
||||
MemoServService::MemoResult result = memoserv->Send(u->nick, nick, text);
|
||||
MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
|
||||
if (result == MemoServService::MEMO_INVALID_TARGET)
|
||||
source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str());
|
||||
else if (result == MemoServService::MEMO_TOO_FAST)
|
||||
|
||||
@@ -31,7 +31,7 @@ class CommandMSSend : public Command
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &text = params[1];
|
||||
|
||||
MemoServService::MemoResult result = memoserv->Send(source.u->nick, nick, text);
|
||||
MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
|
||||
if (result == MemoServService::MEMO_SUCCESS)
|
||||
source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
|
||||
else if (result == MemoServService::MEMO_INVALID_TARGET)
|
||||
|
||||
@@ -28,7 +28,6 @@ class CommandMSSendAll : public Command
|
||||
if (!memoserv)
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
const Anope::string &text = params[0];
|
||||
|
||||
if (readonly)
|
||||
@@ -37,14 +36,12 @@ class CommandMSSendAll : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
const NickAlias *na = findnick(u->nick);
|
||||
|
||||
for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
|
||||
{
|
||||
const NickCore *nc = it->second;
|
||||
|
||||
if ((na && na->nc == nc) || !nc->display.equals_ci(u->nick))
|
||||
memoserv->Send(u->nick, nc->display, text);
|
||||
if (nc != source.nc)
|
||||
memoserv->Send(source.GetNick(), nc->display, text);
|
||||
}
|
||||
|
||||
source.Reply(_("A massmemo has been sent to all registered users."));
|
||||
|
||||
@@ -18,9 +18,8 @@ class CommandMSSet : public Command
|
||||
private:
|
||||
void DoNotify(CommandSource &source, const std::vector<Anope::string> ¶ms, MemoInfo *mi)
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string ¶m = params[1];
|
||||
NickCore *nc = u->Account();
|
||||
NickCore *nc = source.nc;
|
||||
|
||||
if (param.equals_ci("ON"))
|
||||
{
|
||||
@@ -70,16 +69,15 @@ class CommandMSSet : public Command
|
||||
|
||||
void DoLimit(CommandSource &source, const std::vector<Anope::string> ¶ms, MemoInfo *mi)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string p1 = params[1];
|
||||
Anope::string p2 = params.size() > 2 ? params[2] : "";
|
||||
Anope::string p3 = params.size() > 3 ? params[3] : "";
|
||||
Anope::string user, chan;
|
||||
int16_t limit;
|
||||
NickCore *nc = u->Account();
|
||||
NickCore *nc = source.nc;
|
||||
ChannelInfo *ci = NULL;
|
||||
bool is_servadmin = u->HasPriv("memoserv/set-limit");
|
||||
bool is_servadmin = source.HasPriv("memoserv/set-limit");
|
||||
|
||||
if (p1[0] == '#')
|
||||
{
|
||||
@@ -94,7 +92,7 @@ class CommandMSSet : public Command
|
||||
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!is_servadmin && !ci->AccessFor(u).HasPriv("MEMO"))
|
||||
else if (!is_servadmin && !source.AccessFor(ci).HasPriv("MEMO"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -180,21 +178,21 @@ class CommandMSSet : public Command
|
||||
mi->memomax = limit;
|
||||
if (limit > 0)
|
||||
{
|
||||
if (chan.empty() && nc == u->Account())
|
||||
if (chan.empty() && nc == source.nc)
|
||||
source.Reply(_("Your memo limit has been set to \002%d\002."), limit);
|
||||
else
|
||||
source.Reply(_("Memo limit for %s set to \002%d\002."), !chan.empty() ? chan.c_str() : user.c_str(), limit);
|
||||
}
|
||||
else if (!limit)
|
||||
{
|
||||
if (chan.empty() && nc == u->Account())
|
||||
if (chan.empty() && nc == source.nc)
|
||||
source.Reply(_("You will no longer be able to receive memos."));
|
||||
else
|
||||
source.Reply(_("Memo limit for %s set to \0020\002."), !chan.empty() ? chan.c_str() : user.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chan.empty() && nc == u->Account())
|
||||
if (chan.empty() && nc == source.nc)
|
||||
source.Reply(_("Your memo limit has been disabled."));
|
||||
else
|
||||
source.Reply(_("Memo limit \002disabled\002 for %s."), !chan.empty() ? chan.c_str() : user.c_str());
|
||||
@@ -210,9 +208,8 @@ class CommandMSSet : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &cmd = params[0];
|
||||
MemoInfo *mi = const_cast<MemoInfo *>(&u->Account()->memos);
|
||||
MemoInfo *mi = const_cast<MemoInfo *>(&source.nc->memos);
|
||||
|
||||
if (readonly)
|
||||
source.Reply(_("Sorry, memo option setting is temporarily disabled."));
|
||||
@@ -263,8 +260,7 @@ class CommandMSSet : public Command
|
||||
"\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."));
|
||||
else if (subcommand.equals_ci("LIMIT"))
|
||||
{
|
||||
User *u = source.u;
|
||||
if (u->IsServicesOper())
|
||||
if (source.IsServicesOper())
|
||||
source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n"
|
||||
" \n"
|
||||
"Sets the maximum number of memos a user or channel is\n"
|
||||
|
||||
@@ -40,8 +40,8 @@ class CommandMSStaff : public Command
|
||||
{
|
||||
const NickCore *nc = it->second;
|
||||
|
||||
if (nc->IsServicesOper())
|
||||
memoserv->Send(source.u->nick, nc->display, text, true);
|
||||
if (source.nc != nc && nc->IsServicesOper())
|
||||
memoserv->Send(source.GetNick(), nc->display, text, true);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -94,7 +94,6 @@ class CommandNSAccess : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &cmd = params[0];
|
||||
Anope::string nick, mask;
|
||||
|
||||
@@ -115,12 +114,12 @@ class CommandNSAccess : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
return;
|
||||
}
|
||||
else if (na->nc != u->Account() && !u->HasPriv("nickserv/access"))
|
||||
else if (na->nc != source.nc && !source.HasPriv("nickserv/access"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
else if (Config->NSSecureAdmins && u->Account() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
|
||||
else if (Config->NSSecureAdmins && source.nc != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
|
||||
{
|
||||
source.Reply(_("You may view but not modify the access list of other services operators."));
|
||||
return;
|
||||
@@ -129,7 +128,7 @@ class CommandNSAccess : public Command
|
||||
nc = na->nc;
|
||||
}
|
||||
else
|
||||
nc = u->Account();
|
||||
nc = source.nc;
|
||||
|
||||
if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos))
|
||||
{
|
||||
@@ -137,7 +136,7 @@ class CommandNSAccess : public Command
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), this->name.c_str());
|
||||
}
|
||||
else if (nc->HasFlag(NI_SUSPENDED))
|
||||
source.Reply(NICK_X_SUSPENDED, u->Account()->display.c_str());
|
||||
source.Reply(NICK_X_SUSPENDED, nc->display.c_str());
|
||||
else if (cmd.equals_ci("ADD"))
|
||||
return this->DoAdd(source, nc, mask);
|
||||
else if (cmd.equals_ci("DEL"))
|
||||
|
||||
@@ -82,11 +82,11 @@ class CommandNSAJoin : public Command
|
||||
{
|
||||
void DoList(CommandSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
AJoinList *channels = source.u->Account()->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
AJoinList *channels = source.nc->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
if (channels == NULL)
|
||||
{
|
||||
channels = new AJoinList();
|
||||
source.u->Account()->Extend("ns_ajoin_channels", channels);
|
||||
source.nc->Extend("ns_ajoin_channels", channels);
|
||||
}
|
||||
|
||||
if ((*channels)->empty())
|
||||
@@ -117,11 +117,11 @@ class CommandNSAJoin : public Command
|
||||
|
||||
void DoAdd(CommandSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
AJoinList *channels = source.u->Account()->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
AJoinList *channels = source.nc->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
if (channels == NULL)
|
||||
{
|
||||
channels = new AJoinList();
|
||||
source.u->Account()->Extend("ns_ajoin_channels", channels);
|
||||
source.nc->Extend("ns_ajoin_channels", channels);
|
||||
}
|
||||
|
||||
unsigned i = 0;
|
||||
@@ -138,7 +138,7 @@ class CommandNSAJoin : public Command
|
||||
else
|
||||
{
|
||||
AJoinEntry *entry = new AJoinEntry();
|
||||
entry->owner = source.u->Account();
|
||||
entry->owner = source.nc;
|
||||
entry->channel = params[1];
|
||||
entry->key = params.size() > 2 ? params[2] : "";
|
||||
(*channels)->push_back(entry);
|
||||
@@ -148,11 +148,11 @@ class CommandNSAJoin : public Command
|
||||
|
||||
void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
AJoinList *channels = source.u->Account()->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
AJoinList *channels = source.nc->GetExt<AJoinList *>("ns_ajoin_channels");
|
||||
if (channels == NULL)
|
||||
{
|
||||
channels = new AJoinList();
|
||||
source.u->Account()->Extend("ns_ajoin_channels", channels);
|
||||
source.nc->Extend("ns_ajoin_channels", channels);
|
||||
}
|
||||
|
||||
unsigned i = 0;
|
||||
|
||||
@@ -24,10 +24,9 @@ class CommandNSAList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
Anope::string nick = u->Account()->display;
|
||||
Anope::string nick = source.GetNick();
|
||||
|
||||
if (params.size() && u->IsServicesOper())
|
||||
if (params.size() && source.IsServicesOper())
|
||||
nick = params[0];
|
||||
|
||||
const NickAlias *na = findnick(nick);
|
||||
|
||||
@@ -60,10 +60,10 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source.u->fingerprint.empty() && !nc->FindCert(source.u->fingerprint))
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && !nc->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
nc->AddCert(source.u->fingerprint);
|
||||
source.Reply(_("\002%s\002 added to your certificate list."), source.u->fingerprint.c_str());
|
||||
nc->AddCert(source.GetUser()->fingerprint);
|
||||
source.Reply(_("\002%s\002 added to your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,10 @@ class CommandNSCert : public Command
|
||||
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &mask)
|
||||
{
|
||||
|
||||
if (!source.u->fingerprint.empty() && nc->FindCert(source.u->fingerprint))
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && nc->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
nc->EraseCert(source.u->fingerprint);
|
||||
source.Reply(_("\002%s\002 deleted from your certificate list."), source.u->fingerprint.c_str());
|
||||
nc->EraseCert(source.GetUser()->fingerprint);
|
||||
source.Reply(_("\002%s\002 deleted from your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,11 +113,10 @@ class CommandNSCert : public Command
|
||||
|
||||
void DoList(CommandSource &source, const NickCore *nc)
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
if (nc->cert.empty())
|
||||
{
|
||||
source.Reply(_("Your certificate list is empty."), u->nick.c_str());
|
||||
source.Reply(_("Your certificate list is empty."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -150,18 +148,17 @@ class CommandNSCert : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &cmd = params[0];
|
||||
const Anope::string &mask = params.size() > 1 ? params[1] : "";
|
||||
|
||||
const NickAlias *na;
|
||||
if (cmd.equals_ci("LIST") && u->IsServicesOper() && !mask.empty() && (na = findnick(mask)))
|
||||
if (cmd.equals_ci("LIST") && source.IsServicesOper() && !mask.empty() && (na = findnick(mask)))
|
||||
return this->DoServAdminList(source, na->nc);
|
||||
|
||||
NickCore *nc = u->Account();
|
||||
NickCore *nc = source.nc;
|
||||
|
||||
if (u->Account()->HasFlag(NI_SUSPENDED))
|
||||
source.Reply(NICK_X_SUSPENDED, u->Account()->display.c_str());
|
||||
if (source.nc->HasFlag(NI_SUSPENDED))
|
||||
source.Reply(NICK_X_SUSPENDED, source.nc->display.c_str());
|
||||
else if (cmd.equals_ci("ADD"))
|
||||
return this->DoAdd(source, nc, mask);
|
||||
else if (cmd.equals_ci("DEL"))
|
||||
|
||||
@@ -18,13 +18,11 @@ class CommandNSDrop : public Command
|
||||
public:
|
||||
CommandNSDrop(Module *creator) : Command(creator, "nickserv/drop", 0, 1)
|
||||
{
|
||||
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
|
||||
this->SetDesc(_("Cancel the registration of a nickname"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
Anope::string nick = !params.empty() ? params[0] : "";
|
||||
|
||||
if (readonly)
|
||||
@@ -33,25 +31,19 @@ class CommandNSDrop : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
NickAlias *na = findnick((u->Account() && !nick.empty() ? nick : u->nick));
|
||||
NickAlias *na = findnick(!nick.empty() ? nick : source.GetNick());
|
||||
if (!na)
|
||||
{
|
||||
source.Reply(NICK_NOT_REGISTERED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->Account())
|
||||
{
|
||||
source.Reply(NICK_IDENTIFY_REQUIRED, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_mine = u->Account() == na->nc;
|
||||
bool is_mine = source.nc == na->nc;
|
||||
Anope::string my_nick;
|
||||
if (is_mine && nick.empty())
|
||||
my_nick = na->nick;
|
||||
|
||||
if (!is_mine && !u->HasPriv("nickserv/drop"))
|
||||
if (!is_mine && !source.HasPriv("nickserv/drop"))
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (Config->NSSecureAdmins && !is_mine && na->nc->IsServicesOper())
|
||||
source.Reply(_("You may not drop other services operators nicknames."));
|
||||
@@ -60,9 +52,9 @@ class CommandNSDrop : public Command
|
||||
if (readonly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
|
||||
FOREACH_MOD(I_OnNickDrop, OnNickDrop(u, na));
|
||||
FOREACH_MOD(I_OnNickDrop, OnNickDrop(source, na));
|
||||
|
||||
Log(!is_mine ? LOG_OVERRIDE : LOG_COMMAND, u, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
Log(!is_mine ? LOG_OVERRIDE : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
na->destroy();
|
||||
|
||||
if (!is_mine)
|
||||
@@ -83,8 +75,7 @@ class CommandNSDrop : public Command
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
if (u->Account() && u->HasPriv("nickserv/drop"))
|
||||
if (source.HasPriv("nickserv/drop"))
|
||||
source.Reply(_("Syntax: \002%s [\037nickname\037]\002\n"
|
||||
" \n"
|
||||
"Without a parameter, deletes your nickname.\n"
|
||||
|
||||
@@ -28,11 +28,10 @@ class CommandNSGetEMail : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &email = params[0];
|
||||
int j = 0;
|
||||
|
||||
Log(LOG_ADMIN, u, this) << "on " << email;
|
||||
Log(LOG_ADMIN, source, this) << "on " << email;
|
||||
|
||||
for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ class CommandNSGetPass : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &nick = params[0];
|
||||
Anope::string tmp_pass;
|
||||
const NickAlias *na;
|
||||
@@ -37,7 +36,7 @@ class CommandNSGetPass : public Command
|
||||
{
|
||||
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
|
||||
{
|
||||
Log(LOG_ADMIN, u, this) << "for " << nick;
|
||||
Log(LOG_ADMIN, source, this) << "for " << nick;
|
||||
source.Reply(_("Password for %s is \002%s\002."), nick.c_str(), tmp_pass.c_str());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -28,7 +28,6 @@ class CommandNSGhost : public Command
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &pass = params.size() > 1 ? params[1] : "";
|
||||
|
||||
User *u = source.u;
|
||||
User *user = finduser(nick);
|
||||
const NickAlias *na = findnick(nick);
|
||||
|
||||
@@ -40,16 +39,16 @@ class CommandNSGhost : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
else if (na->nc->HasFlag(NI_SUSPENDED))
|
||||
source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
|
||||
else if (nick.equals_ci(u->nick))
|
||||
else if (nick.equals_ci(source.GetNick()))
|
||||
source.Reply(_("You can't ghost yourself!"));
|
||||
else
|
||||
{
|
||||
bool ok = false;
|
||||
if (u->Account() == na->nc)
|
||||
if (source.nc == na->nc)
|
||||
ok = true;
|
||||
else if (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc))
|
||||
else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc))
|
||||
ok = true;
|
||||
else if (!u->fingerprint.empty() && na->nc->FindCert(u->fingerprint))
|
||||
else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint))
|
||||
ok = true;
|
||||
else if (!pass.empty())
|
||||
{
|
||||
@@ -67,8 +66,8 @@ class CommandNSGhost : public Command
|
||||
source.Reply(_("You may not ghost an unidentified user, use RECOVER instead."));
|
||||
else
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "for " << nick;
|
||||
Anope::string buf = "GHOST command used by " + u->nick;
|
||||
Log(LOG_COMMAND, source, this) << "for " << nick;
|
||||
Anope::string buf = "GHOST command used by " + source.GetNick();
|
||||
user->Kill(Config->NickServ, buf);
|
||||
source.Reply(_("Ghost with your nick has been killed."), nick.c_str());
|
||||
}
|
||||
@@ -78,8 +77,9 @@ class CommandNSGhost : public Command
|
||||
source.Reply(ACCESS_DENIED);
|
||||
if (!pass.empty())
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "with an invalid password for " << nick;
|
||||
bad_password(u);
|
||||
Log(LOG_COMMAND, source, this) << "with an invalid password for " << nick;
|
||||
if (source.GetUser())
|
||||
bad_password(source.GetUser());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ class CommandNSGroup : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &pass = params.size() > 1 ? params[1] : "";
|
||||
@@ -61,7 +64,7 @@ class CommandNSGroup : public Command
|
||||
source.Reply(_("Please wait %d seconds before using the GROUP command again."), (Config->NSRegDelay + u->lastnickreg) - Anope::CurTime);
|
||||
else if (target && target->nc->HasFlag(NI_SUSPENDED))
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "tried to use GROUP for SUSPENDED nick " << target->nick;
|
||||
Log(LOG_COMMAND, source, this) << "tried to use GROUP for SUSPENDED nick " << target->nick;
|
||||
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
|
||||
}
|
||||
else if (na && *target->nc == *na->nc)
|
||||
@@ -123,14 +126,14 @@ class CommandNSGroup : public Command
|
||||
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
|
||||
FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target));
|
||||
|
||||
Log(LOG_COMMAND, u, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
|
||||
Log(LOG_COMMAND, source, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
|
||||
source.Reply(_("You are now in the group of \002%s\002."), target->nick.c_str());
|
||||
|
||||
u->lastnickreg = Anope::CurTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "failed group for " << target->nick;
|
||||
Log(LOG_COMMAND, source, this) << "failed group for " << target->nick;
|
||||
source.Reply(PASSWORD_INCORRECT);
|
||||
bad_password(u);
|
||||
}
|
||||
@@ -183,7 +186,10 @@ class CommandNSUngroup : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
Anope::string nick = !params.empty() ? params[0] : "";
|
||||
NickAlias *na = findnick(!nick.empty() ? nick : u->nick);
|
||||
|
||||
@@ -249,7 +255,6 @@ class CommandNSGList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &nick = !params.empty() ? params[0] : "";
|
||||
const NickCore *nc;
|
||||
|
||||
@@ -261,7 +266,7 @@ class CommandNSGList : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!u->IsServicesOper())
|
||||
else if (!source.IsServicesOper())
|
||||
{
|
||||
source.Reply(ACCESS_DENIED, Config->NickServ.c_str());
|
||||
return;
|
||||
@@ -270,7 +275,7 @@ class CommandNSGList : public Command
|
||||
nc = na->nc;
|
||||
}
|
||||
else
|
||||
nc = u->Account();
|
||||
nc = source.nc;
|
||||
|
||||
ListFormatter list;
|
||||
list.addColumn("Nick").addColumn("Expires");
|
||||
@@ -298,8 +303,7 @@ class CommandNSGList : public Command
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
if (u->IsServicesOper())
|
||||
if (source.IsServicesOper())
|
||||
source.Reply(_("Syntax: \002%s [\037nickname\037]\002\n"
|
||||
" \n"
|
||||
"Without a parameter, lists all nicknames that are in\n"
|
||||
|
||||
@@ -25,7 +25,10 @@ class CommandNSIdentify : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
User *u = source.GetUser();
|
||||
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
const Anope::string &nick = params.size() == 2 ? params[0] : u->nick;
|
||||
Anope::string pass = params[params.size() - 1];
|
||||
@@ -46,16 +49,16 @@ class CommandNSIdentify : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
else if (MOD_RESULT != EVENT_ALLOW)
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "and failed to identify";
|
||||
Log(LOG_COMMAND, source, this) << "and failed to identify";
|
||||
source.Reply(PASSWORD_INCORRECT);
|
||||
bad_password(u);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (u->IsIdentified())
|
||||
Log(LOG_COMMAND, u, this) << "to log out of account " << u->Account()->display;
|
||||
Log(LOG_COMMAND, source, this) << "to log out of account " << u->Account()->display;
|
||||
|
||||
Log(LOG_COMMAND, u, this) << "and identified for account " << na->nc->display;
|
||||
Log(LOG_COMMAND, source, this) << "and identified for account " << na->nc->display;
|
||||
source.Reply(_("Password accepted - you are now recognized."));
|
||||
u->Identify(na);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
class CommandNSInfo : public Command
|
||||
{
|
||||
private:
|
||||
template<typename T, unsigned END> void CheckOptStr(User *u, Anope::string &buf, T opt, const char *str, const Flags<T, END> *nc, bool reverse_logic = false)
|
||||
template<typename T, unsigned END> void CheckOptStr(NickCore *core, Anope::string &buf, T opt, const char *str, const Flags<T, END> *nc, bool reverse_logic = false)
|
||||
{
|
||||
if (reverse_logic ? !nc->HasFlag(opt) : nc->HasFlag(opt))
|
||||
{
|
||||
if (!buf.empty())
|
||||
buf += ", ";
|
||||
|
||||
buf += translate(u, str);
|
||||
buf += translate(core, str);
|
||||
}
|
||||
}
|
||||
public:
|
||||
@@ -36,11 +36,10 @@ class CommandNSInfo : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params.size() ? params[0] : (u->Account() ? u->Account()->display : u->nick);
|
||||
const Anope::string &nick = params.size() ? params[0] : (source.nc ? source.nc->display : source.GetNick());
|
||||
NickAlias *na = findnick(nick);
|
||||
bool has_auspex = u->IsIdentified() && u->HasPriv("nickserv/auspex");
|
||||
bool has_auspex = source.HasPriv("nickserv/auspex");
|
||||
|
||||
if (!na)
|
||||
{
|
||||
@@ -58,7 +57,7 @@ class CommandNSInfo : public Command
|
||||
if (u2 && u2->Account() == na->nc)
|
||||
nick_online = true;
|
||||
|
||||
if (has_auspex || (u->Account() && na->nc == u->Account()))
|
||||
if (has_auspex || na->nc == source.nc)
|
||||
show_hidden = true;
|
||||
|
||||
source.Reply(_("%s is %s"), na->nick.c_str(), na->last_realname.c_str());
|
||||
@@ -69,7 +68,7 @@ class CommandNSInfo : public Command
|
||||
if (na->nc->IsServicesOper() && (show_hidden || !na->nc->HasFlag(NI_HIDE_STATUS)))
|
||||
source.Reply(_("%s is a services operator of type %s."), na->nick.c_str(), na->nc->o->ot->GetName().c_str());
|
||||
|
||||
InfoFormatter info(u);
|
||||
InfoFormatter info(source.nc);
|
||||
|
||||
if (nick_online)
|
||||
{
|
||||
@@ -114,14 +113,14 @@ class CommandNSInfo : public Command
|
||||
|
||||
Anope::string optbuf;
|
||||
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_KILLPROTECT, _("Protection"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_SECURE, _("Security"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_PRIVATE, _("Private"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_MSG, _("Message mode"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_AUTOOP, _("Auto-op"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_SUSPENDED, _("Suspended"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(u, optbuf, NI_STATS, _("Chanstats"), na->nc);
|
||||
CheckOptStr<NickNameFlag, NS_END>(u, optbuf, NS_NO_EXPIRE, _("No expire"), na);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_KILLPROTECT, _("Protection"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_SECURE, _("Security"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_PRIVATE, _("Private"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_MSG, _("Message mode"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_AUTOOP, _("Auto-op"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_SUSPENDED, _("Suspended"), na->nc);
|
||||
CheckOptStr<NickCoreFlag, NI_END>(source.nc, optbuf, NI_STATS, _("Chanstats"), na->nc);
|
||||
CheckOptStr<NickNameFlag, NS_END>(source.nc, optbuf, NS_NO_EXPIRE, _("No expire"), na);
|
||||
|
||||
info[_("Options")] = optbuf.empty() ? _("None") : optbuf;
|
||||
|
||||
|
||||
@@ -24,12 +24,11 @@ class CommandNSList : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string pattern = params[0];
|
||||
const NickCore *mync;
|
||||
unsigned nnicks;
|
||||
bool is_servadmin = u->HasCommand("nickserv/list");
|
||||
bool is_servadmin = source.HasCommand("nickserv/list");
|
||||
int count = 0, from = 0, to = 0;
|
||||
bool suspended, nsnoexpire, unconfirmed;
|
||||
|
||||
@@ -70,7 +69,7 @@ class CommandNSList : public Command
|
||||
}
|
||||
}
|
||||
|
||||
mync = u->Account();
|
||||
mync = source.nc;
|
||||
ListFormatter list;
|
||||
|
||||
list.addColumn("Nick").addColumn("Last usermask");
|
||||
|
||||
@@ -25,16 +25,15 @@ class CommandNSLogout : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = !params.empty() ? params[0] : "";
|
||||
const Anope::string ¶m = params.size() > 1 ? params[1] : "";
|
||||
|
||||
User *u2;
|
||||
if (!u->IsServicesOper() && !nick.empty())
|
||||
if (!source.IsServicesOper() && !nick.empty())
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (!(u2 = (!nick.empty() ? finduser(nick) : u)))
|
||||
source.Reply(NICK_X_NOT_IN_USE, nick.c_str());
|
||||
else if (!(u2 = (!nick.empty() ? finduser(nick) : source.GetUser())))
|
||||
source.Reply(NICK_X_NOT_IN_USE, !nick.empty() ? nick.c_str() : source.GetNick().c_str());
|
||||
else if (!nick.empty() && u2->IsServicesOper())
|
||||
source.Reply(_("You can't logout %s because they are a Services Operator."), nick.c_str());
|
||||
else
|
||||
@@ -43,7 +42,7 @@ class CommandNSLogout : public Command
|
||||
nickserv->Validate(u2);
|
||||
|
||||
u2->SuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */
|
||||
Log(LOG_COMMAND, u, this) << "to logout " << u2->nick;
|
||||
Log(LOG_COMMAND, source, this) << "to logout " << u2->nick;
|
||||
|
||||
/* Remove founder status from this user in all channels */
|
||||
if (!nick.empty())
|
||||
|
||||
@@ -44,7 +44,6 @@ class CommandNSRecover : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
|
||||
const Anope::string &nick = params[0];
|
||||
const Anope::string &pass = params.size() > 1 ? params[1] : "";
|
||||
@@ -59,7 +58,7 @@ class CommandNSRecover : public Command
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
else if (na->nc->HasFlag(NI_SUSPENDED))
|
||||
source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
|
||||
else if (nick.equals_ci(u->nick))
|
||||
else if (nick.equals_ci(source.GetNick()))
|
||||
source.Reply(_("You can't recover yourself!"));
|
||||
else if (!pass.empty())
|
||||
{
|
||||
@@ -75,17 +74,22 @@ class CommandNSRecover : public Command
|
||||
else
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
Log(LOG_COMMAND, u, this) << "with invalid password for " << nick;
|
||||
bad_password(u);
|
||||
Log(LOG_COMMAND, source, this) << "with invalid password for " << nick;
|
||||
if (source.GetUser())
|
||||
bad_password(source.GetUser());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc)) ||
|
||||
(!u->fingerprint.empty() && na->nc->FindCert(u->fingerprint)))
|
||||
{
|
||||
bool ok = false;
|
||||
if (source.nc == na->nc)
|
||||
ok = true;
|
||||
else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && is_on_access(source.GetUser(), na->nc))
|
||||
ok = true;
|
||||
else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint))
|
||||
ok = true;
|
||||
if (ok)
|
||||
this->DoRecover(source, u2, na, nick);
|
||||
}
|
||||
else
|
||||
source.Reply(ACCESS_DENIED);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,9 @@ class CommandNSConfirm : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &passcode = params[0];
|
||||
|
||||
if (u->Account() && !u->Account()->HasFlag(NI_UNCONFIRMED) && u->HasPriv("nickserv/confirm"))
|
||||
if (source.nc && !source.nc->HasFlag(NI_UNCONFIRMED) && source.HasPriv("nickserv/confirm"))
|
||||
{
|
||||
NickAlias *na = findnick(passcode);
|
||||
if (na == NULL)
|
||||
@@ -45,25 +44,28 @@ class CommandNSConfirm : public Command
|
||||
else
|
||||
{
|
||||
na->nc->UnsetFlag(NI_UNCONFIRMED);
|
||||
Log(LOG_ADMIN, u, this) << "to confirm nick " << na->nick << " (" << na->nc->display << ")";
|
||||
Log(LOG_ADMIN, source, this) << "to confirm nick " << na->nick << " (" << na->nc->display << ")";
|
||||
source.Reply(_("Nick \002%s\002 has been confirmed."), na->nick.c_str());
|
||||
}
|
||||
}
|
||||
else if (u->Account())
|
||||
else if (source.nc)
|
||||
{
|
||||
Anope::string *code = u->Account()->GetExt<ExtensibleString *>("ns_register_passcode");
|
||||
Anope::string *code = source.nc->GetExt<ExtensibleString *>("ns_register_passcode");
|
||||
if (code != NULL && *code == passcode)
|
||||
{
|
||||
NickCore *nc = u->Account();
|
||||
NickCore *nc = source.nc;
|
||||
nc->Shrink("ns_register_passcode");
|
||||
Log(LOG_COMMAND, u, this) << "to confirm their email";
|
||||
source.Reply(_("Your email address of \002%s\002 has been confirmed."), u->Account()->email.c_str());
|
||||
Log(LOG_COMMAND, source, this) << "to confirm their email";
|
||||
source.Reply(_("Your email address of \002%s\002 has been confirmed."), source.nc->email.c_str());
|
||||
nc->UnsetFlag(NI_UNCONFIRMED);
|
||||
|
||||
ircdproto->SendLogin(u);
|
||||
const NickAlias *na = findnick(u->nick);
|
||||
if (!Config->NoNicknameOwnership && na != NULL && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
|
||||
if (source.GetUser())
|
||||
{
|
||||
ircdproto->SendLogin(source.GetUser());
|
||||
const NickAlias *na = findnick(source.GetNick());
|
||||
if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.nc && na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
source.GetUser()->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
|
||||
}
|
||||
}
|
||||
else
|
||||
source.Reply(_("Invalid passcode."));
|
||||
@@ -76,7 +78,6 @@ class CommandNSConfirm : public Command
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_("This command is used by several commands as a way to confirm\n"
|
||||
@@ -87,7 +88,7 @@ class CommandNSConfirm : public Command
|
||||
" \n"
|
||||
"This is also used after the RESETPASS command has been used to\n"
|
||||
"force identify you to your nick so you may change your password."));
|
||||
if (u->Account() && u->HasPriv("nickserv/confirm"))
|
||||
if (source.HasPriv("nickserv/confirm"))
|
||||
source.Reply(_("Additionally, Services Operators with the \037nickserv/confirm\037 permission can\n"
|
||||
"replace \037passcode\037 with a users nick to force validate them."));
|
||||
return true;
|
||||
@@ -114,10 +115,11 @@ class CommandNSRegister : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
NickAlias *na;
|
||||
size_t prefixlen = Config->NSGuestNickPrefix.length();
|
||||
size_t nicklen = u->nick.length();
|
||||
User *u = source.GetUser();
|
||||
Anope::string u_nick = source.GetNick();
|
||||
size_t nicklen = u_nick.length();
|
||||
Anope::string pass = params[0];
|
||||
Anope::string email = params.size() > 1 ? params[1] : "";
|
||||
|
||||
@@ -133,7 +135,7 @@ class CommandNSRegister : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
|
||||
if (u && !u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
|
||||
{
|
||||
source.Reply(_("You must have been using this nick for at least %d seconds to register."), Config->NickRegDelay);
|
||||
return;
|
||||
@@ -144,15 +146,15 @@ class CommandNSRegister : public Command
|
||||
/* Guest nick can now have a series of between 1 and 7 digits.
|
||||
* --lara
|
||||
*/
|
||||
if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && !u->nick.find_ci(Config->NSGuestNickPrefix) && u->nick.substr(prefixlen).find_first_not_of("1234567890") == Anope::string::npos)
|
||||
if (nicklen <= prefixlen + 7 && nicklen >= prefixlen + 1 && !u_nick.find_ci(Config->NSGuestNickPrefix) && u_nick.substr(prefixlen).find_first_not_of("1234567890") == Anope::string::npos)
|
||||
{
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ircdproto->IsNickValid(u->nick))
|
||||
if (!ircdproto->IsNickValid(u_nick))
|
||||
{
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,20 +163,20 @@ class CommandNSRegister : public Command
|
||||
{
|
||||
Oper *o = Config->Opers[i];
|
||||
|
||||
if (!u->HasMode(UMODE_OPER) && u->nick.find_ci(o->name) != Anope::string::npos)
|
||||
if (!source.IsOper() && u_nick.find_ci(o->name) != Anope::string::npos)
|
||||
{
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
|
||||
source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config->NSForceEmail && email.empty())
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay)
|
||||
else if (u && Anope::CurTime < u->lastnickreg + Config->NSRegDelay)
|
||||
source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + Config->NSRegDelay) - Anope::CurTime);
|
||||
else if ((na = findnick(u->nick)))
|
||||
source.Reply(NICK_ALREADY_REGISTERED, u->nick.c_str());
|
||||
else if (pass.equals_ci(u->nick) || (Config->StrictPasswords && pass.length() < 5))
|
||||
else if ((na = findnick(u_nick)))
|
||||
source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str());
|
||||
else if (pass.equals_ci(u_nick) || (Config->StrictPasswords && pass.length() < 5))
|
||||
source.Reply(MORE_OBSCURE_PASSWORD);
|
||||
else if (pass.length() > Config->PassLen)
|
||||
source.Reply(PASSWORD_TOO_LONG);
|
||||
@@ -182,28 +184,30 @@ class CommandNSRegister : public Command
|
||||
source.Reply(MAIL_X_INVALID, email.c_str());
|
||||
else
|
||||
{
|
||||
NickCore *nc = new NickCore(u->nick);
|
||||
na = new NickAlias(u->nick, nc);
|
||||
NickCore *nc = new NickCore(u_nick);
|
||||
na = new NickAlias(u_nick, nc);
|
||||
enc_encrypt(pass, nc->pass);
|
||||
if (!email.empty())
|
||||
nc->email = email;
|
||||
|
||||
Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
|
||||
na->last_usermask = last_usermask;
|
||||
na->last_realname = u->realname;
|
||||
if (u)
|
||||
{
|
||||
na->last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
|
||||
na->last_realname = u->realname;
|
||||
|
||||
u->Login(nc);
|
||||
}
|
||||
if (Config->NSAddAccessOnReg)
|
||||
nc->AddAccess(create_mask(u));
|
||||
|
||||
u->Login(nc);
|
||||
|
||||
Log(LOG_COMMAND, u, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
|
||||
|
||||
FOREACH_MOD(I_OnNickRegister, OnNickRegister(na));
|
||||
|
||||
if (Config->NSAddAccessOnReg)
|
||||
source.Reply(_("Nickname \002%s\002 registered under your account: %s"), u->nick.c_str(), na->nc->GetAccess(0).c_str());
|
||||
source.Reply(_("Nickname \002%s\002 registered under your account: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str());
|
||||
else
|
||||
source.Reply(_("Nickname \002%s\002 registered."), u->nick.c_str());
|
||||
source.Reply(_("Nickname \002%s\002 registered."), u_nick.c_str());
|
||||
|
||||
Anope::string tmp_pass;
|
||||
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
|
||||
@@ -226,14 +230,13 @@ class CommandNSRegister : public Command
|
||||
else if (Config->NSRegistration.equals_ci("none"))
|
||||
{
|
||||
ircdproto->SendLogin(u);
|
||||
if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
if (!Config->NoNicknameOwnership && u && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
u->SetMode(findbot(Config->NickServ), UMODE_REGISTERED);
|
||||
}
|
||||
|
||||
u->lastnickreg = Anope::CurTime;
|
||||
if (u)
|
||||
u->lastnickreg = Anope::CurTime;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
|
||||
@@ -288,25 +291,24 @@ class CommandNSResend : public Command
|
||||
if (Config->NSRegistration.equals_ci("mail"))
|
||||
return;
|
||||
|
||||
User *u = source.u;
|
||||
const NickAlias *na = findnick(u->nick);
|
||||
const NickAlias *na = findnick(source.GetNick());
|
||||
|
||||
if (na == NULL)
|
||||
source.Reply(NICK_NOT_REGISTERED);
|
||||
else if (na->nc != u->Account() || u->Account()->HasFlag(NI_UNCONFIRMED) == false)
|
||||
else if (na->nc != source.nc || source.nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
source.Reply(_("Your account is already confirmed."));
|
||||
else
|
||||
{
|
||||
if (Anope::CurTime < u->Account()->lastmail + Config->NSResendDelay)
|
||||
if (Anope::CurTime < source.nc->lastmail + Config->NSResendDelay)
|
||||
source.Reply(_("Cannot send mail now; please retry a little later."));
|
||||
else if (SendRegmail(u, na, source.owner))
|
||||
else if (SendRegmail(source.GetUser(), na, source.owner))
|
||||
{
|
||||
na->nc->lastmail = Anope::CurTime;
|
||||
source.Reply(_("Your passcode has been re-sent to %s."), na->nc->email.c_str());
|
||||
Log(LOG_COMMAND, u, this) << "to resend registration verification code";
|
||||
Log(LOG_COMMAND, source, this) << "to resend registration verification code";
|
||||
}
|
||||
else
|
||||
Log() << "Unable to resend registration verification code for " << u->nick;
|
||||
Log() << "Unable to resend registration verification code for " << source.GetNick();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,6 @@ class CommandNSRelease : public Command
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.u;
|
||||
const Anope::string &nick = params[0];
|
||||
Anope::string pass = params.size() > 1 ? params[1] : "";
|
||||
NickAlias *na;
|
||||
@@ -45,26 +44,32 @@ class CommandNSRelease : public Command
|
||||
|
||||
if (MOD_RESULT == EVENT_ALLOW)
|
||||
{
|
||||
Log(LOG_COMMAND, u, this) << "for nickname " << na->nick;
|
||||
Log(LOG_COMMAND, source, this) << "for nickname " << na->nick;
|
||||
na->Release();
|
||||
source.Reply(_("Services' hold on \002%s\002 has been released."), nick.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
Log(LOG_COMMAND, u, this) << "invalid password for " << nick;
|
||||
bad_password(u);
|
||||
Log(LOG_COMMAND, source, this) << "invalid password for " << nick;
|
||||
if (source.GetUser())
|
||||
bad_password(source.GetUser());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool override = u->Account() != na->nc && u->HasPriv("nickserv/release");
|
||||
bool override = source.nc != na->nc && source.HasPriv("nickserv/release");
|
||||
|
||||
if (override || u->Account() == na->nc ||
|
||||
(!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc)) ||
|
||||
(!u->fingerprint.empty() && na->nc->FindCert(u->fingerprint)))
|
||||
bool ok = override;
|
||||
if (source.nc == na->nc)
|
||||
ok = true;
|
||||
else if (source.GetUser() && !na->nc->HasFlag(NI_SECURE) && is_on_access(source.GetUser(), na->nc))
|
||||
ok = true;
|
||||
else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint))
|
||||
ok = true;
|
||||
if (ok)
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this) << "for nickname " << na->nick;
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this) << "for nickname " << na->nick;
|
||||
na->Release();
|
||||
source.Reply(_("Services' hold on \002%s\002 has been released."), nick.c_str());
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user