Package org.jaibo.api

Examples of org.jaibo.api.IrcEvent


        assertEquals(event.getArgument("CloseMessage"), "close message");
        assertEquals(event.getEventType(), IrcEventType.Part);
    }

    public void testQuitChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(quitEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getArgument("QuitMessage"), "quit message");
        assertEquals(event.getEventType(), IrcEventType.Quit);
    }
View Full Code Here


        assertEquals(event.getArgument("QuitMessage"), "quit message");
        assertEquals(event.getEventType(), IrcEventType.Quit);
    }

    public void testKickChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(kickEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getChannel(), "#test_channel");
        assertEquals(event.getArgument("UserKicked"), "kicked_user_nick");
        assertEquals(event.getArgument("KickMessage"), "kick message");
        assertEquals(event.getEventType(), IrcEventType.Kick);
    }
View Full Code Here

        assertEquals(event.getArgument("KickMessage"), "kick message");
        assertEquals(event.getEventType(), IrcEventType.Kick);
    }

    public void testJoinChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(joinEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getChannel(), "#test_channel");
        assertEquals(event.getEventType(), IrcEventType.Join);
    }
View Full Code Here

        assertEquals(event.getChannel(), "#test_channel");
        assertEquals(event.getEventType(), IrcEventType.Join);
    }

    public void testModeChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(modeEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getArgument("User"), "user_nick_name");
        assertEquals(event.getEventType(), IrcEventType.Mode);
    }
View Full Code Here

    private String modeEvent = ":old_nick!host.org MODE #test_channel +o user_nick_name";
    private String joinEvent = ":old_nick!host.org JOIN #test_channel";


    public void testNickChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(nickEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getArgument("NewNickName"), "new_nick");
        assertEquals(event.getEventType(), IrcEventType.Nick);
    }
View Full Code Here

        assertEquals(event.getArgument("NewNickName"), "new_nick");
        assertEquals(event.getEventType(), IrcEventType.Nick);
    }

    public void testTabClosedChangedEvent() {
        IrcEvent event = IrcEvent.tryParse(tabCloseEvent);

        assertNotNull(event);

        assertEquals(event.getUser(), "old_nick");
        assertEquals(event.getHost(), "host.org");
        assertEquals(event.getChannel(), "#test_channel");
        assertEquals(event.getArgument("CloseMessage"), "close message");
        assertEquals(event.getEventType(), IrcEventType.Part);
    }
View Full Code Here

    @Override
    public void ircMessageReceived(String message) {
        if (message != null) {
            IrcMessage ircMessage = IrcMessage.tryParse(message);
            IrcEvent ircEvent = IrcEvent.tryParse(message);

            if (ircMessage != null) {
                this.taskManager.notifyMessageListeners(ircMessage);
            } else if (ircEvent != null) {
                this.taskManager.notifyEventListeners(ircEvent);
View Full Code Here

*/

public final class QuitEventParser implements IrcEventParser {
    @Override
    public IrcEvent tryParse(String message) {
        IrcEvent ircEvent = null;

        if (message != null) {
            Pattern p = Pattern.compile("^:(.*)!(.*) QUIT :(.*)$");

            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.setArgument("QuitMessage", matcher.group(3));
                ircEvent.setEventType(IrcEventType.Quit);
            }
        }

        return ircEvent;
    }
View Full Code Here

*/

public final class NickEventParser implements IrcEventParser {
    @Override
    public IrcEvent tryParse(String message) {
        IrcEvent ircEvent = null;

        if (message != null) {
            Pattern p = Pattern.compile("^:(.*)!(.*) NICK :(.*)$");

            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.setArgument("NewNickName", matcher.group(3));
                ircEvent.setEventType(IrcEventType.Nick);
            }
        }

        return ircEvent;
    }
View Full Code Here

*/

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;
    }
View Full Code Here

TOP

Related Classes of org.jaibo.api.IrcEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.