From bac22f7551f7e672fb2894a4fc2dca46f9d7b47e Mon Sep 17 00:00:00 2001 From: erinn Date: Tue, 5 Feb 2019 12:09:31 -0800 Subject: [PATCH] who knows what this change is. git is terrible --- go/characters/torstatuspoller.go | 48 +++++++++++++++----------------- main.go | 2 +- qml/panes/GroupSettingsPane.qml | 14 ++++++++++ 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/go/characters/torstatuspoller.go b/go/characters/torstatuspoller.go index 95c408f..135f441 100644 --- a/go/characters/torstatuspoller.go +++ b/go/characters/torstatuspoller.go @@ -1,32 +1,28 @@ package characters -func TorStatusPoller(setTorStatus func(int, string)) { - //TODO: convert this from asaur to bine - /* - for { - time.Sleep(time.Second) - //todo: this should use a config manager - //todo: also, try dialing the proxy to differentiate tor not running vs control port not configured - rawStatus, err := asaur.GetInfo("localhost:9051", "tcp4", "", "status/bootstrap-phase") - if err != nil { - setTorStatus(0, "can't find tor. is it running? is the controlport configured?") - continue - } +import ( + "git.openprivacy.ca/openprivacy/libricochet-go/connectivity" + "time" +) - status := asaur.ParseBootstrapPhase(rawStatus) - progress, _ := strconv.Atoi(status["PROGRESS"]) +func TorStatusPoller(setTorStatus func(int, string), acn connectivity.ACN) { + for { + time.Sleep(time.Second) - if status["TAG"] == "done" { - setTorStatus(3, "tor appears to be running just fine!") - continue - } - - if progress == 0 { - setTorStatus(1, "tor is trying to start up") - continue - } - - setTorStatus(2, status["SUMMARY"]) + percent, message := acn.GetBootstrapStatus() + var statuscode int + if percent == 0 { + statuscode = 0 + message = "can't find tor. is it running? is the controlport configured?" + } else if percent == 100 { + statuscode = 3 + message = "tor appears to be running just fine!" + } else if percent < 80 { + statuscode = 1 + } else { + statuscode = 2 } - */ + + setTorStatus(statuscode, message) + } } diff --git a/main.go b/main.go index 01fd0d7..1d706ed 100644 --- a/main.go +++ b/main.go @@ -66,7 +66,7 @@ func main() { loadCwtchData(gcd, acn) go characters.IncomingListener(gcd.UIState.AddMessage) go characters.PostmanPat(gcd.OutgoingMessages) - go characters.TorStatusPoller(gcd.TorStatus) + go characters.TorStatusPoller(gcd.TorStatus, acn) go characters.PresencePoller(gcd.UIState.GetContact, gcd.UIState.AddContact, gcd.UIState.UpdateContact) go characters.GroupPoller(gcd.UIState.GetContact, gcd.UIState.UpdateContact) diff --git a/qml/panes/GroupSettingsPane.qml b/qml/panes/GroupSettingsPane.qml index e999167..98129dc 100644 --- a/qml/panes/GroupSettingsPane.qml +++ b/qml/panes/GroupSettingsPane.qml @@ -67,6 +67,20 @@ ColumnLayout { // groupSettingsPane } } + ScalingLabel { text: "Invite someone to the group:" } + + ComboBox { + id: cbInvite + popup.font.pixelSize: 12 + width: 200 + font.pixelSize: 20 + model: ["erinn", "erinn (open privacy)", "supergirl", "someone else..."] + + onCurrentTextChanged: { + console.log(cbInvite.text) + } + } + Connections { target: gcd