Giter Club home page Giter Club logo

Comments (5)

ivytin avatar ivytin commented on August 24, 2024

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

from nowechatrevoke.

bin456789 avatar bin456789 commented on August 24, 2024

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

from nowechatrevoke.

fkzhang avatar fkzhang commented on August 24, 2024

这样更完美

        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");

from nowechatrevoke.

bin456789 avatar bin456789 commented on August 24, 2024

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

from nowechatrevoke.

fkzhang avatar fkzhang commented on August 24, 2024

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

from nowechatrevoke.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.