Class ::Bot::Auth::ManagerClass
In: lib/rbot/core/remote.rb
Parent: Object
User HTTPResponse BasicUserMessage Bot\n[lib/rbot/core/remote.rb\nlib/rbot/core/utils/extends.rb\nlib/rbot/core/utils/filters.rb\nlib/rbot/core/utils/wordlist.rb] HttpUtil lib/rbot/core/userdata.rb lib/rbot/core/utils/httputil.rb lib/rbot/core/utils/extends.rb lib/rbot/core/remote.rb lib/rbot/core/utils/httputil.rb ParseTime Utils (null) dot/m_15_0.png

We extend the ManagerClass to handle remote logins

Methods

Constants

MAX_SESSION_ID = 2**128 - 1

Public Instance methods

Creates a session id when the given password matches the given botusername

[Source]

    # File lib/rbot/core/remote.rb, line 46
46:       def remote_login(botusername, pwd)
47:         @remote_users = Hash.new unless defined? @remote_users
48:         n = BotUser.sanitize_username(botusername)
49:         k = n.to_sym
50:         raise "No such BotUser #{n}" unless include?(k)
51:         bu = @allbotusers[k]
52:         if bu.remote_login(pwd)
53:           raise "ran out of session ids!" if @remote_users.length == MAX_SESSION_ID
54:           session_id = rand(MAX_SESSION_ID)
55:           while @remote_users.has_key?(session_id)
56:             session_id = rand(MAX_SESSION_ID)
57:           end
58:           @remote_users[session_id] = bu
59:           return session_id
60:         end
61:         return false
62:       end

Returns the botuser associated with the given session id

[Source]

    # File lib/rbot/core/remote.rb, line 65
65:       def remote_user(session_id)
66:         return everyone unless session_id
67:         return nil unless defined? @remote_users
68:         if @remote_users.has_key?(session_id)
69:           return @remote_users[session_id]
70:         else
71:           return nil
72:         end
73:       end

[Validate]