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
629e17bb
Commit
629e17bb
authored
Aug 23, 2013
by
Alexander Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add orbot proxy support. Close #230.
parent
5296a9a3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
14 deletions
+54
-14
account_editor.xml
res/values/account_editor.xml
+1
-0
preferences.xml
res/values/preferences.xml
+2
-0
AccountItem.java
src/com/xabber/android/data/account/AccountItem.java
+1
-1
AccountManager.java
src/com/xabber/android/data/account/AccountManager.java
+2
-2
AccountTable.java
src/com/xabber/android/data/account/AccountTable.java
+2
-3
ConnectionItem.java
src/com/xabber/android/data/connection/ConnectionItem.java
+0
-1
ConnectionSettings.java
...om/xabber/android/data/connection/ConnectionSettings.java
+0
-2
ConnectionThread.java
src/com/xabber/android/data/connection/ConnectionThread.java
+1
-2
ProxyType.java
src/com/xabber/android/data/connection/ProxyType.java
+40
-0
AccountEditor.java
src/com/xabber/android/ui/AccountEditor.java
+5
-3
No files found.
res/values/account_editor.xml
View file @
629e17bb
...
...
@@ -109,6 +109,7 @@
<string
name=
"account_proxy_type_http"
>
HTTP
</string>
<string
name=
"account_proxy_type_socks4"
>
SOCKS4
</string>
<string
name=
"account_proxy_type_socks5"
>
SOCKS5
</string>
<string
name=
"account_proxy_type_orbot"
>
Orbot
</string>
<string
name=
"account_proxy_host"
>
Proxy host
</string>
<string
name=
"account_proxy_port"
>
Proxy port
</string>
<string
name=
"account_proxy_user"
>
Proxy user
</string>
...
...
res/values/preferences.xml
View file @
629e17bb
...
...
@@ -414,12 +414,14 @@
<item>
@string/account_proxy_type_http
</item>
<item>
@string/account_proxy_type_socks4
</item>
<item>
@string/account_proxy_type_socks5
</item>
<item>
@string/account_proxy_type_orbot
</item>
</string-array>
<string-array
name=
"account_proxy_type_entryvalues"
>
<item>
@string/account_proxy_type_none
</item>
<item>
@string/account_proxy_type_http
</item>
<item>
@string/account_proxy_type_socks4
</item>
<item>
@string/account_proxy_type_socks5
</item>
<item>
@string/account_proxy_type_orbot
</item>
</string-array>
<string-array
name=
"account_archive_mode_entries"
>
...
...
src/com/xabber/android/data/account/AccountItem.java
View file @
629e17bb
...
...
@@ -19,13 +19,13 @@ import java.util.Date;
import
org.jivesoftware.smack.packet.Presence
;
import
org.jivesoftware.smack.packet.Presence.Type
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.connection.ConnectionItem
;
import
com.xabber.android.data.connection.ConnectionState
;
import
com.xabber.android.data.connection.ConnectionThread
;
import
com.xabber.android.data.connection.ProxyType
;
import
com.xabber.android.data.connection.TLSMode
;
import
com.xabber.androiddev.R
;
...
...
src/com/xabber/android/data/account/AccountManager.java
View file @
629e17bb
...
...
@@ -24,7 +24,6 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Map
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
org.jivesoftware.smack.util.StringUtils
;
import
android.content.res.TypedArray
;
...
...
@@ -36,6 +35,7 @@ import com.xabber.android.data.OnLoadListener;
import
com.xabber.android.data.OnWipeListener
;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.connection.ConnectionState
;
import
com.xabber.android.data.connection.ProxyType
;
import
com.xabber.android.data.connection.TLSMode
;
import
com.xabber.android.data.extension.vcard.VCardManager
;
import
com.xabber.android.data.notification.BaseAccountNotificationProvider
;
...
...
@@ -446,7 +446,7 @@ public class AccountManager implements OnLoadListener, OnWipeListener {
getNextColorIndex
(),
0
,
StatusMode
.
available
,
SettingsManager
.
statusText
(),
true
,
true
,
tlsRequired
?
TLSMode
.
required
:
TLSMode
.
enabled
,
false
,
ProxyType
.
NONE
,
"localhost"
,
8080
,
""
,
""
,
syncable
,
null
,
ProxyType
.
none
,
"localhost"
,
8080
,
""
,
""
,
syncable
,
null
,
null
,
ArchiveMode
.
available
);
onAccountChanged
(
accountItem
.
getAccount
());
if
(
accountItems
.
size
()
>
1
...
...
src/com/xabber/android/data/account/AccountTable.java
View file @
629e17bb
...
...
@@ -24,8 +24,6 @@ import java.security.spec.PKCS8EncodedKeySpec;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Date
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
android.content.ContentValues
;
import
android.content.SharedPreferences.Editor
;
import
android.database.Cursor
;
...
...
@@ -36,6 +34,7 @@ import android.provider.BaseColumns;
import
com.xabber.android.data.AbstractTable
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.DatabaseManager
;
import
com.xabber.android.data.connection.ProxyType
;
import
com.xabber.android.data.connection.TLSMode
;
import
com.xabber.androiddev.R
;
...
...
@@ -289,7 +288,7 @@ class AccountTable extends AbstractTable {
sql
=
"ALTER TABLE accounts ADD COLUMN proxy_password TEXT;"
;
DatabaseManager
.
execSQL
(
db
,
sql
);
sql
=
"UPDATE accounts SET proxy_type = "
+
ProxyType
.
NONE
.
ordinal
()
+
", "
+
ProxyType
.
none
.
ordinal
()
+
", "
+
"proxy_host = \"localhost\", "
+
"proxy_port = 8080, "
+
"proxy_user = \"\", "
+
"proxy_password = \"\" "
+
"WHERE proxy_type IS NULL;"
;
...
...
src/com/xabber/android/data/connection/ConnectionItem.java
View file @
629e17bb
...
...
@@ -15,7 +15,6 @@
package
com
.
xabber
.
android
.
data
.
connection
;
import
org.jivesoftware.smack.XMPPConnection
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
...
...
src/com/xabber/android/data/connection/ConnectionSettings.java
View file @
629e17bb
...
...
@@ -14,8 +14,6 @@
*/
package
com
.
xabber
.
android
.
data
.
connection
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
com.xabber.android.data.account.AccountProtocol
;
/**
...
...
src/com/xabber/android/data/connection/ConnectionThread.java
View file @
629e17bb
...
...
@@ -31,7 +31,6 @@ import org.jivesoftware.smack.filter.PacketFilter;
import
org.jivesoftware.smack.packet.Packet
;
import
org.jivesoftware.smack.packet.StreamError
;
import
org.jivesoftware.smack.proxy.ProxyInfo
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
org.xbill.DNS.Record
;
import
com.xabber.android.data.Application
;
...
...
@@ -279,7 +278,7 @@ public class ConnectionThread implements
*/
private
void
onReady
(
final
InetAddress
address
,
final
int
port
)
{
LogManager
.
i
(
this
,
"Use "
+
address
);
ProxyInfo
proxy
=
new
ProxyInfo
(
proxyType
,
proxyHost
,
proxyPort
,
ProxyInfo
proxy
=
proxyType
.
getProxyInfo
(
proxyHost
,
proxyPort
,
proxyUser
,
proxyPassword
);
ConnectionConfiguration
connectionConfiguration
=
new
ConnectionConfiguration
(
address
.
getHostAddress
(),
port
,
serverName
,
proxy
);
...
...
src/com/xabber/android/data/connection/ProxyType.java
0 → 100644
View file @
629e17bb
package
com
.
xabber
.
android
.
data
.
connection
;
import
org.jivesoftware.smack.proxy.ProxyInfo
;
public
enum
ProxyType
{
none
,
http
,
socks4
,
socks5
,
orbot
;
public
ProxyInfo
getProxyInfo
(
String
proxyHost
,
int
proxyPort
,
String
proxyUser
,
String
proxyPassword
)
{
ProxyInfo
.
ProxyType
proxyType
;
if
(
this
==
none
)
proxyType
=
ProxyInfo
.
ProxyType
.
NONE
;
else
if
(
this
==
http
)
proxyType
=
ProxyInfo
.
ProxyType
.
HTTP
;
else
if
(
this
==
socks4
)
proxyType
=
ProxyInfo
.
ProxyType
.
SOCKS4
;
else
if
(
this
==
socks5
)
proxyType
=
ProxyInfo
.
ProxyType
.
SOCKS5
;
else
if
(
this
==
orbot
)
{
proxyType
=
ProxyInfo
.
ProxyType
.
SOCKS5
;
proxyHost
=
"localhost"
;
proxyPort
=
9050
;
proxyUser
=
""
;
proxyPassword
=
""
;
}
else
throw
new
IllegalStateException
();
return
new
ProxyInfo
(
proxyType
,
proxyHost
,
proxyPort
,
proxyUser
,
proxyPassword
);
}
}
src/com/xabber/android/ui/AccountEditor.java
View file @
629e17bb
...
...
@@ -17,8 +17,7 @@ package com.xabber.android.ui;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.jivesoftware.smack.proxy.ProxyInfo.ProxyType
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
...
...
@@ -31,6 +30,7 @@ import com.xabber.android.data.account.AccountItem;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.AccountProtocol
;
import
com.xabber.android.data.account.ArchiveMode
;
import
com.xabber.android.data.connection.ProxyType
;
import
com.xabber.android.data.connection.TLSMode
;
import
com.xabber.android.data.intent.AccountIntentBuilder
;
import
com.xabber.android.ui.helper.BaseSettingsActivity
;
...
...
@@ -145,7 +145,9 @@ public class AccountEditor extends BaseSettingsActivity implements
if
(
getString
(
R
.
string
.
account_proxy_type_key
).
equals
(
preference
.
getKey
()))
{
boolean
enabled
=
!
getString
(
R
.
string
.
account_proxy_type_none
)
.
equals
(
newValue
);
.
equals
(
newValue
)
&&
!
getString
(
R
.
string
.
account_proxy_type_orbot
).
equals
(
newValue
);
for
(
int
id
:
new
Integer
[]
{
R
.
string
.
account_proxy_host_key
,
R
.
string
.
account_proxy_port_key
,
R
.
string
.
account_proxy_user_key
,
...
...
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