예제 #1
0
        private void doChannelLogin(AbstractActionFuture future)
        {
            LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN);

            login.channelLogin(getContext().getAccount().getStatus(), delegate(QQActionEvent evt) {
                if (evt.getType() == QQActionEvent.Type.EVT_OK)
                {
                    future.notifyActionEvent(QQActionEvent.Type.EVT_OK, null);
                }
                else if (evt.getType() == QQActionEvent.Type.EVT_ERROR)
                {
                    future.notifyActionEvent(QQActionEvent.Type.EVT_ERROR,
                                             (QQException)evt.getTarget());
                }
            });
        }
예제 #2
0
        /**
         * <p>relogin.</p>
         *
         * @param status a {@link iqq.im.bean.QQStatus} object.
         * @param listener a {@link iqq.im.QQActionListener.OnActionEvent} object.
         * @return a {@link iqq.im.evt.AbstractActionFuture} object.
         */
        public AbstractActionFuture relogin(QQStatus status, QQActionListener.OnActionEvent listener)
        {
            getContext().getAccount().setStatus(status);
            getContext().getSession().setState(QQSession.State.LOGINING);

            AbstractActionFuture future      = new AbstractActionFuture(listener);
            LoginModule          loginModule = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN);

            loginModule.channelLogin(status, delegate(QQActionEvent evt)
            {
                if (evt.getType() == QQActionEvent.Type.EVT_ERROR)
                {
                    login(listener);
                }
                else
                {
                    listener(evt);
                }
            });
            return(future);
        }