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
852e9b5c
Commit
852e9b5c
authored
Jan 29, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates #1003. Handle bare MUC room JIDs
parent
6dfd2f88
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
CHANGES.md
CHANGES.md
+1
-1
src/converse-muc.js
src/converse-muc.js
+5
-11
src/utils.js
src/utils.js
+4
-0
No files found.
CHANGES.md
View file @
852e9b5c
...
...
@@ -10,7 +10,7 @@
-
#994 TypeError when using the
`user.login`
API.
-
#995
`ChildNode.replaceWith`
is not available in Internet Explorer or Safari. Use
`Node.replaceChild`
instead.
-
#1000 Scroll to bottom when maximizing a chat room.
-
#1003
Don't list MUC domain in rooms list.
-
#1003
Handle bare MUC room JIDs
### Translation changes
...
...
src/converse-muc.js
View file @
852e9b5c
...
...
@@ -319,8 +319,8 @@
function
openRoom
(
jid
)
{
if
(
!
u
.
isValidJID
(
jid
))
{
return
converse
.
log
(
if
(
!
u
.
isValid
MUC
JID
(
jid
))
{
return
_
converse
.
log
(
`Invalid JID "
${
jid
}
" provided in URL fragment`
,
Strophe
.
LogLevel
.
WARN
);
...
...
@@ -1187,9 +1187,8 @@
nick
=
this
.
model
.
get
(
'
nick
'
);
}
const
room
=
this
.
model
.
get
(
'
jid
'
);
const
node
=
Strophe
.
getNodeFromJid
(
room
);
const
domain
=
Strophe
.
getDomainFromJid
(
room
);
return
node
+
"
@
"
+
domain
+
(
nick
!==
null
?
`/
${
nick
}
`
:
""
);
const
jid
=
Strophe
.
getBareJidFromJid
(
room
);
return
jid
+
(
nick
!==
null
?
`/
${
nick
}
`
:
""
);
},
registerHandlers
()
{
...
...
@@ -2652,11 +2651,6 @@
},
roomStanzaItemToHTMLElement
(
room
)
{
if
(
!
u
.
isValidJID
(
room
.
getAttribute
(
'
jid
'
),
'
@
'
))
{
// Some XMPP servers return the MUC service in
// the list of rooms (see #1003).
return
null
;
}
const
name
=
Strophe
.
unescapeNode
(
room
.
getAttribute
(
'
name
'
)
||
room
.
getAttribute
(
'
jid
'
)
...
...
@@ -2816,7 +2810,7 @@
}
return
{
'
jid
'
:
jid
,
'
name
'
:
name
||
Strophe
.
unescapeNode
(
Strophe
.
getNodeFromJid
(
jid
))
,
'
name
'
:
name
||
Strophe
.
unescapeNode
(
Strophe
.
getNodeFromJid
(
jid
))
||
jid
}
},
...
...
src/utils.js
View file @
852e9b5c
...
...
@@ -367,6 +367,10 @@
return
_
.
filter
(
jid
.
split
(
'
@
'
)).
length
===
2
&&
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
};
u
.
isValidMUCJID
=
function
(
jid
)
{
return
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
};
u
.
isSameBareJID
=
function
(
jid1
,
jid2
)
{
return
Strophe
.
getBareJidFromJid
(
jid1
).
toLowerCase
()
===
Strophe
.
getBareJidFromJid
(
jid2
).
toLowerCase
();
...
...
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