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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
c63bff68
Commit
c63bff68
authored
Oct 19, 2021
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Add GetInitMessage to group bindings
parent
c99fcead
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!67
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/group.go
+7
-7
7 additions, 7 deletions
bindings/group.go
cmd/group.go
+16
-6
16 additions, 6 deletions
cmd/group.go
with
23 additions
and
13 deletions
bindings/group.go
+
7
−
7
View file @
c63bff68
...
...
@@ -9,7 +9,6 @@ package bindings
import
(
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
gc
"gitlab.com/elixxir/client/groupChat"
gs
"gitlab.com/elixxir/client/groupChat/groupStore"
"gitlab.com/elixxir/crypto/group"
...
...
@@ -191,6 +190,11 @@ func (g *Group) GetID() []byte {
return
g
.
g
.
ID
.
Bytes
()
}
// GetInitMessage returns initial message sent with the group request.
func
(
g
*
Group
)
GetInitMessage
()
[]
byte
{
return
g
.
g
.
InitMessage
}
// GetMembership returns a list of contacts, one for each member in the group.
// The list is in order; the first contact is the leader/creator of the group.
// All subsequent members are ordered by their ID.
...
...
@@ -295,9 +299,7 @@ func (gmr *GroupMessageReceive) GetTimestampNano() int64 {
// GetTimestampMS returns the message timestamp in milliseconds.
func
(
gmr
*
GroupMessageReceive
)
GetTimestampMS
()
int64
{
ts
:=
uint64
(
gmr
.
Timestamp
.
UnixNano
())
/
uint64
(
time
.
Millisecond
)
tsInt64
:=
int64
(
ts
)
jww
.
INFO
.
Printf
(
"TimestampMS: %d"
,
tsInt64
)
return
tsInt64
return
int64
(
ts
)
}
// GetRoundID returns the ID of the round the message was sent on.
...
...
@@ -315,7 +317,5 @@ func (gmr *GroupMessageReceive) GetRoundTimestampNano() int64 {
// message was sent on.
func
(
gmr
*
GroupMessageReceive
)
GetRoundTimestampMS
()
int64
{
ts
:=
uint64
(
gmr
.
RoundTimestamp
.
UnixNano
())
/
uint64
(
time
.
Millisecond
)
tsInt64
:=
int64
(
ts
)
jww
.
INFO
.
Printf
(
"RoundTimestampMS: %d"
,
tsInt64
)
return
tsInt64
return
int64
(
ts
)
}
This diff is collapsed.
Click to expand it.
cmd/group.go
+
16
−
6
View file @
c63bff68
...
...
@@ -154,7 +154,8 @@ func createGroup(name, msg []byte, filePath string, gm *groupChat.Manager) {
// Integration grabs the group ID from this line
jww
.
INFO
.
Printf
(
"NewGroupID: b64:%s"
,
grp
.
ID
)
jww
.
INFO
.
Printf
(
"Created Group: Requests:%s on rounds %#v, %v"
,
status
,
rids
,
grp
)
jww
.
INFO
.
Printf
(
"Created Group: Requests:%s on rounds %#v, %v"
,
status
,
rids
,
grp
)
fmt
.
Printf
(
"Created new group with name %q and message %q
\n
"
,
grp
.
Name
,
grp
.
InitMessage
)
}
...
...
@@ -168,13 +169,15 @@ func resendRequests(groupIdString string, gm *groupChat.Manager) {
groupID
,
err
)
}
jww
.
INFO
.
Printf
(
"Resending requests to group %s: %v, %s"
,
groupID
,
rids
,
status
)
jww
.
INFO
.
Printf
(
"Resending requests to group %s: %v, %s"
,
groupID
,
rids
,
status
)
fmt
.
Println
(
"Resending group requests to group."
)
}
// joinGroup joins a group when a request is received on the group request
// channel.
func
joinGroup
(
reqChan
chan
groupStore
.
Group
,
timeout
time
.
Duration
,
gm
*
groupChat
.
Manager
)
{
func
joinGroup
(
reqChan
chan
groupStore
.
Group
,
timeout
time
.
Duration
,
gm
*
groupChat
.
Manager
)
{
jww
.
INFO
.
Print
(
"Waiting for group request to be received."
)
fmt
.
Println
(
"Waiting for group request to be received."
)
...
...
@@ -226,7 +229,8 @@ func sendGroup(groupIdString string, msg []byte, gm *groupChat.Manager) {
// messageWait waits for the given number of messages to be received on the
// groupChat.MessageReceive channel.
func
messageWait
(
numMessages
uint
,
timeout
time
.
Duration
,
recChan
chan
groupChat
.
MessageReceive
)
{
func
messageWait
(
numMessages
uint
,
timeout
time
.
Duration
,
recChan
chan
groupChat
.
MessageReceive
)
{
jww
.
INFO
.
Printf
(
"Waiting for %d group message(s) to be received."
,
numMessages
)
fmt
.
Printf
(
"Waiting for %d group message(s) to be received.
\n
"
,
numMessages
)
...
...
@@ -263,7 +267,8 @@ func showGroup(groupIdString string, gm *groupChat.Manager) {
}
jww
.
INFO
.
Printf
(
"Show group %#v"
,
grp
)
fmt
.
Printf
(
"Got group with name %q and message %q
\n
"
,
grp
.
Name
,
grp
.
InitMessage
)
fmt
.
Printf
(
"Got group with name %q and message %q
\n
"
,
grp
.
Name
,
grp
.
InitMessage
)
}
// ReadLines returns each line in a file as a string.
...
...
@@ -272,7 +277,12 @@ func ReadLines(fileName string) []string {
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
err
.
Error
())
}
defer
file
.
Close
()
defer
func
(
file
*
os
.
File
)
{
err
=
file
.
Close
()
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to close file: %+v"
,
err
)
}
}(
file
)
var
res
[]
string
...
...
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