forked from cwtch.im/ui
Merge branch 'logging' of dan/ui into master
This commit is contained in:
commit
6b8db197d1
|
@ -4,7 +4,7 @@ import (
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PostmanPat(messages chan gobjects.Letter) {
|
func PostmanPat(messages chan gobjects.Letter) {
|
||||||
|
@ -31,7 +31,7 @@ func andHisBlackAndWhiteCat(incomingMessages chan gobjects.Letter) {
|
||||||
connection.DoOnChannel("im.ricochet.chat", channels.Outbound, func(channel *channels.Channel) {
|
connection.DoOnChannel("im.ricochet.chat", channels.Outbound, func(channel *channels.Channel) {
|
||||||
chatchannel, ok := channel.Handler.(*channels.ChatChannel)
|
chatchannel, ok := channel.Handler.(*channels.ChatChannel)
|
||||||
if ok {
|
if ok {
|
||||||
log.Printf("Sending packet")
|
log.Debugln("Sending packet")
|
||||||
the.AcknowledgementIDs[chatchannel.SendMessage(m.Message)] = m.MID
|
the.AcknowledgementIDs[chatchannel.SendMessage(m.Message)] = m.MID
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"encoding/base32"
|
"encoding/base32"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/therecipe/qt/core"
|
"github.com/therecipe/qt/core"
|
||||||
"log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -110,9 +110,9 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
||||||
this.UIState.UpdateContact(handle)
|
this.UIState.UpdateContact(handle)
|
||||||
|
|
||||||
if len(handle) == 32 { // LOAD GROUP
|
if len(handle) == 32 { // LOAD GROUP
|
||||||
log.Printf("LOADING GROUP %s", handle)
|
log.Debugf("LOADING GROUP %s", handle)
|
||||||
tl := the.Peer.GetGroup(handle).GetTimeline()
|
tl := the.Peer.GetGroup(handle).GetTimeline()
|
||||||
log.Printf("messages: %d", len(tl))
|
log.Debugf("messages: %d", len(tl))
|
||||||
for i := range tl {
|
for i := range tl {
|
||||||
if tl[i].PeerID == the.Peer.GetProfile().Onion {
|
if tl[i].PeerID == the.Peer.GetProfile().Onion {
|
||||||
handle = "me"
|
handle = "me"
|
||||||
|
@ -159,7 +159,7 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) requestGroupSettings() {
|
func (this *GrandCentralDispatcher) requestGroupSettings() {
|
||||||
log.Printf("requestGroupSettings()")
|
log.Debugf("requestGroupSettings()")
|
||||||
group := the.Peer.GetGroup(this.CurrentOpenConversation())
|
group := the.Peer.GetGroup(this.CurrentOpenConversation())
|
||||||
nick, _ := group.GetAttribute("nick")
|
nick, _ := group.GetAttribute("nick")
|
||||||
invite, _ := the.Peer.ExportGroup(this.CurrentOpenConversation())
|
invite, _ := the.Peer.ExportGroup(this.CurrentOpenConversation())
|
||||||
|
@ -169,7 +169,7 @@ func (this *GrandCentralDispatcher) requestGroupSettings() {
|
||||||
func (this *GrandCentralDispatcher) broadcast(signal string) {
|
func (this *GrandCentralDispatcher) broadcast(signal string) {
|
||||||
switch signal {
|
switch signal {
|
||||||
default:
|
default:
|
||||||
log.Printf("unhandled broadcast signal: %v", signal)
|
log.Debugf("unhandled broadcast signal: %v", signal)
|
||||||
case "ResetMessagePane":
|
case "ResetMessagePane":
|
||||||
this.ResetMessagePane()
|
this.ResetMessagePane()
|
||||||
}
|
}
|
||||||
|
@ -177,11 +177,11 @@ func (this *GrandCentralDispatcher) broadcast(signal string) {
|
||||||
|
|
||||||
func (this *GrandCentralDispatcher) importString(str string) {
|
func (this *GrandCentralDispatcher) importString(str string) {
|
||||||
if len(str) < 5 {
|
if len(str) < 5 {
|
||||||
log.Printf("ignoring short string")
|
log.Debugf("ignoring short string")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("importing: %s\n", str)
|
log.Debugf("importing: %s\n", str)
|
||||||
onion := str
|
onion := str
|
||||||
name := onion
|
name := onion
|
||||||
str = strings.TrimSpace(str)
|
str = strings.TrimSpace(str)
|
||||||
|
@ -239,7 +239,7 @@ func (this *GrandCentralDispatcher) importString(str string) {
|
||||||
|
|
||||||
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion[:56]))
|
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion[:56]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("%v", err)
|
log.Debugln(err)
|
||||||
this.InvokePopup("bad format. missing characters?")
|
this.InvokePopup("bad format. missing characters?")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"cwtch.im/ui/go/gobjects"
|
"cwtch.im/ui/go/gobjects"
|
||||||
"cwtch.im/ui/go/the"
|
"cwtch.im/ui/go/the"
|
||||||
"encoding/base32"
|
"encoding/base32"
|
||||||
"log"
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
||||||
|
|
||||||
return
|
return
|
||||||
} else if len(c.Handle) != 56 {
|
} else if len(c.Handle) != 56 {
|
||||||
log.Printf("sorry, unable to handle AddContact(%v)", c.Handle)
|
log.Errorf("sorry, unable to handle AddContact(%v)", c.Handle)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
main.go
17
main.go
|
@ -13,11 +13,11 @@ import (
|
||||||
"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"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||||
|
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||||
"github.com/therecipe/qt/core"
|
"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"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path"
|
"path"
|
||||||
|
@ -98,7 +98,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
/*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so")
|
/*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("ERROR CREATING CWTCH APP: %v", err)
|
log.Errorf("ERROR CREATING CWTCH APP: %v", err)
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second * 10)
|
time.Sleep(time.Second * 10)
|
||||||
*/
|
*/
|
||||||
|
@ -106,7 +106,8 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
mn, err := connectivity.StartTor(the.CwtchDir, "")
|
mn, err := connectivity.StartTor(the.CwtchDir, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[!!!] Could not start Tor: %v", err)
|
log.Errorf("Could not start Tor: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
the.CwtchApp = libapp.NewApp(mn, the.CwtchDir)
|
the.CwtchApp = libapp.NewApp(mn, the.CwtchDir)
|
||||||
|
@ -114,14 +115,16 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
err = the.CwtchApp.LoadProfiles("be gay do crime")
|
err = the.CwtchApp.LoadProfiles("be gay do crime")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//TODO no more fatalfs
|
//TODO no more fatalfs
|
||||||
log.Fatalf("couldn't load profiles: %v", err)
|
log.Errorf("couldn't load profiles: %v", err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(the.CwtchApp.ListPeers()) == 0 {
|
if len(the.CwtchApp.ListPeers()) == 0 {
|
||||||
log.Printf("couldn't load your config file. attempting to create one now")
|
log.Infoln("couldn't load your config file. attempting to create one now")
|
||||||
the.Peer, err = the.CwtchApp.CreatePeer("alice", "be gay do crime")
|
the.Peer, err = the.CwtchApp.CreatePeer("alice", "be gay do crime")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("couldn't create one. is your cwtch folder writable?")
|
log.Errorf("couldn't create one. is your cwtch folder writable?")
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
the.CwtchApp.SaveProfile(the.Peer)
|
the.CwtchApp.SaveProfile(the.Peer)
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +165,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
|
|
||||||
groups := the.Peer.GetGroups()
|
groups := the.Peer.GetGroups()
|
||||||
for i := range groups {
|
for i := range groups {
|
||||||
log.Printf("adding saved group %v", groups[i])
|
log.Infof("adding saved group %v", groups[i])
|
||||||
group := the.Peer.GetGroup(groups[i])
|
group := the.Peer.GetGroup(groups[i])
|
||||||
group.NewMessage = make(chan model.Message)
|
group.NewMessage = make(chan model.Message)
|
||||||
go characters.CwtchListener(gcd.UIState.AddMessage, groups[i], group.NewMessage)
|
go characters.CwtchListener(gcd.UIState.AddMessage, groups[i], group.NewMessage)
|
||||||
|
|
Loading…
Reference in New Issue