Class: Jabber::Version::SimpleResponder

Inherits:
Responder
  • Object
show all
Defined in:
lib/xmpp4r/version/helper/simpleresponder.rb

Overview

A class to answer version requests using IqQueryVersion

This is simplification as one doesn't need dynamic version answering normally.

Example usage:

Jabber::Version::SimpleResponder.new(my_client, "My cool XMPP4R script", "1.0", "Younicks")

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Responder

#add_version_callback, #iq_callback

Constructor Details

#initialize(stream, name, version, os = nil) ⇒ SimpleResponder

Initialize a new version responder

Registers it's callback (prio = 180, ref = self)

stream
Stream

Where to register callback handlers

name
String

Software name for answers

version
String

Software versio for answers

os
String

Optional operating system name for answers


31
32
33
34
35
36
37
38
39
40
41
# File 'lib/xmpp4r/version/helper/simpleresponder.rb', line 31

def initialize(stream, name, version, os=nil)
  super stream

  @name = name
  @version = version
  @os = os

  add_version_callback(180, self) { |iq,block|
    block.call(@name, @version, @os)
  }
end

Instance Attribute Details

#nameObject

Returns the value of attribute name


19
20
21
# File 'lib/xmpp4r/version/helper/simpleresponder.rb', line 19

def name
  @name
end

#osObject

Returns the value of attribute os


21
22
23
# File 'lib/xmpp4r/version/helper/simpleresponder.rb', line 21

def os
  @os
end

#versionObject

Returns the value of attribute version


20
21
22
# File 'lib/xmpp4r/version/helper/simpleresponder.rb', line 20

def version
  @version
end