All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] Updates for mmsd
@ 2021-04-10 14:13 ` Chris Talbot
  0 siblings, 0 replies; 42+ messages in thread
From: Chris Talbot @ 2021-04-10 14:13 UTC (permalink / raw)
  To: ofono, netdev, debian-on-mobile-maintainers, librem-5-dev

Hello,

I am submitting a series of patches for mmsd that I have been working
on. The patches have been successfully tested on PostmarketOS, Debian
on Mobile (Mobian), PureOS, and Fedora.

The patches fall into two catagories:
1) core fixes to mmsd to get it to work with several carriers
(including T-Mobile USA, AT&T USA, Telus Canada, and a Swedish
Carrier). 
2) A new plugin to enable mmsd functionality on Modem Manager. 

The Patches have been tested on both the Pinephone and the Librem 5,
and have been confirmed tested accross all major US carriers (as well
as several minor US carriers), Canadian carriers, French carriers, and
Swedish carriers. They been been likely tested on more carriers, but
the author can only confirm the above ones (as he has gotten positive
feedback for them).

-- 
Respectfully,
Chris Talbot


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [PATCH 7/9] Fix Draft and Sent Bugs
@ 2021-03-26 10:56 Christopher Talbot
  0 siblings, 0 replies; 42+ messages in thread
From: Christopher Talbot @ 2021-03-26 10:56 UTC (permalink / raw)
  To: netdev

This fixes some bugs related to sending MMSes:
- Makes sure "sent" has an accurate time
- Allows "Draft" to Go to "Sent" on the dbus
- Allows the time to be preserved if mmsd is closed and opened in sent
and recieved messages
---
 src/mmsutil.h |  2 ++
 src/service.c | 60 +++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/mmsutil.h b/src/mmsutil.h
index 00ecc39..ec139f1 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -120,12 +120,14 @@ struct mms_retrieve_conf {
        char *priority;
        char *msgid;
        time_t date;
+       char *datestamp;
 };
 
 struct mms_send_req {
        enum mms_message_status status;
        char *to;
        time_t date;
+       char *datestamp;
        char *content_type;
        gboolean dr;
 };
diff --git a/src/service.c b/src/service.c
index dede36d..b0c2428 100644
--- a/src/service.c
+++ b/src/service.c
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-
1301  USA
  *
  */
+#define _XOPEN_SOURCE 700
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -35,6 +36,8 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gdbus.h>
+#include <time.h>
+#include <stdio.h>
 
 #include <gweb/gweb.h>
 
@@ -129,6 +132,11 @@ static DBusConnection *connection;
 
 static guint32 transaction_id_start = 0;
 
+
+static const char *time_to_str(const time_t *t);
+void debug_print(const char* s, void* data);
+
+
 static void mms_load_settings(struct mms_service *service)
 {
        GError *error;
@@ -220,6 +228,7 @@ static void emit_msg_status_changed(const char
*path, const char *new_status)
 
        signal = dbus_message_new_signal(path, MMS_MESSAGE_INTERFACE,
                                                        "PropertyChange
d");
+                                                       
        if (signal == NULL)
                return;
 
@@ -269,6 +278,7 @@ static DBusMessage *msg_mark_read(DBusConnection
*conn,
        g_free(state);
 
        g_key_file_set_boolean(meta, "info", "read", TRUE);
+       mms->rc.status = MMS_MESSAGE_STATUS_READ;
 
        mms_store_meta_close(service->identity, mms->uuid, meta, TRUE);
 
@@ -722,6 +732,7 @@ static gboolean result_request_send_conf(struct
mms_request *request)
 
        g_key_file_set_string(meta, "info", "state", "sent");
        g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
+       request->msg->sr.status = MMS_MESSAGE_STATUS_SENT;
 
        mms_message_free(msg);
 
@@ -1047,6 +1058,7 @@ static DBusMessage *send_message(DBusConnection
*conn,
        struct mms_service *service = data;
        struct mms_request *request;
        GKeyFile *meta;
+       const char *datestr;
 
        msg = g_new0(struct mms_message, 1);
        if (msg == NULL)
@@ -1059,7 +1071,13 @@ static DBusMessage *send_message(DBusConnection
*conn,
 
        msg->sr.dr = service->use_delivery_reports;
 
-       if (send_message_get_args(dbus_msg, msg) == FALSE) {
+       time(&msg->sr.date);
+
+       datestr = time_to_str(&msg->sr.date);
+
+       msg->sr.datestamp = g_strdup(datestr);
+
+       if (send_message_get_args(dbus_msg, msg, service) == FALSE) {
                mms_debug("Invalid arguments");
 
                release_attachement_data(msg->attachments);
@@ -1099,6 +1117,7 @@ static DBusMessage *send_message(DBusConnection
*conn,
        if (meta == NULL)
                goto release_request;
 
+       g_key_file_set_string(meta, "info", "date",  msg-
>sr.datestamp);
        g_key_file_set_string(meta, "info", "state", "draft");
 
        if (service->use_delivery_reports) {
@@ -1339,10 +1358,12 @@ static gboolean load_message_from_store(const
char *service_id,
        char *state = NULL;
        gboolean read_status;
        char *data_path = NULL;
+       char *datestr = NULL;
        gboolean success = FALSE;
        gboolean tainted = FALSE;
        void *pdu;
        size_t len;
+       struct tm tm;
 
        meta = mms_store_meta_open(service_id, uuid);
        if (meta == NULL)
@@ -1354,6 +1375,13 @@ static gboolean load_message_from_store(const
char *service_id,
 
        read_status = g_key_file_get_boolean(meta, "info", "read",
NULL);
 
+       datestr = g_key_file_get_string(meta, "info", "date", NULL);
+       if (datestr != NULL) {
+               strptime(datestr, "%Y-%m-%dT%H:%M:%S%z", &tm);
+       } else {
+               mms_error("src/service.c:load_message_from_store()
There is no date stamp!");
+       }
+    
        data_path = mms_store_get_path(service_id, uuid);
        if (data_path == NULL)
                goto out;
@@ -1372,25 +1400,28 @@ static gboolean load_message_from_store(const
char *service_id,
 
        msg->uuid = g_strdup(uuid);
 
-       if (strcmp(state, "received") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF)
{
+       if (strcmp(state, "received") == 0 && msg->type ==
MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
+        msg->rc.datestamp = g_strdup(datestr);
+        msg->rc.date = mktime(&tm);
                if (read_status == TRUE)
                        msg->rc.status = MMS_MESSAGE_STATUS_READ;
                else
                        msg->rc.status = MMS_MESSAGE_STATUS_RECEIVED;
-       } else if (strcmp(state, "downloaded") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF)
{
+       } else if (strcmp(state, "downloaded") == 0 && msg->type ==
MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
                msg->rc.status = MMS_MESSAGE_STATUS_DOWNLOADED;
                if (msg->transaction_id == NULL)
                        msg->transaction_id = "";
-       } else if (strcmp(state, "sent") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
+       } else if (strcmp(state, "sent") == 0 && msg->type ==
MMS_MESSAGE_TYPE_SEND_REQ) {
+        msg->sr.datestamp = g_strdup(datestr);
+        msg->sr.date = mktime(&tm);
                msg->sr.status = MMS_MESSAGE_STATUS_SENT;
-       else if (strcmp(state, "draft") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
+    }
+       else if (strcmp(state, "draft") == 0 && msg->type ==
MMS_MESSAGE_TYPE_SEND_REQ) {
+        msg->sr.datestamp = g_strdup(datestr);
+        msg->sr.date = mktime(&tm);
                msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
-       else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
-                       msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
+    }
+       else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND && msg-
>type != MMS_MESSAGE_TYPE_DELIVERY_IND)
                goto out;
 
        success = TRUE;
@@ -1879,14 +1910,13 @@ static void
append_rc_msg_properties(DBusMessageIter *dict,
 static void append_sr_msg_properties(DBusMessageIter *dict,
                                        struct mms_message *msg)
 {
-       const char *date = time_to_str(&msg->rc.date);
        const char *status = mms_message_status_get_string(msg-
>sr.status);
 
        mms_dbus_dict_append_basic(dict, "Status",
                                        DBUS_TYPE_STRING, &status);
 
        mms_dbus_dict_append_basic(dict, "Date",
-                                       DBUS_TYPE_STRING,  &date);
+                                       DBUS_TYPE_STRING,  &msg-
>sr.datestamp);
 
        if (msg->sr.to != NULL)
                append_msg_recipients(dict, msg);
@@ -2120,6 +2150,9 @@ static gboolean result_request_notify_resp(struct
mms_request *request)
        if (meta == NULL)
                return FALSE;
 
+    const char *datestr = time_to_str(&msg->rc.date);
+    msg->rc.datestamp = g_strdup(datestr);
+    g_key_file_set_string(meta, "info", "date",  msg->rc.datestamp);
        g_key_file_set_string(meta, "info", "state", "received");
 
        mms_store_meta_close(request->service->identity,
@@ -2536,7 +2569,6 @@ void mms_service_bearer_notify(struct mms_service
*service, mms_bool_t active,
        if (active == FALSE)
                goto interface_down;
 
-
        DBG("interface %s proxy %s", interface, proxy);
 
        if (service->web != NULL) {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 42+ messages in thread
* [PATCH 7/9] Fix Draft and Sent Bugs
@ 2021-03-26 10:52 Christopher Talbot
  0 siblings, 0 replies; 42+ messages in thread
From: Christopher Talbot @ 2021-03-26 10:52 UTC (permalink / raw)
  To: netdev

This fixes some bugs related to sending MMSes:
- Makes sure "sent" has an accurate time
- Allows "Draft" to Go to "Sent" on the dbus
- Allows the time to be preserved if mmsd is closed and opened in sent
and recieved messages
---
 src/mmsutil.h |  2 ++
 src/service.c | 60 +++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/mmsutil.h b/src/mmsutil.h
index 00ecc39..ec139f1 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -120,12 +120,14 @@ struct mms_retrieve_conf {
        char *priority;
        char *msgid;
        time_t date;
+       char *datestamp;
 };
 
 struct mms_send_req {
        enum mms_message_status status;
        char *to;
        time_t date;
+       char *datestamp;
        char *content_type;
        gboolean dr;
 };
diff --git a/src/service.c b/src/service.c
index dede36d..b0c2428 100644
--- a/src/service.c
+++ b/src/service.c
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-
1301  USA
  *
  */
+#define _XOPEN_SOURCE 700
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -35,6 +36,8 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gdbus.h>
+#include <time.h>
+#include <stdio.h>
 
 #include <gweb/gweb.h>
 
@@ -129,6 +132,11 @@ static DBusConnection *connection;
 
 static guint32 transaction_id_start = 0;
 
+
+static const char *time_to_str(const time_t *t);
+void debug_print(const char* s, void* data);
+
+
 static void mms_load_settings(struct mms_service *service)
 {
        GError *error;
@@ -220,6 +228,7 @@ static void emit_msg_status_changed(const char
*path, const char *new_status)
 
        signal = dbus_message_new_signal(path, MMS_MESSAGE_INTERFACE,
                                                        "PropertyChange
d");
+                                                       
        if (signal == NULL)
                return;
 
@@ -269,6 +278,7 @@ static DBusMessage *msg_mark_read(DBusConnection
*conn,
        g_free(state);
 
        g_key_file_set_boolean(meta, "info", "read", TRUE);
+       mms->rc.status = MMS_MESSAGE_STATUS_READ;
 
        mms_store_meta_close(service->identity, mms->uuid, meta, TRUE);
 
@@ -722,6 +732,7 @@ static gboolean result_request_send_conf(struct
mms_request *request)
 
        g_key_file_set_string(meta, "info", "state", "sent");
        g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
+       request->msg->sr.status = MMS_MESSAGE_STATUS_SENT;
 
        mms_message_free(msg);
 
@@ -1047,6 +1058,7 @@ static DBusMessage *send_message(DBusConnection
*conn,
        struct mms_service *service = data;
        struct mms_request *request;
        GKeyFile *meta;
+       const char *datestr;
 
        msg = g_new0(struct mms_message, 1);
        if (msg == NULL)
@@ -1059,7 +1071,13 @@ static DBusMessage *send_message(DBusConnection
*conn,
 
        msg->sr.dr = service->use_delivery_reports;
 
-       if (send_message_get_args(dbus_msg, msg) == FALSE) {
+       time(&msg->sr.date);
+
+       datestr = time_to_str(&msg->sr.date);
+
+       msg->sr.datestamp = g_strdup(datestr);
+
+       if (send_message_get_args(dbus_msg, msg, service) == FALSE) {
                mms_debug("Invalid arguments");
 
                release_attachement_data(msg->attachments);
@@ -1099,6 +1117,7 @@ static DBusMessage *send_message(DBusConnection
*conn,
        if (meta == NULL)
                goto release_request;
 
+       g_key_file_set_string(meta, "info", "date",  msg-
>sr.datestamp);
        g_key_file_set_string(meta, "info", "state", "draft");
 
        if (service->use_delivery_reports) {
@@ -1339,10 +1358,12 @@ static gboolean load_message_from_store(const
char *service_id,
        char *state = NULL;
        gboolean read_status;
        char *data_path = NULL;
+       char *datestr = NULL;
        gboolean success = FALSE;
        gboolean tainted = FALSE;
        void *pdu;
        size_t len;
+       struct tm tm;
 
        meta = mms_store_meta_open(service_id, uuid);
        if (meta == NULL)
@@ -1354,6 +1375,13 @@ static gboolean load_message_from_store(const
char *service_id,
 
        read_status = g_key_file_get_boolean(meta, "info", "read",
NULL);
 
+       datestr = g_key_file_get_string(meta, "info", "date", NULL);
+       if (datestr != NULL) {
+               strptime(datestr, "%Y-%m-%dT%H:%M:%S%z", &tm);
+       } else {
+               mms_error("src/service.c:load_message_from_store()
There is no date stamp!");
+       }
+    
        data_path = mms_store_get_path(service_id, uuid);
        if (data_path == NULL)
                goto out;
@@ -1372,25 +1400,28 @@ static gboolean load_message_from_store(const
char *service_id,
 
        msg->uuid = g_strdup(uuid);
 
-       if (strcmp(state, "received") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF)
{
+       if (strcmp(state, "received") == 0 && msg->type ==
MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
+        msg->rc.datestamp = g_strdup(datestr);
+        msg->rc.date = mktime(&tm);
                if (read_status == TRUE)
                        msg->rc.status = MMS_MESSAGE_STATUS_READ;
                else
                        msg->rc.status = MMS_MESSAGE_STATUS_RECEIVED;
-       } else if (strcmp(state, "downloaded") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF)
{
+       } else if (strcmp(state, "downloaded") == 0 && msg->type ==
MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
                msg->rc.status = MMS_MESSAGE_STATUS_DOWNLOADED;
                if (msg->transaction_id == NULL)
                        msg->transaction_id = "";
-       } else if (strcmp(state, "sent") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
+       } else if (strcmp(state, "sent") == 0 && msg->type ==
MMS_MESSAGE_TYPE_SEND_REQ) {
+        msg->sr.datestamp = g_strdup(datestr);
+        msg->sr.date = mktime(&tm);
                msg->sr.status = MMS_MESSAGE_STATUS_SENT;
-       else if (strcmp(state, "draft") == 0
-                       && msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
+    }
+       else if (strcmp(state, "draft") == 0 && msg->type ==
MMS_MESSAGE_TYPE_SEND_REQ) {
+        msg->sr.datestamp = g_strdup(datestr);
+        msg->sr.date = mktime(&tm);
                msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
-       else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
-                       msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
+    }
+       else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND && msg-
>type != MMS_MESSAGE_TYPE_DELIVERY_IND)
                goto out;
 
        success = TRUE;
@@ -1879,14 +1910,13 @@ static void
append_rc_msg_properties(DBusMessageIter *dict,
 static void append_sr_msg_properties(DBusMessageIter *dict,
                                        struct mms_message *msg)
 {
-       const char *date = time_to_str(&msg->rc.date);
        const char *status = mms_message_status_get_string(msg-
>sr.status);
 
        mms_dbus_dict_append_basic(dict, "Status",
                                        DBUS_TYPE_STRING, &status);
 
        mms_dbus_dict_append_basic(dict, "Date",
-                                       DBUS_TYPE_STRING,  &date);
+                                       DBUS_TYPE_STRING,  &msg-
>sr.datestamp);
 
        if (msg->sr.to != NULL)
                append_msg_recipients(dict, msg);
@@ -2120,6 +2150,9 @@ static gboolean result_request_notify_resp(struct
mms_request *request)
        if (meta == NULL)
                return FALSE;
 
+    const char *datestr = time_to_str(&msg->rc.date);
+    msg->rc.datestamp = g_strdup(datestr);
+    g_key_file_set_string(meta, "info", "date",  msg->rc.datestamp);
        g_key_file_set_string(meta, "info", "state", "received");
 
        mms_store_meta_close(request->service->identity,
@@ -2536,7 +2569,6 @@ void mms_service_bearer_notify(struct mms_service
*service, mms_bool_t active,
        if (active == FALSE)
                goto interface_down;
 
-
        DBG("interface %s proxy %s", interface, proxy);
 
        if (service->web != NULL) {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 42+ messages in thread
* Patches For MMSD
@ 2021-02-25  0:39 chris
  2021-02-25  0:47 ` [PATCH 7/9] Fix Draft and Sent Bugs Christopher Talbot
  0 siblings, 1 reply; 42+ messages in thread
From: chris @ 2021-02-25  0:39 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

Hello,

I am submitting some patches for mmsd. My apoligies for the last time, I messed up the email chain on sending it. I also looked through, and I think I have fixed the errors on my Patches.

I have a total of 9 patches. The first 8 are updates to the mmsd core, and the last one is a a plugin to have mmsd work with Modem Manager.

Chris Talbot

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2021-05-18  3:56 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 14:13 [PATCH 0/9] Updates for mmsd Chris Talbot
2021-04-10 14:13 ` Chris Talbot
2021-04-10 14:17 ` [PATCH 1/9] Fix mmsd to work with T-mobile Chris Talbot
2021-04-10 14:17   ` Chris Talbot
2021-04-10 14:20   ` [PATCH 2/9] Ensure Compatibility with Telus Canada Chris Talbot
2021-04-10 14:20     ` Chris Talbot
2021-04-10 14:20     ` [PATCH 3/9] Ensure Compatibility with AT&T Chris Talbot
2021-04-10 14:20       ` Chris Talbot
2021-04-10 14:21       ` [PATCH 4/9] Fix issue if there is an empty string in encoded text Chris Talbot
2021-04-10 14:21         ` Chris Talbot
2021-04-10 14:22         ` [PATCH 5/9] Allow for a user configurable maximum attachment size Chris Talbot
2021-04-10 14:22           ` Chris Talbot
2021-04-10 14:22           ` [PATCH 6/9] Update README Chris Talbot
2021-04-10 14:22             ` Chris Talbot
2021-04-10 14:23             ` [PATCH 7/9] Fix Draft and Sent Bugs Chris Talbot
2021-04-10 14:23               ` Chris Talbot
2021-04-10 14:23               ` [PATCH 8/9] Allow Maintainer mode to compile without -WError Chris Talbot
2021-04-10 14:23                 ` Chris Talbot
2021-04-10 14:24                 ` [PATCH 9/9] Enable support for Modem Manager Chris Talbot
2021-04-10 14:24                   ` Chris Talbot
2021-04-14 18:21 ` Forking on MMSD Chris Talbot
2021-04-14 18:21   ` Chris Talbot
2021-04-14 18:30   ` [Debian-on-mobile-maintainers] " Guido Günther
2021-04-14 18:46     ` Chris Talbot
2021-04-15  9:10       ` Guido Günther
2021-04-14 18:39   ` Marius Gripsgard
2021-04-14 18:39     ` Marius Gripsgard
2021-04-14 22:09     ` Bug#985893: " Wookey
2021-04-15  0:12       ` Chris Talbot
2021-04-14 19:29   ` Pavel Machek
2021-04-14 19:29     ` Pavel Machek
2021-04-14 21:11     ` Bug#985893: " Paul Wise
     [not found]     ` <c7ffd7e4d62e5d5ed397f69be180d81588a4cfd1.camel@talbothome.com>
2021-04-14 22:58       ` Pavel Machek
2021-04-14 22:58         ` Pavel Machek
2021-04-15  0:01         ` Chris Talbot
2021-04-27  9:15           ` Pavel Machek
2021-04-27  9:15             ` Pavel Machek
2021-04-29 14:49             ` Chris Talbot
2021-05-18  3:56             ` hoangnambohung
  -- strict thread matches above, loose matches on Subject: below --
2021-03-26 10:56 [PATCH 7/9] Fix Draft and Sent Bugs Christopher Talbot
2021-03-26 10:52 Christopher Talbot
2021-02-25  0:39 Patches For MMSD chris
2021-02-25  0:47 ` [PATCH 7/9] Fix Draft and Sent Bugs Christopher Talbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.