Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
6aee1d39
Commit
6aee1d39
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Fix bindings
parent
b3753574
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!413
Xx 4263
,
!340
Project/channels
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/channels.go
+38
-56
38 additions, 56 deletions
bindings/channels.go
with
38 additions
and
56 deletions
bindings/channels.go
+
38
−
56
View file @
6aee1d39
...
...
@@ -8,9 +8,9 @@
package
bindings
import
(
"crypto/ed25519"
"encoding/json"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/channels"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/storage/versioned"
...
...
@@ -913,7 +913,8 @@ type ReceivedChannelMessageReport struct {
MessageId
[]
byte
MessageType
int
Nickname
string
Identity
[]
byte
PubKey
[]
byte
Codeset
int
Content
[]
byte
Timestamp
int64
Lease
int64
...
...
@@ -947,22 +948,17 @@ func (cm *ChannelsManager) RegisterReceiveHandler(messageType int,
cb
:=
channels
.
MessageTypeReceiveMessage
(
func
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
messageType
channels
.
MessageType
,
nickname
string
,
content
[]
byte
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
channels
.
SentStatus
)
uint64
{
idBytes
,
err
:=
json
.
Marshal
(
&
identity
)
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"failed to marshal identity object: %+v"
,
err
)
return
0
}
nickname
string
,
content
[]
byte
,
pubKey
ed25519
.
PublicKey
,
codeset
uint8
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
status
channels
.
SentStatus
)
uint64
{
rcm
:=
ReceivedChannelMessageReport
{
ChannelId
:
channelID
.
Marshal
(),
MessageId
:
messageID
.
Bytes
(),
MessageType
:
int
(
messageType
),
Nickname
:
nickname
,
Identity
:
idBytes
,
PubKey
:
pubKey
,
Codeset
:
int
(
codeset
),
Content
:
content
,
Timestamp
:
timestamp
.
UnixNano
(),
Lease
:
int64
(
lease
),
...
...
@@ -1013,7 +1009,8 @@ type EventModel interface {
// - text - The content of the message.
// - timestamp - Time the message was received; represented as nanoseconds
// since unix epoch.
// - identity - the json of the identity of the sender
// - pubKey - The sender's Ed25519 public key.
// - codeset - The codeset version.
// - lease - The number of nanoseconds that the message is valid for.
// - roundId - The ID of the round that the message was received on.
// - mType - the type of the message, always 1 for this call
...
...
@@ -1027,7 +1024,7 @@ type EventModel interface {
// Returns a non-negative unique UUID for the message that it can be
// referenced by later with [EventModel.UpdateSentStatus].
ReceiveMessage
(
channelID
,
messageID
[]
byte
,
nickname
,
text
string
,
identit
y
[]
byte
,
timestamp
,
lease
,
roundId
,
mType
,
pubKe
y
[]
byte
,
codeset
int
,
timestamp
,
lease
,
roundId
,
mType
,
status
int64
)
int64
// ReceiveReply is called whenever a message is received that is a reply on
...
...
@@ -1045,7 +1042,8 @@ type EventModel interface {
// reply.
// - nickname - The nickname of the sender of the message.
// - text - The content of the message.
// - identity - the json marshaled identity of the sender
// - pubKey - The sender's Ed25519 public key.
// - codeset - The codeset version.
// - timestamp - Time the message was received; represented as nanoseconds
// since unix epoch.
// - lease - The number of nanoseconds that the message is valid for.
...
...
@@ -1060,9 +1058,9 @@ type EventModel interface {
//
// Returns a non-negative unique UUID for the message that it can be
// referenced by later with [EventModel.UpdateSentStatus].
ReceiveReply
(
channelID
,
messageID
,
reactionTo
[]
byte
,
nickname
,
text
str
in
g
,
identity
[]
byt
e
,
timestamp
,
lease
,
roundId
,
mType
,
status
int64
)
int64
ReceiveReply
(
channelID
,
messageID
,
reactionTo
[]
byte
,
nickname
,
text
string
,
pubKey
[]
byte
,
codeset
in
t
,
timestamp
,
lease
,
roundId
,
mTyp
e
,
status
int64
)
int64
// ReceiveReaction is called whenever a reaction to a message is received
// on a given channel. It may be called multiple times on the same reaction.
...
...
@@ -1081,7 +1079,8 @@ type EventModel interface {
// reply.
// - nickname - The nickname of the sender of the message.
// - reaction - The contents of the reaction message.
// - identity - The json marshal of the identity of the sender
// - pubKey - The sender's Ed25519 public key.
// - codeset - The codeset version.
// - timestamp - Time the message was received; represented as nanoseconds
// since unix epoch.
// - lease - The number of nanoseconds that the message is valid for.
...
...
@@ -1096,9 +1095,9 @@ type EventModel interface {
//
// Returns a non-negative unique uuid for the message by which it can be
// referenced later with UpdateSentStatus
ReceiveReaction
(
channelID
,
messageID
,
reactionTo
[]
byte
,
nickname
,
reaction
string
,
identit
y
[]
byte
,
timestamp
,
lease
,
roundId
,
mt
ype
,
status
int64
)
int64
ReceiveReaction
(
channelID
,
messageID
,
reactionTo
[]
byte
,
nickname
,
reaction
string
,
pubKe
y
[]
byte
,
codeset
int
,
timestamp
,
lease
,
roundId
,
mT
ype
,
status
int64
)
int64
// UpdateSentStatus is called whenever the sent status of a message has
// changed.
...
...
@@ -1146,21 +1145,15 @@ func (tem *toEventModel) LeaveChannel(channelID *id.ID) {
// ReceiveMessage is called whenever a message is received on a given channel.
// It may be called multiple times on the same message. It is incumbent on the
// user of the API to filter such called by message ID.
func
(
tem
*
toEventModel
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
channels
.
MessageType
,
func
(
tem
*
toEventModel
)
ReceiveMessage
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
pubKey
ed25519
.
PublicKey
,
codeset
uint8
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
channels
.
MessageType
,
status
channels
.
SentStatus
)
uint64
{
idBytes
,
err
:=
json
.
Marshal
(
&
identity
)
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"failed to marshal identity object: %+v"
,
err
)
return
0
}
return
uint64
(
tem
.
em
.
ReceiveMessage
(
channelID
[
:
],
messageID
[
:
],
nickname
,
text
,
idBytes
,
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
text
,
pubKey
,
int
(
codeset
)
,
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
}
// ReceiveReply is called whenever a message is received that is a reply on a
...
...
@@ -1169,21 +1162,15 @@ func (tem *toEventModel) ReceiveMessage(channelID *id.ID, messageID cryptoChanne
//
// Messages may arrive our of order, so a reply in theory can arrive before the
// initial message. As a result, it may be important to buffer replies.
func
(
tem
*
toEventModel
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
channels
.
MessageType
,
status
channels
.
SentStatus
)
uint64
{
idBytes
,
err
:=
json
.
Marshal
(
&
identity
)
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"failed to marshal identity object: %+v"
,
err
)
return
0
}
func
(
tem
*
toEventModel
)
ReceiveReply
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
text
string
,
pubKey
ed25519
.
PublicKey
,
codeset
uint8
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
channels
.
MessageType
,
status
channels
.
SentStatus
)
uint64
{
return
uint64
(
tem
.
em
.
ReceiveReply
(
channelID
[
:
],
messageID
[
:
],
reactionTo
[
:
],
nickname
,
text
,
idBytes
,
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
nickname
,
text
,
pubKey
,
int
(
codeset
)
,
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
}
...
...
@@ -1195,19 +1182,14 @@ func (tem *toEventModel) ReceiveReply(channelID *id.ID, messageID cryptoChannel.
// initial message. As a result, it may be important to buffer reactions.
func
(
tem
*
toEventModel
)
ReceiveReaction
(
channelID
*
id
.
ID
,
messageID
cryptoChannel
.
MessageID
,
reactionTo
cryptoChannel
.
MessageID
,
nickname
,
reaction
string
,
identity
cryptoChannel
.
Identity
,
timestamp
time
.
Time
,
pubKey
ed25519
.
PublicKey
,
codeset
uint8
,
timestamp
time
.
Time
,
lease
time
.
Duration
,
round
rounds
.
Round
,
mType
channels
.
MessageType
,
status
channels
.
SentStatus
)
uint64
{
idBytes
,
err
:=
json
.
Marshal
(
&
identity
)
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"failed to marshal identity object: %+v"
,
err
)
return
0
}
return
uint64
(
tem
.
em
.
ReceiveReaction
(
channelID
[
:
],
messageID
[
:
],
reactionTo
[
:
],
nickname
,
reaction
,
idBytes
,
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
reactionTo
[
:
],
nickname
,
reaction
,
pubKey
,
int
(
codeset
),
timestamp
.
UnixNano
(),
int64
(
lease
),
int64
(
round
.
ID
),
int64
(
mType
),
int64
(
status
)))
}
// UpdateSentStatus is called whenever the sent status of a message has changed.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment