copy commits
This commit is contained in:
commit
cb7fcfcc11
10 changed files with 128 additions and 37 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
####Version 1.6.12
|
####Version 1.6.12
|
||||||
* added blue tick as read indicator
|
* added blue tick as read indicator
|
||||||
* added backup to SD option
|
* tab completion for MUC nicks
|
||||||
|
* history export to SD card
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
####Version 1.6.11
|
####Version 1.6.11
|
||||||
* optimized app updater and increased app update check period to once a
|
* optimized app updater and increased app update check period to once a
|
||||||
|
|
|
@ -52,7 +52,7 @@ android {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 99
|
versionCode 99
|
||||||
versionName "1.6.12 beta"
|
versionName "1.6.12"
|
||||||
project.ext.set(archivesBaseName, archivesBaseName + "-" + versionName);
|
project.ext.set(archivesBaseName, archivesBaseName + "-" + versionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,9 @@ public class MucOptions {
|
||||||
this.error = ERROR_NO_ERROR;
|
this.error = ERROR_NO_ERROR;
|
||||||
self = user;
|
self = user;
|
||||||
if (mNickChangingInProgress) {
|
if (mNickChangingInProgress) {
|
||||||
|
if (onRenameListener != null) {
|
||||||
onRenameListener.onSuccess();
|
onRenameListener.onSuccess();
|
||||||
|
}
|
||||||
mNickChangingInProgress = false;
|
mNickChangingInProgress = false;
|
||||||
} else if (this.onJoinListener != null) {
|
} else if (this.onJoinListener != null) {
|
||||||
this.onJoinListener.onSuccess();
|
this.onJoinListener.onSuccess();
|
||||||
|
|
|
@ -260,6 +260,10 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getRotation(File file) {
|
||||||
|
return getRotation(Uri.parse("file://"+file.getAbsolutePath()));
|
||||||
|
}
|
||||||
|
|
||||||
private int getRotation(Uri image) {
|
private int getRotation(Uri image) {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
|
@ -274,8 +278,7 @@ public class FileBackend {
|
||||||
|
|
||||||
public Bitmap getThumbnail(Message message, int size, boolean cacheOnly)
|
public Bitmap getThumbnail(Message message, int size, boolean cacheOnly)
|
||||||
throws FileNotFoundException {
|
throws FileNotFoundException {
|
||||||
Bitmap thumbnail = mXmppConnectionService.getBitmapCache().get(
|
Bitmap thumbnail = mXmppConnectionService.getBitmapCache().get(message.getUuid());
|
||||||
message.getUuid());
|
|
||||||
if ((thumbnail == null) && (!cacheOnly)) {
|
if ((thumbnail == null) && (!cacheOnly)) {
|
||||||
File file = getFile(message);
|
File file = getFile(message);
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
|
@ -285,8 +288,12 @@ public class FileBackend {
|
||||||
throw new FileNotFoundException();
|
throw new FileNotFoundException();
|
||||||
}
|
}
|
||||||
thumbnail = resize(fullsize, size);
|
thumbnail = resize(fullsize, size);
|
||||||
this.mXmppConnectionService.getBitmapCache().put(message.getUuid(),
|
fullsize.recycle();
|
||||||
thumbnail);
|
int rotation = getRotation(file);
|
||||||
|
if (rotation > 0) {
|
||||||
|
thumbnail = rotate(thumbnail, rotation);
|
||||||
|
}
|
||||||
|
this.mXmppConnectionService.getBitmapCache().put(message.getUuid(),thumbnail);
|
||||||
}
|
}
|
||||||
return thumbnail;
|
return thumbnail;
|
||||||
}
|
}
|
||||||
|
@ -512,8 +519,10 @@ public class FileBackend {
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
options.inJustDecodeBounds = true;
|
options.inJustDecodeBounds = true;
|
||||||
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
|
||||||
int imageHeight = options.outHeight;
|
int rotation = getRotation(file);
|
||||||
int imageWidth = options.outWidth;
|
boolean rotated = rotation == 90 || rotation == 270;
|
||||||
|
int imageHeight = rotated ? options.outWidth : options.outHeight;
|
||||||
|
int imageWidth = rotated ? options.outHeight : options.outWidth;
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
message.setBody(Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
|
message.setBody(Long.toString(file.getSize()) + '|' + imageWidth + '|' + imageHeight);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
} else if (account.getStatus() == Account.State.REGISTRATION_SUCCESSFUL) {
|
} else if (account.getStatus() == Account.State.REGISTRATION_SUCCESSFUL) {
|
||||||
databaseBackend.updateAccount(account);
|
databaseBackend.updateAccount(account);
|
||||||
reconnectAccount(account, true);
|
reconnectAccount(account, true, false);
|
||||||
} else if ((account.getStatus() != Account.State.CONNECTING)
|
} else if ((account.getStatus() != Account.State.CONNECTING)
|
||||||
&& (account.getStatus() != Account.State.NO_INTERNET)) {
|
&& (account.getStatus() != Account.State.NO_INTERNET)) {
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
|
@ -442,6 +442,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
final String action = intent == null ? null : intent.getAction();
|
final String action = intent == null ? null : intent.getAction();
|
||||||
|
boolean interactive = false;
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ConnectivityManager.CONNECTIVITY_ACTION:
|
case ConnectivityManager.CONNECTIVITY_ACTION:
|
||||||
|
@ -468,6 +469,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
break;
|
break;
|
||||||
case ACTION_TRY_AGAIN:
|
case ACTION_TRY_AGAIN:
|
||||||
resetAllAttemptCounts(false);
|
resetAllAttemptCounts(false);
|
||||||
|
interactive = true;
|
||||||
break;
|
break;
|
||||||
case ACTION_DISABLE_ACCOUNT:
|
case ACTION_DISABLE_ACCOUNT:
|
||||||
try {
|
try {
|
||||||
|
@ -508,7 +510,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
if (lastSent > lastReceived) {
|
if (lastSent > lastReceived) {
|
||||||
if (pingTimeoutIn < 0) {
|
if (pingTimeoutIn < 0) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": ping timeout");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": ping timeout");
|
||||||
this.reconnectAccount(account, true);
|
this.reconnectAccount(account, true, interactive);
|
||||||
} else {
|
} else {
|
||||||
int secs = (int) (pingTimeoutIn / 1000);
|
int secs = (int) (pingTimeoutIn / 1000);
|
||||||
this.scheduleWakeUpCall(secs,account.getUuid().hashCode());
|
this.scheduleWakeUpCall(secs,account.getUuid().hashCode());
|
||||||
|
@ -521,18 +523,18 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
this.scheduleWakeUpCall((int) (msToNextPing / 1000), account.getUuid().hashCode());
|
this.scheduleWakeUpCall((int) (msToNextPing / 1000), account.getUuid().hashCode());
|
||||||
}
|
}
|
||||||
} else if (account.getStatus() == Account.State.OFFLINE) {
|
} else if (account.getStatus() == Account.State.OFFLINE) {
|
||||||
reconnectAccount(account,true);
|
reconnectAccount(account,true, interactive);
|
||||||
} else if (account.getStatus() == Account.State.CONNECTING) {
|
} else if (account.getStatus() == Account.State.CONNECTING) {
|
||||||
long timeout = Config.CONNECT_TIMEOUT - ((SystemClock.elapsedRealtime() - account.getXmppConnection().getLastConnect()) / 1000);
|
long timeout = Config.CONNECT_TIMEOUT - ((SystemClock.elapsedRealtime() - account.getXmppConnection().getLastConnect()) / 1000);
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
Log.d(Config.LOGTAG, account.getJid() + ": time out during connect reconnecting");
|
Log.d(Config.LOGTAG, account.getJid() + ": time out during connect reconnecting");
|
||||||
reconnectAccount(account, true);
|
reconnectAccount(account, true, interactive);
|
||||||
} else {
|
} else {
|
||||||
scheduleWakeUpCall((int) timeout,account.getUuid().hashCode());
|
scheduleWakeUpCall((int) timeout,account.getUuid().hashCode());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (account.getXmppConnection().getTimeToNextAttempt() <= 0) {
|
if (account.getXmppConnection().getTimeToNextAttempt() <= 0) {
|
||||||
reconnectAccount(account, true);
|
reconnectAccount(account, true, interactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1210,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
public void updateAccount(final Account account) {
|
public void updateAccount(final Account account) {
|
||||||
this.statusListener.onStatusChanged(account);
|
this.statusListener.onStatusChanged(account);
|
||||||
databaseBackend.updateAccount(account);
|
databaseBackend.updateAccount(account);
|
||||||
reconnectAccount(account, false);
|
reconnectAccount(account, false, true);
|
||||||
updateAccountUi();
|
updateAccountUi();
|
||||||
getNotificationService().updateErrorNotification();
|
getNotificationService().updateErrorNotification();
|
||||||
}
|
}
|
||||||
|
@ -2145,7 +2147,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
this.databaseBackend.updateConversation(conversation);
|
this.databaseBackend.updateConversation(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reconnectAccount(final Account account, final boolean force) {
|
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
|
||||||
synchronized (account) {
|
synchronized (account) {
|
||||||
if (account.getXmppConnection() != null) {
|
if (account.getXmppConnection() != null) {
|
||||||
disconnect(account, force);
|
disconnect(account, force);
|
||||||
|
@ -2165,6 +2167,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
account.setXmppConnection(createConnection(account));
|
account.setXmppConnection(createConnection(account));
|
||||||
}
|
}
|
||||||
Thread thread = new Thread(account.getXmppConnection());
|
Thread thread = new Thread(account.getXmppConnection());
|
||||||
|
account.getXmppConnection().setInteractive(interactive);
|
||||||
thread.start();
|
thread.start();
|
||||||
scheduleWakeUpCall(Config.CONNECT_TIMEOUT, account.getUuid().hashCode());
|
scheduleWakeUpCall(Config.CONNECT_TIMEOUT, account.getUuid().hashCode());
|
||||||
} else {
|
} else {
|
||||||
|
@ -2178,7 +2181,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
reconnectAccount(account,false);
|
reconnectAccount(account,false,true);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import android.widget.Toast;
|
||||||
import net.java.otr4j.session.SessionStatus;
|
import net.java.otr4j.session.SessionStatus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
@ -1226,6 +1227,48 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
updateSendButton();
|
updateSendButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int completionIndex = 0;
|
||||||
|
private int lastCompletionLength = 0;
|
||||||
|
private String incomplete;
|
||||||
|
private int lastCompletionCursor;
|
||||||
|
private boolean firstWord = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTabPressed(boolean repeated) {
|
||||||
|
if (conversation == null || conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (repeated) {
|
||||||
|
completionIndex++;
|
||||||
|
} else {
|
||||||
|
lastCompletionLength = 0;
|
||||||
|
completionIndex = 0;
|
||||||
|
final String content = mEditMessage.getText().toString();
|
||||||
|
lastCompletionCursor = mEditMessage.getSelectionEnd();
|
||||||
|
int start = lastCompletionCursor > 0 ? content.lastIndexOf(" ",lastCompletionCursor-1) + 1 : 0;
|
||||||
|
firstWord = start == 0;
|
||||||
|
incomplete = content.substring(start,lastCompletionCursor);
|
||||||
|
}
|
||||||
|
List<String> completions = new ArrayList<>();
|
||||||
|
for(MucOptions.User user : conversation.getMucOptions().getUsers()) {
|
||||||
|
if (user.getName().startsWith(incomplete)) {
|
||||||
|
completions.add(user.getName()+(firstWord ? ": " : " "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(completions);
|
||||||
|
if (completions.size() > completionIndex) {
|
||||||
|
String completion = completions.get(completionIndex).substring(incomplete.length());
|
||||||
|
mEditMessage.getEditableText().delete(lastCompletionCursor,lastCompletionCursor + lastCompletionLength);
|
||||||
|
mEditMessage.getEditableText().insert(lastCompletionCursor, completion);
|
||||||
|
lastCompletionLength = completion.length();
|
||||||
|
} else {
|
||||||
|
completionIndex = -1;
|
||||||
|
mEditMessage.getEditableText().delete(lastCompletionCursor,lastCompletionCursor + lastCompletionLength);
|
||||||
|
lastCompletionLength = 0;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode,
|
public void onActivityResult(int requestCode, int resultCode,
|
||||||
final Intent data) {
|
final Intent data) {
|
||||||
|
|
|
@ -32,21 +32,32 @@ public class EditMessage extends EditText {
|
||||||
|
|
||||||
private boolean isUserTyping = false;
|
private boolean isUserTyping = false;
|
||||||
|
|
||||||
|
private boolean lastInputWasTab = false;
|
||||||
|
|
||||||
protected KeyboardListener keyboardListener;
|
protected KeyboardListener keyboardListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent e) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_ENTER && !event.isShiftPressed()) {
|
if (keyCode == KeyEvent.KEYCODE_ENTER && !e.isShiftPressed()) {
|
||||||
|
lastInputWasTab = false;
|
||||||
if (keyboardListener != null && keyboardListener.onEnterPressed()) {
|
if (keyboardListener != null && keyboardListener.onEnterPressed()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (keyCode == KeyEvent.KEYCODE_TAB && !e.isAltPressed() && !e.isCtrlPressed()) {
|
||||||
|
if (keyboardListener != null && keyboardListener.onTabPressed(this.lastInputWasTab)) {
|
||||||
|
lastInputWasTab = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
} else {
|
||||||
|
lastInputWasTab = false;
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
public void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
||||||
super.onTextChanged(text,start,lengthBefore,lengthAfter);
|
super.onTextChanged(text,start,lengthBefore,lengthAfter);
|
||||||
|
lastInputWasTab = false;
|
||||||
if (this.mTypingHandler != null && this.keyboardListener != null) {
|
if (this.mTypingHandler != null && this.keyboardListener != null) {
|
||||||
this.mTypingHandler.removeCallbacks(mTypingTimeout);
|
this.mTypingHandler.removeCallbacks(mTypingTimeout);
|
||||||
this.mTypingHandler.postDelayed(mTypingTimeout, Config.TYPING_TIMEOUT * 1000);
|
this.mTypingHandler.postDelayed(mTypingTimeout, Config.TYPING_TIMEOUT * 1000);
|
||||||
|
@ -69,10 +80,11 @@ public class EditMessage extends EditText {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface KeyboardListener {
|
public interface KeyboardListener {
|
||||||
public boolean onEnterPressed();
|
boolean onEnterPressed();
|
||||||
public void onTypingStarted();
|
void onTypingStarted();
|
||||||
public void onTypingStopped();
|
void onTypingStopped();
|
||||||
public void onTextDeleted();
|
void onTextDeleted();
|
||||||
|
boolean onTabPressed(boolean repeated);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.siacs.conversations.ui.adapter;
|
package eu.siacs.conversations.ui.adapter;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
@ -324,7 +325,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
viewHolder.messageBody.setText("");
|
viewHolder.messageBody.setText("");
|
||||||
}
|
}
|
||||||
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
|
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
|
||||||
viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground,true));
|
viewHolder.messageBody.setLinkTextColor(this.getMessageTextColor(darkBackground, true));
|
||||||
viewHolder.messageBody.setHighlightColor(activity.getResources().getColor(darkBackground ? R.color.grey800 : R.color.grey500));
|
viewHolder.messageBody.setHighlightColor(activity.getResources().getColor(darkBackground ? R.color.grey800 : R.color.grey500));
|
||||||
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
|
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
|
||||||
viewHolder.messageBody.setTextIsSelectable(true);
|
viewHolder.messageBody.setTextIsSelectable(true);
|
||||||
|
@ -616,11 +617,15 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
PackageManager manager = activity.getPackageManager();
|
PackageManager manager = activity.getPackageManager();
|
||||||
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
|
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
|
||||||
if (infos.size() > 0) {
|
if (infos.size() > 0) {
|
||||||
|
try {
|
||||||
getContext().startActivity(openIntent);
|
getContext().startActivity(openIntent);
|
||||||
} else {
|
return;
|
||||||
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
|
} catch (ActivityNotFoundException e) {
|
||||||
|
//ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Toast.makeText(activity,R.string.no_application_found_to_open_file,Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
public void showLocation(Message message) {
|
public void showLocation(Message message) {
|
||||||
for(Intent intent : GeoHelper.createGeoIntentsFromMessage(message)) {
|
for(Intent intent : GeoHelper.createGeoIntentsFromMessage(message)) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ import javax.net.ssl.SSLSocket;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import de.duenndns.ssl.MemorizingTrustManager;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.crypto.sasl.DigestMd5;
|
import eu.siacs.conversations.crypto.sasl.DigestMd5;
|
||||||
import eu.siacs.conversations.crypto.sasl.Plain;
|
import eu.siacs.conversations.crypto.sasl.Plain;
|
||||||
|
@ -100,6 +101,7 @@ public class XmppConnection implements Runnable {
|
||||||
private long lastPingSent = 0;
|
private long lastPingSent = 0;
|
||||||
private long lastConnect = 0;
|
private long lastConnect = 0;
|
||||||
private long lastSessionStarted = 0;
|
private long lastSessionStarted = 0;
|
||||||
|
private boolean mInteractive = false;
|
||||||
private int attempt = 0;
|
private int attempt = 0;
|
||||||
private final Hashtable<String, Pair<IqPacket, OnIqPacketReceived>> packetCallbacks = new Hashtable<>();
|
private final Hashtable<String, Pair<IqPacket, OnIqPacketReceived>> packetCallbacks = new Hashtable<>();
|
||||||
private OnPresencePacketReceived presenceListener = null;
|
private OnPresencePacketReceived presenceListener = null;
|
||||||
|
@ -515,9 +517,15 @@ public class XmppConnection implements Runnable {
|
||||||
tagReader.readTag();
|
tagReader.readTag();
|
||||||
try {
|
try {
|
||||||
final SSLContext sc = SSLContext.getInstance("TLS");
|
final SSLContext sc = SSLContext.getInstance("TLS");
|
||||||
sc.init(null,new X509TrustManager[]{this.mXmppConnectionService.getMemorizingTrustManager()},mXmppConnectionService.getRNG());
|
MemorizingTrustManager trustManager = this.mXmppConnectionService.getMemorizingTrustManager();
|
||||||
|
sc.init(null,new X509TrustManager[]{mInteractive ? trustManager : trustManager.getNonInteractive()},mXmppConnectionService.getRNG());
|
||||||
final SSLSocketFactory factory = sc.getSocketFactory();
|
final SSLSocketFactory factory = sc.getSocketFactory();
|
||||||
final HostnameVerifier verifier = this.mXmppConnectionService.getMemorizingTrustManager().wrapHostnameVerifier(new StrictHostnameVerifier());
|
final HostnameVerifier verifier;
|
||||||
|
if (mInteractive) {
|
||||||
|
verifier = trustManager.wrapHostnameVerifier(new StrictHostnameVerifier());
|
||||||
|
} else {
|
||||||
|
verifier = trustManager.wrapHostnameVerifierNonInteractive(new StrictHostnameVerifier());
|
||||||
|
}
|
||||||
final InetAddress address = socket == null ? null : socket.getInetAddress();
|
final InetAddress address = socket == null ? null : socket.getInetAddress();
|
||||||
|
|
||||||
if (factory == null || address == null || verifier == null) {
|
if (factory == null || address == null || verifier == null) {
|
||||||
|
@ -839,7 +847,7 @@ public class XmppConnection implements Runnable {
|
||||||
sendEnableCarbons();
|
sendEnableCarbons();
|
||||||
}
|
}
|
||||||
if (getFeatures().blocking() && !features.blockListRequested) {
|
if (getFeatures().blocking() && !features.blockListRequested) {
|
||||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": Requesting block list");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": Requesting block list");
|
||||||
this.sendIqPacket(getIqGenerator().generateGetBlockList(), mXmppConnectionService.getIqParser());
|
this.sendIqPacket(getIqGenerator().generateGetBlockList(), mXmppConnectionService.getIqParser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,7 +957,6 @@ public class XmppConnection implements Runnable {
|
||||||
disconnect(true);
|
disconnect(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String name = packet.getName();
|
|
||||||
tagWriter.writeStanzaAsync(packet);
|
tagWriter.writeStanzaAsync(packet);
|
||||||
if (packet instanceof AbstractAcknowledgeableStanza) {
|
if (packet instanceof AbstractAcknowledgeableStanza) {
|
||||||
AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
|
AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet;
|
||||||
|
@ -965,9 +972,7 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPing() {
|
public void sendPing() {
|
||||||
if (streamFeatures.hasChild("sm")) {
|
if (!r()) {
|
||||||
tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
|
|
||||||
} else {
|
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||||
iq.setFrom(account.getJid());
|
iq.setFrom(account.getJid());
|
||||||
iq.addChild("ping", "urn:xmpp:ping");
|
iq.addChild("ping", "urn:xmpp:ping");
|
||||||
|
@ -1078,8 +1083,13 @@ public class XmppConnection implements Runnable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void r() {
|
public boolean r() {
|
||||||
|
if (getFeatures().sm()) {
|
||||||
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
|
this.tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMucServer() {
|
public String getMucServer() {
|
||||||
|
@ -1138,6 +1148,10 @@ public class XmppConnection implements Runnable {
|
||||||
this.lastConnect = 0;
|
this.lastConnect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInteractive(boolean interactive) {
|
||||||
|
this.mInteractive = interactive;
|
||||||
|
}
|
||||||
|
|
||||||
private class Info {
|
private class Info {
|
||||||
public final ArrayList<String> features = new ArrayList<>();
|
public final ArrayList<String> features = new ArrayList<>();
|
||||||
public final ArrayList<Pair<String,String>> identities = new ArrayList<>();
|
public final ArrayList<Pair<String,String>> identities = new ArrayList<>();
|
||||||
|
|
|
@ -176,6 +176,7 @@ public class JingleInbandTransport extends JingleTransport {
|
||||||
data.setAttribute("sid", this.sessionId);
|
data.setAttribute("sid", this.sessionId);
|
||||||
data.setContent(base64);
|
data.setContent(base64);
|
||||||
this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived);
|
this.account.getXmppConnection().sendIqPacket(iq, this.onAckReceived);
|
||||||
|
this.account.getXmppConnection().r(); //don't fill up stanza queue too much
|
||||||
this.seq++;
|
this.seq++;
|
||||||
if (this.remainingSize > 0) {
|
if (this.remainingSize > 0) {
|
||||||
connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100));
|
connection.updateProgress((int) ((((double) (this.fileSize - this.remainingSize)) / this.fileSize) * 100));
|
||||||
|
|
Reference in a new issue