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
a5503de5
Commit
a5503de5
authored
7 years ago
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
7aa6286e
4f8a09b0
master
appsettings
bookmarks-pep-node-settings
bottom-typing-notifications
converse-omemo-subview
groupchat-notifications
indexeddb
karma
match-media
multi-session-nicks
nexedi
selenium
split-muc-views
webpack-karma
xep-0198
3.3.2
v7.0.4
v7.0.3
v7.0.2
v7.0.1
v7.0.0
v6.0.1
v6.0.0
v5.0.5
v5.0.4
v5.0.3
v5.0.2
v5.0.1
v5.0.0
v4.2.0
v4.1.2
v4.1.1
v4.1.0
v4.0.6
v4.0.5
v4.0.4
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.3.4
v3.3.3
v3.3.1
v3.3.0
nexedi-v7.0.0dev1
nexedi-v7.0.0dev
nexedi-v4.2.0
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
src/converse-core.js
src/converse-core.js
+37
-23
No files found.
src/converse-core.js
View file @
a5503de5
...
...
@@ -736,17 +736,31 @@
_converse
.
emit
(
'
rosterInitialized
'
);
};
this
.
populateRoster
=
function
()
{
this
.
populateRoster
=
function
(
ignore_cache
=
false
)
{
/* Fetch all the roster groups, and then the roster contacts.
* Emit an event after fetching is done in each case.
*
* Parameters:
* (Bool) ignore_cache - If set to to true, the local cache
* will be ignored it's guaranteed that the XMPP server
* will be queried for the roster.
*/
_converse
.
rostergroups
.
fetchRosterGroups
().
then
(
function
()
{
if
(
ignore_cache
)
{
_converse
.
send_initial_presence
=
true
;
_converse
.
roster
.
fetchFromServer
()
.
then
(
_converse
.
sendInitialPresence
)
.
catch
(
_converse
.
sendInitialPresence
);
}
else
{
_converse
.
rostergroups
.
fetchRosterGroups
().
then
(()
=>
{
_converse
.
emit
(
'
rosterGroupsFetched
'
);
_converse
.
roster
.
fetchRosterContacts
().
then
(
function
()
{
return
_converse
.
roster
.
fetchRosterContacts
();
}).
then
(()
=>
{
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
sendInitialPresence
();
}).
catch
(()
=>
{
_converse
.
sendInitialPresence
();
});
}
);
}
};
this
.
unregisterPresenceHandler
=
function
()
{
...
...
@@ -788,11 +802,9 @@
_converse
.
initRoster
();
}
_converse
.
roster
.
onConnected
();
_converse
.
populateRoster
();
_converse
.
populateRoster
(
reconnecting
);
_converse
.
registerPresenceHandler
();
if
(
reconnecting
)
{
_converse
.
xmppstatus
.
sendPresence
();
}
else
{
if
(
!
reconnecting
)
{
init_promise
.
resolve
();
_converse
.
emit
(
'
initialized
'
);
}
...
...
@@ -1086,14 +1098,8 @@
add
:
true
,
success
(
collection
)
{
if
(
collection
.
length
===
0
)
{
/* We don't have any roster contacts stored in sessionStorage,
* so lets fetch the roster from the XMPP server. We pass in
* 'sendPresence' as callback method, because after initially
* fetching the roster we are ready to receive presence
* updates from our contacts.
*/
_converse
.
send_initial_presence
=
true
;
_converse
.
roster
.
fetchFromServer
(
resolve
);
_converse
.
roster
.
fetchFromServer
(
).
then
(
resolve
).
catch
(
reject
);
}
else
{
_converse
.
emit
(
'
cachedRoster
'
,
collection
);
resolve
();
...
...
@@ -1244,13 +1250,21 @@
return
true
;
},
fetchFromServer
(
callback
)
{
/* Get the roster from the XMPP server */
const
iq
=
$iq
({
type
:
'
get
'
,
'
id
'
:
_converse
.
connection
.
getUniqueId
(
'
roster
'
)})
.
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
});
return
_converse
.
connection
.
sendIQ
(
iq
,
(
iq
)
=>
{
this
.
onReceivedFromServer
(
iq
);
callback
.
apply
(
this
,
arguments
);
fetchFromServer
()
{
/* Fetch the roster from the XMPP server */
return
new
Promise
((
resolve
,
reject
)
=>
{
const
iq
=
$iq
({
'
type
'
:
'
get
'
,
'
id
'
:
_converse
.
connection
.
getUniqueId
(
'
roster
'
)
}).
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
});
const
callback
=
_
.
flow
(
this
.
onReceivedFromServer
.
bind
(
this
),
resolve
);
const
errback
=
function
(
iq
)
{
const
errmsg
=
"
Error while trying to fetch roster from the server
"
;
_converse
.
log
(
errmsg
,
Strophe
.
LogLevel
.
ERROR
);
reject
(
new
Error
(
errmsg
));
}
return
_converse
.
connection
.
sendIQ
(
iq
,
callback
,
errback
);
});
},
...
...
This diff is collapsed.
Click to expand it.
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