Commit c8b3524b authored by guus's avatar guus

* Updating 'contentFilter' plugin to make use of SLF4J instead of custom logging (OF-53).

* Applied java generics.
* Removed unused code.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11441 b35dd754-fafc-0310-a699-88a17e54d16e
parent bad5859d
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Search Plugin Changelog</title>
<title>ContentFilter Plugin Changelog</title>
<style type="text/css">
BODY {
font-size : 100%;
......@@ -44,6 +44,14 @@
ContentFilter Plugin Changelog
</h1>
<p><b>1.6.0</b> -- December 1, 2009</p>
<ul>
<li>Now requires Openfire 3.6.5.</li>
<li>Applied Java generics.</li>
<li>Removed unused code.</li>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-53'>OF-53</a>] - Replace custom logging implementation with a third party library.</li>
</ul>
<p><b>1.5.0</b> -- April 12, 2007</p>
<ul>
<li>Now requires Openfire 3.3.0.</li>
......
......@@ -8,9 +8,9 @@
<name>Content Filter</name>
<description>Scans message packets for defined patterns</description>
<author>Conor Hayes</author>
<version>1.5.1</version>
<date>4/12/2007</date>
<minServerVersion>3.5.0</minServerVersion>
<version>1.6.1</version>
<date>12/1/2009</date>
<minServerVersion>3.6.5</minServerVersion>
<!-- UI extension -->
<adminconsole>
......
......@@ -141,9 +141,9 @@ public class ContentFilter {
{
//only check children if no match has yet been found
//or all content must be masked
Iterator iter = element.elementIterator();
Iterator<Element> iter = element.elementIterator();
while (iter.hasNext()) {
matched |= process((Element)iter.next());
matched |= process(iter.next());
}
}
......@@ -176,42 +176,4 @@ public class ContentFilter {
return match;
}
/**
* Applies mask to the given <code>content</code>
*
* @param content
* @return masked content
*/
private String mask(String content) {
for (Pattern pattern : compiledPatterns) {
Matcher m = pattern.matcher(content);
content = m.replaceAll(mask);
}
return content;
}
/**
* Applies patterns against the given <code>content</code>. Terminates on
* first match.
*
* @param content the content to search against
* @return true if a match is found, false otherwise
*/
private boolean hasMatch(String content) {
boolean hasMatch = false;
for (Pattern pattern : compiledPatterns) {
Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
hasMatch = true;
break;
}
}
return hasMatch;
}
}
\ No newline at end of file
......@@ -20,9 +20,9 @@
package org.jivesoftware.openfire.plugin;
import org.jivesoftware.util.EmailService;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import java.io.File;
import java.util.regex.PatternSyntaxException;
import org.jivesoftware.openfire.MessageRouter;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.Plugin;
......@@ -33,14 +33,15 @@ import org.jivesoftware.openfire.interceptor.PacketRejectedException;
import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.util.EmailService;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
import org.xmpp.packet.Presence;
import java.io.File;
import java.util.regex.PatternSyntaxException;
/**
* Content filter plugin.
*
......@@ -48,6 +49,8 @@ import java.util.regex.PatternSyntaxException;
*/
public class ContentFilterPlugin implements Plugin, PacketInterceptor {
private static final Logger Log = LoggerFactory.getLogger(ContentFilterPlugin.class);
/**
* The expected value is a boolean, if true the user identified by the value
* of the property #VIOLATION_NOTIFICATION_CONTACT_PROPERTY will be notified
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment