From 29616d02a8e97a9044daec286bdfa7c862108fa4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 27 Apr 2016 16:43:02 +0200 Subject: [PATCH] removed unused config variables --- .../java/eu/siacs/conversations/Config.java | 6 ------ .../siacs/conversations/entities/Bookmark.java | 4 +--- .../siacs/conversations/entities/Contact.java | 4 +--- .../ui/ConferenceDetailsActivity.java | 6 +----- .../conversations/ui/EditAccountActivity.java | 6 ------ .../siacs/conversations/ui/EnterJidDialog.java | 17 +++++------------ .../conversations/ui/ManageAccountActivity.java | 3 --- .../ui/StartConversationActivity.java | 17 +++++------------ .../eu/siacs/conversations/ui/XmppActivity.java | 13 ------------- .../eu/siacs/conversations/utils/Xmlns.java | 2 +- 10 files changed, 14 insertions(+), 64 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 2b12474ce..1c83d05af 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -39,10 +39,6 @@ public final class Config { public static final String DOMAIN_LOCK = null; //only allow account creation for this domain public static final String MAGIC_CREATE_DOMAIN = null; - public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain - public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains - - public static final boolean LOCK_SETTINGS = false; //set to true to disallow account and settings editing public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true @@ -51,8 +47,6 @@ public final class Config { public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification public static final boolean SHOW_DISABLE_FOREGROUND = true; //if set to true the foreground notification has a button to disable it - public static final boolean LEGACY_NAMESPACE_HTTP_UPLOAD = false; - public static final int PING_MAX_INTERVAL = 300; public static final int PING_MIN_INTERVAL = 30; public static final int PING_TIMEOUT = 15; diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index 8d97751c1..fd6a5dab9 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -63,9 +63,7 @@ public class Bookmark extends Element implements ListItem { @Override public String getDisplayJid() { Jid jid = getJid(); - if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { - return jid.getLocalpart(); - } else if (jid != null) { + if (jid != null) { return jid.toString(); } else { return null; diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index e608688ba..8721d9c46 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -124,9 +124,7 @@ public class Contact implements ListItem, Blockable { @Override public String getDisplayJid() { - if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && jid != null && jid.getDomainpart().equals(Config.DOMAIN_LOCK)) { - return jid.getLocalpart(); - } else if (jid != null) { + if (jid != null) { return jid.toString(); } else { return null; diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index d74203592..c806a03e4 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -528,11 +528,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mAccountJid.setText(getString(R.string.using_account, account)); mYourPhoto.setImageBitmap(avatarService().get(mConversation.getAccount(), getPixel(48))); setTitle(mConversation.getName()); - if (Config.LOCK_DOMAINS_IN_CONVERSATIONS && mConversation.getJid().getDomainpart().equals(Config.CONFERENCE_DOMAIN_LOCK)) { - mFullJid.setText(mConversation.getJid().getLocalpart()); - } else { - mFullJid.setText(mConversation.getJid().toBareJid().toString()); - } + mFullJid.setText(mConversation.getJid().toBareJid().toString()); mYourNick.setText(mucOptions.getActualNick()); mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); if (mucOptions.online()) { diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 9dd79ccf8..7cb243db6 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -674,12 +674,6 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); } - mPassword.setEnabled(!Config.LOCK_SETTINGS); - mAccountJid.setEnabled(!Config.LOCK_SETTINGS); - mHostname.setEnabled(!Config.LOCK_SETTINGS); - mPort.setEnabled(!Config.LOCK_SETTINGS); - mPasswordConfirm.setEnabled(!Config.LOCK_SETTINGS); - mRegisterNew.setEnabled(!Config.LOCK_SETTINGS); if (!mInitMode) { this.mAvatar.setVisibility(View.VISIBLE); diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index a6b3c73c7..89000a685 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -43,17 +43,14 @@ public class EnterJidDialog { final String title, final String positiveButton, final String prefilledJid, final String account, boolean allowEditJid ) { - final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null); final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); - jabberIdDesc.setText(lock ? R.string.username : R.string.account_settings_jabber_id); + jabberIdDesc.setText(R.string.account_settings_jabber_id); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); - if (!lock) { - jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts)); - } + jid.setAdapter(new KnownHostsAdapter(context, android.R.layout.simple_list_item_1, knownHosts)); if (prefilledJid != null) { jid.append(prefilledJid); if (!allowEditJid) { @@ -64,7 +61,7 @@ public class EnterJidDialog { } } - jid.setHint(Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.DOMAIN_LOCK != null ? R.string.username_hint : R.string.account_settings_example_jabber_id); + jid.setHint(R.string.account_settings_example_jabber_id); if (account == null) { StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner); @@ -100,13 +97,9 @@ public class EnterJidDialog { } final Jid contactJid; try { - if (lock) { - contactJid = Jid.fromParts(jid.getText().toString(), Config.DOMAIN_LOCK, null); - } else { - contactJid = Jid.fromString(jid.getText().toString()); - } + contactJid = Jid.fromString(jid.getText().toString()); } catch (final InvalidJidException e) { - jid.setError(context.getString(lock ? R.string.invalid_username : R.string.invalid_jid)); + jid.setError(context.getString(R.string.invalid_jid)); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index e43db5d3e..4b8702798 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -156,10 +156,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda if (Config.X509_VERIFICATION) { addAccount.setVisible(false); addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - } else { - addAccount.setVisible(!Config.LOCK_SETTINGS); } - addAccountWithCertificate.setVisible(!Config.LOCK_SETTINGS); if (!accountsLeftToEnable()) { enableAll.setVisible(false); diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 4a59da21e..558a96727 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -390,13 +390,10 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null); final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account); final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid); - final boolean lock = Config.LOCK_DOMAINS_IN_CONVERSATIONS && Config.CONFERENCE_DOMAIN_LOCK != null; final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id); - jabberIdDesc.setText(lock ? R.string.conference_name : R.string.conference_address); - jid.setHint(lock ? R.string.conference_name : R.string.conference_address_example); - if (!lock) { - jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts)); - } + jabberIdDesc.setText(R.string.conference_address); + jid.setHint(R.string.conference_address_example); + jid.setAdapter(new KnownHostsAdapter(this, android.R.layout.simple_list_item_1, mKnownConferenceHosts)); if (prefilledJid != null) { jid.append(prefilledJid); } @@ -422,13 +419,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } final Jid conferenceJid; try { - if (lock) { - conferenceJid = Jid.fromParts(jid.getText().toString(),Config.CONFERENCE_DOMAIN_LOCK, null); - } else { - conferenceJid = Jid.fromString(jid.getText().toString()); - } + conferenceJid = Jid.fromString(jid.getText().toString()); } catch (final InvalidJidException e) { - jid.setError(getString(lock ? R.string.invalid_conference_name : R.string.invalid_jid)); + jid.setError(getString(R.string.invalid_jid)); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 17086b7e1..b89b55601 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -378,19 +378,6 @@ public abstract class XmppActivity extends Activity { } } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - final MenuItem menuSettings = menu.findItem(R.id.action_settings); - final MenuItem menuManageAccounts = menu.findItem(R.id.action_accounts); - if (menuSettings != null) { - menuSettings.setVisible(!Config.LOCK_SETTINGS); - } - if (menuManageAccounts != null) { - menuManageAccounts.setVisible(!Config.LOCK_SETTINGS); - } - return super.onCreateOptionsMenu(menu); - } - protected boolean isOptimizingBattery() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); diff --git a/src/main/java/eu/siacs/conversations/utils/Xmlns.java b/src/main/java/eu/siacs/conversations/utils/Xmlns.java index a19ec791f..ad30b3e63 100644 --- a/src/main/java/eu/siacs/conversations/utils/Xmlns.java +++ b/src/main/java/eu/siacs/conversations/utils/Xmlns.java @@ -7,5 +7,5 @@ public final class Xmlns { public static final String ROSTER = "jabber:iq:roster"; public static final String REGISTER = "jabber:iq:register"; public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams"; - public static final String HTTP_UPLOAD = Config.LEGACY_NAMESPACE_HTTP_UPLOAD ? "eu:siacs:conversations:http:upload" : "urn:xmpp:http:upload"; + public static final String HTTP_UPLOAD = "urn:xmpp:http:upload"; }