summaryrefslogtreecommitdiffstats
path: root/src/message-waiting.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-08-18 22:26:34 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-08-19 18:35:07 -0500
commit99cf14efcfdc5c3a59b23e409559d0fd867842f0 (patch)
treea96af0c6a5a5327d0204e85da52b4e16b6c81b54 /src/message-waiting.c
parent43d1769ce852881d1fd7579df9a2549faec361eb (diff)
downloadofono-99cf14efcfdc5c3a59b23e409559d0fd867842f0.tar.bz2
Refine errors returned by message-waiting
If we have not initialized fully yet, return sim_not_ready error. If we couldn't read EFmbi or not able to stat EFmbdn size properly, then set mbdn_not_present to TRUE and always return not_supported error
Diffstat (limited to 'src/message-waiting.c')
-rw-r--r--src/message-waiting.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/message-waiting.c b/src/message-waiting.c
index ff7df4c9..6cfabf4d 100644
--- a/src/message-waiting.c
+++ b/src/message-waiting.c
@@ -51,6 +51,7 @@ struct ofono_message_waiting {
unsigned char efmwis_length;
unsigned char efmbdn_length;
unsigned char efmbdn_record_id[5];
+ gboolean mbdn_not_provided;
struct ofono_phone_number mailbox_number[5];
struct ofono_sim *sim;
unsigned int sim_watch;
@@ -200,7 +201,7 @@ static DBusMessage *set_mbdn(struct ofono_message_waiting *mw, int mailbox,
if (mw->efmbdn_record_id[mailbox] == 0) {
if (msg)
- return __ofono_error_failed(msg);
+ return __ofono_error_sim_not_ready(msg);
return NULL;
}
@@ -236,8 +237,11 @@ static DBusMessage *mw_set_property(DBusConnection *conn, DBusMessage *msg,
const char *name, *value;
int i;
+ if (mw->mbdn_not_provided == TRUE)
+ return __ofono_error_not_supported(msg);
+
if (mw->efmbdn_length == 0)
- return __ofono_error_busy(msg);
+ return __ofono_error_sim_not_ready(msg);
if (!dbus_message_iter_init(msg, &iter))
return __ofono_error_invalid_args(msg);
@@ -370,7 +374,8 @@ static void mw_mbdn_read_cb(int ok,
ofono_error("Unable to read mailbox dialling numbers "
"from SIM");
- mw->efmbdn_length = -1;
+ mw->efmbdn_length = 0;
+ mw->mbdn_not_provided = TRUE;
return;
}
@@ -412,7 +417,8 @@ static void mw_mbi_read_cb(int ok,
ofono_error("Unable to read mailbox identifies "
"from SIM");
- mw->efmbdn_length = -1;
+ mw->efmbdn_length = 0;
+ mw->mbdn_not_provided = TRUE;
return;
}