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
1f82b7df
Commit
1f82b7df
authored
Jun 14, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create utils method `isSameBareJID`. Refs: #894
parent
ad06c2b9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
src/converse-core.js
src/converse-core.js
+2
-2
src/converse-muc.js
src/converse-muc.js
+1
-1
src/utils.js
src/utils.js
+5
-0
No files found.
src/converse-core.js
View file @
1f82b7df
...
...
@@ -1020,7 +1020,7 @@
},
isSelf
:
function
(
jid
)
{
return
(
Strophe
.
getBareJidFromJid
(
jid
)
===
Strophe
.
getBareJidFromJid
(
_converse
.
connection
.
jid
)
);
return
utils
.
isSameBareJID
(
jid
,
_converse
.
connection
.
jid
);
},
addAndSubscribe
:
function
(
jid
,
name
,
groups
,
message
,
attributes
)
{
...
...
@@ -1510,7 +1510,7 @@
*/
// TODO: we can likely just reuse "onMessage" below
var
from_jid
=
Strophe
.
getBareJidFromJid
(
message
.
getAttribute
(
'
from
'
));
if
(
from_jid
===
_converse
.
bare_jid
)
{
if
(
utils
.
isSameBareJID
(
from_jid
,
_converse
.
bare_jid
)
)
{
return
true
;
}
// Get chat box, but only create a new one when the message has a body.
...
...
src/converse-muc.js
View file @
1f82b7df
...
...
@@ -1717,7 +1717,7 @@
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
).
toLowerCase
()
===
_converse
.
bare_jid
.
toLowerCase
(
))
{
if
(
utils
.
isSameBareJID
(
jid
,
_converse
.
bare_jid
))
{
var
affiliation
=
item
.
getAttribute
(
'
affiliation
'
);
var
role
=
item
.
getAttribute
(
'
role
'
);
if
(
affiliation
)
{
...
...
src/utils.js
View file @
1f82b7df
...
...
@@ -227,6 +227,11 @@
}
},
isSameBareJID
:
function
(
jid1
,
jid2
)
{
return
Strophe
.
getBareJidFromJid
(
jid1
).
toLowerCase
()
===
Strophe
.
getBareJidFromJid
(
jid2
).
toLowerCase
();
},
isNewMessage
:
function
(
message
)
{
/* Given a stanza, determine whether it's a new
* message, i.e. not a MAM archived one.
...
...
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