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
a0f0240b
Commit
a0f0240b
authored
Jun 11, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't set nick before confirmation that it was successful
parent
d385452a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
26 deletions
+25
-26
src/converse-muc-views.js
src/converse-muc-views.js
+9
-5
src/headless/converse-muc.js
src/headless/converse-muc.js
+16
-21
No files found.
src/converse-muc-views.js
View file @
a0f0240b
...
...
@@ -1105,12 +1105,16 @@ converse.plugins.add('converse-muc-views', {
case
'
nick
'
:
{
if
(
!
this
.
verifyRoles
([
'
visitor
'
,
'
participant
'
,
'
moderator
'
]))
{
break
;
}
}
else
if
(
args
.
length
===
0
)
{
this
.
showErrorMessage
(
__
(
'
You need to provide a nickname
'
))
}
else
{
const
jid
=
Strophe
.
getBareJidFromJid
(
this
.
model
.
get
(
'
jid
'
));
_converse
.
api
.
send
(
$pres
({
from
:
_converse
.
connection
.
jid
,
to
:
this
.
model
.
getRoomJIDAndNick
(
args
)
,
to
:
`
${
jid
}
/
${
args
}
`
,
id
:
_converse
.
connection
.
getUniqueId
()
}).
tree
());
}
break
;
}
case
'
owner
'
:
...
...
src/headless/converse-muc.js
View file @
a0f0240b
...
...
@@ -377,7 +377,7 @@ converse.plugins.add('converse-muc', {
}
const
stanza
=
$pres
({
'
from
'
:
_converse
.
connection
.
jid
,
'
to
'
:
this
.
getRoomJIDAndNick
(
nick
)
'
to
'
:
this
.
getRoomJIDAndNick
()
}).
c
(
"
x
"
,
{
'
xmlns
'
:
Strophe
.
NS
.
MUC
})
.
c
(
"
history
"
,
{
'
maxstanzas
'
:
this
.
features
.
get
(
'
mam_enabled
'
)
?
0
:
_converse
.
muc_history_max_stanzas
}).
up
();
...
...
@@ -532,30 +532,25 @@ converse.plugins.add('converse-muc', {
});
},
getRoomJIDAndNick
(
nick
)
{
/
* Utility method to construct the JID for the current user
/**
* Utility method to construct the JID for the current user
* as occupant of the groupchat.
*
* This is the groupchat JID, with the user's nick added at the
* end.
*
* For example: groupchat@conference.example.org/nickname
* @returns {string} - The groupchat JID with the user's nickname added at the end.
* @example groupchat@conference.example.org/nickname
*/
if
(
nick
)
{
this
.
save
({
'
nick
'
:
nick
});
}
else
{
nick
=
this
.
get
(
'
nick
'
);
}
const
groupchat
=
this
.
get
(
'
jid
'
);
const
jid
=
Strophe
.
getBareJidFromJid
(
groupchat
);
getRoomJIDAndNick
()
{
const
nick
=
this
.
get
(
'
nick
'
);
const
jid
=
Strophe
.
getBareJidFromJid
(
this
.
get
(
'
jid
'
));
return
jid
+
(
nick
!==
null
?
`/
${
nick
}
`
:
""
);
},
sendChatState
()
{
/
* Sends a message with the status of the user in this chat session
/**
* Sends a message with the status of the user in this chat session
* as taken from the 'chat_state' attribute of the chat box.
* See XEP-0085 Chat State Notifications.
*/
sendChatState
()
{
if
(
!
_converse
.
send_chat_state_notifications
||
this
.
get
(
'
connection_status
'
)
!==
converse
.
ROOMSTATUS
.
ENTERED
)
{
return
;
}
...
...
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