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
dff3bb1b
Commit
dff3bb1b
authored
Jan 08, 2016
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #498 from tevans/OF-821
OF-821: Prevent duplicates for MUC item query
parents
1c054a2e
23cc2a25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
13 deletions
+47
-13
DiscoItem.java
src/java/org/jivesoftware/openfire/disco/DiscoItem.java
+34
-10
MultiUserChatServiceImpl.java
...vesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
+13
-3
No files found.
src/java/org/jivesoftware/openfire/disco/DiscoItem.java
View file @
dff3bb1b
...
...
@@ -42,6 +42,8 @@ public class DiscoItem implements Result {
private
final
String
node
;
private
final
String
action
;
private
final
Element
element
;
private
volatile
String
uid
=
null
;
public
DiscoItem
(
Element
element
)
{
this
.
element
=
element
;
...
...
@@ -169,17 +171,39 @@ public class DiscoItem implements Result {
*/
@Override
public
String
getUID
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
jid
.
toString
());
if
(
name
!=
null
)
{
sb
.
append
(
name
);
}
if
(
node
!=
null
)
{
sb
.
append
(
node
);
}
if
(
action
!=
null
)
{
sb
.
append
(
action
);
if
(
uid
==
null
)
{
synchronized
(
this
)
{
if
(
uid
==
null
)
{
final
StringBuilder
sb
=
new
StringBuilder
(
jid
.
toString
());
if
(
name
!=
null
)
{
sb
.
append
(
name
);
}
if
(
node
!=
null
)
{
sb
.
append
(
node
);
}
if
(
action
!=
null
)
{
sb
.
append
(
action
);
}
uid
=
sb
.
toString
();
}
}
}
return
uid
;
}
@Override
public
int
hashCode
()
{
return
getUID
().
hashCode
();
}
return
sb
.
toString
();
@Override
public
boolean
equals
(
Object
obj
)
{
return
obj
instanceof
DiscoItem
&&
getUID
().
equals
(((
DiscoItem
)
obj
).
getUID
());
}
@Override
public
String
toString
()
{
return
element
.
asXML
();
}
}
\ No newline at end of file
src/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
View file @
dff3bb1b
...
...
@@ -24,12 +24,18 @@ import java.util.ArrayList;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Queue
;
import
java.util.Set
;
import
java.util.TimerTask
;
import
java.util.concurrent.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicLong
;
...
...
@@ -60,7 +66,11 @@ import org.jivesoftware.openfire.muc.cluster.GetNumberConnectedUsers;
import
org.jivesoftware.openfire.muc.cluster.OccupantAddedEvent
;
import
org.jivesoftware.openfire.muc.cluster.RoomAvailableEvent
;
import
org.jivesoftware.openfire.muc.cluster.RoomRemovedEvent
;
import
org.jivesoftware.util.*
;
import
org.jivesoftware.util.JiveGlobals
;
import
org.jivesoftware.util.JiveProperties
;
import
org.jivesoftware.util.LocaleUtils
;
import
org.jivesoftware.util.TaskEngine
;
import
org.jivesoftware.util.XMPPDateTimeFormat
;
import
org.jivesoftware.util.cache.CacheFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -1636,7 +1646,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
if
(!
isServiceEnabled
())
{
return
null
;
}
List
<
DiscoItem
>
answer
=
new
ArrayLis
t
<>();
Set
<
DiscoItem
>
answer
=
new
HashSe
t
<>();
if
(
name
==
null
&&
node
==
null
)
{
// Answer all the public rooms as items
...
...
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