diff options
author | Sam Whited <sam@samwhited.com> | 2014-12-30 08:50:51 -0500 |
---|---|---|
committer | Sam Whited <sam@samwhited.com> | 2015-01-04 08:28:13 -0500 |
commit | 88704ce5cd68047008375c2eba6751e2e3cdd8c0 (patch) | |
tree | a5f653ca019d55fde10773ce00c5d82f2747cd4b /src/main/java/eu/siacs/conversations/xmpp/stanzas | |
parent | eb7e683403e9335165341ed65cf949cb60319ebc (diff) |
Verify IQ responses
Fixes #20
Move fromServer/toServer to AbstractStanza
Diffstat (limited to 'src/main/java/eu/siacs/conversations/xmpp/stanzas')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java index 1a49b45e3..55256ecee 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java +++ b/src/main/java/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java @@ -1,11 +1,12 @@ package eu.siacs.conversations.xmpp.stanzas; +import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.jid.Jid; public class AbstractStanza extends Element { - protected AbstractStanza(String name) { + protected AbstractStanza(final String name) { super(name); } @@ -36,4 +37,18 @@ public class AbstractStanza extends Element { public void setId(final String id) { setAttribute("id", id); } + + public boolean fromServer(final Account account) { + return getFrom() == null + || getFrom().equals(account.getServer()) + || getFrom().equals(account.getJid().toBareJid()) + || getFrom().equals(account.getJid()); + } + + public boolean toServer(final Account account) { + return getTo() == null + || getTo().equals(account.getServer()) + || getTo().equals(account.getJid().toBareJid()) + || getTo().equals(account.getJid()); + } } |