diff --git a/lib.go b/lib.go index 478820a..c01444a 100644 --- a/lib.go +++ b/lib.go @@ -41,6 +41,12 @@ var acnQueue event.Queue var contactEventsQueue event.Queue var globalACN connectivity.ACN +// ChatMessage API currently not officially documented, see +// https://git.openprivacy.ca/cwtch.im/secure-development-handbook/issues/3 +// for latest updates for now +// +// A ChatMessage is the application-layer Cwtch message, delivered to the UI +// as serialized json. type ChatMessage struct { O int `json:"o"` D string `json:"d"` @@ -529,6 +535,9 @@ func c_SendInvitation(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char SendInvitation(profile, handle, target) } +// Send an invitation from `profileOnion` to contact `handle` (peer or group) +// asking them to add the contact `target` (also peer or group). +// For groups, the profile must already have `target` as a contact. func SendInvitation(profileOnion, handle, target string) { profile := application.GetPeer(profileOnion) ph := utils.NewPeerHelper(profile) @@ -547,14 +556,8 @@ func SendInvitation(profileOnion, handle, target string) { inviteBytes, err := json.Marshal(invite) if err != nil { log.Errorf("malformed invite: %v", err) - } else if ph.IsGroup(handle) { - groupHandler, groupHandlerErr := groups.ExperimentGate(utils.ReadGlobalSettings().Experiments) - if groupHandlerErr == nil { - groupHandler.SendMessage(profile, handle, string(inviteBytes)) - } } else { - contactHandler, _ := contact.FunctionalityGate(utils.ReadGlobalSettings().Experiments) - contactHandler.SendMessage(profile, handle, string(inviteBytes)) + SendMessage(profileOnion, handle, string(inviteBytes)) } }