aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-26 00:48:56 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-26 00:48:56 +0100
commit91e85d2faf18088dc7dc01653bda108f0c04d729 (patch)
tree2e4e0cb1fc4885635df93b8bd91844f90f194064 /src/main/java
parent94086bb9b7dfca4df7579758f6a3172e6c0b17dc (diff)
adapt caps on whether or not message confirmation is on
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java22
-rw-r--r--src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java8
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java4
5 files changed, 31 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
index 501cba91..0b915dca 100644
--- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
@@ -5,24 +5,30 @@ import android.util.Base64;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import eu.siacs.conversations.services.XmppConnectionService;
public abstract class AbstractGenerator {
- public final String[] FEATURES = {"urn:xmpp:jingle:1",
+ public final String[] FEATURES = {
+ "urn:xmpp:jingle:1",
"urn:xmpp:jingle:apps:file-transfer:3",
"urn:xmpp:jingle:transports:s5b:1",
- "urn:xmpp:jingle:transports:ibb:1", "urn:xmpp:receipts",
- "urn:xmpp:chat-markers:0", "http://jabber.org/protocol/muc",
- "jabber:x:conference", "http://jabber.org/protocol/caps",
+ "urn:xmpp:jingle:transports:ibb:1",
+ "http://jabber.org/protocol/muc",
+ "jabber:x:conference",
+ "http://jabber.org/protocol/caps",
"http://jabber.org/protocol/disco#info",
"urn:xmpp:avatar:metadata+notify",
"urn:xmpp:ping"};
+ public final String[] MESSAGE_CONFIRMATION_FEATURES = {
+ "urn:xmpp:chat-markers:0",
+ "urn:xmpp:receipts"
+ };
public final String IDENTITY_NAME = "Conversations 1.0-beta";
public final String IDENTITY_TYPE = "phone";
@@ -43,7 +49,11 @@ public abstract class AbstractGenerator {
} catch (NoSuchAlgorithmException e) {
return null;
}
- List<String> features = Arrays.asList(FEATURES);
+ ArrayList<String> features = new ArrayList<>();
+ features.addAll(Arrays.asList(FEATURES));
+ if (mXmppConnectionService.confirmMessages()) {
+ features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES));
+ }
Collections.sort(features);
for (String feature : features) {
s.append(feature + "<");
diff --git a/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java
index e3642f6b..1e896724 100644
--- a/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/PresenceGenerator.java
@@ -49,7 +49,7 @@ public class PresenceGenerator extends AbstractGenerator {
Element cap = packet.addChild("c",
"http://jabber.org/protocol/caps");
cap.setAttribute("hash", "sha-1");
- cap.setAttribute("node", "http://conversions.siacs.eu");
+ cap.setAttribute("node", "http://conversions.im");
cap.setAttribute("ver", capHash);
}
return packet;
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index a171de3d..e34f9bd7 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -140,7 +140,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
account.pendingConferenceLeaves.clear();
fetchRosterFromServer(account);
fetchBookmarks(account);
- sendPresencePacket(account, mPresenceGenerator.sendPresence(account));
+ sendPresence(account);
connectMultiModeConversations(account);
updateConversationUi();
}
@@ -2150,6 +2150,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
}
+ public void sendPresence(final Account account) {
+ sendPresencePacket(account, mPresenceGenerator.sendPresence(account));
+ }
+
public MessageGenerator getMessageGenerator() {
return this.mMessageGenerator;
}
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index c6e7ab33..5bf3cdab 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -71,6 +71,14 @@ public class SettingsActivity extends XmppActivity implements
}
} else if (name.equals("keep_foreground_service")) {
xmppConnectionService.toggleForegroundService();
+ } else if (name.equals("confirm_messages")) {
+ if (xmppConnectionServiceBound) {
+ for (Account account : xmppConnectionService.getAccounts()) {
+ if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ xmppConnectionService.sendPresence(account);
+ }
+ }
+ }
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 6399bcef..bf247787 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -402,9 +402,7 @@ public abstract class XmppActivity extends Activity {
public void success(Account account) {
xmppConnectionService.databaseBackend
.updateAccount(account);
- xmppConnectionService.sendPresencePacket(account,
- xmppConnectionService.getPresenceGenerator()
- .sendPresence(account));
+ xmppConnectionService.sendPresence(account);
if (conversation != null) {
conversation
.setNextEncryption(Message.ENCRYPTION_PGP);