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
597e3693
Commit
597e3693
authored
Sep 15, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call initRoster only after controlbox is connected.
parent
3a30f30f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
31 deletions
+33
-31
converse.js
converse.js
+33
-31
No files found.
converse.js
View file @
597e3693
...
@@ -669,7 +669,6 @@
...
@@ -669,7 +669,6 @@
this
.
initStatus
(
$
.
proxy
(
function
()
{
this
.
initStatus
(
$
.
proxy
(
function
()
{
this
.
chatboxes
.
onConnected
();
this
.
chatboxes
.
onConnected
();
this
.
connection
.
roster
.
get
(
function
()
{});
this
.
giveFeedback
(
__
(
'
Online Contacts
'
));
this
.
giveFeedback
(
__
(
'
Online Contacts
'
));
if
(
this
.
callback
)
{
if
(
this
.
callback
)
{
if
(
this
.
connection
.
service
===
'
jasmine tests
'
)
{
if
(
this
.
connection
.
service
===
'
jasmine tests
'
)
{
...
@@ -1615,21 +1614,6 @@
...
@@ -1615,21 +1614,6 @@
initialize
:
function
(
cfg
)
{
initialize
:
function
(
cfg
)
{
cfg
.
$parent
.
append
(
this
.
$el
);
cfg
.
$parent
.
append
(
this
.
$el
);
this
.
$tabs
=
cfg
.
$parent
.
parent
().
find
(
'
#controlbox-tabs
'
);
this
.
$tabs
=
cfg
.
$parent
.
parent
().
find
(
'
#controlbox-tabs
'
);
this
.
initRoster
();
},
initRoster
:
function
()
{
/* We initialize the roster, which will appear inside the
* Contacts Panel.
*/
converse
.
roster
=
new
converse
.
RosterContacts
();
converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
converse
.
storage
](
b64_sha1
(
'
converse.contacts-
'
+
converse
.
bare_jid
));
var
rostergroups
=
new
converse
.
RosterGroups
();
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
converse
.
storage
](
b64_sha1
(
'
converse.roster.groups
'
+
converse
.
bare_jid
));
converse
.
rosterview
=
new
converse
.
RosterView
({
model
:
rostergroups
});
converse
.
rosterview
.
render
().
fetch
().
update
();
},
},
render
:
function
()
{
render
:
function
()
{
...
@@ -1662,7 +1646,6 @@
...
@@ -1662,7 +1646,6 @@
}
}
this
.
$el
.
html
(
widgets
);
this
.
$el
.
html
(
widgets
);
this
.
$el
.
find
(
'
.search-xmpp ul
'
).
append
(
markup
);
this
.
$el
.
find
(
'
.search-xmpp ul
'
).
append
(
markup
);
this
.
$el
.
append
(
converse
.
rosterview
.
$el
);
return
this
;
return
this
;
},
},
...
@@ -1941,6 +1924,7 @@
...
@@ -1941,6 +1924,7 @@
this
.
model
.
on
(
'
change:connected
'
,
$
.
proxy
(
function
(
item
)
{
this
.
model
.
on
(
'
change:connected
'
,
$
.
proxy
(
function
(
item
)
{
this
.
render
();
this
.
render
();
if
(
this
.
model
.
get
(
'
connected
'
))
{
if
(
this
.
model
.
get
(
'
connected
'
))
{
this
.
initRoster
();
converse
.
features
.
off
(
'
add
'
,
this
.
featureAdded
,
this
);
converse
.
features
.
off
(
'
add
'
,
this
.
featureAdded
,
this
);
converse
.
features
.
on
(
'
add
'
,
this
.
featureAdded
,
this
);
converse
.
features
.
on
(
'
add
'
,
this
.
featureAdded
,
this
);
// Features could have been added before the controlbox was
// Features could have been added before the controlbox was
...
@@ -1956,6 +1940,24 @@
...
@@ -1956,6 +1940,24 @@
this
.
model
.
on
(
'
hide
'
,
this
.
hide
,
this
);
this
.
model
.
on
(
'
hide
'
,
this
.
hide
,
this
);
},
},
initRoster
:
function
()
{
/* We initialize the roster, which will appear inside the
* Contacts Panel.
*/
if
(
!
converse
.
roster
)
{
converse
.
roster
=
new
converse
.
RosterContacts
();
converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
converse
.
storage
](
b64_sha1
(
'
converse.contacts-
'
+
converse
.
bare_jid
));
var
rostergroups
=
new
converse
.
RosterGroups
();
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
converse
.
storage
](
b64_sha1
(
'
converse.roster.groups
'
+
converse
.
bare_jid
));
converse
.
rosterview
=
new
converse
.
RosterView
({
model
:
rostergroups
});
}
converse
.
rosterview
.
render
().
fetch
().
update
();
this
.
contactspanel
.
$el
.
append
(
converse
.
rosterview
.
$el
);
converse
.
connection
.
roster
.
get
(
function
()
{});
},
render
:
function
()
{
render
:
function
()
{
if
(
!
converse
.
connection
.
connected
||
!
converse
.
connection
.
authenticated
||
converse
.
connection
.
disconnecting
)
{
if
(
!
converse
.
connection
.
connected
||
!
converse
.
connection
.
authenticated
||
converse
.
connection
.
disconnecting
)
{
// TODO: we might need to take prebinding into consideration here.
// TODO: we might need to take prebinding into consideration here.
...
@@ -3413,27 +3415,26 @@
...
@@ -3413,27 +3415,26 @@
return
count
;
return
count
;
},
},
clea
n
Cache
:
function
(
items
)
{
clea
r
Cache
:
function
(
items
)
{
/* The localstorage cache containing roster contacts might contain
/* The localstorage cache containing roster contacts might contain
* some contacts that aren't actually in our roster anymore. We
* some contacts that aren't actually in our roster anymore. We
* therefore need to remove them now.
* therefore need to remove them now.
*/
*/
var
id
,
i
,
var
id
,
i
,
contact
;
roster_ids
=
[];
for
(
i
=
0
;
i
<
items
.
length
;
++
i
)
{
roster_ids
.
push
(
items
[
i
].
jid
);
}
for
(
i
=
0
;
i
<
this
.
models
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
this
.
models
.
length
;
++
i
)
{
id
=
this
.
models
[
i
].
get
(
'
id
'
);
id
=
this
.
models
[
i
].
get
(
'
id
'
);
if
(
_
.
indexOf
(
roster_ids
,
id
)
===
-
1
)
{
if
(
_
.
indexOf
(
_
.
pluck
(
items
,
'
jid
'
),
id
)
===
-
1
)
{
this
.
get
(
id
).
destroy
();
contact
=
this
.
get
(
id
);
if
(
contact
)
{
contact
.
destroy
();
}
}
}
}
}
},
},
rosterHandler
:
function
(
items
)
{
rosterHandler
:
function
(
items
)
{
converse
.
emit
(
'
roster
'
,
items
);
converse
.
emit
(
'
roster
'
,
items
);
this
.
clea
n
Cache
(
items
);
this
.
clea
r
Cache
(
items
);
_
.
each
(
items
,
function
(
item
,
index
,
items
)
{
_
.
each
(
items
,
function
(
item
,
index
,
items
)
{
if
(
this
.
isSelf
(
item
.
jid
))
{
return
;
}
if
(
this
.
isSelf
(
item
.
jid
))
{
return
;
}
var
model
=
this
.
get
(
item
.
jid
);
var
model
=
this
.
get
(
item
.
jid
);
...
@@ -3634,8 +3635,10 @@
...
@@ -3634,8 +3635,10 @@
view
=
this
.
positionContact
(
contact
).
render
();
view
=
this
.
positionContact
(
contact
).
render
();
if
(
this
.
model
.
get
(
'
state
'
)
===
CLOSED
)
{
if
(
this
.
model
.
get
(
'
state
'
)
===
CLOSED
)
{
view
.
$el
.
hide
();
view
.
$el
.
hide
();
}
this
.
$el
.
show
();
this
.
$el
.
show
();
}
else
{
this
.
show
();
}
},
},
positionContact
:
function
(
contact
)
{
positionContact
:
function
(
contact
)
{
...
@@ -4013,7 +4016,7 @@
...
@@ -4013,7 +4016,7 @@
this
.
getGroup
(
name
).
contacts
.
add
(
contact
);
this
.
getGroup
(
name
).
contacts
.
add
(
contact
);
},
},
add
Current
Contact
:
function
(
contact
)
{
add
Existing
Contact
:
function
(
contact
)
{
var
groups
;
var
groups
;
if
(
converse
.
roster_groups
)
{
if
(
converse
.
roster_groups
)
{
groups
=
contact
.
get
(
'
groups
'
);
groups
=
contact
.
get
(
'
groups
'
);
...
@@ -4029,11 +4032,10 @@
...
@@ -4029,11 +4032,10 @@
},
},
addRosterContact
:
function
(
contact
)
{
addRosterContact
:
function
(
contact
)
{
var
view
;
if
(
contact
.
get
(
'
subscription
'
)
===
'
both
'
||
contact
.
get
(
'
subscription
'
)
===
'
to
'
)
{
if
(
contact
.
get
(
'
subscription
'
)
===
'
both
'
||
contact
.
get
(
'
subscription
'
)
===
'
to
'
)
{
this
.
add
Current
Contact
(
contact
);
this
.
add
Existing
Contact
(
contact
);
}
else
{
}
else
{
view
=
(
new
converse
.
RosterContactView
({
model
:
contact
})).
render
();
(
new
converse
.
RosterContactView
({
model
:
contact
})).
render
();
if
((
contact
.
get
(
'
ask
'
)
===
'
subscribe
'
)
||
(
contact
.
get
(
'
subscription
'
)
===
'
from
'
))
{
if
((
contact
.
get
(
'
ask
'
)
===
'
subscribe
'
)
||
(
contact
.
get
(
'
subscription
'
)
===
'
from
'
))
{
this
.
addContactToGroup
(
contact
,
HEADER_PENDING_CONTACTS
);
this
.
addContactToGroup
(
contact
,
HEADER_PENDING_CONTACTS
);
}
else
if
(
contact
.
get
(
'
requesting
'
)
===
true
)
{
}
else
if
(
contact
.
get
(
'
requesting
'
)
===
true
)
{
...
...
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