private void doCheckVerify(AbstractActionFuture future) { LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN); QQAccount account = (QQAccount)getContext().getAccount(); login.checkVerify(account.getUsername(), delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { CheckVerifyArgs args = (CheckVerifyArgs)(evt.getTarget()); account.setUin(args.uin); if (args.result == 0) { doWebLogin(args.code, future); } else { doGetVerify("为了保证您账号的安全,请输入验证码中字符继续登录。", future); } } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent( QQActionEvent.Type.EVT_ERROR, evt.getTarget()); } }); }
/** * <p>sendMsg.</p> * * @param msg a {@link iqq.im.bean.QQMsg} object. * @param listener a {@link iqq.im.QQActionListener.OnActionEvent} object. * @return a {@link iqq.im.evt.AbstractActionFuture} object. */ private void doSendMsg(QQMsg msg, AbstractActionFuture future) { doSendMsg(msg, delegate(QQActionEvent evt) { future.notifyActionEvent(evt.getType(), evt.getTarget()); }); }
private void doGetVerify(String reason, AbstractActionFuture future) { QQAccount account = (QQAccount)(getContext().getAccount()); LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN); login.getCaptcha(account.getUin(), delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { QQNotifyEventArgs.ImageVerify verify = new QQNotifyEventArgs.ImageVerify(); verify.type = QQNotifyEventArgs.ImageVerify.VerifyType.LOGIN; verify.image = (BitmapImage)evt.getTarget(); verify.reason = reason; verify.future = future; getContext().fireNotify(new QQNotifyEvent(QQNotifyEvent.Type.CAPACHA_VERIFY, verify)); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent( QQActionEvent.Type.EVT_ERROR, (QQException)evt.getTarget()); } }); }
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()); } }); }
private void doWebLogin(String verifyCode, AbstractActionFuture future) { LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN); QQAccount account = (QQAccount)getContext().getAccount(); login.webLogin(account.getUsername(), account.getPassword(), account.getUin(), verifyCode, delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { doCheckLoginSig((String)evt.getTarget(), future); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { QQException ex = (QQException)(evt.getTarget()); if (ex.getError() == QQWpfApplication1.action.QQException.QQErrorCode.WRONG_CAPTCHA) { doGetVerify(ex.Message, future); } else { future.notifyActionEvent( QQActionEvent.Type.EVT_ERROR, (QQException)evt.getTarget()); } } }); }
private void doGetLoginSig(AbstractActionFuture future) { LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN); login.getLoginSig(delegate(QQActionEvent evt){ if (evt.getType() == QQActionEvent.Type.EVT_OK) { doCheckVerify(future); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent( QQActionEvent.Type.EVT_ERROR, (QQException)evt.getTarget()); } }); }
private void doCheckLoginSig(String checkSigUrl, AbstractActionFuture future) { LoginModule login = (LoginModule)getContext().getModule(AbstractModule.Type.LOGIN); login.checkLoginSig(checkSigUrl, delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { doChannelLogin(future); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent( QQActionEvent.Type.EVT_ERROR, (QQException)evt.getTarget()); } }); }
public AbstractActionFuture sendMsg(QQMsg msg, QQActionListener.OnActionEvent listener) { if (msg.getType() == QQMsg.Type.SESSION_MSG) { AbstractActionFuture future = new AbstractActionFuture(listener); QQStranger stranger = (QQStranger)msg.getTo(); if (stranger.getGroupSig() == null || stranger.getGroupSig().Equals("")) { getSessionMsgSig(stranger, delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { doSendMsg(msg, future); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent(evt.getType(), evt.getTarget()); } }); } return(future); } else if (msg.getType() == QQMsg.Type.GROUP_MSG || msg.getType() == QQMsg.Type.DISCUZ_MSG) { if (getContext().getSession().getCfaceKey() == null || getContext().getSession().getCfaceKey().Equals("")) { AbstractActionFuture future = new AbstractActionFuture(listener); getCFaceSig(delegate(QQActionEvent evt) { if (evt.getType() == QQActionEvent.Type.EVT_OK) { doSendMsg(msg, future); } else if (evt.getType() == QQActionEvent.Type.EVT_ERROR) { future.notifyActionEvent(evt.getType(), evt.getTarget()); } }); return(future); } } return(doSendMsg(msg, listener)); }