Example #1
0
 /**
  * Ajout d'un salon
  *
  * @param name
  */
 public void addChannel(String name) {
   Integer value = channels.get(name);
   if (value == null) value = 0;
   ++value;
   channels.put(name, value);
   if (value == 1 && connection.isConnected()) connection.doJoin("#" + name);
 }
Example #2
0
 /**
  * Envoi d'un message
  *
  * @param channel
  * @param target
  * @param message
  */
 public void send(String channel, String target, String message) {
   if (!connection.isConnected()) {
     log.log(Level.SEVERE, "IRC connection not connected");
     return;
   }
   connection.doPrivmsg("#" + channel, target + " " + message);
 }
Example #3
0
 /** Constructeur par défaut */
 public NetWatcher() {
   id = buildId();
   String server = Configuration.getInstance().getProperty("ircserver");
   connection = new IRCNetConnection(server, 6667, id, id);
   connection.addIRCEventListener(this);
   connection.setPong(true);
   connection.start();
 }
Example #4
0
 /**
  * Suppression d'un salon
  *
  * @param name
  */
 public void removeChannel(String name) {
   Integer value = channels.get(name);
   if (value == null) return;
   --value;
   channels.put(name, value);
   if (value == 0) {
     channels.remove(name);
     if (connection.isConnected()) connection.doPart("#" + name);
   }
 }
Example #5
0
 /** Fermeture du watcher */
 public void close() {
   connection.doQuit();
   connection.stop();
 }
Example #6
0
 @Override
 public void onRegistered() {
   for (String channel : channels.keySet()) {
     connection.doJoin("#" + channel);
   }
 }