macOS中QQ防消息撤回

macOS下的QQ还是增加了消息撤回功能,稍微研究了一下,只需要Hook一个函数即可。

可以考虑写一个dylib然后附上去,代码如下。然后至于说是用DYLD_INSERT_LIBRARIES这个环境变量,还是说直接改load_commands就看个人喜好了,这里不展开写。

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

void handleRecallNotifyIsOnline(id, SEL, void *, BOOL) {}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"

static void __attribute__((constructor)) initialize(void) {
    method_setImplementation(class_getInstanceMethod(NSClassFromString(@"QQMessageRevokeEngine"), @selector(handleRecallNotify:isOnline:)), (IMP)&handleRecallNotifyIsOnline);
}

#pragma clang diagnostic pop

3 thoughts on “macOS中QQ防消息撤回”

Leave a Reply

Your email address will not be published. Required fields are marked *

8 + 17 =