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
b304a54a
Commit
b304a54a
authored
Jul 14, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show the number of online users.
parent
a20ea9d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
chat.js
chat.js
+12
-8
No files found.
chat.js
View file @
b304a54a
...
@@ -24,6 +24,7 @@ var xmppchat = (function (jarnxmpp, $, console) {
...
@@ -24,6 +24,7 @@ var xmppchat = (function (jarnxmpp, $, console) {
ob
.
Presence
=
jarnxmpp
.
Presence
||
{};
ob
.
Presence
=
jarnxmpp
.
Presence
||
{};
ob
.
Messages
.
ClientStorage
=
(
function
()
{
ob
.
Messages
.
ClientStorage
=
(
function
()
{
// TODO: Messages must be encrypted with a key and salt
methods
=
{};
methods
=
{};
methods
.
addMessage
=
function
(
jid
,
msg
,
direction
)
{
methods
.
addMessage
=
function
(
jid
,
msg
,
direction
)
{
...
@@ -86,14 +87,6 @@ var xmppchat = (function (jarnxmpp, $, console) {
...
@@ -86,14 +87,6 @@ var xmppchat = (function (jarnxmpp, $, console) {
});
});
};
};
ob
.
Presence
.
getOwnStatus
=
function
()
{
return
xmppchat
.
Storage
.
get
(
xmppchat
.
username
+
'
-xmpp-status
'
);
};
ob
.
Presence
.
onlineCount
=
function
()
{
return
xmppchat
.
ChatPartners
.
getTotal
();
};
ob
.
Taskbuffer
=
(
function
(
$
)
{
ob
.
Taskbuffer
=
(
function
(
$
)
{
// Executes tasks one after another (i.e next task is started only when
// Executes tasks one after another (i.e next task is started only when
// the previous one has been completed).
// the previous one has been completed).
...
@@ -723,6 +716,16 @@ xmppchat.RosterClass = (function (stropheRoster, _, $, console) {
...
@@ -723,6 +716,16 @@ xmppchat.RosterClass = (function (stropheRoster, _, $, console) {
if
(
item
)
{
if
(
item
)
{
return
_
.
size
(
item
.
get
(
'
resources
'
));
return
_
.
size
(
item
.
get
(
'
resources
'
));
}
}
},
getNumOnlineContacts
:
function
()
{
var
count
=
0
;
for
(
var
i
=
0
;
i
<
this
.
models
.
length
;
i
++
)
{
if
(
_
.
indexOf
([
'
offline
'
,
'
unavailable
'
],
this
.
models
[
i
].
get
(
'
status
'
))
===
-
1
)
{
count
++
;
}
}
return
count
;
}
}
});
});
...
@@ -826,6 +829,7 @@ xmppchat.RosterView= (function (roster, _, $, console) {
...
@@ -826,6 +829,7 @@ xmppchat.RosterView= (function (roster, _, $, console) {
var
user_id
=
Strophe
.
getNodeFromJid
(
model
.
id
);
var
user_id
=
Strophe
.
getNodeFromJid
(
model
.
id
);
$
(
that
.
el
).
append
(
children
.
filter
(
'
#online-users-
'
+
user_id
));
$
(
that
.
el
).
append
(
children
.
filter
(
'
#online-users-
'
+
user_id
));
});
});
$
(
'
#online-count
'
).
text
(
this
.
model
.
getNumOnlineContacts
());
}
}
});
});
var
view
=
new
View
();
var
view
=
new
View
();
...
...
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