X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fusers.h;h=ca9c3f55703169fc016632a82183cf9a8748b53d;hb=327bacd3687f307a5f8586856a94b16c9e4370bf;hp=d130aec1d0b6962f3c2010968a3cff0eb3db1c35;hpb=21f0718c4ae18f565895b5cc05c4af3942d0f8e5;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/users.h b/include/users.h index d130aec1d..ca9c3f557 100644 --- a/include/users.h +++ b/include/users.h @@ -1,12 +1,21 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2007-2008 Robin Burchell + * Copyright (C) 2019 linuxdaemon + * Copyright (C) 2019 Matt Schatz + * Copyright (C) 2013 Daniel Vassdal + * Copyright (C) 2012-2016, 2018 Attila Molnar + * Copyright (C) 2012-2013, 2016-2019 Sadie Powell + * Copyright (C) 2012, 2018-2019 Robby + * Copyright (C) 2012 DjSlash + * Copyright (C) 2012 ChrisTX + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2008 Thomas Stagner - * Copyright (C) 2003-2007 Craig Edwards - * Copyright (C) 2007 Burlex - * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2008 John Brooks + * Copyright (C) 2007-2009 Robin Burchell + * Copyright (C) 2007, 2009 Dennis Friis + * Copyright (C) 2006-2008 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -456,7 +465,7 @@ class CoreExport User : public Extensible * @param command A command (should be all CAPS) * @return True if this user can execute the command */ - virtual bool HasPermission(const std::string &command); + virtual bool HasCommandPermission(const std::string& command); /** 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 @@ -676,6 +685,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 +715,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 +744,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 +929,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