Permalink
Browse files

Merge pull request #2 from ssoroka/master

bug fix and feature
  • Loading branch information...
2 parents a59406f + e08f627 commit 50dafd6f9cd3b785dec54677afa98e1d8fa60325 @flyerhzm committed Jul 9, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/uniform_notifier/xmpp.rb
@@ -18,12 +18,14 @@ def self.setup_connection( xmpp_information )
require 'xmpp4r'
+ @xmpp = xmpp_information
@receiver = xmpp_information[:receiver]
@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 +41,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 50dafd6

Please sign in to comment.