Class: Jabber::LastActivity::IqQueryLastActivity

Inherits:
IqQuery show all
Defined in:
lib/xmpp4r/last/iq/last.rb

Overview

Class for handling Last Activity queries (XEP-0012)

Instance Method Summary collapse

Methods inherited from XMPPElement

class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, #initialize, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=

Methods inherited from REXML::Element

#==, #delete_elements, #each_elements, #first_element, #first_element_content, #first_element_text, #import, import, #replace_element_content, #replace_element_text, #typed_add

Constructor Details

This class inherits a constructor from Jabber::XMPPElement

Instance Method Details

#secondsObject

Get the number of seconds since last activity.

With a bare jid, this will return the number of seconds since the client was last seen (offline user query).

With a full jid, this will return the number of seconds that the client has been idle (online user query).

With a server, this will return the server or component’s uptime in seconds (server / component query).



28
29
30
# File 'lib/xmpp4r/last/iq/last.rb', line 28

def seconds
  attributes['seconds'] ? attributes['seconds'].to_i : nil
end

#seconds=(val) ⇒ Object

Set the number of seconds since last activity



34
35
36
# File 'lib/xmpp4r/last/iq/last.rb', line 34

def seconds=(val)
  attributes['seconds'] = val.to_s
end

#set_second(val) ⇒ Object

Set the number of seconds since last activity (chaining-friendly)



41
42
43
44
# File 'lib/xmpp4r/last/iq/last.rb', line 41

def set_second(val)
  self.seconds = val
  self
end

#set_status(val) ⇒ Object

For an offline user query, set the last status. (chaining-friendly)



61
62
63
64
# File 'lib/xmpp4r/last/iq/last.rb', line 61

def set_status(val)
  self.status = val
  self
end

#statusObject

For an offline user query, get the last status.



48
49
50
# File 'lib/xmpp4r/last/iq/last.rb', line 48

def status
  self.text
end

#status=(val) ⇒ Object

For an offline user query, set the last status.



54
55
56
# File 'lib/xmpp4r/last/iq/last.rb', line 54

def status=(val)
  self.text = val
end