diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-10 14:31:16 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-14 07:05:23 +0200 |
commit | f0e873b26e036f3a6374ac3859987403cfc01d52 (patch) | |
tree | 0b20f7fb605de5867c52d9596d228575c0ba753f /libmm-common/mm-common-helpers.c | |
parent | 667026f0c829ba1be3d69726d7145b3ecd224dbd (diff) |
cli: new `--store-in-storage' action to be able to select where to store the SMS
Expects the storage as the enum nickname string, e.g:
"me" for MM_SMS_STORAGE_ME
or
"sm" for MM_SMS_STORAGE_SM
Diffstat (limited to 'libmm-common/mm-common-helpers.c')
-rw-r--r-- | libmm-common/mm-common-helpers.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libmm-common/mm-common-helpers.c b/libmm-common/mm-common-helpers.c index 488c771e..1115cbe5 100644 --- a/libmm-common/mm-common-helpers.c +++ b/libmm-common/mm-common-helpers.c @@ -320,7 +320,6 @@ mm_common_get_rm_protocol_from_string (const gchar *str, enum_class = G_ENUM_CLASS (g_type_class_ref (MM_TYPE_MODEM_CDMA_RM_PROTOCOL)); - for (i = 0; enum_class->values[i].value_nick; i++) { if (!g_ascii_strcasecmp (str, enum_class->values[i].value_nick)) return enum_class->values[i].value; @@ -356,6 +355,28 @@ mm_common_get_ip_type_from_string (const gchar *str, return MM_BEARER_IP_FAMILY_UNKNOWN; } +MMSmsStorage +mm_common_get_sms_storage_from_string (const gchar *str, + GError **error) +{ + GEnumClass *enum_class; + guint i; + + enum_class = G_ENUM_CLASS (g_type_class_ref (MM_TYPE_SMS_STORAGE)); + + for (i = 0; enum_class->values[i].value_nick; i++) { + if (!g_ascii_strcasecmp (str, enum_class->values[i].value_nick)) + return enum_class->values[i].value; + } + + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Couldn't match '%s' with a valid MMSmsStorage value", + str); + return MM_SMS_STORAGE_UNKNOWN; +} + GVariant * mm_common_build_bands_unknown (void) { |