Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
a300bcea
Commit
a300bcea
authored
Aug 17, 2015
by
PGoski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add token
parent
d2415bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
CallbackOnOffline.java
...lbackOnOffline/src/java/com/fotsum/CallbackOnOffline.java
+15
-6
No files found.
src/plugins/callbackOnOffline/src/java/com/fotsum/CallbackOnOffline.java
View file @
a300bcea
...
@@ -23,6 +23,7 @@ import javax.ws.rs.client.ClientBuilder;
...
@@ -23,6 +23,7 @@ import javax.ws.rs.client.ClientBuilder;
import
javax.ws.rs.client.WebTarget
;
import
javax.ws.rs.client.WebTarget
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.io.File
;
import
java.io.File
;
import
java.util.UUID
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
public
class
CallbackOnOffline
implements
Plugin
,
PacketInterceptor
{
public
class
CallbackOnOffline
implements
Plugin
,
PacketInterceptor
{
...
@@ -31,6 +32,7 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
...
@@ -31,6 +32,7 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
private
boolean
debug
;
private
boolean
debug
;
private
String
url
;
private
String
url
;
private
String
token
;
private
InterceptorManager
interceptorManager
;
private
InterceptorManager
interceptorManager
;
private
UserManager
userManager
;
private
UserManager
userManager
;
private
PresenceManager
presenceManager
;
private
PresenceManager
presenceManager
;
...
@@ -47,12 +49,8 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
...
@@ -47,12 +49,8 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
userManager
=
XMPPServer
.
getInstance
().
getUserManager
();
userManager
=
XMPPServer
.
getInstance
().
getUserManager
();
client
=
ClientBuilder
.
newClient
();
client
=
ClientBuilder
.
newClient
();
String
code
=
"plugin.callback_on_offline.url"
;
url
=
getProperty
(
"plugin.callback_on_offline.url"
,
"http://localhost:8080/user/offline/callback/url"
);
url
=
JiveGlobals
.
getProperty
(
code
,
null
);
token
=
getProperty
(
"plugin.callback_on_offline.token"
,
UUID
.
randomUUID
().
toString
());
if
(
url
==
null
||
url
.
length
()
==
0
)
{
String
url
=
"http://localhost:8080/user/offline/callback/url"
;
//default url
JiveGlobals
.
setProperty
(
code
,
url
);
}
// register with interceptor manager
// register with interceptor manager
interceptorManager
.
addInterceptor
(
this
);
interceptorManager
.
addInterceptor
(
this
);
...
@@ -62,6 +60,16 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
...
@@ -62,6 +60,16 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
}
}
}
}
private
String
getProperty
(
String
code
,
String
defaultSetValue
)
{
String
value
=
JiveGlobals
.
getProperty
(
code
,
null
);
if
(
value
==
null
||
value
.
length
()
==
0
)
{
JiveGlobals
.
setProperty
(
code
,
defaultSetValue
);
value
=
defaultSetValue
;
}
return
value
;
}
public
void
destroyPlugin
()
{
public
void
destroyPlugin
()
{
// unregister with interceptor manager
// unregister with interceptor manager
interceptorManager
.
removeInterceptor
(
this
);
interceptorManager
.
removeInterceptor
(
this
);
...
@@ -97,6 +105,7 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
...
@@ -97,6 +105,7 @@ public class CallbackOnOffline implements Plugin, PacketInterceptor {
JID
from
=
packet
.
getFrom
();
JID
from
=
packet
.
getFrom
();
WebTarget
target
=
client
.
target
(
url
)
WebTarget
target
=
client
.
target
(
url
)
.
queryParam
(
"token"
,
token
)
.
queryParam
(
"from"
,
from
.
toBareJID
())
.
queryParam
(
"from"
,
from
.
toBareJID
())
.
queryParam
(
"to"
,
to
.
toBareJID
());
.
queryParam
(
"to"
,
to
.
toBareJID
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment