class Jabber::LastActivity::Helper

A Helper to manage discovery of Last Activity.

Public Class Methods

new(client) click to toggle source
# File lib/xmpp4r/last/helper/helper.rb, line 13
def initialize(client)
  @stream = client
end

Public Instance Methods

get_last_activity_from(jid) click to toggle source

Gets the last activity from a JID.

jid
JID
return
Jabber::LastActivity::IqQueryLastActivity
# File lib/xmpp4r/last/helper/helper.rb, line 21
def get_last_activity_from(jid)
  iq = Jabber::Iq.new(:get, jid)
  iq.from = @stream.jid
  iq.add(Jabber::LastActivity::IqQueryLastActivity.new)

  reply = @stream.send_with_id(iq)

  if reply.query && reply.query.kind_of?(IqQueryLastActivity)
    reply.query
  else
    nil
  end
end