iface-modem-messaging: allow Delete operation during enabling/disabling

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/671
This commit is contained in:
Aleksander Morgado
2022-11-30 12:45:52 +00:00
parent f4d867cd59
commit ef6cf656f7

View File

@@ -193,7 +193,12 @@ handle_delete_auth_ready (MMBaseModem *self,
MM_IFACE_MODEM_STATE, &modem_state, MM_IFACE_MODEM_STATE, &modem_state,
NULL); NULL);
if (modem_state < MM_MODEM_STATE_ENABLED) { /* We do allow deleting SMS messages while enabling or disabling, it doesn't
* interfere with the state transition logic to do so. The main reason to allow
* this is that during modem enabling we're emitting "Added" signals before we
* reach the enabled state, and so users listening to the signal may want to
* delete the SMS message as soon as it's read. */
if (modem_state <= MM_MODEM_STATE_DISABLED) {
g_dbus_method_invocation_return_error (ctx->invocation, g_dbus_method_invocation_return_error (ctx->invocation,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_WRONG_STATE, MM_CORE_ERROR_WRONG_STATE,