Commit c0abc2f3 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

d/patches: Add patch to fix finding the right chat

parent 9d2f4650
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
If the SMS is an IP SMS, it may not contain a valid number,
and when we try to match such a chat it won't be valid either.
In the case, we compare g_strcmp0 with NULL, which is always
true.
So fix it by comparing the right variables
---
src/users/chatty-mm-account.c | 10 ++++++++--
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
--- 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,
number1 = chatty_utils_check_phonenumber (user_id, country_code);
number2 = chatty_utils_check_phonenumber (phone, country_code);
- if (g_strcmp0 (number1, number2) == 0)
- return chat;
+ /* If We don't have number2, number2 could be a non-digit number (like provider SMS) */
+ if (!number2) {
+ if (g_strcmp0 (user_id, phone) == 0)
+ return chat;
+ } else {
+ if (g_strcmp0 (number1, number2) == 0)
+ return chat;
+ }
}
return NULL;
--
2.33.0
0001-mm-account-Fix-matching-chats-without-proper-number.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