diff --git a/lib.go b/lib.go index c2b5952..571c00a 100644 --- a/lib.go +++ b/lib.go @@ -12,7 +12,6 @@ import ( "cwtch.im/cwtch/peer" "encoding/json" "fmt" - "git.openprivacy.ca/flutter/libcwtch-go/constants" contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts" "git.openprivacy.ca/flutter/libcwtch-go/features/groups" "git.openprivacy.ca/flutter/libcwtch-go/utils" @@ -150,6 +149,7 @@ func _startCwtch(appDir string, torPath string) { application.GetPrimaryBus().Publish(event.NewEvent(utils.UpdateGlobalSettings, map[event.Field]string{event.Data: string(settingsJson)})) log.Infof("libcwtch-go application launched") application.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{})) + application.QueryACNVersion() } //export c_ReconnectCwtchForeground @@ -169,6 +169,7 @@ func ReconnectCwtchForeground() { eventHandler.Push(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: onion, event.Created: event.False})) } application.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{})) + application.QueryACNVersion() } //export c_SendAppEvent @@ -314,28 +315,6 @@ type Profile struct { ImagePath string `json:"imagePath"` } -//export c_GetProfiles -func c_GetProfiles() *C.char { - return C.CString(GetProfiles()) -} - -func GetProfiles() string { - peerList := application.ListPeers() - profiles := make([]Profile, len(peerList)) - i := 0 - for onion := range peerList { - name, _ := application.GetPeer(onion).GetAttribute(attr.GetPublicScope(constants.Name)) - profiles[i] = Profile{ - Name: name, - Onion: onion, - ImagePath: "", - } - i += 1 - } - jsonBytes, _ := json.Marshal(profiles) - return string(jsonBytes) -} - //export c_CreateProfile func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int) { CreateProfile(C.GoStringN(nick_ptr, nick_len), C.GoStringN(pass_ptr, pass_len)) @@ -519,6 +498,7 @@ func GetMessage(profileOnion, handle string, message_index int) string { return string(bytes) } +// Deprecated? //export c_GetMessages func c_GetMessages(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, start C.int, end C.int) *C.char { profile := C.GoStringN(profile_ptr, profile_len) @@ -597,15 +577,6 @@ func ResetTor() { globalACN.Restart() } -//export c_QueryACNVersion -func c_QueryACNVersion() { - QueryACNVersion() -} - -func QueryACNVersion() { - application.QueryACNVersion() -} - //export c_CreateGroup func c_CreateGroup(profile_ptr *C.char, profile_len C.int, server_ptr *C.char, server_len C.int, name_ptr *C.char, name_len C.int) { profile := C.GoStringN(profile_ptr, profile_len)