Пример #1
0
  /**
   * 更改个人资料 这里只支持更改昵称和个性签名
   *
   * @param updateXML 更新的XML
   * @return
   */
  public SipcRequest createSetPersonalInfoRequest() {
    SipcRequest req = this.createDefaultSipcRequest(SipcMethod.SERVICE);

    NodeBuilder builder = new NodeBuilder();
    // 因为用户可以改变自己的信息,这里权限改变了所以不使用BeanHelper来处理
    builder.add("nickname", StringHelper.qouteHtmlSpecialChars(user.getNickName()));
    builder.add("impresa", StringHelper.qouteHtmlSpecialChars(user.getImpresa()));
    // 用户扩展信息。.TODO ..
    // BeanHelper.toUpdateXML(BuddyExtend.class, this.client.getFetionUser(), builder);

    String body = MessageTemplate.TMPL_SET_PERSONAL_INFO;
    body = body.replace("{personal}", builder.toXML("personal"));

    req.addHeader(SipcHeader.EVENT, "SetUserInfoV4");

    req.setBody(new SipcBody(body));
    return req;
  }
Пример #2
0
  /**
   * 添加飞信好友请求
   *
   * @param uri
   * @param promptId
   * @param cordId
   * @param desc
   * @return
   */
  public SipcRequest createAddBuddyRequest(
      String uri, int promptId, int cordId, String desc, String localName) {
    SipcRequest req = this.createDefaultSipcRequest(SipcMethod.SERVICE);
    String body = MessageTemplate.TMPL_ADD_BUDDY;
    body = body.replace("{uri}", uri);
    body = body.replace("{promptId}", Integer.toString(promptId));
    body = body.replace("{cordId}", cordId == -1 ? "" : Integer.toString(cordId));
    body = body.replace("{desc}", StringHelper.qouteHtmlSpecialChars(desc));
    body = body.replace("{localName}", localName != null ? "local-name=\"" + localName + "\"" : "");

    req.addHeader(SipcHeader.EVENT, "AddBuddyV4");
    req.setBody(new SipcBody(body));
    return req;
  }