Skip to content
Snippets Groups Projects
Select Git revision
  • 01c18d34cec0350d545649450e0df57a86def2cb
  • release default
  • master protected
  • feature/xx-4717/logLevel
  • XX-4626/SingleUsePackage
  • josh/DmPackage
  • xx-4437/no-registration
  • feature/project/DM
  • project/channels
  • feature/ctidh
  • Jakub/rootless-CI
  • jono/wasmDemo
  • feature/XX-4108/updateProtoc
  • feature/hotfix/unsafe_send_to_self
  • Anne/OldSessionTesting
  • hotfix/groupChat
  • josh/groupCreationScript
  • feature/XX-3797/restore
  • feature/XX-3789/DeleteIndividualRequests
  • dev
  • feature/debugSendCMIX
21 results

server

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