📄 auth.txt
字号:
void Auth_VerifyAndSendMSG(Auth_TUHCB*); friend of Auth_TUser Used as a Auth_TUHCB callback function by Auth_TUser::SendMessage in the event that we aren't tracking that user, but the user has the security setting turned off. This determines if the userhost info matches what we remember for this user, and if so delivers the message.void Auth_Init(); Perform initialization for the Authentication system. At present this calls the data subsystem to load the userlist, and initializes the command subsystem.void Auth_Connect(); Handles events the Authentication system needs to do on connecting to IRC. At present, this is a no-op.void Auth_Disconnect(const char *); Handles cleanup from our being disconnected from IRC. At present, it flushes the tracking information from the userlist, and destroys all tracking tickets and unused USERHOST callbacks.TF Auth_Add(void **tref, const char *acct, const char *pass); Called from cmd/authcmd.cc (AUTH LOGIN). tref is a pointer to an Auth_PTicket. This function calls Auth_TUser::Login to log a user into the system, and if successful deletes the unneeded tracking ticket and returns TRUE with tref now pointing to the appropriate Auth_PUser.void Auth_Track(const char *nick, const char *channel, TF flag); In the case where flag is TRUE: If nick is our own, do nothing. Otherwise, first see if we have a user we are tracking by this nick. If we are tracking them in channel, do nothing. If we are tracking them elsewhere, call Auth_TUser::AddTracking to add channel to the list. Next, check to see if we have a tracking ticket for this nick. If so, and we are tracking them in channel, do nothing. If we are tracking them elsewhere, call Auth_TTicket::AddTracking to add channel to the list. Finally, perform a USERHOST lookup to get the necessary data to start a new tracking ticket. In the case where flag is FALSE: First, see if a user is being tracked under nick. If so, then if channel==NULL we call Auth_TUser::FlushTracking, otherwise we use Auth_TUser::RemTracking to remove channel. Next, see if a tracking ticket exists for that nick. If so, then if channel==NULL we call Auth_TTicket::FlushTracking, otherwise Auth_TTicket::RemTracking.void Auth_TrackCR(Auth_PUHCB); This is used as a callback from Auth_Track's USERHOST request. If a user without security set is matched by the userhost info, we start tracking that user; otherwise, we create a new tracking ticket with the info we've collected.void Auth_TrackPr(const char *prefix, const char *channel); This works similarly to Auth_Track with flag==TRUE, but takes a prefix instead of a nick. This should be called when the message we're responding to has a valid prefix associated with it. The main difference is the lack of a USERHOST request to obtain userhost info from the nick, since the prefix includes this information.void Auth_RemTrack(const char *channel); This function is called if we leave a channel. It systematically removes channel from the tracking lists of all users and tickets.void Auth_FlushTrack(); This function is to be used when we are disconnected from the server. At the moment this is fairly meaningless, but will be necessary for AUTO_RECONNECT implementation.void Auth_Rem(void *ticket, uint8 auth); Called by the AUTH LOGOUT command. Creates a new Auth_TTicket, transfers the channel list from the user, and then logs out the user. void *ticket is an Auth_PUser in this case.void Auth_Userhost(const char *nick, const char *user, const char *host); Performs a call to static function Auth_TUHCB::UHCR(). Used to process USERHOST responses from the server.void Auth_Nick(const char *prefix, const char *nick); Called when we see a user change their nick. Used to update tracking.void Auth_Cleanup(); Perform cleanup of the Authentication system. At present, simply calls Auth_TUser::FlushList(). It is assumed that this function is called only after Auth_Disconnect, and only in the event that the bot is about to shut down.void Auth_DCCRequest(const char *nick, void *cookie); Called when someone tries to establish a DCC CHAT with us. If we can find a valid matching user, we accept, otherwise, we reject. If necessary this version uses USERHOST to verify the user.void Auth_DCCRequestCR(Auth_PUHCB); Callback for USERHOST request made by Auth_DCCRequestvoid Auth_DCCRequestPfx(const char *prefix, void *cookie); Same as Auth_DCCRequest, except that no USERHOST request is used.void Auth_DCCEstablished(void *cookie); Called when a user accepts a DCC CHAT we were instructed to offer.void Auth_DCCLost(void *cookie); Called when a DCC CHAT connection is lost or remotely closed.void Auth_CmdResult(void *, uint8, const char *); The command subsystem uses this function to provide results back to the user who invoked the command.void Auth_DCCMessage(void *cookie, const char *message); This is called when we receive a message over a DCC CHAT connection.void Auth_IRCMessage(const char *prefix, const char *message); This is called when we receive a private message over IRC. Both Auth_IRCMessage and Auth_DCCMessage are responsible for delivering user commands to the command subsystem.void Auth_NotifyMaster(const char *message); This is called to send a message to the bot master. Message can only be delivered if the bot master is properly logged in.class Auth_TUser:Auth_TUser(const char *s_acct, const char *s_pass, TF s_master); Constructor for Auth_TUser. s_acct is the name of the user, s_pass is the user's password, s_master is true if this is the master account. This should only be invoked in loaddata.cc when the userlist is retrieved, or if the master account requests a new account to be added (must be written to disk as well in this case). Note: Only one account may have s_master as true. If s_master is passed as true for more than one call to this function, an error will be generated and the program will exit. Also, no two users may have the same name. If s_acct is the same for more than one call to this function, an error will be generated and the program will exit.static void Delete(Auth_PUser user); Cleans up and deletes a user from the list. This will maintain the integrity of the list, so it can be called in an arbitrary order; however, it is generally only used when preparing to end the program.static void FlushList(); Calls Auth_TUser::Delete on each user in the list. Used for program cleanup.const char * GetAcct(); returns the name of the user.static inline Auth_PUser GetFirst(); returns the first user in the list.static inline Auth_PUser GetLast(); returns the last user in the list.static inline uint16 GetLength(); returns the length of the list.static Auth_PUser GetMaster(); returns the master account.inline Auth_PUser GetNext(); returns the next user in the list.const char * GetNick(); returns the user's current nick.inline Auth_PUser GetPrev(); returns the previous user in the list.static Auth_PUser GetUser(const char *s_acct); If s_acct is NULL, this is the same as Auth_TUser::GetFirst. Otherwise this searches for a user entry with an account name matching s_acct. returns the appropriate Auth_PUser or NULL if none is found. I must have forgotten about the other GetUser when I put this in, but since this has an argument, function overloading saves us from a problem. I might rename this in the future, but probably not...const char * GetUser(); returns the user's IRC userid string.const char * GetHost(); returns the user's hostname.IRC_PCL GetChans(); returns the list of channels we currently see this user in.TF Login(const char *s_pass, const char *s_nick, const char *s_user, const char *s_host, IRC_PCL s_chans); Called by Auth_Add. s_pass is the password provided by the user; s_nick, s_user, and s_host are the nick, user, and host fields from the tracking ticket. s_chans is the channel list from the tracking ticket, or NULL if the ticket is for a user we don't see in a channel. If s_pass does not match the password passed by the constructor, login fails (return FALSE). Login also fails if the user has the security flag set and s_chans is NULL. Otherwise, we update the user with the information passed to the function and return TRUE.void Logout(); Called from cmd/authcmd.cc (AUTH LOGOUT). This clears the nick, user, and host entries for this user, and discards the channel list. If there is a DCC CHAT open it is closed. NOTE that we do NOT clean up the chans list; this will generally have been placed in a tracking ticket before Auth_TUser::Logout() is called.static Auth_TUser * MatchNick(const char *, TF flag = FALSE); Finds the user tracked under the given nick. If flag is TRUE, will also match users who were last seen under the nick who are no longer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -