Linux + iPhone Continuity / iMessage / SMS
fix: trunk-0 numbers splitting threads
Zack Bartel642c034c5c38
diff --git a/src/core/src/bluetooth/bmessage.cpp b/src/core/src/bluetooth/bmessage.cppindex fe37683..098d6b3 100644--- a/src/core/src/bluetooth/bmessage.cpp+++ b/src/core/src/bluetooth/bmessage.cpp@@ -277,7 +277,7 @@ namespace tether::bluetooth {}namespace {- constexpr size_t TEL_SUFFIX_DIGITS = 10;+ constexpr size_t TEL_SUFFIX_DIGITS = 9;} // namespacestd::string tel_suffix(const std::string& raw) {diff --git a/src/gtk/messages_view.cpp b/src/gtk/messages_view.cppindex 83cdf09..0335acb 100644--- a/src/gtk/messages_view.cpp+++ b/src/gtk/messages_view.cpp@@ -1248,7 +1248,7 @@ namespace tether::ui {gtk_text_view_set_bottom_margin(GTK_TEXT_VIEW(g_messages.composer), 6);gtk_widget_set_size_request(g_messages.composer, -1, 48);GtkWidget* composer_frame = gtk_scrolled_window_new(nullptr, nullptr);- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(composer_frame), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(composer_frame), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);// Without a border the box floats in the panel with nothing marking it as// somewhere to type.gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(composer_frame), GTK_SHADOW_NONE);diff --git a/test/test_bmessage.cpp b/test/test_bmessage.cppindex e687512..be53444 100644--- a/test/test_bmessage.cpp+++ b/test/test_bmessage.cpp@@ -592,6 +592,17 @@ TEST(MessageStore, NationalAndInternationalFormsShareAThread) {EXPECT_EQ(threads[0].key, "tel:+14255550123");}+// Outside NANP the national form carries a trunk 0 the international one drops.+TEST(MessageStore, TrunkPrefixNationalFormSharesAThread) {+ MessageStore store;+ store.add(make("a", "tel:+61412345678", 100));+ store.add(make("b", "tel:0412345678", 200));++ auto threads = store.threads();+ ASSERT_EQ(threads.size(), 1u);+ EXPECT_EQ(threads[0].key, "tel:+61412345678");+}+// The local echo is keyed on whatever spelling the UI held, the phone's copy on// the sent folder's. Different spellings must not keep them apart, or the reply// shows twice.diff --git a/test/test_vcard.cpp b/test/test_vcard.cppindex 9dfb0f0..8fe37f9 100644--- a/test/test_vcard.cpp+++ b/test/test_vcard.cpp@@ -199,6 +199,15 @@ TEST(ContactStore, MatchesNationalAndE164FormsForDisplay) {EXPECT_EQ(store.name_for("tel:+15550000000"), "") << "an unknown number stays unlabelled";}+TEST(ContactStore, MatchesTrunkPrefixNationalForm) {+ ContactStore store;+ store.set(parse_vcards("BEGIN:VCARD\nFN:Ada\nTEL:0412 345 678\nEND:VCARD\n"+ "BEGIN:VCARD\nFN:Grace\nTEL:+33 6 12 34 56 78\nEND:VCARD\n"));++ EXPECT_EQ(store.name_for("tel:+61412345678"), "Ada");+ EXPECT_EQ(store.name_for("tel:0612345678"), "Grace");+}+// Two people cannot be told apart by the fallback alone, and labelling a thread// with the wrong person's name is worse than labelling it with a number.TEST(ContactStore, RefusesToGuessWhenTwoContactsShareASuffix) {