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
c48b1f2a
Commit
c48b1f2a
authored
Jul 22, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for setting a chat room's topic
parent
df4c1482
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
12 deletions
+33
-12
converse.js
converse.js
+33
-12
No files found.
converse.js
View file @
c48b1f2a
...
...
@@ -331,7 +331,7 @@ xmppchat.ChatBoxView = Backbone.View.extend({
'
<div class="chat-head chat-head-chatbox">
'
+
'
<div class="chat-title"> <%= user_id %> </div>
'
+
'
<a href="javascript:void(0)" class="chatbox-button close-chatbox-button">X</a>
'
+
'
<
br clear="all"
/>
'
+
'
<
p class="user-custom-message"><p
/>
'
+
'
</div>
'
+
'
<div class="chat-content"></div>
'
+
'
<form class="sendXMPPMessage" action="" method="post">
'
+
...
...
@@ -559,16 +559,37 @@ xmppchat.ChatRoomView = xmppchat.ChatBoxView.extend({
}
},
sendGroupMessage
:
function
(
text
)
{
this
.
last_msgid
=
xmppchat
.
connection
.
muc
.
groupchat
(
this
.
model
.
get
(
'
jid
'
),
text
);
this
.
appendMessage
(
text
);
sendGroupMessage
:
function
(
body
)
{
var
match
=
body
.
replace
(
/^
\s
*/
,
""
).
match
(
/^
\/(
.*
?)(?:
(
.*
))?
$/
);
var
args
=
null
;
if
(
match
)
{
if
(
match
[
1
]
===
"
msg
"
)
{
// TODO: Private messages
}
else
if
(
match
[
1
]
===
"
topic
"
)
{
xmppchat
.
connection
.
muc
.
setTopic
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
else
if
(
match
[
1
]
===
"
kick
"
)
{
xmppchat
.
connection
.
muc
.
kick
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
else
if
(
match
[
1
]
===
"
ban
"
)
{
xmppchat
.
connection
.
muc
.
ban
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
else
if
(
match
[
1
]
===
"
op
"
)
{
xmppchat
.
connection
.
muc
.
op
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
else
if
(
match
[
1
]
===
"
deop
"
)
{
xmppchat
.
connection
.
muc
.
deop
(
this
.
model
.
get
(
'
jid
'
),
match
[
2
]);
}
}
else
{
this
.
last_msgid
=
xmppchat
.
connection
.
muc
.
groupchat
(
this
.
model
.
get
(
'
jid
'
),
body
);
}
},
template
:
_
.
template
(
'
<div class="chat-head chat-head-chatroom">
'
+
'
<div class="chat-title"> <%= name %> </div>
'
+
'
<a href="javascript:void(0)" class="chatbox-button close-chatbox-button">X</a>
'
+
'
<
br clear="all"
/>
'
+
'
<
p class="chatroom-topic"><p
/>
'
+
'
</div>
'
+
'
<div>
'
+
'
<div class="chat-area">
'
+
...
...
@@ -620,16 +641,16 @@ xmppchat.ChatRoomView = xmppchat.ChatBoxView.extend({
},
onMessage
:
function
(
message
)
{
if
(
$
(
message
).
attr
(
'
id
'
)
===
this
.
last_msgid
)
{
// Return if own message sent just now...
return
true
;
}
var
body
=
$
(
message
).
children
(
'
body
'
).
text
(),
jid
=
$
(
message
).
attr
(
'
from
'
),
composing
=
$
(
message
).
find
(
'
composing
'
),
$chat_content
=
$
(
this
.
el
).
find
(
'
.chat-content
'
),
sender
=
Strophe
.
getResourceFromJid
(
jid
);
sender
=
Strophe
.
getResourceFromJid
(
jid
),
subject
=
$
(
message
).
children
(
'
subject
'
).
text
();
if
(
subject
)
{
this
.
$el
.
find
(
'
.chatroom-topic
'
).
text
(
subject
);
}
if
(
!
body
)
{
if
(
composing
.
length
>
0
)
{
this
.
insertStatusNotification
(
'
is typing
'
);
...
...
@@ -1291,13 +1312,13 @@ $(document).ready($.proxy(function () {
this
.
xmppstatus
.
sendPresence
();
// Controlbox toggler
$toggle
.
bind
(
'
click
'
,
function
(
e
)
{
$toggle
.
bind
(
'
click
'
,
$
.
proxy
(
function
(
e
)
{
e
.
preventDefault
();
if
(
$
(
"
div#online-users-container
"
).
is
(
'
:visible
'
))
{
this
.
chatboxesview
.
closeChat
(
'
online-users-container
'
);
}
else
{
this
.
chatboxesview
.
openChat
(
'
online-users-container
'
);
}
});
}
,
this
)
);
},
this
));
},
xmppchat
));
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