diff options
Diffstat (limited to 'include/users.h')
-rw-r--r-- | include/users.h | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/include/users.h b/include/users.h index fc31a8297..4c8df549d 100644 --- a/include/users.h +++ b/include/users.h @@ -418,19 +418,21 @@ class CoreExport User : public Extensible */ bool IsNoticeMaskSet(unsigned char sm); - /** Create a displayable mode string for this users umodes - * @param showparameters The mode string + /** Get the mode letters of modes set on the user as a string. + * @param includeparams True to get the parameters of the modes as well. Defaults to false. + * @return Mode letters of modes set on the user and optionally the parameters of those modes, if any. + * The returned string always begins with a '+' character. If the user has no modes set, "+" is returned. */ - const char* FormatModes(bool showparameters = false); + std::string GetModeLetters(bool includeparams = false) const; /** Returns true if a specific mode is set * @param m The user mode * @return True if the mode is set */ - bool IsModeSet(unsigned char m); - bool IsModeSet(ModeHandler* mh); - bool IsModeSet(ModeHandler& mh) { return IsModeSet(&mh); } - bool IsModeSet(UserModeReference& moderef); + bool IsModeSet(unsigned char m) const; + bool IsModeSet(const ModeHandler* mh) const; + bool IsModeSet(const ModeHandler& mh) const { return IsModeSet(&mh); } + bool IsModeSet(UserModeReference& moderef) const; /** Set a specific usermode to on or off * @param m The user mode @@ -715,7 +717,7 @@ class CoreExport User : public Extensible /** Default destructor */ virtual ~User(); - virtual CullResult cull(); + virtual CullResult cull() CXX11_OVERRIDE; }; class CoreExport UserIOHandler : public StreamSocket @@ -740,7 +742,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local { public: LocalUser(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server); - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; UserIOHandler eh; @@ -834,12 +836,12 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local */ void SetClass(const std::string &explicit_name = ""); - bool SetClientIP(const char* sip, bool recheck_eline = true); + bool SetClientIP(const char* sip, bool recheck_eline = true) CXX11_OVERRIDE; - void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true); + void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true) CXX11_OVERRIDE; - void Write(const std::string& text); - void Write(const char*, ...) CUSTOM_PRINTF(2, 3); + void Write(const std::string& text) CXX11_OVERRIDE; + void Write(const char*, ...) CXX11_OVERRIDE CUSTOM_PRINTF(2, 3); /** Send a NOTICE message from the local server to the user. * The message will be sent even if the user is connected to a remote server. @@ -853,7 +855,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local * @param command A command (should be all CAPS) * @return True if this user can execute the command */ - bool HasPermission(const std::string &command); + bool HasPermission(const std::string &command) CXX11_OVERRIDE; /** Returns true if a user has a given permission. * This is used to check whether or not users may perform certain actions which admins may not wish to give to @@ -863,7 +865,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local * @param noisy If set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent. * @return True if this user has the permission in question. */ - bool HasPrivPermission(const std::string &privstr, bool noisy = false); + bool HasPrivPermission(const std::string &privstr, bool noisy = false) CXX11_OVERRIDE; /** Returns true or false if a user can set a privileged user or channel mode. * This is done by looking up their oper type from User::oper, then referencing @@ -871,7 +873,13 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local * @param mh Mode to check * @return True if the user can set or unset this mode. */ - bool HasModePermission(const ModeHandler* mh) const; + bool HasModePermission(const ModeHandler* mh) const CXX11_OVERRIDE; + + /** Change nick to uuid, unset REG_NICK and send a nickname overruled numeric. + * This is called when another user (either local or remote) needs the nick of this user and this user + * isn't registered. + */ + void OverruleNick(); }; class RemoteUser : public User @@ -896,9 +904,9 @@ class CoreExport FakeUser : public User nick = sname; } - virtual CullResult cull(); - virtual const std::string& GetFullHost(); - virtual const std::string& GetFullRealHost(); + virtual CullResult cull() CXX11_OVERRIDE; + virtual const std::string& GetFullHost() CXX11_OVERRIDE; + virtual const std::string& GetFullRealHost() CXX11_OVERRIDE; }; /* Faster than dynamic_cast */ @@ -918,12 +926,12 @@ inline FakeUser* IS_SERVER(User* u) return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL; } -inline bool User::IsModeSet(ModeHandler* mh) +inline bool User::IsModeSet(const ModeHandler* mh) const { return (modes[mh->GetId()]); } -inline bool User::IsModeSet(UserModeReference& moderef) +inline bool User::IsModeSet(UserModeReference& moderef) const { if (!moderef) return false; |