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 @@ ...@@ -44,6 +44,12 @@
Broadcast Plugin Changelog Broadcast Plugin Changelog
</h1> </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> <p><b>1.8.1</b> -- April 1, 2010</p>
<ul> <ul>
<li>Requires Openfire 3.7.0.</li> <li>Requires Openfire 3.7.0.</li>
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<name>Broadcast</name> <name>Broadcast</name>
<description>Broadcasts messages to users.</description> <description>Broadcasts messages to users.</description>
<author>Jive Software</author> <author>Jive Software</author>
<version>1.8.1</version> <version>1.8.2</version>
<date>4/1/2010</date> <date>4/19/2010</date>
<url>http://www.igniterealtime.org</url> <url>http://www.igniterealtime.org</url>
<minServerVersion>3.7.0</minServerVersion> <minServerVersion>3.7.0</minServerVersion>
</plugin> </plugin>
\ No newline at end of file
...@@ -79,6 +79,9 @@ be configured under Server/Server Manager/System Properties: ...@@ -79,6 +79,9 @@ be configured under Server/Server Manager/System Properties:
<li><tt>plugin.broadcast.all2offline</tt> -- true to deliver broadcast messages sent <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 to all@[serviceName].[serverName] to online and offline users. When false or not
set only online users get the messages as described below.</li> 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> </ul>
<h2>Using the Plugin</h2> <h2>Using the Plugin</h2>
......
...@@ -74,6 +74,7 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener ...@@ -74,6 +74,7 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
private boolean groupMembersAllowed; private boolean groupMembersAllowed;
private boolean disableGroupPermissions; private boolean disableGroupPermissions;
private boolean all2ofline; private boolean all2ofline;
private String messagePrefix;
private ComponentManager componentManager; private ComponentManager componentManager;
private PluginManager pluginManager; private PluginManager pluginManager;
private UserManager userManager; private UserManager userManager;
...@@ -88,8 +89,8 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener ...@@ -88,8 +89,8 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
groupMembersAllowed = JiveGlobals.getBooleanProperty( groupMembersAllowed = JiveGlobals.getBooleanProperty(
"plugin.broadcast.groupMembersAllowed", true); "plugin.broadcast.groupMembersAllowed", true);
allowedUsers = stringToList(JiveGlobals.getProperty("plugin.broadcast.allowedUsers", "")); allowedUsers = stringToList(JiveGlobals.getProperty("plugin.broadcast.allowedUsers", ""));
all2ofline = JiveGlobals.getBooleanProperty( all2ofline = JiveGlobals.getBooleanProperty("plugin.broadcast.all2offline", false);
"plugin.broadcast.all2offline", false); messagePrefix = JiveGlobals.getProperty("plugin.broadcast.messagePrefix", null);
} }
// Plugin Interface // Plugin Interface
...@@ -225,6 +226,10 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener ...@@ -225,6 +226,10 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
return; return;
} }
if ( ( messagePrefix != null ) && ( message.getBody() != null ) ) {
message.setBody(messagePrefix + " " + message.getBody());
}
if (all2ofline==false) { if (all2ofline==false) {
// send to online users // send to online users
sessionManager.broadcast(message); sessionManager.broadcast(message);
...@@ -268,6 +273,9 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener ...@@ -268,6 +273,9 @@ public class BroadcastPlugin implements Plugin, Component, PropertyEventListener
else if (canProceed) { else if (canProceed) {
// Broadcast message to group users. Users that are offline will get // Broadcast message to group users. Users that are offline will get
// the message when they come back online // the message when they come back online
if ( ( messagePrefix != null ) && ( message.getBody() != null ) ) {
message.setBody(messagePrefix + " " + message.getBody());
}
for (JID userJID : group.getMembers()) { for (JID userJID : group.getMembers()) {
Message newMessage = message.createCopy(); Message newMessage = message.createCopy();
newMessage.setTo(userJID); 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