예제 #1
0
 @Override
 public byte[] getSendContent() {
   try {
     /** 加密 */
     String sendContent = new String(Security.getInstance().EncryptMsg(content));
     return sendContent.getBytes("utf-8");
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   }
   return null;
 }
예제 #2
0
  // ked 2016-06-03 用于收到未读消息时, 生成会话
  // TODO:缺少session update\create字段。。。
  public static SessionEntity getSessionEntity(UnreadEntity ue) {
    SessionEntity sessionEntity = new SessionEntity();

    // [图文消息] [图片] [语音]
    int msgType = ue.getLaststMsgType();

    String content = ue.getLatestMsgData();
    String desMessage = new String(com.mogujie.tt.Security.getInstance().DecryptMsg(content));
    // 判断具体的类型是什么
    if (msgType == DBConstant.MSG_TYPE_GROUP_TEXT || msgType == DBConstant.MSG_TYPE_SINGLE_TEXT) {
      desMessage = MsgAnalyzeEngine.analyzeMessageDisplay(desMessage);
    }
    sessionEntity.setLatestMsgData(desMessage);

    // sessionEntity.setUpdated(msg.getUpdated());
    // sessionEntity.setCreated(msg.getUpdated());
    sessionEntity.setLatestMsgId(ue.getLaststMsgId());
    sessionEntity.setPeerId(ue.getPeerId());
    sessionEntity.setTalkId(ue.getLatestMsgFromUserId());
    sessionEntity.setPeerType(ue.getSessionType());
    sessionEntity.setLatestMsgType(msgType);

    return sessionEntity;
  }