Class: IRCSupport::Message::DCC::Send
- Inherits:
-
IRCSupport::Message::DCC
- Object
- IRCSupport::Message
- IRCSupport::Message::DCC
- IRCSupport::Message::DCC::Send
- Defined in:
- lib/ircsupport/message.rb
Instance Attribute Summary collapse
-
#address ⇒ IPAddr
The sender’s IP address.
-
#filename ⇒ Pathname
The source filename.
-
#port ⇒ Fixnum
The sender’s port number.
-
#size ⇒ Fixnum
The size of the source file, in bytes.
Attributes inherited from IRCSupport::Message::DCC
Attributes inherited from IRCSupport::Message
Instance Method Summary collapse
-
#initialize(args) ⇒ Send
constructor
A new instance of Send.
Methods inherited from IRCSupport::Message
Constructor Details
#initialize(args) ⇒ Send
Returns a new instance of Send.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/ircsupport/message.rb', line 235 def initialize(args) super(args) return if @dcc_args !~ /^(".+"|[^ ]+) +(\d+) +(\d+)(?: +(\d+))?/ @filename = $1 @address = IPAddr.new($2.to_i, Socket::AF_INET) @port = $3.to_i @size = $4.to_i if @filename =~ /^"/ @filename.gsub!(/^"|"$/, '') @filename.gsub!(/\\"/, '"'); end @filename = Pathname.new(@filename).basename end |
Instance Attribute Details
#address ⇒ IPAddr
Returns The sender’s IP address.
223 224 225 |
# File 'lib/ircsupport/message.rb', line 223 def address @address end |
#filename ⇒ Pathname
Returns The source filename.
229 230 231 |
# File 'lib/ircsupport/message.rb', line 229 def filename @filename end |
#port ⇒ Fixnum
Returns The sender’s port number.
226 227 228 |
# File 'lib/ircsupport/message.rb', line 226 def port @port end |
#size ⇒ Fixnum
Returns The size of the source file, in bytes.
232 233 234 |
# File 'lib/ircsupport/message.rb', line 232 def size @size end |