From: Inaky Perez-Gonzalez <[email protected]>

This will ease adding later on other fields that are D-Bus specific
and needed to export SMS messages in TX transit over D-Bus.
---
 src/sms.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/sms.c b/src/sms.c
index 5f5df04..7bde919 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -90,6 +90,17 @@ struct tx_queue_entry {
        ofono_destroy_func destroy;
 };
 
+/*
+ * Encapsulate information needed to export an SMS message over D-Bus.
+ *
+ * @dbus_path: path of the object in the D-Bus
+ * @dbus_msg: message this originated at
+ */
+struct sms_msg_dbus_data {
+       char *dbus_path;
+       DBusMessage *dbus_msg;
+};
+
 static const char *sms_bearer_to_string(int bearer)
 {
        switch (bearer) {
@@ -560,7 +571,8 @@ static struct tx_queue_entry *tx_queue_entry_new(GSList 
*msg_list)
 static void send_message_cb(gboolean ok, void *data)
 {
        DBusConnection *conn = ofono_dbus_get_connection();
-       DBusMessage *msg = data;
+       struct sms_msg_dbus_data *dbus_data = data;
+       DBusMessage *msg = dbus_data->dbus_msg;
        DBusMessage *reply;
 
        if (ok)
@@ -573,9 +585,11 @@ static void send_message_cb(gboolean ok, void *data)
 
 static void send_message_destroy(void *data)
 {
-       DBusMessage *msg = data;
+       struct sms_msg_dbus_data *dbus_data = data;
+       DBusMessage *msg = dbus_data->dbus_msg;
 
        dbus_message_unref(msg);
+       g_free(dbus_data);
 }
 
 /*
@@ -590,6 +604,9 @@ static void send_message_destroy(void *data)
  * is created by tx_queue_entry_new() and g_queue_push_tail()
  * appends that entry to the SMS transmit queue. Then the tx_next()
  * function is scheduled to run to process the queue.
+ *
+ * @sms is the main SMS driver struct, @entry and @msg_list represent
+ * the current message being processed.
  */
 static DBusMessage *sms_send_message(DBusConnection *conn, DBusMessage *msg,
                                        void *data)
-- 
1.6.6.1

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to