Skip to content

Commit

Permalink
make deliver_deferred a public method
Browse files Browse the repository at this point in the history
git-svn-id: https://xmpp4r-simple.googlecode.com/svn/trunk@15 1e3c5029-9921-0410-9e82-436f4d538387
  • Loading branch information
romeda committed Dec 6, 2006
1 parent 0eeb104 commit 84a3e0b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/xmpp4r-simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ def reconnect
def disconnect
disconnect!
end

# Queue messages for delivery once a user has accepted our authorization
# request. Works in conjunction with the deferred delivery thread.
#
# You can use this method if you want to manually add friends and still
# have the message queued for later delivery.
def deliver_deferred(jid, message, type)
msg = {:to => jid, :message => message, :type => type}
queue(:pending_messages) << [msg]
end

private

Expand Down Expand Up @@ -382,13 +392,6 @@ def start_deferred_delivery_thread #:nodoc:
}
end

# Queue messages for delivery once a user has accepted our authorization
# request. Works in conjunction with the deferred delivery thread.
def deliver_deferred(jid, message, type) #:nodoc:
msg = {:to => jid, :message => message, :type => type}
queue(:pending_messages) << [msg]
end

def queue(queue)
@queues ||= Hash.new { |h,k| h[k] = Queue.new }
@queues[queue]
Expand Down

0 comments on commit 84a3e0b

Please sign in to comment.