Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Shamrock: fix scene and group code
Browse files Browse the repository at this point in the history
  • Loading branch information
ikechan8370 committed Apr 10, 2024
1 parent 36a09ca commit 7baf459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions xposed/src/main/java/kritor/service/GroupService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kritor.service
import io.grpc.Status
import io.grpc.StatusRuntimeException
import io.kritor.group.*
import moe.fuqiuluo.shamrock.helper.LogCenter
import moe.fuqiuluo.shamrock.helper.TroopHonorHelper.decodeHonor
import moe.fuqiuluo.shamrock.tools.ifNullOrEmpty
import qq.service.contact.ContactHelper
Expand Down Expand Up @@ -213,9 +214,10 @@ internal object GroupService : GroupServiceGrpcKt.GroupServiceCoroutineImplBase(
return GetGroupListResponse.newBuilder().apply {
groupList.forEach { groupInfo ->
this.addGroupsInfo(GroupInfo.newBuilder().apply {
groupId = groupInfo.troopcode.toLong()
groupId = groupInfo.troopcode.ifNullOrEmpty { groupInfo.uin }.ifNullOrEmpty { groupInfo.troopuin }?.toLong() ?: 0
groupName = groupInfo.troopname.ifNullOrEmpty { groupInfo.troopRemark }
.ifNullOrEmpty { groupInfo.newTroopName } ?: ""
.ifNullOrEmpty { groupInfo.newTroopName }
?: ""
groupRemark = groupInfo.troopRemark ?: ""
owner = groupInfo.troopowneruin?.toLong() ?: 0
addAllAdmins(GroupHelper.getAdminList(groupId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.tencent.qqnt.kernel.nativeinterface.MsgRecord
import io.kritor.event.*
import io.kritor.common.PushMessageBody
import io.kritor.common.Contact
import io.kritor.common.Scene
import io.kritor.common.Sender
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -44,7 +45,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.GROUP
this.peer = record.peerUin.toString()
this.subPeer = record.peerUid
}.build()
Expand All @@ -67,7 +68,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.FRIEND
this.peer = record.senderUin.toString()
this.subPeer = record.senderUid
}.build()
Expand All @@ -92,7 +93,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = if (groupCode > 0) Scene.STRANGER_FROM_GROUP else Scene.STRANGER
this.peer = record.senderUin.toString()
this.subPeer = groupCode.toString()
}.build()
Expand All @@ -115,7 +116,7 @@ internal object GlobalEventTransmitter : QQInterfaces() {
this.messageId = record.msgId.toString()
this.messageSeq = record.msgSeq
this.contact = Contact.newBuilder().apply {
this.scene = scene
this.scene = Scene.GUILD
this.peer = record.guildId ?: ""
this.subPeer = record.channelId ?: ""
}.build()
Expand Down

0 comments on commit 7baf459

Please sign in to comment.