X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=include%2Fusers.h;h=14f98f70163e50451cd7c9fc12b2dbf9ca77ce0c;hb=1662f21eedf91c49ac97333f72f494c36895803e;hp=e681ef32629f3fd189abb81f46469cec04e26666;hpb=6278262baaed06e2acf134c53ed0485136d61f50;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/users.h b/include/users.h index e681ef326..14f98f701 100644 --- a/include/users.h +++ b/include/users.h @@ -339,6 +339,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 +457,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 +468,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 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 ip; + 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 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 +763,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 +860,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 +944,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);