Skip to content
Snippets Groups Projects
Commit f15bf8df authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add listener passthrough functions to client

parent 9fb97d15
No related branches found
No related tags found
4 merge requests!510Release,!207WIP: Client Restructure,!205cmd restructure,!203Symmetric broadcast
......@@ -16,8 +16,10 @@ import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/auth"
"gitlab.com/elixxir/client/backup"
"gitlab.com/elixxir/client/catalog"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/registration"
......@@ -688,6 +690,39 @@ func (c *Client) GetRoundEvents() interfaces.RoundEvents {
return c.network.GetInstance().GetRoundEvents()
}
// RegisterListener registers a callback struct for message receive
// events.
func (c *Client) RegisterListener(senderID *id.ID,
messageType catalog.MessageType,
newListener receive.Listener) receive.ListenerID {
jww.INFO.Printf("GetRoundEvents()")
jww.WARN.Printf("GetRoundEvents does not handle Client Errors " +
"edge case!")
return c.e2e.RegisterListener(senderID, messageType, newListener)
}
// RegisterListenerFunc registers a callback func for message receive
// events.
func (c *Client) RegisterListenerFunc(name string, senderID *id.ID,
messageType catalog.MessageType,
newListener receive.ListenerFunc) receive.ListenerID {
jww.INFO.Printf("GetRoundEvents()")
jww.WARN.Printf("GetRoundEvents does not handle Client Errors " +
"edge case!")
return c.e2e.RegisterFunc(name, senderID, messageType, newListener)
}
// RegisterListenerChannel registers a channel for message receive
// events.
func (c *Client) RegisterListenerChannel(name string, senderID *id.ID,
messageType catalog.MessageType,
newListener chan receive.Message) receive.ListenerID {
jww.INFO.Printf("GetRoundEvents()")
jww.WARN.Printf("GetRoundEvents does not handle Client Errors " +
"edge case!")
return c.e2e.RegisterChannel(name, senderID, messageType, newListener)
}
// AddService adds a service ot be controlled by the client thread control,
// these will be started and stopped with the network follower
func (c *Client) AddService(sp Service) error {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment