Skip to content

Commit

Permalink
fix: SortAtPanel lost at alll
Browse files Browse the repository at this point in the history
  • Loading branch information
lliioollcn committed Jul 4, 2023
1 parent b78f5fe commit 8f9b46e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions app/src/main/java/me/ketal/hook/SortAtPanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.tlb.ConfigTable
import io.github.qauxv.util.Initiator
import io.github.qauxv.util.Log
import io.github.qauxv.util.PlayQQVersion
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.TIMVersion
Expand Down Expand Up @@ -92,7 +91,7 @@ object SortAtPanel : CommonSwitchFunctionHook(
// for NT QQ 8.9.68.11450
val clazz = Initiator.load("com.tencent.mobileqq.aio.input.at.business.AIOAtSelectMemberUseCase")
for (m in clazz?.declaredMethods!!) {
if ( m.paramCount == 1 && m.returnType == Map::class.java && m.parameterTypes[0] == List::class.java) {
if (m.paramCount == 1 && m.returnType == Map::class.java && m.parameterTypes[0] == List::class.java) {
m.hookAfter {
val backMap = it.result as Map<String, List<Any>>
val map = backMap.toMutableMap()
Expand All @@ -105,28 +104,36 @@ object SortAtPanel : CommonSwitchFunctionHook(
ob.clear()
ab.clear()
l.forEach { v ->
var added = false
for (vf in v.javaClass.declaredFields) {
if (vf.type.name.contains("MemberInfo")) {
val info = XposedHelpers.getObjectField(v, vf.name)
val role = XposedHelpers.getObjectField(info, "role")
if (role.toString().contains("OWNER")) {
// 群主
ob.add(v)
added = true
break
} else if (role.toString().contains("ADMIN")) {
// 管理
ab.add(v)
} else {
list.add(v)
added = true
break
}
}
}
if (!added) {
list.add(v)
}

}

map[k] = list
val f = map.keys.toMutableList()[0]
val c = map[f]?.toMutableList()
c?.addAll(ob)
c?.addAll(ab)
map[f] = c?.toList()!!
val f = ""
val c = map.getOrDefault(f, arrayListOf()).toMutableList()
c.addAll(ob)
c.addAll(ab)
map[f] = c.toList()
}
it.result = map.toMap()
}
Expand Down

0 comments on commit 8f9b46e

Please sign in to comment.