diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-07-05 11:59:38 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-07-05 11:59:38 +0200 |
commit | bef731a3c8ec2d4cefb70e6a7fe4232825a1d876 (patch) | |
tree | eb4043314cb5573f672c1c21d7f03a66132e6039 /src/main/java/eu/siacs/conversations/entities | |
parent | 148955a7136b65b6a070706e5cf561db68fa6616 (diff) |
refactored sendMessage and merged with resendMessage
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Message.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index ac5a9d56..078a4565 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -435,6 +435,26 @@ public class Message extends AbstractEntity { return (status > STATUS_RECEIVED || (contact != null && contact.trusted())); } + public boolean fixCounterpart() { + Presences presences = conversation.getContact().getPresences(); + if (counterpart != null && presences.has(counterpart.getResourcepart())) { + return true; + } else if (presences.size() >= 1) { + try { + counterpart = Jid.fromParts(conversation.getJid().getLocalpart(), + conversation.getJid().getDomainpart(), + presences.asStringArray()[0]); + return true; + } catch (InvalidJidException e) { + counterpart = null; + return false; + } + } else { + counterpart = null; + return false; + } + } + public enum Decision { MUST, SHOULD, |