Class: IRC::Server::Client
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#connectedOn ⇒ Object
readonly
Returns the value of attribute connectedOn.
-
#host ⇒ Object
Returns the value of attribute host.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#listen ⇒ Object
readonly
Returns the value of attribute listen.
-
#mask ⇒ Object
readonly
Returns the value of attribute mask.
-
#modes ⇒ Object
readonly
Returns the value of attribute modes.
-
#nick ⇒ Object
Returns the value of attribute nick.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#realName ⇒ Object
Returns the value of attribute realName.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(server, socket, listen = nil) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #numeric(response, value = nil) ⇒ Object
- #raw(text) ⇒ Object
- #send(symbol, *args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(server, socket, listen = nil) ⇒ Client
Returns a new instance of Client.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/failirc/server/client.rb', line 34 def initialize (server, socket, listen=nil) @server = server @socket = socket @listen = listen @registered = false @channels = Channels.new(@server) @modes = Modes.new if socket.is_a?(Mask) @mask = socket else @mask = Mask.new self.host = socket.peeraddr[2] @ip = socket.peeraddr[3] @port = socket.addr[1] if socket.is_a?(OpenSSL::SSL::SSLSocket) @modes[:ssl] = true end end @connectedOn = Time.now end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def channels @channels end |
#connectedOn ⇒ Object (readonly)
Returns the value of attribute connectedOn.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def connectedOn @connectedOn end |
#host ⇒ Object
Returns the value of attribute host.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def host @host end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def ip @ip end |
#listen ⇒ Object (readonly)
Returns the value of attribute listen.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def listen @listen end |
#mask ⇒ Object (readonly)
Returns the value of attribute mask.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def mask @mask end |
#modes ⇒ Object (readonly)
Returns the value of attribute modes.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def modes @modes end |
#nick ⇒ Object
Returns the value of attribute nick.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def nick @nick end |
#password ⇒ Object
Returns the value of attribute password.
32 33 34 |
# File 'lib/failirc/server/client.rb', line 32 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def port @port end |
#realName ⇒ Object
Returns the value of attribute realName.
32 33 34 |
# File 'lib/failirc/server/client.rb', line 32 def realName @realName end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def server @server end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def socket @socket end |
#user ⇒ Object
Returns the value of attribute user.
31 32 33 |
# File 'lib/failirc/server/client.rb', line 31 def user @user end |
Instance Method Details
#inspect ⇒ Object
93 94 95 |
# File 'lib/failirc/server/client.rb', line 93 def inspect return "#<Client: #{mask} #{modes}#{(modes[:registered]) ? ' registered' : ''}>" end |
#numeric(response, value = nil) ⇒ Object
85 86 87 |
# File 'lib/failirc/server/client.rb', line 85 def numeric (response, value=nil) raw ":#{server.host} #{'%03d' % response[:code]} #{nick || 'faggot'} #{eval(response[:text])}" end |
#raw(text) ⇒ Object
80 81 82 83 |
# File 'lib/failirc/server/client.rb', line 80 def raw (text) @server.dispatcher.dispatch :output, self, text @server.dispatcher.connection.output.push @socket, text end |
#send(symbol, *args) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/failirc/server/client.rb', line 72 def send (symbol, *args) begin self.method(symbol).call(*args) rescue Exception => e self.debug e end end |
#to_s ⇒ Object
89 90 91 |
# File 'lib/failirc/server/client.rb', line 89 def to_s mask.to_s end |