Class: IRCSupport::Message::DCC::Send

Inherits:
IRCSupport::Message::DCC show all
Defined in:
lib/ircsupport/message.rb

Instance Attribute Summary collapse

Attributes inherited from IRCSupport::Message::DCC

#dcc_args, #dcc_type, #sender

Attributes inherited from IRCSupport::Message

#args, #command, #prefix

Instance Method Summary collapse

Methods inherited from IRCSupport::Message

#type

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

#addressIPAddr

Returns The sender’s IP address.

Returns:

  • (IPAddr)

    The sender’s IP address.



223
224
225
# File 'lib/ircsupport/message.rb', line 223

def address
  @address
end

#filenamePathname

Returns The source filename.

Returns:

  • (Pathname)

    The source filename.



229
230
231
# File 'lib/ircsupport/message.rb', line 229

def filename
  @filename
end

#portFixnum

Returns The sender’s port number.

Returns:

  • (Fixnum)

    The sender’s port number.



226
227
228
# File 'lib/ircsupport/message.rb', line 226

def port
  @port
end

#sizeFixnum

Returns The size of the source file, in bytes.

Returns:

  • (Fixnum)

    The size of the source file, in bytes.



232
233
234
# File 'lib/ircsupport/message.rb', line 232

def size
  @size
end