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
12b4559b
Commit
12b4559b
authored
Dec 12, 2016
by
Dave Cridland
Committed by
GitHub
Dec 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #669 from surevine/muc-ext
OF-1213 Add extension points to MUC
parents
b89a1357
f22c928f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
11 deletions
+77
-11
MultiUserChatService.java
...a/org/jivesoftware/openfire/muc/MultiUserChatService.java
+34
-0
MultiUserChatServiceImpl.java
...vesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
+43
-11
No files found.
src/java/org/jivesoftware/openfire/muc/MultiUserChatService.java
View file @
12b4559b
...
...
@@ -20,6 +20,7 @@
package
org
.
jivesoftware
.
openfire
.
muc
;
import
org.jivesoftware.openfire.handler.IQHandler
;
import
org.xmpp.component.Component
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
...
...
@@ -398,4 +399,37 @@ public interface MultiUserChatService extends Component {
* @return true if the MUC service is hidden and externally managed.
*/
boolean
isHidden
();
/**
* Add a IQHandler to MUC rooms and services. If the IQHandler only supports one or
* other, it should quietly ignore it.
*/
void
addIQHandler
(
IQHandler
handler
);
void
removeIQHandler
(
IQHandler
handler
);
/**
* Adds an extra Disco feature to the list of features returned for the conference service.
* @param feature Feature to add.
*/
void
addExtraFeature
(
String
feature
);
/**
* Removes an extra Disco feature from the list of features returned for the conference service.
* @param feature Feature to remove.
*/
void
removeExtraFeature
(
String
feature
);
/**
* Adds an extra Disco identity to the list of identities returned for the conference service.
* @param category Category for identity. e.g. conference
* @param name Descriptive name for identity. e.g. Public Chatrooms
* @param type Type for identity. e.g. text
*/
void
addExtraIdentity
(
String
category
,
String
name
,
String
type
);
/**
* Removes an extra Disco identity from the list of identities returned for the conference service.
* @param name Name of identity to remove.
*/
void
removeExtraIdentity
(
String
name
);
}
\ No newline at end of file
src/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
View file @
12b4559b
...
...
@@ -20,17 +20,7 @@
package
org
.
jivesoftware
.
openfire
.
muc
.
spi
;
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.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
...
...
@@ -45,6 +35,7 @@ import org.jivesoftware.openfire.PacketRouter;
import
org.jivesoftware.openfire.RoutingTable
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServerListener
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
import
org.jivesoftware.openfire.cluster.ClusterManager
;
import
org.jivesoftware.openfire.disco.DiscoInfoProvider
;
import
org.jivesoftware.openfire.disco.DiscoItem
;
...
...
@@ -55,6 +46,7 @@ import org.jivesoftware.openfire.event.GroupEventDispatcher;
import
org.jivesoftware.openfire.group.ConcurrentGroupList
;
import
org.jivesoftware.openfire.group.GroupAwareList
;
import
org.jivesoftware.openfire.group.GroupJID
;
import
org.jivesoftware.openfire.handler.IQHandler
;
import
org.jivesoftware.openfire.muc.HistoryStrategy
;
import
org.jivesoftware.openfire.muc.MUCEventDelegate
;
import
org.jivesoftware.openfire.muc.MUCEventDispatcher
;
...
...
@@ -168,6 +160,11 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
*/
private
IQMUCSearchHandler
searchHandler
=
null
;
/**
* Plugin (etc) provided IQ Handlers for MUC:
*/
private
Map
<
String
,
IQHandler
>
iqHandlers
=
null
;
/**
* The total time all agents took to chat *
*/
...
...
@@ -293,6 +290,23 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
historyStrategy
=
new
HistoryStrategy
(
null
);
}
@Override
public
void
addIQHandler
(
IQHandler
iqHandler
)
{
if
(
this
.
iqHandlers
==
null
)
{
this
.
iqHandlers
=
new
HashMap
<>();
}
this
.
iqHandlers
.
put
(
iqHandler
.
getInfo
().
getNamespace
(),
iqHandler
);
}
@Override
public
void
removeIQHandler
(
IQHandler
iqHandler
)
{
if
(
this
.
iqHandlers
!=
null
)
{
if
(
iqHandler
==
this
.
iqHandlers
.
get
(
iqHandler
.
getInfo
().
getNamespace
()))
{
this
.
iqHandlers
.
remove
(
iqHandler
.
getInfo
().
getNamespace
());
}
}
}
@Override
public
String
getDescription
()
{
return
chatDescription
;
...
...
@@ -402,6 +416,21 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
router
.
route
(
IQ
.
createResultIQ
(
iq
)
);
}
else
{
IQHandler
h
=
this
.
iqHandlers
.
get
(
namespace
);
if
(
h
!=
null
)
{
try
{
IQ
reply
=
h
.
handleIQ
(
iq
);
if
(
reply
!=
null
)
{
router
.
route
(
reply
);
}
}
catch
(
UnauthorizedException
e
)
{
IQ
reply
=
IQ
.
createResultIQ
(
iq
);
reply
.
setType
(
IQ
.
Type
.
error
);
reply
.
setError
(
PacketError
.
Condition
.
service_unavailable
);
router
.
route
(
reply
);
}
return
true
;
}
return
false
;
}
return
true
;
...
...
@@ -1528,6 +1557,9 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
else
{
features
.
add
(
"muc_temporary"
);
}
if
(!
extraDiscoFeatures
.
isEmpty
())
{
features
.
addAll
(
extraDiscoFeatures
);
}
}
}
return
features
.
iterator
();
...
...
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