experimenting with adding additional info to appbus events

This commit is contained in:
erinn 2021-02-03 05:22:52 -08:00
parent 5d0bcf0846
commit da1058f1a8
1 changed files with 10 additions and 10 deletions

20
lib.go
View File

@ -1,5 +1,5 @@
//package cwtch package cwtch
package main //package main
import "C" import "C"
import ( import (
@ -34,6 +34,7 @@ func c_StartCwtch(dir_c *C.char, len C.int, tor_c *C.char, torLen C.int) {
func StartCwtch(appDir string, torPath string) { func StartCwtch(appDir string, torPath string) {
log.SetLevel(log.LevelDebug) log.SetLevel(log.LevelDebug)
//log.ExcludeFromPattern("service.go")
log.Infof("Loading Cwtch Directory %v and tor path: %v", appDir, torPath) log.Infof("Loading Cwtch Directory %v and tor path: %v", appDir, torPath)
@ -108,14 +109,13 @@ func c_AppBusEvent() *C.char {
// GetAppBusEvent blocks until an event // GetAppBusEvent blocks until an event
func GetAppBusEvent() string { func GetAppBusEvent() string {
select { e := appBusQueue.Next()
case myevent := <- acnQueue.OutChan(): if e.EventType == event.NewPeer {
return fmt.Sprintf("%v", myevent) e.Data[event.ProfileName] = "orb Quen"
default: e.Data[event.Path] = "profiles/044-witch.png"
return ""
} }
event := appBusQueue.Next() ba, _ := json.Marshal(e)
return fmt.Sprintf("%v", event) return string(ba)
} }
type Profile struct { type Profile struct {
@ -261,4 +261,4 @@ func GetMessages(profile, handle string, start, end int) string {
} }
// Leave as is, needed by ffi // Leave as is, needed by ffi
func main() {} //func main() {}