The final patch in this series for integrating the status report into D-Bus message state machine is added here -- don't want to resubmit the whole thing as this is still an RFC.
>From 2a22f2cb4328c54fb5cb544056541de63667588c Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez <[email protected]> Date: Mon, 28 Jun 2010 16:18:27 -0700 Subject: [PATCH] SMS: hookup status reports to message status machine When a message is waiting for a delivery report, it gets added to an special queue and it will show in D-Bus. Make it so that when the message's delivery is acknowledged, the message's status machine is updated, and thus, D-Bus signals for it are delivered. --- src/sms.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/src/sms.c b/src/sms.c index 27a3d64..bc0f80f 100644 --- a/src/sms.c +++ b/src/sms.c @@ -1148,6 +1148,21 @@ static void handle_deliver(struct ofono_sms *sms, const struct sms *incoming) g_slist_free(l); } + +static void __sms_find_destroy_by_msg_id(gpointer _sms_msg, gpointer _msg_id) +{ + unsigned msg_id = (unsigned) _msg_id; + struct tx_queue_entry *sms_msg = _sms_msg; + + if (sms_msg->msg_id != msg_id) + return; + ofono_debug("SMS: ACKED %p msg_id match %x", sms_msg, msg_id); + g_queue_remove(sms_msg->sms_mgr->tx_wfaq, sms_msg); + ofono_sms_tx_state_set(sms_msg, OFONO_SMS_TX_ST_DONE); + tx_queue_entry_destroy_free(sms_msg, NULL); +} + + static void handle_sms_status_report(struct ofono_sms *sms, const struct sms *incoming) { @@ -1159,6 +1174,9 @@ static void handle_sms_status_report(struct ofono_sms *sms, &delivered) == FALSE) return; + g_queue_foreach(sms->tx_wfaq, __sms_find_destroy_by_msg_id, + (void *) msg_id); + __ofono_history_sms_send_status(modem, msg_id, time(NULL), delivered ? OFONO_HISTORY_SMS_STATUS_DELIVERED : OFONO_HISTORY_SMS_STATUS_DELIVER_FAILED); _______________________________________________ ofono mailing list [email protected] http://lists.ofono.org/listinfo/ofono
