diff sat/bridge/bridge_constructor/bridge_template.ini @ 4037:524856bd7b19

massive refactoring to switch from camelCase to snake_case: historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a pre-PEP8 code, to use the same coding style as in Twisted. However, snake_case is more readable and it's better to follow PEP8 best practices, so it has been decided to move on full snake_case. Because Libervia has a huge codebase, this ended with a ugly mix of camelCase and snake_case. To fix that, this patch does a big refactoring by renaming every function and method (including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case. This is a massive change, and may result in some bugs.
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:54:42 +0200
parents f300d78f08f3
children 2594e1951cf7
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/bridge_template.ini	Fri Apr 07 15:18:39 2023 +0200
+++ b/sat/bridge/bridge_constructor/bridge_template.ini	Sat Apr 08 13:54:42 2023 +0200
@@ -20,7 +20,7 @@
 doc=Connection is finished or lost
 doc_param_0=%(doc_profile)s
 
-[newContact]
+[contact_new]
 type=signal
 category=core
 sig_in=sa{ss}ass
@@ -34,7 +34,7 @@
 doc_param_2=groups: Roster's groups where the contact is
 doc_param_3=%(doc_profile)s
 
-[messageNew]
+[message_new]
 type=signal
 category=core
 sig_in=sdssa{ss}a{ss}sss
@@ -54,7 +54,7 @@
   - info_type: subtype for info messages
 doc_param_8=%(doc_profile)s
 
-[messageEncryptionStarted]
+[message_encryption_started]
 type=signal
 category=core
 sig_in=sss
@@ -68,7 +68,7 @@
         - directed_devices: list or resource where session is encrypted
 doc_param_2=%(doc_profile_key)s
 
-[messageEncryptionStopped]
+[message_encryption_stopped]
 type=signal
 category=core
 sig_in=sa{ss}s
@@ -79,7 +79,7 @@
     - namespace: namespace of the encryption plugin
 doc_param_2=%(doc_profile_key)s
 
-[presenceUpdate]
+[presence_update]
 type=signal
 category=core
 sig_in=ssia{ss}s
@@ -99,7 +99,7 @@
 doc_param_1=entity_jid: JID from which the subscription is coming
 doc_param_2=%(doc_profile)s
 
-[paramUpdate]
+[param_update]
 type=signal
 category=core
 sig_in=ssss
@@ -109,7 +109,7 @@
 doc_param_2=category: Category of the updated parameter
 doc_param_3=%(doc_profile)s
 
-[contactDeleted]
+[contact_deleted]
 type=signal
 category=core
 sig_in=ss
@@ -117,7 +117,7 @@
 doc_param_0=entity_jid: JID of the contact removed from roster
 doc_param_1=%(doc_profile)s
 
-[actionNew]
+[action_new]
 type=signal
 category=core
 sig_in=a{ss}sis
@@ -137,7 +137,7 @@
 doc_param_2=%(doc_security_limit)s
 doc_param_3=%(doc_profile)s
 
-[entityDataUpdated]
+[entity_data_updated]
 type=signal
 category=core
 sig_in=ssss
@@ -147,7 +147,7 @@
 doc_param_2=value: New value
 doc_param_3=%(doc_profile)s
 
-[progressStarted]
+[progress_started]
 type=signal
 category=core
 sig_in=sa{ss}s
@@ -160,7 +160,7 @@
         C.META_TYPE_FILE: file transfer
 doc_param_2=%(doc_profile)s
 
-[progressFinished]
+[progress_finished]
 type=signal
 category=core
 sig_in=sa{ss}s
@@ -170,11 +170,11 @@
     - hash: value of the computed hash
     - hash_algo: alrorithm used to compute hash
     - hash_verified: C.BOOL_TRUE if hash is verified and OK
-        C.BOOL_FALSE if hash was not received ([progressError] will be used if there is a mismatch)
+        C.BOOL_FALSE if hash was not received ([progress_error] will be used if there is a mismatch)
     - url: url linked to the progression (e.g. download url after a file upload)
 doc_param_2=%(doc_profile)s
 
-[progressError]
+[progress_error]
 type=signal
 category=core
 sig_in=sss
@@ -194,7 +194,7 @@
 
 ;methods
 
-[getReady]
+[ready_get]
 async=
 type=method
 category=core
@@ -202,14 +202,14 @@
 sig_out=
 doc=Return when backend is initialised
 
-[getVersion]
+[version_get]
 type=method
 category=core
 sig_in=
 sig_out=s
 doc=Get "Salut à Toi" full version
 
-[getFeatures]
+[features_get]
 type=method
 category=core
 sig_in=s
@@ -221,7 +221,7 @@
  plugin import name is used as key, data is an other dict managed by the plugin
 async=
 
-[profileNameGet]
+[profile_name_get]
 type=method
 category=core
 sig_in=s
@@ -231,7 +231,7 @@
 doc_param_0=%(doc_profile_key)s
 doc_return=Real profile name
 
-[profilesListGet]
+[profiles_list_get]
 type=method
 category=core
 sig_in=bb
@@ -242,7 +242,7 @@
 doc_param_1=components: get components profiles
 doc=Get list of profiles
 
-[profileSetDefault]
+[profile_set_default]
 type=method
 category=core
 sig_in=s
@@ -250,7 +250,7 @@
 doc_param_0=%(doc_profile)s
 doc=Set default profile
 
-[getEntityData]
+[entity_data_get]
 type=method
 category=core
 sig_in=sass
@@ -262,7 +262,7 @@
 doc_return=dictionary of asked key,
  if key doesn't exist, the resulting dictionary will not have the key
 
-[getEntitiesData]
+[entities_data_get]
 type=method
 category=core
 sig_in=asass
@@ -275,7 +275,7 @@
  values are serialised
  if key doesn't exist for a jid, the resulting dictionary will not have it
 
-[profileCreate]
+[profile_create]
 async=
 type=method
 category=core
@@ -293,7 +293,7 @@
  - CancelError: profile creation canceled
  - NotFound: component entry point is not available
 
-[asyncDeleteProfile]
+[profile_delete_async]
 async=
 type=method
 category=core
@@ -325,7 +325,7 @@
         - False if the XMPP connection has been initiated (it may still fail)
     - failure if the profile authentication failed
 
-[profileStartSession]
+[profile_start_session]
 async=
 type=method
 category=core
@@ -340,7 +340,7 @@
         - True if the profile session was already started
         - False else
 
-[profileIsSessionStarted]
+[profile_is_session_started]
 type=method
 category=core
 sig_in=s
@@ -359,7 +359,7 @@
 doc=Disconnect a profile
 doc_param_0=%(doc_profile_key)s
 
-[isConnected]
+[is_connected]
 type=method
 category=core
 sig_in=s
@@ -368,7 +368,7 @@
 doc=Tell if a profile is connected
 doc_param_0=%(doc_profile_key)s
 
-[contactGet]
+[contact_get]
 async=
 type=method
 category=core
@@ -378,10 +378,10 @@
 doc=Return informations in roster about a contact
 doc_param_1=%(doc_profile_key)s
 doc_return=tuple with the following values:
- - list of attributes as in [newContact]
+ - list of attributes as in [contact_new]
  - groups where the contact is
 
-[getContacts]
+[contacts_get]
 async=
 type=method
 category=core
@@ -392,10 +392,10 @@
 doc_param_0=%(doc_profile_key)s
 doc_return=array of tuples with the following values:
  - JID of the contact
- - list of attributes as in [newContact]
+ - list of attributes as in [contact_new]
  - groups where the contact is
 
-[getContactsFromGroup]
+[contacts_get_from_group]
 type=method
 category=core
 sig_in=ss
@@ -406,7 +406,7 @@
 doc_param_1=%(doc_profile_key)s
 doc_return=array of jids
 
-[getMainResource]
+[main_resource_get]
 type=method
 category=core
 sig_in=ss
@@ -417,7 +417,7 @@
 doc_param_1=%(doc_profile_key)s
 doc_return=the resource connected of the contact with highest priority, or ""
 
-[getPresenceStatuses]
+[presence_statuses_get]
 type=method
 category=core
 sig_in=s
@@ -426,9 +426,9 @@
 doc=Return presence information of all contacts
 doc_param_0=%(doc_profile_key)s
 doc_return=Dict of presence with bare JID of contact as key, and value as follow:
- A dict where key is the resource and the value is a tuple with (show, priority, statuses) as for [presenceUpdate]
+ A dict where key is the resource and the value is a tuple with (show, priority, statuses) as for [presence_update]
 
-[getWaitingSub]
+[sub_waiting_get]
 type=method
 category=core
 sig_in=s
@@ -438,7 +438,7 @@
 doc_param_0=%(doc_profile_key)s
 doc_return=Dict where contact JID is the key, and value is the subscription type
 
-[messageSend]
+[message_send]
 async=
 type=method
 category=core
@@ -458,7 +458,7 @@
 doc_param_4=extra: (serialised) optional data that can be used by a plugin to build more specific messages 
 doc_param_5=%(doc_profile_key)s
 
-[messageEncryptionStart]
+[message_encryption_start]
 async=
 type=method
 category=core
@@ -474,7 +474,7 @@
     else a ConflictError will be raised
 doc_param_3=%(doc_profile_key)s
 
-[messageEncryptionStop]
+[message_encryption_stop]
 async=
 type=method
 category=core
@@ -484,7 +484,7 @@
 doc_param_0=to_jid: JID of the recipient (full jid if encryption must be stopped for one device only)
 doc_param_1=%(doc_profile_key)s
 
-[messageEncryptionGet]
+[message_encryption_get]
 type=method
 category=core
 sig_in=ss
@@ -499,21 +499,21 @@
     following key can be present if suitable:
         - directed_devices: list or resource where session is encrypted
 
-[encryptionNamespaceGet]
+[encryption_namespace_get]
 type=method
 category=core
 sig_in=s
 sig_out=s
 doc=Get algorithm namespace from its name
 
-[encryptionPluginsGet]
+[encryption_plugins_get]
 type=method
 category=core
 sig_in=
 sig_out=s
 doc=Retrieve registered plugins for encryption
 
-[encryptionTrustUIGet]
+[encryption_trust_ui_get]
 async=
 type=method
 category=core
@@ -525,7 +525,7 @@
 doc_param_2=%(doc_profile_key)s
 doc_return=(XMLUI) UI of the trust management
 
-[setPresence]
+[presence_set]
 type=method
 category=core
 sig_in=ssa{ss}s
@@ -536,8 +536,8 @@
 param_3_default="@DEFAULT@"
 doc=Set presence information for the profile
 doc_param_0=to_jid: the JID to who we send the presence data (emtpy string for broadcast)
-doc_param_1=show: as for [presenceUpdate]
-doc_param_2=statuses: as for [presenceUpdate]
+doc_param_1=show: as for [presence_update]
+doc_param_2=statuses: as for [presence_update]
 doc_param_3=%(doc_profile_key)s
 
 [subscription]
@@ -551,7 +551,7 @@
 doc_param_1=entity: as for [subscribe]
 doc_param_2=%(doc_profile_key)s
 
-[getConfig]
+[config_get]
 type=method
 category=core
 sig_in=ss
@@ -560,7 +560,7 @@
 doc_param_0=section: section of the configuration file (empty string for DEFAULT)
 doc_param_1=name: name of the option
 
-[setParam]
+[param_set]
 type=method
 category=core
 sig_in=sssis
@@ -574,7 +574,7 @@
 doc_param_3=%(doc_security_limit)s
 doc_param_4=%(doc_profile_key)s
 
-[getParamA]
+[param_get_a]
 type=method
 category=core
 sig_in=ssss
@@ -582,12 +582,12 @@
 param_2_default="value"
 param_3_default="@DEFAULT@"
 doc=Helper method to get a parameter's attribute *when profile is connected*
-doc_param_0=name: as for [setParam]
-doc_param_1=category: as for [setParam]
+doc_param_0=name: as for [param_set]
+doc_param_1=category: as for [param_set]
 doc_param_2=attribute: Name of the attribute
 doc_param_3=%(doc_profile_key)s
 
-[privateDataGet]
+[private_data_get]
 async=
 type=method
 category=core
@@ -599,7 +599,7 @@
 doc_param_2=%(doc_profile_key)s
 doc_return=serialised data
 
-[privateDataSet]
+[private_data_set]
 async=
 type=method
 category=core
@@ -611,7 +611,7 @@
 doc_param_2=data: serialised data
 doc_param_3=%(doc_profile_key)s
 
-[privateDataDelete]
+[private_data_delete]
 async=
 type=method
 category=core
@@ -622,7 +622,7 @@
 doc_param_1=key: key of the data to delete
 doc_param_3=%(doc_profile_key)s
 
-[asyncGetParamA]
+[param_get_a_async]
 async=
 type=method
 category=core
@@ -632,13 +632,13 @@
 param_3_default=-1
 param_4_default="@DEFAULT@"
 doc=Helper method to get a parameter's attribute
-doc_param_0=name: as for [setParam]
-doc_param_1=category: as for [setParam]
+doc_param_0=name: as for [param_set]
+doc_param_1=category: as for [param_set]
 doc_param_2=attribute: Name of the attribute
 doc_param_3=%(doc_security_limit)s
 doc_param_4=%(doc_profile_key)s
 
-[asyncGetParamsValuesFromCategory]
+[params_values_from_category_get_async]
 async=
 type=method
 category=code
@@ -649,13 +649,13 @@
 param_3_default=""
 param_4_default="@DEFAULT@"
 doc=Get "attribute" for all params of a category
-doc_param_0=category: as for [setParam]
+doc_param_0=category: as for [param_set]
 doc_param_1=%(doc_security_limit)s
 doc_param_2=app: name of the frontend requesting the parameters, or '' to get all parameters
 doc_param_3=extra: extra options/filters
 doc_param_4=%(doc_profile_key)s
 
-[getParamsUI]
+[param_ui_get]
 async=
 type=method
 category=core
@@ -671,7 +671,7 @@
 doc_param_2=extra: extra options/filters
 doc_param_3=%(doc_profile_key)s
 
-[getParamsCategories]
+[params_categories_get]
 type=method
 category=core
 sig_in=
@@ -679,7 +679,7 @@
 doc=Get all categories currently existing in parameters
 doc_return=list of categories
 
-[paramsRegisterApp]
+[params_register_app]
 type=method
 category=core
 sig_in=sis
@@ -691,7 +691,7 @@
 doc_param_1=%(doc_security_limit)s
 doc_param_2=app: name of the frontend registering the parameters
 
-[historyGet]
+[history_get]
 async=
 type=method
 category=core
@@ -712,9 +712,9 @@
     - not_types: type must not be one of those, values are separated by spaces
     - before_uid: check only message received before message with given uid
 doc_param_5=%(doc_profile)s
-doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile)
+doc_return=Ordered list (by timestamp) of data as in [message_new] (without final profile)
 
-[addContact]
+[contact_add]
 type=method
 category=core
 sig_in=ss
@@ -724,7 +724,7 @@
 doc_param_0=entity_jid: JID to add to roster
 doc_param_1=%(doc_profile_key)s
 
-[updateContact]
+[contact_update]
 type=method
 category=core
 sig_in=ssass
@@ -736,7 +736,7 @@
 doc_param_2=groups: list of group where the entity is
 doc_param_3=%(doc_profile_key)s
 
-[delContact]
+[contact_del]
 async=
 type=method
 category=core
@@ -747,7 +747,7 @@
 doc_param_0=entity_jid: JID to remove from roster
 doc_param_1=%(doc_profile_key)s
 
-[rosterResync]
+[roster_resync]
 async=
 type=method
 category=core
@@ -757,7 +757,7 @@
 doc=Do a full resynchronisation of roster with server
 doc_param_0=%(doc_profile_key)s
 
-[launchAction]
+[action_launch]
 async=
 type=method
 category=core
@@ -771,7 +771,7 @@
 doc_return=dict where key can be:
     - xmlui: a XMLUI need to be displayed
 
-[actionsGet]
+[actions_get]
 type=method
 category=core
 sig_in=s
@@ -779,9 +779,9 @@
 param_0_default="@DEFAULT@"
 doc=Get all not yet answered actions
 doc_param_0=%(doc_profile_key)s
-doc_return=list of data as for [actionNew] (without the profile)
+doc_return=list of data as for [action_new] (without the profile)
 
-[progressGet]
+[progress_get]
 type=method
 category=core
 sig_in=ss
@@ -794,7 +794,7 @@
  - size: end position (optional if not known)
  other metadata may be present
 
-[progressGetAllMetadata]
+[progress_get_all_metadata]
 type=method
 category=core
 sig_in=s
@@ -803,9 +803,9 @@
 doc_param_0=%(doc_profile)s or C.PROF_KEY_ALL for all profiles
 doc_return= a dict which map profile to progress_dict
     progress_dict map progress_id to progress_metadata
-    progress_metadata is the same dict as sent by [progressStarted]
+    progress_metadata is the same dict as sent by [progress_started]
 
-[progressGetAll]
+[progress_get_all]
 type=method
 category=core
 sig_in=s
@@ -814,9 +814,9 @@
 doc_param_0=%(doc_profile)s or C.PROF_KEY_ALL for all profiles
 doc_return= a dict which map profile to progress_dict
     progress_dict map progress_id to progress_data
-    progress_data is the same dict as returned by [progressGet]
+    progress_data is the same dict as returned by [progress_get]
 
-[menusGet]
+[menus_get]
 type=method
 category=core
 sig_in=si
@@ -832,7 +832,7 @@
  - menu_path_i18n: translated path of the menu
  - extra: extra data, like icon name
 
-[menuLaunch]
+[menu_launch]
 async=
 type=method
 category=core
@@ -847,7 +847,7 @@
 doc_return=dict where key can be:
     - xmlui: a XMLUI need to be displayed
 
-[menuHelpGet]
+[menu_help_get]
 type=method
 category=core
 sig_in=ss
@@ -858,7 +858,7 @@
 doc_param_1=language: language in which the menu should be translated (empty string for default)
 doc_return=Translated help string
 
-[discoInfos]
+[disco_infos]
 async=
 type=method
 category=core
@@ -884,7 +884,7 @@
             * desc
         - list of values
 
-[discoItems]
+[disco_items]
 async=
 type=method
 category=core
@@ -900,7 +900,7 @@
 doc_param_3=%(doc_profile_key)s
 doc_return=array of tuple (entity, node identifier, name)
 
-[discoFindByFeatures]
+[disco_find_by_features]
 async=
 type=method
 category=core
@@ -927,7 +927,7 @@
  - own entities (i.e. entities linked to profile's jid)
  - roster entities
 
-[saveParamsTemplate]
+[params_template_save]
 type=method
 category=core
 sig_in=s
@@ -936,7 +936,7 @@
 doc_param_0=filename: output filename
 doc_return=boolean (True in case of success)
 
-[loadParamsTemplate]
+[params_template_load]
 type=method
 category=core
 sig_in=s
@@ -945,7 +945,7 @@
 doc_param_0=filename: input filename
 doc_return=boolean (True in case of success)
 
-[sessionInfosGet]
+[session_infos_get]
 async=
 type=method
 category=core
@@ -957,7 +957,7 @@
     jid: current full jid
     started: date of creation of the session (Epoch time)
 
-[devicesInfosGet]
+[devices_infos_get]
 async=
 type=method
 category=core
@@ -970,7 +970,7 @@
 doc_return=list of known devices, where each item is a dict with a least following keys:
     resource: device resource
 
-[namespacesGet]
+[namespaces_get]
 type=method
 category=core
 sig_in=
@@ -978,7 +978,7 @@
 doc=Get a dict to short name => whole namespaces
 doc_return=namespaces mapping
 
-[imageCheck]
+[image_check]
 type=method
 category=core
 sig_in=s
@@ -986,7 +986,7 @@
 doc=Analyze an image a return a report
 doc_return=serialized report
 
-[imageResize]
+[image_resize]
 async=
 type=method
 category=core
@@ -999,7 +999,7 @@
 doc_return=path of the new image with desired size
     the image must be deleted once not needed anymore
 
-[imageGeneratePreview]
+[image_generate_preview]
 async=
 type=method
 category=core
@@ -1010,7 +1010,7 @@
 doc_param_1=%(doc_profile_key)s
 doc_return=path to the preview in cache
 
-[imageConvert]
+[image_convert]
 async=
 type=method
 category=core