Skip to content

Commit

Permalink
Add methods to check the status of the message/presence/subscription …
Browse files Browse the repository at this point in the history
…queues.

git-svn-id: https://xmpp4r-simple.googlecode.com/svn/trunk@17 1e3c5029-9921-0410-9e82-436f4d538387
  • Loading branch information
romeda committed Dec 6, 2006
1 parent 7c5fa9a commit 52ee6e1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/xmpp4r-simple.rb
Expand Up @@ -212,6 +212,12 @@ def received_messages(&block)
dequeue(:received_messages, &block)
end

# Returns true if there are unprocessed received messages waiting in the
# queue, false otherwise.
def received_messages?
!queue(:received_messages).empty?
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
Expand All @@ -226,6 +232,12 @@ def received_messages(&block)
def presence_updates(&block)
dequeue(:presence_updates, &block)
end

# Returns true if there are unprocessed presence updates waiting in the
# queue, false otherwise.
def presence_updates?
!queue(:presence_updates).empty?
end

# Returns an array of subscription notifications received since the last
# time new_subscriptions was called. Passing a block will yield each update
Expand All @@ -242,6 +254,12 @@ def new_subscriptions(&block)
dequeue(:new_subscriptions, &block)
end

# Returns true if there are unprocessed presence updates waiting in the
# queue, false otherwise.
def new_subscriptions?
!queue(:new_subscriptions).empty?
end

# Returns an array of subscription notifications received since the last
# time subscription_requests was called. Passing a block will yield each update
# in turn, allowing you to break part-way through processing (especially
Expand All @@ -256,7 +274,6 @@ def new_subscriptions(&block)
def subscription_requests(&block)
dequeue(:subscription_requests, &block)
end


# Returns true if auto-accept subscriptions (friend requests) is enabled
# (default), false otherwise.
Expand Down

0 comments on commit 52ee6e1

Please sign in to comment.