Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Briar Mailbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Julian Dehm
Briar Mailbox
Commits
47541e5a
Commit
47541e5a
authored
6 years ago
by
bontric
Browse files
Options
Downloads
Patches
Plain Diff
add contact Id to TAKE request
parent
690e3d17
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java
+33
-4
33 additions, 4 deletions
...rproject/bramble/mailbox/protocol/MailboxRequestTake.java
with
33 additions
and
4 deletions
bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java
+
33
−
4
View file @
47541e5a
...
...
@@ -4,11 +4,21 @@ import org.briarproject.bramble.api.FormatException;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.data.BdfList
;
import
javax.annotation.Nullable
;
public
class
MailboxRequestTake
extends
MailboxRequest
{
private
byte
[]
encryptedSyncStream
;
private
final
ContactId
contactId
;
private
final
byte
[]
encryptedSyncStream
;
public
MailboxRequestTake
(
byte
[]
encryptedSyncStream
)
{
super
(
TYPE
.
TAKE
);
this
.
contactId
=
null
;
this
.
encryptedSyncStream
=
encryptedSyncStream
;
}
public
MailboxRequestTake
(
ContactId
contactId
,
byte
[]
encryptedSyncStream
)
{
super
(
TYPE
.
TAKE
);
this
.
contactId
=
contactId
;
this
.
encryptedSyncStream
=
encryptedSyncStream
;
}
...
...
@@ -16,14 +26,26 @@ public class MailboxRequestTake extends MailboxRequest {
super
(
TYPE
.
TAKE
,
msg
.
getLong
(
1
));
BdfList
body
=
msg
.
getList
(
2
);
if
(
body
.
size
()
!=
1
)
if
(
body
.
size
()
!=
2
)
throw
new
FormatException
();
this
.
encryptedSyncStream
=
body
.
getRaw
(
0
);
Long
cId
=
body
.
getOptionalLong
(
0
);
if
(
cId
!=
null
)
{
if
(
cId
>
Integer
.
MAX_VALUE
||
cId
<
Integer
.
MIN_VALUE
)
throw
new
FormatException
();
contactId
=
new
ContactId
(
cId
.
intValue
());
}
else
contactId
=
null
;
encryptedSyncStream
=
body
.
getRaw
(
1
);
}
@Override
protected
BdfList
getRequestBody
()
{
return
BdfList
.
of
(
encryptedSyncStream
);
if
(
contactId
==
null
)
return
BdfList
.
of
(
null
,
encryptedSyncStream
);
return
BdfList
.
of
(
contactId
.
getInt
(),
encryptedSyncStream
);
}
@Override
...
...
@@ -35,5 +57,12 @@ public class MailboxRequestTake extends MailboxRequest {
return
encryptedSyncStream
;
}
@Nullable
public
ContactId
getContactId
()
{
return
contactId
;
}
public
boolean
hasContactId
()
{
return
contactId
!=
null
;
}
}
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