Skip to content
Snippets Groups Projects
Select Git revision
  • b2910dec8bce4a15e0cb89323d174feacd5a7339
  • release default
  • 11-22-implement-kv-interface-defined-in-collectiveversionedkvgo
  • master protected
  • XX-4688/DbEncoding
  • hotfix/update
  • @XX-4682/Files
  • hotfix/XX-4655
  • dev protected
  • project/HavenNotifications
  • XX-4602/SilentMessageType
  • jono/npmTest
  • wasmTest2
  • XX-4461/FileUpload
  • XX-4505/blockuser
  • XX-4441
  • Jakub/Emoji-CI-Test
  • testing/websockets
  • fastReg
  • fast-registration
  • NewHostPool
  • v0.3.22
  • v0.3.21
  • v0.3.20
  • v0.3.18
  • v0.3.17
  • v0.3.16
  • v0.3.15
  • v0.3.14
  • v0.3.13
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • 812b395df518ce096d01d5292596ca26f8fe92d9c4487ddfa515e190a51aa1a1
  • 76ba08e2dfa1798412a265404fa271840b52c035869111fce8e8cdb23a036a5a
41 results

main.go

Blame
  • wrapper.go 2.10 KiB
    ////////////////////////////////////////////////////////////////////////////////
    // Copyright © 2022 xx foundation                                             //
    //                                                                            //
    // Use of this source code is governed by a license that can be found in the  //
    // LICENSE file.                                                              //
    ////////////////////////////////////////////////////////////////////////////////
    
    package groupChat
    
    import (
    	gs "gitlab.com/elixxir/client/groupChat/groupStore"
    	"gitlab.com/elixxir/crypto/group"
    	"gitlab.com/xx_network/primitives/id"
    	"time"
    )
    
    // Wrapper handles the sending and receiving of group chat using E2E
    // messages to inform the recipient of incoming group chat messages.
    type Wrapper struct {
    	gc GroupChat
    }
    
    // NewWrapper constructs a wrapper around the GroupChat interface.
    func NewWrapper(manager GroupChat) *Wrapper {
    	return &Wrapper{gc: manager}
    }
    
    // MakeGroup calls GroupChat.MakeGroup.
    func (w *Wrapper) MakeGroup(membership []*id.ID, name, message []byte) (
    	gs.Group, []id.Round, RequestStatus, error) {
    	return w.gc.MakeGroup(membership, name, message)
    }
    
    // GetGroup calls GroupChat.GetGroup.
    func (w *Wrapper) GetGroup(groupID *id.ID) (gs.Group, bool) {
    	return w.gc.GetGroup(groupID)
    }
    
    // ResendRequest calls GroupChat.ResendRequest.
    func (w *Wrapper) ResendRequest(groupID *id.ID) ([]id.Round, RequestStatus, error) {
    	return w.gc.ResendRequest(groupID)
    }
    
    // JoinGroup calls GroupChat.JoinGroup.
    func (w *Wrapper) JoinGroup(grp gs.Group) error {
    	return w.gc.JoinGroup(grp)
    }
    
    // LeaveGroup calls GroupChat.LeaveGroup.
    func (w *Wrapper) LeaveGroup(groupID *id.ID) error {
    	return w.gc.LeaveGroup(groupID)
    }
    
    // Send calls GroupChat.Send.
    func (w *Wrapper) Send(groupID *id.ID, message []byte, tag string) (
    	id.Round, time.Time, group.MessageID, error) {
    	return w.gc.Send(groupID, tag, message)
    }
    
    // GetGroups calls GroupChat.GetGroups.
    func (w *Wrapper) GetGroups() []*id.ID {
    	return w.gc.GetGroups()
    }
    
    // NumGroups calls GroupChat.NumGroups.
    func (w *Wrapper) NumGroups() int {
    	return w.gc.NumGroups()
    }