Unlock Profiles #4
27
lib.go
27
lib.go
|
@ -1,5 +1,5 @@
|
|||
package cwtch
|
||||
//package main
|
||||
//package cwtch
|
||||
package main
|
||||
|
||||
import "C"
|
||||
import (
|
||||
|
@ -100,8 +100,20 @@ func ACNEvents() string {
|
|||
}
|
||||
}
|
||||
|
||||
//export c_AppBusEvent
|
||||
func c_AppBusEvent() *C.char {
|
||||
return C.CString(GetAppBusEvent())
|
||||
}
|
||||
|
||||
|
||||
// GetAppBusEvent blocks until an event
|
||||
func GetAppBusEvent() string {
|
||||
select {
|
||||
case myevent := <- acnQueue.OutChan():
|
||||
return fmt.Sprintf("%v", myevent)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
event := appBusQueue.Next()
|
||||
return fmt.Sprintf("%v", event)
|
||||
}
|
||||
|
@ -184,6 +196,15 @@ func SelectProfile(onion string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
//export c_LoadProfiles
|
||||
func c_LoadProfiles(passwordPtr *C.char, passwordLen C.int) {
|
||||
LoadProfiles(C.GoStringN(passwordPtr, passwordLen))
|
||||
}
|
||||
|
||||
func LoadProfiles(pass string) {
|
||||
application.LoadProfiles(pass)
|
||||
}
|
||||
|
||||
//export c_ContactEvents
|
||||
func c_ContactEvents() *C.char {
|
||||
return C.CString(ContactEvents())
|
||||
|
@ -240,4 +261,4 @@ func GetMessages(profile, handle string, start, end int) string {
|
|||
}
|
||||
|
||||
// Leave as is, needed by ffi
|
||||
//func main() {}
|
||||
func main() {}
|
Loading…
Reference in New Issue