Ejemplo n.º 1
0
 public IRCEvent generate(RawMessage raw) {
   final Channel channel = raw.getServer().getChannels().get(raw.getRaw().split(" ")[2]);
   if (channel == null) {
     return null;
   }
   final ChannelUser user = channel.getUser(raw.getRaw().split(" ")[3]);
   if (user == null) {
     return null;
   }
   return new ChannelUserEvent(this, channel, user, ChannelUserEvent.USER_KICKED);
 }
 private void addMessage(RawMessage message) {
   if (!message.getCommand().equals(Numerics.SERVER_SUPPORT))
     throw new IllegalArgumentException("Wrong numeric: " + message.getCommand());
   RawMessage[] msgs = new RawMessage[index + 1];
   msgs[index] = message;
   for (int i = 0; i < index; i++) {
     msgs[i] = messages[i];
   }
   index++;
   messages = msgs;
 }
 public void parse(RawMessage msg) {
   addMessage(msg);
   String message = msg.getRaw();
   if (msg.getRaw().contains(" :are supported by this server")) {
     message = msg.getRaw().replace(" :are supported by this server", "").trim();
   }
   String[] parts = message.split(" ");
   for (String s : parts) {
     String key = null;
     String value = null;
     if (s.contains("=")) {
       String[] t = s.split("=", 2);
       key = t[0];
       value = t[1];
     } else {
       key = s;
       value = s;
     }
     settings.put(key, value);
   }
 }
Ejemplo n.º 4
0
 public boolean accept(RawMessage raw) {
   return raw.getCommand().equals("KICK");
 }