Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julian Dehm
briar
Commits
d430b4fd
Verified
Commit
d430b4fd
authored
Sep 07, 2018
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move introduction role into IntroductionResponse
parent
fcf7cf72
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
34 additions
and
62 deletions
+34
-62
bramble-api/src/main/java/org/briarproject/bramble/api/Nameable.java
.../src/main/java/org/briarproject/bramble/api/Nameable.java
+1
-1
bramble-api/src/main/java/org/briarproject/bramble/api/identity/Author.java
...in/java/org/briarproject/bramble/api/identity/Author.java
+2
-1
briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItem.java
.../briarproject/briar/android/contact/ConversationItem.java
+1
-1
briar-api/src/main/java/org/briarproject/briar/api/introduction/Introduction.java
...org/briarproject/briar/api/introduction/Introduction.java
+0
-32
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionRequest.java
...arproject/briar/api/introduction/IntroductionRequest.java
+5
-4
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionResponse.java
...rproject/briar/api/introduction/IntroductionResponse.java
+13
-3
briar-api/src/main/java/org/briarproject/briar/api/messaging/PrivateRequest.java
.../org/briarproject/briar/api/messaging/PrivateRequest.java
+1
-0
briar-api/src/main/java/org/briarproject/briar/api/messaging/PrivateResponse.java
...org/briarproject/briar/api/messaging/PrivateResponse.java
+1
-0
briar-api/src/main/java/org/briarproject/briar/api/sharing/Shareable.java
...in/java/org/briarproject/briar/api/sharing/Shareable.java
+1
-1
briar-core/src/main/java/org/briarproject/briar/introduction/AbstractProtocolEngine.java
...iarproject/briar/introduction/AbstractProtocolEngine.java
+2
-4
briar-core/src/main/java/org/briarproject/briar/introduction/IntroduceeProtocolEngine.java
...rproject/briar/introduction/IntroduceeProtocolEngine.java
+1
-4
briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java
...arproject/briar/introduction/IntroductionManagerImpl.java
+2
-5
briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java
...oject/briar/introduction/IntroductionIntegrationTest.java
+4
-6
No files found.
br
iar-api/src/main/java/org/briarproject/briar/api/messaging
/Nameable.java
→
br
amble-api/src/main/java/org/briarproject/bramble/api
/Nameable.java
View file @
d430b4fd
package
org.briarproject.br
iar.api.messaging
;
package
org.briarproject.br
amble.api
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
...
...
bramble-api/src/main/java/org/briarproject/bramble/api/identity/Author.java
View file @
d430b4fd
package
org.briarproject.bramble.api.identity
;
import
org.briarproject.bramble.api.Nameable
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.util.StringUtils
;
...
...
@@ -13,7 +14,7 @@ import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_K
*/
@Immutable
@NotNullByDefault
public
class
Author
{
public
class
Author
implements
Nameable
{
public
enum
Status
{
NONE
,
ANONYMOUS
,
UNKNOWN
,
UNVERIFIED
,
VERIFIED
,
OURSELVES
...
...
briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItem.java
View file @
d430b4fd
...
...
@@ -183,7 +183,7 @@ abstract class ConversationItem {
if
(
ir
.
wasAccepted
())
{
res
=
R
.
string
.
introduction_response_accepted_received
;
}
else
{
if
(
ir
.
getNameable
().
isIntroducer
())
{
if
(
ir
.
isIntroducer
())
{
res
=
R
.
string
.
introduction_response_declined_received
;
}
else
{
res
=
...
...
briar-api/src/main/java/org/briarproject/briar/api/introduction/Introduction.java
deleted
100644 → 0
View file @
fcf7cf72
package
org.briarproject.briar.api.introduction
;
import
org.briarproject.bramble.api.identity.Author
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.briar.api.messaging.Nameable
;
import
javax.annotation.concurrent.Immutable
;
import
static
org
.
briarproject
.
briar
.
api
.
introduction
.
Role
.
INTRODUCER
;
@Immutable
@NotNullByDefault
public
class
Introduction
implements
Nameable
{
private
final
Author
introducedAuthor
;
private
final
Role
ourRole
;
public
Introduction
(
Author
introducedAuthor
,
Role
ourRole
)
{
this
.
introducedAuthor
=
introducedAuthor
;
this
.
ourRole
=
ourRole
;
}
@Override
public
String
getName
()
{
return
introducedAuthor
.
getName
();
}
public
boolean
isIntroducer
()
{
return
ourRole
==
INTRODUCER
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionRequest.java
View file @
d430b4fd
package
org.briarproject.briar.api.introduction
;
import
org.briarproject.bramble.api.identity.Author
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -11,16 +12,16 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public
class
IntroductionRequest
extends
PrivateRequest
<
Introduction
>
{
public
class
IntroductionRequest
extends
PrivateRequest
<
Author
>
{
private
final
boolean
contact
;
public
IntroductionRequest
(
MessageId
messageId
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
Introduction
introduction
,
@Nullable
String
message
,
boolean
answered
,
boolean
contact
)
{
SessionId
sessionId
,
Author
author
,
@Nullable
String
message
,
boolean
answered
,
boolean
contact
)
{
super
(
messageId
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
introduction
,
message
,
answered
);
author
,
message
,
answered
);
this
.
contact
=
contact
;
}
...
...
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionResponse.java
View file @
d430b4fd
package
org.briarproject.briar.api.introduction
;
import
org.briarproject.bramble.api.identity.Author
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -8,15 +9,24 @@ import org.briarproject.briar.api.messaging.PrivateResponse;
import
javax.annotation.concurrent.Immutable
;
import
static
org
.
briarproject
.
briar
.
api
.
introduction
.
Role
.
INTRODUCER
;
@Immutable
@NotNullByDefault
public
class
IntroductionResponse
extends
PrivateResponse
<
Introduction
>
{
public
class
IntroductionResponse
extends
PrivateResponse
<
Author
>
{
private
final
Role
ourRole
;
public
IntroductionResponse
(
MessageId
messageId
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
Introduction
introduction
,
boolean
accepted
)
{
SessionId
sessionId
,
Author
author
,
boolean
accepted
,
Role
role
)
{
super
(
messageId
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
introduction
,
accepted
);
author
,
accepted
);
this
.
ourRole
=
role
;
}
public
boolean
isIntroducer
()
{
return
ourRole
==
INTRODUCER
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/messaging/PrivateRequest.java
View file @
d430b4fd
package
org.briarproject.briar.api.messaging
;
import
org.briarproject.bramble.api.Nameable
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
briar-api/src/main/java/org/briarproject/briar/api/messaging/PrivateResponse.java
View file @
d430b4fd
package
org.briarproject.briar.api.messaging
;
import
org.briarproject.bramble.api.Nameable
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
briar-api/src/main/java/org/briarproject/briar/api/sharing/Shareable.java
View file @
d430b4fd
...
...
@@ -2,7 +2,7 @@ package org.briarproject.briar.api.sharing;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.br
iar.api.messaging
.Nameable
;
import
org.briarproject.br
amble.api
.Nameable
;
@NotNullByDefault
public
interface
Shareable
extends
Nameable
{
...
...
briar-core/src/main/java/org/briarproject/briar/introduction/AbstractProtocolEngine.java
View file @
d430b4fd
...
...
@@ -20,7 +20,6 @@ import org.briarproject.bramble.api.sync.MessageId;
import
org.briarproject.bramble.api.system.Clock
;
import
org.briarproject.briar.api.client.MessageTracker
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.introduction.Introduction
;
import
org.briarproject.briar.api.introduction.IntroductionResponse
;
import
org.briarproject.briar.api.introduction.event.IntroductionResponseReceivedEvent
;
...
...
@@ -148,14 +147,13 @@ abstract class AbstractProtocolEngine<S extends Session>
void
broadcastIntroductionResponseReceivedEvent
(
Transaction
txn
,
Session
s
,
AuthorId
sender
,
Author
otherAuthor
,
AbstractIntroductionMessage
m
)
throws
DbException
{
Introduction
introduction
=
new
Introduction
(
otherAuthor
,
s
.
getRole
());
AuthorId
localAuthorId
=
identityManager
.
getLocalAuthor
(
txn
).
getId
();
Contact
c
=
contactManager
.
getContact
(
txn
,
sender
,
localAuthorId
);
IntroductionResponse
response
=
new
IntroductionResponse
(
m
.
getMessageId
(),
m
.
getGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
false
,
false
,
s
.
getSessionId
(),
introduction
,
m
instanceof
AcceptMessage
);
s
.
getSessionId
(),
otherAuthor
,
m
instanceof
AcceptMessage
,
s
.
getRole
()
);
IntroductionResponseReceivedEvent
e
=
new
IntroductionResponseReceivedEvent
(
response
,
c
.
getId
());
txn
.
attach
(
e
);
...
...
briar-core/src/main/java/org/briarproject/briar/introduction/IntroduceeProtocolEngine.java
View file @
d430b4fd
...
...
@@ -26,7 +26,6 @@ import org.briarproject.bramble.api.transport.KeySetId;
import
org.briarproject.briar.api.client.MessageTracker
;
import
org.briarproject.briar.api.client.ProtocolStateException
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.introduction.Introduction
;
import
org.briarproject.briar.api.introduction.IntroductionRequest
;
import
org.briarproject.briar.api.introduction.event.IntroductionAbortedEvent
;
import
org.briarproject.briar.api.introduction.event.IntroductionRequestReceivedEvent
;
...
...
@@ -255,11 +254,9 @@ class IntroduceeProtocolEngine
localAuthor
.
getId
());
boolean
contactExists
=
contactManager
.
contactExists
(
txn
,
m
.
getAuthor
().
getId
(),
localAuthor
.
getId
());
Introduction
introduction
=
new
Introduction
(
m
.
getAuthor
(),
s
.
getRole
());
IntroductionRequest
request
=
new
IntroductionRequest
(
m
.
getMessageId
(),
m
.
getGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
false
,
false
,
s
.
getSessionId
(),
introduction
,
m
.
getMessage
(),
false
,
s
.
getSessionId
(),
m
.
getAuthor
()
,
m
.
getMessage
(),
false
,
contactExists
);
IntroductionRequestReceivedEvent
e
=
new
IntroductionRequestReceivedEvent
(
request
,
c
.
getId
());
...
...
briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java
View file @
d430b4fd
...
...
@@ -29,7 +29,6 @@ import org.briarproject.bramble.api.versioning.ClientVersioningManager;
import
org.briarproject.bramble.api.versioning.ClientVersioningManager.ClientVersioningHook
;
import
org.briarproject.briar.api.client.MessageTracker
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.introduction.Introduction
;
import
org.briarproject.briar.api.introduction.IntroductionManager
;
import
org.briarproject.briar.api.introduction.IntroductionRequest
;
import
org.briarproject.briar.api.introduction.IntroductionResponse
;
...
...
@@ -467,10 +466,9 @@ class IntroductionManagerImpl extends ConversationClientImpl
boolean
contactExists
=
contactManager
.
contactExists
(
txn
,
rm
.
getAuthor
().
getId
(),
localAuthor
.
getId
());
Introduction
introduction
=
new
Introduction
(
author
,
role
);
return
new
IntroductionRequest
(
m
,
contactGroupId
,
meta
.
getTimestamp
(),
meta
.
isLocal
(),
status
.
isSent
(),
status
.
isSeen
(),
meta
.
isRead
(),
sessionId
,
introduction
,
message
,
!
meta
.
isAvailableToAnswer
(),
sessionId
,
author
,
message
,
!
meta
.
isAvailableToAnswer
(),
contactExists
);
}
...
...
@@ -495,10 +493,9 @@ class IntroductionManagerImpl extends ConversationClientImpl
sessionId
=
session
.
getSessionId
();
author
=
session
.
getRemote
().
author
;
}
else
throw
new
AssertionError
();
Introduction
introduction
=
new
Introduction
(
author
,
role
);
return
new
IntroductionResponse
(
m
,
contactGroupId
,
meta
.
getTimestamp
(),
meta
.
isLocal
(),
status
.
isSent
(),
status
.
isSeen
(),
meta
.
isRead
(),
sessionId
,
introduction
,
accept
);
sessionId
,
author
,
accept
,
role
);
}
private
void
removeSessionWithIntroducer
(
Transaction
txn
,
...
...
briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java
View file @
d430b4fd
...
...
@@ -24,16 +24,14 @@ import org.briarproject.bramble.api.sync.MessageId;
import
org.briarproject.bramble.test.TestDatabaseModule
;
import
org.briarproject.briar.api.client.ProtocolStateException
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.introduction.Introduction
;
import
org.briarproject.briar.api.introduction.IntroductionManager
;
import
org.briarproject.briar.api.introduction.IntroductionRequest
;
import
org.briarproject.briar.api.introduction.IntroductionResponse
;
import
org.briarproject.briar.api.introduction.event.IntroductionAbortedEvent
;
import
org.briarproject.briar.api.introduction.event.IntroductionRequestReceivedEvent
;
import
org.briarproject.briar.api.introduction.event.IntroductionResponseReceivedEvent
;
import
org.briarproject.briar.api.introduction.event.IntroductionSucceededEvent
;
import
org.briarproject.briar.api.messaging.PrivateMessageHeader
;
import
org.briarproject.briar.api.messaging.PrivateRequest
;
import
org.briarproject.briar.api.messaging.PrivateResponse
;
import
org.briarproject.briar.test.BriarIntegrationTest
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
@@ -1148,7 +1146,7 @@ public class IntroductionIntegrationTest
protected
volatile
Event
latestEvent
;
@SuppressWarnings
(
"WeakerAccess"
)
PrivateResponse
<
Introduction
>
getResponse
()
{
IntroductionResponse
getResponse
()
{
assertTrue
(
latestEvent
instanceof
IntroductionResponseReceivedEvent
);
return
((
IntroductionResponseReceivedEvent
)
latestEvent
)
...
...
@@ -1180,7 +1178,7 @@ public class IntroductionIntegrationTest
IntroductionRequestReceivedEvent
introEvent
=
((
IntroductionRequestReceivedEvent
)
e
);
requestReceived
=
true
;
PrivateRequest
<
Introduction
>
ir
=
introEvent
.
getMessageHeader
();
IntroductionRequest
ir
=
introEvent
.
getMessageHeader
();
ContactId
contactId
=
introEvent
.
getContactId
();
sessionId
=
ir
.
getSessionId
();
long
time
=
clock
.
currentTimeMillis
();
...
...
@@ -1217,7 +1215,7 @@ public class IntroductionIntegrationTest
}
}
private
PrivateRequest
<
Introduction
>
getRequest
()
{
private
IntroductionRequest
getRequest
()
{
assertTrue
(
latestEvent
instanceof
IntroductionRequestReceivedEvent
);
return
((
IntroductionRequestReceivedEvent
)
latestEvent
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment