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
61b2dc7f
Commit
61b2dc7f
authored
Feb 24, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move MAM code to proper place.
Also, don't query for MAM messages if the chat room doesn't support it.
parent
0d48929b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
31 deletions
+41
-31
src/converse-mam.js
src/converse-mam.js
+41
-5
src/converse-muc.js
src/converse-muc.js
+0
-26
No files found.
src/converse-mam.js
View file @
61b2dc7f
...
...
@@ -86,12 +86,14 @@
fetchArchivedMessages
:
function
(
options
)
{
/* Fetch archived chat messages from the XMPP server.
*
* Then, upon receiving them, call onMessage on the chat
box,
* so that they are displayed inside it.
* Then, upon receiving them, call onMessage on the chat
*
box,
so that they are displayed inside it.
*/
var
_converse
=
this
.
__super__
.
_converse
;
if
(
!
_converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
_converse
.
log
(
"
Attempted to fetch archived messages but this user's server doesn't support XEP-0313
"
);
_converse
.
log
(
"
Attempted to fetch archived messages but this
"
+
"
user's server doesn't support XEP-0313
"
);
return
;
}
if
(
this
.
disable_mam
)
{
...
...
@@ -106,7 +108,9 @@
}.
bind
(
this
),
function
()
{
this
.
clearSpinner
();
_converse
.
log
(
"
Error or timeout while trying to fetch archived messages
"
,
"
error
"
);
_converse
.
log
(
"
Error or timeout while trying to fetch
"
+
"
archived messages
"
,
"
error
"
);
}.
bind
(
this
)
);
},
...
...
@@ -132,8 +136,40 @@
return
result
;
},
fetchArchivedMessages
:
function
(
options
)
{
/* Fetch archived chat messages from the XMPP server.
*
* Then, upon receiving them, call onChatRoomMessage
* so that they are displayed inside it.
*/
var
that
=
this
;
var
_converse
=
this
.
__super__
.
_converse
;
if
(
!
_converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
_converse
.
log
(
"
Attempted to fetch archived messages but this
"
+
"
user's server doesn't support XEP-0313
"
);
return
;
}
if
(
!
this
.
model
.
get
(
'
mam_enabled
'
))
{
return
;
}
this
.
addSpinner
();
_converse
.
api
.
archive
.
query
(
_
.
extend
(
options
,
{
'
groupchat
'
:
true
}),
function
(
messages
)
{
that
.
clearSpinner
();
if
(
messages
.
length
)
{
_
.
each
(
messages
,
that
.
onChatRoomMessage
.
bind
(
that
));
}
},
function
()
{
that
.
clearSpinner
();
_converse
.
log
(
"
Error while trying to fetch archived messages
"
,
"
error
"
);
}
);
}
}
},
...
...
src/converse-muc.js
View file @
61b2dc7f
...
...
@@ -1888,32 +1888,6 @@
_converse
.
emit
(
'
message
'
,
message
);
}
return
true
;
},
fetchArchivedMessages
:
function
(
options
)
{
/* Fetch archived chat messages from the XMPP server.
*
* Then, upon receiving them, call onChatRoomMessage
* so that they are displayed inside it.
*/
var
that
=
this
;
if
(
!
_converse
.
features
.
findWhere
({
'
var
'
:
Strophe
.
NS
.
MAM
}))
{
_converse
.
log
(
"
Attempted to fetch archived messages but this user's server doesn't support XEP-0313
"
);
return
;
}
this
.
addSpinner
();
_converse
.
api
.
archive
.
query
(
_
.
extend
(
options
,
{
'
groupchat
'
:
true
}),
function
(
messages
)
{
that
.
clearSpinner
();
if
(
messages
.
length
)
{
_
.
each
(
messages
,
that
.
onChatRoomMessage
.
bind
(
that
));
}
},
function
()
{
that
.
clearSpinner
();
_converse
.
log
(
"
Error while trying to fetch archived messages
"
,
"
error
"
);
}
);
}
});
...
...
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