Commit c46e77de authored by God Ly's avatar God Ly Committed by it2000

OF-127 Prepend string to broadcast messages (not using the patch)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11681 b35dd754-fafc-0310-a699-88a17e54d16e
parent e32531df
......@@ -44,6 +44,12 @@
Broadcast Plugin Changelog
</h1>
<p><b>1.8.2</b> -- April 19, 2010</p>
<ul>
<li>Requires Openfire 3.7.0.</li>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-127'>OF-127</a>] - Prepend string to broadcast messages.</li>
</ul>
<p><b>1.8.1</b> -- April 1, 2010</p>
<ul>
<li>Requires Openfire 3.7.0.</li>
......
......@@ -8,8 +8,8 @@
<name>Broadcast</name>
<description>Broadcasts messages to users.</description>
<author>Jive Software</author>
<version>1.8.1</version>
<date>4/1/2010</date>
<version>1.8.2</version>
<date>4/19/2010</date>
<url>http://www.igniterealtime.org</url>
<minServerVersion>3.7.0</minServerVersion>
</plugin>
\ No newline at end of file
......@@ -62,23 +62,26 @@ The broadcast plugin is configured via Openfire system properties. These can
be configured under Server/Server Manager/System Properties:
<ul>
<li><tt>plugin.broadcast.serviceName</tt> -- the name of the broadcast service. If no value
is set, the default is "broadcast".</li>
<li><tt>plugin.broadcast.disableGroupPermissions</tt> -- true to allow any user to
broadcast a message to a group. When false, only group members or administrators can
broadcast messages to a group. The default value is false.</li>
<li><tt>plugin.broadcast.groupMembersAllowed</tt> -- true to also allow group members
to send broadcast messages to groups they belong to. When false, only administrators can
send broadcast messages to a group. The default value is true. Note that the property value
of <tt>plugin.broadcast.disableGroupPermissions</tt> can effectively override this value
by letting anyone send broadcast messages to groups.</li>
<li><tt>plugin.broadcast.allowedUsers</tt> -- the comma-delimitted list of users allowed
to broadcast messages to all connected users at once. When this property isn't set,
anyone is allowed to broadcast messages to all users. Users should be specified by their
bare JID (e.g. john@myserver.com)</li>
<li><tt>plugin.broadcast.all2offline</tt> -- true to deliver broadcast messages sent
to all@[serviceName].[serverName] to online and offline users. When false or not
set only online users get the messages as described below.</li>
<li><tt>plugin.broadcast.serviceName</tt> -- the name of the broadcast service. If no value
is set, the default is "broadcast".</li>
<li><tt>plugin.broadcast.disableGroupPermissions</tt> -- true to allow any user to
broadcast a message to a group. When false, only group members or administrators can
broadcast messages to a group. The default value is false.</li>
<li><tt>plugin.broadcast.groupMembersAllowed</tt> -- true to also allow group members
to send broadcast messages to groups they belong to. When false, only administrators can
send broadcast messages to a group. The default value is true. Note that the property value
of <tt>plugin.broadcast.disableGroupPermissions</tt> can effectively override this value
by letting anyone send broadcast messages to groups.</li>
<li><tt>plugin.broadcast.allowedUsers</tt> -- the comma-delimitted list of users allowed
to broadcast messages to all connected users at once. When this property isn't set,
anyone is allowed to broadcast messages to all users. Users should be specified by their
bare JID (e.g. john@myserver.com)</li>
<li><tt>plugin.broadcast.all2offline</tt> -- true to deliver broadcast messages sent
to all@[serviceName].[serverName] to online and offline users. When false or not
set only online users get the messages as described below.</li>
<li><tt>plugin.broadcast.messagePrefix</tt> -- Add a prefix for all broadcast
messages. Set this to "(broadcast)" to prepend "(broadcast)&nbsp;".
</li>
</ul>
<h2>Using the Plugin</h2>
......
......@@ -74,6 +74,7 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
private boolean groupMembersAllowed;
private boolean disableGroupPermissions;
private boolean all2ofline;
private String messagePrefix;
private ComponentManager componentManager;
private PluginManager pluginManager;
private UserManager userManager;
......@@ -88,8 +89,8 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
groupMembersAllowed = JiveGlobals.getBooleanProperty(
"plugin.broadcast.groupMembersAllowed", true);
allowedUsers = stringToList(JiveGlobals.getProperty("plugin.broadcast.allowedUsers", ""));
all2ofline = JiveGlobals.getBooleanProperty(
"plugin.broadcast.all2offline", false);
all2ofline = JiveGlobals.getBooleanProperty("plugin.broadcast.all2offline", false);
messagePrefix = JiveGlobals.getProperty("plugin.broadcast.messagePrefix", null);
}
// Plugin Interface
......@@ -224,7 +225,11 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
}
return;
}
if ( ( messagePrefix != null ) && ( message.getBody() != null ) ) {
message.setBody(messagePrefix + " " + message.getBody());
}
if (all2ofline==false) {
// send to online users
sessionManager.broadcast(message);
......@@ -268,6 +273,9 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
else if (canProceed) {
// Broadcast message to group users. Users that are offline will get
// the message when they come back online
if ( ( messagePrefix != null ) && ( message.getBody() != null ) ) {
message.setBody(messagePrefix + " " + message.getBody());
}
for (JID userJID : group.getMembers()) {
Message newMessage = message.createCopy();
newMessage.setTo(userJID);
......
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