Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef USERS_H
00015 #define USERS_H
00016
00017 #include "anope.h"
00018 #include "modes.h"
00019 #include "extensible.h"
00020 #include "serialize.h"
00021 #include "commands.h"
00022 #include "account.h"
00023
00024 typedef Anope::hash_map<User *> user_map;
00025
00026 extern CoreExport user_map UserListByNick, UserListByUID;
00027
00028 extern CoreExport int OperCount;
00029 extern CoreExport unsigned MaxUserCount;
00030 extern CoreExport time_t MaxUserTime;
00031
00032
00033 class CoreExport User : public virtual Base, public Extensible, public CommandReply
00034 {
00035
00036 bool quit;
00037
00038 static std::list<User *> quitting_users;
00039 protected:
00040 Anope::string vident;
00041 Anope::string ident;
00042 Anope::string uid;
00043
00044 bool on_access;
00045
00046 std::map<Anope::string, Anope::string> modes;
00047
00048 Serialize::Reference<NickCore> nc;
00049
00050
00051 unsigned short invalid_pw_count;
00052
00053 time_t invalid_pw_time;
00054
00055
00056 public:
00057
00058 Anope::string nick;
00059
00060
00061 Anope::string host;
00062
00063 Anope::string vhost;
00064
00065 Anope::string chost;
00066
00067 Anope::string realname;
00068
00069 Anope::string fingerprint;
00070
00071 Anope::string ip;
00072
00073 Server *server;
00074
00075 time_t signon;
00076
00077 time_t timestamp;
00078
00079 bool super_admin;
00080
00081
00082 typedef std::list<ChanUserContainer *> ChanUserList;
00083 ChanUserList chans;
00084
00085
00086 time_t lastmemosend;
00087
00088 time_t lastnickreg;
00089
00090 time_t lastmail;
00091
00106 User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ssignon, const Anope::string &smodes, const Anope::string &suid = "");
00107
00108 protected:
00111 virtual ~User();
00112
00113 public:
00119 void ChangeNick(const Anope::string &newnick, time_t ts = Anope::CurTime);
00120
00125 void SetDisplayedHost(const Anope::string &host);
00126
00130 const Anope::string &GetDisplayedHost() const;
00131
00135 void SetCloakedHost(const Anope::string &newhost);
00136
00140 const Anope::string &GetCloakedHost() const;
00141
00145 const Anope::string &GetUID() const;
00146
00150 void SetVIdent(const Anope::string &ident);
00151
00155 const Anope::string &GetVIdent() const;
00156
00161 void SetIdent(const Anope::string &ident);
00162
00167 const Anope::string &GetIdent() const;
00168
00171 Anope::string GetMask() const;
00172
00175 Anope::string GetDisplayedMask() const;
00176
00179 void SetRealname(const Anope::string &realname);
00180
00187 void SendMessage(const BotInfo *source, const char *fmt, ...);
00188 void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override;
00189
00194 void Collide(NickAlias *na);
00195
00201 void Identify(NickAlias *na);
00202
00206 void Login(NickCore *core);
00207
00210 void Logout();
00211
00215 virtual NickCore *Account() const;
00216
00221 bool IsIdentified(bool check_nick = false) const;
00222
00227 bool IsRecognized(bool check_nick = true) const;
00228
00232 bool IsServicesOper();
00233
00238 bool HasCommand(const Anope::string &cmdstr);
00239
00244 bool HasPriv(const Anope::string &privstr);
00245
00248 void UpdateHost();
00249
00254 bool HasMode(const Anope::string &name) const;
00255
00260 void SetModeInternal(UserMode *um, const Anope::string ¶m = "");
00261
00265 void RemoveModeInternal(UserMode *um);
00266
00272 void SetMode(const BotInfo *bi, UserMode *um, const Anope::string ¶m = "");
00273
00279 void SetMode(const BotInfo *bi, const Anope::string &name, const Anope::string ¶m = "");
00280
00285 void RemoveMode(const BotInfo *bi, UserMode *um);
00286
00291 void RemoveMode(const BotInfo *bi, const Anope::string &name);
00292
00297 void SetModes(const BotInfo *bi, const char *umodes, ...);
00298
00302 void SetModesInternal(const char *umodes, ...);
00303
00307 Anope::string GetModes() const;
00308
00315 ChanUserContainer *FindChannel(const Channel *c) const;
00316
00320 bool IsProtected() const;
00321
00326 void Kill(const Anope::string &source, const Anope::string &reason);
00327
00332 void KillInternal(const Anope::string &source, const Anope::string &reason);
00333
00337 void Quit(const Anope::string &reason = "");
00338
00339 bool Quitting() const;
00340
00341
00342
00343
00344
00345
00346
00347
00348 Anope::string Mask() const;
00349
00354 bool BadPassword();
00355
00361 static User* Find(const Anope::string &name, bool nick_only = false);
00362
00365 static void QuitUsers();
00366 };
00367
00368 #endif // USERS_H