public IRCEvent createEvent(IRCEvent event) { String data = event.getRawEventData(); Pattern p = Pattern.compile("^:\\S+\\s322\\s\\S+\\s(\\S+)\\s(\\d+)\\s:(.*)$"); Matcher m = p.matcher(data); if (m.matches()) { return new ChannelListEvent( data, m.group(1), m.group(3), Integer.parseInt(m.group(2)), event.getSession()); } return event; }
@Override public IRCEvent createEvent(IRCEvent event) { if (event.command().matches("366")) { Session session = event.getSession(); return new NickListEvent( event.getRawEventData(), session, session.getChannel(event.arg(1)), session.getChannel(event.arg(1)).getNicks()); } Channel chan = event.getSession().getChannel(event.arg(2)); String[] names = event.arg(3).split("\\s+"); for (String name : names) { if (name != null && name.length() > 0) { chan.addNick(name); } } return event; }