aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2015-04-14 23:48:28 +0200
committerlookshe <github@lookshe.org>2015-04-14 23:48:28 +0200
commit549810783ce651f27bdd386488b6690195522372 (patch)
treebe050d54e7c591370c5c0dc9667ab6eb5056887b /src/main/java/eu/siacs/conversations
parent8932dd9fb320b4641e707ae44de2c1d00996c358 (diff)
changed received and read confirmation setting to one list and put it to settings class
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r--src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java3
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java10
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java5
4 files changed, 7 insertions, 13 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
index 79626511..186b4b98 100644
--- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
@@ -12,6 +12,7 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
+import de.tzur.conversations.Settings;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.PhoneHelper;
@@ -81,7 +82,7 @@ public abstract class AbstractGenerator {
public List<String> getFeatures() {
ArrayList<String> features = new ArrayList<>();
features.addAll(Arrays.asList(FEATURES));
- if (mXmppConnectionService.confirmMessages()) {
+ if (Settings.CONFIRM_MESSAGE_RECEIVED) {
features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES));
}
Collections.sort(features);
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 064a1662..9f36f1e9 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -582,7 +582,7 @@ public class MessageParser extends AbstractParser implements
if ((message == null) || (message.getBody() == null)) {
return;
}
- if ((mXmppConnectionService.confirmMessages())
+ if ((Settings.CONFIRM_MESSAGE_RECEIVED)
&& ((packet.getId() != null))) {
if (packet.hasChild("markable", "urn:xmpp:chat-markers:0")) {
MessagePacket receipt = mXmppConnectionService
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 0e531d57..fc670efd 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -2107,14 +2107,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
return getPreferences().getBoolean("force_encryption", false);
}
- public boolean confirmMessages() {
- return getPreferences().getBoolean("confirm_messages", true);
- }
-
- public boolean confirmMessagesRead() {
- return getPreferences().getBoolean("confirm_read_message", true);
- }
-
public boolean sendChatStates() {
return getPreferences().getBoolean("chat_states", false);
}
@@ -2191,7 +2183,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
public void sendReadMarker(final Conversation conversation) {
final Message markable = conversation.getLatestMarkableMessage();
this.markRead(conversation);
- if (confirmMessagesRead() && markable != null && markable.getRemoteMsgId() != null) {
+ if (Settings.CONFIRM_MESSAGE_READ && markable != null && markable.getRemoteMsgId() != null) {
Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": sending read marker to " + markable.getCounterpart().toString());
Account account = conversation.getAccount();
final Jid to = markable.getCounterpart();
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index 1c1ff3b9..2115b23b 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -59,6 +59,8 @@ public class SettingsActivity extends XmppActivity implements
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences,
String name) {
+ // need to synchronize the settings class first
+ Settings.synchronizeSettingsClassWithPreferences(getPreferences(), name);
switch (name) {
case "resource":
String resource = preferences.getString("resource", "mobile")
@@ -75,7 +77,7 @@ public class SettingsActivity extends XmppActivity implements
case "keep_foreground_service":
xmppConnectionService.toggleForegroundService();
break;
- case "confirm_messages":
+ case "confirm_messages_list":
if (xmppConnectionServiceBound) {
for (Account account : xmppConnectionService.getAccounts()) {
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
@@ -85,7 +87,6 @@ public class SettingsActivity extends XmppActivity implements
}
break;
}
- Settings.synchronizeSettingsClassWithPreferences(getPreferences(), name);
}
}