[vlma-devel] commit: Add an init method to notifiers (useful if a connection is required ). (Adrien Grand )

git version control git at videolan.org
Tue Jul 8 01:04:55 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Mon Jul  7 16:41:57 2008 +0200| [36f40b71b0910c19e4c3abc24f5560ff8084ea20]

Add an init method to notifiers (useful if a connection is required).

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=36f40b71b0910c19e4c3abc24f5560ff8084ea20
---

 .../org/videolan/vlma/notifier/IRCNotifier.java    |   11 +++++++++++
 .../org/videolan/vlma/notifier/MSNNotifier.java    |    7 +++++++
 .../java/org/videolan/vlma/notifier/Notifier.java  |    5 +++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/notifier/IRCNotifier.java b/vlma-core/src/main/java/org/videolan/vlma/notifier/IRCNotifier.java
index e277170..b8ab9a5 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/notifier/IRCNotifier.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/notifier/IRCNotifier.java
@@ -77,6 +77,17 @@ public class IRCNotifier extends Notifier {
         }
     }
 
+    @Override
+    public void init() {
+        if(isIRCEnabled()) {
+            try {
+                connect();
+            } catch (IOException e) {
+                logger.error("Error while connecting", e);
+            }
+        }
+    }
+
     /**
      * Reconnect to the IRC server if the connection has been broken.
      *
diff --git a/vlma-core/src/main/java/org/videolan/vlma/notifier/MSNNotifier.java b/vlma-core/src/main/java/org/videolan/vlma/notifier/MSNNotifier.java
index 317aab5..71b7695 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/notifier/MSNNotifier.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/notifier/MSNNotifier.java
@@ -59,6 +59,13 @@ public class MSNNotifier extends Notifier {
         msnm.login();
     }
 
+    @Override
+    public void init() {
+        if(isMSNEnabled()) {
+            connect();
+        }
+    }
+
     /**
      * Does the user want to be notified by MSN?
      *
diff --git a/vlma-core/src/main/java/org/videolan/vlma/notifier/Notifier.java b/vlma-core/src/main/java/org/videolan/vlma/notifier/Notifier.java
index 244cc56..3d7b95b 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/notifier/Notifier.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/notifier/Notifier.java
@@ -28,6 +28,11 @@ package org.videolan.vlma.notifier;
 public abstract class Notifier {
 
     /**
+     * Initializes the notifier.
+     */
+    public void init() { }
+
+    /**
      * Sends a notification.
      *
      * @param message the message to send



More information about the vlma-devel mailing list