Mercurial > libervia-backend
diff sat/bridge/dbus_bridge.py @ 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 | 60d3861e5996 |
children | 2594e1951cf7 |
line wrap: on
line diff
--- a/sat/bridge/dbus_bridge.py Fri Apr 07 15:18:39 2023 +0200 +++ b/sat/bridge/dbus_bridge.py Sat Apr 08 13:54:42 2023 +0200 @@ -30,8 +30,8 @@ log = getLogger(__name__) # Interface prefix -const_INT_PREFIX = config.getConfig( - config.parseMainConf(), +const_INT_PREFIX = config.config_get( + config.parse_main_conf(), "", "bridge_dbus_int_prefix", "org.libervia.Libervia") @@ -88,87 +88,87 @@ core_iface = DBusInterface( const_INT_PREFIX + const_CORE_SUFFIX, - Method('actionsGet', arguments='s', returns='a(a{ss}si)'), - Method('addContact', arguments='ss', returns=''), - Method('asyncDeleteProfile', arguments='s', returns=''), - Method('asyncGetParamA', arguments='sssis', returns='s'), - Method('asyncGetParamsValuesFromCategory', arguments='sisss', returns='a{ss}'), + Method('action_launch', arguments='sa{ss}s', returns='a{ss}'), + Method('actions_get', arguments='s', returns='a(a{ss}si)'), + Method('config_get', arguments='ss', returns='s'), Method('connect', arguments='ssa{ss}', returns='b'), - Method('contactGet', arguments='ss', returns='(a{ss}as)'), - Method('delContact', arguments='ss', returns=''), - Method('devicesInfosGet', arguments='ss', returns='s'), - Method('discoFindByFeatures', arguments='asa(ss)bbbbbs', returns='(a{sa(sss)}a{sa(sss)}a{sa(sss)})'), - Method('discoInfos', arguments='ssbs', returns='(asa(sss)a{sa(a{ss}as)})'), - Method('discoItems', arguments='ssbs', returns='a(sss)'), + Method('contact_add', arguments='ss', returns=''), + Method('contact_del', arguments='ss', returns=''), + Method('contact_get', arguments='ss', returns='(a{ss}as)'), + Method('contact_update', arguments='ssass', returns=''), + Method('contacts_get', arguments='s', returns='a(sa{ss}as)'), + Method('contacts_get_from_group', arguments='ss', returns='as'), + Method('devices_infos_get', arguments='ss', returns='s'), + Method('disco_find_by_features', arguments='asa(ss)bbbbbs', returns='(a{sa(sss)}a{sa(sss)}a{sa(sss)})'), + Method('disco_infos', arguments='ssbs', returns='(asa(sss)a{sa(a{ss}as)})'), + Method('disco_items', arguments='ssbs', returns='a(sss)'), Method('disconnect', arguments='s', returns=''), - Method('encryptionNamespaceGet', arguments='s', returns='s'), - Method('encryptionPluginsGet', arguments='', returns='s'), - Method('encryptionTrustUIGet', arguments='sss', returns='s'), - Method('getConfig', arguments='ss', returns='s'), - Method('getContacts', arguments='s', returns='a(sa{ss}as)'), - Method('getContactsFromGroup', arguments='ss', returns='as'), - Method('getEntitiesData', arguments='asass', returns='a{sa{ss}}'), - Method('getEntityData', arguments='sass', returns='a{ss}'), - Method('getFeatures', arguments='s', returns='a{sa{ss}}'), - Method('getMainResource', arguments='ss', returns='s'), - Method('getParamA', arguments='ssss', returns='s'), - Method('getParamsCategories', arguments='', returns='as'), - Method('getParamsUI', arguments='isss', returns='s'), - Method('getPresenceStatuses', arguments='s', returns='a{sa{s(sia{ss})}}'), - Method('getReady', arguments='', returns=''), - Method('getVersion', arguments='', returns='s'), - Method('getWaitingSub', arguments='s', returns='a{ss}'), - Method('historyGet', arguments='ssiba{ss}s', returns='a(sdssa{ss}a{ss}ss)'), - Method('imageCheck', arguments='s', returns='s'), - Method('imageConvert', arguments='ssss', returns='s'), - Method('imageGeneratePreview', arguments='ss', returns='s'), - Method('imageResize', arguments='sii', returns='s'), - Method('isConnected', arguments='s', returns='b'), - Method('launchAction', arguments='sa{ss}s', returns='a{ss}'), - Method('loadParamsTemplate', arguments='s', returns='b'), - Method('menuHelpGet', arguments='ss', returns='s'), - Method('menuLaunch', arguments='sasa{ss}is', returns='a{ss}'), - Method('menusGet', arguments='si', returns='a(ssasasa{ss})'), - Method('messageEncryptionGet', arguments='ss', returns='s'), - Method('messageEncryptionStart', arguments='ssbs', returns=''), - Method('messageEncryptionStop', arguments='ss', returns=''), - Method('messageSend', arguments='sa{ss}a{ss}sss', returns=''), - Method('namespacesGet', arguments='', returns='a{ss}'), - Method('paramsRegisterApp', arguments='sis', returns=''), - Method('privateDataDelete', arguments='sss', returns=''), - Method('privateDataGet', arguments='sss', returns='s'), - Method('privateDataSet', arguments='ssss', returns=''), - Method('profileCreate', arguments='sss', returns=''), - Method('profileIsSessionStarted', arguments='s', returns='b'), - Method('profileNameGet', arguments='s', returns='s'), - Method('profileSetDefault', arguments='s', returns=''), - Method('profileStartSession', arguments='ss', returns='b'), - Method('profilesListGet', arguments='bb', returns='as'), - Method('progressGet', arguments='ss', returns='a{ss}'), - Method('progressGetAll', arguments='s', returns='a{sa{sa{ss}}}'), - Method('progressGetAllMetadata', arguments='s', returns='a{sa{sa{ss}}}'), - Method('rosterResync', arguments='s', returns=''), - Method('saveParamsTemplate', arguments='s', returns='b'), - Method('sessionInfosGet', arguments='s', returns='a{ss}'), - Method('setParam', arguments='sssis', returns=''), - Method('setPresence', arguments='ssa{ss}s', returns=''), + Method('encryption_namespace_get', arguments='s', returns='s'), + Method('encryption_plugins_get', arguments='', returns='s'), + Method('encryption_trust_ui_get', arguments='sss', returns='s'), + Method('entities_data_get', arguments='asass', returns='a{sa{ss}}'), + Method('entity_data_get', arguments='sass', returns='a{ss}'), + Method('features_get', arguments='s', returns='a{sa{ss}}'), + Method('history_get', arguments='ssiba{ss}s', returns='a(sdssa{ss}a{ss}ss)'), + Method('image_check', arguments='s', returns='s'), + Method('image_convert', arguments='ssss', returns='s'), + Method('image_generate_preview', arguments='ss', returns='s'), + Method('image_resize', arguments='sii', returns='s'), + Method('is_connected', arguments='s', returns='b'), + Method('main_resource_get', arguments='ss', returns='s'), + Method('menu_help_get', arguments='ss', returns='s'), + Method('menu_launch', arguments='sasa{ss}is', returns='a{ss}'), + Method('menus_get', arguments='si', returns='a(ssasasa{ss})'), + Method('message_encryption_get', arguments='ss', returns='s'), + Method('message_encryption_start', arguments='ssbs', returns=''), + Method('message_encryption_stop', arguments='ss', returns=''), + Method('message_send', arguments='sa{ss}a{ss}sss', returns=''), + Method('namespaces_get', arguments='', returns='a{ss}'), + Method('param_get_a', arguments='ssss', returns='s'), + Method('param_get_a_async', arguments='sssis', returns='s'), + Method('param_set', arguments='sssis', returns=''), + Method('param_ui_get', arguments='isss', returns='s'), + Method('params_categories_get', arguments='', returns='as'), + Method('params_register_app', arguments='sis', returns=''), + Method('params_template_load', arguments='s', returns='b'), + Method('params_template_save', arguments='s', returns='b'), + Method('params_values_from_category_get_async', arguments='sisss', returns='a{ss}'), + Method('presence_set', arguments='ssa{ss}s', returns=''), + Method('presence_statuses_get', arguments='s', returns='a{sa{s(sia{ss})}}'), + Method('private_data_delete', arguments='sss', returns=''), + Method('private_data_get', arguments='sss', returns='s'), + Method('private_data_set', arguments='ssss', returns=''), + Method('profile_create', arguments='sss', returns=''), + Method('profile_delete_async', arguments='s', returns=''), + Method('profile_is_session_started', arguments='s', returns='b'), + Method('profile_name_get', arguments='s', returns='s'), + Method('profile_set_default', arguments='s', returns=''), + Method('profile_start_session', arguments='ss', returns='b'), + Method('profiles_list_get', arguments='bb', returns='as'), + Method('progress_get', arguments='ss', returns='a{ss}'), + Method('progress_get_all', arguments='s', returns='a{sa{sa{ss}}}'), + Method('progress_get_all_metadata', arguments='s', returns='a{sa{sa{ss}}}'), + Method('ready_get', arguments='', returns=''), + Method('roster_resync', arguments='s', returns=''), + Method('session_infos_get', arguments='s', returns='a{ss}'), + Method('sub_waiting_get', arguments='s', returns='a{ss}'), Method('subscription', arguments='sss', returns=''), - Method('updateContact', arguments='ssass', returns=''), + Method('version_get', arguments='', returns='s'), Signal('_debug', 'sa{ss}s'), - Signal('actionNew', 'a{ss}sis'), + Signal('action_new', 'a{ss}sis'), Signal('connected', 'ss'), - Signal('contactDeleted', 'ss'), + Signal('contact_deleted', 'ss'), + Signal('contact_new', 'sa{ss}ass'), Signal('disconnected', 's'), - Signal('entityDataUpdated', 'ssss'), - Signal('messageEncryptionStarted', 'sss'), - Signal('messageEncryptionStopped', 'sa{ss}s'), - Signal('messageNew', 'sdssa{ss}a{ss}sss'), - Signal('newContact', 'sa{ss}ass'), - Signal('paramUpdate', 'ssss'), - Signal('presenceUpdate', 'ssia{ss}s'), - Signal('progressError', 'sss'), - Signal('progressFinished', 'sa{ss}s'), - Signal('progressStarted', 'sa{ss}s'), + Signal('entity_data_updated', 'ssss'), + Signal('message_encryption_started', 'sss'), + Signal('message_encryption_stopped', 'sa{ss}s'), + Signal('message_new', 'sdssa{ss}a{ss}sss'), + Signal('param_update', 'ssss'), + Signal('presence_update', 'ssia{ss}s'), + Signal('progress_error', 'sss'), + Signal('progress_finished', 'sa{ss}s'), + Signal('progress_started', 'sa{ss}s'), Signal('subscribe', 'sss'), ) plugin_iface = DBusInterface( @@ -196,212 +196,212 @@ d.addErrback(GenericException.create_and_raise) return d - def dbus_actionsGet(self, profile_key="@DEFAULT@"): - return self._callback("actionsGet", profile_key) - - def dbus_addContact(self, entity_jid, profile_key="@DEFAULT@"): - return self._callback("addContact", entity_jid, profile_key) + def dbus_action_launch(self, callback_id, data, profile_key="@DEFAULT@"): + return self._callback("action_launch", callback_id, data, profile_key) - def dbus_asyncDeleteProfile(self, profile): - return self._callback("asyncDeleteProfile", profile) + def dbus_actions_get(self, profile_key="@DEFAULT@"): + return self._callback("actions_get", profile_key) - def dbus_asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"): - return self._callback("asyncGetParamA", name, category, attribute, security_limit, profile_key) - - def dbus_asyncGetParamsValuesFromCategory(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"): - return self._callback("asyncGetParamsValuesFromCategory", category, security_limit, app, extra, profile_key) + def dbus_config_get(self, section, name): + return self._callback("config_get", section, name) def dbus_connect(self, profile_key="@DEFAULT@", password='', options={}): return self._callback("connect", profile_key, password, options) - def dbus_contactGet(self, arg_0, profile_key="@DEFAULT@"): - return self._callback("contactGet", arg_0, profile_key) + def dbus_contact_add(self, entity_jid, profile_key="@DEFAULT@"): + return self._callback("contact_add", entity_jid, profile_key) + + def dbus_contact_del(self, entity_jid, profile_key="@DEFAULT@"): + return self._callback("contact_del", entity_jid, profile_key) - def dbus_delContact(self, entity_jid, profile_key="@DEFAULT@"): - return self._callback("delContact", entity_jid, profile_key) + def dbus_contact_get(self, arg_0, profile_key="@DEFAULT@"): + return self._callback("contact_get", arg_0, profile_key) - def dbus_devicesInfosGet(self, bare_jid, profile_key): - return self._callback("devicesInfosGet", bare_jid, profile_key) + def dbus_contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@"): + return self._callback("contact_update", entity_jid, name, groups, profile_key) + + def dbus_contacts_get(self, profile_key="@DEFAULT@"): + return self._callback("contacts_get", profile_key) - def dbus_discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"): - return self._callback("discoFindByFeatures", namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key) + def dbus_contacts_get_from_group(self, group, profile_key="@DEFAULT@"): + return self._callback("contacts_get_from_group", group, profile_key) + + def dbus_devices_infos_get(self, bare_jid, profile_key): + return self._callback("devices_infos_get", bare_jid, profile_key) - def dbus_discoInfos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): - return self._callback("discoInfos", entity_jid, node, use_cache, profile_key) + def dbus_disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"): + return self._callback("disco_find_by_features", namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key) - def dbus_discoItems(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): - return self._callback("discoItems", entity_jid, node, use_cache, profile_key) + def dbus_disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): + return self._callback("disco_infos", entity_jid, node, use_cache, profile_key) + + def dbus_disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): + return self._callback("disco_items", entity_jid, node, use_cache, profile_key) def dbus_disconnect(self, profile_key="@DEFAULT@"): return self._callback("disconnect", profile_key) - def dbus_encryptionNamespaceGet(self, arg_0): - return self._callback("encryptionNamespaceGet", arg_0) + def dbus_encryption_namespace_get(self, arg_0): + return self._callback("encryption_namespace_get", arg_0) - def dbus_encryptionPluginsGet(self, ): - return self._callback("encryptionPluginsGet", ) + def dbus_encryption_plugins_get(self, ): + return self._callback("encryption_plugins_get", ) - def dbus_encryptionTrustUIGet(self, to_jid, namespace, profile_key): - return self._callback("encryptionTrustUIGet", to_jid, namespace, profile_key) + def dbus_encryption_trust_ui_get(self, to_jid, namespace, profile_key): + return self._callback("encryption_trust_ui_get", to_jid, namespace, profile_key) - def dbus_getConfig(self, section, name): - return self._callback("getConfig", section, name) + def dbus_entities_data_get(self, jids, keys, profile): + return self._callback("entities_data_get", jids, keys, profile) - def dbus_getContacts(self, profile_key="@DEFAULT@"): - return self._callback("getContacts", profile_key) + def dbus_entity_data_get(self, jid, keys, profile): + return self._callback("entity_data_get", jid, keys, profile) - def dbus_getContactsFromGroup(self, group, profile_key="@DEFAULT@"): - return self._callback("getContactsFromGroup", group, profile_key) + def dbus_features_get(self, profile_key): + return self._callback("features_get", profile_key) - def dbus_getEntitiesData(self, jids, keys, profile): - return self._callback("getEntitiesData", jids, keys, profile) + def dbus_history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"): + return self._callback("history_get", from_jid, to_jid, limit, between, filters, profile) - def dbus_getEntityData(self, jid, keys, profile): - return self._callback("getEntityData", jid, keys, profile) + def dbus_image_check(self, arg_0): + return self._callback("image_check", arg_0) - def dbus_getFeatures(self, profile_key): - return self._callback("getFeatures", profile_key) + def dbus_image_convert(self, source, dest, arg_2, extra): + return self._callback("image_convert", source, dest, arg_2, extra) - def dbus_getMainResource(self, contact_jid, profile_key="@DEFAULT@"): - return self._callback("getMainResource", contact_jid, profile_key) + def dbus_image_generate_preview(self, image_path, profile_key): + return self._callback("image_generate_preview", image_path, profile_key) - def dbus_getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): - return self._callback("getParamA", name, category, attribute, profile_key) + def dbus_image_resize(self, image_path, width, height): + return self._callback("image_resize", image_path, width, height) - def dbus_getParamsCategories(self, ): - return self._callback("getParamsCategories", ) + def dbus_is_connected(self, profile_key="@DEFAULT@"): + return self._callback("is_connected", profile_key) - def dbus_getParamsUI(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"): - return self._callback("getParamsUI", security_limit, app, extra, profile_key) + def dbus_main_resource_get(self, contact_jid, profile_key="@DEFAULT@"): + return self._callback("main_resource_get", contact_jid, profile_key) - def dbus_getPresenceStatuses(self, profile_key="@DEFAULT@"): - return self._callback("getPresenceStatuses", profile_key) + def dbus_menu_help_get(self, menu_id, language): + return self._callback("menu_help_get", menu_id, language) - def dbus_getReady(self, ): - return self._callback("getReady", ) + def dbus_menu_launch(self, menu_type, path, data, security_limit, profile_key): + return self._callback("menu_launch", menu_type, path, data, security_limit, profile_key) - def dbus_getVersion(self, ): - return self._callback("getVersion", ) + def dbus_menus_get(self, language, security_limit): + return self._callback("menus_get", language, security_limit) - def dbus_getWaitingSub(self, profile_key="@DEFAULT@"): - return self._callback("getWaitingSub", profile_key) + def dbus_message_encryption_get(self, to_jid, profile_key): + return self._callback("message_encryption_get", to_jid, profile_key) - def dbus_historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"): - return self._callback("historyGet", from_jid, to_jid, limit, between, filters, profile) + def dbus_message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@"): + return self._callback("message_encryption_start", to_jid, namespace, replace, profile_key) - def dbus_imageCheck(self, arg_0): - return self._callback("imageCheck", arg_0) + def dbus_message_encryption_stop(self, to_jid, profile_key): + return self._callback("message_encryption_stop", to_jid, profile_key) - def dbus_imageConvert(self, source, dest, arg_2, extra): - return self._callback("imageConvert", source, dest, arg_2, extra) + def dbus_message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"): + return self._callback("message_send", to_jid, message, subject, mess_type, extra, profile_key) - def dbus_imageGeneratePreview(self, image_path, profile_key): - return self._callback("imageGeneratePreview", image_path, profile_key) + def dbus_namespaces_get(self, ): + return self._callback("namespaces_get", ) - def dbus_imageResize(self, image_path, width, height): - return self._callback("imageResize", image_path, width, height) - - def dbus_isConnected(self, profile_key="@DEFAULT@"): - return self._callback("isConnected", profile_key) + def dbus_param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): + return self._callback("param_get_a", name, category, attribute, profile_key) - def dbus_launchAction(self, callback_id, data, profile_key="@DEFAULT@"): - return self._callback("launchAction", callback_id, data, profile_key) + def dbus_param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"): + return self._callback("param_get_a_async", name, category, attribute, security_limit, profile_key) - def dbus_loadParamsTemplate(self, filename): - return self._callback("loadParamsTemplate", filename) + def dbus_param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): + return self._callback("param_set", name, value, category, security_limit, profile_key) - def dbus_menuHelpGet(self, menu_id, language): - return self._callback("menuHelpGet", menu_id, language) + def dbus_param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"): + return self._callback("param_ui_get", security_limit, app, extra, profile_key) - def dbus_menuLaunch(self, menu_type, path, data, security_limit, profile_key): - return self._callback("menuLaunch", menu_type, path, data, security_limit, profile_key) + def dbus_params_categories_get(self, ): + return self._callback("params_categories_get", ) - def dbus_menusGet(self, language, security_limit): - return self._callback("menusGet", language, security_limit) + def dbus_params_register_app(self, xml, security_limit=-1, app=''): + return self._callback("params_register_app", xml, security_limit, app) - def dbus_messageEncryptionGet(self, to_jid, profile_key): - return self._callback("messageEncryptionGet", to_jid, profile_key) + def dbus_params_template_load(self, filename): + return self._callback("params_template_load", filename) - def dbus_messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@"): - return self._callback("messageEncryptionStart", to_jid, namespace, replace, profile_key) + def dbus_params_template_save(self, filename): + return self._callback("params_template_save", filename) - def dbus_messageEncryptionStop(self, to_jid, profile_key): - return self._callback("messageEncryptionStop", to_jid, profile_key) + def dbus_params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"): + return self._callback("params_values_from_category_get_async", category, security_limit, app, extra, profile_key) - def dbus_messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"): - return self._callback("messageSend", to_jid, message, subject, mess_type, extra, profile_key) + def dbus_presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): + return self._callback("presence_set", to_jid, show, statuses, profile_key) - def dbus_namespacesGet(self, ): - return self._callback("namespacesGet", ) + def dbus_presence_statuses_get(self, profile_key="@DEFAULT@"): + return self._callback("presence_statuses_get", profile_key) - def dbus_paramsRegisterApp(self, xml, security_limit=-1, app=''): - return self._callback("paramsRegisterApp", xml, security_limit, app) + def dbus_private_data_delete(self, namespace, key, arg_2): + return self._callback("private_data_delete", namespace, key, arg_2) - def dbus_privateDataDelete(self, namespace, key, arg_2): - return self._callback("privateDataDelete", namespace, key, arg_2) - - def dbus_privateDataGet(self, namespace, key, profile_key): - return self._callback("privateDataGet", namespace, key, profile_key) + def dbus_private_data_get(self, namespace, key, profile_key): + return self._callback("private_data_get", namespace, key, profile_key) - def dbus_privateDataSet(self, namespace, key, data, profile_key): - return self._callback("privateDataSet", namespace, key, data, profile_key) + def dbus_private_data_set(self, namespace, key, data, profile_key): + return self._callback("private_data_set", namespace, key, data, profile_key) - def dbus_profileCreate(self, profile, password='', component=''): - return self._callback("profileCreate", profile, password, component) + def dbus_profile_create(self, profile, password='', component=''): + return self._callback("profile_create", profile, password, component) - def dbus_profileIsSessionStarted(self, profile_key="@DEFAULT@"): - return self._callback("profileIsSessionStarted", profile_key) + def dbus_profile_delete_async(self, profile): + return self._callback("profile_delete_async", profile) - def dbus_profileNameGet(self, profile_key="@DEFAULT@"): - return self._callback("profileNameGet", profile_key) + def dbus_profile_is_session_started(self, profile_key="@DEFAULT@"): + return self._callback("profile_is_session_started", profile_key) - def dbus_profileSetDefault(self, profile): - return self._callback("profileSetDefault", profile) + def dbus_profile_name_get(self, profile_key="@DEFAULT@"): + return self._callback("profile_name_get", profile_key) - def dbus_profileStartSession(self, password='', profile_key="@DEFAULT@"): - return self._callback("profileStartSession", password, profile_key) + def dbus_profile_set_default(self, profile): + return self._callback("profile_set_default", profile) - def dbus_profilesListGet(self, clients=True, components=False): - return self._callback("profilesListGet", clients, components) + def dbus_profile_start_session(self, password='', profile_key="@DEFAULT@"): + return self._callback("profile_start_session", password, profile_key) - def dbus_progressGet(self, id, profile): - return self._callback("progressGet", id, profile) + def dbus_profiles_list_get(self, clients=True, components=False): + return self._callback("profiles_list_get", clients, components) - def dbus_progressGetAll(self, profile): - return self._callback("progressGetAll", profile) + def dbus_progress_get(self, id, profile): + return self._callback("progress_get", id, profile) - def dbus_progressGetAllMetadata(self, profile): - return self._callback("progressGetAllMetadata", profile) + def dbus_progress_get_all(self, profile): + return self._callback("progress_get_all", profile) - def dbus_rosterResync(self, profile_key="@DEFAULT@"): - return self._callback("rosterResync", profile_key) + def dbus_progress_get_all_metadata(self, profile): + return self._callback("progress_get_all_metadata", profile) - def dbus_saveParamsTemplate(self, filename): - return self._callback("saveParamsTemplate", filename) + def dbus_ready_get(self, ): + return self._callback("ready_get", ) - def dbus_sessionInfosGet(self, profile_key): - return self._callback("sessionInfosGet", profile_key) + def dbus_roster_resync(self, profile_key="@DEFAULT@"): + return self._callback("roster_resync", profile_key) - def dbus_setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): - return self._callback("setParam", name, value, category, security_limit, profile_key) + def dbus_session_infos_get(self, profile_key): + return self._callback("session_infos_get", profile_key) - def dbus_setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): - return self._callback("setPresence", to_jid, show, statuses, profile_key) + def dbus_sub_waiting_get(self, profile_key="@DEFAULT@"): + return self._callback("sub_waiting_get", profile_key) def dbus_subscription(self, sub_type, entity, profile_key="@DEFAULT@"): return self._callback("subscription", sub_type, entity, profile_key) - def dbus_updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@"): - return self._callback("updateContact", entity_jid, name, groups, profile_key) + def dbus_version_get(self, ): + return self._callback("version_get", ) -class Bridge: +class bridge: def __init__(self): log.info("Init DBus...") self._obj = DBusObject(const_OBJ_PATH) - async def postInit(self): + async def post_init(self): try: conn = await client.connect(reactor) except error.DBusException as e: @@ -420,47 +420,47 @@ def _debug(self, action, params, profile): self._obj.emitSignal("_debug", action, params, profile) - def actionNew(self, action_data, id, security_limit, profile): - self._obj.emitSignal("actionNew", action_data, id, security_limit, profile) + def action_new(self, action_data, id, security_limit, profile): + self._obj.emitSignal("action_new", action_data, id, security_limit, profile) def connected(self, jid_s, profile): self._obj.emitSignal("connected", jid_s, profile) - def contactDeleted(self, entity_jid, profile): - self._obj.emitSignal("contactDeleted", entity_jid, profile) + def contact_deleted(self, entity_jid, profile): + self._obj.emitSignal("contact_deleted", entity_jid, profile) + + def contact_new(self, contact_jid, attributes, groups, profile): + self._obj.emitSignal("contact_new", contact_jid, attributes, groups, profile) def disconnected(self, profile): self._obj.emitSignal("disconnected", profile) - def entityDataUpdated(self, jid, name, value, profile): - self._obj.emitSignal("entityDataUpdated", jid, name, value, profile) + def entity_data_updated(self, jid, name, value, profile): + self._obj.emitSignal("entity_data_updated", jid, name, value, profile) - def messageEncryptionStarted(self, to_jid, encryption_data, profile_key): - self._obj.emitSignal("messageEncryptionStarted", to_jid, encryption_data, profile_key) + def message_encryption_started(self, to_jid, encryption_data, profile_key): + self._obj.emitSignal("message_encryption_started", to_jid, encryption_data, profile_key) - def messageEncryptionStopped(self, to_jid, encryption_data, profile_key): - self._obj.emitSignal("messageEncryptionStopped", to_jid, encryption_data, profile_key) + def message_encryption_stopped(self, to_jid, encryption_data, profile_key): + self._obj.emitSignal("message_encryption_stopped", to_jid, encryption_data, profile_key) - def messageNew(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile): - self._obj.emitSignal("messageNew", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile) - - def newContact(self, contact_jid, attributes, groups, profile): - self._obj.emitSignal("newContact", contact_jid, attributes, groups, profile) + def message_new(self, uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile): + self._obj.emitSignal("message_new", uid, timestamp, from_jid, to_jid, message, subject, mess_type, extra, profile) - def paramUpdate(self, name, value, category, profile): - self._obj.emitSignal("paramUpdate", name, value, category, profile) + def param_update(self, name, value, category, profile): + self._obj.emitSignal("param_update", name, value, category, profile) - def presenceUpdate(self, entity_jid, show, priority, statuses, profile): - self._obj.emitSignal("presenceUpdate", entity_jid, show, priority, statuses, profile) + def presence_update(self, entity_jid, show, priority, statuses, profile): + self._obj.emitSignal("presence_update", entity_jid, show, priority, statuses, profile) - def progressError(self, id, error, profile): - self._obj.emitSignal("progressError", id, error, profile) + def progress_error(self, id, error, profile): + self._obj.emitSignal("progress_error", id, error, profile) - def progressFinished(self, id, metadata, profile): - self._obj.emitSignal("progressFinished", id, metadata, profile) + def progress_finished(self, id, metadata, profile): + self._obj.emitSignal("progress_finished", id, metadata, profile) - def progressStarted(self, id, metadata, profile): - self._obj.emitSignal("progressStarted", id, metadata, profile) + def progress_started(self, id, metadata, profile): + self._obj.emitSignal("progress_started", id, metadata, profile) def subscribe(self, sub_type, entity_jid, profile): self._obj.emitSignal("subscribe", sub_type, entity_jid, profile) @@ -469,13 +469,13 @@ log.debug(f"registering DBus bridge method [{name}]") self._obj.register_method(name, callback) - def emitSignal(self, name, *args): + def emit_signal(self, name, *args): self._obj.emitSignal(name, *args) - def addMethod( + def add_method( self, name, int_suffix, in_sign, out_sign, method, async_=False, doc={} ): - """Dynamically add a method to D-Bus Bridge""" + """Dynamically add a method to D-Bus bridge""" # FIXME: doc parameter is kept only temporary, the time to remove it from calls log.debug(f"Adding method {name!r} to D-Bus bridge") self._obj.plugin_iface.addMethod( @@ -488,8 +488,8 @@ setattr(self._obj, f"dbus_{name}", MethodType(caller, self._obj)) self.register_method(name, method) - def addSignal(self, name, int_suffix, signature, doc={}): - """Dynamically add a signal to D-Bus Bridge""" + def add_signal(self, name, int_suffix, signature, doc={}): + """Dynamically add a signal to D-Bus bridge""" log.debug(f"Adding signal {name!r} to D-Bus bridge") self._obj.plugin_iface.addSignal(Signal(name, signature)) - setattr(Bridge, name, partialmethod(Bridge.emitSignal, name)) \ No newline at end of file + setattr(bridge, name, partialmethod(bridge.emit_signal, name)) \ No newline at end of file