aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarin Dzhigarov <m.dzhigarov@gmail.com>2013-08-21 14:42:16 +0300
committerBoris Grozev <boris@jitsi.org>2013-08-21 14:42:44 +0300
commit4ccf32c738b11405c24556fa9fe816370c2b31f6 (patch)
tree2c8ad5784de645e985e489b4cbc76ba465a4fd41 /src
parentb2635ae0b62c7ff4b44570163d14dd8db31e6e3a (diff)
downloadjitsi-4ccf32c738b11405c24556fa9fe816370c2b31f6.zip
jitsi-4ccf32c738b11405c24556fa9fe816370c2b31f6.tar.gz
jitsi-4ccf32c738b11405c24556fa9fe816370c2b31f6.tar.bz2
Added support for OTR for SIP
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
index 45dbcb6..1ff29fa 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
@@ -211,7 +211,8 @@ public class OperationSetBasicInstantMessagingSipImpl
Request mes;
try
{
- mes = createMessageRequest(to, message);
+ Message transformedMessage = transformSIPMessage(to, message);
+ mes = createMessageRequest(to, transformedMessage);
}
catch (OperationFailedException ex)
{
@@ -468,6 +469,38 @@ public class OperationSetBasicInstantMessagingSipImpl
}
/**
+ * Transforms SIP message via transformation layer.
+ *
+ * @param to The <tt>Contact</tt> to send the <tt>message</tt> to.
+ * @param message The <tt>message</tt> to send.
+ *
+ * @return The new transformed <tt>Message</tt>
+ */
+ private Message transformSIPMessage(Contact to, Message message)
+ {
+ MessageDeliveredEvent msgDeliveryPendingEvt
+ = new MessageDeliveredEvent(message, to);
+
+ msgDeliveryPendingEvt
+ = messageDeliveryPendingTransform(msgDeliveryPendingEvt);
+
+ if (msgDeliveryPendingEvt == null)
+ return null;
+
+ String content = msgDeliveryPendingEvt.getSourceMessage().getContent();
+
+ OperationSetBasicInstantMessaging opSetBasicIM =
+ (OperationSetBasicInstantMessaging) sipProvider
+ .getSupportedOperationSets().get(
+ OperationSetBasicInstantMessaging.class.getName());
+ Message transformedMesssage =
+ opSetBasicIM.createMessage(content, message.getContentType(),
+ message.getEncoding(), message.getSubject());
+
+ return transformedMesssage;
+ }
+
+ /**
* Parses the content type of a message and return the type
*
* @param msg the Message to scan