lib/xmpp4r-simple.rb in xmpp4r-simple-0.8.0 vs lib/xmpp4r-simple.rb in xmpp4r-simple-0.8.1

- old
+ new

@@ -296,10 +296,20 @@ # Use this to force the client to disconnect and not automatically # 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 def client=(client) self.roster = nil # ensure we clear the roster, since that's now associated with a different client. @@ -378,16 +388,9 @@ queue(:pending_messages) << message end end } } - 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]