From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/3 v2] sms: delete sent sms messages from backup
Date: Fri, 10 Dec 2010 16:16:58 -0800 [thread overview]
Message-ID: <1292026618-16816-1-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <4CFD9C64.2030609@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2772 bytes --]
---
src/sms.c | 7 +++++++
src/smsutil.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
src/smsutil.h | 5 +++++
3 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/sms.c b/src/sms.c
index e5e06db..dd4d27c 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -766,6 +766,10 @@ static void tx_finished(const struct ofono_error *error, int mr, void *data)
goto next_q;
}
+ sms_tx_backup_remove(sms->imsi, entry->id, entry->flags,
+ ofono_uuid_to_str(&entry->uuid),
+ entry->cur_pdu);
+
entry->cur_pdu += 1;
entry->retry = 0;
@@ -810,6 +814,9 @@ next_q:
message_set_state(sms, &entry->uuid, ms);
}
+ sms_tx_backup_free(sms->imsi, entry->id, entry->flags,
+ ofono_uuid_to_str(&entry->uuid));
+
tx_queue_entry_destroy(entry);
if (g_queue_peek_head(sms->txq)) {
diff --git a/src/smsutil.c b/src/smsutil.c
index 9c6596f..09da657 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -3169,6 +3169,51 @@ gboolean sms_tx_store(const char *imsi, unsigned long id, unsigned long flags,
return TRUE;
}
+void sms_tx_backup_free(const char *imsi, unsigned long id,
+ unsigned long flags, const char *uuid)
+{
+ char *path;
+ struct dirent **entries;
+ int len;
+
+ path = g_strdup_printf(SMS_TX_BACKUP_PATH_DIR,
+ imsi, id, flags, uuid);
+
+ len = scandir(path, &entries, NULL, versionsort);
+
+ if (len < 0)
+ return;
+
+ while (len--) {
+ struct dirent *dir = entries[len];
+ char *file = g_strdup_printf("%s/%s", path, dir->d_name);
+
+ unlink(file);
+
+ g_free(file);
+ g_free(entries[len]);
+ }
+
+ g_free(entries);
+
+ rmdir(path);
+
+ g_free(path);
+}
+
+void sms_tx_backup_remove(const char *imsi, unsigned long id,
+ unsigned long flags, const char *uuid,
+ guint8 seq)
+{
+ char *path;
+
+ path = g_strdup_printf(SMS_TX_BACKUP_PATH_FILE,
+ imsi, id, flags, uuid, seq);
+ unlink(path);
+
+ g_free(path);
+}
+
static inline GSList *sms_list_append(GSList *l, const struct sms *in)
{
struct sms *sms;
diff --git a/src/smsutil.h b/src/smsutil.h
index 46084ab..fa4e453 100644
--- a/src/smsutil.h
+++ b/src/smsutil.h
@@ -519,6 +519,11 @@ void status_report_assembly_expire(struct status_report_assembly *assembly,
gboolean sms_tx_store(const char *imsi, unsigned long id, unsigned long flags,
const char *uuid, struct sms *s, guint8 seq);
+void sms_tx_backup_remove(const char *imsi, unsigned long id,
+ unsigned long flags, const char *uuid,
+ guint8 seq);
+void sms_tx_backup_free(const char *imsi, unsigned long id,
+ unsigned long flags, const char *uuid);
GSList *sms_text_prepare(const char *to, const char *utf8, guint16 ref,
gboolean use_16bit,
--
1.7.2.3
next prev parent reply other threads:[~2010-12-11 0:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 22:53 [PATCH 0/3] Persist TX SMS messages Kristen Carlson Accardi
2010-11-24 22:53 ` [PATCH 1/3] sms: store pending tx pdus on disk Kristen Carlson Accardi
2010-12-07 2:38 ` Denis Kenzior
2010-12-07 22:57 ` Kristen Carlson Accardi
2010-12-08 11:01 ` Denis Kenzior
2010-12-11 0:16 ` [PATCH 1/3 v2] " Kristen Carlson Accardi
2010-12-07 13:26 ` [PATCH 1/3] " Aki Niemi
2010-11-24 22:53 ` [PATCH 2/3] sms: delete sent sms messages from backup Kristen Carlson Accardi
2010-12-07 2:31 ` Denis Kenzior
2010-12-11 0:16 ` Kristen Carlson Accardi [this message]
2010-11-24 22:53 ` [PATCH 3/3] sms: restore pending tx " Kristen Carlson Accardi
2010-12-07 2:43 ` Denis Kenzior
2010-12-11 0:17 ` [PATCH 3/3 v2] " Kristen Carlson Accardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1292026618-16816-1-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox