Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
579
Issues
579
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
briar
Commits
2d9345c0
Verified
Commit
2d9345c0
authored
Sep 04, 2018
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary information from private message classes
parent
817df9c7
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
137 additions
and
214 deletions
+137
-214
ContactListFragment.java
...iarproject/briar/android/contact/ContactListFragment.java
+1
-2
ConversationItem.java
.../briarproject/briar/android/contact/ConversationItem.java
+10
-15
ForumControllerImpl.java
...briarproject/briar/android/forum/ForumControllerImpl.java
+1
-1
GroupControllerImpl.java
...ndroid/privategroup/conversation/GroupControllerImpl.java
+1
-1
BlogInvitationRequest.java
...rg/briarproject/briar/api/blog/BlogInvitationRequest.java
+1
-1
BlogInvitationResponse.java
...g/briarproject/briar/api/blog/BlogInvitationResponse.java
+2
-4
BaseMessageHeader.java
.../org/briarproject/briar/api/client/BaseMessageHeader.java
+0
-58
ForumInvitationRequest.java
.../briarproject/briar/api/forum/ForumInvitationRequest.java
+1
-1
ForumInvitationResponse.java
...briarproject/briar/api/forum/ForumInvitationResponse.java
+2
-4
IntroductionMessage.java
...arproject/briar/api/introduction/IntroductionMessage.java
+3
-18
IntroductionRequest.java
...arproject/briar/api/introduction/IntroductionRequest.java
+11
-7
IntroductionResponse.java
...rproject/briar/api/introduction/IntroductionResponse.java
+9
-3
PrivateMessageHeader.java
...riarproject/briar/api/messaging/PrivateMessageHeader.java
+40
-3
GroupInvitationRequest.java
...r/api/privategroup/invitation/GroupInvitationRequest.java
+1
-1
GroupInvitationResponse.java
.../api/privategroup/invitation/GroupInvitationResponse.java
+2
-4
InvitationMessage.java
...org/briarproject/briar/api/sharing/InvitationMessage.java
+3
-11
InvitationRequest.java
...org/briarproject/briar/api/sharing/InvitationRequest.java
+4
-4
InvitationResponse.java
...rg/briarproject/briar/api/sharing/InvitationResponse.java
+3
-4
Shareable.java
...in/java/org/briarproject/briar/api/sharing/Shareable.java
+0
-3
IntroduceeProtocolEngine.java
...rproject/briar/introduction/IntroduceeProtocolEngine.java
+4
-6
IntroductionManagerImpl.java
...arproject/briar/introduction/IntroductionManagerImpl.java
+3
-4
CreatorProtocolEngine.java
.../briar/privategroup/invitation/CreatorProtocolEngine.java
+1
-1
GroupInvitationManagerImpl.java
...r/privategroup/invitation/GroupInvitationManagerImpl.java
+1
-1
BlogInvitationFactoryImpl.java
...briarproject/briar/sharing/BlogInvitationFactoryImpl.java
+2
-3
BlogProtocolEngineImpl.java
...rg/briarproject/briar/sharing/BlogProtocolEngineImpl.java
+2
-2
BlogSharingManagerImpl.java
...rg/briarproject/briar/sharing/BlogSharingManagerImpl.java
+2
-2
ForumInvitationFactoryImpl.java
...riarproject/briar/sharing/ForumInvitationFactoryImpl.java
+2
-2
ForumProtocolEngineImpl.java
...g/briarproject/briar/sharing/ForumProtocolEngineImpl.java
+2
-2
InvitationFactory.java
...ava/org/briarproject/briar/sharing/InvitationFactory.java
+1
-1
SharingManagerImpl.java
...va/org/briarproject/briar/sharing/SharingManagerImpl.java
+14
-15
GroupInvitationIntegrationTest.java
...ivategroup/invitation/GroupInvitationIntegrationTest.java
+0
-3
GroupInvitationManagerImplTest.java
...ivategroup/invitation/GroupInvitationManagerImplTest.java
+0
-1
BlogSharingIntegrationTest.java
...riarproject/briar/sharing/BlogSharingIntegrationTest.java
+6
-18
ForumSharingIntegrationTest.java
...iarproject/briar/sharing/ForumSharingIntegrationTest.java
+2
-8
No files found.
briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java
View file @
2d9345c0
...
...
@@ -36,7 +36,6 @@ import org.briarproject.briar.android.fragment.BaseFragment;
import
org.briarproject.briar.android.keyagreement.ContactExchangeActivity
;
import
org.briarproject.briar.android.view.BriarRecyclerView
;
import
org.briarproject.briar.api.android.AndroidNotificationManager
;
import
org.briarproject.briar.api.client.BaseMessageHeader
;
import
org.briarproject.briar.api.client.MessageTracker.GroupCount
;
import
org.briarproject.briar.api.introduction.IntroductionRequest
;
import
org.briarproject.briar.api.introduction.IntroductionResponse
;
...
...
@@ -283,7 +282,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
}
}
private
void
updateItem
(
ContactId
c
,
Bas
eMessageHeader
h
)
{
private
void
updateItem
(
ContactId
c
,
Privat
eMessageHeader
h
)
{
runOnUiThreadUnlessDestroyed
(()
->
{
adapter
.
incrementRevision
();
int
position
=
adapter
.
findItemPosition
(
c
);
...
...
briar-android/src/main/java/org/briarproject/briar/android/contact/ConversationItem.java
View file @
2d9345c0
...
...
@@ -11,7 +11,6 @@ import org.briarproject.briar.R;
import
org.briarproject.briar.android.contact.ConversationRequestItem.RequestType
;
import
org.briarproject.briar.api.blog.BlogInvitationRequest
;
import
org.briarproject.briar.api.blog.BlogInvitationResponse
;
import
org.briarproject.briar.api.client.BaseMessageHeader
;
import
org.briarproject.briar.api.forum.ForumInvitationRequest
;
import
org.briarproject.briar.api.forum.ForumInvitationResponse
;
import
org.briarproject.briar.api.introduction.IntroductionRequest
;
...
...
@@ -92,7 +91,7 @@ abstract class ConversationItem {
if
(
ir
.
isLocal
())
{
String
text
=
ctx
.
getString
(
R
.
string
.
introduction_request_sent
,
contactName
,
ir
.
getName
());
return
new
ConversationNoticeOutItem
(
ir
.
get
Message
Id
(),
return
new
ConversationNoticeOutItem
(
ir
.
getId
(),
ir
.
getGroupId
(),
text
,
ir
.
getMessage
(),
ir
.
getTimestamp
(),
ir
.
isSent
(),
ir
.
isSeen
());
}
else
{
...
...
@@ -109,7 +108,7 @@ abstract class ConversationItem {
text
=
ctx
.
getString
(
R
.
string
.
introduction_request_received
,
contactName
,
ir
.
getName
());
}
return
new
ConversationRequestItem
(
ir
.
get
Message
Id
(),
return
new
ConversationRequestItem
(
ir
.
getId
(),
ir
.
getGroupId
(),
INTRODUCTION
,
ir
.
getSessionId
(),
text
,
ir
.
getMessage
(),
ir
.
getTimestamp
(),
ir
.
isRead
(),
null
,
ir
.
wasAnswered
(),
false
);
...
...
@@ -132,9 +131,8 @@ abstract class ConversationItem {
R
.
string
.
introduction_response_declined_sent
,
ir
.
getName
());
}
return
new
ConversationNoticeOutItem
(
ir
.
getMessageId
(),
ir
.
getGroupId
(),
text
,
null
,
ir
.
getTimestamp
(),
ir
.
isSent
(),
ir
.
isSeen
());
return
new
ConversationNoticeOutItem
(
ir
.
getId
(),
ir
.
getGroupId
(),
text
,
null
,
ir
.
getTimestamp
(),
ir
.
isSent
(),
ir
.
isSeen
());
}
else
{
String
text
;
if
(
ir
.
wasAccepted
())
{
...
...
@@ -152,9 +150,8 @@ abstract class ConversationItem {
contactName
,
ir
.
getName
());
}
}
return
new
ConversationNoticeInItem
(
ir
.
getMessageId
(),
ir
.
getGroupId
(),
text
,
null
,
ir
.
getTimestamp
(),
ir
.
isRead
());
return
new
ConversationNoticeInItem
(
ir
.
getId
(),
ir
.
getGroupId
(),
text
,
null
,
ir
.
getTimestamp
(),
ir
.
isRead
());
}
}
...
...
@@ -272,12 +269,10 @@ abstract class ConversationItem {
/**
* This method should not be used to display the resulting ConversationItem
* in the UI, but only to update list information based on the
*
Bas
eMessageHeader.
*
Privat
eMessageHeader.
**/
static
ConversationItem
from
(
Context
ctx
,
BaseMessageHeader
h
)
{
if
(
h
instanceof
PrivateMessageHeader
)
{
return
from
((
PrivateMessageHeader
)
h
);
}
else
if
(
h
instanceof
IntroductionRequest
)
{
static
ConversationItem
from
(
Context
ctx
,
PrivateMessageHeader
h
)
{
if
(
h
instanceof
IntroductionRequest
)
{
return
from
(
ctx
,
""
,
(
IntroductionRequest
)
h
);
}
else
if
(
h
instanceof
IntroductionResponse
)
{
return
from
(
ctx
,
""
,
(
IntroductionResponse
)
h
);
...
...
@@ -286,7 +281,7 @@ abstract class ConversationItem {
}
else
if
(
h
instanceof
InvitationResponse
)
{
return
from
(
ctx
,
""
,
(
InvitationResponse
)
h
);
}
else
{
throw
new
IllegalArgumentException
(
"Unknown message header"
);
return
from
(
h
);
}
}
...
...
briar-android/src/main/java/org/briarproject/briar/android/forum/ForumControllerImpl.java
View file @
2d9345c0
...
...
@@ -88,7 +88,7 @@ class ForumControllerImpl extends
(
ForumInvitationResponse
)
f
.
getResponse
();
if
(
r
.
getShareableId
().
equals
(
getGroupId
())
&&
r
.
wasAccepted
())
{
LOG
.
info
(
"Forum invitation was accepted"
);
onForumInvitationAccepted
(
r
.
getContactId
());
onForumInvitationAccepted
(
f
.
getContactId
());
}
}
else
if
(
e
instanceof
ContactLeftShareableEvent
)
{
ContactLeftShareableEvent
c
=
(
ContactLeftShareableEvent
)
e
;
...
...
briar-android/src/main/java/org/briarproject/briar/android/privategroup/conversation/GroupControllerImpl.java
View file @
2d9345c0
...
...
@@ -103,7 +103,7 @@ class GroupControllerImpl extends
(
GroupInvitationResponse
)
g
.
getResponse
();
if
(
getGroupId
().
equals
(
r
.
getShareableId
())
&&
r
.
wasAccepted
())
{
listener
.
runOnUiThreadUnlessDestroyed
(
()
->
listener
.
onInvitationAccepted
(
r
.
getContactId
()));
()
->
listener
.
onInvitationAccepted
(
g
.
getContactId
()));
}
}
else
if
(
e
instanceof
GroupDissolvedEvent
)
{
GroupDissolvedEvent
g
=
(
GroupDissolvedEvent
)
e
;
...
...
briar-api/src/main/java/org/briarproject/briar/api/blog/BlogInvitationRequest.java
View file @
2d9345c0
...
...
@@ -17,7 +17,7 @@ public class BlogInvitationRequest extends InvitationRequest<Blog> {
SessionId
sessionId
,
Blog
blog
,
ContactId
contactId
,
@Nullable
String
message
,
boolean
available
,
boolean
canBeOpened
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
blog
,
contactId
,
message
,
available
,
canBeOpened
);
message
,
available
,
canBeOpened
);
}
public
String
getBlogAuthorName
()
{
...
...
briar-api/src/main/java/org/briarproject/briar/api/blog/BlogInvitationResponse.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
blog
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -12,10 +11,9 @@ public class BlogInvitationResponse extends InvitationResponse {
public
BlogInvitationResponse
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
GroupId
blogId
,
ContactId
contactId
,
boolean
accept
)
{
SessionId
sessionId
,
GroupId
blogId
,
boolean
accept
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
blogId
,
contactId
,
accept
);
accept
);
}
}
briar-api/src/main/java/org/briarproject/briar/api/client/BaseMessageHeader.java
deleted
100644 → 0
View file @
817df9c7
package
org
.
briarproject
.
briar
.
api
.
client
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
import
javax.annotation.concurrent.Immutable
;
@Immutable
@NotNullByDefault
public
abstract
class
BaseMessageHeader
{
private
final
MessageId
id
;
private
final
GroupId
groupId
;
private
final
long
timestamp
;
private
final
boolean
local
,
sent
,
seen
,
read
;
public
BaseMessageHeader
(
MessageId
id
,
GroupId
groupId
,
long
timestamp
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
)
{
this
.
id
=
id
;
this
.
groupId
=
groupId
;
this
.
timestamp
=
timestamp
;
this
.
local
=
local
;
this
.
sent
=
sent
;
this
.
seen
=
seen
;
this
.
read
=
read
;
}
public
MessageId
getId
()
{
return
id
;
}
public
GroupId
getGroupId
()
{
return
groupId
;
}
public
long
getTimestamp
()
{
return
timestamp
;
}
public
boolean
isLocal
()
{
return
local
;
}
public
boolean
isSent
()
{
return
sent
;
}
public
boolean
isSeen
()
{
return
seen
;
}
public
boolean
isRead
()
{
return
read
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/forum/ForumInvitationRequest.java
View file @
2d9345c0
...
...
@@ -19,7 +19,7 @@ public class ForumInvitationRequest extends InvitationRequest<Forum> {
SessionId
sessionId
,
Forum
forum
,
ContactId
contactId
,
@Nullable
String
message
,
boolean
available
,
boolean
canBeOpened
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
forum
,
contactId
,
message
,
available
,
canBeOpened
);
message
,
available
,
canBeOpened
);
}
public
String
getForumName
()
{
...
...
briar-api/src/main/java/org/briarproject/briar/api/forum/ForumInvitationResponse.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
forum
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -15,10 +14,9 @@ public class ForumInvitationResponse extends InvitationResponse {
public
ForumInvitationResponse
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
GroupId
forumId
,
ContactId
contactId
,
boolean
accept
)
{
SessionId
sessionId
,
GroupId
forumId
,
boolean
accept
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
forumId
,
contactId
,
accept
);
accept
);
}
}
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionMessage.java
View file @
2d9345c0
...
...
@@ -3,41 +3,26 @@ package org.briarproject.briar.api.introduction;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
import
org.briarproject.briar.api.client.BaseMessageHeader
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.messaging.PrivateMessageHeader
;
import
javax.annotation.concurrent.Immutable
;
import
static
org
.
briarproject
.
briar
.
api
.
introduction
.
Role
.
INTRODUCER
;
@Immutable
@NotNullByDefault
public
class
IntroductionMessage
extends
Bas
eMessageHeader
{
public
abstract
class
IntroductionMessage
extends
Privat
eMessageHeader
{
private
final
SessionId
sessionId
;
private
final
MessageId
messageId
;
private
final
Role
role
;
IntroductionMessage
(
SessionId
sessionId
,
MessageId
messageId
,
GroupId
groupId
,
Role
role
,
long
time
,
boolean
local
,
boolean
sent
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
)
{
super
(
messageId
,
groupId
,
time
,
local
,
sent
,
seen
,
read
);
this
.
sessionId
=
sessionId
;
this
.
messageId
=
messageId
;
this
.
role
=
role
;
}
public
SessionId
getSessionId
()
{
return
sessionId
;
}
public
MessageId
getMessageId
()
{
return
messageId
;
}
public
boolean
isIntroducer
()
{
return
role
==
INTRODUCER
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionRequest.java
View file @
2d9345c0
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
;
...
...
@@ -10,25 +11,28 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public
class
IntroductionRequest
extends
Introduction
Respons
e
{
public
class
IntroductionRequest
extends
Introduction
Messag
e
{
private
final
Author
introducedAuthor
;
@Nullable
private
final
String
message
;
private
final
boolean
answered
,
exists
;
public
IntroductionRequest
(
SessionId
sessionId
,
MessageId
messageId
,
GroupId
groupId
,
Role
role
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
String
name
,
boolean
accepted
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
Author
introducedAuthor
,
@Nullable
String
message
,
boolean
answered
,
boolean
exists
)
{
super
(
sessionId
,
messageId
,
groupId
,
role
,
time
,
local
,
sent
,
seen
,
read
,
name
,
accepted
);
super
(
sessionId
,
messageId
,
groupId
,
time
,
local
,
sent
,
seen
,
read
);
this
.
introducedAuthor
=
introducedAuthor
;
this
.
message
=
message
;
this
.
answered
=
answered
;
this
.
exists
=
exists
;
}
public
String
getName
()
{
return
introducedAuthor
.
getName
();
}
@Nullable
public
String
getMessage
()
{
return
message
;
...
...
briar-api/src/main/java/org/briarproject/briar/api/introduction/IntroductionResponse.java
View file @
2d9345c0
...
...
@@ -7,20 +7,22 @@ import org.briarproject.briar.api.client.SessionId;
import
javax.annotation.concurrent.Immutable
;
import
static
org
.
briarproject
.
briar
.
api
.
introduction
.
Role
.
INTRODUCER
;
@Immutable
@NotNullByDefault
public
class
IntroductionResponse
extends
IntroductionMessage
{
private
final
String
name
;
private
final
Role
role
;
private
final
boolean
accepted
;
public
IntroductionResponse
(
SessionId
sessionId
,
MessageId
messageId
,
GroupId
groupId
,
Role
role
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
String
name
,
boolean
accepted
)
{
super
(
sessionId
,
messageId
,
groupId
,
role
,
time
,
local
,
sent
,
seen
,
read
);
super
(
sessionId
,
messageId
,
groupId
,
time
,
local
,
sent
,
seen
,
read
);
this
.
name
=
name
;
this
.
role
=
role
;
this
.
accepted
=
accepted
;
}
...
...
@@ -28,6 +30,10 @@ public class IntroductionResponse extends IntroductionMessage {
return
name
;
}
public
boolean
isIntroducer
()
{
return
role
==
INTRODUCER
;
}
public
boolean
wasAccepted
()
{
return
accepted
;
}
...
...
briar-api/src/main/java/org/briarproject/briar/api/messaging/PrivateMessageHeader.java
View file @
2d9345c0
...
...
@@ -3,18 +3,55 @@ package org.briarproject.briar.api.messaging;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
import
org.briarproject.briar.api.client.BaseMessageHeader
;
import
javax.annotation.concurrent.Immutable
;
@Immutable
@NotNullByDefault
public
class
PrivateMessageHeader
extends
BaseMessageHeader
{
public
class
PrivateMessageHeader
{
private
final
MessageId
id
;
private
final
GroupId
groupId
;
private
final
long
timestamp
;
private
final
boolean
local
,
sent
,
seen
,
read
;
public
PrivateMessageHeader
(
MessageId
id
,
GroupId
groupId
,
long
timestamp
,
boolean
local
,
boolean
read
,
boolean
sent
,
boolean
seen
)
{
this
.
id
=
id
;
this
.
groupId
=
groupId
;
this
.
timestamp
=
timestamp
;
this
.
local
=
local
;
this
.
sent
=
sent
;
this
.
seen
=
seen
;
this
.
read
=
read
;
}
public
MessageId
getId
()
{
return
id
;
}
public
GroupId
getGroupId
()
{
return
groupId
;
}
public
long
getTimestamp
()
{
return
timestamp
;
}
public
boolean
isLocal
()
{
return
local
;
}
public
boolean
isSent
()
{
return
sent
;
}
public
boolean
isSeen
()
{
return
seen
;
}
super
(
id
,
groupId
,
timestamp
,
local
,
sent
,
seen
,
read
);
public
boolean
isRead
()
{
return
read
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/privategroup/invitation/GroupInvitationRequest.java
View file @
2d9345c0
...
...
@@ -20,7 +20,7 @@ public class GroupInvitationRequest extends InvitationRequest<PrivateGroup> {
SessionId
sessionId
,
PrivateGroup
shareable
,
ContactId
contactId
,
@Nullable
String
message
,
boolean
available
,
boolean
canBeOpened
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
shareable
,
contactId
,
message
,
available
,
canBeOpened
);
message
,
available
,
canBeOpened
);
}
}
briar-api/src/main/java/org/briarproject/briar/api/privategroup/invitation/GroupInvitationResponse.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
privategroup
.
invitation
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -15,10 +14,9 @@ public class GroupInvitationResponse extends InvitationResponse {
public
GroupInvitationResponse
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
GroupId
shareableId
,
ContactId
contactId
,
boolean
accept
)
{
SessionId
sessionId
,
GroupId
shareableId
,
boolean
accept
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
shareableId
,
contactId
,
accept
);
shareableId
,
accept
);
}
}
briar-api/src/main/java/org/briarproject/briar/api/sharing/InvitationMessage.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
sharing
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
import
org.briarproject.briar.api.client.BaseMessageHeader
;
import
org.briarproject.briar.api.client.SessionId
;
import
org.briarproject.briar.api.messaging.PrivateMessageHeader
;
import
javax.annotation.concurrent.Immutable
;
@Immutable
@NotNullByDefault
public
class
InvitationMessage
extends
Bas
eMessageHeader
{
public
abstract
class
InvitationMessage
extends
Privat
eMessageHeader
{
private
final
SessionId
sessionId
;
private
final
ContactId
contactId
;
public
InvitationMessage
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
ContactId
contactId
)
{
SessionId
sessionId
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
);
this
.
sessionId
=
sessionId
;
this
.
contactId
=
contactId
;
}
public
SessionId
getSessionId
()
{
return
sessionId
;
}
public
ContactId
getContactId
()
{
return
contactId
;
}
}
briar-api/src/main/java/org/briarproject/briar/api/sharing/InvitationRequest.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
sharing
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -11,7 +10,8 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public
class
InvitationRequest
<
S
extends
Shareable
>
extends
InvitationMessage
{
public
abstract
class
InvitationRequest
<
S
extends
Shareable
>
extends
InvitationMessage
{
private
final
S
shareable
;
@Nullable
...
...
@@ -20,9 +20,9 @@ public class InvitationRequest<S extends Shareable> extends InvitationMessage {
public
InvitationRequest
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
S
shareable
,
ContactId
contactId
,
SessionId
sessionId
,
S
shareable
,
@Nullable
String
message
,
boolean
available
,
boolean
canBeOpened
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
contactId
);
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
);
this
.
shareable
=
shareable
;
this
.
message
=
message
;
this
.
available
=
available
;
...
...
briar-api/src/main/java/org/briarproject/briar/api/sharing/InvitationResponse.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
sharing
;
import
org.briarproject.bramble.api.contact.ContactId
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.bramble.api.sync.MessageId
;
...
...
@@ -10,7 +9,7 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public
class
InvitationResponse
extends
InvitationMessage
{
public
abstract
class
InvitationResponse
extends
InvitationMessage
{
private
final
GroupId
shareableId
;
private
final
boolean
accept
;
...
...
@@ -18,8 +17,8 @@ public class InvitationResponse extends InvitationMessage {
public
InvitationResponse
(
MessageId
id
,
GroupId
groupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
SessionId
sessionId
,
GroupId
shareableId
,
ContactId
contactId
,
boolean
accept
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
contactId
);
boolean
accept
)
{
super
(
id
,
groupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
);
this
.
shareableId
=
shareableId
;
this
.
accept
=
accept
;
}
...
...
briar-api/src/main/java/org/briarproject/briar/api/sharing/Shareable.java
View file @
2d9345c0
package
org
.
briarproject
.
briar
.
api
.
sharing
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.Group
;
import
org.briarproject.bramble.api.sync.GroupId
;
@NotNullByDefault
...
...
@@ -9,8 +8,6 @@ public interface Shareable {
GroupId
getId
();
Group
getGroup
();
String
getName
();
}
briar-core/src/main/java/org/briarproject/briar/introduction/IntroduceeProtocolEngine.java
View file @
2d9345c0
...
...
@@ -41,7 +41,6 @@ import javax.inject.Inject;
import
static
java
.
util
.
logging
.
Level
.
WARNING
;
import
static
org
.
briarproject
.
bramble
.
util
.
LogUtils
.
logException
;
import
static
org
.
briarproject
.
briar
.
api
.
introduction
.
Role
.
INTRODUCEE
;
import
static
org
.
briarproject
.
briar
.
introduction
.
IntroduceeState
.
AWAIT_AUTH
;
import
static
org
.
briarproject
.
briar
.
introduction
.
IntroduceeState
.
AWAIT_RESPONSES
;
import
static
org
.
briarproject
.
briar
.
introduction
.
IntroduceeState
.
LOCAL_ACCEPTED
;
...
...
@@ -255,11 +254,10 @@ class IntroduceeProtocolEngine
localAuthor
.
getId
());
boolean
contactExists
=
contactManager
.
contactExists
(
txn
,
m
.
getAuthor
().
getId
(),
localAuthor
.
getId
());
IntroductionRequest
request
=
new
IntroductionRequest
(
s
.
getSessionId
(),
m
.
getMessageId
(),
m
.
getGroupId
(),
INTRODUCEE
,
m
.
getTimestamp
(),
false
,
false
,
false
,
false
,
m
.
getAuthor
().
getName
(),
false
,
m
.
getMessage
(),
false
,
contactExists
);
IntroductionRequest
request
=
new
IntroductionRequest
(
s
.
getSessionId
(),
m
.
getMessageId
(),
m
.
getGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
false
,
false
,
m
.
getAuthor
(),
m
.
getMessage
(),
false
,
contactExists
);
IntroductionRequestReceivedEvent
e
=
new
IntroductionRequestReceivedEvent
(
c
.
getId
(),
request
);
txn
.
attach
(
e
);
...
...
briar-core/src/main/java/org/briarproject/briar/introduction/IntroductionManagerImpl.java
View file @
2d9345c0
...
...
@@ -472,10 +472,9 @@ class IntroductionManagerImpl extends ConversationClientImpl
localAuthor
.
getId
());
return
new
IntroductionRequest
(
sessionId
,
m
,
contactGroupId
,
role
,
meta
.
getTimestamp
(),
meta
.
isLocal
(),
status
.
isSent
(),
status
.
isSeen
(),
meta
.
isRead
(),
author
.
getName
(),
false
,
message
,
!
meta
.
isAvailableToAnswer
(),
contactExists
);
meta
.
getTimestamp
(),
meta
.
isLocal
(),
status
.
isSent
(),
status
.
isSeen
(),
meta
.
isRead
(),
author
,
message
,
!
meta
.
isAvailableToAnswer
(),
contactExists
);
}
private
IntroductionResponse
parseInvitationResponse
(
GroupId
contactGroupId
,
...
...
briar-core/src/main/java/org/briarproject/briar/privategroup/invitation/CreatorProtocolEngine.java
View file @
2d9345c0
...
...
@@ -258,6 +258,6 @@ class CreatorProtocolEngine extends AbstractProtocolEngine<CreatorSession> {
SessionId
sessionId
=
new
SessionId
(
m
.
getPrivateGroupId
().
getBytes
());
return
new
GroupInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
true
,
false
,
sessionId
,
m
.
getPrivateGroupId
(),
c
,
accept
);
m
.
getPrivateGroupId
(),
accept
);
}
}
briar-core/src/main/java/org/briarproject/briar/privategroup/invitation/GroupInvitationManagerImpl.java
View file @
2d9345c0
...
...
@@ -434,7 +434,7 @@ class GroupInvitationManagerImpl extends ConversationClientImpl
return
new
GroupInvitationResponse
(
m
,
contactGroupId
,
meta
.
getTimestamp
(),
meta
.
isLocal
(),
status
.
isSent
(),
status
.
isSeen
(),
meta
.
isRead
(),
sessionId
,
meta
.
getPrivateGroupId
(),
c
,
accept
);
meta
.
getPrivateGroupId
(),
accept
);
}
@Override
...
...
briar-core/src/main/java/org/briarproject/briar/sharing/BlogInvitationFactoryImpl.java
View file @
2d9345c0
...
...
@@ -30,11 +30,10 @@ public class BlogInvitationFactoryImpl
@Override
public
BlogInvitationResponse
createInvitationResponse
(
MessageId
id
,
GroupId
contactGroupId
,
long
time
,
boolean
local
,
boolean
sent
,
boolean
seen
,
boolean
read
,
GroupId
shareableId
,
ContactId
contactId
,
boolean
accept
)
{
boolean
seen
,
boolean
read
,
GroupId
shareableId
,
boolean
accept
)
{
SessionId
sessionId
=
new
SessionId
(
shareableId
.
getBytes
());
return
new
BlogInvitationResponse
(
id
,
contactGroupId
,
time
,
local
,
sent
,
seen
,
read
,
sessionId
,
shareableId
,
contactId
,
accept
);
sent
,
seen
,
read
,
sessionId
,
shareableId
,
accept
);
}
}
briar-core/src/main/java/org/briarproject/briar/sharing/BlogProtocolEngineImpl.java
View file @
2d9345c0
...
...
@@ -63,7 +63,7 @@ class BlogProtocolEngineImpl extends ProtocolEngineImpl<Blog> {
BlogInvitationResponse
response
=
invitationFactory
.
createInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
true
,
false
,
m
.
getShareableId
(),
contactId
,
true
);
m
.
getShareableId
(),
true
);
return
new
BlogInvitationResponseReceivedEvent
(
contactId
,
response
);
}
...
...
@@ -73,7 +73,7 @@ class BlogProtocolEngineImpl extends ProtocolEngineImpl<Blog> {
BlogInvitationResponse
response
=
invitationFactory
.
createInvitationResponse
(
m
.
getId
(),
m
.
getContactGroupId
(),
m
.
getTimestamp
(),
false
,
false
,
true
,
false
,
m
.
getShareableId
(),
contactId
,
true
);
m
.
getShareableId
(),
true
);
return
new
BlogInvitationResponseReceivedEvent
(
contactId
,
response
);
}
...
...
briar-core/src/main/java/org/briarproject/briar/sharing/BlogSharingManagerImpl.java
View file @
2d9345c0
...
...
@@ -80,8 +80,8 @@ class BlogSharingManagerImpl extends SharingManagerImpl<Blog>
// Pre-share both blogs, if they have not been shared already
try
{
preShare
Shareable
(
txn
,
c
,
ourBlog
);
preShare
Shareable
(
txn
,
c
,
theirBlog
);
preShare
Group
(
txn
,
c
,
ourBlog
.
getGroup
()
);
preShare
Group
(
txn
,
c
,
theirBlog
.
getGroup
()
);
}
catch
(
FormatException
e
)
{
throw
new
DbException
(
e
);
}
...