Commit a2250981 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Updates.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@871 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3a353a28
......@@ -58,7 +58,7 @@ Choose your database from the list below for setup details:
upgrade to the newest Connector/J drivers (3.0.2 or later).
<p>
In the Jive Messenger web-based setup tool, use the following values:<p><ul>
<li>driver: <tt>org.gjt.mm.mysql.Driver</tt>
<li>driver: <tt>com.mysql.jdbc.Driver</tt>
<li>server: <tt>jdbc:mysql://[YOUR_HOST]/[DATABASE_NAME]</tt>
</ul><p>
......@@ -68,11 +68,10 @@ Choose your database from the list below for setup details:
<p><b>Setup Instructions</b><p>
<ol>
<li>Make sure that you are using MySQL 3.23.2 or later and the
MyISAM table type (default).
<li>Make sure that you are using MySQL 3.23.2 or later (4.x recommended).
<li>Create a database for the Jive tables:<br>
<code>mysqladmin create [databaseName]</code><br>
(note: "databaseName" can be something like 'jivexmpp')
(note: "databaseName" can be something like 'messenger')
<li>Import the schema file from the <tt>resources/database</tt> directory of the installation folder:<br>
Unix/Linux: <code>cat messenger_mysql.sql | mysql [databaseName];</code>
......@@ -258,18 +257,18 @@ Choose your database from the list below for setup details:
</ul>
<p><h2><a name="hsql">HSQL 1.7.1 (Hypersonic)</a></h2><p><ul>
<p><h2><a name="hsql">HSQLDB 1.7.4</a></h2><p><ul>
<b>Special Note</b>
<p>
Jive Messenger bundles HSQL as its embedded database. If you choose to use the embedded database,
Jive Messenger bundles hsqldb as its embedded database. If you choose to use the embedded database,
it can be configured via the Jive Messenger installer. If you have a stand-alone installation
of HSQL, follow the instructions below to connect to it.
of hsqlDB, follow the instructions below to connect to it.
</p>
<b>JDBC Drivers</b>
<p>
Because HSQL db is embedded in Jive Messenger, there is no need to download the
Because hsqldb is embedded in Jive Messenger, there is no need to download the
JDBC driver separately. Values for the config file are:
<ul>
<li>driver: <code>org.hsqldb.jdbcDriver</code>
......
......@@ -65,7 +65,8 @@ file might look like the following:
<p>Your plugin class must be implement the
<tt><a href="javadoc/org/jivesoftware/messenger/container/Plugin.html">Plugin</a></tt>
interface from the <a href="javadoc/index.html">Jive Messenger API</a>. The Plugin interface has
interface from the <a href="javadoc/index.html">Jive Messenger API</a> as
well as have a default (no argument) contructor. The Plugin interface has
methods for initializing and destroying the plugin, as well as methods for retrieving meta-data
such as the plugin name, description, version, and author.
</p>
......@@ -191,7 +192,29 @@ looks for plugin development directories in the following format:
</fieldset>
<p>The build script will compile source files and JSPs and create a valid
plugin structure.</p>
plugin structure and JAR file. Put your plugin directories in the <tt>src/plugins</tt>
directory of the source distribution and then use <tt>ant plugins</tt> to
build your plugins.</p>
<h2>Implementing Your Plugin</h2>
<p>Plugins have full access to the Jive Messenger API. This provides a tremendous
amount of flexibility for what plugins can accomplish. However, there are several integration
points that are the most common:
<ol>
<li>Register a plugin as a <a href="javadoc/org/jivesoftware/messenger/Component.html">Component</a>.
Components receive all packets addressed to a particular sub-domain. For example,
<tt>test_component.example.com</tt>. So, a packet sent to <tt>joe@test_component.example.com</tt> would
be delivered to the component. Note that the sub-domains defined as components are unrelated to DNS entries
for sub-domains. All XMPP routing at the socket level is done using the primary server domain (example.com in the
example above); sub-domains are only used for routing within the XMPP server.
<li>Register a plugin as an IQHandler. IQ handlers respond to IQ packets with a particular element name and
namespace.
</ol>
</p>
<br><br>
......
/**
* $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;
import org.xmpp.packet.Packet;
/**
* Interface for Components.
*
* @see ComponentManager
* @author Derek DeMoro
*/
public interface Component {
/**
* Processes an incoming packet addressed to this component.
*
* @param packet the packet.
*/
void processPacket(Packet packet);
}
/**
* $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;
import java.util.Map;
......@@ -9,7 +20,7 @@ import org.xmpp.packet.Presence;
/**
* Manages the registration and delegation of Components. The ComponentManager
* is responsible for managing registration and delegation of <code>Components</code>,
* is responsible for managing registration and delegation of {@link Component Components},
* as well as offering a facade around basic server functionallity such as sending and
* receiving of packets.
*
......
......@@ -28,6 +28,7 @@ import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
* Broadcast service plugin. It accepts messages and broadcasts them out to
......@@ -43,7 +44,7 @@ public class BroadcastPlugin implements Plugin, Component {
private String serviceName;
private SessionManager sessionManager;
private GroupManager groupManager;
private List<String> allowedUsers;
private List<JID> allowedUsers;
private boolean groupMembersAllowed;
/**
......@@ -53,7 +54,7 @@ public class BroadcastPlugin implements Plugin, Component {
serviceName = JiveGlobals.getProperty("plugin.broadcast.serviceName", "broadcast");
groupMembersAllowed = JiveGlobals.getBooleanProperty(
"plugin.broadcast.groupMembersAllowed", true);
allowedUsers = new ArrayList<String>();
allowedUsers = stringToList(JiveGlobals.getProperty("plugin.broadcast.allowedUsers", ""));
}
// Plugin Interface
......@@ -86,6 +87,8 @@ public class BroadcastPlugin implements Plugin, Component {
// Unregister component.
ComponentManager.getInstance().removeComponent(serviceName);
sessionManager = null;
groupManager = null;
allowedUsers.clear();
}
// Component Interface
......@@ -100,7 +103,8 @@ public class BroadcastPlugin implements Plugin, Component {
if ("all".equals(toNode)) {
if (allowedUsers.size() > 0) {
// See if the user is allowed to send the message.
String address = message.getFrom().toBareJID();
JID address = new JID(message.getFrom().toBareJID());
System.out.println("address: " + address);
if (!allowedUsers.contains(address)) {
Message error = new Message();
if (message.getID() != null) {
......@@ -127,7 +131,8 @@ public class BroadcastPlugin implements Plugin, Component {
try {
Group group = groupManager.getGroup(toNode);
if ((groupMembersAllowed && group.isUser(fromNode)) ||
group.getAdmins().contains(fromNode))
group.getAdmins().contains(fromNode) ||
allowedUsers.contains(message.getFrom().toBareJID()))
{
for (String user : group.getMembers()) {
Message newMessage = message.createCopy();
......@@ -205,10 +210,27 @@ public class BroadcastPlugin implements Plugin, Component {
*
* @return the users allowed to send broadcast messages.
*/
public Collection<String> getGlobalAllowedUsers() {
public Collection<JID> getGlobalAllowedUsers() {
return allowedUsers;
}
/**
* Sets the collection of addresses of users allowed to send broadcast
* messages. If the collection is empty, anyone can send broadcast messages.
* Additional users may also be allowed to send broadcast messages to
* specific groups depending on the group settings.
*
* @param allowedUsers collection of users allowed to send broadcast messages
* to all users.
*/
public void setGlobalAllowedUsers(Collection<String> allowedUsers) {
StringBuffer buf = new StringBuffer();
for (String jid : allowedUsers) {
buf.append(jid).append(",");
}
JiveGlobals.setProperty("plugin.broadcast.allowedUsers", buf.toString());
}
/**
* Returns true if normal group members are allowed to send broadcast messages
* to groups they belong to. Otherwise, only group administrators can send
......@@ -235,4 +257,28 @@ public class BroadcastPlugin implements Plugin, Component {
this.groupMembersAllowed = allowed;
JiveGlobals.setProperty("plugin.broadcast.groupMembersAllowed", Boolean.toString(allowed));
}
/**
* Returns a comma-delimitted list of strings into a Collection of Strings.
*
* @param str the String.
* @return a list.
*/
private List<JID> stringToList(String str) {
List<JID> values = new ArrayList<JID>();
StringTokenizer tokens = new StringTokenizer(str, ",");
while (tokens.hasMoreTokens()) {
String value = tokens.nextToken().trim();
if (!value.equals("")) {
// See if this is a full JID or just a username.
if (value.contains("@")) {
values.add(new JID(value));
}
else {
values.add(XMPPServer.getInstance().createJID(value, null));
}
}
}
return values;
}
}
\ No newline at end of file
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