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
Hide 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 @@
...
@@ -10,7 +10,7 @@
-
#994 TypeError when using the
`user.login`
API.
-
#994 TypeError when using the
`user.login`
API.
-
#995
`ChildNode.replaceWith`
is not available in Internet Explorer or Safari. Use
`Node.replaceChild`
instead.
-
#995
`ChildNode.replaceWith`
is not available in Internet Explorer or Safari. Use
`Node.replaceChild`
instead.
-
#1000 Scroll to bottom when maximizing a chat room.
-
#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
### Translation changes
...
...
src/converse-muc.js
View file @
852e9b5c
...
@@ -319,8 +319,8 @@
...
@@ -319,8 +319,8 @@
function
openRoom
(
jid
)
{
function
openRoom
(
jid
)
{
if
(
!
u
.
isValidJID
(
jid
))
{
if
(
!
u
.
isValid
MUC
JID
(
jid
))
{
return
converse
.
log
(
return
_
converse
.
log
(
`Invalid JID "
${
jid
}
" provided in URL fragment`
,
`Invalid JID "
${
jid
}
" provided in URL fragment`
,
Strophe
.
LogLevel
.
WARN
Strophe
.
LogLevel
.
WARN
);
);
...
@@ -1187,9 +1187,8 @@
...
@@ -1187,9 +1187,8 @@
nick
=
this
.
model
.
get
(
'
nick
'
);
nick
=
this
.
model
.
get
(
'
nick
'
);
}
}
const
room
=
this
.
model
.
get
(
'
jid
'
);
const
room
=
this
.
model
.
get
(
'
jid
'
);
const
node
=
Strophe
.
getNodeFromJid
(
room
);
const
jid
=
Strophe
.
getBareJidFromJid
(
room
);
const
domain
=
Strophe
.
getDomainFromJid
(
room
);
return
jid
+
(
nick
!==
null
?
`/
${
nick
}
`
:
""
);
return
node
+
"
@
"
+
domain
+
(
nick
!==
null
?
`/
${
nick
}
`
:
""
);
},
},
registerHandlers
()
{
registerHandlers
()
{
...
@@ -2652,11 +2651,6 @@
...
@@ -2652,11 +2651,6 @@
},
},
roomStanzaItemToHTMLElement
(
room
)
{
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
(
const
name
=
Strophe
.
unescapeNode
(
room
.
getAttribute
(
'
name
'
)
||
room
.
getAttribute
(
'
name
'
)
||
room
.
getAttribute
(
'
jid
'
)
room
.
getAttribute
(
'
jid
'
)
...
@@ -2816,7 +2810,7 @@
...
@@ -2816,7 +2810,7 @@
}
}
return
{
return
{
'
jid
'
:
jid
,
'
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 @@
...
@@ -367,6 +367,10 @@
return
_
.
filter
(
jid
.
split
(
'
@
'
)).
length
===
2
&&
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
return
_
.
filter
(
jid
.
split
(
'
@
'
)).
length
===
2
&&
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
};
};
u
.
isValidMUCJID
=
function
(
jid
)
{
return
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
};
u
.
isSameBareJID
=
function
(
jid1
,
jid2
)
{
u
.
isSameBareJID
=
function
(
jid1
,
jid2
)
{
return
Strophe
.
getBareJidFromJid
(
jid1
).
toLowerCase
()
===
return
Strophe
.
getBareJidFromJid
(
jid1
).
toLowerCase
()
===
Strophe
.
getBareJidFromJid
(
jid2
).
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