NoWechatRevoke icon indicating copy to clipboard operation
NoWechatRevoke copied to clipboard

建议撤回得消息标示出:(已撤回消息)

Open leo-wong opened this issue 10 years ago • 5 comments

如题

leo-wong avatar Dec 01 '15 04:12 leo-wong

似乎新版已经实现了,issues可以关闭了 nice work!

ivytin avatar Dec 19 '15 16:12 ivytin

@ivytin 现在这个只是折中的办法,最好还是能在消息旁边添加,而且不用碰微信的数据库

bin456789 avatar Dec 20 '15 12:12 bin456789

这样更完美

        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 avatar Jan 09 '16 15:01 fkzhang

@fkzhang 我看到你发布的版本了,代码也跟上面的类似,但这样的话高并发时msgId会不会有重复? 另外,将 createTime 改成被撤回消息的 createTime + 1 可以将系统提示显示在被撤回消息的下方。

bin456789 avatar Jan 25 '16 08:01 bin456789

好主意 msgId 不会重复因为是从数据库得来的最大一个加一 最后一句就是告诉其他的这个msgId已经用过

fkzhang avatar Jan 25 '16 14:01 fkzhang