Package iqq.im.core

Examples of iqq.im.core.QQSession


          QQException ex = (QQException) event.getTarget();
          if (ex.getError() == QQErrorCode.INVALID_LOGIN_AUTH) {
            // 登录失败,QQ消息的POLL同时也失效,这时那边会重新登录
            // 如果已经在登录中,或者已经登录了,就不用再次执行
            LOG.warn("getPT4Auth error!!! wait relogin...", ex);
            QQSession session = getContext().getSession();
            if(session.getState() == QQSession.State.LOGINING
                || session.getState() == QQSession.State.KICKED) return;
           
            ProcModule procModule = getContext().getModule(
                Type.PROC);
            procModule.relogin();// 重新登录成功会重新唤醒beginPoll
          } else if (errorCount < QQConstants.MAX_POLL_ERR_CNT) {
View Full Code Here


   */
  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {
    QQHttpRequest req = createHttpRequest("GET", QQConstants.URL_SEND_INPUT_NOTIFY);
    QQSession session  = getContext().getSession();
    req.addGetValue("clientid", session.getClientId() + "");
    req.addGetValue("to_uin", user.getUin() + "");
    req.addGetValue("t", DateUtils.nowTimestamp() + "");
    req.addGetValue("psessionid", session.getSessionId());
    return req;
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {

    QQSession session = getContext().getSession();

    QQHttpRequest req = createHttpRequest("POST", QQConstants.URL_UPLOAD_CUSTOM_FACE);
    req.addGetValue("time", System.currentTimeMillis() / 1000 + "");
    req.addPostValue("from", "control");
    req.addPostValue("f", "EQQ.Model.ChatMsg.callbackSendPicGroup");
    req.addPostValue("vfwebqq", session.getVfwebqq());
    req.addPostValue("fileid", getContext().getStore().getPicItemListSize() + "");
    req.addPostFile("custom_face", file);

    return req;
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public QQHttpRequest onBuildRequest() throws QQException, JSONException {
    HttpService httpService = (HttpService) getContext().getSerivce(QQService.Type.HTTP);
    QQSession session = getContext().getSession();
    Random rand = new Random();
    if(session.getClientId() == 0){
      session.setClientId(rand.nextInt()); //random??
    }
   
    JSONObject json = new JSONObject();
    json.put("status", status.getValue());
    json.put("ptwebqq", httpService.getCookie("ptwebqq",  QQConstants.URL_CHANNEL_LOGIN).getValue());
    json.put("passwd_sig", "");
    json.put("clientid", session.getClientId());
    json.put("psessionid", session.getSessionId());
   
    QQHttpRequest req = createHttpRequest("POST", QQConstants.URL_CHANNEL_LOGIN);
    req.addPostValue("r", json.toString());
    req.addPostValue("clientid", session.getClientId()+"");
    req.addPostValue("psessionid", session.getSessionId());
   
    req.addHeader("Referer", QQConstants.REFFER);
    return req;
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected void onHttpStatusOK(QQHttpResponse response) throws QQException, JSONException {
    //{"retcode":0,"result":{"uin":236557647,"cip":1991953329,"index":1075,"port":51494,"status":"online","vfwebqq":"41778677efd86bae2ed575eea02349046a36f3f53298a34b97d75297ec1e67f6ee5226429daa6aa7","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133332e342e31373200005b9200000549016e04004f95190e6d0000000a4052347371696a62724f6d0000002841778677efd86bae2ed575eea02349046a36f3f53298a34b97d75297ec1e67f6ee5226429daa6aa7","user_state":0,"f":0}}
    JSONObject json = new JSONObject(response.getResponseString());
    QQSession session = getContext().getSession();
    QQAccount account = getContext().getAccount();
    if(json.getInt("retcode") == 0){
      JSONObject ret = json.getJSONObject("result");
      account.setUin(ret.getLong("uin"));
      account.setQQ(ret.getLong("uin"));
      session.setSessionId(ret.getString("psessionid"));
      session.setVfwebqq(ret.getString("vfwebqq"));
      account.setStatus(QQStatus.valueOfRaw(ret.getString("status")));
      session.setState(QQSession.State.ONLINE);
      session.setIndex(ret.getInt("index"));
      session.setPort(ret.getInt("port"));
      notifyActionEvent(QQActionEvent.Type.EVT_OK, null);
    }else{
      notifyActionEvent(QQActionEvent.Type.EVT_ERROR, new QQException(QQErrorCode.INVALID_RESPONSE))//TODO ..
    }
  }
View Full Code Here

  }
 
  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {
    QQSession session = getContext().getSession();
    QQHttpRequest req = createHttpRequest("GET",
        QQConstants.URL_SEARCH_GROUP_INFO);
   
    //我不知道以下4个参数干啥?但是一致! 
    req.addGetValue("c1", "0");
    req.addGetValue("c2", "0");
    req.addGetValue("c3", "0");
    req.addGetValue("st", "0");
   
   
    req.addGetValue("pg", buddy.getCurrentPage() + "");
    req.addGetValue("perpage", buddy.getPageSize() + "");
    req.addGetValue("all", buddy.getKeyStr());
   
   
    req.addGetValue("vfwebqq", session.getVfwebqq());
    req.addGetValue("t", System.currentTimeMillis() / 1000 + "");
    req.addGetValue("type", 1 + "");
    req.addGetValue("vfcode", "");   
   
    return req;   
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {
    QQSession session = getContext().getSession();
    // tuin=4245757755&verifysession=&type=1&code=&vfwebqq=**&t=1361631644492
    QQHttpRequest req = createHttpRequest("GET",
        QQConstants.URL_GET_USER_ACCOUNT);
    req.addGetValue("tuin", buddy.getUin() + "");
    req.addGetValue("vfwebqq", session.getVfwebqq());
    req.addGetValue("t", System.currentTimeMillis() / 1000 + "");
    req.addGetValue("verifysession", ""); // 验证码??
    req.addGetValue("type", 1 + "");
    req.addGetValue("code", "");

View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {
    QQSession session = getContext().getSession();

    QQHttpRequest req = createHttpRequest("GET",
        QQConstants.URL_CUSTOM_FACE_SIG);
    req.addGetValue("clientid", session.getClientId() + "");
    req.addGetValue("psessionid", session.getSessionId());
    req.addGetValue("t", System.currentTimeMillis() / 1000 + "");

    req.addHeader("Referer", QQConstants.REFFER);
    return req;
  }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected void onHttpStatusOK(QQHttpResponse response) throws QQException,
      JSONException {
    QQSession session = getContext().getSession();

    JSONObject json = new JSONObject(response.getResponseString());
    if (json.getInt("retcode") == 0) {
      JSONObject obj = json.getJSONObject("result");
      session.setCfaceKey(obj.getString("gface_key"));
      session.setCfaceSig(obj.getString("gface_sig"));
      notifyActionEvent(QQActionEvent.Type.EVT_OK, session);
    }else{
      notifyActionEvent(QQActionEvent.Type.EVT_ERROR,
        new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.getResponseString()));
    }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  protected QQHttpRequest onBuildRequest() throws QQException, JSONException {
    QQHttpRequest req = createHttpRequest("GET", QQConstants.URL_GET_USER_LEVEL);
    QQSession session  = getContext().getSession();
    req.addGetValue("tuin", user.getUin() + "");
    req.addGetValue("t", DateUtils.nowTimestamp() + "");
    req.addGetValue("vfwebqq", session.getVfwebqq());
    return req;
  }
View Full Code Here

TOP

Related Classes of iqq.im.core.QQSession

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.