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
305559a8
Commit
305559a8
authored
Feb 24, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sizzle in converse-muc.js
parent
fe2a925c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
20 deletions
+6
-20
src/converse-core.js
src/converse-core.js
+1
-0
src/converse-muc.js
src/converse-muc.js
+5
-20
No files found.
src/converse-core.js
View file @
305559a8
...
...
@@ -2258,6 +2258,7 @@
'
b64_sha1
'
:
b64_sha1
,
'
_
'
:
_
,
'
jQuery
'
:
$
,
'
sizzle
'
:
sizzle
,
'
moment
'
:
moment
,
'
utils
'
:
utils
}
...
...
src/converse-muc.js
View file @
305559a8
...
...
@@ -59,6 +59,7 @@
$msg
=
converse
.
env
.
$msg
,
$pres
=
converse
.
env
.
$pres
,
b64_sha1
=
converse
.
env
.
b64_sha1
,
sizzle
=
converse
.
env
.
sizzle
,
utils
=
converse
.
env
.
utils
;
// Other necessary globals
var
$
=
converse
.
env
.
jQuery
,
...
...
@@ -1598,15 +1599,8 @@
* Parameters:
* (XMLElement) pres: A <presence> stanza.
*/
// XXX: For some inexplicable reason, the following line of
// code works in tests, but not with live data, even though
// the passed in stanza looks exactly the same to me:
// var item = pres.querySelector('x[xmlns="'+Strophe.NS.MUC_USER+'"] item');
// If we want to eventually get rid of jQuery altogether,
// then the Sizzle selector library might still be needed
// here.
var
item
=
$
(
pres
).
find
(
'
x[xmlns="
'
+
Strophe
.
NS
.
MUC_USER
+
'
"] item
'
).
get
(
0
);
if
(
_
.
isUndefined
(
item
))
{
return
;
}
var
item
=
sizzle
(
'
x[xmlns="
'
+
Strophe
.
NS
.
MUC_USER
+
'
"] item
'
,
pres
).
pop
();
if
(
_
.
isNil
(
item
))
{
return
;
}
var
jid
=
item
.
getAttribute
(
'
jid
'
);
if
(
Strophe
.
getBareJidFromJid
(
jid
)
===
_converse
.
bare_jid
)
{
var
affiliation
=
item
.
getAttribute
(
'
affiliation
'
);
...
...
@@ -1695,15 +1689,7 @@
* containing the status codes.
*/
var
is_self
=
stanza
.
querySelectorAll
(
"
status[code='110']
"
).
length
;
// Unfortunately this doesn't work (returns empty list)
// var elements = stanza.querySelectorAll('x[xmlns="'+Strophe.NS.MUC_USER+'"]');
var
elements
=
_
.
filter
(
stanza
.
querySelectorAll
(
'
x
'
),
function
(
x
)
{
return
x
.
getAttribute
(
'
xmlns
'
)
===
Strophe
.
NS
.
MUC_USER
;
}
);
var
elements
=
sizzle
(
'
x[xmlns="
'
+
Strophe
.
NS
.
MUC_USER
+
'
"]
'
,
stanza
);
var
notifications
=
_
.
map
(
elements
,
_
.
partial
(
this
.
parseXUserElement
.
bind
(
this
),
_
,
stanza
,
is_self
)
...
...
@@ -1713,8 +1699,7 @@
},
showErrorMessage
:
function
(
presence
)
{
// We didn't enter the room, so we must remove it from the MUC
// add-on
// We didn't enter the room, so we must remove it from the MUC add-on
var
$error
=
$
(
presence
).
find
(
'
error
'
);
if
(
$error
.
attr
(
'
type
'
)
===
'
auth
'
)
{
if
(
$error
.
find
(
'
not-authorized
'
).
length
)
{
...
...
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