X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fusers.h;h=505c43b9e621fcc570707989af43e97095cfb2ab;hb=01c23b31f7d0ea87052cd22814af826ecb11f0f3;hp=0964de9b91800c62f97e94d8fd0d2a91c446e6d3;hpb=5f4095e595fe36c6f83df96b7c59cb459b966ed3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/users.h b/include/users.h index 0964de9b9..505c43b9e 100644 --- a/include/users.h +++ b/include/users.h @@ -18,19 +18,6 @@ #include "dns.h" #include "mode.h" -/** Channel status for a user - */ -enum ChanStatus { - /** Op */ - STATUS_OP = 4, - /** Halfop */ - STATUS_HOP = 2, - /** Voice */ - STATUS_VOICE = 1, - /** None */ - STATUS_NORMAL = 0 -}; - /** connect class types */ enum ClassTypes { @@ -208,7 +195,7 @@ typedef std::vector ClassVector; /** Typedef for the list of user-channel records for a user */ -typedef std::map UserChanList; +typedef std::set UserChanList; /** Shorthand for an iterator into a UserChanList */ @@ -218,27 +205,6 @@ typedef UserChanList::iterator UCListIter; */ class User; -/** Visibility data for a user. - * If a user has a non-null instance of this class in their User, - * then it is used to determine if this user is visible to other users - * or not. - */ -class CoreExport VisData -{ - public: - /** Create a visdata - */ - VisData(); - /** Destroy a visdata - */ - virtual ~VisData(); - /** Is this user visible to some other user? - * @param user The other user to compare to - * @return true True if the user is visible to the other user, false if not - */ - virtual bool VisibleTo(User* user); -}; - /** Holds all information about a user * This class stores all information about a user connected to the irc server. Everything about a * connection is stored here primarily, from the user's socket ID (file descriptor) through to the @@ -289,21 +255,14 @@ class CoreExport User : public EventHandler std::bitset<64> AllowedChanModes; public: - /** Pointer to creator. - * This is required to make use of core functions - * from within the User class. - */ - InspIRCd* ServerInstance; + static LocalIntExt NICKForced; + static LocalStringExt OperQuit; /** Contains a pointer to the connect class a user is on from - this will be NULL for remote connections. * The pointer is guarenteed to *always* be valid. :) */ ConnectClass *MyClass; - /** User visibility state, see definition of VisData. - */ - VisData* Visibility; - /** Hostname of connection. * This should be valid as per RFC1035. */ @@ -339,6 +298,10 @@ class CoreExport User : public EventHandler */ time_t lastping; + /** Time that the object was instantiated (used for TS calculation etc) + */ + time_t age; + /** Time the connection was created, set in the constructor. This * may be different from the time the user's classbase object was * created. @@ -453,14 +416,6 @@ class CoreExport User : public EventHandler */ std::string sendq; - /** Message user will quit with. Not to be set externally. - */ - std::string quitmsg; - - /** Quit message shown to opers - not to be set externally. - */ - std::string operquitmsg; - /** Whether or not to send an snotice about this user's quitting */ bool quietquit; @@ -472,23 +427,32 @@ class CoreExport User : public EventHandler */ bool quitting; - /** IPV4 or IPV6 ip address, binary format. Use SetSockAddr to set this and - * GetIPString/GetPort to obtain its value in a readable manner + /** Server address and port that this user is connected to. + * If unknown, address family is AF_UNKNOWN */ - irc::sockets::sockaddrs ip; + irc::sockets::sockaddrs server_sa; + /** Client address that the user is connected from. + * Port number is only valid if local. + * + * Do not modify this value directly, use SetClientIP() to change it + */ + irc::sockets::sockaddrs client_sa; - /** Initialize the clients sockaddr - * @param ip A human-readable IP address for this user - * @param port The port number of this user (zero if unknown) + /** Sets the client IP for this user + * @return true if the conversion was successful */ - void SetSockAddr(const char* ip, int port); + bool SetClientIP(const char* sip); - /** Get port number from sockaddr + /** * @return The port number of this user. */ - int GetPort(); + int GetServerPort(); + /** + * @return The server IP address + */ + std::string GetServerIP(); - /** Get IP string from sockaddr, using static internal buffer + /** Get client IP string from sockaddr, using static internal buffer * @return The IP string */ const char* GetIPString(); @@ -758,7 +722,7 @@ class CoreExport User : public EventHandler /** Write text to this user, appending CR/LF. * @param text A std::string to send to the user */ - void Write(std::string text); + void Write(const std::string &text); /** Write text to this user, appending CR/LF. * @param text The format string for text to send to the user @@ -855,6 +819,14 @@ class CoreExport User : public EventHandler */ bool SharesChannelWith(User *other); + /** Send fake quit/join messages for host or ident cycle. + * Run this after the item in question has changed. + * You should not need to use this function, call ChangeDisplayedHost instead + * + * @param The entire QUIT line, including the source using the old value + */ + void DoHostCycle(const std::string &quitline); + /** Change the displayed host of a user. * ALWAYS use this function, rather than writing User::dhost directly, * as this triggers module events allowing the change to be syncronized to @@ -931,16 +903,6 @@ class CoreExport User : public EventHandler */ void ShowRULES(); - /** Set oper-specific quit message shown to opers only when the user quits - * (overrides any sent by QuitUser) - */ - void SetOperQuit(const std::string &oquit); - - /** Get oper-specific quit message shown only to opers when the user quits. - * (overrides any sent by QuitUser) - */ - const std::string& GetOperQuit(); - /** Increases a user's command penalty by a set amount. */ void IncreasePenalty(int increase); @@ -999,7 +961,4 @@ class CoreExport UserResolver : public Resolver void OnError(ResolverError e, const std::string &errormessage); }; -/* Configuration callbacks */ -//class ServerConfig; - #endif