base-call: no need to delete call info from the device
Call information only lives in the ModemManager logic, there is no associated date stored within the device itself. Therefore, simplify everything by assuming there is nothing to remove. Looks like this logic was implemented because it was originally based on the SMS management logic, but for SMS we do have to remove them (the stored PDU parts) from the device.
This commit is contained in:

committed by
Dan Williams

parent
9503af95e2
commit
60d42de68e
@@ -819,65 +819,6 @@ call_send_dtmf (MMBaseCall *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
|
||||||
call_delete (MMBaseCall *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
call_delete_finish (MMBaseCall *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
mm_base_call_delete_finish (MMBaseCall *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
if (MM_BASE_CALL_GET_CLASS (self)->delete_finish) {
|
|
||||||
gboolean deleted;
|
|
||||||
|
|
||||||
deleted = MM_BASE_CALL_GET_CLASS (self)->delete_finish (self, res, error);
|
|
||||||
if (deleted)
|
|
||||||
/* We do change the state of this call back to UNKNOWN */
|
|
||||||
mm_base_call_change_state (self, MM_CALL_STATE_UNKNOWN, MM_CALL_STATE_REASON_UNKNOWN);
|
|
||||||
|
|
||||||
return deleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mm_base_call_delete (MMBaseCall *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
if (MM_BASE_CALL_GET_CLASS (self)->delete &&
|
|
||||||
MM_BASE_CALL_GET_CLASS (self)->delete_finish) {
|
|
||||||
MM_BASE_CALL_GET_CLASS (self)->delete (self, callback, user_data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_task_report_new_error (self, callback, user_data, mm_base_call_delete,
|
|
||||||
MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
|
||||||
"Deleting call is not supported by this modem");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
MMBaseCall *
|
MMBaseCall *
|
||||||
mm_base_call_new (MMBaseModem *modem)
|
mm_base_call_new (MMBaseModem *modem)
|
||||||
{
|
{
|
||||||
@@ -1053,8 +994,6 @@ mm_base_call_class_init (MMBaseCallClass *klass)
|
|||||||
klass->accept_finish = call_accept_finish;
|
klass->accept_finish = call_accept_finish;
|
||||||
klass->hangup = call_hangup;
|
klass->hangup = call_hangup;
|
||||||
klass->hangup_finish = call_hangup_finish;
|
klass->hangup_finish = call_hangup_finish;
|
||||||
klass->delete = call_delete;
|
|
||||||
klass->delete_finish = call_delete_finish;
|
|
||||||
klass->send_dtmf = call_send_dtmf;
|
klass->send_dtmf = call_send_dtmf;
|
||||||
klass->send_dtmf_finish = call_send_dtmf_finish;
|
klass->send_dtmf_finish = call_send_dtmf_finish;
|
||||||
|
|
||||||
|
@@ -79,14 +79,6 @@ struct _MMBaseCallClass {
|
|||||||
gboolean (* send_dtmf_finish) (MMBaseCall *self,
|
gboolean (* send_dtmf_finish) (MMBaseCall *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/* Delete the call */
|
|
||||||
void (* delete) (MMBaseCall *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean (* delete_finish) (MMBaseCall *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GType mm_base_call_get_type (void);
|
GType mm_base_call_get_type (void);
|
||||||
@@ -106,11 +98,4 @@ void mm_base_call_change_state (MMBaseCall *self,
|
|||||||
void mm_base_call_received_dtmf (MMBaseCall *self,
|
void mm_base_call_received_dtmf (MMBaseCall *self,
|
||||||
const gchar *dtmf);
|
const gchar *dtmf);
|
||||||
|
|
||||||
void mm_base_call_delete (MMBaseCall *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean mm_base_call_delete_finish (MMBaseCall *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
#endif /* MM_BASE_CALL_H */
|
#endif /* MM_BASE_CALL_H */
|
||||||
|
@@ -207,14 +207,6 @@ mm_call_list_send_dtmf_to_active_calls (MMCallList *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
gboolean
|
|
||||||
mm_call_list_delete_call_finish (MMCallList *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
cmp_call_by_path (MMBaseCall *call,
|
cmp_call_by_path (MMBaseCall *call,
|
||||||
const gchar *path)
|
const gchar *path)
|
||||||
@@ -222,78 +214,34 @@ cmp_call_by_path (MMBaseCall *call,
|
|||||||
return g_strcmp0 (mm_base_call_get_path (call), path);
|
return g_strcmp0 (mm_base_call_get_path (call), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
gboolean
|
||||||
delete_ready (MMBaseCall *call,
|
mm_call_list_delete_call (MMCallList *self,
|
||||||
GAsyncResult *res,
|
const gchar *call_path,
|
||||||
GTask *task)
|
GError **error)
|
||||||
{
|
{
|
||||||
MMCallList *self;
|
GList *l;
|
||||||
const gchar *path;
|
MMBaseCall *call;
|
||||||
GError *error = NULL;
|
|
||||||
GList *l;
|
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
|
||||||
path = g_task_get_task_data (task);
|
|
||||||
if (!mm_base_call_delete_finish (call, res, &error)) {
|
|
||||||
/* We report the error */
|
|
||||||
g_task_return_error (task, error);
|
|
||||||
g_object_unref (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The CALL was properly deleted, we now remove it from our list */
|
|
||||||
l = g_list_find_custom (self->priv->list,
|
|
||||||
path,
|
|
||||||
(GCompareFunc)cmp_call_by_path);
|
|
||||||
if (l) {
|
|
||||||
g_object_unref (MM_BASE_CALL (l->data));
|
|
||||||
self->priv->list = g_list_delete_link (self->priv->list, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We don't need to unref the CALL any more, but we can use the
|
|
||||||
* reference we got in the method, which is the one kept alive
|
|
||||||
* during the async operation. */
|
|
||||||
mm_base_call_unexport (call);
|
|
||||||
|
|
||||||
g_signal_emit (self,
|
|
||||||
signals[SIGNAL_CALL_DELETED], 0,
|
|
||||||
path);
|
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mm_call_list_delete_call (MMCallList *self,
|
|
||||||
const gchar *call_path,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GList *l;
|
|
||||||
GTask *task;
|
|
||||||
|
|
||||||
l = g_list_find_custom (self->priv->list,
|
l = g_list_find_custom (self->priv->list,
|
||||||
(gpointer)call_path,
|
(gpointer)call_path,
|
||||||
(GCompareFunc)cmp_call_by_path);
|
(GCompareFunc)cmp_call_by_path);
|
||||||
if (!l) {
|
if (!l) {
|
||||||
g_task_report_new_error (self,
|
g_set_error (error,
|
||||||
callback,
|
MM_CORE_ERROR,
|
||||||
user_data,
|
MM_CORE_ERROR_NOT_FOUND,
|
||||||
mm_call_list_delete_call,
|
"No call found with path '%s'",
|
||||||
MM_CORE_ERROR,
|
call_path);
|
||||||
MM_CORE_ERROR_NOT_FOUND,
|
return FALSE;
|
||||||
"No CALL found with path '%s'",
|
|
||||||
call_path);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete all CALL parts */
|
call = MM_BASE_CALL (l->data);
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
mm_base_call_unexport (call);
|
||||||
g_task_set_task_data (task, g_strdup (call_path), g_free);
|
g_signal_emit (self, signals[SIGNAL_CALL_DELETED], 0, call_path);
|
||||||
|
|
||||||
mm_base_call_delete (MM_BASE_CALL (l->data),
|
g_object_unref (call);
|
||||||
(GAsyncReadyCallback)delete_ready,
|
self->priv->list = g_list_delete_link (self->priv->list, l);
|
||||||
task);
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -64,13 +64,9 @@ guint mm_call_list_get_count (MMCallList *self);
|
|||||||
void mm_call_list_add_call (MMCallList *self,
|
void mm_call_list_add_call (MMCallList *self,
|
||||||
MMBaseCall *call);
|
MMBaseCall *call);
|
||||||
|
|
||||||
void mm_call_list_delete_call (MMCallList *self,
|
gboolean mm_call_list_delete_call (MMCallList *self,
|
||||||
const gchar *call_path,
|
const gchar *call_path,
|
||||||
GAsyncReadyCallback callback,
|
GError **error);
|
||||||
gpointer user_data);
|
|
||||||
gboolean mm_call_list_delete_call_finish (MMCallList *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
MMBaseCall *mm_call_list_get_new_incoming (MMCallList *self);
|
MMBaseCall *mm_call_list_get_new_incoming (MMCallList *self);
|
||||||
MMBaseCall *mm_call_list_get_first_ringing_call (MMCallList *self);
|
MMBaseCall *mm_call_list_get_first_ringing_call (MMCallList *self);
|
||||||
|
@@ -229,21 +229,6 @@ handle_delete_context_free (HandleDeleteContext *ctx)
|
|||||||
g_free (ctx);
|
g_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_delete_ready (MMCallList *list,
|
|
||||||
GAsyncResult *res,
|
|
||||||
HandleDeleteContext *ctx)
|
|
||||||
{
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
if (!mm_call_list_delete_call_finish (list, res, &error))
|
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
|
||||||
else
|
|
||||||
mm_gdbus_modem_voice_complete_delete_call (ctx->skeleton, ctx->invocation);
|
|
||||||
|
|
||||||
handle_delete_context_free (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_delete_auth_ready (MMBaseModem *self,
|
handle_delete_auth_ready (MMBaseModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -267,7 +252,7 @@ handle_delete_auth_ready (MMBaseModem *self,
|
|||||||
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,
|
||||||
"Cannot delete CALL: device not yet enabled");
|
"Cannot delete call: device not yet enabled");
|
||||||
handle_delete_context_free (ctx);
|
handle_delete_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -279,15 +264,17 @@ handle_delete_auth_ready (MMBaseModem *self,
|
|||||||
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,
|
||||||
"Cannot delete CALL: missing CALL list");
|
"Cannot delete call: missing call list");
|
||||||
handle_delete_context_free (ctx);
|
handle_delete_context_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_call_list_delete_call (list,
|
if (!mm_call_list_delete_call (list, ctx->path, &error))
|
||||||
ctx->path,
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
(GAsyncReadyCallback)handle_delete_ready,
|
else
|
||||||
ctx);
|
mm_gdbus_modem_voice_complete_delete_call (ctx->skeleton, ctx->invocation);
|
||||||
|
|
||||||
|
handle_delete_context_free (ctx);
|
||||||
g_object_unref (list);
|
g_object_unref (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user