Commit d7eade45 authored by daryl herzmann's avatar daryl herzmann

Merge pull request #72 from Redor/master

MUC Service Plugin update to 0.2.2
parents 5110ec0f 72898bc7
......@@ -44,6 +44,11 @@
MUC Service Plugin Changelog
</h1>
<p><b>0.2.2</b> -- 09.17.2014</p>
<ul>
<li>Room user roles can now be added and removed individually</li>
</ul>
<p><b>0.2.1</b> -- 08.09.2014</p>
<ul>
<li>Creation and modification dates, are now optional</li>
......
......@@ -5,7 +5,7 @@
<name>MUC Service</name>
<description>MUC administration over REST Interface</description>
<author>Roman Soldatow</author>
<version>0.2.1</version>
<date>08.09.2014</date>
<version>0.2.2</version>
<date>09.17.2014</date>
<minServerVersion>3.9.1</minServerVersion>
</plugin>
......@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>MUC Service Plugin</title>
<title>MUC Service Plugin Readme</title>
<style type="text/css">
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
audio,canvas,video{display:inline-block}
......@@ -1224,17 +1224,84 @@ body.pdf{font-family:"DejaVu Sans"}body.pdf code,body.pdf pre{font-family:"DejaV
</style>
</head>
<body><div class="container"><h1 id="muc-service-plugin">MUC Service Plugin</h1>
<body><div class="container"><h1 id="muc-service-plugin-readme">MUC Service Plugin Readme</h1>
<p>MUC Service is a plugin to manage the chat rooms over the REST/HTTP interface. <br>
It is possible to get a XML based overview over all or filtered chat rooms and also to Create / Update / Delete chat rooms and there user roles.</p>
<hr>
<p>MUC Service is a plugin to manage the chat rooms over the REST/HTTP interface. <br>
It is possible to get a XML based overview over all or filtered chat rooms and also to Create / Update / Delete chat rooms.</p>
<p><div class="toc"><div class="toc">
<ul>
<li><a href="#muc-service-plugin-readme">MUC Service Plugin Readme</a><ul>
<li><a href="#installation">Installation</a></li>
<li><a href="#explanation-of-rest">Explanation of REST</a></li>
<li><a href="#basic-http-authentication">Basic HTTP Authentication</a></li>
<li><a href="#data-types">Data types</a><ul>
<li><a href="#chatroom">Chatroom</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#chat-room-related-rest-endpoints">Chat room related REST Endpoints</a><ul>
<li><a href="#get-mucservicechatrooms">GET /mucservice/chatrooms</a><ul>
<li><a href="#possible-parameters">Possible parameters</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</li>
<li><a href="#get-mucservicechatroomsroomname">GET /mucservice/chatrooms/{roomName}</a><ul>
<li><a href="#possible-parameters-1">Possible parameters</a></li>
<li><a href="#examples-1">Examples</a></li>
</ul>
</li>
<li><a href="#get-mucservicechatroomsroomnameparticipants">GET /mucservice/chatrooms/{roomName}/participants</a><ul>
<li><a href="#possible-parameters-2">Possible parameters</a></li>
<li><a href="#examples-2">Examples</a></li>
</ul>
</li>
<li><a href="#post-mucservicechatrooms">POST /mucservice/chatrooms</a><ul>
<li><a href="#possible-parameters-3">Possible parameters</a></li>
<li><a href="#examples-3">Examples</a></li>
</ul>
</li>
<li><a href="#delete-mucservicechatroomsroomname">DELETE /mucservice/chatrooms/{roomName}</a><ul>
<li><a href="#possible-parameters-4">Possible parameters</a></li>
<li><a href="#examples-4">Examples</a></li>
</ul>
</li>
<li><a href="#put-mucservicechatroomsroomname">PUT /mucservice/chatrooms/{roomName}</a><ul>
<li><a href="#possible-parameters-5">Possible parameters</a></li>
<li><a href="#examples-5">Examples</a></li>
</ul>
</li>
<li><a href="#post-mucservicechatroomsroomnamerolesjid">POST /mucservice/chatrooms/{roomName}/{roles}/{jid}</a><ul>
<li><a href="#possible-parameters-6">Possible parameters</a></li>
<li><a href="#examples-6">Examples</a></li>
</ul>
</li>
<li><a href="#delete-mucservicechatroomsroomnamerolesjid">DELETE /mucservice/chatrooms/{roomName}/{roles}/{jid}</a><ul>
<li><a href="#possible-parameters-7">Possible parameters</a></li>
<li><a href="#examples-7">Examples</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</p>
<h2 id="installation">Installation</h2>
<p>Copy the file, “mucservice.jar” into the plugins directory of your Openfire installation. The plugin will then be automatically deployed. </p>
<h2 id="explanation-of-rest">Explanation of REST</h2>
<p>To provide a standard way of accessing the data the MUC Service <br>
is using REST.</p>
<p>To provide a standard way of accessing the data the MUC Service is using REST.</p>
<table>
<thead>
......@@ -1262,9 +1329,9 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h2 id="chat-room-related-rest-endpoints">Chat room related REST Endpoints</h2>
<h3 id="basic-http-authentication">Basic HTTP Authentication</h3>
<h2 id="basic-http-authentication">Basic HTTP Authentication</h2>
<p>All REST Endpoint are secured by <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">Basic HTTP Authentication.</a></p>
......@@ -1278,6 +1345,144 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
c.addFilter(new HTTPBasicAuthFilter(user, password)); <br>
</code></p>
<h2 id="data-types">Data types</h2>
<h3 id="chatroom">Chatroom</h3>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>roomName</td>
<td>No</td>
<td>The name/id of the room. Can only contains lowercase and alphanumeric characters.</td>
</tr>
<tr>
<td>naturalName</td>
<td>No</td>
<td>Also the name of the room, but can contains non alphanumeric characters. It’s mainly used for users while discovering rooms hosted by the Multi-User Chat service.</td>
</tr>
<tr>
<td>description</td>
<td>No</td>
<td>Description text of the room.</td>
</tr>
<tr>
<td>password</td>
<td>Yes</td>
<td>The password that the user must provide to enter the room</td>
</tr>
<tr>
<td>creationDate</td>
<td>Yes</td>
<td>The date when the room was created. Will be automatically set by creation. Example: 2014-07-10T09:49:12.411+02:00</td>
</tr>
<tr>
<td>modificationDate</td>
<td>Yes</td>
<td>The last date when the room’s configuration was modified. If the room’s configuration was never modified then the initial value will be the same as the creation date. Will be automatically set by update. Example: 2014-07-10T09:49:12.411+02:00</td>
</tr>
<tr>
<td>maxUsers</td>
<td>Yes</td>
<td>the maximum number of occupants that can be simultaneously in the room. 0 means unlimited number of occupants.</td>
</tr>
<tr>
<td>persistent</td>
<td>Yes</td>
<td>Can be “true” or “false”. Persistent rooms are saved to the database to make their configurations persistent together with the affiliation of the users. Otherwise the room will be destroyed if the last occupant leave the room.</td>
</tr>
<tr>
<td>publicRoom</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if the room is searchable and visible through service discovery.</td>
</tr>
<tr>
<td>registrationEnabled</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if users are allowed to register with the room. By default, room registration is enabled.</td>
</tr>
<tr>
<td>canAnyoneDiscoverJID</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if every presence packet will include the JID of every occupant.</td>
</tr>
<tr>
<td>canOccupantsChangeSubject</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if participants are allowed to change the room’s subject.</td>
</tr>
<tr>
<td>canOccupantsInvite</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if occupants can invite other users to the room. If the room does not require an invitation to enter (i.e. is not members-only) then any occupant can send invitations. On the other hand, if the room is members-only and occupants cannot send invitation then only the room owners and admins are allowed to send invitations.</td>
</tr>
<tr>
<td>canChangeNickname</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if room occupants are allowed to change their nicknames in the room. By default, occupants are allowed to change their nicknames.</td>
</tr>
<tr>
<td>logEnabled</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if the room’s conversation is being logged. If logging is activated the room conversation will be saved to the database every couple of minutes. The saving frequency is the same for all the rooms and can be configured by changing the property “xmpp.muc.tasks.log.timeout”.</td>
</tr>
<tr>
<td>loginRestrictedToNickname</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if registered users can only join the room using their registered nickname. By default, registered users can join the room using any nickname.</td>
</tr>
<tr>
<td>membersOnly</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if the room requires an invitation to enter. That is if the room is members-only.</td>
</tr>
<tr>
<td>moderated</td>
<td>Yes</td>
<td>Can be “true” or “false”. True if the room in which only those with “voice” may send messages to all occupants.</td>
</tr>
<tr>
<td>broadcastPresenceRoles</td>
<td>Yes</td>
<td>The list of roles of which presence will be broadcasted to the rest of the occupants.</td>
</tr>
<tr>
<td>owners</td>
<td>Yes</td>
<td>A collection with the current list of owners. The collection contains the bareJID of the users with owner affiliation.</td>
</tr>
<tr>
<td>admins</td>
<td>Yes</td>
<td>A collection with the current list of admins. The collection contains the bareJID of the users with admin affiliation.</td>
</tr>
<tr>
<td>members</td>
<td>Yes</td>
<td>A collection with the current list of room members. The collection contains the bareJID of the users with member affiliation. If the room is not members-only then the list will contain the users that registered with the room and therefore they may have reserved a nickname.</td>
</tr>
<tr>
<td>outcasts</td>
<td>Yes</td>
<td>A collection with the current list of outcast users. An outcast user is not allowed to join the room again. The collection contains the bareJID of the users with outcast affiliation.</td>
</tr>
</tbody></table>
<h1 id="chat-room-related-rest-endpoints">Chat room related REST Endpoints</h1>
<h2 id="get-mucservicechatrooms">GET /mucservice/chatrooms</h2>
<p>Endpoint to get all chat rooms</p>
......@@ -1285,6 +1490,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> Chatrooms</p>
<h3 id="possible-parameters">Possible parameters</h3>
<table>
......@@ -1317,6 +1524,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples">Examples</h3>
<p><strong>Header</strong>: Authorization: Basic YWRtaW46MTIzNDU=</p>
......@@ -1329,6 +1538,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>GET</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms?search=test">http://example.org:9090/plugins/mucservice/chatrooms?search=test</a></p>
<h2 id="get-mucservicechatroomsroomname">GET /mucservice/chatrooms<span>/{roomName}</span></h2>
<p>Endpoint to get information over specific chat room</p>
......@@ -1336,6 +1547,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> Chatroom</p>
<h3 id="possible-parameters-1">Possible parameters</h3>
<table>
......@@ -1362,6 +1575,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples-1">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
......@@ -1370,6 +1585,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>GET</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/test?servicename=privateconf">http://example.org:9090/plugins/mucservice/chatrooms/test?servicename=privateconf</a></p>
<h2 id="get-mucservicechatroomsroomnameparticipants">GET /mucservice/chatrooms/{roomName}/participants</h2>
<p>Endpoint to get all participants with a role of specified room.</p>
......@@ -1377,6 +1594,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> Participants</p>
<h3 id="possible-parameters-2">Possible parameters</h3>
<table>
......@@ -1403,18 +1622,24 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples-2">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
<p><strong>GET</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/room1/participants">http://example.org:9090/plugins/mucservice/chatrooms/room1/participants</a></p>
<h2 id="post-mucservicechatrooms">POST /mucservice/chatrooms</h2>
<p>Endpoint to create a new chat room.</p>
<p><strong>Payload:</strong> Chatroom <br>
<strong>Return value:</strong> void</p>
<strong>Return value:</strong> HTTP status 201 (Created)</p>
<h3 id="possible-parameters-3">Possible parameters</h3>
......@@ -1436,6 +1661,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples-3">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
......@@ -1444,42 +1671,68 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms">http://example.org:9090/plugins/mucservice/chatrooms</a></p>
<p><strong>Payload:</strong></p>
<p><strong>Payload Example 1 (required parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="pln"> </span><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">moderator</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">participant</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">visitor</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;/broadcastPresenceRoles&gt;</span><span class="pln">
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-1</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<p><strong>Payload Example 2 (available parameters):</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-2</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;modificationDate&gt;</span><span class="pln">2014-09-12T15:35:54.702+02:00</span><span class="tag">&lt;/modificationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;canAnyoneDiscoverJID&gt;</span><span class="pln">false</span><span class="tag">&lt;/canAnyoneDiscoverJID&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsChangeSubject&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsChangeSubject&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsInvite&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsInvite&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;logEnabled&gt;</span><span class="pln">true</span><span class="tag">&lt;/logEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;loginRestrictedToNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/loginRestrictedToNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;membersOnly&gt;</span><span class="pln">false</span><span class="tag">&lt;/membersOnly&gt;</span><span class="pln">
</span><span class="tag">&lt;moderated&gt;</span><span class="pln">false</span><span class="tag">&lt;/moderated&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-1</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">moderator</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">participant</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRole&gt;</span><span class="pln">visitor</span><span class="tag">&lt;/broadcastPresenceRole&gt;</span><span class="pln">
</span><span class="tag">&lt;/broadcastPresenceRoles&gt;</span><span class="pln">
</span><span class="tag">&lt;owners&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">admin@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">owner@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;/owners&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">test</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre><div class="se-section-delimiter"></div>
</span><span class="tag">&lt;admins&gt;</span><span class="pln">
</span><span class="tag">&lt;admin&gt;</span><span class="pln">admin@localhost</span><span class="tag">&lt;/admin&gt;</span><span class="pln">
</span><span class="tag">&lt;/admins&gt;</span><span class="pln">
</span><span class="tag">&lt;members&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member2@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member1@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;/members&gt;</span><span class="pln">
</span><span class="tag">&lt;outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;outcast&gt;</span><span class="pln">outcast1@localhost</span><span class="tag">&lt;/outcast&gt;</span><span class="pln">
</span><span class="tag">&lt;/outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<h2 id="delete-mucservicechatroomsroomname">DELETE /mucservice/chatrooms/{roomName}</h2>
<p>Endpoint to delete a chat room.</p>
<p><strong>Payload:</strong> void <br>
<strong>Return value:</strong> void</p>
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> HTTP status 200 (OK)</p>
<h3 id="possible-parameters-4">Possible parameters</h3>
......@@ -1507,6 +1760,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples-4">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
......@@ -1515,12 +1770,16 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/testroom?servicename=privateconf">http://example.org:9090/plugins/mucservice/chatrooms/testroom?servicename=privateconf</a></p>
<h2 id="put-mucservicechatroomsroomname">PUT /mucservice/chatrooms/{roomName}</h2>
<p>Endpoint to update a chat room.</p>
<p><strong>Payload:</strong> Chatroom <br>
<strong>Return value:</strong> void</p>
<strong>Return value:</strong> HTTP status 200 (OK)</p>
<h3 id="possible-parameters-5">Possible parameters</h3>
......@@ -1548,6 +1807,8 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
</tbody></table>
<h3 id="examples-5">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
......@@ -1558,37 +1819,214 @@ It is possible to get a XML based overview over all or filtered chat rooms and a
<p><strong>Payload:</strong></p>
<pre class="prettyprint prettyprinted"><code><span class="pln"> </span><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
<pre class="prettyprint prettyprinted"><code><span class="tag">&lt;chatRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-2</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room edit</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">test</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;modificationDate&gt;</span><span class="pln">2014-09-12T14:20:56.286+02:00</span><span class="tag">&lt;/modificationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;canAnyoneDiscoverJID&gt;</span><span class="pln">false</span><span class="tag">&lt;/canAnyoneDiscoverJID&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsChangeSubject&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsChangeSubject&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsInvite&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsInvite&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;logEnabled&gt;</span><span class="pln">true</span><span class="tag">&lt;/logEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;loginRestrictedToNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/loginRestrictedToNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;membersOnly&gt;</span><span class="pln">false</span><span class="tag">&lt;/membersOnly&gt;</span><span class="pln">
</span><span class="tag">&lt;moderated&gt;</span><span class="pln">false</span><span class="tag">&lt;/moderated&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles/&gt;</span><span class="pln">
</span><span class="tag">&lt;owners&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">owner@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;/owners&gt;</span><span class="pln">
</span><span class="tag">&lt;admins&gt;</span><span class="pln">
</span><span class="tag">&lt;admin&gt;</span><span class="pln">admin@localhost</span><span class="tag">&lt;/admin&gt;</span><span class="pln">
</span><span class="tag">&lt;/admins&gt;</span><span class="pln">
</span><span class="tag">&lt;broadcastPresenceRoles/&gt;</span><span class="pln">
</span><span class="tag">&lt;members&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member1@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member2@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;member&gt;</span><span class="pln">member1@localhost</span><span class="tag">&lt;/member&gt;</span><span class="pln">
</span><span class="tag">&lt;/members&gt;</span><span class="pln">
</span><span class="tag">&lt;outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;outcast&gt;</span><span class="pln">outcast1@localhost</span><span class="tag">&lt;/outcast&gt;</span><span class="pln">
</span><span class="tag">&lt;/outcasts&gt;</span><span class="pln">
</span><span class="tag">&lt;owners&gt;</span><span class="pln">
</span><span class="tag">&lt;owner&gt;</span><span class="pln">owner@localhost</span><span class="tag">&lt;/owner&gt;</span><span class="pln">
</span><span class="tag">&lt;/owners&gt;</span><span class="pln">
</span><span class="tag">&lt;canAnyoneDiscoverJID&gt;</span><span class="pln">false</span><span class="tag">&lt;/canAnyoneDiscoverJID&gt;</span><span class="pln">
</span><span class="tag">&lt;canChangeNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/canChangeNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsChangeSubject&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsChangeSubject&gt;</span><span class="pln">
</span><span class="tag">&lt;canOccupantsInvite&gt;</span><span class="pln">false</span><span class="tag">&lt;/canOccupantsInvite&gt;</span><span class="pln">
</span><span class="tag">&lt;creationDate&gt;</span><span class="pln">2014-02-12T15:52:37.592+01:00</span><span class="tag">&lt;/creationDate&gt;</span><span class="pln">
</span><span class="tag">&lt;description&gt;</span><span class="pln">Global Chat Room edit</span><span class="tag">&lt;/description&gt;</span><span class="pln">
</span><span class="tag">&lt;logEnabled&gt;</span><span class="pln">true</span><span class="tag">&lt;/logEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;loginRestrictedToNickname&gt;</span><span class="pln">false</span><span class="tag">&lt;/loginRestrictedToNickname&gt;</span><span class="pln">
</span><span class="tag">&lt;maxUsers&gt;</span><span class="pln">0</span><span class="tag">&lt;/maxUsers&gt;</span><span class="pln">
</span><span class="tag">&lt;membersOnly&gt;</span><span class="pln">false</span><span class="tag">&lt;/membersOnly&gt;</span><span class="pln">
</span><span class="tag">&lt;moderated&gt;</span><span class="pln">false</span><span class="tag">&lt;/moderated&gt;</span><span class="pln">
</span><span class="tag">&lt;naturalName&gt;</span><span class="pln">global-2</span><span class="tag">&lt;/naturalName&gt;</span><span class="pln">
</span><span class="tag">&lt;password&gt;</span><span class="pln">test</span><span class="tag">&lt;/password&gt;</span><span class="pln">
</span><span class="tag">&lt;persistent&gt;</span><span class="pln">true</span><span class="tag">&lt;/persistent&gt;</span><span class="pln">
</span><span class="tag">&lt;publicRoom&gt;</span><span class="pln">true</span><span class="tag">&lt;/publicRoom&gt;</span><span class="pln">
</span><span class="tag">&lt;registrationEnabled&gt;</span><span class="pln">false</span><span class="tag">&lt;/registrationEnabled&gt;</span><span class="pln">
</span><span class="tag">&lt;roomName&gt;</span><span class="pln">global</span><span class="tag">&lt;/roomName&gt;</span><span class="pln">
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre></div></body>
</span><span class="tag">&lt;/chatRoom&gt;</span></code></pre>
<h2 id="post-mucservicechatroomsroomnamerolesjid">POST /mucservice/chatrooms/{roomName}/{roles}/{jid}</h2>
<p>Endpoint to add a new user role to a room.</p>
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> HTTP status 201 (Created)</p>
<h3 id="possible-parameters-6">Possible parameters</h3>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Parameter Type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody><tr>
<td>roomname</td>
<td>@Path</td>
<td>Exact room name</td>
<td></td>
</tr>
<tr>
<td>jid</td>
<td>@Path</td>
<td>JID of the owner (username@xmppDomain)</td>
<td></td>
</tr>
<tr>
<td>roles</td>
<td>@Path</td>
<td>Available roles: <br><strong>owners</strong> <br> <strong>admins</strong> <br> <strong>members</strong> <br> <strong>outcasts</strong></td>
<td></td>
</tr>
<tr>
<td>servicename</td>
<td>@QueryParam</td>
<td>The name of the Group Chat Service</td>
<td>conference</td>
</tr>
</tbody></table>
<h3 id="examples-6">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
<p><strong>Header:</strong> Content-Type application/xml</p>
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost</a></p>
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/admins/admin@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/admins/admin@localhost</a></p>
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/members/member@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/members/member@localhost</a></p>
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/outcasts/outcast@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/outcasts/outcast@localhost</a></p>
<p><strong>POST</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost?servicename=privateconf">http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost?servicename=privateconf</a></p>
<h2 id="delete-mucservicechatroomsroomnamerolesjid">DELETE /mucservice/chatrooms/{roomName}/{roles}/{jid}</h2>
<p>Endpoint to remove a room user role.</p>
<p><strong>Payload:</strong> none <br>
<strong>Return value:</strong> HTTP status 200 (OK)</p>
<h3 id="possible-parameters-7">Possible parameters</h3>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Parameter Type</th>
<th>Description</th>
<th>Default value</th>
</tr>
</thead>
<tbody><tr>
<td>roomname</td>
<td>@Path</td>
<td>Exact room name</td>
<td></td>
</tr>
<tr>
<td>jid</td>
<td>@Path</td>
<td>JID of the owner (username@xmppDomain)</td>
<td></td>
</tr>
<tr>
<td>roles</td>
<td>@Path</td>
<td>Available roles: <br><strong>owners</strong> <br> <strong>admins</strong> <br> <strong>members</strong> <br> <strong>outcasts</strong></td>
<td></td>
</tr>
<tr>
<td>servicename</td>
<td>@QueryParam</td>
<td>The name of the Group Chat Service</td>
<td>conference</td>
</tr>
</tbody></table>
<h3 id="examples-7">Examples</h3>
<p><strong>Header:</strong> Authorization: Basic YWRtaW46MTIzNDU=</p>
<p><strong>Header:</strong> Content-Type application/xml</p>
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost</a></p>
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/admins/admin@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/admins/admin@localhost</a></p>
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/members/member@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/members/member@localhost</a></p>
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/outcasts/outcast@localhost">http://example.org:9090/plugins/mucservice/chatrooms/global/outcasts/outcast@localhost</a></p>
<p><strong>DELETE</strong> <a href="http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost?servicename=privateconf">http://example.org:9090/plugins/mucservice/chatrooms/global/owners/owner@localhost?servicename=privateconf</a></p>
</div></body>
</html>
\ No newline at end of file
......@@ -6,8 +6,14 @@ import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name = "chatRoom")
@XmlType(propOrder = { "roomName", "naturalName", "description", "password", "subject", "creationDate",
"modificationDate", "maxUsers", "persistent", "publicRoom", "registrationEnabled", "canAnyoneDiscoverJID",
"canOccupantsChangeSubject", "canOccupantsInvite", "canChangeNickname", "logEnabled",
"loginRestrictedToNickname", "membersOnly", "moderated", "broadcastPresenceRoles", "owners", "admins",
"members", "outcasts" })
public class MUCRoomEntity {
private String roomName;
......
......@@ -18,6 +18,8 @@ import org.jivesoftware.openfire.muc.MUCRole;
import org.jivesoftware.openfire.muc.MUCRoom;
import org.jivesoftware.openfire.muc.NotAllowedException;
import org.jivesoftware.openfire.utils.MUCRoomUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;
/**
......@@ -25,6 +27,8 @@ import org.xmpp.packet.JID;
*/
public class MUCRoomController {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(MUCRoomController.class);
/** The Constant INSTANCE. */
public static final MUCRoomController INSTANCE = new MUCRoomController();
......@@ -106,7 +110,7 @@ public class MUCRoomController {
*/
public void deleteChatRoom(String roomName, String serviceName) throws MUCServiceException {
MUCRoom chatRoom = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName);
.getChatRoom(roomName.toLowerCase());
if (chatRoom != null) {
chatRoom.destroyRoom(null, null);
......@@ -221,8 +225,12 @@ public class MUCRoomController {
room.setMembersOnly(mucRoomEntity.isMembersOnly());
room.setModerated(mucRoomEntity.isModerated());
// Set broadcast presence roles
if (mucRoomEntity.getBroadcastPresenceRoles() != null) {
room.setRolesToBroadcastPresence(mucRoomEntity.getBroadcastPresenceRoles());
} else {
room.setRolesToBroadcastPresence(new ArrayList<String>());
}
// Set all roles
setRoles(room, mucRoomEntity);
......@@ -373,4 +381,134 @@ public class MUCRoomController {
}
}
}
/**
* Adds the admin.
*
* @param serviceName
* the service name
* @param roomName
* the room name
* @param jid
* the jid
* @throws MUCServiceException
* the MUC service exception
*/
public void addAdmin(String serviceName, String roomName, String jid) throws MUCServiceException {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName.toLowerCase());
try {
room.addAdmin(new JID(jid), room.getRole());
} catch (ForbiddenException e) {
LOG.error("Could not add admin", e);
throw new MUCServiceException("Could not add admin", jid, "ForbiddenException");
} catch (ConflictException e) {
LOG.error("Could not add admin", e);
throw new MUCServiceException("Could not add admin", jid, "ConflictException");
}
}
/**
* Adds the owner.
*
* @param serviceName
* the service name
* @param roomName
* the room name
* @param jid
* the jid
* @throws MUCServiceException
* the MUC service exception
*/
public void addOwner(String serviceName, String roomName, String jid) throws MUCServiceException {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName.toLowerCase());
try {
room.addOwner(new JID(jid), room.getRole());
} catch (ForbiddenException e) {
LOG.error("Could not add owner", e);
throw new MUCServiceException("Could not add owner", jid, "ForbiddenException");
}
}
/**
* Adds the member.
*
* @param serviceName
* the service name
* @param roomName
* the room name
* @param jid
* the jid
* @throws MUCServiceException
* the MUC service exception
*/
public void addMember(String serviceName, String roomName, String jid) throws MUCServiceException {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName.toLowerCase());
try {
room.addMember(new JID(jid), null, room.getRole());
} catch (ForbiddenException e) {
LOG.error("Could not add member", e);
throw new MUCServiceException("Could not add member", jid, "ForbiddenException");
} catch (ConflictException e) {
LOG.error("Could not add member", e);
throw new MUCServiceException("Could not add member", jid, "ConflictException");
}
}
/**
* Adds the outcast.
*
* @param serviceName
* the service name
* @param roomName
* the room name
* @param jid
* the jid
* @throws MUCServiceException
* the MUC service exception
*/
public void addOutcast(String serviceName, String roomName, String jid) throws MUCServiceException {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName.toLowerCase());
try {
room.addOutcast(new JID(jid), null, room.getRole());
} catch (NotAllowedException e) {
LOG.error("Could not add outcast", e);
throw new MUCServiceException("Could not add outcast", jid, "NotAllowedException");
} catch (ForbiddenException e) {
LOG.error("Could not add outcast", e);
throw new MUCServiceException("Could not add outcast", jid, "ForbiddenException");
} catch (ConflictException e) {
LOG.error("Could not add outcast", e);
throw new MUCServiceException("Could not add outcast", jid, "ConflictException");
}
}
/**
* Delete affiliation.
*
* @param serviceName
* the service name
* @param roomName
* the room name
* @param jid
* the jid
* @throws MUCServiceException
* the MUC service exception
*/
public void deleteAffiliation(String serviceName, String roomName, String jid) throws MUCServiceException {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceName)
.getChatRoom(roomName.toLowerCase());
try {
room.addNone(new JID(jid), room.getRole());
} catch (ForbiddenException e) {
LOG.error("Could not delete affiliation", e);
throw new MUCServiceException("Could not delete affiliation", jid, "ForbiddenException");
} catch (ConflictException e) {
LOG.error("Could not delete affiliation", e);
throw new MUCServiceException("Could not delete affiliation", jid, "ConflictException");
}
}
}
\ No newline at end of file
......@@ -7,6 +7,10 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import org.jivesoftware.admin.AuthCheckFilter;
import org.jivesoftware.openfire.service.MUCRoomAdminsService;
import org.jivesoftware.openfire.service.MUCRoomMembersService;
import org.jivesoftware.openfire.service.MUCRoomOutcastsService;
import org.jivesoftware.openfire.service.MUCRoomOwnersService;
import org.jivesoftware.openfire.service.MUCRoomService;
import com.sun.jersey.api.core.PackagesResourceConfig;
......@@ -46,6 +50,11 @@ public class JerseyWrapper extends ServletContainer {
prc.getProperties().put("com.sun.jersey.spi.container.ContainerRequestFilters",
"org.jivesoftware.openfire.plugin.servlet.AuthFilter");
prc.getClasses().add(MUCRoomService.class);
prc.getClasses().add(MUCRoomOwnersService.class);
prc.getClasses().add(MUCRoomAdminsService.class);
prc.getClasses().add(MUCRoomMembersService.class);
prc.getClasses().add(MUCRoomOutcastsService.class);
prc.getClasses().add(RESTExceptionMapper.class);
}
......
package org.jivesoftware.openfire.service;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.jivesoftware.openfire.exception.MUCServiceException;
import org.jivesoftware.openfire.plugin.MUCRoomController;
@Path("mucservice/chatrooms/{roomName}/admins")
public class MUCRoomAdminsService {
@POST
@Path("/{jid}")
public Response addMUCRoomAdmin(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("jid") String jid, @PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().addAdmin(serviceName, roomName, jid);
return Response.status(Status.CREATED).build();
}
@DELETE
@Path("/{jid}")
public Response deleteMUCRoomAdmin(@PathParam("jid") String jid,
@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, jid);
return Response.status(Status.OK).build();
}
}
package org.jivesoftware.openfire.service;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.jivesoftware.openfire.exception.MUCServiceException;
import org.jivesoftware.openfire.plugin.MUCRoomController;
@Path("mucservice/chatrooms/{roomName}/members")
public class MUCRoomMembersService {
@POST
@Path("/{jid}")
public Response addMUCRoomMember(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("jid") String jid, @PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().addMember(serviceName, roomName, jid);
return Response.status(Status.CREATED).build();
}
@DELETE
@Path("/{jid}")
public Response deleteMUCRoomMember(@PathParam("jid") String jid,
@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, jid);
return Response.status(Status.OK).build();
}
}
package org.jivesoftware.openfire.service;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.jivesoftware.openfire.exception.MUCServiceException;
import org.jivesoftware.openfire.plugin.MUCRoomController;
@Path("mucservice/chatrooms/{roomName}/outcasts")
public class MUCRoomOutcastsService {
@POST
@Path("/{jid}")
public Response addMUCRoomOutcast(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("jid") String jid, @PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().addOutcast(serviceName, roomName, jid);
return Response.status(Status.CREATED).build();
}
@DELETE
@Path("/{jid}")
public Response deleteMUCRoomOutcast(@PathParam("jid") String jid,
@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, jid);
return Response.status(Status.OK).build();
}
}
package org.jivesoftware.openfire.service;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.jivesoftware.openfire.exception.MUCServiceException;
import org.jivesoftware.openfire.plugin.MUCRoomController;
@Path("mucservice/chatrooms/{roomName}/owners")
public class MUCRoomOwnersService {
@POST
@Path("/{jid}")
public Response addMUCRoomOwner(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("jid") String jid, @PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().addOwner(serviceName, roomName, jid);
return Response.status(Status.CREATED).build();
}
@DELETE
@Path("/{jid}")
public Response deleteMUCRoomOwner(@PathParam("jid") String jid,
@DefaultValue("conference") @QueryParam("servicename") String serviceName,
@PathParam("roomName") String roomName) throws MUCServiceException {
MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, jid);
return Response.status(Status.OK).build();
}
}
......@@ -10,6 +10,8 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.jivesoftware.openfire.entity.MUCChannelType;
import org.jivesoftware.openfire.entity.MUCRoomEntities;
......@@ -39,30 +41,33 @@ public class MUCRoomService {
@DELETE
@Path("/{roomName}")
public void deleteMUCRoom(@PathParam("roomName") String roomName,
public Response deleteMUCRoom(@PathParam("roomName") String roomName,
@DefaultValue("conference") @QueryParam("servicename") String serviceName) throws MUCServiceException {
MUCRoomController.getInstance().deleteChatRoom(roomName, serviceName);
return Response.status(Status.OK).build();
}
@POST
public void createMUCRoom(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
public Response createMUCRoom(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
MUCRoomEntity mucRoomEntity) throws MUCServiceException {
MUCRoomController.getInstance().createChatRoom(serviceName, mucRoomEntity);
return Response.status(Status.CREATED).build();
}
@PUT
@Path("/{roomName}")
public void udpateMUCRoom(@PathParam("roomName") String roomName,
public Response udpateMUCRoom(@PathParam("roomName") String roomName,
@DefaultValue("conference") @QueryParam("servicename") String serviceName, MUCRoomEntity mucRoomEntity)
throws MUCServiceException {
MUCRoomController.getInstance().updateChatRoom(roomName, serviceName, mucRoomEntity);
return Response.status(Status.OK).build();
}
@GET
@Path("/{roomName}/participants")
@Produces(MediaType.APPLICATION_XML)
public ParticipantEntities getMUCRoomParticipants(@PathParam("roomName") String roomName,
@DefaultValue("conference") @QueryParam("servicename") String serviceName) throws MUCServiceException {
@DefaultValue("conference") @QueryParam("servicename") String serviceName) {
return MUCRoomController.getInstance().getRoomParticipants(roomName, serviceName);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment