From 195ffe943614ac084839b590294ad740e4bb15d3 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 20 Oct 2011 15:29:06 +0100 Subject: More XMPP robustification. --- lib/mauve/notifier.rb | 18 +++++++++--------- lib/mauve/notifiers/xmpp.rb | 7 +------ 2 files changed, 10 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/mauve/notifier.rb b/lib/mauve/notifier.rb index 14e188c..bf36162 100644 --- a/lib/mauve/notifier.rb +++ b/lib/mauve/notifier.rb @@ -42,24 +42,23 @@ module Mauve # # Make sure we're connected to the XMPP server if needed on every iteration. # - if Configuration.current.notification_methods['xmpp'] and !Configuration.current.notification_methods['xmpp'].ready? + xmpp = Configuration.current.notification_methods['xmpp'] + + if xmpp and !xmpp.ready? # # Connect to XMPP server # - xmpp = Configuration.current.notification_methods['xmpp'] - xmpp.connect + xmpp.connect + # + # Join all chats and shit. Unless the connection failed. + # Configuration.current.people.each do |username, person| # # Ignore people without XMPP stanzas. # next unless person.xmpp - # - # Can't do this unless we're ready. - # - next unless xmpp.ready? - # # For each JID, either ensure they're on our roster, or that we're in # that chat room. @@ -71,7 +70,8 @@ module Mauve end Configuration.current.people[username].xmpp = jid unless jid.nil? - end + + end if xmpp.ready? end diff --git a/lib/mauve/notifiers/xmpp.rb b/lib/mauve/notifiers/xmpp.rb index 16c47bb..8254494 100644 --- a/lib/mauve/notifiers/xmpp.rb +++ b/lib/mauve/notifiers/xmpp.rb @@ -150,12 +150,7 @@ module Mauve unless ex.nil? or @closing logger.warn(["Caught",ex.class,ex.to_s,"during XMPP",where].join(" ")) logger.debug ex.backtrace.join("\n") - @closing = true - connect - @mucs.each do |jid, muc| - @mucs.delete(jid) - join_muc(muc[:jid], muc[:password]) - end + self.close end end rescue StandardError => ex -- cgit v1.2.1