Skip to content

Commit be046bd

Browse files
authored
Merge pull request #4 from mkelley88/master
Fixed individual member online statuses
2 parents d69afa3 + 39c5410 commit be046bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

package/contents/ui/main.qml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import QtQuick.Controls 2.0
66
import org.kde.plasma.plasmoid 2.0
77
import org.kde.plasma.core 2.0 as PlasmaCore
88
import org.kde.plasma.components 2.0 as PlasmaComponents
9+
import org.kde.plasma.components 3.0 as PlasmaComponents3
910
import org.kde.plasma.extras 2.0 as PlasmaExtras
1011

1112
Item {
@@ -81,6 +82,15 @@ Item {
8182
console.log("NETWORK ONLINE COUNT:",onlinecount)
8283
zeroRequest("network/"+netw+"/member", function(res) {
8384
for (let dat of res) {
85+
// Subtract timestamps to determine how long ago member was seen and convert to seconds
86+
var lastseen = (dat.clock - dat.lastOnline)/1000
87+
// console.log("MEMBER LAST SEEN: ", lastseen + " seconds ago" )
88+
// If member has not been seen for more than 120 seconds, consider offline.
89+
if(lastseen < 120){
90+
dat.online = true
91+
}else{
92+
dat.online = false
93+
}
8494
if (plasmoid.configuration.show){
8595
if(!dat.online){
8696
continue;}
@@ -245,7 +255,7 @@ Item {
245255
}
246256
}
247257

248-
PlasmaExtras.ScrollArea {
258+
PlasmaComponents3.ScrollView {
249259
anchors.fill: parent
250260

251261
ListView {

zerotier.plasmoid

183 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)