X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fusers.h;h=6cc7f423b73734caea5213f101d5b1ac88146d87;hb=bef13bcae31bd8111f7de093148319761cbb8c94;hp=dc7da40fe2a7e2adb817fcba8894f4b185ffa3d7;hpb=2cd6efcc64458c7b5c33529eb58fe00b7bc5e4ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/users.h b/include/users.h index dc7da40fe..6cc7f423b 100644 --- a/include/users.h +++ b/include/users.h @@ -676,6 +676,12 @@ class CoreExport User : public Extensible */ virtual ~User(); CullResult cull() CXX11_OVERRIDE; + + /** @copydoc Serializable::Deserialize. */ + bool Deserialize(Data& data) CXX11_OVERRIDE; + + /** @copydoc Serializable::Deserialize. */ + bool Serialize(Serializable::Data& data) CXX11_OVERRIDE; }; class CoreExport UserIOHandler : public StreamSocket @@ -700,6 +706,11 @@ class CoreExport UserIOHandler : public StreamSocket * @param data The data to add to the write buffer */ void AddWriteBuf(const std::string &data); + + /** Swaps the internals of this UserIOHandler with another one. + * @param other A UserIOHandler to swap internals with. + */ + void SwapInternals(UserIOHandler& other); }; typedef unsigned int already_sent_t; @@ -724,6 +735,8 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_nodeGetName(); } FakeUser(const std::string& uid, const std::string& sname, const std::string& sdesc) - : User(uid, new Server(sname, sdesc), USERTYPE_SERVER) + : User(uid, new Server(uid, sname, sdesc), USERTYPE_SERVER) { nick = sname; } @@ -900,17 +920,17 @@ class CoreExport FakeUser : public User /** Is a local user */ inline LocalUser* IS_LOCAL(User* u) { - return u->usertype == USERTYPE_LOCAL ? static_cast(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_LOCAL) ? static_cast(u) : NULL; } /** Is a remote user */ inline RemoteUser* IS_REMOTE(User* u) { - return u->usertype == USERTYPE_REMOTE ? static_cast(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_REMOTE) ? static_cast(u) : NULL; } /** Is a server fakeuser */ inline FakeUser* IS_SERVER(User* u) { - return u->usertype == USERTYPE_SERVER ? static_cast(u) : NULL; + return (u != NULL && u->usertype == USERTYPE_SERVER) ? static_cast(u) : NULL; } inline bool User::IsModeSet(const ModeHandler* mh) const