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
7d479063
Verified
Commit
7d479063
authored
Sep 18, 2018
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConversationManager: Address review issues
parent
2309e732
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
31 deletions
+45
-31
briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutItem.java
...ject/briar/android/contact/ConversationNoticeOutItem.java
+12
-12
briar-core/src/main/java/org/briarproject/briar/privategroup/invitation/CreatorProtocolEngine.java
.../briar/privategroup/invitation/CreatorProtocolEngine.java
+1
-1
briar-core/src/main/java/org/briarproject/briar/sharing/BlogProtocolEngineImpl.java
...rg/briarproject/briar/sharing/BlogProtocolEngineImpl.java
+3
-3
briar-core/src/main/java/org/briarproject/briar/sharing/ForumProtocolEngineImpl.java
...g/briarproject/briar/sharing/ForumProtocolEngineImpl.java
+1
-1
briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java
...oject/briar/introduction/IntroductionIntegrationTest.java
+7
-4
briar-core/src/test/java/org/briarproject/briar/privategroup/PrivateGroupManagerIntegrationTest.java
...riar/privategroup/PrivateGroupManagerIntegrationTest.java
+1
-1
briar-core/src/test/java/org/briarproject/briar/sharing/ForumSharingIntegrationTest.java
...iarproject/briar/sharing/ForumSharingIntegrationTest.java
+20
-9
No files found.
briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationNoticeOutItem.java
View file @
7d479063
...
...
@@ -70,34 +70,34 @@ class ConversationNoticeOutItem extends ConversationOutItem {
}
private
static
String
getText
(
Context
ctx
,
String
contactName
,
PrivateResponse
i
r
)
{
if
(
i
r
.
wasAccepted
())
{
if
(
i
r
instanceof
IntroductionResponse
)
{
String
name
=
((
IntroductionResponse
)
i
r
).
getIntroducedAuthor
()
PrivateResponse
r
)
{
if
(
r
.
wasAccepted
())
{
if
(
r
instanceof
IntroductionResponse
)
{
String
name
=
((
IntroductionResponse
)
r
).
getIntroducedAuthor
()
.
getName
();
return
ctx
.
getString
(
R
.
string
.
introduction_response_accepted_sent
,
name
)
+
"\n\n"
+
ctx
.
getString
(
R
.
string
.
introduction_response_accepted_sent_info
,
name
);
}
else
if
(
i
r
instanceof
ForumInvitationResponse
)
{
}
else
if
(
r
instanceof
ForumInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
forum_invitation_response_accepted_sent
,
contactName
);
}
else
if
(
i
r
instanceof
BlogInvitationResponse
)
{
}
else
if
(
r
instanceof
BlogInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
blogs_sharing_response_accepted_sent
,
contactName
);
}
else
if
(
i
r
instanceof
GroupInvitationResponse
)
{
}
else
if
(
r
instanceof
GroupInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
groups_invitations_response_accepted_sent
,
contactName
);
}
}
else
{
if
(
i
r
instanceof
IntroductionResponse
)
{
String
name
=
((
IntroductionResponse
)
i
r
).
getIntroducedAuthor
()
if
(
r
instanceof
IntroductionResponse
)
{
String
name
=
((
IntroductionResponse
)
r
).
getIntroducedAuthor
()
.
getName
();
return
ctx
.
getString
(
R
.
string
.
introduction_response_declined_sent
,
name
);
}
else
if
(
i
r
instanceof
ForumInvitationResponse
)
{
}
else
if
(
r
instanceof
ForumInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
forum_invitation_response_declined_sent
,
contactName
);
}
else
if
(
i
r
instanceof
BlogInvitationResponse
)
{
}
else
if
(
r
instanceof
BlogInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
blogs_sharing_response_declined_sent
,
contactName
);
}
else
if
(
i
r
instanceof
GroupInvitationResponse
)
{
}
else
if
(
r
instanceof
GroupInvitationResponse
)
{
return
ctx
.
getString
(
R
.
string
.
groups_invitations_response_declined_sent
,
contactName
);
}
}
...
...
briar-core/src/main/java/org/briarproject/briar/privategroup/invitation/CreatorProtocolEngine.java
View file @
7d479063
...
...
@@ -256,7 +256,7 @@ class CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> {
GroupInvitationMessage
m
,
boolean
accept
)
{
SessionId
sessionId
=
new
SessionId
(
m
.
getPrivateGroupId
().
getBytes
());
return
new
GroupInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
tru
e
,
false
,
sessionId
,
m
.
getTimestamp
(),
false
,
false
,
fals
e
,
false
,
sessionId
,
accept
,
m
.
getPrivateGroupId
());
}
}
briar-core/src/main/java/org/briarproject/briar/sharing/BlogProtocolEngineImpl.java
View file @
7d479063
...
...
@@ -61,7 +61,7 @@ class BlogProtocolEngineImpl extends ProtocolEngineImpl<Blog> {
ContactId
contactId
)
{
BlogInvitationResponse
response
=
invitationFactory
.
createInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
tru
e
,
false
,
m
.
getTimestamp
(),
false
,
false
,
fals
e
,
false
,
true
,
m
.
getShareableId
());
return
new
BlogInvitationResponseReceivedEvent
(
response
,
contactId
);
}
...
...
@@ -71,8 +71,8 @@ class BlogProtocolEngineImpl extends ProtocolEngineImpl<Blog> {
ContactId
contactId
)
{
BlogInvitationResponse
response
=
invitationFactory
.
createInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
tru
e
,
false
,
tru
e
,
m
.
getShareableId
());
m
.
getTimestamp
(),
false
,
false
,
fals
e
,
false
,
fals
e
,
m
.
getShareableId
());
return
new
BlogInvitationResponseReceivedEvent
(
response
,
contactId
);
}
...
...
briar-core/src/main/java/org/briarproject/briar/sharing/ForumProtocolEngineImpl.java
View file @
7d479063
...
...
@@ -73,7 +73,7 @@ class ForumProtocolEngineImpl extends ProtocolEngineImpl<Forum> {
ForumInvitationResponse
response
=
invitationFactory
.
createInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
true
,
false
,
tru
e
,
m
.
getShareableId
());
fals
e
,
m
.
getShareableId
());
return
new
ForumInvitationResponseReceivedEvent
(
response
,
contactId
);
}
...
...
briar-core/src/test/java/org/briarproject/briar/introduction/IntroductionIntegrationTest.java
View file @
7d479063
...
...
@@ -368,13 +368,16 @@ public class IntroductionIntegrationTest
.
getMessageHeaders
(
txn
,
contactId1From0
));
assertEquals
(
2
,
messages
.
size
());
messages
=
withinTransactionReturns
(
db0
,
txn
->
introductionManager0
.
getMessageHeaders
(
txn
,
contactId2From0
));
txn
->
introductionManager0
.
getMessageHeaders
(
txn
,
contactId2From0
));
assertEquals
(
2
,
messages
.
size
());
messages
=
withinTransactionReturns
(
db1
,
txn
->
introductionManager1
.
getMessageHeaders
(
txn
,
contactId0From1
));
assertEquals
(
3
,
messages
.
size
());
txn
->
introductionManager1
.
getMessageHeaders
(
txn
,
contactId0From1
));
assertEquals
(
3
,
messages
.
size
());
messages
=
withinTransactionReturns
(
db2
,
txn
->
introductionManager2
.
getMessageHeaders
(
txn
,
contactId0From2
));
txn
->
introductionManager2
.
getMessageHeaders
(
txn
,
contactId0From2
));
assertEquals
(
3
,
messages
.
size
());
assertFalse
(
listener0
.
aborted
);
assertFalse
(
listener1
.
aborted
);
...
...
briar-core/src/test/java/org/briarproject/briar/privategroup/PrivateGroupManagerIntegrationTest.java
View file @
7d479063
...
...
@@ -408,7 +408,7 @@ public class PrivateGroupManagerIntegrationTest
groupManager2
.
addPrivateGroup
(
txn
,
privateGroup0
,
joinMsg2
,
false
);
// share the group with 0
db2
.
setGroupVisibility
(
txn
,
contactId0From
1
,
privateGroup0
.
getId
(),
SHARED
);
// TODO contactId
contactId0From
2
,
privateGroup0
.
getId
(),
SHARED
);
});
// sync join messages
...
...
briar-core/src/test/java/org/briarproject/briar/sharing/ForumSharingIntegrationTest.java
View file @
7d479063
...
...
@@ -478,11 +478,11 @@ public class ForumSharingIntegrationTest
.
contains
(
contact0From1
));
// and both have each other's invitations (and no response)
assertEquals
(
2
,
withinTransactionReturns
(
db0
,
txn
2
->
forumSharingManager0
.
getMessageHeaders
(
txn
2
,
contactId1From0
))
assertEquals
(
2
,
withinTransactionReturns
(
db0
,
txn
->
forumSharingManager0
.
getMessageHeaders
(
txn
,
contactId1From0
))
.
size
());
assertEquals
(
2
,
withinTransactionReturns
(
db1
,
txn
2
->
forumSharingManager1
.
getMessageHeaders
(
txn
2
,
contactId0From1
))
assertEquals
(
2
,
withinTransactionReturns
(
db1
,
txn
->
forumSharingManager1
.
getMessageHeaders
(
txn
,
contactId0From1
))
.
size
());
// there are no more open invitations
...
...
@@ -561,11 +561,11 @@ public class ForumSharingIntegrationTest
withinTransaction
(
db2
,
txn
->
db2
.
addGroup
(
txn
,
forum0
.
getGroup
()));
// add listeners
listener0
=
new
SharerListener
();
listener0
=
new
SharerListener
(
true
);
c0
.
getEventBus
().
addListener
(
listener0
);
listener1
=
new
InviteeListener
(
true
,
false
);
c1
.
getEventBus
().
addListener
(
listener1
);
listener2
=
new
SharerListener
();
listener2
=
new
SharerListener
(
true
);
c2
.
getEventBus
().
addListener
(
listener2
);
// send invitation
...
...
@@ -790,13 +790,22 @@ public class ForumSharingIntegrationTest
@NotNullByDefault
private
class
SharerListener
implements
EventListener
{
private
final
boolean
accept
;
private
volatile
boolean
requestReceived
=
false
;
private
volatile
boolean
responseReceived
=
false
;
private
SharerListener
(
boolean
accept
)
{
this
.
accept
=
accept
;
}
@Override
public
void
eventOccurred
(
Event
e
)
{
if
(
e
instanceof
ForumInvitationResponseReceivedEvent
)
{
ForumInvitationResponseReceivedEvent
event
=
(
ForumInvitationResponseReceivedEvent
)
e
;
responseReceived
=
true
;
eventWaiter
.
assertEquals
(
accept
,
event
.
getMessageHeader
().
wasAccepted
());
eventWaiter
.
resume
();
}
// this is only needed for tests where a forum is re-shared
...
...
@@ -868,17 +877,19 @@ public class ForumSharingIntegrationTest
ForumInvitationResponseReceivedEvent
event
=
(
ForumInvitationResponseReceivedEvent
)
e
;
eventWaiter
.
assertEquals
(
contactId0From1
,
event
.
getContactId
());
eventWaiter
.
assertEquals
(
accept
,
event
.
getMessageHeader
().
wasAccepted
());
eventWaiter
.
resume
();
}
}
}
private
void
listenToEvents
(
boolean
accept
)
throws
DbException
{
listener0
=
new
SharerListener
();
private
void
listenToEvents
(
boolean
accept
)
{
listener0
=
new
SharerListener
(
accept
);
c0
.
getEventBus
().
addListener
(
listener0
);
listener1
=
new
InviteeListener
(
accept
);
c1
.
getEventBus
().
addListener
(
listener1
);
listener2
=
new
SharerListener
();
listener2
=
new
SharerListener
(
accept
);
c2
.
getEventBus
().
addListener
(
listener2
);
}
...
...
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