aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-24 16:14:18 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-24 16:14:18 +0200
commitea261c1032eae6c17244da029e1c491ade51e1e1 (patch)
tree7a239d39553bc12f9f577b870f9158dfaf1ab464 /src/eu/siacs/conversations/services
parentc2ddfded94b71e1f04466821378ca4b187292baf (diff)
more otr fixes
Diffstat (limited to 'src/eu/siacs/conversations/services')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 35bc26035..51192432c 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -760,6 +760,7 @@ public class XmppConnectionService extends Service {
private void resendMessage(Message message) {
Account account = message.getConversation().getAccount();
+ MessagePacket packet = null;
if (message.getEncryption() == Message.ENCRYPTION_OTR) {
Presences presences = message.getConversation().getContact()
.getPresences();
@@ -776,18 +777,21 @@ public class XmppConnectionService extends Service {
getApplicationContext(), presence, true);
}
}
+ } else {
+ if (message.getConversation().getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) {
+ if (message.getType() == Message.TYPE_TEXT) {
+ packet = mMessageGenerator.generateOtrChat(message,true);
+ } else if (message.getType() == Message.TYPE_IMAGE) {
+ mJingleConnectionManager.createNewConnection(message);
+ }
+ }
}
} else if (message.getType() == Message.TYPE_TEXT) {
- MessagePacket packet = null;
if (message.getEncryption() == Message.ENCRYPTION_NONE) {
packet = mMessageGenerator.generateChat(message,true);
} else if ((message.getEncryption() == Message.ENCRYPTION_DECRYPTED)||(message.getEncryption() == Message.ENCRYPTION_PGP)) {
packet = mMessageGenerator.generatePgpChat(message,true);
}
- if (packet != null) {
- account.getXmppConnection().sendMessagePacket(packet);
- markMessage(message, Message.STATUS_SEND);
- }
} else if (message.getType() == Message.TYPE_IMAGE) {
Presences presences = message.getConversation().getContact()
.getPresences();
@@ -804,6 +808,10 @@ public class XmppConnectionService extends Service {
}
}
}
+ if (packet != null) {
+ account.getXmppConnection().sendMessagePacket(packet);
+ markMessage(message, Message.STATUS_SEND);
+ }
}
public void fetchRosterFromServer(Account account) {
@@ -1206,13 +1214,11 @@ public class XmppConnectionService extends Service {
&& (msg.getEncryption() == Message.ENCRYPTION_OTR)) {
msg.setPresence(otrSession.getSessionID().getUserID());
if (msg.getType() == Message.TYPE_TEXT) {
- try {
- MessagePacket outPacket = mMessageGenerator.generateOtrChat(msg,true);
+ MessagePacket outPacket = mMessageGenerator.generateOtrChat(msg,true);
+ if (outPacket!=null) {
msg.setStatus(Message.STATUS_SEND);
databaseBackend.updateMessage(msg);
account.getXmppConnection().sendMessagePacket(outPacket);
- } catch (OtrException e) {
- Log.e(LOGTAG,"error creating otr packet");
}
} else if (msg.getType() == Message.TYPE_IMAGE) {
mJingleConnectionManager.createNewConnection(msg);