Пример #1
0
 public boolean onPartAll(String sender, String reason) {
   int d = channels.size();
   d--;
   for (int i = 0; i <= channels.size(); i++) {
     boolean f = inChannel(channels.get(d));
     if (!f) {
       return true;
     } else {
       try {
         if (reason == null) {
           this.partChannel(
               channels.get(i),
               config.getProperty("disconnect-message") + "  (Requested by " + sender + ")");
         } else {
           this.partChannel(
               channels.get(i),
               config.getProperty("disconnect-message")
                   + " (Reason: "
                   + reason
                   + "  (Requested by "
                   + sender
                   + "))");
         }
       } catch (Exception ex) {
         return true;
       }
     }
   }
   return false;
 }
Пример #2
0
 public boolean inChannel(String channel) {
   boolean outp = false;
   for (int i = 0; i < channels.size(); i++) {
     if (channels.get(i).equalsIgnoreCase(channel)) {
       outp = true;
     }
   }
   return outp;
 }
Пример #3
0
 public void removeChannel(String channel, String sender) throws IOException {
   File file = new File("channels.txt");
   FileWriter d = new FileWriter(file);
   channels.remove(channel);
   StringBuilder f = new StringBuilder();
   for (int i = 0; i < channels.size(); i++) {
     if (!channels.get(i).equalsIgnoreCase(channel)) {
       f.append(channels.get(i).toString().toLowerCase());
       f.append("\n");
     }
   }
   d.flush();
   d.write(f.toString());
   d.close();
 }
Пример #4
0
 public boolean isMod(String sender) {
   if (mods.contains(sender)) {
     return true;
   } else {
     return false;
   }
 }
Пример #5
0
 public boolean isAdmin(String sender) {
   if (admins.contains(sender)) {
     return true;
   } else {
     return false;
   }
 }
Пример #6
0
 public void appendChannel(String channel, String sender) throws IOException {
   File file = new File("channels.txt");
   FileWriter d = new FileWriter(file);
   channels.add(channel.toLowerCase());
   StringBuilder f = new StringBuilder();
   for (int i = 0; i < channels.size(); i++) {
     f.append(channels.get(i).toString());
     f.append("\n");
   }
   System.out.println("f:" + f.toString());
   d.flush();
   d.write(f.toString());
   d.close();
   this.joinChannel(channel);
   this.sendMessage(channel, "Hello ya'll. I was invited by " + sender + ".");
 }
Пример #7
0
 public void onInvite(
     String targetNick, String sender, String sourceLogin, String sourceHostname, String channel) {
   if (!ignored.contains(channel)) {
     try {
       this.appendChannel(channel, sender);
     } catch (IOException ex) {
       this.sendError(sender, ex.toString());
     }
   } else {
     ignoredChannel(sender, channel);
   }
 }