mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 05:12:17 +00:00
Compare commits
4 Commits
494b1f1fd0
...
63ce2d40bd
Author | SHA1 | Date | |
---|---|---|---|
63ce2d40bd | |||
36f8b6e54b | |||
58413044e9 | |||
3395cd9d95 |
@ -1,5 +1,6 @@
|
|||||||
package com.tencent.qqnt.kernel.api.impl;
|
package com.tencent.qqnt.kernel.api.impl;
|
||||||
|
|
||||||
|
import com.tencent.qqnt.kernel.nativeinterface.IGetTempChatInfoCallback;
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IKernelMsgListener;
|
import com.tencent.qqnt.kernel.nativeinterface.IKernelMsgListener;
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IOperateCallback;
|
import com.tencent.qqnt.kernel.nativeinterface.IOperateCallback;
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.RichMediaFilePathInfo;
|
import com.tencent.qqnt.kernel.nativeinterface.RichMediaFilePathInfo;
|
||||||
@ -24,4 +25,8 @@ public class MsgService {
|
|||||||
public void prepareTempChat(TempChatPrepareInfo tempChatPrepareInfo, IOperateCallback cb) {
|
public void prepareTempChat(TempChatPrepareInfo tempChatPrepareInfo, IOperateCallback cb) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getTempChatInfo(int chatType, @Nullable String uid, @Nullable IGetTempChatInfoCallback cb) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.tencent.qqnt.kernel.nativeinterface;
|
||||||
|
|
||||||
|
public interface IGetTempChatInfoCallback {
|
||||||
|
void onResult(int code, String msg, TempChatInfo info);
|
||||||
|
}
|
@ -97,6 +97,8 @@ import java.nio.ByteBuffer
|
|||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
|
||||||
internal object GroupSvc: BaseSvc() {
|
internal object GroupSvc: BaseSvc() {
|
||||||
|
private const val GET_MEMBER_ROLE_BY_NT = false
|
||||||
|
|
||||||
private val RefreshTroopMemberInfoLock by lazy {
|
private val RefreshTroopMemberInfoLock by lazy {
|
||||||
Mutex()
|
Mutex()
|
||||||
}
|
}
|
||||||
@ -396,6 +398,13 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getMemberRole(groupId: Long, memberUin: Long): MemberRole {
|
suspend fun getMemberRole(groupId: Long, memberUin: Long): MemberRole {
|
||||||
|
if (!GET_MEMBER_ROLE_BY_NT) {
|
||||||
|
return when (memberUin) {
|
||||||
|
getOwner(groupId.toString()) -> MemberRole.Owner
|
||||||
|
in getAdminList(groupId.toString()) -> MemberRole.Admin
|
||||||
|
else -> MemberRole.Member
|
||||||
|
}
|
||||||
|
}
|
||||||
return when(getTroopMemberInfoByUinViaNt(groupId.toString(), memberUin, 3000).getOrNull()?.role) {
|
return when(getTroopMemberInfoByUinViaNt(groupId.toString(), memberUin, 3000).getOrNull()?.role) {
|
||||||
com.tencent.qqnt.kernel.nativeinterface.MemberRole.STRANGER -> MemberRole.Stranger
|
com.tencent.qqnt.kernel.nativeinterface.MemberRole.STRANGER -> MemberRole.Stranger
|
||||||
com.tencent.qqnt.kernel.nativeinterface.MemberRole.MEMBER -> MemberRole.Member
|
com.tencent.qqnt.kernel.nativeinterface.MemberRole.MEMBER -> MemberRole.Member
|
||||||
@ -641,30 +650,32 @@ internal object GroupSvc: BaseSvc() {
|
|||||||
qq: Long,
|
qq: Long,
|
||||||
timeout: Long = 5000L
|
timeout: Long = 5000L
|
||||||
): Result<MemberInfo> {
|
): Result<MemberInfo> {
|
||||||
val kernelService = NTServiceFetcher.kernelService
|
return runCatching {
|
||||||
val sessionService = kernelService.wrapperSession
|
val kernelService = NTServiceFetcher.kernelService
|
||||||
val groupService = sessionService.groupService
|
val sessionService = kernelService.wrapperSession
|
||||||
val info = withTimeoutOrNull(timeout) {
|
val groupService = sessionService.groupService
|
||||||
suspendCancellableCoroutine {
|
val info = withTimeoutOrNull(timeout) {
|
||||||
groupService.getTransferableMemberInfo(groupId.toLong()) { code, _, data ->
|
suspendCancellableCoroutine {
|
||||||
if (code != 0) {
|
groupService.getTransferableMemberInfo(groupId.toLong()) { code, _, data ->
|
||||||
it.resume(null)
|
if (code != 0) {
|
||||||
return@getTransferableMemberInfo
|
it.resume(null)
|
||||||
}
|
return@getTransferableMemberInfo
|
||||||
data.forEach { (_, info) ->
|
|
||||||
if (info.uin == qq) {
|
|
||||||
it.resume(info)
|
|
||||||
return@forEach
|
|
||||||
}
|
}
|
||||||
|
data.forEach { (_, info) ->
|
||||||
|
if (info.uin == qq) {
|
||||||
|
it.resume(info)
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it.resume(null)
|
||||||
}
|
}
|
||||||
it.resume(null)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return if (info != null) {
|
||||||
return if (info != null) {
|
Result.success(info)
|
||||||
Result.success(info)
|
} else {
|
||||||
} else {
|
Result.failure(Exception("获取群成员信息失败"))
|
||||||
Result.failure(Exception("获取群成员信息失败"))
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import com.tencent.qqnt.kernel.nativeinterface.IOperateCallback
|
|||||||
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant
|
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
|
import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.TempChatGameSession
|
import com.tencent.qqnt.kernel.nativeinterface.TempChatGameSession
|
||||||
|
import com.tencent.qqnt.kernel.nativeinterface.TempChatInfo
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.TempChatPrepareInfo
|
import com.tencent.qqnt.kernel.nativeinterface.TempChatPrepareInfo
|
||||||
import com.tencent.qqnt.msg.api.IMsgService
|
import com.tencent.qqnt.msg.api.IMsgService
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
@ -42,9 +43,12 @@ internal object MsgSvc: BaseSvc() {
|
|||||||
msgService.prepareTempChat(TempChatPrepareInfo(
|
msgService.prepareTempChat(TempChatPrepareInfo(
|
||||||
MsgConstant.KCHATTYPETEMPC2CFROMGROUP,
|
MsgConstant.KCHATTYPETEMPC2CFROMGROUP,
|
||||||
ContactHelper.getUidByUinAsync(peerId = peerId.toLong()),
|
ContactHelper.getUidByUinAsync(peerId = peerId.toLong()),
|
||||||
app.getRuntimeService(ITroopMemberNameService::class.java, "all")
|
app.getRuntimeService(ITroopMemberNameService::class.java, "all").getTroopMemberNameRemarkFirst(groupId, peerId),
|
||||||
.getTroopMemberNameRemarkFirst(groupId, peerId),
|
groupId,
|
||||||
groupId, EMPTY_BYTE_ARRAY, app.currentUid, "", TempChatGameSession()
|
EMPTY_BYTE_ARRAY,
|
||||||
|
app.currentUid,
|
||||||
|
"",
|
||||||
|
TempChatGameSession()
|
||||||
)) { code, reason ->
|
)) { code, reason ->
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
LogCenter.log("临时会话创建失败: $code, $reason", Level.ERROR)
|
LogCenter.log("临时会话创建失败: $code, $reason", Level.ERROR)
|
||||||
@ -53,6 +57,24 @@ internal object MsgSvc: BaseSvc() {
|
|||||||
return Result.success(Unit)
|
return Result.success(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getTempChatInfo(chatType: Int, uid: String): Result<TempChatInfo> {
|
||||||
|
val msgService = app.getRuntimeService(IKernelService::class.java, "all").msgService
|
||||||
|
?: return Result.failure(Exception("获取消息服务失败"))
|
||||||
|
val info: TempChatInfo = withTimeoutOrNull(5000) {
|
||||||
|
suspendCancellableCoroutine {
|
||||||
|
msgService.getTempChatInfo(chatType, uid) { code, msg, tempChatInfo ->
|
||||||
|
if (code == 0) {
|
||||||
|
it.resume(tempChatInfo)
|
||||||
|
} else {
|
||||||
|
LogCenter.log("获取临时会话信息失败: $code:$msg", Level.ERROR)
|
||||||
|
it.resume(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return Result.failure(Exception("获取临时会话信息失败"))
|
||||||
|
return Result.success(info)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正常获取
|
* 正常获取
|
||||||
*/
|
*/
|
||||||
@ -183,8 +205,8 @@ internal object MsgSvc: BaseSvc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val result = MessageHelper.sendMessageWithoutMsgId(chatType, peedId, message, fromId, MessageCallback(peedId, 0))
|
val result = MessageHelper.sendMessageWithoutMsgId(chatType, peedId, message, fromId, MessageCallback(peedId, 0))
|
||||||
result.onFailure {
|
if (result.isFailure) {
|
||||||
LogCenter.log("sendToAio: " + it.stackTraceToString(), Level.ERROR)
|
LogCenter.log("sendToAio: " + result.exceptionOrNull()?.stackTraceToString(), Level.ERROR)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
val sendResult = result.getOrThrow()
|
val sendResult = result.getOrThrow()
|
||||||
|
@ -6,6 +6,7 @@ import com.tencent.mobileqq.transfile.TransferRequest
|
|||||||
import moe.fuqiuluo.shamrock.utils.MD5
|
import moe.fuqiuluo.shamrock.utils.MD5
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import moe.fuqiuluo.qqinterface.servlet.transfile.ResourceType.*
|
import moe.fuqiuluo.qqinterface.servlet.transfile.ResourceType.*
|
||||||
|
import moe.fuqiuluo.shamrock.helper.TransfileHelper
|
||||||
|
|
||||||
internal object Transfer: FileTransfer() {
|
internal object Transfer: FileTransfer() {
|
||||||
private val ROUTE = mapOf<ContactType, Map<ResourceType, suspend TransTarget.(Resource) -> Boolean>>(
|
private val ROUTE = mapOf<ContactType, Map<ResourceType, suspend TransTarget.(Resource) -> Boolean>>(
|
||||||
@ -84,11 +85,14 @@ internal object Transfer: FileTransfer() {
|
|||||||
file: File,
|
file: File,
|
||||||
wait: Boolean = true
|
wait: Boolean = true
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return transC2CResource(peerId, file, FileMsg.TRANSFILE_TYPE_PIC, SEND_MSG_BUSINESS_TYPE_PIC_SHARE, wait) {
|
return transC2CResource(peerId, file, FileMsg.TRANSFILE_TYPE_PIC, SEND_MSG_BUSINESS_TYPE_PIC_CAMERA, wait) {
|
||||||
val picUpExtraInfo = TransferRequest.PicUpExtraInfo()
|
val picUpExtraInfo = TransferRequest.PicUpExtraInfo()
|
||||||
picUpExtraInfo.mIsRaw = true
|
picUpExtraInfo.mIsRaw = false
|
||||||
|
picUpExtraInfo.mUinType = FileMsg.UIN_BUDDY
|
||||||
it.mPicSendSource = 8
|
it.mPicSendSource = 8
|
||||||
it.mExtraObj = picUpExtraInfo
|
it.mExtraObj = picUpExtraInfo
|
||||||
|
it.mIsPresend = true
|
||||||
|
it.delayShowProgressTimeInMs = 2000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,10 +101,13 @@ internal object Transfer: FileTransfer() {
|
|||||||
file: File,
|
file: File,
|
||||||
wait: Boolean = true
|
wait: Boolean = true
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return transTroopResource(groupId, file, FileMsg.TRANSFILE_TYPE_PIC, SEND_MSG_BUSINESS_TYPE_PIC_SHARE, wait) {
|
return transTroopResource(groupId, file, FileMsg.TRANSFILE_TYPE_PIC, SEND_MSG_BUSINESS_TYPE_PIC_CAMERA, wait) {
|
||||||
val picUpExtraInfo = TransferRequest.PicUpExtraInfo()
|
val picUpExtraInfo = TransferRequest.PicUpExtraInfo()
|
||||||
picUpExtraInfo.mIsRaw = true
|
//picUpExtraInfo.mIsRaw = !TransfileHelper.isGifFile(file)
|
||||||
|
picUpExtraInfo.mIsRaw = false
|
||||||
|
picUpExtraInfo.mUinType = FileMsg.UIN_TROOP
|
||||||
it.mPicSendSource = 8
|
it.mPicSendSource = 8
|
||||||
|
it.delayShowProgressTimeInMs = 2000
|
||||||
it.mExtraObj = picUpExtraInfo
|
it.mExtraObj = picUpExtraInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package moe.fuqiuluo.shamrock.helper
|
package moe.fuqiuluo.shamrock.helper
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.RandomAccessFile
|
||||||
|
|
||||||
internal object TransfileHelper {
|
internal object TransfileHelper {
|
||||||
private val extensionMap = mapOf(
|
private val extensionMap = mapOf(
|
||||||
@ -94,4 +96,15 @@ internal object TransfileHelper {
|
|||||||
val extension = name.substring(index)
|
val extension = name.substring(index)
|
||||||
return extensionMap[extension] ?: -1
|
return extensionMap[extension] ?: -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isGifFile(picFile: File): Boolean {
|
||||||
|
if (picFile.exists() && picFile.length() > 3) {
|
||||||
|
return RandomAccessFile(picFile, "r").use {
|
||||||
|
val bArr = ByteArray(3)
|
||||||
|
it.read(bArr)
|
||||||
|
if (bArr[0].toInt() == 71 && bArr[1].toInt() == 73 && bArr[2].toInt() == 70) { return true } else false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
@ -114,7 +114,9 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
rawMsg: String,
|
rawMsg: String,
|
||||||
msgHash: Int,
|
msgHash: Int,
|
||||||
postType: PostType,
|
postType: PostType,
|
||||||
tempSource: MessageTempSource = MessageTempSource.Unknown
|
tempSource: MessageTempSource = MessageTempSource.Unknown,
|
||||||
|
groupId: Long = Long.MIN_VALUE,
|
||||||
|
fromNick: String? = null
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val botUin = app.longAccountUin
|
val botUin = app.longAccountUin
|
||||||
var nickName = record.sendNickName
|
var nickName = record.sendNickName
|
||||||
@ -148,7 +150,9 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
title = "",
|
title = "",
|
||||||
level = "",
|
level = "",
|
||||||
),
|
),
|
||||||
tmpSource = tempSource.id
|
tmpSource = tempSource.id,
|
||||||
|
groupId = groupId,
|
||||||
|
fromNickName = fromNick
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return true
|
return true
|
||||||
|
@ -52,10 +52,10 @@ internal data class MessageEvent (
|
|||||||
@SerialName("message_type") val messageType: MsgType,
|
@SerialName("message_type") val messageType: MsgType,
|
||||||
@SerialName("sub_type") val subType: MsgSubType,
|
@SerialName("sub_type") val subType: MsgSubType,
|
||||||
@SerialName("message_id") val messageId: Int,
|
@SerialName("message_id") val messageId: Int,
|
||||||
@SerialName("group_id") val groupId: Long = 0,
|
@SerialName("group_id") val groupId: Long = Long.MIN_VALUE,
|
||||||
@SerialName("guild_id") val guildId: String? = null,
|
@SerialName("guild_id") val guildId: String? = null,
|
||||||
@SerialName("channel_id") val channelId: String? = null,
|
@SerialName("channel_id") val channelId: String? = null,
|
||||||
@SerialName("target_id") val targetId: Long = 0,
|
@SerialName("target_id") val targetId: Long = Long.MIN_VALUE,
|
||||||
@SerialName("peer_id") val peerId: Long,
|
@SerialName("peer_id") val peerId: Long,
|
||||||
@SerialName("user_id") val userId: Long,
|
@SerialName("user_id") val userId: Long,
|
||||||
@SerialName("anonymous") val anonymous: Anonymous? = null,
|
@SerialName("anonymous") val anonymous: Anonymous? = null,
|
||||||
@ -63,7 +63,8 @@ internal data class MessageEvent (
|
|||||||
@SerialName("raw_message") val rawMessage: String,
|
@SerialName("raw_message") val rawMessage: String,
|
||||||
@SerialName("font") val font: Int,
|
@SerialName("font") val font: Int,
|
||||||
@SerialName("sender") val sender: Sender,
|
@SerialName("sender") val sender: Sender,
|
||||||
@SerialName("temp_source") val tmpSource: Int = -1
|
@SerialName("temp_source") val tmpSource: Int = Int.MIN_VALUE,
|
||||||
|
@SerialName("from_nick") val fromNickName: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class MessageTempSource(val id: Int) {
|
enum class MessageTempSource(val id: Int) {
|
||||||
|
@ -7,6 +7,7 @@ import com.tencent.qqnt.kernel.nativeinterface.*
|
|||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import moe.fuqiuluo.qqinterface.servlet.MsgSvc
|
||||||
import moe.fuqiuluo.qqinterface.servlet.TicketSvc
|
import moe.fuqiuluo.qqinterface.servlet.TicketSvc
|
||||||
import moe.fuqiuluo.qqinterface.servlet.msg.convert.toCQCode
|
import moe.fuqiuluo.qqinterface.servlet.msg.convert.toCQCode
|
||||||
import moe.fuqiuluo.qqinterface.servlet.transfile.RichProtoSvc
|
import moe.fuqiuluo.qqinterface.servlet.transfile.RichProtoSvc
|
||||||
@ -113,19 +114,29 @@ internal object AioListener : IKernelMsgListener {
|
|||||||
MsgConstant.KCHATTYPETEMPC2CFROMGROUP -> {
|
MsgConstant.KCHATTYPETEMPC2CFROMGROUP -> {
|
||||||
if (!ShamrockConfig.allowTempSession()) return
|
if (!ShamrockConfig.allowTempSession()) return
|
||||||
|
|
||||||
LogCenter.log("私聊临时消息(private = ${record.senderUin}, id = $msgHash, msg = $rawMsg)")
|
|
||||||
ShamrockConfig.getPrivateRule()?.let { rule ->
|
ShamrockConfig.getPrivateRule()?.let { rule ->
|
||||||
if (!rule.black.isNullOrEmpty() && rule.black.contains(record.senderUin)) return
|
if (!rule.black.isNullOrEmpty() && rule.black.contains(record.senderUin)) return
|
||||||
if (!rule.white.isNullOrEmpty() && !rule.white.contains(record.senderUin)) return
|
if (!rule.white.isNullOrEmpty() && !rule.white.contains(record.senderUin)) return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var groupCode = 0L
|
||||||
|
var fromNick = ""
|
||||||
|
MsgSvc.getTempChatInfo(record.chatType, record.senderUid).onSuccess {
|
||||||
|
groupCode = it.groupCode.toLong()
|
||||||
|
fromNick = it.fromNick
|
||||||
|
}
|
||||||
|
|
||||||
|
LogCenter.log("私聊临时消息(private = ${record.senderUin}, groupId=$groupCode, id = $msgHash, msg = $rawMsg)")
|
||||||
|
|
||||||
if (!GlobalEventTransmitter.MessageTransmitter.transPrivateMessage(
|
if (!GlobalEventTransmitter.MessageTransmitter.transPrivateMessage(
|
||||||
record,
|
record,
|
||||||
record.elements,
|
record.elements,
|
||||||
rawMsg,
|
rawMsg,
|
||||||
msgHash,
|
msgHash,
|
||||||
tempSource = MessageTempSource.Group,
|
tempSource = MessageTempSource.Group,
|
||||||
postType = postType
|
postType = postType,
|
||||||
|
groupId = groupCode,
|
||||||
|
fromNick = fromNick
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
LogCenter.log("私聊临时消息推送失败 -> MessageTransmitter", Level.WARN)
|
LogCenter.log("私聊临时消息推送失败 -> MessageTransmitter", Level.WARN)
|
||||||
|
@ -138,16 +138,18 @@ internal class XposedEntry: IXposedHookLoadPackage {
|
|||||||
MMKVFetcher.initMMKV(ctx)
|
MMKVFetcher.initMMKV(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShamrockConfig.forbidUselessProcess()) {
|
runCatching {
|
||||||
if(uselessProcess.any {
|
if (ShamrockConfig.forbidUselessProcess()) {
|
||||||
processName.contains(it, ignoreCase = true)
|
if(uselessProcess.any {
|
||||||
}) {
|
processName.contains(it, ignoreCase = true)
|
||||||
log("[Shamrock] Useless process detected: $processName, exit.")
|
}) {
|
||||||
Process.killProcess(Process.myPid())
|
log("[Shamrock] Useless process detected: $processName, exit.")
|
||||||
exitProcess(0)
|
Process.killProcess(Process.myPid())
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log("[Shamrock] Useless process detection is disabled.")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log("[Shamrock] Useless process detection is disabled.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Process Name = $processName")
|
log("Process Name = $processName")
|
||||||
|
@ -2,24 +2,17 @@ package moe.fuqiuluo.shamrock.xposed.helper
|
|||||||
|
|
||||||
import com.tencent.qqnt.kernel.api.IKernelService
|
import com.tencent.qqnt.kernel.api.IKernelService
|
||||||
import com.tencent.qqnt.kernel.api.impl.MsgService
|
import com.tencent.qqnt.kernel.api.impl.MsgService
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IKernelGroupService
|
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IKernelGuildService
|
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IOperateCallback
|
import com.tencent.qqnt.kernel.nativeinterface.IOperateCallback
|
||||||
import com.tencent.qqnt.kernel.nativeinterface.IQQNTWrapperSession
|
import com.tencent.qqnt.kernel.nativeinterface.IQQNTWrapperSession
|
||||||
import de.robv.android.xposed.XC_MethodHook
|
|
||||||
import de.robv.android.xposed.XposedBridge
|
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import moe.fuqiuluo.shamrock.helper.Level
|
import moe.fuqiuluo.shamrock.helper.Level
|
||||||
import moe.fuqiuluo.shamrock.helper.LogCenter
|
import moe.fuqiuluo.shamrock.helper.LogCenter
|
||||||
import moe.fuqiuluo.shamrock.remote.service.PacketReceiver
|
import moe.fuqiuluo.shamrock.remote.service.PacketReceiver
|
||||||
import moe.fuqiuluo.shamrock.remote.service.listener.AioListener
|
import moe.fuqiuluo.shamrock.remote.service.listener.AioListener
|
||||||
import moe.fuqiuluo.shamrock.remote.service.listener.GroupEventListener
|
|
||||||
import moe.fuqiuluo.shamrock.remote.service.listener.KernelGuildListener
|
|
||||||
import moe.fuqiuluo.shamrock.remote.service.listener.PrimitiveListener
|
import moe.fuqiuluo.shamrock.remote.service.listener.PrimitiveListener
|
||||||
import moe.fuqiuluo.shamrock.tools.hookMethod
|
import moe.fuqiuluo.shamrock.tools.hookMethod
|
||||||
import moe.fuqiuluo.shamrock.utils.PlatformUtils
|
import moe.fuqiuluo.shamrock.utils.PlatformUtils
|
||||||
import kotlin.reflect.jvm.javaMethod
|
|
||||||
|
|
||||||
internal object NTServiceFetcher {
|
internal object NTServiceFetcher {
|
||||||
private lateinit var iKernelService: IKernelService
|
private lateinit var iKernelService: IKernelService
|
||||||
@ -30,7 +23,7 @@ internal object NTServiceFetcher {
|
|||||||
lock.withLock {
|
lock.withLock {
|
||||||
val msgService = service.msgService ?: return
|
val msgService = service.msgService ?: return
|
||||||
val sessionService = service.wrapperSession ?: return
|
val sessionService = service.wrapperSession ?: return
|
||||||
val groupService = sessionService.groupService ?: return
|
//val groupService = sessionService.groupService ?: return
|
||||||
|
|
||||||
val curHash = service.hashCode() + msgService.hashCode()
|
val curHash = service.hashCode() + msgService.hashCode()
|
||||||
if (isInitForNt(curHash)) return
|
if (isInitForNt(curHash)) return
|
||||||
@ -43,7 +36,7 @@ internal object NTServiceFetcher {
|
|||||||
this.iKernelService = service
|
this.iKernelService = service
|
||||||
|
|
||||||
|
|
||||||
initNTKernelListener(msgService, groupService)
|
initNTKernelListener(msgService)
|
||||||
antiBackgroundMode(sessionService)
|
antiBackgroundMode(sessionService)
|
||||||
//hookGuildListener(sessionService)
|
//hookGuildListener(sessionService)
|
||||||
}
|
}
|
||||||
@ -66,7 +59,7 @@ internal object NTServiceFetcher {
|
|||||||
return hash == curKernelHash
|
return hash == curKernelHash
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initNTKernelListener(msgService: MsgService, groupService: IKernelGroupService) {
|
private fun initNTKernelListener(msgService: MsgService) {
|
||||||
if (!PlatformUtils.isMainProcess()) return
|
if (!PlatformUtils.isMainProcess()) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user