From 495c44445642cfae8f23fadde299ad5307f5be58 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 9 Jun 2011 18:09:52 +0100 Subject: Big commit --HG-- rename : views/please_authenticate.haml => views/login.haml --- lib/mauve/notifier.rb | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'lib/mauve/notifier.rb') diff --git a/lib/mauve/notifier.rb b/lib/mauve/notifier.rb index e0692f6..0127b6b 100644 --- a/lib/mauve/notifier.rb +++ b/lib/mauve/notifier.rb @@ -40,11 +40,38 @@ module Mauve def start super - Configuration.current.notification_methods['xmpp'].connect if Configuration.current.notification_methods['xmpp'] + if Configuration.current.notification_methods['xmpp'] + # + # Connect to XMPP server + # + xmpp = Configuration.current.notification_methods['xmpp'] + xmpp.connect + + Configuration.current.people.each do |username, person| + # + # Ignore people without XMPP stanzas. + # + next unless person.xmpp + + # + # For each JID, either ensure they're on our roster, or that we're in + # that chat room. + # + jid = if xmpp.is_muc?(person.xmpp) + xmpp.join_muc(person.xmpp) + else + xmpp.ensure_roster_and_subscription!(person.xmpp) + end + + Configuration.current.people[username].xmpp = jid unless jid.nil? + end + end end def stop - Configuration.current.notification_methods['xmpp'].close + if Configuration.current.notification_methods['xmpp'] + Configuration.current.notification_methods['xmpp'].close + end super end -- cgit v1.2.1