Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support :stay_connected => false option to connect as-needed and then…

… disconnect immediately.
  • Loading branch information...
commit ae57f1a2dfa44fb2910143f2a09a4c987afcb9d5 1 parent a59406f
@ssoroka ssoroka authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/uniform_notifier/xmpp.rb
View
4 lib/uniform_notifier/xmpp.rb
@@ -22,8 +22,9 @@ def self.setup_connection( xmpp_information )
@password = xmpp_information[:password]
@account = xmpp_information[:account]
@show_online_status = xmpp_information[:show_online_status]
+ @stay_connected = xmpp_information[:stay_connected].nil? ? true : xmpp_information[:stay_connected]
- connect
+ connect if @stay_connected
rescue LoadError
@xmpp = nil
raise NotificationError.new( 'You must install the xmpp4r gem to use XMPP notification: `gem install xmpp4r`' )
@@ -39,6 +40,7 @@ def self.connect
end
def self.notify( message )
+ connect unless @stay_connected
message = Jabber::Message.new( @receiver, message ).
set_type( :normal ).
set_subject( 'Uniform Notifier' )

0 comments on commit ae57f1a

Please sign in to comment.
Something went wrong with that request. Please try again.