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) {
|
||||
if (my_strstr((const char*) __rhs, "lsposed")) {
|
||||
return -1;
|
||||
}
|
||||
if (my_strstr((const char*) __rhs, "xposed")) {
|
||||
return -1;
|
||||
}
|
||||
//if (my_strstr((const char*) __rhs, "lsposed")) {
|
||||
//return -1;
|
||||
//}
|
||||
//if (my_strstr((const char*) __rhs, "xposed")) {
|
||||
// return -1;
|
||||
//}
|
||||
if (my_strstr((const char*) __rhs, "shamrock")) {
|
||||
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")) {
|
||||
return -1;
|
||||
}
|
||||
if (my_strstr((const char*) __rhs, "zygisk")) {
|
||||
return -1;
|
||||
}
|
||||
if (my_strstr((const char*) __rhs, "magisk")) {
|
||||
return -1;
|
||||
}
|
||||
//if (my_strstr((const char*) __rhs, "zygisk")) {
|
||||
// return -1;
|
||||
//}
|
||||
//if (my_strstr((const char*) __rhs, "magisk")) {
|
||||
// return -1;
|
||||
//}
|
||||
return backup_memcmp(__lhs, __rhs, __n);
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,10 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
suspend fun transGroupMemberNumChanged(
|
||||
time: Long,
|
||||
target: Long,
|
||||
targetUid: String,
|
||||
groupCode: Long,
|
||||
operation: Long,
|
||||
operator: Long,
|
||||
operatorUid: String,
|
||||
noticeType: NoticeType,
|
||||
noticeSubType: NoticeSubType
|
||||
): Boolean {
|
||||
@ -275,11 +277,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
postType = PostType.Notice,
|
||||
type = noticeType,
|
||||
subType = noticeSubType,
|
||||
operatorId = operation,
|
||||
operatorId = operator,
|
||||
userId = target,
|
||||
senderId = operation,
|
||||
senderId = operator,
|
||||
target = target,
|
||||
groupId = groupCode
|
||||
groupId = groupCode,
|
||||
targetUid = targetUid,
|
||||
operatorUid = operatorUid,
|
||||
userUid = targetUid
|
||||
))
|
||||
return true
|
||||
}
|
||||
@ -287,6 +292,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
suspend fun transGroupAdminChanged(
|
||||
msgTime: Long,
|
||||
target: Long,
|
||||
targetUid: String,
|
||||
groupCode: Long,
|
||||
setAdmin: Boolean
|
||||
): Boolean {
|
||||
@ -298,6 +304,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
subType = if (setAdmin) NoticeSubType.Set else NoticeSubType.UnSet,
|
||||
operatorId = 0,
|
||||
target = target,
|
||||
targetUid = targetUid,
|
||||
groupId = groupCode
|
||||
))
|
||||
return true
|
||||
@ -306,8 +313,10 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
suspend fun transGroupBan(
|
||||
msgTime: Long,
|
||||
subType: NoticeSubType,
|
||||
operation: Long,
|
||||
operator: Long,
|
||||
operatorUid: String,
|
||||
target: Long,
|
||||
targetUid: String,
|
||||
groupCode: Long,
|
||||
duration: Int
|
||||
): Boolean {
|
||||
@ -317,12 +326,14 @@ internal object GlobalEventTransmitter: BaseSvc() {
|
||||
postType = PostType.Notice,
|
||||
type = NoticeType.GroupBan,
|
||||
subType = subType,
|
||||
operatorId = operation,
|
||||
operatorId = operator,
|
||||
userId = target,
|
||||
senderId = operation,
|
||||
senderId = operator,
|
||||
target = target,
|
||||
groupId = groupCode,
|
||||
duration = duration
|
||||
duration = duration,
|
||||
operatorUid = operatorUid,
|
||||
targetUid = targetUid
|
||||
))
|
||||
return true
|
||||
}
|
||||
|
@ -67,14 +67,20 @@ internal data class NoticeEvent(
|
||||
@SerialName("post_type") val postType: PostType,
|
||||
@SerialName("notice_type") val type: NoticeType,
|
||||
@SerialName("sub_type") val subType: NoticeSubType = NoticeSubType.None,
|
||||
@SerialName("group_id") val groupId: Long = -1,
|
||||
@SerialName("operator_id") val operatorId: Long = -1,
|
||||
@SerialName("user_id") val userId: Long = -1,
|
||||
@SerialName("sender_id") val senderId: Long = -1,
|
||||
@SerialName("duration") val duration: Int = -1,
|
||||
@SerialName("message_id") val msgId: Int = -1,
|
||||
@SerialName("group_id") val groupId: Long = Long.MIN_VALUE,
|
||||
@SerialName("operator_id") val operatorId: Long = Long.MIN_VALUE,
|
||||
@SerialName("operator_uid") val operatorUid: String = "",
|
||||
@SerialName("user_id") val userId: Long = Long.MIN_VALUE,
|
||||
@SerialName("user_uid") val userUid: String = "",
|
||||
@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("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("private_file") val privateFile: PrivateFileMsg? = null,
|
||||
@SerialName("flag") val flag: String? = null,
|
||||
@ -92,7 +98,7 @@ internal data class NoticeEvent(
|
||||
// 群打卡
|
||||
@SerialName("sign_detail") val signDetail: SignDetail? = null,
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* 不要使用继承的方式实现通用字段,那样会很难维护!
|
||||
|
@ -14,6 +14,7 @@ import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import moe.fuqiuluo.proto.*
|
||||
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.TicketSvc.getLongUin
|
||||
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
||||
@ -302,11 +303,10 @@ internal object PrimitiveListener {
|
||||
LogCenter.log("onGroupPokeAndGroupSign error: ${e.stackTraceToString()}", Level.WARN)
|
||||
}
|
||||
}
|
||||
var groupId:Long
|
||||
try {
|
||||
groupId = detail[4].asULong
|
||||
val groupId = try {
|
||||
detail[4].asULong
|
||||
}catch (e: ClassCastException){
|
||||
groupId = detail[4].asList.value[0].asULong
|
||||
detail[4].asList.value[0].asULong
|
||||
}
|
||||
|
||||
detail = if (detail[26] is ProtoList) {
|
||||
@ -392,13 +392,21 @@ internal object PrimitiveListener {
|
||||
val groupCode = pb[1, 3, 2, 1].asULong
|
||||
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
||||
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()
|
||||
LogCenter.log("群成员增加($groupCode): $target, type = $type")
|
||||
|
||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||
.transGroupMemberNumChanged(
|
||||
time, target, groupCode, operation, NoticeType.GroupMemIncrease, when (type) {
|
||||
time, target, targetUid, groupCode, operator, operatorUid, NoticeType.GroupMemIncrease, when (type) {
|
||||
130 -> NoticeSubType.Approve
|
||||
131 -> NoticeSubType.Invite
|
||||
else -> NoticeSubType.Approve
|
||||
@ -413,11 +421,19 @@ internal object PrimitiveListener {
|
||||
val groupCode = pb[1, 3, 2, 1].asULong
|
||||
val targetUid = pb[1, 3, 2, 3].asUtf8String
|
||||
val type = pb[1, 3, 2, 4].asInt
|
||||
val operation = try {
|
||||
ContactHelper.getUinByUidAsync(pb[1, 3, 2, 5, 1, 1].asUtf8String).toLong()
|
||||
val operatorUid = try {
|
||||
pb[1, 3, 2, 5, 1, 1].asUtf8String
|
||||
} 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 subtype = when (type) {
|
||||
130 -> NoticeSubType.Leave
|
||||
@ -431,7 +447,7 @@ internal object PrimitiveListener {
|
||||
LogCenter.log("群成员减少($groupCode): $target, type = $subtype ($type)")
|
||||
|
||||
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)
|
||||
}
|
||||
@ -452,7 +468,7 @@ internal object PrimitiveListener {
|
||||
LogCenter.log("群管理员变动($groupCode): $target, isSetAdmin = $isSetAdmin")
|
||||
|
||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||
.transGroupAdminChanged(msgTime, target, groupCode, isSetAdmin)
|
||||
.transGroupAdminChanged(msgTime, target, targetUid, groupCode, isSetAdmin)
|
||||
) {
|
||||
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 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 target = if (wholeBan) 0 else ContactHelper.getUinByUidAsync(targetUid).toLong()
|
||||
val subType = if (rawDuration == 0) NoticeSubType.LiftBan else NoticeSubType.Ban
|
||||
|
||||
if (wholeBan) {
|
||||
LogCenter.log("群全员禁言($groupCode): $operation -> ${if (subType == NoticeSubType.Ban) "开启" else "关闭"}")
|
||||
LogCenter.log("群全员禁言($groupCode): $operator -> ${if (subType == NoticeSubType.Ban) "开启" else "关闭"}")
|
||||
} else {
|
||||
LogCenter.log("群禁言($groupCode): $operation -> $target, 时长 = ${duration}s")
|
||||
LogCenter.log("群禁言($groupCode): $operator -> $target, 时长 = ${duration}s")
|
||||
}
|
||||
if (!GlobalEventTransmitter.GroupNoticeTransmitter
|
||||
.transGroupBan(msgTime, subType, operation, target, groupCode, duration)
|
||||
.transGroupBan(msgTime, subType, operator, operatorUid, target, targetUid, groupCode, duration)
|
||||
) {
|
||||
LogCenter.log("群禁言推送失败!", Level.WARN)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user