/** * {@inheritDoc} * * 提交验证码 */ public void submitVerify(String code, QQNotifyEvent verifyEvent) { QQNotifyEventArgs.ImageVerify verify = (QQNotifyEventArgs.ImageVerify)verifyEvent.getTarget(); if (verify.type == QQWpfApplication1.bean.QQNotifyEventArgs.ImageVerify.VerifyType.LOGIN) { ProcModule mod = (ProcModule)getModule(AbstractModule.Type.PROC); mod.loginWithVerify(code, (AbstractActionFuture)verify.future); } }
/** * {@inheritDoc} * * 重新登录 */ public void relogin(QQStatus status, QQActionListener.OnActionEvent listener) { if (session.getState() == QQWpfApplication1.action.QQSession.State.ONLINE) { throw new ApplicationException("client is aready online !!!"); } getAccount().setStatus(status); getSession().setState(QQSession.State.LOGINING); ProcModule procModule = (ProcModule)getModule(AbstractModule.Type.PROC); procModule.relogin(status, listener); }
/** * {@inheritDoc} * * 登录接口 */ public AbstractActionFuture login(QQStatus status, QQActionListener.OnActionEvent listener) { //检查客户端状态,是否允许登陆 if (session.getState() == QQWpfApplication1.action.QQSession.State.ONLINE) { throw new ApplicationException("client is aready online !!!"); } getAccount().setStatus(status); session.setState(QQSession.State.LOGINING); ProcModule procModule = (ProcModule)getModule(AbstractModule.Type.PROC); return(procModule.login(listener)); }
/** * {@inheritDoc} * * 轮询QQ消息 */ public void beginPollMsg() { if (session.getState() == QQSession.State.OFFLINE) { throw new ApplicationException("client is aready offline !!!"); } ProcModule procModule = (ProcModule)getModule(AbstractModule.Type.PROC); procModule.doPollMsg(); // 轮询邮件 // EmailModule emailModule = (EmailModule) getModule(AbstractModule.Type.EMAIL); // emailModule.doPoll(); }
/** * {@inheritDoc} * * 退出登录 */ public AbstractActionFuture logout(QQActionListener.OnActionEvent listener) { if (session.getState() == QQSession.State.OFFLINE) { throw new ApplicationException("client is aready offline !!!"); } ProcModule procModule = (ProcModule)getModule(AbstractModule.Type.PROC); return(procModule.doLogout(delegate(QQActionEvent evt) { // 无论退出登录失败还是成功,都需要释放资源 if (evt.getType() == QQActionEvent.Type.EVT_OK || evt.getType() == QQActionEvent.Type.EVT_ERROR) { session.setState(QQSession.State.OFFLINE); destroy(); } if (listener != null) { listener(evt); } })); }