Commit 053c2df7 authored by Holger Bergunde's avatar Holger Bergunde Committed by holger.bergunde

OF-530 added jabber:iq:last feature, minor fixes, v1.2.0

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12997 b35dd754-fafc-0310-a699-88a17e54d16e
parent e4470e82
......@@ -44,11 +44,18 @@
GoJara Plugin Changelog
</h1>
<p><b>1.2 Alpha</b> -- Feb 17, 2012</p>
<ul>
<li>Added feature: Auto response to jabber:iq:last</li>
<li>Added: Icon</li>
<li>Fixed: jQuery conflicts with OF's prototype.js</li>
</ul>
<p><b>1.1 Alpha</b> -- Jan 6, 2012</p>
<ul>
<li>Added feature to limit gateways to specific user group</li>
<li>Added feature: Limit gateways to specific user group</li>
<li>Capture packets to create statistics</li>
<li>Added live logging</li>
<li>Renamed to GoJara</li>
......
......@@ -7,8 +7,8 @@
<name>GoJara</name>
<description>ProtoXEP-xxxx: Remote Roster Management support</description>
<author>Holger Bergunde and Daniel Henninger</author>
<version>1.1.1 Alpha</version>
<date>01/06/2012</date>
<version>1.2.0 Alpha</version>
<date>02/17/2012</date>
<databaseKey>gojara</databaseKey>
<databaseVersion>0</databaseVersion>
<minServerVersion>3.7.0</minServerVersion>
......
package org.jivesoftware.openfire.plugin.gojara.messagefilter.handler;
import org.jivesoftware.openfire.plugin.gojara.messagefilter.interceptors.DiscoPackageInterceptorHandler;
import org.jivesoftware.openfire.plugin.gojara.messagefilter.interceptors.IQLastInterceptor;
import org.jivesoftware.openfire.plugin.gojara.messagefilter.interceptors.StatisticPackageInterceptor;
import org.jivesoftware.openfire.plugin.gojara.messagefilter.remoteroster.RemoteRosterInterceptor;
......@@ -19,8 +20,12 @@ public class GatewayInterceptorHandler extends AbstractInterceptorHandler {
DiscoPackageInterceptorHandler discoInterceptor = new DiscoPackageInterceptorHandler(subdomain);
RemoteRosterInterceptor remoteRosterInterceptor = new RemoteRosterInterceptor(subdomain);
StatisticPackageInterceptor statisticInterceptor = new StatisticPackageInterceptor(subdomain);
IQLastInterceptor iqLastInterceptor = new IQLastInterceptor(subdomain);
addInterceptor(remoteRosterInterceptor);
addInterceptor(discoInterceptor);
addInterceptor(statisticInterceptor);
addInterceptor(iqLastInterceptor);
}
}
package org.jivesoftware.openfire.plugin.gojara.messagefilter.interceptors;
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
import org.jivesoftware.openfire.PacketRouter;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.interceptor.PacketInterceptor;
import org.jivesoftware.openfire.interceptor.PacketRejectedException;
import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.util.JiveGlobals;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.IQ;
import org.xmpp.packet.Packet;
/**
*
* Some clients try to check how long a contact is already offline. This feature
* is not supported by spectrum so it won't response to this IQ stanza. To
* prevent the client from waiting for a response we could answer with a
* service-unavailable message as described in XEP-12.
*
* @author Holger Bergunde
*
*/
public class IQLastInterceptor implements PacketInterceptor {
private String _subDomain;
protected static final Logger Log = LoggerFactory.getLogger(IQLastInterceptor.class);
public IQLastInterceptor(String subdomain) {
Log.debug("Createt IQLastInterceptor for " + subdomain);
_subDomain = subdomain;
}
@Override
public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed)
throws PacketRejectedException {
if (!iqLastInterceptorEnabled()) {
Log.debug("Auto repsonse to jabber:iq:last is deactivated. You could enabled it using the webinterface ");
return;
}
if (packet instanceof IQ && incoming && processed) {
IQ iqpacket = (IQ) packet;
if (!iqpacket.getTo().toString().contains(_subDomain))
return;
Element root = iqpacket.getChildElement();
if (root == null)
return;
String ns = root.getNamespaceURI();
if (ns.equals("jabber:iq:last") && iqpacket.getType().equals(IQ.Type.get)) {
IQ answer = new IQ();
answer.setType(IQ.Type.error);
answer.setFrom(iqpacket.getTo());
answer.setTo(iqpacket.getFrom());
answer.setID(iqpacket.getID());
DefaultElement errorElement = new DefaultElement("error");
errorElement.addAttribute("type", "cancel");
errorElement.addAttribute("code", "503");
DefaultElement serviceElement = new DefaultElement("service-unavailable");
serviceElement.addNamespace("", "urn:ietf:params:xml:ns:xmpp-stanzas");
errorElement.add(serviceElement);
answer.setChildElement(errorElement);
Log.debug("Auto response to jabber:iq:last for " + _subDomain);
PacketRouter router = XMPPServer.getInstance().getPacketRouter();
router.route(answer);
}
}
}
private boolean iqLastInterceptorEnabled() {
return JiveGlobals.getBooleanProperty("plugin.remoteroster.iqLastFilter", false);
}
}
jQuery.noConflict();
function searchSuggest(object) {
document.getElementById('search_suggest' + object).innerHTML = '';
var str = escape(document.getElementById('groupSearch' + object).value);
$("#ajaxloading" + object).html("<img src=\"images/ajax-loader.gif\">");
jQuery("#ajaxloading" + object).html("<img src=\"images/ajax-loader.gif\">");
var request = new http();
var f = function(obj) {
var ss = document.getElementById('search_suggest' + object);
......@@ -16,9 +18,9 @@ function searchSuggest(object) {
+ '</div>';
ss.innerHTML += suggest;
}
$("#search_suggest" + object).show("slow");
jQuery("#search_suggest" + object).show("slow");
} else {
$("#search_suggest" + object).hide("slow");
jQuery("#search_suggest" + object).hide("slow");
}
};
request.callback = f;
......@@ -37,7 +39,7 @@ function suggestOut(div_value) {
function setSearch(value, object) {
document.getElementById("groupSearch" + object).value = value;
// document.getElementById('search_suggest').innerHTML = '';
$("#search_suggest" + object).hide("slow");
jQuery("#search_suggest" + object).hide("slow");
checkIfExists(value, object);
}
......@@ -51,7 +53,7 @@ function checkIfExists(value, object) {
var stri = String(str);
var respStr = String(resp[i].textContent);
if (stri == respStr) {
$("#ajaxloading" + object).html(
jQuery("#ajaxloading" + object).html(
"<img src=\"images/correct-16x16.png\">");
break;
}
......@@ -61,16 +63,16 @@ function checkIfExists(value, object) {
request.load('groups?search=' + str);
}
$(document).ready(function() {
$(".browser-data").horizontalBarGraph({
jQuery(document).ready(function() {
jQuery(".browser-data").horizontalBarGraph({
interval : 1
});
var i = 0;
while ($('#logiq' + i).html() != null) {
var iqs = $('#logiq' + i).html();
var msg = $('#logmsg' + i).html();
var roster = $('#logroster' + i).html();
var presence = $('#logpresence' + i).html();
while (jQuery('#logiq' + i).html() != null) {
var iqs = jQuery('#logiq' + i).html();
var msg = jQuery('#logmsg' + i).html();
var roster = jQuery('#logroster' + i).html();
var presence = jQuery('#logpresence' + i).html();
var data = [ {
label : "IQ",
......@@ -86,7 +88,7 @@ $(document).ready(function() {
data : parseInt(presence)
} ];
$.plot($("#pie" + i), data, {
jQuery.plot(jQuery("#pie" + i), data, {
series : {
pie : {
show : true,
......@@ -110,5 +112,5 @@ $(document).ready(function() {
})
function slideToggle(value) {
$(value).slideToggle();
jQuery(value).slideToggle();
}
......@@ -23,6 +23,10 @@
boolean persistentRoster = true;
String sparkdiscoParam = request.getParameter("sparkDiscoInfo");
boolean sparkDiscoInfo = sparkdiscoParam == null ? false : sparkdiscoParam.equals("true");
String iqLastFilterPram = request.getParameter("iqLastFilter");
boolean iqLastFilter = iqLastFilterPram == null ? false : iqLastFilterPram.equals("true");
String[] componentsEnabled = request.getParameterValues("enabledComponents[]");
PermissionManager _pmanager = new PermissionManager();
DatabaseManager _db;
......@@ -43,6 +47,7 @@
}
JiveGlobals.setProperty("plugin.remoteroster.persistent", (persistentRoster ? "true" : "false"));
JiveGlobals.setProperty("plugin.remoteroster.sparkDiscoInfo", (sparkDiscoInfo ? "true" : "false"));
JiveGlobals.setProperty("plugin.remoteroster.iqLastFilter", (iqLastFilter ? "true" : "false"));
response.sendRedirect("rr-main.jsp?success=true");
return;
}
......@@ -321,15 +326,29 @@
: ""%> />
</td>
<td><label for="SDI"> Support jabber:iq:registered feature*</label></td>
<td><label for="SDI"> Support jabber:iq:registered feature</label></td>
</tr>
<tr>
<td />
<td align="left" style="font-size: -3; color: grey">*If you use Spark clients within your network, it
<td align="left" style="font-size: -3; color: grey">If you use Spark clients within your network, it
might be necessary to modify the service discovery packets between Spark and the external component. If you
check this RemoteRoster will add the feature "jabber:iq:registered" to the disco#info to indicate that the
Client is registered with the external component.</td>
</tr>
<tr>
<td><input type="checkbox" name="iqLastFilter" id="SDI2" value="true"
<%=JiveGlobals.getBooleanProperty("plugin.remoteroster.iqLastFilter", false) ? "checked=\"checked\""
: ""%> />
</td>
<td><label for="SDI">Reply to jabber:iq:last </label></td>
</tr>
<tr>
<td />
<td align="left" style="font-size: -3; color: grey">Some clients try to check how long a contact is already offline.
This feature is not supported by spectrum so it won't response to this IQ stanza. To prevent the client from waiting
for a response we could answer with a service-unavailable message as described in XEP-12.</td>
</tr>
</tbody>
</table>
</td>
......
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