Skip to content
Snippets Groups Projects
Select Git revision
  • 2732eebc625cdab4c34c2907663c09d65d2c2082
  • main default protected
  • dev protected
  • hotfixes-oct-2022
  • refactor/avatar-cell
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1
  • 1.0.8
  • 1.0.7
  • 1.0.6
12 results

Gemfile

Blame
  • This project manages its dependencies using Bundler. Learn more
    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()
    }