summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Martinsons <frederic.martinsons@unabiz.com>2023-01-01 08:40:27 +0100
committerAleksander Morgado <aleksandermj@chromium.org>2023-02-24 13:28:01 +0000
commit192c266de3035edb93656dd48a39ad5f4b8ef792 (patch)
treed4d5ae4ca6553d6ef0eaedeb96ab418fbc2288b0
parent9032debd3c17e8042cab8ae1a5f5f4311ab7553a (diff)
downloadModemManager-192c266de3035edb93656dd48a39ad5f4b8ef792.tar.gz
cli: add formating option (json and key/value) for created SMS
Fixes #657 Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com> (cherry picked from commit 766962167c99665a10825328b65bf67523d7cd3f)
-rw-r--r--cli/mmcli-modem-messaging.c4
-rw-r--r--cli/mmcli-output.c1
-rw-r--r--cli/mmcli-output.h1
3 files changed, 5 insertions, 1 deletions
diff --git a/cli/mmcli-modem-messaging.c b/cli/mmcli-modem-messaging.c
index 513c6975d..8912a2484 100644
--- a/cli/mmcli-modem-messaging.c
+++ b/cli/mmcli-modem-messaging.c
@@ -277,7 +277,9 @@ create_process_reply (MMSms *sms,
exit (EXIT_FAILURE);
}
- g_print ("Successfully created new SMS: %s\n", mm_sms_get_path (sms));
+ mmcli_output_string (MMC_F_MESSAGING_CREATED_SMS, mm_sms_get_path (sms));
+ mmcli_output_dump ();
+
g_object_unref (sms);
}
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index ef1c7cb38..2dccb201f 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -169,6 +169,7 @@ static FieldInfo field_infos[] = {
[MMC_F_TIMEZONE_LEAP_SECONDS] = { "modem.time.leap-seconds", "leap seconds", MMC_S_MODEM_TIMEZONE, },
[MMC_F_MESSAGING_SUPPORTED_STORAGES] = { "modem.messaging.supported-storages", "supported storages", MMC_S_MODEM_MESSAGING, },
[MMC_F_MESSAGING_DEFAULT_STORAGES] = { "modem.messaging.default-storages", "default storages", MMC_S_MODEM_MESSAGING, },
+ [MMC_F_MESSAGING_CREATED_SMS] = { "modem.messaging.created-sms", "created sms", MMC_S_MODEM_MESSAGING, },
[MMC_F_SIGNAL_REFRESH_RATE] = { "modem.signal.refresh.rate", "refresh rate", MMC_S_MODEM_SIGNAL, },
[MMC_F_SIGNAL_RSSI_THRESHOLD] = { "modem.signal.threshold.rssi", "rssi threshold", MMC_S_MODEM_SIGNAL, },
[MMC_F_SIGNAL_ERROR_RATE_THRESHOLD] = { "modem.signal.threshold.error-rate", "error rate threshold", MMC_S_MODEM_SIGNAL, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index efcd51af9..77c75a67b 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -179,6 +179,7 @@ typedef enum {
/* Messaging section */
MMC_F_MESSAGING_SUPPORTED_STORAGES,
MMC_F_MESSAGING_DEFAULT_STORAGES,
+ MMC_F_MESSAGING_CREATED_SMS,
/* Signal section */
MMC_F_SIGNAL_REFRESH_RATE,
MMC_F_SIGNAL_RSSI_THRESHOLD,