mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
feat: starting member left admin handling functionality
This commit is contained in:
parent
253788b4ed
commit
ecc75dfeed
3 changed files with 21 additions and 1 deletions
|
@ -1616,6 +1616,25 @@ open class Storage(
|
|||
keys.free()
|
||||
}
|
||||
|
||||
override fun handleMemberLeft(message: GroupUpdated, closedGroupId: SessionId) {
|
||||
val userGroups = configFactory.userGroups ?: return
|
||||
val closedGroup = userGroups.getClosedGroup(closedGroupId.hexString()) ?: return
|
||||
if (closedGroup.hasAdminKey()) {
|
||||
// re-key and do a new config removing the previous member
|
||||
val info = configFactory.getGroupInfoConfig(closedGroupId) ?: return
|
||||
val members = configFactory.getGroupMemberConfig(closedGroupId) ?: return
|
||||
val keys = configFactory.getGroupKeysConfig(closedGroupId, info, members, free = false) ?: return
|
||||
members.erase(message.sender!!)
|
||||
|
||||
keys.rekey(info, members)
|
||||
|
||||
val
|
||||
|
||||
}
|
||||
|
||||
insertGroupInfoChange(message, closedGroupId)
|
||||
}
|
||||
|
||||
override fun leaveGroup(groupSessionId: String) {
|
||||
val closedGroupId = SessionId.from(groupSessionId)
|
||||
val message = GroupUpdated(
|
||||
|
|
|
@ -172,6 +172,7 @@ interface StorageProtocol {
|
|||
fun promoteMember(groupSessionId: String, promotions: Array<String>)
|
||||
fun removeMember(groupSessionId: String, removedMembers: Array<String>, fromDelete: Boolean = false)
|
||||
fun handlePromoted(keyPair: KeyPair)
|
||||
fun handleMemberLeft(message: GroupUpdated, closedGroupId: SessionId)
|
||||
fun leaveGroup(groupSessionId: String)
|
||||
|
||||
// Groups
|
||||
|
|
|
@ -557,7 +557,7 @@ private fun handleMemberChange(message: GroupUpdated, closedGroup: SessionId) {
|
|||
|
||||
private fun handleMemberLeft(message: GroupUpdated, closedGroup: SessionId) {
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
storage.insertGroupInfoChange(message, closedGroup)
|
||||
storage.handleMemberLeft(message, closedGroup)
|
||||
}
|
||||
|
||||
private fun handleGroupInfoChange(message: GroupUpdated, closedGroup: SessionId) {
|
||||
|
|
Loading…
Reference in a new issue