mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Add (To|From)TypeFilter.(FROM|TO)_ANY_JID
to filter all stanzas which have a valid jid set as to/from.
This commit is contained in:
parent
61be4d768d
commit
c73219b797
3 changed files with 8 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Florian Schmaus.
|
||||
* Copyright 2017-2018 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,6 +27,7 @@ public abstract class AbstractJidTypeFilter implements StanzaFilter {
|
|||
entityBare,
|
||||
domainFull,
|
||||
domainBare,
|
||||
any,
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -55,6 +56,8 @@ public abstract class AbstractJidTypeFilter implements StanzaFilter {
|
|||
return jid.isDomainFullJid();
|
||||
case domainBare:
|
||||
return jid.isDomainBareJid();
|
||||
case any:
|
||||
return true;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Florian Schmaus.
|
||||
* Copyright 2017-2018 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -26,6 +26,7 @@ public final class FromTypeFilter extends AbstractJidTypeFilter {
|
|||
public static final FromTypeFilter ENTITY_BARE_JID = new FromTypeFilter(JidType.entityBare);
|
||||
public static final FromTypeFilter DOMAIN_FULL_JID = new FromTypeFilter(JidType.domainFull);
|
||||
public static final FromTypeFilter DOMAIN_BARE_JID = new FromTypeFilter(JidType.domainBare);
|
||||
public static final FromTypeFilter FROM_ANY_JID = new FromTypeFilter(JidType.any);
|
||||
|
||||
private FromTypeFilter(JidType jidType) {
|
||||
super(jidType);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Florian Schmaus.
|
||||
* Copyright 2017-2018 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -26,6 +26,7 @@ public final class ToTypeFilter extends AbstractJidTypeFilter {
|
|||
public static final ToTypeFilter ENTITY_BARE_JID = new ToTypeFilter(JidType.entityBare);
|
||||
public static final ToTypeFilter DOMAIN_FULL_JID = new ToTypeFilter(JidType.domainFull);
|
||||
public static final ToTypeFilter DOMAIN_BARE_JID = new ToTypeFilter(JidType.domainBare);
|
||||
public static final ToTypeFilter TO_ANY_JID = new ToTypeFilter(JidType.any);
|
||||
|
||||
public static final StanzaFilter ENTITY_FULL_OR_BARE_JID = new OrFilter(ENTITY_FULL_JID, ENTITY_BARE_JID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue