Skip to content
Snippets Groups Projects
Select Git revision
  • b5483067f8ef312bf1d947d9ac85000032b086eb
  • main default protected
  • development
  • integration
  • v1.1.5
  • v1.1.4
  • v1.1.3
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.0
11 results

README.md

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()
    }