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
9c904ce5
Commit
9c904ce5
authored
Feb 02, 2015
by
Christian Schudt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-874 disco#items request SHOULD return connected or available resources
parent
9c69db39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
SessionManager.java
src/java/org/jivesoftware/openfire/SessionManager.java
+54
-1
XMPPServer.java
src/java/org/jivesoftware/openfire/XMPPServer.java
+2
-1
No files found.
src/java/org/jivesoftware/openfire/SessionManager.java
View file @
9c904ce5
...
...
@@ -22,6 +22,7 @@ package org.jivesoftware.openfire;
import
java.net.InetAddress
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashSet
;
...
...
@@ -32,6 +33,7 @@ import java.util.Set;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.locks.Lock
;
import
org.dom4j.Element
;
import
org.jivesoftware.openfire.audit.AuditStreamIDFactory
;
import
org.jivesoftware.openfire.auth.AuthToken
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
...
...
@@ -39,6 +41,11 @@ import org.jivesoftware.openfire.cluster.ClusterEventListener;
import
org.jivesoftware.openfire.cluster.ClusterManager
;
import
org.jivesoftware.openfire.component.InternalComponentManager
;
import
org.jivesoftware.openfire.container.BasicModule
;
import
org.jivesoftware.openfire.disco.DiscoInfoProvider
;
import
org.jivesoftware.openfire.disco.DiscoItem
;
import
org.jivesoftware.openfire.disco.DiscoItemsProvider
;
import
org.jivesoftware.openfire.disco.DiscoServerItem
;
import
org.jivesoftware.openfire.disco.ServerItemsProvider
;
import
org.jivesoftware.openfire.event.SessionEventDispatcher
;
import
org.jivesoftware.openfire.http.HttpConnection
;
import
org.jivesoftware.openfire.http.HttpSession
;
...
...
@@ -60,12 +67,15 @@ import org.jivesoftware.openfire.session.RemoteSessionLocator;
import
org.jivesoftware.openfire.session.Session
;
import
org.jivesoftware.openfire.spi.BasicStreamIDFactory
;
import
org.jivesoftware.openfire.user.UserManager
;
import
org.jivesoftware.openfire.user.UserNotFoundException
;
import
org.jivesoftware.util.JiveGlobals
;
import
org.jivesoftware.util.LocaleUtils
;
import
org.jivesoftware.util.Log
;
import
org.jivesoftware.util.cache.Cache
;
import
org.jivesoftware.util.cache.CacheFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.xmpp.forms.DataForm
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Packet
;
...
...
@@ -78,7 +88,7 @@ import org.xmpp.packet.Presence;
*
* @author Derek DeMoro
*/
public
class
SessionManager
extends
BasicModule
implements
ClusterEventListener
{
public
class
SessionManager
extends
BasicModule
implements
ClusterEventListener
,
ServerItemsProvider
,
DiscoInfoProvider
,
DiscoItemsProvider
{
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
SessionManager
.
class
);
...
...
@@ -1162,6 +1172,48 @@ public class SessionManager extends BasicModule implements ClusterEventListener
JiveGlobals
.
setProperty
(
"xmpp.session.conflict-limit"
,
Integer
.
toString
(
conflictLimit
));
}
@Override
public
Iterator
<
DiscoServerItem
>
getItems
()
{
return
Arrays
.
asList
(
new
DiscoServerItem
(
serverAddress
,
null
,
null
,
null
,
this
,
this
)).
iterator
();
}
@Override
public
Iterator
<
Element
>
getIdentities
(
String
name
,
String
node
,
JID
senderJID
)
{
return
Collections
.
emptyIterator
();
}
@Override
public
Iterator
<
String
>
getFeatures
(
String
name
,
String
node
,
JID
senderJID
)
{
return
Collections
.
emptyIterator
();
}
@Override
public
DataForm
getExtendedInfo
(
String
name
,
String
node
,
JID
senderJID
)
{
return
null
;
}
@Override
public
boolean
hasInfo
(
String
name
,
String
node
,
JID
senderJID
)
{
return
false
;
}
@Override
public
Iterator
<
DiscoItem
>
getItems
(
String
name
,
String
node
,
JID
senderJID
)
{
try
{
// If the requesting entity is the user itself or the sender or the requesting entity can probe the presence of the user.
if
(
server
.
getUserManager
().
isRegisteredUser
(
senderJID
)
&&
name
.
equals
(
senderJID
.
getNode
())
||
server
.
getPresenceManager
().
canProbePresence
(
senderJID
,
name
))
{
Collection
<
DiscoItem
>
discoItems
=
new
ArrayList
<
DiscoItem
>();
for
(
ClientSession
clientSession
:
getSessions
(
name
))
{
discoItems
.
add
(
new
DiscoItem
(
clientSession
.
getAddress
(),
null
,
null
,
null
));
}
return
discoItems
.
iterator
();
}
return
Collections
.
emptyIterator
();
}
catch
(
UserNotFoundException
e
)
{
return
Collections
.
emptyIterator
();
}
}
private
class
ClientSessionListener
implements
ConnectionCloseListener
{
/**
* Handle a session that just closed.
...
...
@@ -1320,6 +1372,7 @@ public class SessionManager extends BasicModule implements ClusterEventListener
sessionInfoCache
=
CacheFactory
.
createCache
(
C2S_INFO_CACHE_NAME
);
// Listen to cluster events
ClusterManager
.
addListener
(
this
);
server
.
getIQDiscoItemsHandler
().
addServerItemsProvider
(
this
);
}
...
...
src/java/org/jivesoftware/openfire/XMPPServer.java
View file @
9c904ce5
...
...
@@ -540,7 +540,6 @@ public class XMPPServer {
loadModule
(
PrivateStorage
.
class
.
getName
());
// Load core modules
loadModule
(
PresenceManagerImpl
.
class
.
getName
());
loadModule
(
SessionManager
.
class
.
getName
());
loadModule
(
PacketRouterImpl
.
class
.
getName
());
loadModule
(
IQRouter
.
class
.
getName
());
loadModule
(
MessageRouter
.
class
.
getName
());
...
...
@@ -580,6 +579,8 @@ public class XMPPServer {
loadModule
(
PubSubModule
.
class
.
getName
());
loadModule
(
IQDiscoInfoHandler
.
class
.
getName
());
loadModule
(
IQDiscoItemsHandler
.
class
.
getName
());
// SessionManager registers to IQDiscoItemsHandler, therefore load it after it.
loadModule
(
SessionManager
.
class
.
getName
());
loadModule
(
UpdateManager
.
class
.
getName
());
loadModule
(
FlashCrossDomainHandler
.
class
.
getName
());
loadModule
(
InternalComponentManager
.
class
.
getName
());
...
...
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