예제 #1
0
  public void onMessage(
      String channel, String sender, String login, String hostname, String message) {
    if (message.matches("^(\\w+):.+") && !message.matches("(\\w+)://.+")) {
      String toNick = message.substring(0, message.indexOf(':'));
      String msg = message.substring(message.indexOf(':') + 1, message.length());

      List<SeenUser> seens = JWorm.get(SeenUser.class);
      boolean save = false;
      for (SeenUser s : seens) {
        if (s.getNicks().contains(toNick)) {
          save = true;
          break;
        }
      }

      for (User user : bot.getUsers(channel)) {
        if (user.equals(toNick)) {
          return;
        }
      }

      if (save) {
        saveTell(channel, sender, toNick, msg);
      }
    }
  }
예제 #2
0
  public void onTrigger(
      String channel,
      String sender,
      String login,
      String hostname,
      String message,
      String trigger) {
    String toNick = null;
    String msg = null;
    try {
      toNick = message.substring(0, message.indexOf(' '));
      msg = message.substring(message.indexOf(' '));
    } catch (IndexOutOfBoundsException ioobe) {
      bot.msg(channel, "Bogus message format: try !" + TRIGGER + " <nick> <message>.");
      return;
    }

    for (User user : bot.getUsers(channel)) {
      if (user.equals(toNick)) {
        bot.msg(channel, toNick + " is here right now, you dumbass!");
        return;
      }
    }
    saveTell(channel, sender, toNick, msg);
  }
예제 #3
0
 public void onNickChange(String oldNick, String login, String hostname, String newNick) {
   for (String chan : bot.getChannels()) {
     for (User user : bot.getUsers(chan)) {
       if (user.equals(newNick)) {
         tell(chan, newNick);
       }
     }
   }
 }
예제 #4
0
  public boolean userIsOnChannel(final String nick, final String channel) {

    for (final User user : getUsers(channel)) {
      if (user.getNick().toLowerCase().equals(nick.toLowerCase())) {
        return true;
      }
    }
    return false;
  }
예제 #5
0
 /**
  * Is the sender respected in the channel?
  *
  * IOW, does he have a voice of a channel operator?
  */
 private boolean isSenderAuthorized(String channel, String sender) {
     for (User u : getUsers(channel)) {
         System.out.println(u.getPrefix()+u.getNick());
         if (u.getNick().equals(sender)) {
             String p = u.getPrefix();
             if (p.contains("@") || p.contains("+"))
                 return true;
         }
     }
     return false;
 }
예제 #6
0
 @Override
 protected void onUserList(String channel, User[] users) {
   for (User u : getUsers(channel)) {
     if (u.isOp()) {
       String nick = u.getNick();
       if (!ops.contains(nick)) {
         ops.add(nick);
       }
     }
   }
 }
예제 #7
0
 public void handleLoss(String nick) {
   for (String s : channels) {
     for (User u : getUsers(s)) {
       if (u.getNick().equals(nick)) {
         return;
       }
     }
   }
   Group removedGroup = Group.getGroup(nick);
   if (removedGroup != null) {
     groups.remove(removedGroup);
   }
 }
예제 #8
0
  public User playerMatchIRC(String name) {
    if (getServer().getOnlinePlayers().length < 1) {
      return null;
    }

    for (User user : getIrcBot().getUsers("#hardwork")) {
      if (user.getNick().equalsIgnoreCase(name)) {
        return user;
      }
    }

    return null;
  }
예제 #9
0
파일: Arisu.java 프로젝트: Carlgo11/Arisu
 public boolean isVoice(String sender, String channel) {
   User users[] = getUsers(channel);
   User u = null;
   for (User usa : users) {
     if (sender.equals(usa.getNick())) {
       u = usa;
       break;
     }
   }
   if (u.hasVoice()) {
     return true;
   } else {
     return false;
   }
 }
예제 #10
0
  /**
   * Get all channels where the user with the given nickname is online
   *
   * @param nickname
   * @return Array of channel names
   */
  private Vector<String> getChannelsByNickname(String nickname) {
    Vector<String> channels = new Vector<String>();
    String[] channelArray = getChannels();

    for (String channel : channelArray) {
      User[] userArray = getUsers(channel);
      for (User user : userArray) {
        if (user.getNick().equals(nickname)) {
          channels.add(channel);
          break;
        }
      }
    }

    return channels;
  }
예제 #11
0
파일: Arisu.java 프로젝트: Carlgo11/Arisu
  public boolean isOp(String sender, String channel) {
    User users[] = getUsers(channel);
    User u = null;
    for (User user : users) {
      String us = user.getNick().replace("~", "");
      System.out.println("user: "******"~")) {
      return true;
    } else {
      return false;
    }
  }