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
1cdf82c0
Commit
1cdf82c0
authored
Dec 06, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add /help command for chat and groupchat and /clear command for chat
parent
f1bfc511
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
converse.css
converse.css
+1
-1
converse.js
converse.js
+36
-3
No files found.
converse.css
View file @
1cdf82c0
...
@@ -145,7 +145,7 @@ input.new-chatroom-name {
...
@@ -145,7 +145,7 @@ input.new-chatroom-name {
white-space
:
nowrap
;
white-space
:
nowrap
;
}
}
.chat-event
,
.chat-date
{
.chat-event
,
.chat-date
,
.chat-help
{
color
:
#808080
;
color
:
#808080
;
}
}
...
...
converse.js
View file @
1cdf82c0
...
@@ -193,6 +193,11 @@
...
@@ -193,6 +193,11 @@
}
}
},
},
clearMessages
:
function
(
jid
)
{
var
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
);
store
.
set
(
hex_sha1
(
this
.
get
(
'
own_jid
'
)
+
bare_jid
),
[]);
},
getOpenChats
:
function
()
{
getOpenChats
:
function
()
{
var
key
=
hex_sha1
(
this
.
get
(
'
own_jid
'
)
+
'
-open-chats
'
),
var
key
=
hex_sha1
(
this
.
get
(
'
own_jid
'
)
+
'
-open-chats
'
),
chats
=
store
.
get
(
key
)
||
[],
chats
=
store
.
get
(
key
)
||
[],
...
@@ -412,8 +417,25 @@
...
@@ -412,8 +417,25 @@
// TODO: Look in ChatPartners to see what resources we have for the recipient.
// TODO: Look in ChatPartners to see what resources we have for the recipient.
// if we have one resource, we sent to only that resources, if we have multiple
// if we have one resource, we sent to only that resources, if we have multiple
// we send to the bare jid.
// we send to the bare jid.
var
timestamp
=
(
new
Date
()).
getTime
();
var
timestamp
=
(
new
Date
()).
getTime
(),
var
bare_jid
=
this
.
model
.
get
(
'
jid
'
);
bare_jid
=
this
.
model
.
get
(
'
jid
'
),
match
=
text
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
)\s
*$/
),
el
,
$chat_content
;
if
(
match
)
{
if
(
match
[
1
]
===
"
clear
"
)
{
$
(
this
.
el
).
find
(
'
.chat-content
'
).
empty
();
xmppchat
.
storage
.
clearMessages
(
bare_jid
);
return
;
}
else
if
(
match
[
1
]
===
"
help
"
)
{
$chat_content
=
$
(
this
.
el
).
find
(
'
.chat-content
'
);
$chat_content
.
append
(
$
(
'
<div class="chat-help"><strong>/help</strong>: Show this menu</div>
'
));
$chat_content
.
append
(
$
(
'
<div class="chat-help"><strong>/clear</strong>: Remove messages</div>
'
));
this
.
scrolldown
();
return
;
}
}
var
message
=
$msg
({
from
:
xmppchat
.
connection
.
bare_jid
,
to
:
bare_jid
,
type
:
'
chat
'
,
id
:
timestamp
})
var
message
=
$msg
({
from
:
xmppchat
.
connection
.
bare_jid
,
to
:
bare_jid
,
type
:
'
chat
'
,
id
:
timestamp
})
.
c
(
'
body
'
).
t
(
text
).
up
()
.
c
(
'
body
'
).
t
(
text
).
up
()
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
});
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
});
...
@@ -807,7 +829,6 @@
...
@@ -807,7 +829,6 @@
sendGroupMessage
:
function
(
body
)
{
sendGroupMessage
:
function
(
body
)
{
var
match
=
body
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
?)(?:
(
.*
))?
$/
);
var
match
=
body
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
?)(?:
(
.*
))?
$/
);
var
args
=
null
;
if
(
match
)
{
if
(
match
)
{
if
(
match
[
1
]
===
"
msg
"
)
{
if
(
match
[
1
]
===
"
msg
"
)
{
// TODO: Private messages
// TODO: Private messages
...
@@ -825,6 +846,18 @@
...
@@ -825,6 +846,18 @@
}
else
if
(
match
[
1
]
===
"
deop
"
)
{
}
else
if
(
match
[
1
]
===
"
deop
"
)
{
xmppchat
.
connection
.
muc
.
deop
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
xmppchat
.
connection
.
muc
.
deop
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
else
if
(
match
[
1
]
===
"
help
"
)
{
$chat_content
=
$
(
this
.
el
).
find
(
'
.chat-content
'
);
$chat_content
.
append
(
$
(
'
<div class="chat-help"><strong>/help</strong>: Show this menu</div>
'
));
$chat_content
.
append
(
$
(
'
<div class="chat-help"><strong>/topic</strong>: Set chatroom topic</div>
'
));
/* TODO:
$chat_content.append($('<div class="chat-help"><strong>/kick</strong>: Kick out user</div>'));
$chat_content.append($('<div class="chat-help"><strong>/ban</strong>: Ban user</div>'));
$chat_content.append($('<div class="chat-help"><strong>/op $user</strong>: Remove messages</div>'));
$chat_content.append($('<div class="chat-help"><strong>/deop $user</strong>: Remove messages</div>'));
*/
this
.
scrolldown
();
}
else
{
}
else
{
this
.
last_msgid
=
xmppchat
.
connection
.
muc
.
groupchat
(
this
.
model
.
get
(
'
jid
'
),
body
);
this
.
last_msgid
=
xmppchat
.
connection
.
muc
.
groupchat
(
this
.
model
.
get
(
'
jid
'
),
body
);
}
}
...
...
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