*/
public final class ModeEventParser implements IrcEventParser {
@Override
public IrcEvent tryParse(String message) {
IrcEvent ircEvent = null;
if (message != null) {
Pattern p = Pattern.compile("^:(.*)!(.*) MODE (.*) (.*) (.*)$");
CharSequence sequence = message.subSequence(0, message.length());
Matcher matcher = p.matcher(sequence);
if (matcher.matches()) {
ircEvent = new IrcEvent();
ircEvent.setUser(matcher.group(1));
ircEvent.setHost(matcher.group(2));
ircEvent.setChannel(matcher.group(3));
ircEvent.setUserModes(ModeEventParser.tryParseUserMode(matcher.group(4)));
ircEvent.setArgument("User", matcher.group(5));
ircEvent.setEventType(IrcEventType.Mode);
}
}
return ircEvent;
}