Adding a Contact #115
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sorry if this is a stupid question but I am wondering how to add a contact and send a message to them using the library...
The process should be something like this but I don't see a function for it:
This is definitely non-obvious because this library is a shim between Cwtch and a UI, so it has some idiosyncratic assumptions bout how clients interact with it that we hide away in the higher level rust/go libraries.
Background - with some exceptions the UI is asynchronous so it is necessary to listen to the event bus messages to manage state (see: https://git.openprivacy.ca/cwtch.im/cwtch-ui/src/branch/trunk/lib/cwtch/cwtchNotifier.dart#L59 for an example)
Adding a Contact
This can be done using the
c_ImportBundle
where the "bundle" is a cwtch onion address. See: https://git.openprivacy.ca/cwtch.im/libcwtch-go/src/branch/trunk/lib.go#L1105This will trigger a
ContactCreated
event on the event bus which will contain the conversation id needed to send a message.(https://git.openprivacy.ca/cwtch.im/libcwtch-go/src/branch/trunk/utils/eventHandler.go#L433)
(On startup this information is currently available via the
NewPeer
message which has a list of known contacts).Also worth noting that there is an open issue which will likely change this behavior in the future: cwtch.im/cwtch-ui#403
Another note. If there is no need to use c-bindings then are direct APIs available in CwtchPeer for theses purpose: https://git.openprivacy.ca/cwtch.im/cwtch/src/branch/master/peer/profile_interface.go#L106 - though we are currently working on exposing these as part of the bindings API (per: https://docs.cwtch.im/blog/cwtch-stable-api-design)
Hope that helps - feel free to ask followups.