aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny van Heumen <danny@dannyvanheumen.nl>2014-11-25 22:14:30 +0100
committerDanny van Heumen <danny@dannyvanheumen.nl>2014-11-26 00:05:23 +0100
commit50fb5ceabb894d20bcd1507c8b48a1ddd5af399b (patch)
treeeae977922d926aaccf459bdbc4518f14fdbe0f08
parent3edf1138a726861066fbf156c93931174249d0d3 (diff)
downloadjitsi-50fb5ceabb894d20bcd1507c8b48a1ddd5af399b.zip
jitsi-50fb5ceabb894d20bcd1507c8b48a1ddd5af399b.tar.gz
jitsi-50fb5ceabb894d20bcd1507c8b48a1ddd5af399b.tar.bz2
Fix bug in conjuction with OTR fragmentation support.
Fixed bug where sent message would be listed as many times as there were fragments required to send the message. (+ some tweaks)
-rw-r--r--src/net/java/sip/communicator/impl/protocol/irc/OperationSetBasicInstantMessagingIrcImpl.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetBasicInstantMessagingIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetBasicInstantMessagingIrcImpl.java
index b9f951d..62d2d54 100644
--- a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetBasicInstantMessagingIrcImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetBasicInstantMessagingIrcImpl.java
@@ -89,6 +89,13 @@ public class OperationSetBasicInstantMessagingIrcImpl
return;
}
+ final IrcConnection connection =
+ this.provider.getIrcStack().getConnection();
+ if (connection == null)
+ {
+ throw new IllegalStateException("Connection is not available.");
+ }
+
// OTR seems to be compatible with the command syntax (starts with '/')
// and there were no other obvious problems so we decided to implement
// IRC command support for IM infrastructure too.
@@ -97,6 +104,13 @@ public class OperationSetBasicInstantMessagingIrcImpl
messageDeliveryPendingTransform(new MessageDeliveredEvent(original,
to));
+ if (msgDeliveryPendingEvts.length == 0)
+ {
+ LOGGER.warn("Message transformation result does not contain a "
+ + "single message. Nothing to send.");
+ return;
+ }
+
try
{
for (MessageDeliveredEvent event : msgDeliveryPendingEvts)
@@ -111,16 +125,11 @@ public class OperationSetBasicInstantMessagingIrcImpl
// Note: can't set subject since it leaks information while
// message content actually did get encrypted.
+ // FIXME should get contentType and contentEncoding from
+ // transformed messages, just in case
MessageIrcImpl message = this.createMessage(transformedContent,
original.getContentType(), original.getEncoding(), "");
- final IrcConnection connection =
- this.provider.getIrcStack().getConnection();
- if (connection == null)
- {
- throw new IllegalStateException(
- "Connection is not available.");
- }
try
{
if (!event.isMessageEncrypted() && message.isCommand())
@@ -128,14 +137,6 @@ public class OperationSetBasicInstantMessagingIrcImpl
try
{
connection.getMessageManager().command(to, message);
- MessageReceivedEvent systemEvent =
- new MessageReceivedEvent(
- message,
- to,
- new Date(),
- MessageReceivedEvent
- .SYSTEM_MESSAGE_RECEIVED);
- fireMessageEvent(systemEvent);
}
catch (final UnsupportedCommandException e)
{
@@ -174,7 +175,6 @@ public class OperationSetBasicInstantMessagingIrcImpl
else
{
connection.getMessageManager().message(to, message);
- fireMessageDelivered(original, to);
}
}
catch (RuntimeException e)
@@ -183,6 +183,7 @@ public class OperationSetBasicInstantMessagingIrcImpl
throw e;
}
}
+ fireMessageDelivered(original, to);
}
catch (RuntimeException e)
{