Commit 1c384447 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Initial version.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1594 b35dd754-fafc-0310-a699-88a17e54d16e
parent f29ffc9f
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Search Plugin Changelog</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
padding-left : 1em;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
</style>
</head>
<body>
<h1>
ContentFilter Plugin Changelog
</h1>
<p><b>1.0</b> -- July, 2005</p>
<ul>
<li>Initial release.</li>
</ul>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<!-- Main plugin class -->
<class>org.jivesoftware.messenger.plugin.ContentFilterPlugin</class>
<!-- Plugin meta-data -->
<name>ContentFilter</name>
<description>Scans message packets for defined patterns</description>
<author>Conor Hayes</author>
<version>1.0</version>
<minServerVersion>2.2.0</minServerVersion>
<!-- UI extension -->
<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="contentfilter-props-edit-form" name="Content Filter"
url="contentfilter-props-edit-form.jsp"
description="Click to configure content filter" />
</sidebar>
</tab>
</adminconsole>
</plugin>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ContentFilter Plugin Readme</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
</style>
</head>
<body>
<h1>
ContentFilter Plugin Readme
</h1>
<h2>Overview</h2>
<p>
The content filter plugin allows admins to configure various actions based on
message content. These actions include notifying the admin of content matches,
notifying the sender that a message was rejected or masking the content with
alternative content.
</p>
<h2>Installation</h2>
<p>
Copy the contentfilter.jar into the plugins directory of your Jive Messenger
installation. The plugin will then be automatically deployed. To upgrade to a
new version, copy the new contentfilter.jar file over the existing file.
</p>
<h2>Configuration</h2>
<p>
By default, after the plugin has been deployed all of its features are disabled.
This plugin is configured via the "Content Filter" sidebar item located under the
"System" tab in the Jive Messenger Admin Console.
</p>
<h2>Using the Plugin</h2>
<p>
After the plugin has been configured, nothing else needs to be done to use it.
</p>
</body>
</html>
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.messenger.plugin;
import org.xmpp.packet.Message;
import java.util.ArrayList;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Filters message content using regular expressions. If a content mask is
* provided message content will be altered.
*
* @author Conor Hayes
*/
public class ContentFilter {
private String patterns;
private Collection<Pattern> compiledPatterns = new ArrayList<Pattern>();
private String mask;
/**
* A default instance will allow all message content.
*
* @see #setPatterns(String)
* @see #setMask(String)
*/
public ContentFilter() {
}
/**
* Set the patterns to use for searching content.
*
* @param regExps a comma separated String of regular expressions
*/
public void setPatterns(String patterns) {
if (patterns != null) {
this.patterns = patterns;
String[] data = patterns.split(",");
compiledPatterns.clear();
for (int i = 0; i < data.length; i++) {
compiledPatterns.add(Pattern.compile(data[i]));
}
}
else {
clearPatterns();
}
}
public String getPatterns() {
return this.patterns;
}
/**
* Clears all patterns. Calling this method means that all message content
* will be allowed.
*/
public void clearPatterns() {
patterns = null;
compiledPatterns.clear();
}
/**
* Set the content replacement mask.
*
* @param mask the mask to use when replacing content
*/
public void setMask(String mask) {
this.mask = mask;
}
/**
* @return the current mask or null if none has been set
*/
public String getMask() {
return mask;
}
/**
* Clears the content mask.
*
* @see #filter(Message)
*/
public void clearMask() {
mask = null;
}
/**
* @return true if the filter is currently masking content, false otherwise
*/
public boolean isMaskingContent() {
return mask != null;
}
/**
* Filters message content.
*
* @param msg the message to filter, its subject/body may be altered if there
* are content matches and a content mask is set
* @return true if the msg content matched up, false otherwise
*/
public boolean filter(Message msg) {
boolean hasMatch = false;
if (msg.getSubject() != null) {
if (hasMatch(msg.getSubject())) {
hasMatch = true;
if (isMaskingContent()) {
String newSubject = replaceContent(msg.getSubject());
msg.setSubject(newSubject);
}
}
}
if (msg.getBody() != null) {
if (hasMatch(msg.getBody())) {
hasMatch = true;
if (isMaskingContent()) {
String newBody = replaceContent(msg.getBody());
msg.setBody(newBody);
}
}
}
return hasMatch;
}
private String replaceContent(String content) {
for (Pattern pattern : compiledPatterns) {
Matcher m = pattern.matcher(content);
content = m.replaceAll(mask);
}
return content;
}
/**
* Performs sequential search for any pattern 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 m = pattern.matcher(content);
if (m.find()) {
hasMatch = true;
break;
}
}
return hasMatch;
}
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.messenger.plugin;
import org.jivesoftware.messenger.MessageRouter;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.container.Plugin;
import org.jivesoftware.messenger.container.PluginManager;
import org.jivesoftware.messenger.interceptor.InterceptorManager;
import org.jivesoftware.messenger.interceptor.PacketInterceptor;
import org.jivesoftware.messenger.interceptor.PacketRejectedException;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
import java.io.File;
/**
* Content filter plugin.
*
* @author Conor Hayes
*/
public class ContentFilterPlugin implements Plugin, PacketInterceptor {
/**
* The expected value is a boolean, if true the user identified by the value
* of the property #VIOLATION_NOTIFICATION_CONTACT_PROPERTY will be notified
* every time there is a content match, otherwise no notification will be
* sent. Then default value is false.
*/
public static final String VIOLATION_NOTIFICATION_ENABLED_PROPERTY =
"plugin.contentFilter.violation.notification.enabled";
/**
* The expected value is a user name. The default value is "admin".
*/
public static final String VIOLATION_NOTIFICATION_CONTACT_PROPERTY =
"plugin.contentFilter.violation.notification.contact";
/**
* The expected value is a boolean, if true the sender will be notified when a
* message is rejected, otherwise the message will be silently rejected,i.e. the
* sender will not know that the message was rejected and the receiver will
* not get the message. The default value is false.
*/
public static final String REJECTION_NOTIFICATION_ENABLED_PROPERTY =
"plugin.contentFilter.rejection.notification.enabled";
/**
* The expected value is a string, containing the desired message for the
* sender notification.
*/
public static final String REJECTION_MSG_PROPERTY = "plugin.contentFilter.rejection.msg";
/**
* The expected value is a boolean, if true the value of #PATTERNS_PROPERTY
* will be used for pattern matching.
*/
public static final String PATTERNS_ENABLED_PROPERTY = "plugin.contentFilter.patterns.enabled";
/**
* The expected value is a comma separated string of regular expressions.
*/
public static final String PATTERNS_PROPERTY = "plugin.contentFilter.patterns";
/**
* The expected value is a boolean, if true the value of #MASK_PROPERTY will
* be used to mask matching content.
*/
public static final String MASK_ENABLED_PROPERTY = "plugin.contentFilter.mask.enabled";
/**
* The expected value is a string. If this property is set any
* matching content will not be rejected but masked with the given value.
* Setting a content mask means that property #SENDER_NOTIFICATION_ENABLED_PROPERTY
* is ignored. The default value is "**".
*/
public static final String MASK_PROPERTY = "plugin.contentFilter.mask";
/**
* the hook into the inteceptor chain
*/
private InterceptorManager interceptorManager;
/**
* used to send violation notifications
*/
private MessageRouter messageRouter;
/**
* delegate that does the real work of this plugin
*/
private ContentFilter contentFilter;
/**
* flags if sender should be notified of rejections
*/
private boolean rejectionNotificationEnabled;
/**
* the rejection msg to send
*/
private String rejectionMessage;
/**
* flags if content matches should result in admin notification
*/
private boolean violationNotificationEnabled;
/**
* the admin user to send violation notifications to
*/
private String violationContact;
/**
* flag if patterns should be used
*/
private boolean patternsEnabled;
/**
* the patterns to use
*/
private String patterns;
/**
* flag if mask should be used
*/
private boolean maskEnabled;
/**
* the mask to use
*/
private String mask;
/**
* violation notification messages will be from this JID
*/
private JID violationNotificationFrom;
public ContentFilterPlugin() {
contentFilter = new ContentFilter();
interceptorManager = InterceptorManager.getInstance();
violationNotificationFrom = new JID(XMPPServer.getInstance()
.getServerInfo().getName());
messageRouter = XMPPServer.getInstance().getMessageRouter();
}
public boolean isMaskEnabled() {
return maskEnabled;
}
public void setMaskEnabled(boolean enabled) {
maskEnabled = enabled;
JiveGlobals.setProperty(MASK_ENABLED_PROPERTY, enabled ? "true" : "false");
changeContentFilterMask();
}
public void setMask(String mas) {
mask = mas;
JiveGlobals.setProperty(MASK_PROPERTY, mas);
changeContentFilterMask();
}
private void changeContentFilterMask() {
if (maskEnabled) {
contentFilter.setMask(mask);
}
else {
contentFilter.clearMask();
}
}
public String getMask() {
return mask;
}
public boolean isPatternsEnabled() {
return patternsEnabled;
}
public void setPatternsEnabled(boolean enabled) {
patternsEnabled = enabled;
JiveGlobals.setProperty(PATTERNS_ENABLED_PROPERTY, enabled ? "true"
: "false");
changeContentFilterPatterns();
}
public void setPatterns(String patt) {
patterns = patt;
JiveGlobals.setProperty(PATTERNS_PROPERTY, patt);
changeContentFilterPatterns();
}
private void changeContentFilterPatterns() {
if (patternsEnabled) {
contentFilter.setPatterns(patterns);
}
else {
contentFilter.clearPatterns();
}
}
public String getPatterns() {
return patterns;
}
public boolean isRejectionNotificationEnabled() {
return rejectionNotificationEnabled;
}
public void setRejectionNotificationEnabled(boolean enabled) {
rejectionNotificationEnabled = enabled;
JiveGlobals.setProperty(REJECTION_NOTIFICATION_ENABLED_PROPERTY,
enabled ? "true" : "false");
}
public String getRejectionMessage() {
return rejectionMessage;
}
public void setRejectionMessage(String message) {
this.rejectionMessage = message;
JiveGlobals.setProperty(REJECTION_MSG_PROPERTY, message);
}
public boolean isViolationNotificationEnabled() {
return violationNotificationEnabled;
}
public void setViolationNotificationEnabled(boolean enabled) {
violationNotificationEnabled = enabled;
JiveGlobals.setProperty(VIOLATION_NOTIFICATION_ENABLED_PROPERTY,
enabled ? "true" : "false");
}
public void setViolationContact(String contact) {
violationContact = contact;
JiveGlobals.setProperty(VIOLATION_NOTIFICATION_CONTACT_PROPERTY, contact);
}
public String getViolationContact() {
return violationContact;
}
public void initializePlugin(PluginManager pManager, File pluginDirectory) {
// configure this plugin
initFilter();
// register with interceptor manager
interceptorManager.addInterceptor(this);
}
private void initFilter() {
// default to false
violationNotificationEnabled = JiveGlobals.getBooleanProperty(
VIOLATION_NOTIFICATION_ENABLED_PROPERTY, false);
// default to "admin"
violationContact = JiveGlobals.getProperty(VIOLATION_NOTIFICATION_CONTACT_PROPERTY,
"admin");
// default to false
rejectionNotificationEnabled = JiveGlobals.getBooleanProperty(
REJECTION_NOTIFICATION_ENABLED_PROPERTY, false);
// default to english
rejectionMessage = JiveGlobals.getProperty(REJECTION_MSG_PROPERTY,
"Message rejected. This is an automated server response");
// default to false
patternsEnabled = JiveGlobals.getBooleanProperty(PATTERNS_ENABLED_PROPERTY,
false);
//default to "fox,dog"
patterns = JiveGlobals.getProperty(PATTERNS_PROPERTY, "fox,dog");
changeContentFilterPatterns();
// default to false
maskEnabled = JiveGlobals.getBooleanProperty(MASK_ENABLED_PROPERTY, false);
//default to "***"
mask = JiveGlobals.getProperty(MASK_PROPERTY, "***");
changeContentFilterMask();
}
/**
* @see org.jivesoftware.messenger.container.Plugin#destroyPlugin()
*/
public void destroyPlugin() {
// unregister with interceptor manager
interceptorManager.removeInterceptor(this);
}
public void interceptPacket(Packet packet, Session session, boolean read,
boolean processed) throws PacketRejectedException {
if (patternsEnabled && !processed && (packet instanceof Message)) {
Message msg = (Message) packet;
// filter the message
boolean contentMatched = contentFilter.filter(msg);
// notify contact of violations
if (contentMatched && violationNotificationEnabled) {
sendViolationNotification(msg);
}
// reject the message if not masking content
if (contentMatched && !maskEnabled) {
PacketRejectedException rejected = new PacketRejectedException(
"Message rejected with disallowed content!");
if (rejectionNotificationEnabled) {
// let the sender know about the rejection, this is
// only possible/useful if the content is not masked
rejected.setRejectionMessage(rejectionMessage);
}
throw rejected;
}
}
}
private void sendViolationNotification(Message offendingMsg) {
String subject = "Content filter notification!";
String msg = "Disallowed content detected in message from:"
+ offendingMsg.getFrom() + " to:" + offendingMsg.getTo()
+ ", message was "
+ (contentFilter.isMaskingContent() ? "altered" : "rejected");
messageRouter.route(createServerMessage(subject, msg));
}
private Message createServerMessage(String subject, String body) {
Message message = new Message();
message.setTo(violationContact + "@"
+ violationNotificationFrom.getDomain());
message.setFrom(violationNotificationFrom);
message.setSubject(subject);
message.setBody(body);
return message;
}
}
\ No newline at end of file
package org.jivesoftware.messenger.plugin;
import java.util.regex.PatternSyntaxException;
import junit.framework.TestCase;
import org.xmpp.packet.Message;
/**
* Basic unit tests for ContentFilter.
*
* @author chayes
*/
public class ContentFilterTest extends TestCase
{
private ContentFilter filter;
public static void main(String[] args)
{
junit.textui.TestRunner.run(ContentFilterTest.class);
}
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception
{
filter = new ContentFilter();
}
/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
super.tearDown();
}
public void testSetInvalidPatterns()
{
try
{
filter.setPatterns("$*[");
}
catch (PatternSyntaxException e)
{
System.out.println(e.getMessage());
System.out.println(e.getPattern());
}
}
public void testSetContentMask()
{
assertFalse(filter.isMaskingContent());
filter.setMask("dummy");
assertTrue(filter.isMaskingContent());
filter.clearMask();
assertFalse(filter.isMaskingContent());
}
public void testFilterWithEmptyMessage()
{
Message message = new Message();
boolean matched = filter.filter(message);
// no matches should be found
assertFalse(matched);
// message should not have changed
assertEquals(new Message().toXML(), message.toXML());
}
public void testFilterMessageSubject()
{
// filter on the word fox
filter.setPatterns("fox");
// test message
Message message = new Message();
message.setSubject("the quick brown fox jumped over the lazy dog");
boolean matched = filter.filter(message);
// matches should be found
assertTrue(matched);
// content has not changed as there is no content mask
assertEquals("the quick brown fox jumped over the lazy dog", message
.getSubject());
assertNull(message.getBody());
}
public void testFilterMessageSubjectWithMask()
{
// filter on the word fox
filter.setPatterns("fox");
//set a content mask
filter.setMask("**");
// test message
Message message = new Message();
message.setSubject("the quick brown fox jumped over the lazy dog");
boolean matched = filter.filter(message);
// matches should be found
assertTrue(matched);
// content has changed
assertEquals("the quick brown ** jumped over the lazy dog", message
.getSubject());
assertNull(message.getBody());
}
public void testFilterMessageBody()
{
// filter on the word fox
filter.setPatterns("fox");
// test message
Message message = new Message();
message.setBody("the quick brown fox jumped over the lazy dog");
boolean matched = filter.filter(message);
// matches should be found
assertTrue(matched);
// content has not changed as there is no content mask
assertEquals("the quick brown fox jumped over the lazy dog", message
.getBody());
assertNull(message.getSubject());
}
public void testFilterMessageBodyWithMask()
{
// filter on the word "fox" and "dog"
filter.setPatterns("fox,dog");
filter.setMask("**");
// test message
Message message = new Message();
message.setBody("the quick brown fox jumped over the lazy dog");
boolean matched = filter.filter(message);
// matches should not be found
assertTrue(matched);
// content has changed
assertEquals("the quick brown ** jumped over the lazy **", message
.getBody());
assertNull(message.getSubject());
}
}
\ No newline at end of file
<%@ page import="java.util.*,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*,
org.jivesoftware.messenger.plugin.ContentFilterPlugin,
org.jivesoftware.util.*"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<c:set var="admin" value="${admin.manager}" />
<% admin.init(request, response, session, application, out ); %>
<%
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
//pattern options
boolean patternsEnabled = ParamUtils.getBooleanParameter(request, "patternsenabled");
String patterns = ParamUtils.getParameter(request, "patterns");
//mask options
boolean maskEnabled = ParamUtils.getBooleanParameter(request, "maskenabled");
String mask = ParamUtils.getParameter(request, "mask");
//rejection options
boolean rejectionNotificationEnabled = ParamUtils.getBooleanParameter(request, "rejectionnotificationenabled");
String rejectionMsg = ParamUtils.getParameter(request, "rejectionMsg");
//notification options
boolean notificationEnabled = ParamUtils.getBooleanParameter(request, "notificationenabled");
String contactName = ParamUtils.getParameter(request, "contactname");
//get handle to plugin
ContentFilterPlugin plugin = (ContentFilterPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("contentfilter");
//input validation
Map errors = new HashMap();
if (save) {
if (patterns == null) {
errors.put("missingPatterns", "missingPatterns");
} else {
String[] data = patterns.split(",");
try {
for (int i = 0; i < data.length; i++) {
java.util.regex.Pattern.compile(data[i]);
}
} catch (java.util.regex.PatternSyntaxException e) {
errors.put("patternSyntaxException", e.getMessage());
}
}
if (mask == null) {
errors.put("missingMask", "missingMask");
}
if (rejectionMsg == null) {
errors.put("missingRejectionMsg", "missingRejectionMsg");
}
if (contactName == null) {
errors.put("missingContactName", "missingContactName");
} else {
contactName = contactName.trim().toLowerCase();
try {
UserManager.getInstance().getUser(contactName);
} catch (UserNotFoundException unfe) {
errors.put("userNotFound", "userNotFound");
}
}
if (errors.size() == 0) {
plugin.setPatternsEnabled(patternsEnabled);
plugin.setPatterns(patterns);
plugin.setMaskEnabled(maskEnabled);
plugin.setMask(mask);
plugin.setViolationNotificationEnabled(notificationEnabled);
plugin.setViolationContact(contactName);
plugin.setRejectionNotificationEnabled(rejectionNotificationEnabled);
plugin.setRejectionMessage(rejectionMsg);
response.sendRedirect("contentfilter-props-edit-form.jsp?success=true");
return;
}
}
else {
patterns = plugin.getPatterns();
mask = plugin.getMask();
contactName = plugin.getViolationContact();
rejectionMsg = plugin.getRejectionMessage();
}
if (errors.size() == 0) {
patterns = plugin.getPatterns();
mask = plugin.getMask();
contactName = plugin.getViolationContact();
rejectionMsg = plugin.getRejectionMessage();
}
patternsEnabled = plugin.isPatternsEnabled();
maskEnabled = plugin.isMaskEnabled();
notificationEnabled = plugin.isViolationNotificationEnabled();
rejectionNotificationEnabled = plugin.isRejectionNotificationEnabled();
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%
String title = "Content Filter";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "contentfilter-props-edit-form.jsp"));
pageinfo.setPageID("contentfilter-props-edit-form");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
Use the form below to edit content filter settings.<br>
</p>
<% if (success) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Settings updated successfully.</td>
</tr>
</tbody>
</table>
</div><br>
<% } else if (errors.size() > 0) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">Error saving the settings.</td>
</tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="contentfilter-props-edit-form.jsp?save" method="post">
<fieldset>
<legend>Filter</legend>
<div>
<p>
To enable the content filter you need to set up some regular expressions.
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="patternsenabled" value="false" id="not01"
<%= ((patternsEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Messages will not be filtered.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="patternsenabled" value="true" id="not02"
<%= ((patternsEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Messages will be filtered.
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left">Patterns:&nbsp;
<input type="text" size="100" maxlength="100" name="patterns"
value="<%= (patterns != null ? patterns : "") %>">
<% if (errors.containsKey("missingPatterns")) { %>
<span class="jive-error-text">
<br>Please enter comma separated, regular expressions.
</span>
<% } else if (errors.containsKey("patternSyntaxException")) { %>
<span class="jive-error-text">
<br>Invalid regular expression: <%= errors.get("patternSyntaxException") %>. Please try again.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>Content Mask</legend>
<div>
<p>
Enable this feature to alter message content when there is a pattern match.
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="maskenabled" value="false" id="not01"
<%= ((maskEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Messages will be rejected.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="maskenabled" value="true" id="not02"
<%= ((maskEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Messages will be masked.
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left">Mask:&nbsp;
<input type="text" size="100" maxlength="100" name="mask"
value="<%= (mask != null ? mask : "") %>">
<% if (errors.containsKey("missingMask")) { %>
<span class="jive-error-text">
<br>Please enter a mask.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>Rejection Notification</legend>
<div>
<p>
Enable this feature to have the message sender notified whenever a message is rejected.
NB: This feature is only operational if "Content Mask" feature is disabled.
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="rejectionnotificationenabled" value="false" id="not01"
<%= ((rejectionNotificationEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Notifications will not be sent out.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="rejectionnotificationenabled" value="true" id="not02"
<%= ((rejectionNotificationEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Notifications will be sent out.
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left">Rejection message:&nbsp;
<input type="text" size="100" maxlength="100" name="rejectionMsg"
value="<%= (rejectionMsg != null ? rejectionMsg : "") %>">
<% if (errors.containsKey("missingRejectionMsg")) { %>
<span class="jive-error-text">
<br>Please enter a rejection message.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>Content Match Notification</legend>
<div>
<p>
Enable this feature to have the contact person notified whenever there is a content match.
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="notificationenabled" value="false" id="not01"
<%= ((notificationEnabled) ? "" : "checked") %>>
</td>
<td width="99%">
<label for="not01"><b>Disabled</b></label> - Notifications will not be sent out.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="notificationenabled" value="true" id="not02"
<%= ((notificationEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="not02"><b>Enabled</b></label> - Notifications will be sent out.
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="left">Username:&nbsp;
<input type="text" size="100" maxlength="100" name="contactname"
value="<%= (contactName != null ? contactName : "") %>">@<%= XMPPServer.getInstance().getServerInfo().getName() %>
<% if (errors.containsKey("missingContactName")) { %>
<span class="jive-error-text">
<br>Please enter a username.
</span>
<% } else if (errors.containsKey("userNotFound")) { %>
<span class="jive-error-text">
<br>Could not find user. Please try again.
</span>
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<input type="submit" value="Save Properties">
</form>
<jsp:include page="bottom.jsp" flush="true" />
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