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

Commit

Permalink
Expose interface for getting groupv2 members
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Sep 3, 2022
1 parent a0891d4 commit bdb977b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions groupsv2/groupsv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,15 @@ func (g *GroupV2) UpdateGroupFromServer() error {

return nil
}
func GetGroupV2MembersForGroup(group string) ([]*signalservice.DecryptedMember, error) {
g := FindGroup(group)
if g == nil {
return nil, fmt.Errorf("Group not found")
}
g.UpdateGroupFromServer()

return g.DecryptedGroup.Members, nil
}
func HandleGroupsV2(src string, dm *signalservice.DataMessage) (*GroupV2, error) {
groupContext := dm.GetGroupV2()
if groupContext == nil {
Expand Down
6 changes: 6 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/signal-golang/textsecure/contactDiscoveryCrypto"
"github.com/signal-golang/textsecure/contacts"
"github.com/signal-golang/textsecure/contactsDiscovery"
"github.com/signal-golang/textsecure/groupsv2"
"github.com/signal-golang/textsecure/profiles"
signalservice "github.com/signal-golang/textsecure/protobuf"
"github.com/signal-golang/textsecure/registration"
Expand Down Expand Up @@ -395,6 +396,11 @@ func GetProfileAndCredential(uuid string, profileKey []byte) (*profiles.Profile,
return profile, nil
}

// GetGroupV2MembersForGroup returns the members of a group
func GetGroupV2MembersForGroup(group string) ([]*signalservice.DecryptedMember, error) {
return groupsv2.GetGroupV2MembersForGroup(group)
}

// GetMyUUID returns the uid from the current user
func GetMyUUID() (string, error) {
log.Debugln("[textsecure] get my uuid")
Expand Down

0 comments on commit bdb977b

Please sign in to comment.