def presence_updates(&block)
      updates = []
      @presence_mutex.synchronize do
        dequeue(:presence_updates) do |friend|
          presence = @presence_updates[friend]
          next unless presence
          new_update = [friend, presence[0], presence[1]]
          yield new_update if block_given?
          updates << new_update
          @presence_updates.delete(friend)
        end
      end
      return updates
    end
def presence_updates(&block)
      updates = []
      @presence_mutex.synchronize do
        dequeue(:presence_updates) do |friend|
          presence = @presence_updates[friend]
          next unless presence
          new_update = [friend, presence[0], presence[1]]
          yield new_update if block_given?
          updates << new_update
          @presence_updates.delete(friend)
        end
      end
      return updates
    end
Returns an array of presence updates received since the last time
 presence_updates was called. Passing a block will yield each update in
 turn, allowing you to break part-way through processing (especially
 useful when your presence handling code is not thread-safe (e.g.,
 ActiveRecord).

 e.g.:

   jabber.presence_updates do |friend, new_presence|
     puts "Received presence update from #{friend}: #{new_presence}"
   end