migrating to libricochet-go's new logging #4
|
@ -4,7 +4,7 @@ import (
|
|||
"cwtch.im/ui/go/gobjects"
|
||||
"cwtch.im/ui/go/the"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||
"log"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
)
|
||||
|
||||
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) {
|
||||
chatchannel, ok := channel.Handler.(*channels.ChatChannel)
|
||||
if ok {
|
||||
log.Printf("Sending packet")
|
||||
log.Debugln("Sending packet")
|
||||
the.AcknowledgementIDs[chatchannel.SendMessage(m.Message)] = m.MID
|
||||
}
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"encoding/base32"
|
||||
"fmt"
|
||||
"github.com/therecipe/qt/core"
|
||||
"log"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
@ -110,9 +110,9 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
|||
this.UIState.UpdateContact(handle)
|
||||
|
||||
if len(handle) == 32 { // LOAD GROUP
|
||||
log.Printf("LOADING GROUP %s", handle)
|
||||
log.Debugf("LOADING GROUP %s", handle)
|
||||
tl := the.Peer.GetGroup(handle).GetTimeline()
|
||||
log.Printf("messages: %d", len(tl))
|
||||
log.Debugf("messages: %d", len(tl))
|
||||
for i := range tl {
|
||||
if tl[i].PeerID == the.Peer.GetProfile().Onion {
|
||||
handle = "me"
|
||||
|
@ -159,7 +159,7 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
|
|||
}
|
||||
|
||||
func (this *GrandCentralDispatcher) requestGroupSettings() {
|
||||
log.Printf("requestGroupSettings()")
|
||||
log.Debugf("requestGroupSettings()")
|
||||
group := the.Peer.GetGroup(this.CurrentOpenConversation())
|
||||
nick, _ := group.GetAttribute("nick")
|
||||
invite, _ := the.Peer.ExportGroup(this.CurrentOpenConversation())
|
||||
|
@ -169,7 +169,7 @@ func (this *GrandCentralDispatcher) requestGroupSettings() {
|
|||
func (this *GrandCentralDispatcher) broadcast(signal string) {
|
||||
switch signal {
|
||||
default:
|
||||
log.Printf("unhandled broadcast signal: %v", signal)
|
||||
log.Debugf("unhandled broadcast signal: %v", signal)
|
||||
case "ResetMessagePane":
|
||||
this.ResetMessagePane()
|
||||
}
|
||||
|
@ -177,11 +177,11 @@ func (this *GrandCentralDispatcher) broadcast(signal string) {
|
|||
|
||||
func (this *GrandCentralDispatcher) importString(str string) {
|
||||
if len(str) < 5 {
|
||||
log.Printf("ignoring short string")
|
||||
log.Debugf("ignoring short string")
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("importing: %s\n", str)
|
||||
log.Debugf("importing: %s\n", str)
|
||||
onion := str
|
||||
name := onion
|
||||
str = strings.TrimSpace(str)
|
||||
|
@ -239,7 +239,7 @@ func (this *GrandCentralDispatcher) importString(str string) {
|
|||
|
||||
_, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion[:56]))
|
||||
if err != nil {
|
||||
log.Printf("%v", err)
|
||||
log.Debugln(err)
|
||||
this.InvokePopup("bad format. missing characters?")
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"cwtch.im/ui/go/gobjects"
|
||||
"cwtch.im/ui/go/the"
|
||||
"encoding/base32"
|
||||
"log"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) {
|
|||
|
||||
return
|
||||
} 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
|
||||
}
|
||||
|
||||
|
|
17
main.go
17
main.go
|
@ -13,11 +13,11 @@ import (
|
|||
"git.openprivacy.ca/openprivacy/libricochet-go/application"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
"github.com/therecipe/qt/core"
|
||||
"github.com/therecipe/qt/quick"
|
||||
"github.com/therecipe/qt/quickcontrols2"
|
||||
"github.com/therecipe/qt/widgets"
|
||||
"log"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
@ -98,7 +98,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
|||
|
||||
/*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so")
|
||||
if err != nil {
|
||||
log.Printf("ERROR CREATING CWTCH APP: %v", err)
|
||||
log.Errorf("ERROR CREATING CWTCH APP: %v", err)
|
||||
}
|
||||
time.Sleep(time.Second * 10)
|
||||
*/
|
||||
|
@ -106,7 +106,8 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
|||
|
||||
mn, err := connectivity.StartTor(the.CwtchDir, "")
|
||||
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)
|
||||
|
@ -114,14 +115,16 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
|||
err = the.CwtchApp.LoadProfiles("be gay do crime")
|
||||
if err != nil {
|
||||
//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 {
|
||||
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")
|
||||
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)
|
||||
} else {
|
||||
|
@ -162,7 +165,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
|||
|
||||
groups := the.Peer.GetGroups()
|
||||
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.NewMessage = make(chan model.Message)
|
||||
go characters.CwtchListener(gcd.UIState.AddMessage, groups[i], group.NewMessage)
|
||||
|
|
Reference in New Issue