From 83bba73045b1b306192d81e06a3f8dab0c3ea32a Mon Sep 17 00:00:00 2001
From: Jono Wenger <jono@elixxir.io>
Date: Tue, 6 Dec 2022 15:01:27 -0800
Subject: [PATCH] Update channel bindings

---
 go.mod           |  2 +-
 go.sum           |  4 ++--
 wasm/channels.go | 15 ++++++++++++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/go.mod b/go.mod
index a798e8f9..f955f7e6 100644
--- a/go.mod
+++ b/go.mod
@@ -7,7 +7,7 @@ require (
 	github.com/hack-pad/go-indexeddb v0.2.0
 	github.com/pkg/errors v0.9.1
 	github.com/spf13/jwalterweatherman v1.1.0
-	gitlab.com/elixxir/client/v4 v4.3.9-0.20221205235846-54146fc90a3e
+	gitlab.com/elixxir/client/v4 v4.3.9-0.20221206225837-f9eb943a3fc4
 	gitlab.com/elixxir/crypto v0.0.7-0.20221202020255-46eeab272a7f
 	gitlab.com/elixxir/primitives v0.0.3-0.20221114231218-cc461261a6af
 	gitlab.com/xx_network/crypto v0.0.5-0.20221121220724-8eefdbb0eb46
diff --git a/go.sum b/go.sum
index aa0aec4a..857ea511 100644
--- a/go.sum
+++ b/go.sum
@@ -369,8 +369,8 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
 github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
 gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f h1:yXGvNBqzZwAhDYlSnxPRbgor6JWoOt1Z7s3z1O9JR40=
 gitlab.com/elixxir/bloomfilter v0.0.0-20211222005329-7d931ceead6f/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k=
-gitlab.com/elixxir/client/v4 v4.3.9-0.20221205235846-54146fc90a3e h1:rvt+hzzZA4sk1t8Bez7FOxDtjGoCn+ltkJowyzhJieE=
-gitlab.com/elixxir/client/v4 v4.3.9-0.20221205235846-54146fc90a3e/go.mod h1:6zBHVEOwB42N3Ba3879GW0huu595RLSar04KlNsa7QE=
+gitlab.com/elixxir/client/v4 v4.3.9-0.20221206225837-f9eb943a3fc4 h1:YsDCyiyDL+0JFF24gQbX9KYTtxrLey9K6nJqApt4hlQ=
+gitlab.com/elixxir/client/v4 v4.3.9-0.20221206225837-f9eb943a3fc4/go.mod h1:6zBHVEOwB42N3Ba3879GW0huu595RLSar04KlNsa7QE=
 gitlab.com/elixxir/comms v0.0.4-0.20221110181420-84bca6216fe4 h1:bLRjVCyMVde4n2hTVgoyyIAWrKI4CevpChchkPeb6A0=
 gitlab.com/elixxir/comms v0.0.4-0.20221110181420-84bca6216fe4/go.mod h1:XhI2/CMng+xcH3mAs+1aPz29PSNu1079XMJ8V+xxihw=
 gitlab.com/elixxir/crypto v0.0.7-0.20221202020255-46eeab272a7f h1:e7h3InxgzRnYOqgUgHrTfK6CW8qNM2SiYRj9tOvsFjA=
diff --git a/wasm/channels.go b/wasm/channels.go
index e5710ba5..e09e8b7a 100644
--- a/wasm/channels.go
+++ b/wasm/channels.go
@@ -1518,6 +1518,14 @@ func (cmrCB *channelMessageReceptionCallback) Callback(
 //   - args[1] - Javascript object that has functions that implement the
 //     [bindings.ChannelMessageReceptionCallback] interface. This callback will
 //     be executed when a channel message of the messageType is received.
+//   - args[2] - A name describing what type of messages the listener picks up.
+//     This is used for debugging and logging (string).
+//   - args[3] - Set to true if this listener can receive messages from normal
+//     users (boolean).
+//   - args[4] - Set to true if this listener can receive messages from admins
+//     (boolean).
+//   - args[5] - Set to true if this listener can receive messages from muted
+//     users (boolean).
 //
 // Returns:
 //   - Throws a TypeError if registering the handler fails.
@@ -1525,8 +1533,13 @@ func (cm *ChannelsManager) RegisterReceiveHandler(_ js.Value, args []js.Value) a
 	messageType := args[0].Int()
 	listenerCb := &channelMessageReceptionCallback{
 		utils.WrapCB(args[1], "Callback")}
+	name := args[2].String()
+	userSpace := args[3].Bool()
+	adminSpace := args[4].Bool()
+	mutedSpace := args[5].Bool()
 
-	err := cm.api.RegisterReceiveHandler(messageType, listenerCb)
+	err := cm.api.RegisterReceiveHandler(
+		messageType, listenerCb, name, userSpace, adminSpace, mutedSpace)
 	if err != nil {
 		utils.Throw(utils.TypeError, err)
 		return nil
-- 
GitLab