summaryrefslogtreecommitdiffstats
path: root/src/sms.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2011-01-28 00:39:55 -0200
committerDenis Kenzior <denkenz@gmail.com>2011-01-28 16:14:12 -0600
commit8305ddf32146abb9ecbfb41c1420762c397706bb (patch)
treecdeaec24be58dd82a61a787dbff85ba6c90c5534 /src/sms.c
parent304ab32817952e91727fb115f4230a433c576ab7 (diff)
downloadofono-8305ddf32146abb9ecbfb41c1420762c397706bb.tar.bz2
sms: store pending tx pdus on disk
Based on patch from Kristen Carlson Accardi <kristen@linux.intel.com>
Diffstat (limited to 'src/sms.c')
-rw-r--r--src/sms.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sms.c b/src/sms.c
index 7224bdf5..87283d30 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -65,6 +65,7 @@ struct ofono_sms {
struct sms_assembly *assembly;
guint ref;
GQueue *txq;
+ unsigned long tx_counter;
guint tx_source;
struct ofono_message_waiting *mw;
unsigned int mw_watch;
@@ -103,6 +104,7 @@ struct tx_queue_entry {
ofono_sms_txq_submit_cb_t cb;
void *data;
ofono_destroy_func destroy;
+ unsigned long id;
};
static gboolean uuid_equal(gconstpointer v1, gconstpointer v2)
@@ -1814,6 +1816,8 @@ int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
sms->ref = sms->ref + 1;
}
+ entry->id = sms->tx_counter++;
+
g_queue_push_tail(sms->txq, entry);
if (sms->registered && g_queue_get_length(sms->txq) == 1)
@@ -1822,6 +1826,23 @@ int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
if (uuid)
memcpy(uuid, &entry->uuid, sizeof(*uuid));
+ if (flags & OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS) {
+ const char *uuid_str;
+ unsigned char i;
+
+ uuid_str = ofono_uuid_to_str(&entry->uuid);
+
+ for (i = 0; i < entry->num_pdus; i++) {
+ struct pending_pdu *pdu;
+
+ pdu = &entry->pdus[i];
+
+ sms_tx_backup_store(sms->imsi, entry->id, entry->flags,
+ uuid_str, i, pdu->pdu,
+ pdu->pdu_len, pdu->tpdu_len);
+ }
+ }
+
if (cb)
cb(sms, &entry->uuid, data);