Package org.openmim.mn2.model

Examples of org.openmim.mn2.model.IRCServerBean


    }

    public void startReconnecting(Context context, StatusRoomListenerExternal statusRoomListenerExternal) {
        List<IMNetworkBean> nets=context.getConfigurationBean().getNetworksConfigured();
        if(nets!=null)for (IMNetworkBean bean : nets) {
            MessagingNetwork2 net=getMessagingNetwork2ByType(bean.getType());
            net.load(context, imListener, statusRoomListenerExternal);
            net.startReconnecting();
        }
    }
View Full Code Here


        this.imNetworks=new ArrayList<IMNetwork>();
        final List<IMNetworkBean> imNetworkBeans = ctx.getConfigurationBean().getNetworksConfigured();
        for (IMNetworkBean bean : imNetworkBeans) {
            String key=bean.getKey();
            String keyCanon=getFactory().getNameConvertor().toCanonicalIMNetworkKey(key);
            IMNetwork imNetwork=getFactory().createIMNetwork(bean.getType(),key,
                    imListener,
                    new MyStatusRoomListenerInternal(statusRoomListenerExternal),
                    getFactory().createListOfServersToKeepConnectionWith(
                            ctx.getConfigurationBean().
                                    getNetworkKeyCanonical2ListOfServersToKeepConnectionWith().
View Full Code Here

    }

    protected static void handleCommand(int i, IRCMessage msg, IRCListener il) throws Exception {
        Lang.ASSERT_NOT_NULL(il, "il");
        Lang.ASSERT_NOT_NULL(msg, "msg");
        IRCController queryClient = il.getProtocolHandler().getLocalClient();
        Lang.ASSERT_NOT_NULL(queryClient, "queryClient");
        //org.openmim.irc.mvc_impl.model.User_ clientFrom = msg.getUser();
        //Lang.ASSERT_NOT_NULL(clientFrom, "clientFrom");
        int middlePartsCount = msg.getMiddlePartsCount();
        //
        switch (i) {
            default:
                break;
                //:goo!webchat@127.0.0.*** NOTICE goo :pidarrr
            case RPL_EXT_ISON:
                //":127.0.0.1 303 jj_mirc_foo :"
                //":127.0.0.1 303 jj_mirc_foo :jj_mirc_foo "
                //":127.0.0.1 303 jj_mirc_foo :jjj_mirc_foo jj_mirc_foo "
                String[] nicksOnline = Acme.Utils.splitStr(msg.getTrailing().trim(), ' ');
                Lang.ASSERT_NOT_NULL(nicksOnline, "nicksOnline");
                il.handleIsonReply(/*server*/ msg.getPrefix(), nicksOnline);
                return;
            case RPL_EXT_NOTICE:
                try {
                    il.handleNotice(msg.getPrefix(), msg.getSender(), msg.getTrailing());
                }
                catch (Exception ex) {
                    il.handleNotice(msg.getPrefix(), null, msg.getTrailing());
                }
                return;
            case 002:
                String s002 = msg.getTrailing();
//    if (s002 != null && s002.toLowerCase().lastIndexOf(".ircz.") != -1)
//    il.setIrczMuteSupported();
                break;
//  case 387 :
//    :Beauce-R.Qc.UnderZ.Org 387 goo #goo :End of IRCChannel Mute List
//    if (il.isIrczMuteSupported())
//    {
//    Lang.EXPECT(middlePartsCount >= 1, "middlePartsCount is expected to be >= 1, but it is " + middlePartsCount);
//    String channelName = msg.getMiddlePart(1);
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
//    il.handleMuteListEnd(channelName);
//    return;
//    }
//    break;
//  case 386 :
//    //:Beauce-R.Qc.UnderZ.Org 386 goo #z jp!*@* sKaTeR 971112601
//    //                                1  2      3      4
//    if (il.isIrczMuteSupported())
//    {
//    Lang.EXPECT(middlePartsCount >= 4, "middlePartsCount is expected to be >= 4, but it is " + middlePartsCount);
//    String channelName = msg.getMiddlePart(1);
//    String ircMaskMuted = msg.getMiddlePart(2);
//    String muterNickName = msg.getMiddlePart(3);
//    String timeAsString = msg.getMiddlePart(4);
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(ircMaskMuted, "ircMaskMuted");
//    il.handleMuteListItem(new org.openmim.irc.driver.ircz.MuteListItem(channelName, ircMaskMuted, muterNickName, timeAsString));
//    return;
//    }
//    break;
                //:127.0.0.1 401 goo goojhg :No such nick/channel
            case 401:
                il.handleNoSuchNickChannel(msg.getMiddlePart(1), msg.getTrailing());
                return;
                //:127.0.0.1 301 goo goo :away message
            case 301:
                il.handleAwayMessage(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 405:
            case 471:
            case 473:
            case 474:
            case 475:
                il.cannotJoinChannel(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 432:
            case 433:
            case 436:
                il.invalidNickName(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 311:
                il.handleWhoisUser(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getMiddlePart(3), msg.getTrailing());
                return;
            case 312:
                il.handleWhoisServer(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getTrailing());
                return;
            case 313:
                il.handleWhoisOperator(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 317:
                il.handleWhoisIdleTime(msg.getMiddlePart(1), Integer.parseInt(msg.getMiddlePart(2)), msg.getTrailing());
                return;
            case 319:
                il.handleWhoisChannelsOn(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 318:
                il.handleWhoisEnd(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 331:
                il.onInitialTopic(msg.getMiddlePart(1), false, msg.getTrailing());
                return;
            case 332:
                il.onInitialTopic(msg.getMiddlePart(1), true, msg.getTrailing());
                return;
            case 367:
                il.handleBanListItem(msg.getMiddlePart(1), msg.getMiddlePart(2));
                return;
            case 368:
                il.handleBanListEnd(msg.getMiddlePart(1));
                return;
            case -101:

            {
                String to = msg.getMiddlePart(0);
                Lang.ASSERT_NOT_NULL_NOR_EMPTY(to, "privmsg.to");
                //char c = to.charAt(0);
                //boolean isToChannel = (c == '#' || c == '&');
                ////
                User userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                //if (!isToChannel)
                //{
                ////new Query should not be created at all for ignored users.
                //if (il.shouldCreateQuery(userFrom, msg.getTrailing()))
                //queryClient.onJoinedQuery(userFrom);
                //}
                if (msg.getTrailing() != null) {
                    String s = msg.getTrailing();
                    if (s.startsWith("\001")) {
                        boolean flag1 = s.endsWith("\001") && s.length() > 1;
                        int j = flag1 ? s.length() - 1 : s.length();
                        handleCtcp(msg, s.substring(1, j), il);
                        return;
                    }
                }
                il.textMessageReceived(//
                        userFrom, //
                        to, //
                        msg.getTrailing());
                return;
            }
            case -100:
                il.ping(msg.getTrailing());
                return;
            case -103:
                handleJoin(il, msg);
                return;
            case 353:
                parseNamReply(il, msg);
                return;
            case RPL_EXT_PART:

            {
                String channelName = msg.getMiddlePart(0);
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByChannelName(userFrom, channelName);
                Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole");
                IRCChannel channel = (IRCChannel) IRCChannelRole.getRoom();
                channel.parts(IRCChannelRole, msg.getTrailing());
                il.handlePart(channelName, userFrom, msg.getTrailing() != null ? msg.getTrailing() : userFrom.getActiveNick());
                return;
            }
            case -106:
                il.handleTopic(msg.getMiddlePart(0), msg.getTrailing());
                return;
            case -105:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                queryClient.onQuit(userFrom);
                il.quit(userFrom.getActiveNick(), msg.getTrailing());
                return;
            }
            case -104:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                String oldNickName = userFrom.getActiveNick();
                String newNickName = msg.getTrailing();
                if (newNickName == null) newNickName = msg.getMiddlePart(0);
                il.nickChange(oldNickName, newNickName);
                userFrom.setActiveNick(newNickName);
                return;
            }
            case -108:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                String channelName = msg.getMiddlePart(0);
                String kickedNick = msg.getMiddlePart(1);
                IRCChannel IRCChannel = queryClient.getChannelJoinedByChannelName(channelName);
                Lang.EXPECT_NOT_NULL(IRCChannel, "IRCChannel named " + StringUtil.toPrintableString(channelName));
                IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByNickName(IRCChannel,kickedNick);
                Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole for " + StringUtil.toPrintableString(kickedNick) + " on " + StringUtil.toPrintableString(channelName));
                IRCChannel.kicked(IRCChannelRole,userFrom,msg.getTrailing());
                il.kick(userFrom.getActiveNick(), channelName, kickedNick, msg.getTrailing());
                return;
            }
            case 1:
                /* '\001' */
                il.welcome(msg.getMiddlePart(0), msg.getTrailing());
                queryClient.welcome_setNickName(msg.getMiddlePart(0));
                return;
            case RPL_EXT_MODE:
            case 324:
                //:127.0.0.1 324 goo #goo +
                final boolean is324 = i == 324;
View Full Code Here

        String channelName = ircmessage.getTrailing();
        if (channelName == null)
            channelName = ircmessage.getMiddlePart(0);
        if (channelName != null)
            channelName = channelName.trim();
        IRCController queryClient = irclistener.getProtocolHandler().getLocalClient();
        if (nickJoined.equalsIgnoreCase(irclistener.getProtocolHandler().getNick())) {
            queryClient.onMeJoinedChannel(channelName, userJoined);
            irclistener.join(channelName);
        } else {
            IRCChannel ch = queryClient.getChannelJoinedByChannelName(channelName);
            Lang.EXPECT_NOT_NULL(ch, "channel named " + StringUtil.toPrintableString(channelName));
            final RoomParticipant rp = queryClient.createDefaultRole(ch, userJoined);
            rp.getRoom().addRoomRole(rp);
            ch.joins((IRCChannelParticipant) rp);
            irclistener.join(channelName, userJoined);
        }
    }
View Full Code Here

    }

    protected static void parseNamReply(IRCListener irclistener, IRCMessage ircmessage) throws IOException, ExpectException {
        String channelName = ircmessage.getMiddlePart(2);
        Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
        IRCController queryClient = irclistener.getProtocolHandler().getLocalClient();
        IRCChannel IRCChannel = queryClient.getChannelJoinedByChannelName(channelName);
        Lang.EXPECT_NOT_NULL(IRCChannel, "IRCChannel");
        irclistener.namReplyStart(channelName);
        String nickName;
        char modifierChar;
        StringTokenizer st = new StringTokenizer(ircmessage.getTrailing());
        while (st.hasMoreElements()) {
            nickName = st.nextToken();
            Lang.EXPECT_POSITIVE(nickName.length(), "@nick length for " + StringUtil.toPrintableString(nickName));
            modifierChar = nickName.charAt(0);
            if (modifierChar == '@' || modifierChar == '+')
                nickName = nickName.substring(1);
            else
                modifierChar = ' ';
            Lang.EXPECT_POSITIVE(nickName.length(), "nick length for " + StringUtil.toPrintableString(nickName));
            if (!nickName.equalsIgnoreCase(queryClient.getActiveNick())) {
//    User_ client = queryClient.getCreateUser(nickName);
//    IRCChannel.createDefaultRole_addToRoom(client);
            }
            irclistener.namReplyAddNick(nickName, modifierChar);
        }
View Full Code Here

        PrintWriter printwriter = new PrintWriter(new BufferedOutputStream(socket.getOutputStream(), 1024), true);
        init(bufferedreader, printwriter, irclistener);
        irclistener.registering();
        register(loginPassword, nickName, userName, realIrcServerHostName, realIrcServerHostName, realName);
        irclistener.connected();
        queryClient = new IRCController(nickName, realName, userName, loginPassword, MN2Factory);
    }
View Full Code Here

    public IMNetwork createIMNetwork(IMNetwork.Type type, String key, IMListener imListener,
                                     StatusRoomListenerInternal statusRoomListenerInternal,
                                     List<Server> listOfIRCServersToKeepConnectionWith, Context ctx) {
        switch (type){
            case irc:
                return new IRCIMNetwork(key, ctx, imListener, statusRoomListenerInternal,
                        listOfIRCServersToKeepConnectionWith);
            default:throw new AssertionError();
        }
    }
View Full Code Here

        }
    }

    public Server createServer(String hostNameOfRealServer, String redirdHostName, int redirdPort, String realName,
                                  List<String> nickNames, String password, String identdUserName) {
        return new IRCServerImpl(
                hostNameOfRealServer, redirdHostName, redirdPort, realName, nickNames,
                password, identdUserName);
    }
View Full Code Here

    public String getIdentdUserName() {
        return identdUserName;
    }

    public ServerBean toBean(IMNetworkBean net) {
        IRCServerBean sb=new IRCServerBean();
        sb.setPort(redirdPort);
        sb.setHostName(redirdHostName);
        sb.setImNetwork(net);
        return sb;
    }
View Full Code Here

TOP

Related Classes of org.openmim.mn2.model.IRCServerBean

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.