Merge pull request 'Unlock Profiles' (#4) from unlock into gomobile
Reviewed-on: #4
This commit is contained in:
commit
dd9f60a9ac
27
lib.go
27
lib.go
|
@ -1,5 +1,5 @@
|
||||||
package cwtch
|
//package cwtch
|
||||||
//package main
|
package main
|
||||||
|
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
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
|
// GetAppBusEvent blocks until an event
|
||||||
func GetAppBusEvent() string {
|
func GetAppBusEvent() string {
|
||||||
|
select {
|
||||||
|
case myevent := <- acnQueue.OutChan():
|
||||||
|
return fmt.Sprintf("%v", myevent)
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
event := appBusQueue.Next()
|
event := appBusQueue.Next()
|
||||||
return fmt.Sprintf("%v", event)
|
return fmt.Sprintf("%v", event)
|
||||||
}
|
}
|
||||||
|
@ -184,6 +196,15 @@ func SelectProfile(onion string) string {
|
||||||
return ""
|
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
|
//export c_ContactEvents
|
||||||
func c_ContactEvents() *C.char {
|
func c_ContactEvents() *C.char {
|
||||||
return C.CString(ContactEvents())
|
return C.CString(ContactEvents())
|
||||||
|
@ -240,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() {}
|
Loading…
Reference in New Issue