Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
version 0.9.4 Release 7 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
deleolajide committed Dec 17, 2018
1 parent e2616b8 commit 0512982
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion classes/swagger/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
});
window.swaggerUi.load();
window.swaggerUi.api.clientAuthorizations.add("ofchat", new SwaggerClient.ApiKeyAuthorization("Authorization", "<%= JiveGlobals.getProperty("plugin.restapi.secret", null) %>", "header"));
window.swaggerUi.api.clientAuthorizations.add("ofchat", new SwaggerClient.ApiKeyAuthorization("Authorization", "<%= JiveGlobals.getProperty("plugin.ofchat.secret", null) %>", "header"));
function log() {
if ('console' in window) {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<adminconsole>
<tab id="tab-webclients" name="${admin.sidebar.webclients.name}" description="${admin.sidebar.webclients.description}" url="rest-api.jsp">
<sidebar id="tab-chatapi" name="${admin.sidebar.webclients.item.chatapi.name}" description="${admin.sidebar.webclients.item.chatapi.description}">
<item url="rest-api.jsp" id="rest-api" name="${admin.sidebar.webclients.item.settings.name}" description="${admin.sidebar.webclients.item.settings.description}" />
<item url="rest-api.jsp" id="chatapi-rest-api" name="${admin.sidebar.webclients.item.settings.name}" description="${admin.sidebar.webclients.item.settings.description}" />
<item url="swagger-ui-sandbox.jsp" id="swagger-ui" name="${admin.sidebar.webclients.item.swagger.name}" description="${admin.sidebar.webclients.item.swagger.description}" />
<item url="ofchat-email-listener.jsp" id="ofchat-email-listener" name="${config.page.email.listener.title}" description="${config.page.email.listener.description}"/>
<item url="uport-summary.jsp" id="uport-summary" name="${config.page.uport.summary.title}" description="${config.page.uport.summary.description}"/>
Expand Down
9 changes: 7 additions & 2 deletions src/java/org/ifsoft/meet/MeetController.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public static MeetController getInstance() {
*/
public boolean performAction(String action, String callId, String destination)
{
Log.debug("performAction " + action + " " + callId + " " + destination + " " + callList.get(callId));
JSONObject call = callList.get(callId);
String otherCallid = otherCallid = callId + " -bleg"; // use " -both" for consultative transfer

if (call.has("otherCallId")) otherCallid = call.getString("otherCallId");

Log.debug("performAction " + action + " " + callId + " " + destination + " " + call);

boolean processed = false;

Expand All @@ -83,7 +88,7 @@ public boolean performAction(String action, String callId, String destination)
}
else

if ("transfer".equals(action) && RESTServicePlugin.getInstance().sendAsyncFWCommand("uuid_transfer " + callId + " -bleg " + destination) != null)
if ("transfer".equals(action) && RESTServicePlugin.getInstance().sendAsyncFWCommand("uuid_transfer " + otherCallid + " " + destination) != null)
{
processed = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ public void initializePlugin(PluginManager manager, File pluginDirectory)

SessionEventDispatcher.addListener(this);

secret = JiveGlobals.getProperty("plugin.restapi.secret", "");
secret = JiveGlobals.getProperty("plugin.ofchat.secret", "");

// If no secret key has been assigned, assign a random one.
if ("".equals(secret)) {
secret = StringUtils.randomString(16);
setSecret(secret);
}

permission = JiveGlobals.getProperty("plugin.restapi.permission", "");
permission = JiveGlobals.getProperty("plugin.ofchat.permission", "");

// If no permission key has been assigned, assign a random one.
if ("".equals(permission)) {
Expand All @@ -202,22 +202,22 @@ public void initializePlugin(PluginManager manager, File pluginDirectory)
Log.info("Initialize REST");

// See if Custom authentication filter has been defined
customAuthFilterClassName = JiveGlobals.getProperty("plugin.restapi.customAuthFilter", "");
customAuthFilterClassName = JiveGlobals.getProperty("plugin.ofchat.customAuthFilter", "");

// See if the service is enabled or not.
enabled = JiveGlobals.getBooleanProperty("plugin.restapi.enabled", false);
enabled = JiveGlobals.getBooleanProperty("plugin.ofchat.enabled", false);
smsEnabled = JiveGlobals.getBooleanProperty("ofchat.sms.enabled", false);
emailEnabled = JiveGlobals.getBooleanProperty("ofchat.email.enabled", false);
smsProvider = JiveGlobals.getProperty("ofchat.sms.provider", "mexmo");
adhocEnabled = JiveGlobals.getBooleanProperty("ofchat.adhoc.commands.enabled", false);
swaggerSecure = JiveGlobals.getBooleanProperty("ofchat.swagger.secure", false);

// See if the HTTP Basic Auth is enabled or not.
httpAuth = JiveGlobals.getProperty("plugin.restapi.httpAuth", "basic");
httpAuth = JiveGlobals.getProperty("plugin.ofchat.httpAuth", "basic");

// Get the list of IP addresses that can use this service. An empty list
// means that this filter is disabled.
allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.restapi.allowedIPs", ""));
allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.ofchat.allowedIPs", ""));

// Listen to system property events
PropertyEventDispatcher.addListener(this);
Expand Down Expand Up @@ -649,7 +649,7 @@ public String getSecret() {
* the secret key.
*/
public void setSecret(String secret) {
JiveGlobals.setProperty("plugin.restapi.secret", secret);
JiveGlobals.setProperty("plugin.ofchat.secret", secret);
this.secret = secret;
}

Expand All @@ -669,7 +669,7 @@ public String getPermission() {
* the permission key.
*/
public void setPermission(String permission) {
JiveGlobals.setProperty("plugin.restapi.permission", permission);
JiveGlobals.setProperty("plugin.ofchat.permission", permission);
this.permission = permission;
}

Expand Down Expand Up @@ -708,7 +708,7 @@ public Collection<String> getAllowedIPs() {
* @param allowedIPs the new allowed i ps
*/
public void setAllowedIPs(Collection<String> allowedIPs) {
JiveGlobals.setProperty("plugin.restapi.allowedIPs", StringUtils.collectionToString(allowedIPs));
JiveGlobals.setProperty("plugin.ofchat.allowedIPs", StringUtils.collectionToString(allowedIPs));
this.allowedIPs = allowedIPs;
}

Expand All @@ -731,7 +731,7 @@ public boolean isEnabled() {
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
JiveGlobals.setProperty("plugin.restapi.enabled", enabled ? "true" : "false");
JiveGlobals.setProperty("plugin.ofchat.enabled", enabled ? "true" : "false");
}

public boolean isEmailEnabled() {
Expand Down Expand Up @@ -795,22 +795,22 @@ public String getHttpAuth() {
*/
public void setHttpAuth(String httpAuth) {
this.httpAuth = httpAuth;
JiveGlobals.setProperty("plugin.restapi.httpAuth", httpAuth);
JiveGlobals.setProperty("plugin.ofchat.httpAuth", httpAuth);
}

/* (non-Javadoc)
* @see org.jivesoftware.util.PropertyEventListener#propertySet(java.lang.String, java.util.Map)
*/
public void propertySet(String property, Map<String, Object> params) {
if (property.equals("plugin.restapi.secret")) {
if (property.equals("plugin.ofchat.secret")) {
this.secret = (String) params.get("value");
} else if (property.equals("plugin.restapi.permission")) {
} else if (property.equals("plugin.ofchat.permission")) {
this.permission = (String) params.get("value");
} else if (property.equals("plugin.restapi.enabled")) {
} else if (property.equals("plugin.ofchat.enabled")) {
this.enabled = Boolean.parseBoolean((String) params.get("value"));
} else if (property.equals("plugin.restapi.allowedIPs")) {
} else if (property.equals("plugin.ofchat.allowedIPs")) {
this.allowedIPs = StringUtils.stringToCollection((String) params.get("value"));
} else if (property.equals("plugin.restapi.httpAuth")) {
} else if (property.equals("plugin.ofchat.httpAuth")) {
this.httpAuth = (String) params.get("value");
} else if(property.equals(CUSTOM_AUTH_FILTER_PROPERTY_NAME)) {
this.customAuthFilterClassName = (String) params.get("value");
Expand All @@ -821,15 +821,15 @@ public void propertySet(String property, Map<String, Object> params) {
* @see org.jivesoftware.util.PropertyEventListener#propertyDeleted(java.lang.String, java.util.Map)
*/
public void propertyDeleted(String property, Map<String, Object> params) {
if (property.equals("plugin.restapi.secret")) {
if (property.equals("plugin.ofchat.secret")) {
this.secret = "";
} else if (property.equals("plugin.restapi.permission")) {
} else if (property.equals("plugin.ofchat.permission")) {
this.permission = "";
} else if (property.equals("plugin.restapi.enabled")) {
} else if (property.equals("plugin.ofchat.enabled")) {
this.enabled = false;
} else if (property.equals("plugin.restapi.allowedIPs")) {
} else if (property.equals("plugin.ofchat.allowedIPs")) {
this.allowedIPs = Collections.emptyList();
} else if (property.equals("plugin.restapi.httpAuth")) {
} else if (property.equals("plugin.ofchat.httpAuth")) {
this.httpAuth = "basic";
} else if(property.equals(CUSTOM_AUTH_FILTER_PROPERTY_NAME)) {
this.customAuthFilterClassName = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
public class JerseyWrapper extends ServletContainer {

/** The Constant CUSTOM_AUTH_PROPERTY_NAME */
private static final String CUSTOM_AUTH_PROPERTY_NAME = "plugin.restapi.customAuthFilter";
private static final String CUSTOM_AUTH_PROPERTY_NAME = "plugin.ofchat.customAuthFilter";

/** The Constant REST_AUTH_TYPE */
private static final String REST_AUTH_TYPE = "plugin.restapi.httpAuth";
private static final String REST_AUTH_TYPE = "plugin.ofchat.httpAuth";

/** The Constant AUTHFILTER. */
private static final String AUTHFILTER = "org.jivesoftware.openfire.plugin.rest.AuthFilter";
Expand Down
2 changes: 1 addition & 1 deletion src/web/rest-api.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<html>
<head>
<title>Chat API Properties</title>
<meta name="pageID" content="rest-api" />
<meta name="pageID" content="chatapi-rest-api" />
</head>
<body>

Expand Down

0 comments on commit 0512982

Please sign in to comment.