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
1343a409
Commit
1343a409
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add debugs
parent
046d5d0c
No related branches found
No related tags found
2 merge requests
!510
Release
,
!388
Xx 4214/group message
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
groupChat/receive.go
+12
-0
12 additions, 0 deletions
groupChat/receive.go
groupChat/send.go
+36
-2
36 additions, 2 deletions
groupChat/send.go
with
48 additions
and
2 deletions
groupChat/receive.go
+
12
−
0
View file @
1343a409
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
package
groupChat
package
groupChat
import
(
import
(
"encoding/base64"
"encoding/json"
"fmt"
"fmt"
"gitlab.com/xx_network/primitives/netTime"
"gitlab.com/xx_network/primitives/netTime"
"time"
"time"
...
@@ -113,6 +115,16 @@ func decryptMessage(g gs.Group, fingerprint format.Fingerprint,
...
@@ -113,6 +115,16 @@ func decryptMessage(g gs.Group, fingerprint format.Fingerprint,
return
MessageReceive
{},
errors
.
Errorf
(
unmarshalSenderIdErr
,
err
)
return
MessageReceive
{},
errors
.
Errorf
(
unmarshalSenderIdErr
,
err
)
}
}
mar
,
_
:=
json
.
Marshal
(
NewPublicInternalMessage_DeleteThis
(
intlMsg
))
jww
.
INFO
.
Printf
(
"GROUP MSG ID DEBUG (decryptMsg): "
+
"senders group ID: %s, "
+
"internalMessage: %s"
+
"internalMessage: %s"
,
g
.
ID
,
base64
.
StdEncoding
.
EncodeToString
(
intlMsg
.
Marshal
()),
string
(
mar
))
return
MessageReceive
{
return
MessageReceive
{
ID
:
group
.
NewMessageID
(
g
.
ID
,
intlMsg
.
Marshal
()),
ID
:
group
.
NewMessageID
(
g
.
ID
,
intlMsg
.
Marshal
()),
Payload
:
intlMsg
.
GetPayload
(),
Payload
:
intlMsg
.
GetPayload
(),
...
...
This diff is collapsed.
Click to expand it.
groupChat/send.go
+
36
−
2
View file @
1343a409
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
package
groupChat
package
groupChat
import
(
import
(
"encoding/base64"
"encoding/json"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix"
...
@@ -176,6 +178,27 @@ func newCmixMsg(g gs.Group, tag string, msg []byte, timestamp time.Time,
...
@@ -176,6 +178,27 @@ func newCmixMsg(g gs.Group, tag string, msg []byte, timestamp time.Time,
return
cmixMsg
,
nil
return
cmixMsg
,
nil
}
}
// PublicInternalMessage_DeleteThis so internalMsg could be json marshalled for legibility
// in a debug ticket.
type
PublicInternalMessage_DeleteThis
struct
{
Data
[]
byte
// Serial of all the parts of the message
Timestamp
[]
byte
// 64-bit Unix time timestamp stored in nanoseconds
SenderID
[]
byte
// 264-bit sender ID
Size
[]
byte
// Size of the payload
Payload
[]
byte
// Message contents
}
func
NewPublicInternalMessage_DeleteThis
(
msg
internalMsg
)
*
PublicInternalMessage_DeleteThis
{
return
&
PublicInternalMessage_DeleteThis
{
Data
:
msg
.
data
,
Timestamp
:
msg
.
timestamp
,
SenderID
:
msg
.
senderID
,
Size
:
msg
.
size
,
Payload
:
msg
.
payload
,
}
}
// getGroupMessageId builds the group message ID.
// getGroupMessageId builds the group message ID.
func
getGroupMessageId
(
grp
*
cyclic
.
Group
,
groupId
,
senderId
*
id
.
ID
,
func
getGroupMessageId
(
grp
*
cyclic
.
Group
,
groupId
,
senderId
*
id
.
ID
,
timestamp
time
.
Time
,
msg
[]
byte
)
(
group
.
MessageID
,
error
)
{
timestamp
time
.
Time
,
msg
[]
byte
)
(
group
.
MessageID
,
error
)
{
...
@@ -185,8 +208,19 @@ func getGroupMessageId(grp *cyclic.Group, groupId, senderId *id.ID,
...
@@ -185,8 +208,19 @@ func getGroupMessageId(grp *cyclic.Group, groupId, senderId *id.ID,
return
group
.
MessageID
{},
errors
.
WithMessage
(
err
,
return
group
.
MessageID
{},
errors
.
WithMessage
(
err
,
"Failed to make message parts for message ID"
)
"Failed to make message parts for message ID"
)
}
}
return
group
.
NewMessageID
(
groupId
,
setInternalPayload
(
intlMsg
,
timestamp
,
senderId
,
msg
)),
nil
intlMsgMarshal
:=
setInternalPayload
(
intlMsg
,
timestamp
,
senderId
,
msg
)
mar
,
_
:=
json
.
Marshal
(
NewPublicInternalMessage_DeleteThis
(
intlMsg
))
jww
.
INFO
.
Printf
(
"GROUP MSG ID DEBUG (getGroupMsgId): "
+
"senders group ID: %s, "
+
"internalMessage: %s"
+
"internalMessage: %s"
,
groupId
,
base64
.
StdEncoding
.
EncodeToString
(
intlMsgMarshal
),
string
(
mar
))
return
group
.
NewMessageID
(
groupId
,
intlMsgMarshal
),
nil
}
}
// newMessageParts generates a public payload message and the internal payload
// newMessageParts generates a public payload message and the internal payload
...
...
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