mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: fix #150
This commit is contained in:
parent
8d6d984849
commit
b9cfe73eae
@ -138,12 +138,12 @@ char * __cdecl my_strstr(const char *lhs, const char *rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int fake_memcmp(const void* __lhs, const void* __rhs, size_t __n) {
|
int fake_memcmp(const void* __lhs, const void* __rhs, size_t __n) {
|
||||||
if (my_strstr((const char*) __rhs, "lsposed")) {
|
//if (my_strstr((const char*) __rhs, "lsposed")) {
|
||||||
return -1;
|
//return -1;
|
||||||
}
|
//}
|
||||||
if (my_strstr((const char*) __rhs, "xposed")) {
|
//if (my_strstr((const char*) __rhs, "xposed")) {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
//}
|
||||||
if (my_strstr((const char*) __rhs, "shamrock")) {
|
if (my_strstr((const char*) __rhs, "shamrock")) {
|
||||||
if (backup_memcmp(__lhs, __rhs, __n) == 0) {
|
if (backup_memcmp(__lhs, __rhs, __n) == 0) {
|
||||||
// 底层广播判断
|
// 底层广播判断
|
||||||
@ -154,12 +154,12 @@ int fake_memcmp(const void* __lhs, const void* __rhs, size_t __n) {
|
|||||||
if (my_strstr((const char*) __rhs, "riru")) {
|
if (my_strstr((const char*) __rhs, "riru")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (my_strstr((const char*) __rhs, "zygisk")) {
|
//if (my_strstr((const char*) __rhs, "zygisk")) {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
//}
|
||||||
if (my_strstr((const char*) __rhs, "magisk")) {
|
//if (my_strstr((const char*) __rhs, "magisk")) {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
//}
|
||||||
return backup_memcmp(__lhs, __rhs, __n);
|
return backup_memcmp(__lhs, __rhs, __n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +264,10 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
suspend fun transGroupMemberNumChanged(
|
suspend fun transGroupMemberNumChanged(
|
||||||
time: Long,
|
time: Long,
|
||||||
target: Long,
|
target: Long,
|
||||||
|
targetUid: String,
|
||||||
groupCode: Long,
|
groupCode: Long,
|
||||||
operation: Long,
|
operator: Long,
|
||||||
|
operatorUid: String,
|
||||||
noticeType: NoticeType,
|
noticeType: NoticeType,
|
||||||
noticeSubType: NoticeSubType
|
noticeSubType: NoticeSubType
|
||||||
): Boolean {
|
): Boolean {
|
||||||
@ -275,11 +277,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
postType = PostType.Notice,
|
postType = PostType.Notice,
|
||||||
type = noticeType,
|
type = noticeType,
|
||||||
subType = noticeSubType,
|
subType = noticeSubType,
|
||||||
operatorId = operation,
|
operatorId = operator,
|
||||||
userId = target,
|
userId = target,
|
||||||
senderId = operation,
|
senderId = operator,
|
||||||
target = target,
|
target = target,
|
||||||
groupId = groupCode
|
groupId = groupCode,
|
||||||
|
targetUid = targetUid,
|
||||||
|
operatorUid = operatorUid,
|
||||||
|
userUid = targetUid
|
||||||
))
|
))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -287,6 +292,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
suspend fun transGroupAdminChanged(
|
suspend fun transGroupAdminChanged(
|
||||||
msgTime: Long,
|
msgTime: Long,
|
||||||
target: Long,
|
target: Long,
|
||||||
|
targetUid: String,
|
||||||
groupCode: Long,
|
groupCode: Long,
|
||||||
setAdmin: Boolean
|
setAdmin: Boolean
|
||||||
): Boolean {
|
): Boolean {
|
||||||
@ -298,6 +304,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet,
|
subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet,
|
||||||
operatorId = 0,
|
operatorId = 0,
|
||||||
target = target,
|
target = target,
|
||||||
|
targetUid = targetUid,
|
||||||
groupId = groupCode
|
groupId = groupCode
|
||||||
))
|
))
|
||||||
return true
|
return true
|
||||||
@ -306,8 +313,10 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
suspend fun transGroupBan(
|
suspend fun transGroupBan(
|
||||||
msgTime: Long,
|
msgTime: Long,
|
||||||
subType: NoticeSubType,
|
subType: NoticeSubType,
|
||||||
operation: Long,
|
operator: Long,
|
||||||
|
operatorUid: String,
|
||||||
target: Long,
|
target: Long,
|
||||||
|
targetUid: String,
|
||||||
groupCode: Long,
|
groupCode: Long,
|
||||||
duration: Int
|
duration: Int
|
||||||
): Boolean {
|
): Boolean {
|
||||||
@ -317,12 +326,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
|||||||
postType = PostType.Notice,
|
postType = PostType.Notice,
|
||||||
type = NoticeType.GroupBan,
|
type = NoticeType.GroupBan,
|
||||||
subType = subType,
|
subType = subType,
|
||||||
operatorId = operation,
|
operatorId = operator,
|
||||||
userId = target,
|
userId = target,
|
||||||
senderId = operation,
|
senderId = operator,
|
||||||
target = target,
|
target = target,
|
||||||
groupId = groupCode,
|
groupId = groupCode,
|
||||||
duration = duration
|
duration = duration,
|
||||||
|
operatorUid = operatorUid,
|
||||||
|
targetUid = targetUid
|
||||||
))
|
))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -67,14 +67,20 @@ internal data class NoticeEvent(
|
|||||||
@SerialName("post_type") val postType: PostType,
|
@SerialName("post_type") val postType: PostType,
|
||||||
@SerialName("notice_type") val type: NoticeType,
|
@SerialName("notice_type") val type: NoticeType,
|
||||||
@SerialName("sub_type") val subType: NoticeSubType = NoticeSubType.None,
|
@SerialName("sub_type") val subType: NoticeSubType = NoticeSubType.None,
|
||||||
@SerialName("group_id") val groupId: Long = -1,
|
@SerialName("group_id") val groupId: Long = Long.MIN_VALUE,
|
||||||
@SerialName("operator_id") val operatorId: Long = -1,
|
@SerialName("operator_id") val operatorId: Long = Long.MIN_VALUE,
|
||||||
@SerialName("user_id") val userId: Long = -1,
|
@SerialName("operator_uid") val operatorUid: String = "",
|
||||||
@SerialName("sender_id") val senderId: Long = -1,
|
@SerialName("user_id") val userId: Long = Long.MIN_VALUE,
|
||||||
@SerialName("duration") val duration: Int = -1,
|
@SerialName("user_uid") val userUid: String = "",
|
||||||
@SerialName("message_id") val msgId: Int = -1,
|
@SerialName("sender_id") val senderId: Long = Long.MIN_VALUE,
|
||||||
|
@SerialName("duration") val duration: Int = Int.MIN_VALUE,
|
||||||
|
@SerialName("message_id") val msgId: Int = Int.MIN_VALUE,
|
||||||
@SerialName("tip_text") val tip: String = "",
|
@SerialName("tip_text") val tip: String = "",
|
||||||
@SerialName("target_id") val target: Long = -1,
|
|
||||||
|
@SerialName("target_id") val target: Long = Long.MIN_VALUE,
|
||||||
|
@SerialName("target_uid") val targetUid: String = "",
|
||||||
|
|
||||||
|
|
||||||
@SerialName("file") val file: GroupFileMsg? = null,
|
@SerialName("file") val file: GroupFileMsg? = null,
|
||||||
@SerialName("private_file") val privateFile: PrivateFileMsg? = null,
|
@SerialName("private_file") val privateFile: PrivateFileMsg? = null,
|
||||||
@SerialName("flag") val flag: String? = null,
|
@SerialName("flag") val flag: String? = null,
|
||||||
|
@ -14,6 +14,7 @@ import kotlinx.serialization.json.Json
|
|||||||
import kotlinx.serialization.json.JsonElement
|
import kotlinx.serialization.json.JsonElement
|
||||||
import moe.fuqiuluo.proto.*
|
import moe.fuqiuluo.proto.*
|
||||||
import moe.fuqiuluo.qqinterface.servlet.FriendSvc.requestFriendSystemMsgNew
|
import moe.fuqiuluo.qqinterface.servlet.FriendSvc.requestFriendSystemMsgNew
|
||||||
|
import moe.fuqiuluo.qqinterface.servlet.GroupSvc
|
||||||
import moe.fuqiuluo.qqinterface.servlet.GroupSvc.requestGroupSystemMsgNew
|
import moe.fuqiuluo.qqinterface.servlet.GroupSvc.requestGroupSystemMsgNew
|
||||||
import moe.fuqiuluo.qqinterface.servlet.TicketSvc.getLongUin
|
import moe.fuqiuluo.qqinterface.servlet.TicketSvc.getLongUin
|
||||||
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
||||||
@ -302,11 +303,10 @@ internal object PrimitiveListener {
|
|||||||
LogCenter.log("onGroupPokeAndGroupSign error: ${e.stackTraceToString()}", Level.WARN)
|
LogCenter.log("onGroupPokeAndGroupSign error: ${e.stackTraceToString()}", Level.WARN)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var groupId:Long
|
val groupId = try {
|
||||||
try {
|
detail[4].asULong
|
||||||
groupId = detail[4].asULong
|
|
||||||
}catch (e: ClassCastException){
|
}catch (e: ClassCastException){
|
||||||
groupId = detail[4].asList.value[0].asULong
|
detail[4].asList.value[0].asULong
|
||||||
}
|
}
|
||||||
|
|
||||||
detail = if (detail[26] is ProtoList) {
|
detail = if (detail[26] is ProtoList) {
|
||||||
@ -392,13 +392,21 @@ internal object PrimitiveListener {
|
|||||||
val groupCode = pb[1, 3, 2, 1].asULong
|
val groupCode = pb[1, 3, 2, 1].asULong
|
||||||
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
||||||
val type = pb[1, 3, 2, 4].asInt
|
val type = pb[1, 3, 2, 4].asInt
|
||||||
val operation = ContactHelper.getUinByUidAsync(pb[1, 3, 2, 5].asUtf8String).toLong()
|
|
||||||
|
GroupSvc.getGroupMemberList(groupCode.toString(), true).onFailure {
|
||||||
|
LogCenter.log("新成员加入刷新群成员列表失败: $groupCode", Level.WARN)
|
||||||
|
}.onSuccess {
|
||||||
|
LogCenter.log("新成员加入刷新群成员列表成功,群成员数量: ${it.size}", Level.INFO)
|
||||||
|
}
|
||||||
|
|
||||||
|
val operatorUid = pb[1, 3, 2, 5].asUtf8String
|
||||||
|
val operator = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
||||||
val target = ContactHelper.getUinByUidAsync(targetUid).toLong()
|
val target = ContactHelper.getUinByUidAsync(targetUid).toLong()
|
||||||
LogCenter.log("群成员增加($groupCode): $target, type = $type")
|
LogCenter.log("群成员增加($groupCode): $target, type = $type")
|
||||||
|
|
||||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||||
.transGroupMemberNumChanged(
|
.transGroupMemberNumChanged(
|
||||||
time, target, groupCode, operation, NoticeType.GroupMemIncrease, when (type) {
|
time, target, targetUid, groupCode, operator, operatorUid, NoticeType.GroupMemIncrease, when (type) {
|
||||||
130 -> NoticeSubType.Approve
|
130 -> NoticeSubType.Approve
|
||||||
131 -> NoticeSubType.Invite
|
131 -> NoticeSubType.Invite
|
||||||
else -> NoticeSubType.Approve
|
else -> NoticeSubType.Approve
|
||||||
@ -413,11 +421,19 @@ internal object PrimitiveListener {
|
|||||||
val groupCode = pb[1, 3, 2, 1].asULong
|
val groupCode = pb[1, 3, 2, 1].asULong
|
||||||
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
||||||
val type = pb[1, 3, 2, 4].asInt
|
val type = pb[1, 3, 2, 4].asInt
|
||||||
val operation = try {
|
val operatorUid = try {
|
||||||
ContactHelper.getUinByUidAsync(pb[1, 3, 2, 5, 1, 1].asUtf8String).toLong()
|
pb[1, 3, 2, 5, 1, 1].asUtf8String
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
ContactHelper.getUinByUidAsync(pb[1, 3, 2, 5].asUtf8String).toLong()
|
pb[1, 3, 2, 5].asUtf8String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GroupSvc.getGroupMemberList(groupCode.toString(), true).onFailure {
|
||||||
|
LogCenter.log("新成员加入刷新群成员列表失败: $groupCode", Level.WARN)
|
||||||
|
}.onSuccess {
|
||||||
|
LogCenter.log("新成员加入刷新群成员列表成功,群成员数量: ${it.size}", Level.INFO)
|
||||||
|
}
|
||||||
|
|
||||||
|
val operator = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
||||||
val target = ContactHelper.getUinByUidAsync(targetUid).toLong()
|
val target = ContactHelper.getUinByUidAsync(targetUid).toLong()
|
||||||
val subtype = when (type) {
|
val subtype = when (type) {
|
||||||
130 -> NoticeSubType.Leave
|
130 -> NoticeSubType.Leave
|
||||||
@ -431,7 +447,7 @@ internal object PrimitiveListener {
|
|||||||
LogCenter.log("群成员减少($groupCode): $target, type = $subtype ($type)")
|
LogCenter.log("群成员减少($groupCode): $target, type = $subtype ($type)")
|
||||||
|
|
||||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||||
.transGroupMemberNumChanged(time, target, groupCode, operation, NoticeType.GroupMemDecrease, subtype)
|
.transGroupMemberNumChanged(time, target, targetUid, groupCode, operator, operatorUid, NoticeType.GroupMemDecrease, subtype)
|
||||||
) {
|
) {
|
||||||
LogCenter.log("群成员减少推送失败!", Level.WARN)
|
LogCenter.log("群成员减少推送失败!", Level.WARN)
|
||||||
}
|
}
|
||||||
@ -452,7 +468,7 @@ internal object PrimitiveListener {
|
|||||||
LogCenter.log("群管理员变动($groupCode): $target, isSetAdmin = $isSetAdmin")
|
LogCenter.log("群管理员变动($groupCode): $target, isSetAdmin = $isSetAdmin")
|
||||||
|
|
||||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||||
.transGroupAdminChanged(msgTime, target, groupCode, isSetAdmin)
|
.transGroupAdminChanged(msgTime, target, targetUid, groupCode, isSetAdmin)
|
||||||
) {
|
) {
|
||||||
LogCenter.log("群管理员变动推送失败!", Level.WARN)
|
LogCenter.log("群管理员变动推送失败!", Level.WARN)
|
||||||
}
|
}
|
||||||
@ -465,18 +481,18 @@ internal object PrimitiveListener {
|
|||||||
val targetUid = if (wholeBan) "" else pb[1, 3, 2, 5, 3, 1].asUtf8String
|
val targetUid = if (wholeBan) "" else pb[1, 3, 2, 5, 3, 1].asUtf8String
|
||||||
val rawDuration = pb[1, 3, 2, 5, 3, 2].asInt
|
val rawDuration = pb[1, 3, 2, 5, 3, 2].asInt
|
||||||
|
|
||||||
val operation = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
val operator = ContactHelper.getUinByUidAsync(operatorUid).toLong()
|
||||||
val duration = if (wholeBan) -1 else rawDuration
|
val duration = if (wholeBan) -1 else rawDuration
|
||||||
val target = if (wholeBan) 0 else ContactHelper.getUinByUidAsync(targetUid).toLong()
|
val target = if (wholeBan) 0 else ContactHelper.getUinByUidAsync(targetUid).toLong()
|
||||||
val subType = if (rawDuration == 0) NoticeSubType.LiftBan else NoticeSubType.Ban
|
val subType = if (rawDuration == 0) NoticeSubType.LiftBan else NoticeSubType.Ban
|
||||||
|
|
||||||
if (wholeBan) {
|
if (wholeBan) {
|
||||||
LogCenter.log("群全员禁言($groupCode): $operation -> ${if (subType == NoticeSubType.Ban) "开启" else "关闭"}")
|
LogCenter.log("群全员禁言($groupCode): $operator -> ${if (subType == NoticeSubType.Ban) "开启" else "关闭"}")
|
||||||
} else {
|
} else {
|
||||||
LogCenter.log("群禁言($groupCode): $operation -> $target, 时长 = ${duration}s")
|
LogCenter.log("群禁言($groupCode): $operator -> $target, 时长 = ${duration}s")
|
||||||
}
|
}
|
||||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||||
.transGroupBan(msgTime, subType, operation, target, groupCode, duration)
|
.transGroupBan(msgTime, subType, operator, operatorUid, target, targetUid, groupCode, duration)
|
||||||
) {
|
) {
|
||||||
LogCenter.log("群禁言推送失败!", Level.WARN)
|
LogCenter.log("群禁言推送失败!", Level.WARN)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user