pgp fixes and revert configuration changes
This commit is contained in:
parent
8228e82f51
commit
a557d38e4d
|
@ -39,7 +39,6 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ConversationActivity"
|
android:name=".ui.ConversationActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="stateHidden">
|
android:windowSoftInputMode="stateHidden">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -91,22 +90,18 @@
|
||||||
android:label="@string/change_password_on_server"/>
|
android:label="@string/change_password_on_server"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ManageAccountActivity"
|
android:name=".ui.ManageAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:label="@string/title_activity_manage_accounts"
|
android:label="@string/title_activity_manage_accounts"
|
||||||
android:launchMode="singleTask"/>
|
android:launchMode="singleTask"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.EditAccountActivity"
|
android:name=".ui.EditAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ConferenceDetailsActivity"
|
android:name=".ui.ConferenceDetailsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:label="@string/title_activity_conference_details"
|
android:label="@string/title_activity_conference_details"
|
||||||
android:windowSoftInputMode="stateHidden"/>
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ContactDetailsActivity"
|
android:name=".ui.ContactDetailsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:label="@string/title_activity_contact_details"
|
android:label="@string/title_activity_contact_details"
|
||||||
android:windowSoftInputMode="stateHidden"/>
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -37,7 +37,8 @@ public final class Config {
|
||||||
|
|
||||||
public static final int REFRESH_UI_INTERVAL = 500;
|
public static final int REFRESH_UI_INTERVAL = 500;
|
||||||
|
|
||||||
public static final boolean NO_PROXY_LOOKUP = false; //useful to debug ibb
|
public static final boolean DISABLE_PROXY_LOOKUP = false; //useful to debug ibb
|
||||||
|
public static final boolean DISABLE_HTTP_UPLOAD = false;
|
||||||
public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance
|
public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance
|
||||||
public static final boolean EXTENDED_SM_LOGGING = true; // log stanza counts
|
public static final boolean EXTENDED_SM_LOGGING = true; // log stanza counts
|
||||||
public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption
|
public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption
|
||||||
|
|
|
@ -24,6 +24,7 @@ import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.http.HttpConnectionManager;
|
import eu.siacs.conversations.http.HttpConnectionManager;
|
||||||
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.ui.UiCallback;
|
import eu.siacs.conversations.ui.UiCallback;
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ public class PgpEngine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReturn(Intent result) {
|
public void onReturn(Intent result) {
|
||||||
|
notifyPgpDecryptionService(message.getConversation().getAccount(), OpenPgpApi.ACTION_DECRYPT_VERIFY, result);
|
||||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE,
|
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE,
|
||||||
OpenPgpApi.RESULT_CODE_ERROR)) {
|
OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||||
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
||||||
|
@ -196,8 +198,8 @@ public class PgpEngine {
|
||||||
.getFileBackend().getFile(message, false);
|
.getFileBackend().getFile(message, false);
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
outputFile.createNewFile();
|
outputFile.createNewFile();
|
||||||
InputStream is = new FileInputStream(inputFile);
|
final InputStream is = new FileInputStream(inputFile);
|
||||||
OutputStream os = new FileOutputStream(outputFile);
|
final OutputStream os = new FileOutputStream(outputFile);
|
||||||
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
|
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -206,6 +208,12 @@ public class PgpEngine {
|
||||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE,
|
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE,
|
||||||
OpenPgpApi.RESULT_CODE_ERROR)) {
|
OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||||
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
||||||
|
try {
|
||||||
|
os.flush();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
//ignored
|
||||||
|
}
|
||||||
|
FileBackend.close(os);
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
break;
|
break;
|
||||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
|
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
|
||||||
|
|
|
@ -523,7 +523,7 @@ public class Message extends AbstractEntity {
|
||||||
String extension = filename.substring(dotPosition + 1);
|
String extension = filename.substring(dotPosition + 1);
|
||||||
// we want the real file extension, not the crypto one
|
// we want the real file extension, not the crypto one
|
||||||
if (Arrays.asList(Transferable.VALID_CRYPTO_EXTENSIONS).contains(extension)) {
|
if (Arrays.asList(Transferable.VALID_CRYPTO_EXTENSIONS).contains(extension)) {
|
||||||
return extractRelevantExtension(path.substring(0,dotPosition));
|
return extractRelevantExtension(filename.substring(0,dotPosition));
|
||||||
} else {
|
} else {
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,10 +107,6 @@ public class MucOptions {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnJoinListener extends OnEventListener {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
private Role role = Role.NONE;
|
private Role role = Role.NONE;
|
||||||
private Affiliation affiliation = Affiliation.NONE;
|
private Affiliation affiliation = Affiliation.NONE;
|
||||||
|
@ -215,7 +211,6 @@ public class MucOptions {
|
||||||
private boolean isOnline = false;
|
private boolean isOnline = false;
|
||||||
private int error = ERROR_UNKNOWN;
|
private int error = ERROR_UNKNOWN;
|
||||||
private OnRenameListener onRenameListener = null;
|
private OnRenameListener onRenameListener = null;
|
||||||
private OnJoinListener onJoinListener = null;
|
|
||||||
private User self = new User();
|
private User self = new User();
|
||||||
private String subject = null;
|
private String subject = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
|
@ -317,9 +312,6 @@ public class MucOptions {
|
||||||
onRenameListener.onSuccess();
|
onRenameListener.onSuccess();
|
||||||
}
|
}
|
||||||
mNickChangingInProgress = false;
|
mNickChangingInProgress = false;
|
||||||
} else if (this.onJoinListener != null) {
|
|
||||||
this.onJoinListener.onSuccess();
|
|
||||||
this.onJoinListener = null;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addUser(user);
|
addUser(user);
|
||||||
|
@ -328,14 +320,11 @@ public class MucOptions {
|
||||||
Element signed = packet.findChild("x", "jabber:x:signed");
|
Element signed = packet.findChild("x", "jabber:x:signed");
|
||||||
if (signed != null) {
|
if (signed != null) {
|
||||||
Element status = packet.findChild("status");
|
Element status = packet.findChild("status");
|
||||||
String msg;
|
String msg = status == null ? "" : status.getContent();
|
||||||
if (status != null) {
|
long keyId = pgp.fetchKeyId(account, msg, signed.getContent());
|
||||||
msg = status.getContent();
|
if (keyId != 0) {
|
||||||
} else {
|
user.setPgpKeyId(keyId);
|
||||||
msg = "";
|
|
||||||
}
|
}
|
||||||
user.setPgpKeyId(pgp.fetchKeyId(account, msg,
|
|
||||||
signed.getContent()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,10 +370,6 @@ public class MucOptions {
|
||||||
private void setError(int error) {
|
private void setError(int error) {
|
||||||
this.isOnline = false;
|
this.isOnline = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
if (onJoinListener != null) {
|
|
||||||
onJoinListener.onFailure();
|
|
||||||
onJoinListener = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getStatusCodes(Element x) {
|
private List<String> getStatusCodes(Element x) {
|
||||||
|
@ -438,10 +423,6 @@ public class MucOptions {
|
||||||
this.onRenameListener = listener;
|
this.onRenameListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnJoinListener(OnJoinListener listener) {
|
|
||||||
this.onJoinListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffline() {
|
public void setOffline() {
|
||||||
this.users.clear();
|
this.users.clear();
|
||||||
this.error = 0;
|
this.error = 0;
|
||||||
|
|
|
@ -125,6 +125,9 @@ public class HttpDownloadConnection implements Transferable {
|
||||||
mXmppConnectionService.sendBroadcast(intent);
|
mXmppConnectionService.sendBroadcast(intent);
|
||||||
message.setTransferable(null);
|
message.setTransferable(null);
|
||||||
mHttpConnectionManager.finishConnection(this);
|
mHttpConnectionManager.finishConnection(this);
|
||||||
|
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
||||||
|
message.getConversation().getAccount().getPgpDecryptionService().add(message);
|
||||||
|
}
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
if (acceptedAutomatically) {
|
if (acceptedAutomatically) {
|
||||||
mXmppConnectionService.getNotificationService().push(message);
|
mXmppConnectionService.getNotificationService().push(message);
|
||||||
|
|
|
@ -61,22 +61,26 @@ public class FileBackend {
|
||||||
final boolean encrypted = !decrypted
|
final boolean encrypted = !decrypted
|
||||||
&& (message.getEncryption() == Message.ENCRYPTION_PGP
|
&& (message.getEncryption() == Message.ENCRYPTION_PGP
|
||||||
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED);
|
|| message.getEncryption() == Message.ENCRYPTION_DECRYPTED);
|
||||||
if (encrypted) {
|
final DownloadableFile file;
|
||||||
return new DownloadableFile(getConversationsFileDirectory()+message.getUuid()+".pgp");
|
String path = message.getRelativeFilePath();
|
||||||
|
if (path == null) {
|
||||||
|
path = message.getUuid();
|
||||||
|
}
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
file = new DownloadableFile(path);
|
||||||
} else {
|
} else {
|
||||||
String path = message.getRelativeFilePath();
|
|
||||||
if (path == null) {
|
|
||||||
path = message.getUuid();
|
|
||||||
} else if (path.startsWith("/")) {
|
|
||||||
return new DownloadableFile(path);
|
|
||||||
}
|
|
||||||
String mime = message.getMimeType();
|
String mime = message.getMimeType();
|
||||||
if (mime != null && mime.startsWith("image")) {
|
if (mime != null && mime.startsWith("image")) {
|
||||||
return new DownloadableFile(getConversationsImageDirectory() + path);
|
file = new DownloadableFile(getConversationsImageDirectory() + path);
|
||||||
} else {
|
} else {
|
||||||
return new DownloadableFile(getConversationsFileDirectory() + path);
|
file = new DownloadableFile(getConversationsFileDirectory() + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (encrypted) {
|
||||||
|
return new DownloadableFile(getConversationsFileDirectory() + file.getName() + ".pgp");
|
||||||
|
} else {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getConversationsFileDirectory() {
|
public static String getConversationsFileDirectory() {
|
||||||
|
|
|
@ -1688,16 +1688,16 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
List<Conversation> conversations = getConversations();
|
List<Conversation> conversations = getConversations();
|
||||||
for (Conversation conversation : conversations) {
|
for (Conversation conversation : conversations) {
|
||||||
if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getAccount() == account) {
|
if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getAccount() == account) {
|
||||||
joinMuc(conversation, true);
|
joinMuc(conversation, true, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void joinMuc(Conversation conversation) {
|
public void joinMuc(Conversation conversation) {
|
||||||
joinMuc(conversation, false);
|
joinMuc(conversation, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void joinMuc(Conversation conversation, boolean now) {
|
private void joinMuc(Conversation conversation, boolean now, final OnConferenceJoined onConferenceJoined) {
|
||||||
Account account = conversation.getAccount();
|
Account account = conversation.getAccount();
|
||||||
account.pendingConferenceJoins.remove(conversation);
|
account.pendingConferenceJoins.remove(conversation);
|
||||||
account.pendingConferenceLeaves.remove(conversation);
|
account.pendingConferenceLeaves.remove(conversation);
|
||||||
|
@ -1730,11 +1730,13 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
}
|
}
|
||||||
String sig = account.getPgpSignature();
|
String sig = account.getPgpSignature();
|
||||||
if (sig != null) {
|
if (sig != null) {
|
||||||
packet.addChild("status").setContent("online");
|
|
||||||
packet.addChild("x", "jabber:x:signed").setContent(sig);
|
packet.addChild("x", "jabber:x:signed").setContent(sig);
|
||||||
}
|
}
|
||||||
sendPresencePacket(account, packet);
|
sendPresencePacket(account, packet);
|
||||||
fetchConferenceConfiguration(conversation);
|
fetchConferenceConfiguration(conversation);
|
||||||
|
if (onConferenceJoined != null) {
|
||||||
|
onConferenceJoined.onConferenceJoined(conversation);
|
||||||
|
}
|
||||||
if (!joinJid.equals(conversation.getJid())) {
|
if (!joinJid.equals(conversation.getJid())) {
|
||||||
conversation.setContactJid(joinJid);
|
conversation.setContactJid(joinJid);
|
||||||
databaseBackend.updateConversation(conversation);
|
databaseBackend.updateConversation(conversation);
|
||||||
|
@ -1752,17 +1754,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFetchFailed(final Conversation conversation, Element error) {
|
public void onFetchFailed(final Conversation conversation, Element error) {
|
||||||
conversation.getMucOptions().setOnJoinListener(new MucOptions.OnJoinListener() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
fetchConferenceConfiguration(conversation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure() {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
join(conversation);
|
join(conversation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1889,34 +1880,37 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
String name = new BigInteger(75, getRNG()).toString(32);
|
String name = new BigInteger(75, getRNG()).toString(32);
|
||||||
Jid jid = Jid.fromParts(name, server, null);
|
Jid jid = Jid.fromParts(name, server, null);
|
||||||
final Conversation conversation = findOrCreateConversation(account, jid, true);
|
final Conversation conversation = findOrCreateConversation(account, jid, true);
|
||||||
joinMuc(conversation);
|
joinMuc(conversation, true, new OnConferenceJoined() {
|
||||||
Bundle options = new Bundle();
|
|
||||||
options.putString("muc#roomconfig_persistentroom", "1");
|
|
||||||
options.putString("muc#roomconfig_membersonly", "1");
|
|
||||||
options.putString("muc#roomconfig_publicroom", "0");
|
|
||||||
options.putString("muc#roomconfig_whois", "anyone");
|
|
||||||
pushConferenceConfiguration(conversation, options, new OnConferenceOptionsPushed() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onPushSucceeded() {
|
public void onConferenceJoined(final Conversation conversation) {
|
||||||
for (Jid invite : jids) {
|
Bundle options = new Bundle();
|
||||||
invite(conversation, invite);
|
options.putString("muc#roomconfig_persistentroom", "1");
|
||||||
}
|
options.putString("muc#roomconfig_membersonly", "1");
|
||||||
if (account.countPresences() > 1) {
|
options.putString("muc#roomconfig_publicroom", "0");
|
||||||
directInvite(conversation, account.getJid().toBareJid());
|
options.putString("muc#roomconfig_whois", "anyone");
|
||||||
}
|
pushConferenceConfiguration(conversation, options, new OnConferenceOptionsPushed() {
|
||||||
if (callback != null) {
|
@Override
|
||||||
callback.success(conversation);
|
public void onPushSucceeded() {
|
||||||
}
|
for (Jid invite : jids) {
|
||||||
}
|
invite(conversation, invite);
|
||||||
|
}
|
||||||
|
if (account.countPresences() > 1) {
|
||||||
|
directInvite(conversation, account.getJid().toBareJid());
|
||||||
|
}
|
||||||
|
if (callback != null) {
|
||||||
|
callback.success(conversation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPushFailed() {
|
public void onPushFailed() {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.error(R.string.conference_creation_failed, conversation);
|
callback.error(R.string.conference_creation_failed, conversation);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.error(R.string.conference_creation_failed, null);
|
callback.error(R.string.conference_creation_failed, null);
|
||||||
|
@ -2976,6 +2970,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
void onFetchFailed(Conversation conversation, Element error);
|
void onFetchFailed(Conversation conversation, Element error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnConferenceJoined {
|
||||||
|
void onConferenceJoined(Conversation conversation);
|
||||||
|
}
|
||||||
|
|
||||||
public interface OnConferenceOptionsPushed {
|
public interface OnConferenceOptionsPushed {
|
||||||
void onPushSucceeded();
|
void onPushSucceeded();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.IntentSender.SendIntentException;
|
import android.content.IntentSender.SendIntentException;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -42,7 +41,6 @@ import eu.siacs.conversations.entities.MucOptions.User;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
|
import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService.OnMucRosterUpdate;
|
import eu.siacs.conversations.services.XmppConnectionService.OnMucRosterUpdate;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
|
|
||||||
public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConferenceOptionsPushed {
|
public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConferenceOptionsPushed {
|
||||||
|
@ -55,7 +53,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
inviteToConversation(mConversation);
|
inviteToConversation(mConversation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private LinearLayout mMainLayout;
|
|
||||||
private TextView mYourNick;
|
private TextView mYourNick;
|
||||||
private ImageView mYourPhoto;
|
private ImageView mYourPhoto;
|
||||||
private ImageButton mEditNickButton;
|
private ImageButton mEditNickButton;
|
||||||
|
@ -190,7 +187,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_muc_details);
|
setContentView(R.layout.activity_muc_details);
|
||||||
mMainLayout = (LinearLayout) findViewById(R.id.muc_main_layout);
|
|
||||||
mYourNick = (TextView) findViewById(R.id.muc_your_nick);
|
mYourNick = (TextView) findViewById(R.id.muc_your_nick);
|
||||||
mYourPhoto = (ImageView) findViewById(R.id.your_photo);
|
mYourPhoto = (ImageView) findViewById(R.id.your_photo);
|
||||||
mEditNickButton = (ImageButton) findViewById(R.id.edit_nick_button);
|
mEditNickButton = (ImageButton) findViewById(R.id.edit_nick_button);
|
||||||
|
@ -454,12 +450,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged (Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
UIHelper.resetChildMargins(mMainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateView() {
|
private void updateView() {
|
||||||
final MucOptions mucOptions = mConversation.getMucOptions();
|
final MucOptions mucOptions = mConversation.getMucOptions();
|
||||||
final User self = mucOptions.getSelf();
|
final User self = mucOptions.getSelf();
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender.SendIntentException;
|
import android.content.IntentSender.SendIntentException;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
@ -100,7 +99,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private LinearLayout mainLayout;
|
|
||||||
private Jid accountJid;
|
private Jid accountJid;
|
||||||
private Jid contactJid;
|
private Jid contactJid;
|
||||||
private TextView contactJidTv;
|
private TextView contactJidTv;
|
||||||
|
@ -199,7 +197,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
|
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
|
||||||
setContentView(R.layout.activity_contact_details);
|
setContentView(R.layout.activity_contact_details);
|
||||||
|
|
||||||
mainLayout = (LinearLayout) findViewById(R.id.details_main_layout);
|
|
||||||
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
|
contactJidTv = (TextView) findViewById(R.id.details_contactjid);
|
||||||
accountJidTv = (TextView) findViewById(R.id.details_account);
|
accountJidTv = (TextView) findViewById(R.id.details_account);
|
||||||
lastseen = (TextView) findViewById(R.id.details_lastseen);
|
lastseen = (TextView) findViewById(R.id.details_lastseen);
|
||||||
|
@ -300,12 +297,6 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged (Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
UIHelper.resetChildMargins(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateView() {
|
private void populateView() {
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
setTitle(contact.getDisplayName());
|
setTitle(contact.getDisplayName());
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.provider.MediaStore;
|
||||||
import android.support.v4.widget.SlidingPaneLayout;
|
import android.support.v4.widget.SlidingPaneLayout;
|
||||||
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
|
import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -510,22 +511,22 @@ public class ConversationActivity extends XmppActivity
|
||||||
}
|
}
|
||||||
final Conversation conversation = getSelectedConversation();
|
final Conversation conversation = getSelectedConversation();
|
||||||
final int encryption = conversation.getNextEncryption();
|
final int encryption = conversation.getNextEncryption();
|
||||||
|
final int mode = conversation.getMode();
|
||||||
if (encryption == Message.ENCRYPTION_PGP) {
|
if (encryption == Message.ENCRYPTION_PGP) {
|
||||||
if (hasPgp()) {
|
if (hasPgp()) {
|
||||||
if (conversation.getContact().getPgpKeyId() != 0) {
|
if (mode == Conversation.MODE_SINGLE && conversation.getContact().getPgpKeyId() != 0) {
|
||||||
xmppConnectionService.getPgpEngine().hasKey(
|
xmppConnectionService.getPgpEngine().hasKey(
|
||||||
conversation.getContact(),
|
conversation.getContact(),
|
||||||
new UiCallback<Contact>() {
|
new UiCallback<Contact>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userInputRequried(PendingIntent pi,
|
public void userInputRequried(PendingIntent pi, Contact contact) {
|
||||||
Contact contact) {
|
ConversationActivity.this.runIntent(pi, attachmentChoice);
|
||||||
ConversationActivity.this.runIntent(pi,attachmentChoice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void success(Contact contact) {
|
public void success(Contact contact) {
|
||||||
selectPresenceToAttachFile(attachmentChoice,encryption);
|
selectPresenceToAttachFile(attachmentChoice, encryption);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -533,6 +534,16 @@ public class ConversationActivity extends XmppActivity
|
||||||
displayErrorDialog(error);
|
displayErrorDialog(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (mode == Conversation.MODE_MULTI && conversation.getMucOptions().pgpKeysInUse()) {
|
||||||
|
if (!conversation.getMucOptions().everybodyHasKeys()) {
|
||||||
|
Toast warning = Toast
|
||||||
|
.makeText(this,
|
||||||
|
R.string.missing_public_keys,
|
||||||
|
Toast.LENGTH_LONG);
|
||||||
|
warning.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
|
||||||
|
warning.show();
|
||||||
|
}
|
||||||
|
selectPresenceToAttachFile(attachmentChoice, encryption);
|
||||||
} else {
|
} else {
|
||||||
final ConversationFragment fragment = (ConversationFragment) getFragmentManager()
|
final ConversationFragment fragment = (ConversationFragment) getFragmentManager()
|
||||||
.findFragmentByTag("conversation");
|
.findFragmentByTag("conversation");
|
||||||
|
|
|
@ -482,12 +482,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged (Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
UIHelper.resetChildMargins(mMainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
|
|
@ -3,11 +3,7 @@ package eu.siacs.conversations.utils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -265,21 +261,4 @@ public class UIHelper {
|
||||||
body = body.replace("?","").replace("¿","");
|
body = body.replace("?","").replace("¿","");
|
||||||
return LOCATION_QUESTIONS.contains(body);
|
return LOCATION_QUESTIONS.contains(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetChildMargins(LinearLayout view) {
|
|
||||||
int childCount = view.getChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
UIHelper.resetMargins(view.getChildAt(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void resetMargins(View view) {
|
|
||||||
LinearLayout.MarginLayoutParams marginLayoutParams = new LinearLayout.MarginLayoutParams(view.getLayoutParams());
|
|
||||||
marginLayoutParams.setMargins(view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
|
|
||||||
view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin),
|
|
||||||
view.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin),
|
|
||||||
view.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin));
|
|
||||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(marginLayoutParams);
|
|
||||||
view.setLayoutParams(layoutParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1369,7 +1369,7 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean httpUpload() {
|
public boolean httpUpload() {
|
||||||
return findDiscoItemsByFeature(Xmlns.HTTP_UPLOAD).size() > 0;
|
return !Config.DISABLE_HTTP_UPLOAD && findDiscoItemsByFeature(Xmlns.HTTP_UPLOAD).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,8 @@ public class JingleConnection implements Transferable {
|
||||||
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||||
intent.setData(Uri.fromFile(file));
|
intent.setData(Uri.fromFile(file));
|
||||||
mXmppConnectionService.sendBroadcast(intent);
|
mXmppConnectionService.sendBroadcast(intent);
|
||||||
|
} else {
|
||||||
|
account.getPgpDecryptionService().add(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
|
|
||||||
public void getPrimaryCandidate(Account account,
|
public void getPrimaryCandidate(Account account,
|
||||||
final OnPrimaryCandidateFound listener) {
|
final OnPrimaryCandidateFound listener) {
|
||||||
if (Config.NO_PROXY_LOOKUP) {
|
if (Config.DISABLE_PROXY_LOOKUP) {
|
||||||
listener.onPrimaryCandidateFound(false, null);
|
listener.onPrimaryCandidateFound(false, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue