NoWechatRevoke
NoWechatRevoke copied to clipboard
建议撤回得消息标示出:(已撤回消息)
如题
似乎新版已经实现了,issues可以关闭了 nice work!
@ivytin 现在这个只是折中的办法,最好还是能在消息旁边添加,而且不用碰微信的数据库
这样更完美
String talker = map.get(".sysmsg.revokemsg.session");
// get next msgId
Cursor cursor = (Cursor) callMethod(dbContext, "rawQuery",
"SELECT msgId FROM message WHERE rowid in (SELECT max(rowid) FROM message)", null);
cursor.moveToFirst();
int msgId = cursor.getInt(cursor.getColumnIndex("msgId")) + 1;
cursor.close();
// get talkerId
cursor = (Cursor) callMethod(dbContext, "rawQuery",
"SELECT *,rowid FROM rcontact WHERE username = '" + talker + "'", null);
cursor.moveToFirst();
int talkerId = cursor.getInt(cursor.getColumnIndex("rowid"));
cursor.close();
String msg = map.get(".sysmsg.revokemsg.replacemsg").replaceAll("撤回了", "尝试撤回");
int type = 10000;
int status = 3;
long createTime = System.currentTimeMillis();
long msgSvrId = createTime + (new Random().nextInt());
ContentValues v = new ContentValues();
v.put("msgid", msgId);
v.put("msgSvrid", msgSvrId);
v.put("type", type);
v.put("status", status);
v.put("createTime", createTime);
v.put("talker", talker);
v.put("content", msg);
v.put("talkerid", talkerId);
callMethod(dbContext, "insert", "message", "", v);
// for version 6.3.8
callMethod(callMethod(callStaticMethod(findClass("com.tencent.mm.model.ah",
lpparam.classLoader), "tl"), "rj"), "aTT");
// for version 6.3.9
callMethod(callMethod(callStaticMethod(findClass("com.tencent.mm.model.ah",
lpparam.classLoader), "tr"), "rk"), "aVP");
@fkzhang 我看到你发布的版本了,代码也跟上面的类似,但这样的话高并发时msgId会不会有重复? 另外,将 createTime 改成被撤回消息的 createTime + 1 可以将系统提示显示在被撤回消息的下方。
好主意 msgId 不会重复因为是从数据库得来的最大一个加一 最后一句就是告诉其他的这个msgId已经用过