# File jabber4r/session.rb, line 385 def register_presence_filter @connection.add_filter("presenceAvailableFilter") do |element| if element.element_tag=="presence" type = element.attr_type type = nil if type.nil? case type when nil, "available" element.consume_element from = JID.new(element.attr_from) rItem = @roster[from] show = element.show.element_data show = "chat" unless show status = element.status.element_data status = "" unless status if rItem resource = rItem[from.resource] if resource resource.update(show, status) else rItem.add(from.resource, show, status) end end when "unavailable" element.consume_element from = JID.new(element.attr_from) rItem = @roster[from] resource = rItem.delete(from.resource) if rItem when "subscribe", "unsubscribe", "subscribed", "unsubscribed" element.consume_element from = JID.new(element.attr_from) break unless @subscriptionHandler if @subscriptionHandler.kind_of? Proc @subscriptionHandler.call(Subscription.new(self, type.intern, from, id)) else @subscriptionHandler.send(Subscription.new(self, type.intern, from, id)) end end end #if presence end #do end