diff --git a/README.md b/README.md new file mode 100644 index 0000000..6003084 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Cwtch Autobindings + +## Building + + go mod download + go run generate/generate_bindings.go + make linux // alternatively windows, android, macos + +## Spec File Format + +The current Cwtch Bindings Specification is defined in [spec](./spec) + +Supported function prototypes: + + * `app ` - an application-level function, called on global `Application` + * `profile ` - a profile-level function, takes `profile` as an implicit first argument + * `json(profile) ` - a profile-level function, takes `profile` as an implicit first argument and returns a json blob that must be freed by the calling library + * `@profile-experiment `- an experimental profile-level function, takes `profile` as an implicit first argument, experiment must implement cwtch Functionality interface + * `@(json)profile-experiment ` - am experimental profile-level function, takes `profile` as an implicit first argument and returns a json blob that must be freed by the calling library, , experiment must implement cwtch Functionality interface + +Supported argument prototypes: + + * `profile` - a cwtch profile identifier + * `conversation` - a cwtch conversation identifier + * `message` - a cwtch message identifier + * `int:` - a generic integer argument (with optional name) + * `bool:` - a generic boolean argument (with optional name) + * `string:` - a generic string argument (with optional name) + +All arguments must be defined in the order they are specified by the underlying Cwtch library function. + +Other directives: + + * `import ` - includes an additional go importin the compiled lib.go (needed for experiments) + * Functions that start with `Enhanced` are automatically stripped of that prefix for their binding names e.g. `EnhancedGetMessage` generated a binding `c_GetMessage` - for certain functions Cwtch has two potential calling options `` and `Enhanced`. "Enhanced" in this case means that the response is optimised for calling by a user-facing application by e.g. directly making a number of calls under the hood and returning a json blob of the results. \ No newline at end of file diff --git a/constants/attributes.go b/constants/attributes.go index a50d7b5..5ddb9d5 100644 --- a/constants/attributes.go +++ b/constants/attributes.go @@ -1,37 +1,17 @@ package constants -const SchemaVersion = "schemaVersion" - const Name = "name" -const LastRead = "last-read" + const Picture = "picture" const DefaultProfilePicture = "defaultPicture" -const ShowBlocked = "show-blocked" + const Archived = "archived" const LastSeenTime = "lastMessageSeenTime" -const ProfileTypeV1DefaultPassword = "v1-defaultPassword" -const ProfileTypeV1Password = "v1-userPassword" - // PeerOnline stores state on if the peer believes it is online const PeerOnline = "peer-online" const PeerAutostart = "autostart" -// Description is used on server contacts, -const Description = "description" - // ConversationNotificationPolicy is the attribute label for conversations. When App NotificationPolicy is OptIn a true value here opts in const ConversationNotificationPolicy = "notification-policy" - -const StateProfilePane = "state-profile-pane" -const StateSelectedConversation = "state-selected-conversation" -const StateSelectedProfileTime = "state-selected-profile-time" - -// Settings -const BlockUnknownPeersSetting = "blockunknownpeers" -const LocaleSetting = "locale" -const ZoomSetting = "zoom" - -// App Experiments -const MessageFormattingExperiment = "message-formatting" diff --git a/constants/globals.go b/constants/globals.go index ed300fd..f4669f4 100644 --- a/constants/globals.go +++ b/constants/globals.go @@ -1,17 +1,5 @@ package constants -// We offer "un-passworded" profiles but our storage encrypts everything with a password. We need an agreed upon -// password to use in that case, that the app case use behind the scenes to password and unlock with -// https://docs.openprivacy.ca/cwtch-security-handbook/profile_encryption_and_storage.html -const DefactoPasswordForUnencryptedProfiles = "be gay do crime" - -const ( - // StatusSuccess is an event response for event.Status signifying a call succeeded - StatusSuccess = "success" - // StatusError is an event response for event.Status signifying a call failed in error, ideally accompanied by a event.Error - StatusError = "error" -) - type NotificationType string const ( diff --git a/utils/notifications.go b/utils/notifications.go index 7983892..614ccd2 100644 --- a/utils/notifications.go +++ b/utils/notifications.go @@ -4,7 +4,7 @@ import ( "cwtch.im/cwtch/app" "cwtch.im/cwtch/model" "cwtch.im/cwtch/model/attr" - "git.openprivacy.ca/cwtch.im/libcwtch-go/constants" + "git.openprivacy.ca/cwtch.im/cwtch-autobindings/constants" ) func determineNotification(ci *model.Conversation, settings app.GlobalSettings) constants.NotificationType {