Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
  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;
    }
  }
Ejemplo n.º 3
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;
  }
Ejemplo n.º 4
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);
       }
     }
   }
 }
Ejemplo n.º 5
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);
   }
 }
Ejemplo n.º 6
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;
  }
Ejemplo n.º 7
0
 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;
   }
 }
Ejemplo n.º 8
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;
  }