mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Filters now ignore case when doing comparisons.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1942 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1ac4992358
commit
206ac09f79
2 changed files with 9 additions and 9 deletions
|
@ -72,15 +72,15 @@ public class FromContainsFilter implements PacketFilter {
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
throw new IllegalArgumentException("Parameter cannot be null.");
|
throw new IllegalArgumentException("Parameter cannot be null.");
|
||||||
}
|
}
|
||||||
this.from = from;
|
this.from = from.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Packet packet) {
|
||||||
if (packet.getFrom() != null) {
|
if (packet.getFrom() == null) {
|
||||||
return packet.getFrom().indexOf(from) != -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return packet.getFrom().toLowerCase().indexOf(from) != -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -73,7 +73,7 @@ public class ToContainsFilter implements PacketFilter {
|
||||||
if (to == null) {
|
if (to == null) {
|
||||||
throw new IllegalArgumentException("Parameter cannot be null.");
|
throw new IllegalArgumentException("Parameter cannot be null.");
|
||||||
}
|
}
|
||||||
this.to = to;
|
this.to = to.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Packet packet) {
|
||||||
|
@ -81,7 +81,7 @@ public class ToContainsFilter implements PacketFilter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return packet.getTo().indexOf(to) != -1;
|
return packet.getTo().toLowerCase().indexOf(to) != -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue