From a61889110118d04703b023936048b44517947516 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 21 May 2014 13:58:26 -0300 Subject: Rename backend methods for consistency. --- src/leap/bitmask/backend.py | 40 ++++++++++++++--------------- src/leap/bitmask/gui/mainwindow.py | 36 +++++++++++++------------- src/leap/bitmask/gui/preferenceswindow.py | 4 +-- src/leap/bitmask/gui/wizard.py | 4 +-- src/leap/bitmask/services/mail/conductor.py | 12 ++++----- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/leap/bitmask/backend.py b/src/leap/bitmask/backend.py index 96d0b0db..0ab7040b 100644 --- a/src/leap/bitmask/backend.py +++ b/src/leap/bitmask/backend.py @@ -1356,7 +1356,7 @@ class Backend(object): # this in two processes, the methods bellow can be changed to # send_multipart and this backend class will be really simple. - def setup_provider(self, provider): + def provider_setup(self, provider): """ Initiate the setup for a provider. @@ -1372,7 +1372,7 @@ class Backend(object): """ self._call_queue.put(("provider", "setup_provider", None, provider)) - def cancel_setup_provider(self): + def provider_cancel_setup(self): """ Cancel the ongoing setup provider (if any). """ @@ -1393,7 +1393,7 @@ class Backend(object): """ self._call_queue.put(("provider", "bootstrap", None, provider)) - def register_user(self, provider, username, password): + def user_register(self, provider, username, password): """ Register a user using the domain and password given as parameters. @@ -1412,7 +1412,7 @@ class Backend(object): self._call_queue.put(("register", "register_user", None, provider, username, password)) - def setup_eip(self, provider, skip_network=False): + def eip_setup(self, provider, skip_network=False): """ Initiate the setup for a provider @@ -1430,13 +1430,13 @@ class Backend(object): self._call_queue.put(("eip", "setup_eip", None, provider, skip_network)) - def cancel_setup_eip(self): + def eip_cancel_setup(self): """ Cancel the ongoing setup EIP (if any). """ self._call_queue.put(("eip", "cancel_setup_eip", None)) - def start_eip(self): + def eip_start(self): """ Start the EIP service. @@ -1460,7 +1460,7 @@ class Backend(object): """ self._call_queue.put(("eip", "start", None)) - def stop_eip(self, shutdown=False): + def eip_stop(self, shutdown=False): """ Stop the EIP service. @@ -1469,7 +1469,7 @@ class Backend(object): """ self._call_queue.put(("eip", "stop", None, shutdown)) - def terminate_eip(self): + def eip_terminate(self): """ Terminate the EIP service, not necessarily in a nice way. """ @@ -1521,7 +1521,7 @@ class Backend(object): self._call_queue.put(("eip", "can_start", None, domain)) - def login(self, provider, username, password): + def user_login(self, provider, username, password): """ Execute the whole authentication process for a user @@ -1543,7 +1543,7 @@ class Backend(object): self._call_queue.put(("authenticate", "login", None, provider, username, password)) - def logout(self): + def user_logout(self): """ Log out the current session. @@ -1554,13 +1554,13 @@ class Backend(object): """ self._call_queue.put(("authenticate", "logout", None)) - def cancel_login(self): + def user_cancel_login(self): """ Cancel the ongoing login (if any). """ self._call_queue.put(("authenticate", "cancel_login", None)) - def auth_change_password(self, current_password, new_password): + def user_change_password(self, current_password, new_password): """ Change the user's password. @@ -1594,7 +1594,7 @@ class Backend(object): self._call_queue.put(("soledad", "change_password", None, new_password)) - def get_logged_in_status(self): + def user_get_logged_in_status(self): """ Signal if the user is currently logged in or not. @@ -1623,7 +1623,7 @@ class Backend(object): self._call_queue.put(("soledad", "bootstrap", None, username, domain, password)) - def load_offline_soledad(self, username, password, uuid): + def soledad_load_offline(self, username, password, uuid): """ Load the soledad database in offline mode. @@ -1639,19 +1639,19 @@ class Backend(object): self._call_queue.put(("soledad", "load_offline", None, username, password, uuid)) - def cancel_soledad_bootstrap(self): + def soledad_cancel_bootstrap(self): """ Cancel the ongoing soledad bootstrapping process (if any). """ self._call_queue.put(("soledad", "cancel_bootstrap", None)) - def close_soledad(self): + def soledad_close(self): """ Close soledad database. """ self._call_queue.put(("soledad", "close", None)) - def start_smtp_service(self, full_user_id, download_if_needed=False): + def smtp_start_service(self, full_user_id, download_if_needed=False): """ Start the SMTP service. @@ -1664,7 +1664,7 @@ class Backend(object): self._call_queue.put(("mail", "start_smtp_service", None, full_user_id, download_if_needed)) - def start_imap_service(self, full_user_id, offline=False): + def imap_start_service(self, full_user_id, offline=False): """ Start the IMAP service. @@ -1676,13 +1676,13 @@ class Backend(object): self._call_queue.put(("mail", "start_imap_service", None, full_user_id, offline)) - def stop_smtp_service(self): + def smtp_stop_service(self): """ Stop the SMTP service. """ self._call_queue.put(("mail", "stop_smtp_service", None)) - def stop_imap_service(self): + def imap_stop_service(self): """ Stop imap service. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 7cc88c1f..fc4b4d75 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -653,7 +653,7 @@ class MainWindow(QtGui.QMainWindow): # If we don't want to start eip, we leave everything # initialized to quickly start it if not self._trying_to_start_eip: - self._backend.setup_eip(default_provider, skip_network=True) + self._backend.eip_setup(default_provider, skip_network=True) def _backend_can_start_eip(self): """ @@ -1167,7 +1167,7 @@ class MainWindow(QtGui.QMainWindow): """ # XXX should rename this provider, name clash. provider = self._login_widget.get_selected_provider() - self._backend.setup_provider(provider) + self._backend.provider_setup(provider) @QtCore.Slot(dict) def _load_provider_config(self, data): @@ -1261,10 +1261,10 @@ class MainWindow(QtGui.QMainWindow): Cancel the running defers to avoid app blocking. """ # XXX: Should we stop all the backend defers? - self._backend.cancel_setup_provider() - self._backend.cancel_login() - self._backend.cancel_soledad_bootstrap() - self._backend.close_soledad() + self._backend.provider_cancel_setup() + self._backend.user_cancel_login() + self._backend.soledad_cancel_bootstrap() + self._backend.soledad_close() self._soledad_started = False @@ -1273,7 +1273,7 @@ class MainWindow(QtGui.QMainWindow): """ TRIGGERS: Signaler.prov_cancelled_setup fired by - self._backend.cancel_setup_provider() + self._backend.provider_cancel_setup() This method re-enables the login widget and display a message for the cancelled operation. @@ -1299,7 +1299,7 @@ class MainWindow(QtGui.QMainWindow): self._show_hide_unsupported_services() domain = self._provider_config.get_domain() - self._backend.login(domain, username, password) + self._backend.user_login(domain, username, password) else: logger.error(data[self._backend.ERROR_KEY]) self._login_problem_provider() @@ -1402,7 +1402,7 @@ class MainWindow(QtGui.QMainWindow): # this is mostly for internal use/debug for now. logger.warning("Sorry! Log-in at least one time.") return - self._backend.load_offline_soledad(full_user_id, password, uuid) + self._backend.soledad_load_offline(full_user_id, password, uuid) else: if self._logged_user is not None: domain = self._provider_config.get_domain() @@ -1609,7 +1609,7 @@ class MainWindow(QtGui.QMainWindow): # won't try the next time. self._settings.set_autostart_eip(True) - self._backend.start_eip() + self._backend.eip_start() @QtCore.Slot() def _on_eip_connection_aborted(self): @@ -1692,7 +1692,7 @@ class MainWindow(QtGui.QMainWindow): :type abnormal: bool """ self.user_stopped_eip = True - self._backend.stop_eip() + self._backend.eip_stop() self._set_eipstatus_off(False) self._already_started_eip = False @@ -1783,7 +1783,7 @@ class MainWindow(QtGui.QMainWindow): eip_status_label = eip_status_label.format(self._eip_name) self._eip_status.set_eip_status(eip_status_label, error=True) signal = qtsigs.connection_aborted_signal - self._backend.terminate_eip() + self._backend.eip_terminate() elif exitCode != 0 or not self.user_stopped_eip: eip_status_label = self.tr("{0} finished in an unexpected manner!") @@ -1813,7 +1813,7 @@ class MainWindow(QtGui.QMainWindow): self.tr("Starting...")) domain = self._login_widget.get_selected_provider() - self._backend.setup_eip(domain) + self._backend.eip_setup(domain) self._already_started_eip = True # we want to start soledad anyway after a certain timeout if eip @@ -1910,7 +1910,7 @@ class MainWindow(QtGui.QMainWindow): # XXX: If other defers are doing authenticated stuff, this # might conflict with those. CHECK! - self._backend.logout() + self._backend.user_logout() self.logout.emit() @QtCore.Slot() @@ -2011,15 +2011,15 @@ class MainWindow(QtGui.QMainWindow): self._backend.signaler.eip_stopped.connect(eip_stopped) logger.debug('Stopping mail services') - self._backend.stop_imap_service() - self._backend.stop_smtp_service() + self._backend.imap_stop_service() + self._backend.smtp_stop_service() if self._logged_user is not None: logger.debug("Doing logout") - self._backend.logout() + self._backend.user_logout() logger.debug('Terminating vpn') - self._backend.stop_eip(shutdown=True) + self._backend.eip_stop(shutdown=True) def quit(self): """ diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 77a3994f..47011a85 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -87,7 +87,7 @@ class PreferencesWindow(QtGui.QDialog): else: self._add_configured_providers() - self._backend.get_logged_in_status() + self._backend.user_get_logged_in_status() self._select_provider_by_name(domain) @@ -207,7 +207,7 @@ class PreferencesWindow(QtGui.QDialog): return self._set_changing_password(True) - self._backend.auth_change_password(current_password, new_password) + self._backend.user_change_password(current_password, new_password) @QtCore.Slot() def _srp_change_password_ok(self): diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index 020a58e2..316b2bff 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -257,7 +257,7 @@ class Wizard(QtGui.QWizard): if ok: self._set_register_status(self.tr("Starting registration...")) - self._backend.register_user(self._domain, username, password) + self._backend.user_register(self._domain, username, password) self._username = username self._password = password else: @@ -406,7 +406,7 @@ class Wizard(QtGui.QWizard): self.ui.lblNameResolution.setPixmap(self.QUESTION_ICON) self._provider_select_defer = self._backend.\ - setup_provider(self._domain) + provider_setup(self._domain) @QtCore.Slot(bool) def _skip_provider_checks(self, skip): diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py index 87c4621e..7fc19f1c 100644 --- a/src/leap/bitmask/services/mail/conductor.py +++ b/src/leap/bitmask/services/mail/conductor.py @@ -64,7 +64,7 @@ class IMAPControl(object): """ Start imap service. """ - self._backend.start_imap_service(self.userid, flags.OFFLINE) + self._backend.imap_start_service(self.userid, flags.OFFLINE) def stop_imap_service(self): """ @@ -73,7 +73,7 @@ class IMAPControl(object): self.imap_connection.qtsigs.disconnecting_signal.emit() logger.debug('Stopping imap service.') - self._backend.stop_imap_service() + self._backend.imap_stop_service() def _handle_imap_events(self, req): """ @@ -146,14 +146,14 @@ class SMTPControl(object): :type download_if_needed: bool """ self.smtp_connection.qtsigs.connecting_signal.emit() - self._backend.start_smtp_service(self.userid, download_if_needed) + self._backend.smtp_start_service(self.userid, download_if_needed) def stop_smtp_service(self): """ Stops the SMTP service. """ self.smtp_connection.qtsigs.disconnecting_signal.emit() - self._backend.stop_smtp_service() + self._backend.smtp_stop_service() def _handle_smtp_events(self, req): """ @@ -249,8 +249,8 @@ class MailConductor(IMAPControl, SMTPControl): """ Stop the IMAP and SMTP services. """ - self.stop_imap_service() - self.stop_smtp_service() + self.imap_stop_service() + self.smtp_stop_service() def connect_mail_signals(self, widget): """ -- cgit v1.2.3