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 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()); } } }); }
/** {@inheritDoc} */ public override QQHttpRequest onBuildRequest() { QQSession session = getContext().getSession(); QQAccount account = (QQAccount)getContext().getAccount(); ApacheHttpService httpService = getContext().getSerivce(); Cookie ptwebqq = httpService.getCookie("ptwebqq", QQConstants.URL_GET_USER_CATEGORIES); JSONObject json = new JSONObject(); json.put("h", "hello"); json.put("vfwebqq", session.getVfwebqq()); // 同上 json.put("hash", QQEncryptor.getHash(account.getUin() + "", ptwebqq.Value)); QQHttpRequest req = createHttpRequest("POST", QQConstants.URL_GET_USER_CATEGORIES); req.addPostValue("r", json.ToString()); req.addHeader("Referer", QQConstants.REFFER); return req; }
/** * {@inheritDoc} * * 刷新验证码 */ public AbstractActionFuture freshVerify(QQNotifyEvent verifyEvent, QQActionListener.OnActionEvent listener) { LoginModule mod = (LoginModule)getModule(AbstractModule.Type.LOGIN); return(mod.getCaptcha(account.getUin(), listener)); }