Index: src/plugins/contentFilter/src/java/org/jivesoftware/openfire/plugin/ContentFilterPlugin.java =================================================================== --- src/plugins/contentFilter/src/java/org/jivesoftware/openfire/plugin/ContentFilterPlugin.java (revision 7852) +++ src/plugins/contentFilter/src/java/org/jivesoftware/openfire/plugin/ContentFilterPlugin.java (working copy) @@ -109,6 +109,8 @@ * be used to mask matching content. */ public static final String MASK_ENABLED_PROPERTY = "plugin.contentFilter.mask.enabled"; + + public static final String EVIL_ENABLED_PROPERTY = "plugin.contentFilter.evil.enabled"; /** * The expected value is a string. If this property is set any matching @@ -196,6 +198,11 @@ * flag if mask should be used */ private boolean maskEnabled; + + /** + * flag if malicious stanza tag should be used + */ + private boolean evilEnabled; /** * the mask to use @@ -235,6 +242,7 @@ setPatterns("fox,dog"); setFilterStatusEnabled(false); setMaskEnabled(false); + setEvilEnabled(false); setMask("***"); setAllowOnMatch(false); } @@ -254,6 +262,10 @@ public boolean isMaskEnabled() { return maskEnabled; } + + public boolean isEvilEnabled() { + return evilEnabled; + } public void setMaskEnabled(boolean enabled) { maskEnabled = enabled; @@ -262,6 +274,12 @@ changeContentFilterMask(); } + + public void setEvilEnabled(boolean enabled) { + evilEnabled = enabled; + JiveGlobals.setProperty(EVIL_ENABLED_PROPERTY, enabled ? "true" + : "false"); + } public void setMask(String mas) { mask = mas; @@ -454,9 +472,13 @@ // default to false maskEnabled = JiveGlobals.getBooleanProperty(MASK_ENABLED_PROPERTY, false); - + // default to "***" mask = JiveGlobals.getProperty(MASK_PROPERTY, "***"); + + // default to false + evilEnabled = JiveGlobals.getBooleanProperty(EVIL_ENABLED_PROPERTY, + false); // default to false allowOnMatch = JiveGlobals.getBooleanProperty( @@ -529,6 +551,10 @@ Log.debug("Content filter: allowed content:" + packet.toString()); } + + if (evilEnabled) { + packet.getElement().addElement("evil","http://jabber.org/protocol/evil"); + } // no further action required @@ -644,4 +670,4 @@ Log.error("Content Filter: Failed to send email, please review Openfire setup", e); } } -} \ No newline at end of file +} Index: src/plugins/contentFilter/src/web/contentfilter-props-edit-form.jsp =================================================================== --- src/plugins/contentFilter/src/web/contentfilter-props-edit-form.jsp (revision 7852) +++ src/plugins/contentFilter/src/web/contentfilter-props-edit-form.jsp (working copy) @@ -24,7 +24,10 @@ boolean allowOnMatch = ParamUtils.getBooleanParameter(request, "allowonmatch"); String [] maskChecked = ParamUtils.getParameters(request, "maskenabled"); boolean maskEnabled = maskChecked.length > 0; - String mask = ParamUtils.getParameter(request, "mask"); + String mask = ParamUtils.getParameter(request, "mask"); + + String [] evilChecked = ParamUtils.getParameters(request, "evilenabled"); + boolean evilEnabled = evilChecked.length > 0; //rejection options boolean rejectionNotificationEnabled = ParamUtils.getBooleanParameter(request, "rejectionnotificationenabled"); @@ -61,7 +64,7 @@ if (mask == null) { errors.put("missingMask", "missingMask"); } - + if (rejectionMsg == null) { errors.put("missingRejectionMsg", "missingRejectionMsg"); } @@ -98,6 +101,7 @@ plugin.setAllowOnMatch(allowOnMatch); plugin.setMaskEnabled(maskEnabled); plugin.setMask(mask); + plugin.setEvilEnabled(evilEnabled); plugin.setViolationNotificationEnabled(notificationEnabled); plugin.setViolationContact(contactName); plugin.setViolationNotificationByIMEnabled(notificationByIMEnabled); @@ -132,6 +136,7 @@ filterStatusEnabled = plugin.isFilterStatusEnabled(); allowOnMatch = plugin.isAllowOnMatch(); maskEnabled = plugin.isMaskEnabled(); + evilEnabled = plugin.isEvilEnabled(); notificationEnabled = plugin.isViolationNotificationEnabled(); rejectionNotificationEnabled = plugin.isRejectionNotificationEnabled(); @@ -264,6 +269,10 @@ - Packets will be allowed. +