aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2015-07-23 09:31:29 +0200
committerChristian S <christian@pix-art.de>2015-07-23 09:31:29 +0200
commit98cc2023b1a57f6b8a3f605ff699fa624eed1bd6 (patch)
tree57c8aeaf5e3d5942435b90eb8a568ebc37cdee7b /src/main/java/eu/siacs/conversations/services
parent5ffeed8edb2ad89f942631b93472282313d1559b (diff)
parentcd204d5931a6cf0289d2df120f278864b8b94fdf (diff)
copy commits
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java12
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java42
2 files changed, 29 insertions, 25 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index ec68c07a6..b99069a64 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -62,12 +62,12 @@ public class NotificationService {
public boolean notify(final Message message) {
return (message.getStatus() == Message.STATUS_RECEIVED)
- && notificationsEnabled()
- && !message.getConversation().isMuted()
- && (message.getConversation().getMode() == Conversation.MODE_SINGLE
- || conferenceNotificationsEnabled()
- || wasHighlightedOrPrivate(message)
- );
+ && notificationsEnabled()
+ && !message.getConversation().isMuted()
+ && (message.getConversation().isPnNA()
+ || conferenceNotificationsEnabled()
+ || wasHighlightedOrPrivate(message)
+ );
}
public void notifyPebble(final Message message) {
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index e43b25368..fa0a87096 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -52,6 +52,7 @@ import de.duenndns.ssl.MemorizingTrustManager;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
+import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Bookmark;
@@ -85,7 +86,7 @@ import eu.siacs.conversations.xmpp.OnContactStatusChanged;
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.OnMessageAcknowledged;
import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
-import eu.siacs.conversations.xmpp.OnNewKeysAvailable;
+import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnPresencePacketReceived;
import eu.siacs.conversations.xmpp.OnStatusChanged;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
@@ -308,8 +309,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
private int rosterChangedListenerCount = 0;
private OnMucRosterUpdate mOnMucRosterUpdate = null;
private int mucRosterChangedListenerCount = 0;
- private OnNewKeysAvailable mOnNewKeysAvailable = null;
- private int newKeysAvailableListenerCount = 0;
+ private OnKeyStatusUpdated mOnKeyStatusUpdated = null;
+ private int keyStatusUpdatedListenerCount = 0;
private SecureRandom mRandom;
private OpenPgpServiceConnection pgpServiceConnection;
private PgpEngine mPgpEngine = null;
@@ -765,10 +766,12 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
break;
}
} else {
- packet = account.getAxolotlService().fetchPacketFromCache(message);
- if (packet == null) {
+ XmppAxolotlMessage axolotlMessage = account.getAxolotlService().fetchAxolotlMessageFromCache(message);
+ if (axolotlMessage == null) {
account.getAxolotlService().prepareMessage(message,delay);
message.setAxolotlFingerprint(account.getAxolotlService().getOwnPublicKey().getFingerprint().replaceAll("\\s", ""));
+ } else {
+ packet = mMessageGenerator.generateAxolotlChat(message, axolotlMessage);
}
}
break;
@@ -839,7 +842,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override
public void onMessageFound(Message message) {
- resendMessage(message,true);
+ resendMessage(message, true);
}
});
}
@@ -1369,30 +1372,31 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
}
- public void setOnNewKeysAvailableListener(final OnNewKeysAvailable listener) {
+ public void setOnKeyStatusUpdatedListener(final OnKeyStatusUpdated listener) {
synchronized (this) {
if (checkListeners()) {
switchToForeground();
}
- this.mOnNewKeysAvailable = listener;
- if (this.newKeysAvailableListenerCount < 2) {
- this.newKeysAvailableListenerCount++;
+ this.mOnKeyStatusUpdated = listener;
+ if (this.keyStatusUpdatedListenerCount < 2) {
+ this.keyStatusUpdatedListenerCount++;
}
}
}
public void removeOnNewKeysAvailableListener() {
synchronized (this) {
- this.newKeysAvailableListenerCount--;
- if (this.newKeysAvailableListenerCount <= 0) {
- this.newKeysAvailableListenerCount = 0;
- this.mOnNewKeysAvailable = null;
+ this.keyStatusUpdatedListenerCount--;
+ if (this.keyStatusUpdatedListenerCount <= 0) {
+ this.keyStatusUpdatedListenerCount = 0;
+ this.mOnKeyStatusUpdated = null;
if (checkListeners()) {
switchToBackground();
}
}
}
}
+
public void setOnMucRosterUpdateListener(OnMucRosterUpdate listener) {
synchronized (this) {
if (checkListeners()) {
@@ -1424,7 +1428,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
&& this.mOnRosterUpdate == null
&& this.mOnUpdateBlocklist == null
&& this.mOnShowErrorToast == null
- && this.mOnNewKeysAvailable == null);
+ && this.mOnKeyStatusUpdated == null);
}
private void switchToForeground() {
@@ -1851,7 +1855,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} else {
MessagePacket outPacket = mMessageGenerator.generateOtrChat(message);
if (outPacket != null) {
- mMessageGenerator.addDelay(outPacket,message.getTimeSent());
+ mMessageGenerator.addDelay(outPacket, message.getTimeSent());
message.setStatus(Message.STATUS_SEND);
databaseBackend.updateMessage(message);
sendMessagePacket(account, outPacket);
@@ -2313,9 +2317,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
}
- public void newKeysAvailable() {
- if(mOnNewKeysAvailable != null) {
- mOnNewKeysAvailable.onNewKeysAvailable();
+ public void keyStatusUpdated() {
+ if(mOnKeyStatusUpdated != null) {
+ mOnKeyStatusUpdated.onKeyStatusUpdated();
}
}