|
|
|
|
@ -6,7 +6,6 @@
|
|
|
|
|
*/
|
|
|
|
|
package net.java.sip.communicator.plugin.otr;
|
|
|
|
|
|
|
|
|
|
import net.java.otr4j.*;
|
|
|
|
|
import net.java.otr4j.io.*;
|
|
|
|
|
import net.java.sip.communicator.plugin.otr.OtrContactManager.OtrContact;
|
|
|
|
|
import net.java.sip.communicator.service.protocol.*;
|
|
|
|
|
@ -29,16 +28,6 @@ public MessageDeliveredEvent messageDelivered(MessageDeliveredEvent evt)
|
|
|
|
|
OtrContact otrContact =
|
|
|
|
|
OtrContactManager.getOtrContact(contact, evt.getContactResource());
|
|
|
|
|
|
|
|
|
|
OtrPolicy policy = OtrActivator.scOtrEngine.getContactPolicy(contact);
|
|
|
|
|
ScSessionStatus sessionStatus =
|
|
|
|
|
OtrActivator.scOtrEngine.getSessionStatus(otrContact);
|
|
|
|
|
// If OTR is disabled and we are not over an encrypted session, don't
|
|
|
|
|
// process anything.
|
|
|
|
|
if (!policy.getEnableManual()
|
|
|
|
|
&& sessionStatus != ScSessionStatus.ENCRYPTED
|
|
|
|
|
&& sessionStatus != ScSessionStatus.FINISHED)
|
|
|
|
|
return evt;
|
|
|
|
|
|
|
|
|
|
if (OtrActivator.scOtrEngine.isMessageUIDInjected(evt
|
|
|
|
|
.getSourceMessage().getMessageUID()))
|
|
|
|
|
// If this is a message otr4j injected earlier, don't display it,
|
|
|
|
|
@ -68,16 +57,6 @@ public MessageDeliveredEvent[] messageDeliveryPending(
|
|
|
|
|
OtrContact otrContact =
|
|
|
|
|
OtrContactManager.getOtrContact(contact, evt.getContactResource());
|
|
|
|
|
|
|
|
|
|
OtrPolicy policy = OtrActivator.scOtrEngine.getContactPolicy(contact);
|
|
|
|
|
ScSessionStatus sessionStatus =
|
|
|
|
|
OtrActivator.scOtrEngine.getSessionStatus(otrContact);
|
|
|
|
|
// If OTR is disabled and we are not over an encrypted session, don't
|
|
|
|
|
// process anything.
|
|
|
|
|
if (!policy.getEnableManual()
|
|
|
|
|
&& sessionStatus != ScSessionStatus.ENCRYPTED
|
|
|
|
|
&& sessionStatus != ScSessionStatus.FINISHED)
|
|
|
|
|
return new MessageDeliveredEvent[] {evt};
|
|
|
|
|
|
|
|
|
|
// If this is a message otr4j injected earlier, return the event as is.
|
|
|
|
|
if (OtrActivator.scOtrEngine.isMessageUIDInjected(evt
|
|
|
|
|
.getSourceMessage().getMessageUID()))
|
|
|
|
|
@ -138,16 +117,6 @@ public MessageReceivedEvent messageReceived(MessageReceivedEvent evt)
|
|
|
|
|
OtrContact otrContact =
|
|
|
|
|
OtrContactManager.getOtrContact(contact, evt.getContactResource());
|
|
|
|
|
|
|
|
|
|
OtrPolicy policy = OtrActivator.scOtrEngine.getContactPolicy(contact);
|
|
|
|
|
ScSessionStatus sessionStatus =
|
|
|
|
|
OtrActivator.scOtrEngine.getSessionStatus(otrContact);
|
|
|
|
|
// If OTR is disabled and we are not over an encrypted session, don't
|
|
|
|
|
// process anything.
|
|
|
|
|
if (!policy.getEnableManual()
|
|
|
|
|
&& sessionStatus != ScSessionStatus.ENCRYPTED
|
|
|
|
|
&& sessionStatus != ScSessionStatus.FINISHED)
|
|
|
|
|
return evt;
|
|
|
|
|
|
|
|
|
|
// Process the incoming message.
|
|
|
|
|
String msgContent = evt.getSourceMessage().getContent();
|
|
|
|
|
|
|
|
|
|
|