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
e1efb604
Commit
e1efb604
authored
Nov 08, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Previous commit didn't take closed chat boxes into consideration
parent
dc31057c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
converse.js
converse.js
+13
-6
No files found.
converse.js
View file @
e1efb604
...
@@ -2844,6 +2844,7 @@
...
@@ -2844,6 +2844,7 @@
var
$message
=
$
(
message
);
var
$message
=
$
(
message
);
var
buddy_jid
,
$forwarded
,
$received
,
var
buddy_jid
,
$forwarded
,
$received
,
msgid
=
$message
.
attr
(
'
id
'
),
msgid
=
$message
.
attr
(
'
id
'
),
chatbox
,
resource
,
roster_item
,
message_from
=
$message
.
attr
(
'
from
'
);
message_from
=
$message
.
attr
(
'
from
'
);
if
(
message_from
===
converse
.
connection
.
jid
)
{
if
(
message_from
===
converse
.
connection
.
jid
)
{
// FIXME: Forwarded messages should be sent to specific resources,
// FIXME: Forwarded messages should be sent to specific resources,
...
@@ -2859,8 +2860,7 @@
...
@@ -2859,8 +2860,7 @@
message_from
=
$message
.
attr
(
'
from
'
);
message_from
=
$message
.
attr
(
'
from
'
);
}
}
var
from
=
Strophe
.
getBareJidFromJid
(
message_from
),
var
from
=
Strophe
.
getBareJidFromJid
(
message_from
),
to
=
Strophe
.
getBareJidFromJid
(
$message
.
attr
(
'
to
'
)),
to
=
Strophe
.
getBareJidFromJid
(
$message
.
attr
(
'
to
'
));
resource
,
chatbox
,
roster_item
;
if
(
from
==
converse
.
bare_jid
)
{
if
(
from
==
converse
.
bare_jid
)
{
// I am the sender, so this must be a forwarded message...
// I am the sender, so this must be a forwarded message...
buddy_jid
=
to
;
buddy_jid
=
to
;
...
@@ -2869,10 +2869,6 @@
...
@@ -2869,10 +2869,6 @@
buddy_jid
=
from
;
buddy_jid
=
from
;
resource
=
Strophe
.
getResourceFromJid
(
message_from
);
resource
=
Strophe
.
getResourceFromJid
(
message_from
);
}
}
chatbox
=
this
.
get
(
buddy_jid
);
if
(
msgid
&&
chatbox
.
messages
.
findWhere
({
msgid
:
msgid
}))
{
return
true
;
// We already have this message stored.
}
roster_item
=
converse
.
roster
.
get
(
buddy_jid
);
roster_item
=
converse
.
roster
.
get
(
buddy_jid
);
if
(
roster_item
===
undefined
)
{
if
(
roster_item
===
undefined
)
{
...
@@ -2881,6 +2877,7 @@
...
@@ -2881,6 +2877,7 @@
return
true
;
return
true
;
}
}
chatbox
=
this
.
get
(
buddy_jid
);
if
(
!
chatbox
)
{
if
(
!
chatbox
)
{
var
fullname
=
roster_item
.
get
(
'
fullname
'
);
var
fullname
=
roster_item
.
get
(
'
fullname
'
);
fullname
=
_
.
isEmpty
(
fullname
)?
buddy_jid
:
fullname
;
fullname
=
_
.
isEmpty
(
fullname
)?
buddy_jid
:
fullname
;
...
@@ -2893,6 +2890,16 @@
...
@@ -2893,6 +2890,16 @@
'
url
'
:
roster_item
.
get
(
'
url
'
)
'
url
'
:
roster_item
.
get
(
'
url
'
)
});
});
}
}
if
(
msgid
&&
chatbox
.
messages
.
findWhere
({
msgid
:
msgid
}))
{
// FIXME: There's still a bug here..
// If a duplicate message is received just after the chat
// box was closed, then it'll open again (due to it being
// created here above), with now new messages.
// The solution is mostly likely to not let chat boxes show
// automatically when they are created, but to require
// "show" to be called explicitly.
return
true
;
// We already have this message stored.
}
if
(
!
this
.
isOnlyChatStateNotification
(
$message
)
&&
from
!==
converse
.
bare_jid
)
{
if
(
!
this
.
isOnlyChatStateNotification
(
$message
)
&&
from
!==
converse
.
bare_jid
)
{
playNotification
();
playNotification
();
}
}
...
...
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