Exemple #1
0
 /**
  * to get the list of channels which contain the current user and which can be see by the user who
  * is asking for
  *
  * @param sAskerNickName the nickname of the user who asks for
  */
 public String[] getChannelList(String sAskerNickName) {
   Vector vAllChannels = new Vector();
   StringBuffer buffer = new StringBuffer(Message.getSizeLimit() + 20);
   String sCurrentChannel;
   for (int i = 0; i < channelList.size(); i++) {
     sCurrentChannel = getDisplayedValue(getChannelAt(i), sAskerNickName);
     if (!sCurrentChannel.equals(VOID)) {
       buffer.append(sCurrentChannel + SPACE);
     }
     if (buffer.length() > Message.getSizeLimit()) {
       vAllChannels.addElement(buffer.toString());
       buffer = new StringBuffer(Message.getSizeLimit() + 20);
     }
   }
   if (buffer.length() > 0) {
     vAllChannels.addElement(buffer.toString());
   }
   String[] sChannels = new String[vAllChannels.size()];
   return (String[]) vAllChannels.toArray(sChannels);
 }
Exemple #2
0
 /**
  * to execute the Notice's command
  *
  * @param userExp the user who sends the command
  * @return the list of message to send back to the sender
  */
 public Message[] exec(org.codehaus.plexus.ircd.user.User userExp) {
   ParamsToken paramsToken = getRequestMessage().getParamsToken();
   MiddleToken[] middleTokens = paramsToken.getMiddleTokens();
   TrailingToken trailingToken = paramsToken.getTrailingToken();
   if (trailingToken == null) {
     return Message.createSingleMessage(
         new Message(Replies.ERR_NEEDMOREPARAMS, new String[] {getName()}));
   } else {
     String sMessage = trailingToken.getTrailingValue();
     TargetToken targetToken = (TargetToken) TargetToken.getToken(middleTokens[0].toString());
     if (targetToken == null) {
       return null;
     }
     ToToken[] toTokens = targetToken.getToTokens();
     if (toTokens != null) {
       for (int i = 0; i < toTokens.length; i++) {
         NickToken nickToken = toTokens[i].getNickToken();
         org.codehaus.plexus.ircd.user.User user = null;
         if (nickToken == null) {
           continue;
         }
         String login = nickToken.getNickName();
         try {
           user = HandleUser.getUser(login);
         } catch (IRCException e) {
         }
         if (user != null) {
           user.addResponses(
               Message.createSingleMessage(
                   new Message(
                       userExp.getNickName(), user.getNickName(), getName(), VOID, sMessage)));
         }
       }
     }
     return null;
   }
 }
Exemple #3
0
 /**
  * to set the away's state with a specific message
  *
  * @param sMessage the away's message
  */
 public void setAwayState(String sMessage) {
   setAway(true);
   setAwayMessage(sMessage);
   addResponses(
       Message.createSingleMessage(new Message(nickName, Replies.RPL_NOWAWAY, new String[] {})));
 }
Exemple #4
0
 /** to remove the away's state */
 public void removeAwayState() {
   setAway(false);
   setAwayMessage(null);
   addResponses(
       Message.createSingleMessage(new Message(nickName, Replies.RPL_UNAWAY, new String[] {})));
 }