Commit 82659e87 authored by JC Brand's avatar JC Brand

Add extra chat room commands: /nick, /mute and /voice.

Also document the available chat room commands.
parent 78ac525e
...@@ -2021,38 +2021,47 @@ ...@@ -2021,38 +2021,47 @@
var match = body.replace(/^\s*/, "").match(/^\/(.*?)(?: (.*))?$/) || [false], var match = body.replace(/^\s*/, "").match(/^\/(.*?)(?: (.*))?$/) || [false],
$chat_content; $chat_content;
switch (match[1]) { switch (match[1]) {
case 'msg': case 'ban':
// TODO: Private messages converse.connection.muc.ban(this.model.get('jid'), match[2]);
break; break;
case 'clear': case 'clear':
this.clearChatRoomMessages(); this.clearChatRoomMessages();
break; break;
case 'topic': case 'deop':
converse.connection.muc.setTopic(this.model.get('jid'), match[2]); converse.connection.muc.deop(this.model.get('jid'), match[2]);
break;
case 'help':
$chat_content = this.$el.find('.chat-content');
msgs = [
'<strong>/ban</strong>: ' +__('Ban user from room'),
'<strong>/clear</strong>: ' +__('Remove messages'),
'<strong>/help</strong>: ' +__('Show this menu'),
'<strong>/kick</strong>: ' +__('Kick user from room'),
'<strong>/me</strong>: ' +__('Write in 3rd person'),
'<strong>/mute</strong>: ' +__("Remove user's ability to post messages"),
'<strong>/nick</strong>: ' +__('Change your nickname'),
'<strong>/topic</strong>: ' +__('Set room topic'),
'<strong>/voice</strong>: ' +__('Allow muted user to post messages')
];
this.showHelpMessages(msgs);
break; break;
case 'kick': case 'kick':
converse.connection.muc.kick(this.model.get('jid'), match[2]); converse.connection.muc.kick(this.model.get('jid'), match[2]);
break; break;
case 'ban': case 'mute':
converse.connection.muc.ban(this.model.get('jid'), match[2]); converse.connection.muc.mute(this.model.get('jid'), match[2]);
break;
case 'nick':
converse.connection.muc.changeNick(this.model.get('jid'), match[2]);
break; break;
case 'op': case 'op':
converse.connection.muc.op(this.model.get('jid'), match[2]); converse.connection.muc.op(this.model.get('jid'), match[2]);
break; break;
case 'deop': case 'topic':
converse.connection.muc.deop(this.model.get('jid'), match[2]); converse.connection.muc.setTopic(this.model.get('jid'), match[2]);
break; break;
case 'help': case 'voice':
$chat_content = this.$el.find('.chat-content'); converse.connection.muc.voice(this.model.get('jid'), match[2]);
msgs = [
'<strong>/help</strong>:'+__('Show this menu')+'',
'<strong>/me</strong>:'+__('Write in the third person')+'',
'<strong>/topic</strong>:'+__('Set chatroom topic')+'',
'<strong>/kick</strong>:'+__('Kick user from chatroom')+'',
'<strong>/ban</strong>:'+__('Ban user from chatroom')+'',
'<strong>/clear</strong>:'+__('Remove messages')+''
];
this.showHelpMessages(msgs);
break; break;
default: default:
this.last_msgid = converse.connection.muc.groupchat(this.model.get('jid'), body); this.last_msgid = converse.connection.muc.groupchat(this.model.get('jid'), body);
......
...@@ -393,6 +393,9 @@ ...@@ -393,6 +393,9 @@
font: inherit; font: inherit;
vertical-align: baseline; vertical-align: baseline;
} }
#conversejs strong {
font-weight: 700;
}
#conversejs, #conversejs,
#conversejs input, #conversejs input,
#conversejs textarea { #conversejs textarea {
......
...@@ -4,6 +4,8 @@ Changelog ...@@ -4,6 +4,8 @@ Changelog
0.8.1 (Unreleased) 0.8.1 (Unreleased)
------------------ ------------------
* Allow changing of nickname in a chat room via /nick command. [jcbrand]
* Allow a chat room user to be muted or unmuted with the /mute and /voice commands. [jcbrand]
* Add a chat room toolbar button for toggling the list of participants. [jcbrand] * Add a chat room toolbar button for toggling the list of participants. [jcbrand]
* Converse.js now responds to XEP-0030: Service Discovery requests. [jcbrand] * Converse.js now responds to XEP-0030: Service Discovery requests. [jcbrand]
* Bugfix. Roster groups all appear offline after page reload (with prebind). * Bugfix. Roster groups all appear offline after page reload (with prebind).
......
...@@ -340,6 +340,40 @@ Languages increase the size of the Converse.js significantly. ...@@ -340,6 +340,40 @@ Languages increase the size of the Converse.js significantly.
If you only need one, or a subset of the available languages, it's better to If you only need one, or a subset of the available languages, it's better to
make a custom build which includes only those languages that you need. make a custom build which includes only those languages that you need.
Chat Rooms
==========
Commands
--------
Here are the different commands that may be used in a chat room:
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| Event Type | When is it triggered? | Example (substitue $nickname with an actual user's nickname) |
+============+==============================================================================================+===============================================================+
| **ban** | Ban a user from the chat room. They will not be able to join again. | /ban $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **clear** | Clear the messages shown in the chat room. | /clear |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **deop** | Make a moderator a normal participant. | /deop $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **help** | Show the list of available commands. | /help |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **kick** | Kick a user out of a room. They will be able to join again. | /kick $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **me** | Speak in the 3rd person. | /me $message |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **mute** | Remove a user's ability to post messages to the room. They will still be able to observe. | /mute $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **nick** | Change your nickname. | /nick $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **op** | Make a normal participant a moderator. | /op $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **topic** | Set the topic of the chat room. | /topic ${topic text} |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **voice** | Allow a muted user to post messages to the room. | /voice $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
=========== ===========
Development Development
=========== ===========
......
...@@ -407,6 +407,10 @@ ...@@ -407,6 +407,10 @@
vertical-align: baseline; vertical-align: baseline;
} }
#conversejs strong {
font-weight: 700;
}
#conversejs, #conversejs,
#conversejs input, #conversejs input,
#conversejs textarea { #conversejs textarea {
......
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