Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
b11a4c8d
Commit
b11a4c8d
authored
Feb 12, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'aelmahmoudy-new_otr' into develop
parents
3b0a8bcd
e927b0c9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
10 deletions
+57
-10
.gitmodules
.gitmodules
+3
-0
build.gradle
app/build.gradle
+12
-1
otr4j.jar
app/libs/otr4j.jar
+0
-0
otr4j
app/otr4j
+1
-0
OTRManager.java
...ava/com/xabber/android/data/extension/otr/OTRManager.java
+41
-9
No files found.
.gitmodules
0 → 100644
View file @
b11a4c8d
[submodule "app/otr4j"]
path = app/otr4j
url = https://github.com/otr4j/otr4j.git
app/build.gradle
View file @
b11a4c8d
apply
plugin:
'com.android.application'
apply
plugin:
'com.android.application'
repositories
{
mavenCentral
()
mavenLocal
()
}
android
{
android
{
compileSdkVersion
21
compileSdkVersion
21
buildToolsVersion
"21.1.2"
buildToolsVersion
"21.1.2"
...
@@ -12,6 +17,12 @@ android {
...
@@ -12,6 +17,12 @@ android {
versionName
'0.10.18'
versionName
'0.10.18'
}
}
sourceSets
{
main
{
java
.
srcDirs
=
[
'src/main/java'
,
'otr4j/src/main/java'
]
}
}
buildTypes
{
buildTypes
{
release
{
release
{
minifyEnabled
false
minifyEnabled
false
...
@@ -25,7 +36,7 @@ android {
...
@@ -25,7 +36,7 @@ android {
}
}
dependencies
{
dependencies
{
compile
files
(
'libs/otr4j.jar'
)
compile
'com.android.support:appcompat-v7:21.0.3'
compile
'com.android.support:appcompat-v7:21.0.3'
compile
'com.android.support:support-v13:21.0.3'
compile
'com.android.support:support-v13:21.0.3'
compile
'org.bouncycastle:bcprov-jdk15on:1.49'
}
}
app/libs/otr4j.jar
deleted
100644 → 0
View file @
3b0a8bcd
File deleted
otr4j
@
1811af26
Subproject commit 1811af26058c45aa0b67accd29ee278c80b02f0a
app/src/main/java/com/xabber/android/data/extension/otr/OTRManager.java
View file @
b11a4c8d
...
@@ -39,6 +39,7 @@ import com.xabber.android.data.message.MessageManager;
...
@@ -39,6 +39,7 @@ import com.xabber.android.data.message.MessageManager;
import
com.xabber.android.data.notification.EntityNotificationProvider
;
import
com.xabber.android.data.notification.EntityNotificationProvider
;
import
com.xabber.android.data.notification.NotificationManager
;
import
com.xabber.android.data.notification.NotificationManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.android.data.roster.RosterManager
;
import
com.xabber.androiddev.BuildConfig
;
import
com.xabber.androiddev.R
;
import
com.xabber.androiddev.R
;
import
com.xabber.xmpp.archive.OtrMode
;
import
com.xabber.xmpp.archive.OtrMode
;
import
com.xabber.xmpp.archive.SaveMode
;
import
com.xabber.xmpp.archive.SaveMode
;
...
@@ -51,9 +52,9 @@ import net.java.otr4j.OtrPolicyImpl;
...
@@ -51,9 +52,9 @@ import net.java.otr4j.OtrPolicyImpl;
import
net.java.otr4j.crypto.OtrCryptoEngineImpl
;
import
net.java.otr4j.crypto.OtrCryptoEngineImpl
;
import
net.java.otr4j.crypto.OtrCryptoException
;
import
net.java.otr4j.crypto.OtrCryptoException
;
import
net.java.otr4j.io.SerializationUtils
;
import
net.java.otr4j.io.SerializationUtils
;
import
net.java.otr4j.session.InstanceTag
;
import
net.java.otr4j.session.Session
;
import
net.java.otr4j.session.Session
;
import
net.java.otr4j.session.SessionID
;
import
net.java.otr4j.session.SessionID
;
import
net.java.otr4j.session.SessionImpl
;
import
net.java.otr4j.session.SessionStatus
;
import
net.java.otr4j.session.SessionStatus
;
import
java.security.KeyPair
;
import
java.security.KeyPair
;
...
@@ -194,7 +195,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -194,7 +195,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
return
session
;
return
session
;
AccountItem
accountItem
=
AccountManager
.
getInstance
().
getAccount
(
AccountItem
accountItem
=
AccountManager
.
getInstance
().
getAccount
(
account
);
account
);
session
=
new
Session
Impl
(
new
SessionID
(
account
,
user
,
session
=
new
Session
(
new
SessionID
(
account
,
user
,
accountItem
==
null
?
""
:
accountItem
.
getConnectionSettings
()
accountItem
==
null
?
""
:
accountItem
.
getConnectionSettings
()
.
getProtocol
().
toString
()),
this
);
.
getProtocol
().
toString
()),
this
);
session
.
addOtrEngineListener
(
this
);
session
.
addOtrEngineListener
(
this
);
...
@@ -283,7 +284,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -283,7 +284,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
String
getReplyForUnreadableMessage
()
{
public
String
getReplyForUnreadableMessage
(
SessionID
sessionID
)
{
return
Application
.
getInstance
().
getString
(
return
Application
.
getInstance
().
getString
(
R
.
string
.
otr_unreadable_message
);
R
.
string
.
otr_unreadable_message
);
}
}
...
@@ -318,7 +319,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -318,7 +319,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
void
finishedSessionMessage
(
SessionID
sessionID
)
throws
OtrException
{
public
void
finishedSessionMessage
(
SessionID
sessionID
,
String
msgText
)
throws
OtrException
{
newAction
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
(),
null
,
newAction
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
(),
null
,
ChatAction
.
otr_finished_session
);
ChatAction
.
otr_finished_session
);
throw
new
OtrException
(
throw
new
OtrException
(
...
@@ -413,7 +414,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -413,7 +414,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
void
askForSecret
(
SessionID
sessionID
,
String
question
)
{
public
void
askForSecret
(
SessionID
sessionID
,
InstanceTag
receiverTag
,
String
question
)
{
smRequestProvider
.
add
(
smRequestProvider
.
add
(
new
SMRequest
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
(),
new
SMRequest
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
(),
question
),
true
);
question
),
true
);
...
@@ -430,8 +431,13 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -430,8 +431,13 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
*/
*/
public
String
transformSending
(
String
account
,
String
user
,
String
content
)
public
String
transformSending
(
String
account
,
String
user
,
String
content
)
throws
OtrException
{
throws
OtrException
{
return
getOrCreateSession
(
account
,
user
)
String
parts
[]
=
getOrCreateSession
(
account
,
user
)
.
transformSending
(
content
,
null
);
.
transformSending
(
content
,
null
);
if
(
BuildConfig
.
DEBUG
&&
parts
.
length
!=
1
)
{
throw
new
RuntimeException
(
"We do not use fragmentation, so there must be only one otr fragment."
);
}
return
parts
[
0
];
}
}
/**
/**
...
@@ -516,7 +522,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -516,7 +522,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
void
verify
(
SessionID
sessionID
,
boolean
approved
)
{
public
void
verify
(
SessionID
sessionID
,
String
fingerprint
,
boolean
approved
)
{
if
(
approved
)
if
(
approved
)
setVerify
(
sessionID
,
true
);
setVerify
(
sessionID
,
true
);
else
if
(
isVerified
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
()))
else
if
(
isVerified
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
()))
...
@@ -526,7 +532,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -526,7 +532,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
void
unverify
(
SessionID
sessionID
)
{
public
void
unverify
(
SessionID
sessionID
,
String
fingerprint
)
{
setVerify
(
sessionID
,
false
);
setVerify
(
sessionID
,
false
);
removeSMProgress
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
());
removeSMProgress
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
());
}
}
...
@@ -555,7 +561,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -555,7 +561,7 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
}
}
@Override
@Override
public
String
getFallbackMessage
()
{
public
String
getFallbackMessage
(
SessionID
sessionID
)
{
return
Application
.
getInstance
().
getString
(
R
.
string
.
otr_request
);
return
Application
.
getInstance
().
getString
(
R
.
string
.
otr_request
);
}
}
...
@@ -712,4 +718,30 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
...
@@ -712,4 +718,30 @@ public class OTRManager implements OtrEngineHost, OtrEngineListener,
endAllSessions
();
endAllSessions
();
}
}
@Override
public
int
getMaxFragmentSize
(
SessionID
sessionID
)
{
// we do not want fragmentation
return
Integer
.
MAX_VALUE
;
}
@Override
public
void
outgoingSessionChanged
(
SessionID
sessionID
)
{
LogManager
.
i
(
this
,
"Outgoing session change with SessionID "
+
sessionID
);
// TODO what to in this situation?
}
@Override
public
void
messageFromAnotherInstanceReceived
(
SessionID
sessionID
)
{
LogManager
.
i
(
this
,
"Message from another instance received on SessionID "
+
sessionID
+
". Restarting OTR session for this user."
);
newAction
(
sessionID
.
getAccountID
(),
sessionID
.
getUserID
(),
null
,
ChatAction
.
otr_unreadable
);
}
@Override
public
void
multipleInstancesDetected
(
SessionID
sessionID
)
{
LogManager
.
i
(
this
,
"Multiple instances detected on SessionID "
+
sessionID
);
// since this is not supported, we don't need to do anything
}
}
}
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