Commit df47742b authored by daryl herzmann's avatar daryl herzmann

Merge pull request #519 from Redor/master

REST API Plugin update to version 1.2.2
parents d8980554 d52458f7
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
REST API Plugin Changelog REST API Plugin Changelog
</h1> </h1>
<p><b>1.2.2</b> -- January 20th, 2015</p>
<ul>
<li>Added: Presence status to the Session Enitity. E.g. Online, Away etc.</li>
<li>Fixed: Node parameter in the Session Enitity. E.g. Local or Remote</li>
</ul>
<p><b>1.2.1</b> -- November 24th, 2015</p> <p><b>1.2.1</b> -- November 24th, 2015</p>
<ul> <ul>
<li>Fixed: Cluster issue by creating a new chat room</li> <li>Fixed: Cluster issue by creating a new chat room</li>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<name>REST API</name> <name>REST API</name>
<description>Allows administration over a RESTful API.</description> <description>Allows administration over a RESTful API.</description>
<author>Roman Soldatow</author> <author>Roman Soldatow</author>
<version>1.2.1</version> <version>1.2.2</version>
<date>11/24/2015</date> <date>01/20/2016</date>
<minServerVersion>4.0.0</minServerVersion> <minServerVersion>4.0.0</minServerVersion>
<adminconsole> <adminconsole>
<tab id="tab-server"> <tab id="tab-server">
......
...@@ -13,10 +13,12 @@ import org.jivesoftware.openfire.plugin.rest.entity.SessionEntity; ...@@ -13,10 +13,12 @@ import org.jivesoftware.openfire.plugin.rest.entity.SessionEntity;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType; import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException; import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.session.ClientSession; import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.session.LocalClientSession;
import org.jivesoftware.openfire.session.Session; import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.xmpp.packet.Presence;
import org.xmpp.packet.StreamError; import org.xmpp.packet.StreamError;
/** /**
...@@ -104,7 +106,12 @@ public class SessionController { ...@@ -104,7 +106,12 @@ public class SessionController {
} }
session.setRessource(clientSession.getAddress().getResource()); session.setRessource(clientSession.getAddress().getResource());
session.setNode(session.getNode());
if (clientSession instanceof LocalClientSession) {
session.setNode("Local");
} else {
session.setNode("Remote");
}
String status = ""; String status = "";
if (clientSession.getStatus() == Session.STATUS_CLOSED) { if (clientSession.getStatus() == Session.STATUS_CLOSED) {
...@@ -119,9 +126,25 @@ public class SessionController { ...@@ -119,9 +126,25 @@ public class SessionController {
session.setSessionStatus(status); session.setSessionStatus(status);
if (clientSession.getPresence() != null) { if (clientSession.getPresence() != null) {
session.setPresenceStatus(clientSession.getPresence().getStatus()); session.setPresenceMessage(clientSession.getPresence().getStatus());
Presence.Show show = clientSession.getPresence().getShow();
if(show == Presence.Show.away) {
session.setPresenceStatus("Away");
} else if(show == Presence.Show.chat) {
session.setPresenceStatus("Available to Chat");
} else if(show == Presence.Show.dnd) {
session.setPresenceStatus("Do Not Disturb");
} else if(show == Presence.Show.xa) {
session.setPresenceStatus("Extended Away");
} else if(show == null) {
session.setPresenceStatus("Online");
} else {
session.setPresenceStatus("Unknown/Not Recognized");
}
session.setPriority(clientSession.getPresence().getPriority()); session.setPriority(clientSession.getPresence().getPriority());
} }
try { try {
session.setHostAddress(clientSession.getHostAddress()); session.setHostAddress(clientSession.getHostAddress());
session.setHostName(clientSession.getHostName()); session.setHostName(clientSession.getHostName());
......
...@@ -7,7 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -7,7 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name = "session") @XmlRootElement(name = "session")
@XmlType(propOrder = { "sessionId", "username", "ressource", "node", "sessionStatus", "presenceStatus", "priority", @XmlType(propOrder = { "sessionId", "username", "ressource", "node", "sessionStatus", "presenceStatus", "presenceMessage", "priority",
"hostAddress", "hostName", "creationDate", "lastActionDate", "secure" }) "hostAddress", "hostName", "creationDate", "lastActionDate", "secure" })
public class SessionEntity { public class SessionEntity {
...@@ -17,6 +17,7 @@ public class SessionEntity { ...@@ -17,6 +17,7 @@ public class SessionEntity {
private String node; private String node;
private String sessionStatus; private String sessionStatus;
private String presenceStatus; private String presenceStatus;
private String presenceMessage;
private int priority; private int priority;
private String hostAddress; private String hostAddress;
private String hostName; private String hostName;
...@@ -83,6 +84,14 @@ public class SessionEntity { ...@@ -83,6 +84,14 @@ public class SessionEntity {
this.presenceStatus = presenceStatus; this.presenceStatus = presenceStatus;
} }
public String getPresenceMessage() {
return presenceMessage;
}
public void setPresenceMessage(String presenceMessage) {
this.presenceMessage = presenceMessage;
}
@XmlElement @XmlElement
public int getPriority() { public int getPriority() {
return priority; return priority;
......
...@@ -16,7 +16,6 @@ import org.jivesoftware.openfire.group.GroupJID; ...@@ -16,7 +16,6 @@ import org.jivesoftware.openfire.group.GroupJID;
import org.jivesoftware.openfire.group.GroupNotFoundException; import org.jivesoftware.openfire.group.GroupNotFoundException;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
// TODO: Auto-generated Javadoc
/** /**
* The Class UserUtils. * The Class UserUtils.
*/ */
......
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