Commit 0cfa5e95 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Committing beginnings of remote roster plugin, for spectrum integration (and...

Committing beginnings of remote roster plugin, for spectrum integration (and anything else that might use it).  This is completely non-functional atm.  Just doing work on UI and working out some logistics.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12875 b35dd754-fafc-0310-a699-88a17e54d16e
parent 627121e8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Remote Roster 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>
Remote Roster Plugin Changelog
</h1>
<p><b>1.0</b> -- Oct 16, 2011</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.openfire.plugin.RemoteRosterPlugin</class>
<name>Remote Roster</name>
<description>ProtoXEP-xxxx: Remote Roster Management support</description>
<author>Daniel Henninger</author>
<version>1.0.0</version>
<date>10/16/2011</date>
<minServerVersion>3.7.0</minServerVersion>
<!-- Admin console entries -->
<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="remoteRoster" name="${rr.summary.title}"
url="rr-main.jsp"
description="${rr.summary.title}" />
</sidebar>
</tab>
</adminconsole>
</plugin>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Remote Roster 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%;
}
#datatable TH {
color : #fff;
background-color : #2A448C;
text-align : left;
}
#datatable TD {
background-color : #FAF6EF;
}
#datatable .name {
background-color : #DCE2F5;
}
</style>
</head>
<body>
<h1>
Remote Roster Plugin Readme
</h1>
<h2>Overview</h2>
<p>
This plugin will implement the proto-XEP, Remote Roster, discussed
<a href="http://jkaluza.fedorapeople.org/remote-roster.html">here</a>.
Basically it's purpose is to allow an external component full
control over the part of a roster it's assigned. For example,
if the AIM transport is at aim.example.org, you can allow that transport
to make whatever modifications it needs without involving the end user.
This is especially useful so that a user does not get flooded with
subscription requests upon registration. This plugin also implements
a few minor extensions that Kraken used to implement for Spark, though
those are optional.
</p>
<h2>Installation</h2>
<p>Copy remoteRoster.jar into the plugins directory of your Openfire installation. The
plugin will then be automatically deployed. To upgrade to a new version, copy the new
remoteRoster.jar file over the existing file.</p>
<h2>Configuration</h2>
<p>The Remote Roster plugin can be configured under "Server"-"Server Settings"-"Remote Roster".</p>
</body>
</html>
\ No newline at end of file
rr.summary.title=Remote Roster
\ No newline at end of file
package org.jivesoftware.openfire.plugin;
import java.io.File;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RemoteRosterPlugin implements Plugin {
private static final Logger Log = LoggerFactory.getLogger(RemoteRosterPlugin.class);
private static PluginManager pluginManager;
public RemoteRosterPlugin() {
}
public void initializePlugin(PluginManager manager, File pluginDirectory) {
pluginManager = manager;
}
public void destroyPlugin() {
}
public String getName() {
return "remoteRoster";
}
public static PluginManager getPluginManager() {
return pluginManager;
}
}
<%@ page import="org.jivesoftware.openfire.session.ComponentSession" %>
<%@ page import="java.util.Collection" %>
<%@ page import="org.jivesoftware.openfire.SessionManager" %>
<%@ page import="org.jivesoftware.util.JiveGlobals" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="org.jivesoftware.util.ParamUtils" %>
<%@ 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="webManager" class="org.jivesoftware.util.WebManager"/>
<%
webManager.init(request, response, session, application, out);
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
boolean persistentRoster = ParamUtils.getBooleanAttribute(request, "persistentEnabled");
String[] componentsEnabled = request.getParameterValues("enabledComponents[]");
Map<String,String> errors = new HashMap<String,String>();
if (save) {
for (String property : JiveGlobals.getPropertyNames("plugin.remoteroster.jids")) {
JiveGlobals.deleteProperty(property);
}
if (componentsEnabled != null) {
for (int i = 0; i < componentsEnabled.length; i++) {
JiveGlobals.setProperty("plugin.remoteroster.jids."+componentsEnabled[i], "true");
}
}
JiveGlobals.setProperty("plugin.remoteroster.persistent", (persistentRoster ? "true" : "false"));
response.sendRedirect("rr-main.jsp?success=true");
return;
}
// Get the session manager
SessionManager sessionManager = webManager.getSessionManager();
Collection<ComponentSession> sessions = sessionManager.getComponentSessions();
%>
<html>
<head>
<title>
<fmt:message key="rr.summary.title"/>
</title>
<meta name="pageID" content="remoteRoster"/>
<meta name="helpPage" content=""/>
</head>
<body>
<p>
Any components configured here will allow the external component associated with them full control over
their domain within any user's roster. Before enabling Remote Roster Management support for an external
component, first connect it like you would any external component. Once it has connected and registered
with Openfire, it's JID should show up below and you can enable Remote Roster support.
</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" alt=""></td>
<td class="jive-icon-label">
Settings saved!
</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" alt=""></td>
<td class="jive-icon-label">
Error saving settings!
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="rr-main.jsp?save" method="post">
<div class="jive-contentBoxHeader">Connected Gateway Components</div>
<div class="jive-contentBox">
<p>Select which components you want to enable remote roster on:</p>
<table>
<%
boolean gatewayFound = false;
for (ComponentSession componentSession : sessions) {
if (!componentSession.getExternalComponent().getCategory().equals("gateway")) { continue; }
gatewayFound = true;
%>
<tr>
<td align="center"><input type="checkbox" name="enabledComponents[]" value="<%= componentSession.getExternalComponent().getInitialSubdomain() %>" <%= JiveGlobals.getBooleanProperty("plugin.remoteroster.jids."+componentSession.getExternalComponent().getInitialSubdomain(), false) ? "checked=\"checked\"" : "" %> /></td>
<td align="left"><%= componentSession.getExternalComponent().getName() %></td>
<td align="left"><%= componentSession.getExternalComponent().getInitialSubdomain() %></td>
</tr>
<%
}
%>
</table>
<%
if (!gatewayFound) {
%>
<span style="font-weight: bold">No connected external gateway components found.</span>
<%
}
%>
</div>
<div class="jive-contentBoxHeader">Options</div>
<div class="jive-contentBox">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr valign="top">
<td width="1%" nowrap class="c1">
Persistent Roster:
</td>
<td width="99%">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td>
<input type="radio" name="persistentEnabled" value="true" checked id="PER01">
</td>
<td><label for="PER01">Enabled (remote rosters are saved into the user's stored roster)</label></td>
</tr>
<tr>
<td>
<input type="radio" name="persistentEnabled" value="false" id="PER02">
</td>
<td><label for="PER02">Disabled (remote rosters exist only in memory)</label></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<input type="submit" name="save" value="Save Settings" />
</form>
</body>
</html>
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