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
de3099a9
Commit
de3099a9
authored
Jun 16, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converse-muc: Show `<text>` content of error presences
parent
1d6ee5bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
src/converse-muc-views.js
src/converse-muc-views.js
+3
-2
src/headless/converse-muc.js
src/headless/converse-muc.js
+21
-16
No files found.
src/converse-muc-views.js
View file @
de3099a9
...
...
@@ -1169,9 +1169,10 @@ converse.plugins.add('converse-muc-views', {
if
(
!
this
.
password_form
)
{
this
.
password_form
=
new
_converse
.
MUCPasswordForm
({
'
model
'
:
new
Backbone
.
Model
(),
'
model
'
:
new
Backbone
.
Model
({
'
validation_message
'
:
message
}),
'
chatroomview
'
:
this
,
'
validation_message
'
:
message
});
const
container_el
=
this
.
el
.
querySelector
(
'
.chatroom-body
'
);
container_el
.
insertAdjacentElement
(
'
beforeend
'
,
this
.
password_form
.
el
);
...
...
src/headless/converse-muc.js
View file @
de3099a9
...
...
@@ -1538,33 +1538,37 @@ converse.plugins.add('converse-muc', {
* @param { XMLElement } stanza - The presence stanza
*/
onErrorPresence
(
stanza
)
{
if
(
sizzle
(
`error not-authorized[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
stanza
).
length
)
{
this
.
save
({
'
password_validation_message
'
:
__
(
"
Password incorrect
"
),
'
connection_status
'
:
converse
.
ROOMSTATUS
.
PASSWORD_REQUIRED
});
}
const
error
=
stanza
.
querySelector
(
'
error
'
);
const
error_type
=
error
.
getAttribute
(
'
type
'
);
const
reason
=
_
.
get
(
sizzle
(
`text[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
error
).
pop
(),
'
textContent
'
);
if
(
error_type
===
'
modify
'
)
{
this
.
handleModifyError
(
stanza
);
}
else
if
(
error_type
===
'
auth
'
)
{
if
(
sizzle
(
`not-authorized[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
error
).
length
)
{
this
.
save
({
'
password_validation_message
'
:
reason
||
__
(
"
Password incorrect
"
),
'
connection_status
'
:
converse
.
ROOMSTATUS
.
PASSWORD_REQUIRED
});
}
if
(
error
.
querySelector
(
'
registration-required
'
))
{
this
.
setDisconnectionMessage
(
__
(
'
You are not on the member list of this groupchat.
'
));
const
message
=
__
(
'
You are not on the member list of this groupchat.
'
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
else
if
(
error
.
querySelector
(
'
forbidden
'
))
{
this
.
setDisconnectionMessage
(
__
(
'
You have been banned from this groupchat.
'
));
const
message
=
__
(
'
You have been banned from this groupchat.
'
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
}
else
if
(
error_type
===
'
cancel
'
)
{
if
(
error
.
querySelector
(
'
not-allowed
'
))
{
this
.
setDisconnectionMessage
(
__
(
'
You are not allowed to create new groupchats.
'
));
const
message
=
__
(
'
You are not allowed to create new groupchats.
'
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
else
if
(
error
.
querySelector
(
'
not-acceptable
'
))
{
this
.
setDisconnectionMessage
(
__
(
"
Your nickname doesn't conform to this groupchat's policies.
"
));
const
message
=
__
(
"
Your nickname doesn't conform to this groupchat's policies.
"
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
else
if
(
sizzle
(
`gone[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
error
).
length
)
{
const
moved_jid
=
_
.
get
(
sizzle
(
`gone[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
error
).
pop
(),
'
textContent
'
)
.
replace
(
/^xmpp:/
,
''
)
.
replace
(
/
\?
join$/
,
''
);
const
reason
=
_
.
get
(
sizzle
(
`text[xmlns="
${
Strophe
.
NS
.
STANZAS
}
"]`
,
error
).
pop
(),
'
textContent
'
);
this
.
save
({
'
connection_status
'
:
converse
.
ROOMSTATUS
.
DESTROYED
,
'
destroyed_reason
'
:
reason
,
...
...
@@ -1573,14 +1577,15 @@ converse.plugins.add('converse-muc', {
}
else
if
(
error
.
querySelector
(
'
conflict
'
))
{
this
.
onNicknameClash
(
stanza
);
}
else
if
(
error
.
querySelector
(
'
item-not-found
'
))
{
this
.
setDisconnectionMessage
(
__
(
"
This groupchat does not (yet) exist.
"
));
const
message
=
__
(
"
This groupchat does not (yet) exist.
"
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
else
if
(
error
.
querySelector
(
'
service-unavailable
'
))
{
this
.
setDisconnectionMessage
(
__
(
"
This groupchat has reached its maximum number of participants.
"
));
const
message
=
__
(
"
This groupchat has reached its maximum number of participants.
"
);
this
.
setDisconnectionMessage
(
message
,
reason
);
}
else
if
(
error
.
querySelector
(
'
remote-server-not-found
'
))
{
const
message
=
__
(
"
Remote server not found
"
);
const
text
=
_
.
get
(
error
.
querySelector
(
'
text
'
),
'
textContent
'
);
const
reason
=
text
?
__
(
'
The explanation given is: "%1$s".
'
,
text
)
:
undefined
;
this
.
setDisconnectionMessage
(
message
,
reason
);
const
feedback
=
reason
?
__
(
'
The explanation given is: "%1$s".
'
,
reason
)
:
undefined
;
this
.
setDisconnectionMessage
(
message
,
feedback
);
}
}
},
...
...
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