Updates #1003. Handle bare MUC room JIDs
This commit is contained in:
parent
6dfd2f8855
commit
852e9b5c85
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -319,8 +319,8 @@
|
||||||
|
|
||||||
|
|
||||||
function openRoom (jid) {
|
function openRoom (jid) {
|
||||||
if (!u.isValidJID(jid)) {
|
if (!u.isValidMUCJID(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 @@
|
||||||
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 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
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 @@
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'jid': jid,
|
'jid': jid,
|
||||||
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)) || jid
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user