Commit d5184410 authored by Guido Gunther's avatar Guido Gunther
Browse files

Rediff patches

Add mm-chat-Add-API-to-update-db-thread-members.patch: <REASON>
Add mm-account-Refresh-chat-when-modem-is-ready.patch: <REASON>
parent 18b4f705
Pipeline #70907 passed with stages
in 4 minutes and 52 seconds
From 11dcec42b1b1552384e8546ee9af3feebad05187 Mon Sep 17 00:00:00 2001
From: Mohammed Sadiq <sadiq@sadiqpk.org>
Date: Mon, 6 Sep 2021 21:26:10 +0530
Subject: [PATCH] mm-account: Fix matching chats without proper number
......@@ -14,7 +13,7 @@ So fix it by comparing the right variables
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/users/chatty-mm-account.c b/src/users/chatty-mm-account.c
index de240497..99759942 100644
index de24049..9975994 100644
--- a/src/users/chatty-mm-account.c
+++ b/src/users/chatty-mm-account.c
@@ -956,8 +956,14 @@ chatty_mm_account_find_chat (ChattyMmAccount *self,
......@@ -34,6 +33,3 @@ index de240497..99759942 100644
}
return NULL;
--
2.33.0
From: Mohammed Sadiq <sadiq@sadiqpk.org>
Date: Wed, 8 Sep 2021 10:07:22 +0530
Subject: mm-account: Refresh chat when modem is ready
This is to fix the issue that older chats didn't store thread
members, which was fixed in b5d4f448ecdfef3189d794c2c136ed869e48f59f
Fixes #560
---
src/users/chatty-mm-account.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/users/chatty-mm-account.c b/src/users/chatty-mm-account.c
index 9975994..f30571d 100644
--- a/src/users/chatty-mm-account.c
+++ b/src/users/chatty-mm-account.c
@@ -506,8 +506,10 @@ mm_object_added_cb (ChattyMmAccount *self,
{
g_autoptr(ChattyMmAccount) account = NULL;
g_autoptr(ChattyMmDevice) device = NULL;
+ GListModel *chat_list;
MessagingData *data;
MMSim *sim;
+ guint n_chats;
g_assert (CHATTY_IS_MM_ACCOUNT (self));
g_assert (MM_IS_OBJECT (object));
@@ -542,6 +544,15 @@ mm_object_added_cb (ChattyMmAccount *self,
chatty_settings_set_country_iso_code (settings, code);
}
+ chat_list = chatty_mm_account_get_chat_list (self);
+ n_chats = g_list_model_get_n_items (chat_list);
+ for (guint i = 0; i < n_chats; i++) {
+ g_autoptr(ChattyMmChat) chat = NULL;
+
+ chat = g_list_model_get_item (chat_list, i);
+ chatty_mm_chat_refresh (chat);
+ }
+
g_signal_connect_swapped (mm_object_peek_modem_messaging (MM_OBJECT (object)),
"added",
G_CALLBACK (mm_account_sms_recieved_cb), self);
From: Mohammed Sadiq <sadiq@sadiqpk.org>
Date: Wed, 8 Sep 2021 10:06:15 +0530
Subject: mm-chat: Add API to update db thread members
---
src/chatty-mm-chat.c | 35 +++++++++++++++++++++++++++++++++++
src/chatty-mm-chat.h | 1 +
2 files changed, 36 insertions(+)
diff --git a/src/chatty-mm-chat.c b/src/chatty-mm-chat.c
index 1c13a21..45b6b27 100644
--- a/src/chatty-mm-chat.c
+++ b/src/chatty-mm-chat.c
@@ -683,3 +683,38 @@ chatty_mm_chat_show_notification (ChattyMmChat *self)
if (g_set_object (&self->last_notify_message, message))
chatty_notification_show_message (self->notification, chat, message, NULL);
}
+
+/*
+ * In the past, we were not storing thread members in db,
+ * which was fixed in b5d4f448ecdfef3189d794c2c136ed869e48f59f
+ * but the chats created before the fix had empty members,
+ * Let's work around by adding the members if that's the case
+ */
+void
+chatty_mm_chat_refresh (ChattyMmChat *self)
+{
+ g_autoptr(ChattyMmBuddy) buddy = NULL;
+ g_autofree char *number = NULL;
+ ChattySettings *settings;
+ const char *name, *country;
+
+ g_return_if_fail (CHATTY_IS_MM_CHAT (self));
+
+ if (g_list_model_get_n_items (G_LIST_MODEL (self->chat_users)) > 0)
+ return;
+
+ settings = chatty_settings_get_default ();
+ country = chatty_settings_get_country_iso_code (settings);
+ name = chatty_chat_get_chat_name (CHATTY_CHAT (self));
+
+ if (country)
+ number = chatty_utils_check_phonenumber (name, country);
+ if (!number)
+ number = g_strdup (name);
+
+ CHATTY_DEBUG (number, "Updating chat member in db, number:");
+
+ buddy = chatty_mm_buddy_new (number, chatty_item_get_name (CHATTY_ITEM (self)));
+ chatty_mm_chat_add_user (self, buddy);
+ chatty_history_update_chat (self->history_db, CHATTY_CHAT (self));
+}
diff --git a/src/chatty-mm-chat.h b/src/chatty-mm-chat.h
index 549e36e..0f57ab2 100644
--- a/src/chatty-mm-chat.h
+++ b/src/chatty-mm-chat.h
@@ -48,5 +48,6 @@ void chatty_mm_chat_add_users (ChattyMmChat *self,
GPtrArray *users);
void chatty_mm_chat_delete (ChattyMmChat *self);
void chatty_mm_chat_show_notification (ChattyMmChat *self);
+void chatty_mm_chat_refresh (ChattyMmChat *self);
G_END_DECLS
0001-mm-account-Fix-matching-chats-without-proper-number.patch
mm-chat-Add-API-to-update-db-thread-members.patch
mm-account-Refresh-chat-when-modem-is-ready.patch
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment