Ejemplo n.º 1
0
  protected void insertRequestReceiveFileMsg(PeerHolder gpeer, GMessageTcp msgTcp) {
    ContentValues cv = new ContentValues();
    long date = System.currentTimeMillis();

    cv.put(MsgTable.FROM, MsgTable.FROM_INCOMING);
    cv.put(MsgTable.TYPE, MsgTable.TYPE_RECEIVE_ATTACH_REQUEST);
    cv.put(MsgTable.STATUS, MsgTable.STATUS_RECEIVE_COMPLETE);
    cv.put(MsgTable.FLAG, msgTcp.flag);
    cv.put(MsgTable.MAC_ADDRESS, gpeer.macAddress);
    cv.put(MsgTable.DATE, date);

    if (UID.curMacAddress != null && UID.curMacAddress.equals(gpeer.macAddress)) {
      cv.put(MsgTable.READ, MsgTable.READ_READED);
    }

    MsgTable.getInstance().insert(cv);

    for (int i = 0; i < msgTcp.msgAttach.length; i++) {
      cv.clear();
      long adate = System.currentTimeMillis();

      cv.put(AttachTable.MAC_ADDRESS, gpeer.macAddress);
      cv.put(AttachTable.FILE_PATH, msgTcp.msgAttach[i].filePath);
      cv.put(AttachTable.TYPE, msgTcp.msgAttach[i].type);
      cv.put(AttachTable.FLAG, msgTcp.msgAttach[i].flag);
      cv.put(AttachTable.ATT_FLAG, msgTcp.msgAttach[i].attflag);
      cv.put(AttachTable.SIZE, msgTcp.msgAttach[i].size);
      cv.put(AttachTable.DATE, adate);
      AttachTable.getInstance().insert(cv);
    }

    //	    MsgCenter.getInstance().loadPeerGDialogAttach(msgTcp.flag);

    refreshDialogAndnotibar(gpeer, date, msgTcp.msgAttach[0].filePath);
  }
Ejemplo n.º 2
0
  protected void insertMsg(PeerHolder gpeer, GMessageTcp msgTcp) {
    ContentValues cv = new ContentValues();
    long date = System.currentTimeMillis();

    cv.put(MsgTable.FROM, MsgTable.FROM_INCOMING);
    cv.put(MsgTable.STATUS, MsgTable.STATUS_RECEIVE_COMPLETE);
    cv.put(MsgTable.MSG, msgTcp.msgBody);
    cv.put(MsgTable.MAC_ADDRESS, gpeer.macAddress);
    cv.put(MsgTable.DATE, date);

    if (UID.curMacAddress != null && UID.curMacAddress.equals(gpeer.macAddress)) {
      cv.put(MsgTable.READ, MsgTable.READ_READED);
    }

    MsgTable.getInstance().insert(cv);

    refreshDialogAndnotibar(gpeer, date, msgTcp.msgBody);
  }