Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a3e540fa
Commit
a3e540fa
authored
Sep 05, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide feedback if a chat room command didn't work.
parent
82659e87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
15 deletions
+33
-15
converse.js
converse.js
+28
-10
docs/source/index.rst
docs/source/index.rst
+5
-5
No files found.
converse.js
View file @
a3e540fa
...
...
@@ -72,6 +72,11 @@
};
};
String
.
prototype
.
splitOnce
=
function
(
delimiter
)
{
var
components
=
this
.
split
(
delimiter
);
return
[
components
.
shift
(),
components
.
join
(
delimiter
)];
};
var
playNotification
=
function
()
{
var
audio
;
if
(
converse
.
play_sounds
&&
typeof
Audio
!==
"
undefined
"
){
...
...
@@ -1000,10 +1005,12 @@
return
this
;
},
showStatusNotification
:
function
(
message
,
replace
)
{
showStatusNotification
:
function
(
message
,
keep_old
)
{
var
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
$chat_content
.
find
(
'
div.chat-event
'
).
remove
().
end
()
.
append
(
$
(
'
<div class="chat-event"></div>
'
).
text
(
message
));
if
(
!
keep_old
)
{
$chat_content
.
find
(
'
div.chat-event
'
).
remove
();
}
$chat_content
.
append
(
$
(
'
<div class="chat-event"></div>
'
).
text
(
message
));
this
.
scrollDown
();
},
...
...
@@ -2017,18 +2024,25 @@
return
this
;
},
onCommandError
:
function
(
stanza
)
{
this
.
showStatusNotification
(
__
(
"
Error: could not execute the command
"
),
true
);
},
sendChatRoomMessage
:
function
(
body
)
{
var
match
=
body
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
?)(?:
(
.*
))?
$/
)
||
[
false
],
$chat_content
;
$chat_content
,
args
;
switch
(
match
[
1
])
{
case
'
ban
'
:
converse
.
connection
.
muc
.
ban
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
ban
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
case
'
clear
'
:
this
.
clearChatRoomMessages
();
break
;
case
'
deop
'
:
converse
.
connection
.
muc
.
deop
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
deop
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
case
'
help
'
:
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
...
...
@@ -2046,22 +2060,26 @@
this
.
showHelpMessages
(
msgs
);
break
;
case
'
kick
'
:
converse
.
connection
.
muc
.
kick
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
kick
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
case
'
mute
'
:
converse
.
connection
.
muc
.
mute
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
mute
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
case
'
nick
'
:
converse
.
connection
.
muc
.
changeNick
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
break
;
case
'
op
'
:
converse
.
connection
.
muc
.
op
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
op
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
case
'
topic
'
:
converse
.
connection
.
muc
.
setTopic
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
break
;
case
'
voice
'
:
converse
.
connection
.
muc
.
voice
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
args
=
match
[
2
].
splitOnce
(
'
'
);
converse
.
connection
.
muc
.
voice
(
this
.
model
.
get
(
'
jid
'
),
args
[
0
],
args
[
1
],
undefined
,
$
.
proxy
(
this
.
onCommandError
,
this
));
break
;
default
:
this
.
last_msgid
=
converse
.
connection
.
muc
.
groupchat
(
this
.
model
.
get
(
'
jid
'
),
body
);
...
...
docs/source/index.rst
View file @
a3e540fa
...
...
@@ -355,23 +355,23 @@ Here are the different commands that may be used in a chat room:
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **clear** | Clear the messages shown in the chat room. | /clear |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **deop** | Make a moderator a normal participant. | /deop $nickname
|
| **deop** | Make a moderator a normal participant. | /deop $nickname
[$reason]
|
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **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
|
| **kick** | Kick a user out of a room. They will be able to join again. | /kick $nickname
[$reason]
|
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **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
|
| **mute** | Remove a user's ability to post messages to the room. They will still be able to observe. | /mute $nickname
[$reason]
|
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **nick** | Change your nickname. | /nick $nickname |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **op** | Make a normal participant a moderator. | /op $nickname
|
| **op** | Make a normal participant a moderator. | /op $nickname
[$reason]
|
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **topic** | Set the topic of the chat room. | /topic ${topic text} |
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **voice** | Allow a muted user to post messages to the room. | /voice $nickname
|
| **voice** | Allow a muted user to post messages to the room. | /voice $nickname
[$reason]
|
+------------+----------------------------------------------------------------------------------------------+---------------------------------------------------------------+
===========
...
...
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