renaming bounce to cwtch.im/app

This commit is contained in:
erinn 2018-11-28 14:14:02 -08:00
parent fe5f83c3f7
commit ae7e3e5c4e
13 changed files with 73 additions and 78 deletions

View File

@ -1,9 +1,9 @@
package characters package characters
import ( import (
"bounce/go/gobjects"
"bounce/go/the"
"cwtch.im/cwtch/model" "cwtch.im/cwtch/model"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
) )
func CwtchListener(callback func(message *gobjects.Message), groupID string, channel chan model.Message) { func CwtchListener(callback func(message *gobjects.Message), groupID string, channel chan model.Message) {

View File

@ -1,9 +1,9 @@
package characters package characters
import ( import (
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"time" "time"
"bounce/go/the"
"bounce/go/gobjects"
) )
func GroupPoller(getContact func(string) *gobjects.Contact, updateContact func(string)) { func GroupPoller(getContact func(string) *gobjects.Contact, updateContact func(string)) {

View File

@ -1,10 +1,10 @@
package characters package characters
import ( import (
"bounce/go/the" "cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"git.openprivacy.ca/openprivacy/libricochet-go/channels" "git.openprivacy.ca/openprivacy/libricochet-go/channels"
"log" "log"
"bounce/go/gobjects"
) )
func PostmanPat(messages chan gobjects.Letter) { func PostmanPat(messages chan gobjects.Letter) {

View File

@ -1,10 +1,10 @@
package characters package characters
import ( import (
"cwtch.im/ui/go/cwutil"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"time" "time"
"bounce/go/the"
"bounce/go/cwutil"
"bounce/go/gobjects"
) )
func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(contact *gobjects.Contact), updateContact func(string)) { // TODO: make this subscribe-able in ricochet func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(contact *gobjects.Contact), updateContact func(string)) { // TODO: make this subscribe-able in ricochet
@ -46,4 +46,4 @@ func PresencePoller(getContact func(string) *gobjects.Contact, addContact func(c
} }
time.Sleep(time.Second * 4) time.Sleep(time.Second * 4)
} }
} }

View File

@ -1,35 +1,32 @@
package characters package characters
import (
"git.openprivacy.ca/openprivacy/asaur"
"strconv"
"time"
)
func TorStatusPoller(setTorStatus func(int, string)) { func TorStatusPoller(setTorStatus func(int, string)) {
for { //TODO: convert this from asaur to bine
time.Sleep(time.Second) /*
//todo: this should use a config manager for {
//todo: also, try dialing the proxy to differentiate tor not running vs control port not configured time.Sleep(time.Second)
rawStatus, err := asaur.GetInfo("localhost:9051", "tcp4", "", "status/bootstrap-phase") //todo: this should use a config manager
if err != nil { //todo: also, try dialing the proxy to differentiate tor not running vs control port not configured
setTorStatus(0, "can't find tor. is it running? is the controlport configured?") rawStatus, err := asaur.GetInfo("localhost:9051", "tcp4", "", "status/bootstrap-phase")
continue if err != nil {
setTorStatus(0, "can't find tor. is it running? is the controlport configured?")
continue
}
status := asaur.ParseBootstrapPhase(rawStatus)
progress, _ := strconv.Atoi(status["PROGRESS"])
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"])
} }
*/
status := asaur.ParseBootstrapPhase(rawStatus)
progress, _ := strconv.Atoi(status["PROGRESS"])
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"])
}
} }

View File

@ -1,18 +1,18 @@
package cwtchthings package cwtchthings
import ( import (
"cwtch.im/ui/go/cwutil"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"git.openprivacy.ca/openprivacy/libricochet-go/application" "git.openprivacy.ca/openprivacy/libricochet-go/application"
"git.openprivacy.ca/openprivacy/libricochet-go/channels" "git.openprivacy.ca/openprivacy/libricochet-go/channels"
"time" "time"
"bounce/go/the"
"bounce/go/cwutil"
"bounce/go/gobjects"
) )
type ChatChannelListener struct { type ChatChannelListener struct {
rai *application.ApplicationInstance rai *application.ApplicationInstance
ra *application.RicochetApplication ra *application.RicochetApplication
addMessage func(*gobjects.Message) addMessage func(*gobjects.Message)
acknowledged func(uint) acknowledged func(uint)
} }
@ -57,4 +57,4 @@ func (this *ChatChannelListener) ChatMessage(messageID uint32, when time.Time, m
func (this *ChatChannelListener) ChatMessageAck(messageID uint32, accepted bool) { func (this *ChatChannelListener) ChatMessageAck(messageID uint32, accepted bool) {
this.acknowledged(the.AcknowledgementIDs[messageID]) this.acknowledged(the.AcknowledgementIDs[messageID])
} }

View File

@ -8,4 +8,4 @@ type Contact struct {
Badge int Badge int
Status int Status int
Trusted bool Trusted bool
} }

View File

@ -5,4 +5,3 @@ type Letter struct {
To, Message string To, Message string
MID uint MID uint
} }

View File

@ -11,4 +11,4 @@ type Message struct {
FromMe bool FromMe bool
MessageID int MessageID int
Timestamp time.Time Timestamp time.Time
} }

View File

@ -1,26 +1,26 @@
package gothings package gothings
import ( import (
"bounce/go/constants" "cwtch.im/ui/go/constants"
"bounce/go/cwutil" "cwtch.im/ui/go/cwutil"
"cwtch.im/cwtch/model"
"cwtch.im/ui/go/characters"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"encoding/base32" "encoding/base32"
"fmt" "fmt"
"github.com/therecipe/qt/core" "github.com/therecipe/qt/core"
"log" "log"
"strings" "strings"
"time" "time"
"bounce/go/the"
"cwtch.im/cwtch/model"
"bounce/go/characters"
"bounce/go/gobjects"
) )
type GrandCentralDispatcher struct { type GrandCentralDispatcher struct {
core.QObject core.QObject
OutgoingMessages chan gobjects.Letter OutgoingMessages chan gobjects.Letter
UIState InterfaceState UIState InterfaceState
_ string `property:"currentOpenConversation"` _ string `property:"currentOpenConversation"`
_ float32 `property:"themeScale"` _ float32 `property:"themeScale"`
@ -31,16 +31,16 @@ type GrandCentralDispatcher struct {
// messages pane stuff // messages pane stuff
_ func(handle, from, displayName, message, image string, mID uint, fromMe bool, ts string) `signal:"AppendMessage"` _ func(handle, from, displayName, message, image string, mID uint, fromMe bool, ts string) `signal:"AppendMessage"`
_ func() `signal:"ClearMessages"` _ func() `signal:"ClearMessages"`
_ func() `signal:"ResetMessagePane"` _ func() `signal:"ResetMessagePane"`
_ func(mID uint) `signal:"Acknowledged"` _ func(mID uint) `signal:"Acknowledged"`
// profile-area stuff // profile-area stuff
_ func(name, onion, image string) `signal:"UpdateMyProfile"` _ func(name, onion, image string) `signal:"UpdateMyProfile"`
_ func(status int, str string) `signal:"TorStatus"` _ func(status int, str string) `signal:"TorStatus"`
// other stuff i can't ontologize atm // other stuff i can't ontologize atm
_ func(str string) `signal:"InvokePopup"` _ func(str string) `signal:"InvokePopup"`
_ func(name, server, invitation string) `signal:"SupplyGroupSettings"` _ func(name, server, invitation string) `signal:"SupplyGroupSettings"`
// signals emitted from the ui (written in go, below) // signals emitted from the ui (written in go, below)
@ -300,4 +300,4 @@ func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
the.Peer.JoinServer(server) the.Peer.JoinServer(server)
group.NewMessage = make(chan model.Message) group.NewMessage = make(chan model.Message)
go characters.CwtchListener(this.UIState.AddMessage, group.GroupID, group.NewMessage) go characters.CwtchListener(this.UIState.AddMessage, group.GroupID, group.NewMessage)
} }

View File

@ -1,10 +1,10 @@
package gothings package gothings
import ( import (
"bounce/go/constants"
"bounce/go/gobjects"
"bounce/go/the"
"cwtch.im/cwtch/model" "cwtch.im/cwtch/model"
"cwtch.im/ui/go/constants"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/the"
"encoding/base32" "encoding/base32"
"log" "log"
"strings" "strings"

View File

@ -1,9 +1,9 @@
package the package the
import ( import (
libPeer "cwtch.im/cwtch/peer"
"cwtch.im/cwtch/app" "cwtch.im/cwtch/app"
) libPeer "cwtch.im/cwtch/peer"
)
var CwtchApp app.Application var CwtchApp app.Application
var Peer libPeer.CwtchPeer var Peer libPeer.CwtchPeer

21
main.go
View File

@ -1,15 +1,19 @@
package main package main
import ( import (
"bounce/go/characters"
"bounce/go/cwutil"
"bounce/go/the"
libapp "cwtch.im/cwtch/app" libapp "cwtch.im/cwtch/app"
"cwtch.im/cwtch/model" "cwtch.im/cwtch/model"
"fmt" "cwtch.im/ui/go/characters"
"cwtch.im/ui/go/cwtchthings"
"cwtch.im/ui/go/cwutil"
"cwtch.im/ui/go/gobjects"
"cwtch.im/ui/go/gothings"
"cwtch.im/ui/go/the"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/application" "git.openprivacy.ca/openprivacy/libricochet-go/application"
"git.openprivacy.ca/openprivacy/libricochet-go/channels" "git.openprivacy.ca/openprivacy/libricochet-go/channels"
"github.com/therecipe/qt/core" "git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/quick" "github.com/therecipe/qt/quick"
"github.com/therecipe/qt/quickcontrols2" "github.com/therecipe/qt/quickcontrols2"
"github.com/therecipe/qt/widgets" "github.com/therecipe/qt/widgets"
@ -17,10 +21,6 @@ import (
"os" "os"
"os/user" "os/user"
"path" "path"
"bounce/go/cwtchthings"
"bounce/go/gothings"
"bounce/go/gobjects"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
) )
func init() { func init() {
@ -145,7 +145,6 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
the.Peer.SetApplicationInstanceFactory(aif) the.Peer.SetApplicationInstanceFactory(aif)
the.CwtchApp.LaunchPeers() the.CwtchApp.LaunchPeers()
contacts := the.Peer.GetContacts() contacts := the.Peer.GetContacts()
for i := range contacts { for i := range contacts {
contact, _ := the.Peer.GetProfile().GetContact(contacts[i]) contact, _ := the.Peer.GetProfile().GetContact(contacts[i])
@ -182,4 +181,4 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
group.Accepted, group.Accepted,
}) })
} }
} }