remove QueryACNVersion API, just do it on app launch; removed unused GetProfiles API
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
08b1b19f7a
commit
3261d18118
35
lib.go
35
lib.go
|
@ -12,7 +12,6 @@ import (
|
||||||
"cwtch.im/cwtch/peer"
|
"cwtch.im/cwtch/peer"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/constants"
|
|
||||||
contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts"
|
contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts"
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/features/groups"
|
"git.openprivacy.ca/flutter/libcwtch-go/features/groups"
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/utils"
|
"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)}))
|
application.GetPrimaryBus().Publish(event.NewEvent(utils.UpdateGlobalSettings, map[event.Field]string{event.Data: string(settingsJson)}))
|
||||||
log.Infof("libcwtch-go application launched")
|
log.Infof("libcwtch-go application launched")
|
||||||
application.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{}))
|
application.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{}))
|
||||||
|
application.QueryACNVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_ReconnectCwtchForeground
|
//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}))
|
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.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{}))
|
||||||
|
application.QueryACNVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_SendAppEvent
|
//export c_SendAppEvent
|
||||||
|
@ -314,28 +315,6 @@ type Profile struct {
|
||||||
ImagePath string `json:"imagePath"`
|
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
|
//export c_CreateProfile
|
||||||
func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_len C.int) {
|
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))
|
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)
|
return string(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated?
|
||||||
//export c_GetMessages
|
//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 {
|
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)
|
profile := C.GoStringN(profile_ptr, profile_len)
|
||||||
|
@ -597,15 +577,6 @@ func ResetTor() {
|
||||||
globalACN.Restart()
|
globalACN.Restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
//export c_QueryACNVersion
|
|
||||||
func c_QueryACNVersion() {
|
|
||||||
QueryACNVersion()
|
|
||||||
}
|
|
||||||
|
|
||||||
func QueryACNVersion() {
|
|
||||||
application.QueryACNVersion()
|
|
||||||
}
|
|
||||||
|
|
||||||
//export c_CreateGroup
|
//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) {
|
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)
|
profile := C.GoStringN(profile_ptr, profile_len)
|
||||||
|
|
Loading…
Reference in New Issue