Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix: bug fixes and performance improvements

Zack Bartelef08dc60ddb8
diff --git a/po/cs.po b/po/cs.po
index f63f46c..4b75fe7 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -398,6 +398,14 @@ msgstr "Odesláno na %s\n"
msgid "The message was not sent."
msgstr "Zpráva nebyla odeslána."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port očekává číslo.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout očekává číslo v milisekundách.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Neznámá akce. Spusťte tether --help pro seznam voleb\n"
@@ -594,6 +602,12 @@ msgstr "Není vybrán žádný spárovaný iPhone."
msgid "Group replies are turned off."
msgstr "Skupinové odpovědi jsou vypnuté."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Do této skupiny napsal někdo, kdo není v jejím uloženém seznamu členů, takže seznam je zastaralý. Před odpovědí jej aktualizujte v souboru groups.json."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/de.po b/po/de.po
index 592b879..01fcfc3 100644
--- a/po/de.po
+++ b/po/de.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -397,6 +397,14 @@ msgstr "Gesendet an %s\n"
msgid "The message was not sent."
msgstr "Die Nachricht wurde nicht gesendet."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port erwartet eine Zahl.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout erwartet eine Zahl in Millisekunden.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr ""
@@ -602,6 +610,12 @@ msgstr "Kein gekoppeltes iPhone ausgewählt."
msgid "Group replies are turned off."
msgstr "Antworten in Gruppen sind ausgeschaltet."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Jemand, der nicht in der gespeicherten Mitgliederliste dieser Gruppe steht, hat darin geschrieben. Die Liste ist also veraltet. Aktualisieren Sie sie in groups.json, bevor Sie antworten."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/es.po b/po/es.po
index 855ab3a..adeb43c 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -395,6 +395,14 @@ msgstr "Enviado a %s\n"
msgid "The message was not sent."
msgstr "El mensaje no se envió."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port espera un número.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout espera un número en milisegundos.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Acción desconocida. Ejecute tether --help para ver las opciones\n"
@@ -599,6 +607,12 @@ msgstr "No hay ningún iPhone emparejado seleccionado."
msgid "Group replies are turned off."
msgstr "Las respuestas a grupos están desactivadas."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Alguien que no está en la lista de miembros guardada de este grupo ha escrito en él, así que la lista está desactualizada. Actualícela en groups.json antes de responder."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/fr.po b/po/fr.po
index ca5433b..8ea77f1 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -399,6 +399,14 @@ msgstr "Envoyé à %s\n"
msgid "The message was not sent."
msgstr "Le message n'a pas été envoyé."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port attend un nombre.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout attend un nombre en millisecondes.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Action inconnue. Lancez tether --help pour voir les options\n"
@@ -602,6 +610,12 @@ msgstr "Aucun iPhone appairé sélectionné."
msgid "Group replies are turned off."
msgstr "Les réponses aux groupes sont désactivées."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Quelqu'un qui ne figure pas dans la liste des membres enregistrée de ce groupe y a écrit ; la liste est donc obsolète. Mettez-la à jour dans groups.json avant de répondre."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/it.po b/po/it.po
index 90b55f2..f2343f3 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -396,6 +396,14 @@ msgstr "Inviato a %s\n"
msgid "The message was not sent."
msgstr "Il messaggio non è stato inviato."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port richiede un numero.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout richiede un numero in millisecondi.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Azione sconosciuta. Esegui tether --help per le opzioni\n"
@@ -600,6 +608,12 @@ msgstr "Nessun iPhone accoppiato selezionato."
msgid "Group replies are turned off."
msgstr "Le risposte di gruppo sono disattivate."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Qualcuno che non è nell'elenco dei membri salvato di questo gruppo vi ha scritto, quindi l'elenco non è aggiornato. Aggiornalo in groups.json prima di rispondere."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/ja.po b/po/ja.po
index 8d5665f..3e5aafb 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -384,6 +384,14 @@ msgstr "%s に送信しました\n"
msgid "The message was not sent."
msgstr "メッセージは送信されませんでした。"
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port には数値を指定してください。\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout にはミリ秒単位の数値を指定してください。\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr ""
@@ -576,6 +584,12 @@ msgstr "ペアリング済みの iPhone が選択されていません。"
msgid "Group replies are turned off."
msgstr "グループへの返信はオフになっています。"
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "このグループの保存済みメンバーリストにない相手が投稿したため、リストが古くなっています。返信する前に groups.json で更新してください。"
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/ko.po b/po/ko.po
index 6dc9b78..e329293 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -383,6 +383,14 @@ msgstr "%s(으)로 보냈습니다\n"
msgid "The message was not sent."
msgstr "메시지가 전송되지 않았습니다."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port에는 숫자를 지정해야 합니다.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout에는 밀리초 단위의 숫자를 지정해야 합니다.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "알 수 없는 동작입니다. 옵션을 보려면 tether --help를 실행하십시오\n"
@@ -574,6 +582,12 @@ msgstr "선택된 페어링 iPhone이 없습니다."
msgid "Group replies are turned off."
msgstr "그룹 답장이 꺼져 있습니다."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "이 그룹의 저장된 구성원 목록에 없는 사람이 글을 보냈으므로 목록이 오래되었습니다. 답장하기 전에 groups.json에서 업데이트하세요."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/nl.po b/po/nl.po
index a57fa0f..7564b24 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -393,6 +393,14 @@ msgstr "Verstuurd naar %s\n"
msgid "The message was not sent."
msgstr "Het bericht is niet verstuurd."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port verwacht een getal.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout verwacht een getal in milliseconden.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Onbekende actie. Voer tether --help uit voor de opties\n"
@@ -593,6 +601,12 @@ msgstr "Geen gekoppelde iPhone geselecteerd."
msgid "Group replies are turned off."
msgstr "Groepsantwoorden staan uit."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Iemand die niet in de opgeslagen ledenlijst van deze groep staat, heeft erin geschreven, dus de lijst is verouderd. Werk hem bij in groups.json voordat u antwoordt."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/pl.po b/po/pl.po
index 0fdf4dc..07d5b45 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -399,6 +399,14 @@ msgstr "Wysłano do %s\n"
msgid "The message was not sent."
msgstr "Wiadomość nie została wysłana."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port oczekuje liczby.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout oczekuje liczby w milisekundach.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Nieznane działanie. Uruchom tether --help, aby zobaczyć opcje\n"
@@ -598,6 +606,12 @@ msgstr "Nie wybrano żadnego sparowanego iPhone'a."
msgid "Group replies are turned off."
msgstr "Odpowiedzi grupowe są wyłączone."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Do tej grupy napisał ktoś, kogo nie ma na jej zapisanej liście członków, więc lista jest nieaktualna. Zaktualizuj ją w pliku groups.json przed odpowiedzią."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index acd1615..18f30b1 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -393,6 +393,14 @@ msgstr "Enviado para %s\n"
msgid "The message was not sent."
msgstr "A mensagem não foi enviada."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port espera um número.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout espera um número em milissegundos.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Ação desconhecida. Execute tether --help para ver as opções\n"
@@ -595,6 +603,12 @@ msgstr "Nenhum iPhone pareado selecionado."
msgid "Group replies are turned off."
msgstr "As respostas em grupo estão desativadas."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Alguém que não está na lista de membros salva deste grupo escreveu nele, então a lista está desatualizada. Atualize-a em groups.json antes de responder."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/ru.po b/po/ru.po
index 4bfd0a9..19d96a0 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -399,6 +399,14 @@ msgstr "Отправлено в %s\n"
msgid "The message was not sent."
msgstr "Сообщение не отправлено."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port ожидает число.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout ожидает число в миллисекундах.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr ""
@@ -599,6 +607,12 @@ msgstr "Не выбран сопряжённый iPhone."
msgid "Group replies are turned off."
msgstr "Групповые ответы выключены."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "В эту группу написал кто-то, кого нет в её сохранённом списке участников, значит список устарел. Обновите его в groups.json, прежде чем отвечать."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/sv.po b/po/sv.po
index a2b21bb..4428a2c 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -392,6 +392,14 @@ msgstr "Skickat till %s\n"
msgid "The message was not sent."
msgstr "Meddelandet skickades inte."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port förväntar sig ett tal.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout förväntar sig ett tal i millisekunder.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Okänd åtgärd. Kör tether --help för flaggorna\n"
@@ -589,6 +597,12 @@ msgstr "Ingen parkopplad iPhone vald."
msgid "Group replies are turned off."
msgstr "Gruppsvar är avstängda."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Någon som inte finns i gruppens sparade medlemslista har skrivit i den, så listan är inaktuell. Uppdatera den i groups.json innan du svarar."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/tether.pot b/po/tether.pot
index 1a786df..e54ea0c 100644
--- a/po/tether.pot
+++ b/po/tether.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether 0.2.15\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -371,6 +371,14 @@ msgstr ""
msgid "The message was not sent."
msgstr ""
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr ""
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr ""
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr ""
@@ -541,6 +549,12 @@ msgstr ""
msgid "Group replies are turned off."
msgstr ""
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr ""
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/tr.po b/po/tr.po
index e6965d8..3b35a29 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -391,6 +391,14 @@ msgstr "%s adresine gönderildi\n"
msgid "The message was not sent."
msgstr "Mesaj gönderilmedi."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port bir sayı bekliyor.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout milisaniye cinsinden bir sayı bekliyor.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Bilinmeyen eylem. Seçenekler için tether --help komutunu çalıştırın\n"
@@ -589,6 +597,12 @@ msgstr "Eşleşmiş bir iPhone seçilmedi."
msgid "Group replies are turned off."
msgstr "Grup yanıtları kapalı."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "Bu grubun kayıtlı üye listesinde olmayan biri gruba yazdı, dolayısıyla liste güncel değil. Yanıtlamadan önce groups.json dosyasında güncelleyin."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/uk.po b/po/uk.po
index 76d887a..f6c619d 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -400,6 +400,14 @@ msgstr "Надіслано до %s\n"
msgid "The message was not sent."
msgstr "Повідомлення не надіслано."
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port очікує число.\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout очікує число в мілісекундах.\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "Невідома дія. Запустіть tether --help, щоб побачити параметри\n"
@@ -597,6 +605,12 @@ msgstr "Не вибрано спареного iPhone."
msgid "Group replies are turned off."
msgstr "Групові відповіді вимкнено."
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "У цю групу написав хтось, кого немає в її збереженому списку учасників, тож список застарів. Оновіть його у файлі groups.json, перш ніж відповідати."
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 6dc39bd..708aefb 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-08-28 16:06-0700\n"
+"POT-Creation-Date: 2026-08-28 20:29-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -381,6 +381,14 @@ msgstr "已发送至 %s\n"
msgid "The message was not sent."
msgstr "信息未发送。"
+#: src/cli/main.cpp
+msgid "--port expects a number.\n"
+msgstr "--port 需要一个数字。\n"
+
+#: src/cli/main.cpp
+msgid "--timeout expects a number in milliseconds.\n"
+msgstr "--timeout 需要一个以毫秒为单位的数字。\n"
+
#: src/cli/main.cpp
msgid "Unknown action. Run tether --help for options\n"
msgstr "未知操作。运行 tether --help 查看选项\n"
@@ -562,6 +570,12 @@ msgstr "未选择已配对的 iPhone。"
msgid "Group replies are turned off."
msgstr "群组回复已关闭。"
+#: src/core/src/bluetooth/groups.cpp
+msgid ""
+"Someone who is not in this group's saved member list has posted to it, so "
+"the list is out of date. Update it in groups.json before replying."
+msgstr "有不在该群组已保存成员列表中的人发了消息,说明该列表已过期。回复前请在 groups.json 中更新它。"
+
#: src/core/src/bluetooth/groups.cpp
#, c++-format
msgid "The roster for this group contains an unusable address: {}"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index 8c4d620..a7e6e12 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -1,6 +1,8 @@
#include <algorithm>
#include <atomic>
+#include <charconv>
#include <csignal>
+#include <cstring>
#include <ctime>
#include <iostream>
#include <nlohmann/json.hpp>
@@ -97,6 +99,16 @@ void run_native_messaging_host(tether::Client& client) {
}
}
+static bool parse_int(const char* text, int& out) {
+ const char* end = text + std::strlen(text);
+ int value = 0;
+ auto [stop, ec] = std::from_chars(text, end, value);
+ if (ec != std::errc{} || stop != end)
+ return false;
+ out = value;
+ return true;
+}
+
static size_t term_width() {
struct winsize ws{};
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == 0 && ws.ws_col > 20)
@@ -737,11 +749,15 @@ int main(int argc, char* argv[]) {
if (i + 1 < argc && argv[i + 1][0] != '-')
host = argv[++i];
} else if (arg == "--port") {
- if (i + 1 < argc && argv[i + 1][0] != '-')
- port = std::stoi(argv[++i]);
+ if (i + 1 < argc && argv[i + 1][0] != '-' && !parse_int(argv[++i], port)) {
+ debug::log(ERR, _("--port expects a number.\n"));
+ return 1;
+ }
} else if (arg == "--timeout") {
- if (i + 1 < argc && argv[i + 1][0] != '-')
- timeout_ms = std::stoi(argv[++i]);
+ if (i + 1 < argc && argv[i + 1][0] != '-' && !parse_int(argv[++i], timeout_ms)) {
+ debug::log(ERR, _("--timeout expects a number in milliseconds.\n"));
+ return 1;
+ }
} else if (arg == "-f" || arg == "--send-file") {
action = "file";
if (i + 1 < argc && argv[i + 1][0] != '-')
diff --git a/src/core/include/tether/bluetooth/advert.hpp b/src/core/include/tether/bluetooth/advert.hpp
index 71d6d01..2009d90 100644
--- a/src/core/include/tether/bluetooth/advert.hpp
+++ b/src/core/include/tether/bluetooth/advert.hpp
@@ -6,6 +6,9 @@
namespace tether::bluetooth {
+ // How long BlueZ keeps the solicitation on air before retiring it and calling release
+ inline constexpr int ANCS_ADVERT_TIMEOUT_SECONDS = 180;
+
struct AdvertState;
// Broadcasts an LE advertisement soliciting the ANCS service.
diff --git a/src/core/include/tether/bluetooth/ancs/client.hpp b/src/core/include/tether/bluetooth/ancs/client.hpp
index 20bfed7..d4c4db8 100644
--- a/src/core/include/tether/bluetooth/ancs/client.hpp
+++ b/src/core/include/tether/bluetooth/ancs/client.hpp
@@ -15,6 +15,9 @@ namespace tether::bluetooth::ancs {
// How often to retry discovery, subscription and the readiness probe.
inline constexpr int ANCS_RETRY_SECONDS = 5;
+ // How often a live subscription is re-confirmed against BlueZ.
+ inline constexpr int ANCS_VERIFY_SECONDS = 30;
+
// Defined in client.cpp.
struct AncsClientState;
diff --git a/src/core/include/tether/bluetooth/diagnostics.hpp b/src/core/include/tether/bluetooth/diagnostics.hpp
index f4b330d..5599b64 100644
--- a/src/core/include/tether/bluetooth/diagnostics.hpp
+++ b/src/core/include/tether/bluetooth/diagnostics.hpp
@@ -3,6 +3,8 @@
#include <map>
#include <nlohmann/json.hpp>
#include <string>
+#include <utility>
+#include <vector>
namespace tether::bluetooth {
@@ -11,6 +13,9 @@ namespace tether::bluetooth {
// addresses, and the user's home and runtime directories.
class Redactor {
public:
+ // Registers a literal to scrub wherever it appears
+ void hide(const std::string& literal, const std::string& kind);
+
std::string text(const std::string& in);
// Recursively redacts strings
@@ -20,6 +25,8 @@ namespace tether::bluetooth {
std::string placeholder(const std::string& kind, const std::string& key);
std::map<std::string, std::string> assigned_;
+ // Longest first, so a name that contains another is replaced whole.
+ std::vector<std::pair<std::string, std::string>> literals_;
};
// True for keys whose values are personal content and must never appear in
diff --git a/src/core/include/tether/bluetooth/groups.hpp b/src/core/include/tether/bluetooth/groups.hpp
index 9b34ae5..99b29d5 100644
--- a/src/core/include/tether/bluetooth/groups.hpp
+++ b/src/core/include/tether/bluetooth/groups.hpp
@@ -17,6 +17,7 @@ namespace tether::bluetooth {
bool is_group = false;
// when the group has a name
bool named = false;
+ bool route_invalidated = false;
std::string name;
// display names parsed from an unnamed group's subtitle, excluding the user.
std::vector<std::string> participants;
diff --git a/src/core/include/tether/bluetooth/profile_supervisor.hpp b/src/core/include/tether/bluetooth/profile_supervisor.hpp
index 3e966d2..68ff662 100644
--- a/src/core/include/tether/bluetooth/profile_supervisor.hpp
+++ b/src/core/include/tether/bluetooth/profile_supervisor.hpp
@@ -9,6 +9,9 @@ namespace tether::bluetooth {
inline constexpr int PROFILE_INITIAL_POLL_SECONDS = 5;
inline constexpr int PROFILE_STEADY_POLL_SECONDS = 15;
+ // How often an open session is confirmed still to exist.
+ inline constexpr int PROFILE_VERIFY_SECONDS = 30;
+
// Why an OBEX session could not be opened. Forbidden and Busy look alike from a distance, and reporting one as the
// other sends the user off re-pairing for nothing.
enum class ObexError {
@@ -46,6 +49,8 @@ namespace tether::bluetooth {
// Returns the new session's object path, or an empty string with err set.
virtual std::string create_session(const std::string& target, std::string& err) = 0;
virtual void remove_session(const std::string& path) = 0;
+ // Whether obexd still has this session.
+ virtual bool session_alive(const std::string& path) = 0;
};
struct ProfileStatus {
@@ -81,6 +86,9 @@ namespace tether::bluetooth {
private:
bool open_profile(const std::string& target, std::string& path, ObexError& error, bool& retried);
+ // Clears map_open/pbap_open for any session obexd has let go
+ void verify_sessions(int64_t now);
+
ProfileOps& ops_;
ProfileStatus status_;
std::string map_path_;
@@ -88,6 +96,7 @@ namespace tether::bluetooth {
bool map_retried_ = false;
bool pbap_retried_ = false;
int64_t next_attempt_ = 0;
+ int64_t next_verify_ = 0;
bool opened_once_ = false;
};
diff --git a/src/core/src/bluetooth/advert.cpp b/src/core/src/bluetooth/advert.cpp
index 73bd53e..cf2e429 100644
--- a/src/core/src/bluetooth/advert.cpp
+++ b/src/core/src/bluetooth/advert.cpp
@@ -23,8 +23,7 @@ namespace tether::bluetooth {
constexpr guint16 INERT_MANUFACTURER_ID = 0xffff;
constexpr const char* INERT_SERVICE_UUID = "00009999-0000-1000-8000-00805f9b34fb";
- // iOS needs the it running long enough to notice
- constexpr guint16 ADVERT_TIMEOUT_SECONDS = 180;
+ constexpr guint16 ADVERT_TIMEOUT_SECONDS = ANCS_ADVERT_TIMEOUT_SECONDS;
constexpr const char* ADVERT_XML = R"XML(
<node>
diff --git a/src/core/src/bluetooth/ancs/client.cpp b/src/core/src/bluetooth/ancs/client.cpp
index 40c63d8..5eee902 100644
--- a/src/core/src/bluetooth/ancs/client.cpp
+++ b/src/core/src/bluetooth/ancs/client.cpp
@@ -338,7 +338,7 @@ namespace tether::bluetooth::ancs {
data_source_path.clear();
}
- // `subscribed` records that StartNotify once succeeded, which is not the same as a subscription that is still live.
+ // `subscribed` records that StartNotify once succeeded, and `ready` that iOS once answered on the Data Source.
void AncsClientState::verify_subscription() {
if (!monitor || !monitor->connection())
return;
@@ -383,10 +383,12 @@ namespace tether::bluetooth::ancs {
object_gone ? "characteristics gone" : "BlueZ cleared Notifying");
if (object_gone) {
drop_gatt_paths();
+ set_status(false, "Waiting for the iPhone's notification service.");
} else {
unsubscribe();
subscribed = false;
next_subscribe = 0;
+ set_status(false, "Subscribing to the iPhone's notifications...");
}
sequencer->reset();
in_progress.clear();
@@ -461,6 +463,12 @@ namespace tether::bluetooth::ancs {
if (response.command != CommandId::GetNotificationAttributes)
return;
+ if (response.uid != request.uid) {
+ debug::log(
+ WARN, "ancs: discarding a response for uid {} while {} was in flight", response.uid, request.uid);
+ return;
+ }
+
auto found = in_progress.find(request.uid);
if (found == in_progress.end())
return;
@@ -590,8 +598,8 @@ namespace tether::bluetooth::ancs {
if (s->device_path.empty())
return;
- if (s->subscribed && !s->ready && now >= s->next_verify) {
- s->next_verify = now + ANCS_RETRY_SECONDS;
+ if (s->subscribed && now >= s->next_verify) {
+ s->next_verify = now + (s->ready ? ANCS_VERIFY_SECONDS : ANCS_RETRY_SECONDS);
s->verify_subscription();
}
diff --git a/src/core/src/bluetooth/bearer_supervisor.cpp b/src/core/src/bluetooth/bearer_supervisor.cpp
index 6bac674..0e2c6a6 100644
--- a/src/core/src/bluetooth/bearer_supervisor.cpp
+++ b/src/core/src/bluetooth/bearer_supervisor.cpp
@@ -15,8 +15,6 @@ namespace tether::bluetooth {
}
// Failures that clear on their own, unlike a refusal from the phone.
- // Backing off for minutes on these leaves the link down long after the
- // reason for it is gone (left the room answers with a page timeout, not a rejection).
bool is_transient(const std::string& err) {
static const char* const transient[] = {
"org.bluez.Error.NotReady",
@@ -81,6 +79,7 @@ namespace tether::bluetooth {
classic_connected_since_ = -1;
next_classic_attempt_ = 0;
status_.classic_backoff = 0;
+ status_.le_dialling = ops_.le_connect_outstanding();
}
bool BearerSupervisor::tick(int64_t now, bool obex_up) {
@@ -92,6 +91,7 @@ namespace tether::bluetooth {
status_.classic_connected = false;
status_.le_connected = false;
status_.le_available = false;
+ status_.le_dialling = ops_.le_connect_outstanding();
classic_connected_since_ = -1;
status_.reason = status_.device_present ? "iPhone is not paired." : "iPhone not known to BlueZ.";
return !(status_ == previous);
@@ -154,6 +154,8 @@ namespace tether::bluetooth {
}
}
+ status_.le_dialling = ops_.le_connect_outstanding();
+
// An iPhone that keeps refusing while unlocked, with its Bluetooth
// permissions already on, is wedged on its own side: nothing here
// clears it, and saying "connecting" forever hides that. A host with
diff --git a/src/core/src/bluetooth/bmessage.cpp b/src/core/src/bluetooth/bmessage.cpp
index 3f86d7a..a04458a 100644
--- a/src/core/src/bluetooth/bmessage.cpp
+++ b/src/core/src/bluetooth/bmessage.cpp
@@ -396,6 +396,9 @@ namespace tether::bluetooth {
}
std::string stuff_body(const std::string& body) {
+ if (body.empty())
+ return {};
+
std::string out;
for (const std::string& line : split_lines(body)) {
if (line_needs_stuffing(line))
@@ -403,10 +406,10 @@ namespace tether::bluetooth {
out += line;
out += "\r\n";
}
- // split_lines yields a trailing empty element for a body ending in a
- // line break; drop the extra break it would introduce.
- if (!body.empty() && body.back() != '\n' && body.back() != '\r' && out.size() >= 2)
- out.erase(out.size() - 2);
+
+ const size_t surplus = (body.back() == '\n' || body.back() == '\r') ? 4 : 2;
+ if (out.size() >= surplus)
+ out.erase(out.size() - surplus);
return out;
}
diff --git a/src/core/src/bluetooth/connection.cpp b/src/core/src/bluetooth/connection.cpp
index 9e3746a..f4116e5 100644
--- a/src/core/src/bluetooth/connection.cpp
+++ b/src/core/src/bluetooth/connection.cpp
@@ -46,6 +46,22 @@ namespace tether::bluetooth {
constexpr const char* MAP_FOLDER_SENT = "sent";
} // namespace
+ namespace {
+ bool roster_contradicted(const std::string& thread_key, const std::string& sender_key) {
+ const std::vector<std::string>* roster = g_rosters.find(thread_key);
+ if (!roster || sender_key.empty())
+ return false;
+ std::vector<Recipient> members;
+ for (const auto& address : *roster) {
+ Recipient recipient;
+ std::string ignored;
+ if (recipient_from_thread_key(address, recipient, ignored))
+ members.push_back(recipient);
+ }
+ return sender_invalidates_route(sender_key, members);
+ }
+ } // namespace
+
MessageStore& message_store() { return g_messages; }
std::mutex& message_store_mutex() { return g_messages_mutex; }
@@ -153,6 +169,9 @@ namespace tether::bluetooth {
void reload_group_rosters() {
std::lock_guard<std::mutex> lock(g_group_mutex);
g_rosters = load_rosters();
+ // re-reading the file is the user's answer to an invalidation.
+ for (auto& [key, info] : g_group_info)
+ info.route_invalidated = false;
}
bool mark_message_read(const std::string& handle, bool read, std::string& err_out, bool* synced_out) {
@@ -507,6 +526,35 @@ namespace tether::bluetooth {
return session;
}
+ // GetAll rather than a named property: it answers for the interface as
+ // a whole, so this does not depend on which properties this obexd
+ // publishes.
+ bool session_alive(const std::string& path) override {
+ if (path.empty() || !conn_)
+ return false;
+ GError* error = nullptr;
+ GVariant* reply = g_dbus_connection_call_sync(conn_,
+ OBEX_NAME,
+ path.c_str(),
+ IFACE_PROPS,
+ "GetAll",
+ g_variant_new("(s)", "org.bluez.obex.Session1"),
+ G_VARIANT_TYPE("(a{sv})"),
+ G_DBUS_CALL_FLAGS_NONE,
+ 5000,
+ nullptr,
+ &error);
+ if (reply) {
+ g_variant_unref(reply);
+ return true;
+ }
+
+ const std::string message = error && error->message ? error->message : "";
+ g_clear_error(&error);
+ return message.find("UnknownObject") == std::string::npos &&
+ message.find("UnknownMethod") == std::string::npos;
+ }
+
void remove_session(const std::string& path) override {
if (path.empty() || !conn_)
return;
@@ -832,11 +880,16 @@ namespace tether::bluetooth {
if (g_correlator.correlate(message.body, now, info) == Correlation::Matched) {
const std::string key = group_thread_key(info);
if (!key.empty()) {
+
+ const bool stale = !message.outgoing && roster_contradicted(key, message.thread_key);
+
// The sender label is display only and never becomes
// part of the thread identity or the reply route.
message.peer_name = info.sender;
message.thread_key = key;
+ const bool was_stale = g_group_info[key].route_invalidated;
g_group_info[key] = info;
+ g_group_info[key].route_invalidated = was_stale || stale;
}
}
}
@@ -1044,7 +1097,7 @@ namespace tether::bluetooth {
}
state_->bearer_ops = std::make_unique<BluezBearerOps>(*state_->monitor, address);
state_->profile_ops = std::make_unique<ObexProfileOps>(address);
- state_->bearers = std::make_unique<BearerSupervisor>(*state_->bearer_ops, ancs_enabled);
+ state_->bearers = std::make_unique<BearerSupervisor>(*state_->bearer_ops, ancs_effective);
state_->profiles = std::make_unique<ProfileSupervisor>(*state_->profile_ops);
// Only built when the caller can actually show notifications and the
diff --git a/src/core/src/bluetooth/diagnostics.cpp b/src/core/src/bluetooth/diagnostics.cpp
index f9947c9..afa0fca 100644
--- a/src/core/src/bluetooth/diagnostics.cpp
+++ b/src/core/src/bluetooth/diagnostics.cpp
@@ -1,6 +1,7 @@
#include "tether/bluetooth/diagnostics.hpp"
#include "tether/bluetooth/config.hpp"
+#include "tether/bluetooth/monitor.hpp"
#include "tether/bluetooth/pairing.hpp"
#include "tether/version.hpp"
@@ -26,6 +27,20 @@ namespace tether::bluetooth {
const std::regex kNumber(R"(\+[0-9]{7,15})");
const std::regex kRuntimeDir(R"(/run/user/[0-9]+)");
+ // Device names that identify a model rather than a person.
+ bool is_generic_device_name(const std::string& name) {
+ static const char* const GENERIC[] = {
+ "iphone", "ipad", "ipod", "mac", "macbook", "apple watch", "watch", "airpods", "tether", "phone"};
+ std::string lowered = name;
+ std::transform(lowered.begin(), lowered.end(), lowered.begin(), [](unsigned char c) {
+ return static_cast<char>(std::tolower(c));
+ });
+ for (const char* generic : GENERIC)
+ if (lowered == generic)
+ return true;
+ return false;
+ }
+
std::string upper(std::string s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::toupper(c); });
return s;
@@ -92,9 +107,29 @@ namespace tether::bluetooth {
return token;
}
+ void Redactor::hide(const std::string& literal, const std::string& kind) {
+ // A one- or two-character alias would shred unrelated text.
+ if (literal.size() < 3)
+ return;
+
+ if (is_generic_device_name(literal))
+ return;
+
+ for (const auto& [existing, token] : literals_)
+ if (existing == literal)
+ return;
+ literals_.emplace_back(literal, placeholder(kind, literal));
+ std::sort(literals_.begin(), literals_.end(), [](const auto& a, const auto& b) {
+ return a.first.size() > b.first.size();
+ });
+ }
+
std::string Redactor::text(const std::string& in) {
std::string out = in;
+ for (const auto& [literal, token] : literals_)
+ out = replace_literal(out, literal, token);
+
// Directories first: a path under $HOME can contain anything below.
if (const char* runtime = std::getenv("XDG_RUNTIME_DIR"); runtime && *runtime)
out = replace_literal(out, runtime, "<runtime>");
@@ -181,6 +216,13 @@ namespace tether::bluetooth {
const Config config = load_config();
Redactor redactor;
+ if (g_bluez) {
+ for (const auto& device : g_bluez->snapshot().devices)
+ redactor.hide(device.name, "name");
+ for (const auto& adapter : g_bluez->snapshot().adapters)
+ redactor.hide(adapter.name, "name");
+ }
+
nlohmann::json report;
report["command"] = "bt_diagnostics";
report["version"] = TETHER_VERSION;
diff --git a/src/core/src/bluetooth/groups.cpp b/src/core/src/bluetooth/groups.cpp
index 1996b1c..c1eae21 100644
--- a/src/core/src/bluetooth/groups.cpp
+++ b/src/core/src/bluetooth/groups.cpp
@@ -279,6 +279,12 @@ namespace tether::bluetooth {
return ReplyEligibility::Disabled;
}
+ if (info.route_invalidated) {
+ reason = _("Someone who is not in this group's saved member list has posted to it, so the list is out of "
+ "date. Update it in groups.json before replying.");
+ return ReplyEligibility::RouteInvalidated;
+ }
+
// user-supplied roster is authoritative for either kind of group
if (const std::vector<std::string>* roster = rosters.find(thread_key)) {
for (const auto& address : *roster) {
diff --git a/src/core/src/bluetooth/map_session.cpp b/src/core/src/bluetooth/map_session.cpp
index 658eedd..0aca5d7 100644
--- a/src/core/src/bluetooth/map_session.cpp
+++ b/src/core/src/bluetooth/map_session.cpp
@@ -2,6 +2,7 @@
#include "tether/bluetooth/obex_transfer.hpp"
#include "tether/log.hpp"
+#include <atomic>
#include <chrono>
#include <cstdlib>
#include <filesystem>
@@ -260,13 +261,14 @@ namespace tether::bluetooth {
return false;
}
- // obexd reads the message from a file. It is staged in the per-user
- // runtime directory rather than a shared temp directory, since it holds
- // the message text and the recipient.
+ static std::atomic<uint64_t> serial{0};
const char* runtime = getenv("XDG_RUNTIME_DIR");
- std::filesystem::path source =
- (runtime && *runtime ? std::filesystem::path(runtime) : std::filesystem::temp_directory_path()) /
- ("tether-send-" + std::to_string(getpid()) + ".bmsg");
+ if (!runtime || !*runtime) {
+ err = "XDG_RUNTIME_DIR is not set, and a message cannot be staged anywhere else.";
+ return false;
+ }
+ std::filesystem::path source = std::filesystem::path(runtime) / ("tether-send-" + std::to_string(getpid()) +
+ "-" + std::to_string(serial++) + ".bmsg");
std::error_code ec;
{
diff --git a/src/core/src/bluetooth/pairing.cpp b/src/core/src/bluetooth/pairing.cpp
index 6422004..8f4fe33 100644
--- a/src/core/src/bluetooth/pairing.cpp
+++ b/src/core/src/bluetooth/pairing.cpp
@@ -277,6 +277,18 @@ namespace tether::bluetooth {
std::atomic<bool> g_pairing_owns_advert{false};
+ std::atomic<int64_t> g_advert_hold_until_ms{0};
+
+ int64_t steady_ms() {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count();
+ }
+
+ void hold_advert_for(int seconds) { g_advert_hold_until_ms = steady_ms() + seconds * 1000; }
+
+ bool advert_held() { return steady_ms() < g_advert_hold_until_ms.load(); }
+
struct AdvertOwnership {
AdvertOwnership() { g_pairing_owns_advert = true; }
~AdvertOwnership() { g_pairing_owns_advert = false; }
@@ -369,18 +381,39 @@ namespace tether::bluetooth {
// report what BlueZ actually says.
auto objects = monitor.snapshot();
const std::string adapter = objects.adapters.empty() ? std::string{} : objects.adapters.front().path;
- return start_advert(monitor, adapter, err);
+ if (!start_advert(monitor, adapter, err))
+ return false;
+
+ hold_advert_for(ANCS_ADVERT_TIMEOUT_SECONDS);
+
+ return true;
}
+ namespace {
+
+ bool rearm_solicitation(BluezMonitor& monitor, std::string& err) {
+ if (!monitor.connection()) {
+ err = "Bluetooth is unavailable.";
+ return false;
+ }
+ auto objects = monitor.snapshot();
+ const std::string adapter = objects.adapters.empty() ? std::string{} : objects.adapters.front().path;
+ return start_advert(monitor, adapter, err);
+ }
+ } // namespace
+
bool ancs_solicitation_active() {
std::lock_guard<std::mutex> lock(g_advert_mutex);
return g_advert && g_advert->active();
}
- void stop_ancs_solicitation(BluezMonitor& monitor) { stop_advert(monitor); }
+ void stop_ancs_solicitation(BluezMonitor& monitor) {
+ g_advert_hold_until_ms = 0;
+ stop_advert(monitor);
+ }
void supervise_ancs_solicitation(BluezMonitor& monitor, bool want) {
- if (g_pairing_owns_advert)
+ if (g_pairing_owns_advert || advert_held())
return;
if (!want) {
if (ancs_solicitation_active())
@@ -396,7 +429,7 @@ namespace tether::bluetooth {
return;
std::string err;
- if (solicit_ancs(monitor, err)) {
+ if (rearm_solicitation(monitor, err)) {
next_attempt = {};
return;
}
@@ -405,8 +438,6 @@ namespace tether::bluetooth {
}
bool confirm_with_dialog(const std::string& device_name, const std::string& code, bool& unavailable) {
- // Translated before the fork: gettext takes a lock, and calling it in the
- // child of a threaded process can deadlock if another thread held it.
// TRANSLATORS: {0} is the device name, {1} is the numeric pairing code.
const std::string body = tr_format(
_("{0} wants to pair.\n\nConfirm this code matches the one on your iPhone:\n\n{1}"), device_name, code);
@@ -414,6 +445,14 @@ namespace tether::bluetooth {
const std::string accept = _("Confirm");
const std::string reject = _("Cancel");
+ std::filesystem::path self_path;
+ try {
+ self_path = std::filesystem::read_symlink("/proc/self/exe");
+ } catch (...) {
+ }
+ const std::string sibling = (self_path.parent_path() / "tether-dialog").string();
+ const std::string timeout = std::to_string(DIALOG_TIMEOUT_SECONDS);
+
pid_t pid = fork();
if (pid < 0) {
debug::log(ERR, "bluetooth: fork() for confirmation dialog failed");
@@ -422,14 +461,6 @@ namespace tether::bluetooth {
}
if (pid == 0) {
- std::filesystem::path self_path;
- try {
- self_path = std::filesystem::read_symlink("/proc/self/exe");
- } catch (...) {
- }
- std::string sibling = (self_path.parent_path() / "tether-dialog").string();
- std::string timeout = std::to_string(DIALOG_TIMEOUT_SECONDS);
-
execl(sibling.c_str(),
"tether-dialog",
"--title",
@@ -693,25 +724,27 @@ namespace tether::bluetooth {
if (!set_property(conn, device.path, IFACE_DEVICE, "Trusted", g_variant_new_boolean(TRUE), &trust_err))
debug::log(WARN, "bluetooth: could not trust device: {}", trust_err);
- // Prefer BR/EDR for the next outbound connection, then let the Classic ACL
- // settle before anything touches LE. Older BlueZ has no such property.
- set_property(conn, device.path, IFACE_DEVICE, "PreferredBearer", g_variant_new_string("bredr"));
- notify(progress, "settling", "waiting for the Classic link to settle");
- std::this_thread::sleep_for(std::chrono::seconds(CLASSIC_SETTLE_SECONDS));
+ if (result.status == "paired") {
+ // Prefer BR/EDR for the next outbound connection, then let the Classic
+ // ACL settle before anything touches LE. Older BlueZ has no such property.
+ set_property(conn, device.path, IFACE_DEVICE, "PreferredBearer", g_variant_new_string("bredr"));
+ notify(progress, "settling", "waiting for the Classic link to settle");
+ std::this_thread::sleep_for(std::chrono::seconds(CLASSIC_SETTLE_SECONDS));
+ }
Device settled;
if (lookup(monitor, result.device_address, settled))
result.dual_bond = settled.has_le_bearer && settled.le_bonded;
- // Hand the preference back to LE now that Classic has settled. Leaving the
- // bond pinned to BR/EDR keeps the LE half down indefinitely
- set_property(conn, device.path, IFACE_DEVICE, "PreferredBearer", g_variant_new_string("le"));
+ if (!settled.le_link_up())
+ set_property(conn, device.path, IFACE_DEVICE, "PreferredBearer", g_variant_new_string("le"));
// Only now solicit ANCS. This advert is what makes iOS reveal its
// "Show Message Notifications" and "Sync Contacts" toggles, and it is safe
// to broadcast because the bond already exists.
std::string advert_err;
if (start_advert(monitor, adapter_path, advert_err)) {
+ hold_advert_for(ANCS_ADVERT_TIMEOUT_SECONDS);
notify(progress,
"soliciting",
"Open Settings > Bluetooth > (i) on the iPhone and enable Show Message Notifications and "
diff --git a/src/core/src/bluetooth/pbap_session.cpp b/src/core/src/bluetooth/pbap_session.cpp
index fda2e4a..d73f546 100644
--- a/src/core/src/bluetooth/pbap_session.cpp
+++ b/src/core/src/bluetooth/pbap_session.cpp
@@ -23,13 +23,15 @@ namespace tether::bluetooth {
return false;
}
- // The phonebook is personal data, so it is staged in the per-user runtime
- // directory rather than a world-readable /tmp.
+ // The phonebook is personal data and obexd writes the file under its own
+ // umask, so there is nowhere safe to stage it but the per-user runtime
+ // directory. Falling back to a shared /tmp would leave it readable and its
+ // predictable name a symlink target; refuse instead.
std::filesystem::path staging_file() {
const char* runtime = getenv("XDG_RUNTIME_DIR");
- std::filesystem::path dir =
- runtime && *runtime ? std::filesystem::path(runtime) : std::filesystem::temp_directory_path();
- return dir / ("tether-pbap-" + std::to_string(getpid()) + ".vcf");
+ if (!runtime || !*runtime)
+ return {};
+ return std::filesystem::path(runtime) / ("tether-pbap-" + std::to_string(getpid()) + ".vcf");
}
std::string read_file(const std::filesystem::path& path) {
@@ -79,6 +81,10 @@ namespace tether::bluetooth {
std::vector<VCard> contacts;
const std::filesystem::path target = staging_file();
+ if (target.empty()) {
+ err = "XDG_RUNTIME_DIR is not set, and the phonebook cannot be staged anywhere else.";
+ return contacts;
+ }
std::error_code ec;
std::filesystem::remove(target, ec);
diff --git a/src/core/src/bluetooth/profile_supervisor.cpp b/src/core/src/bluetooth/profile_supervisor.cpp
index 367190c..0ba14ee 100644
--- a/src/core/src/bluetooth/profile_supervisor.cpp
+++ b/src/core/src/bluetooth/profile_supervisor.cpp
@@ -125,6 +125,7 @@ namespace tether::bluetooth {
map_retried_ = false;
pbap_retried_ = false;
next_attempt_ = 0;
+ next_verify_ = 0;
status_.map_open = false;
status_.pbap_open = false;
}
@@ -170,6 +171,28 @@ namespace tether::bluetooth {
return false;
}
+ // A session obexd has dropped still says open, and the short-circuit below means nothing ever notices.
+ void ProfileSupervisor::verify_sessions(int64_t now) {
+ if (now < next_verify_)
+ return;
+ next_verify_ = now + PROFILE_VERIFY_SECONDS;
+
+ if (status_.map_open && !ops_.session_alive(map_path_)) {
+ debug::log(WARN, "bluetooth: the MAP session is gone; reopening it");
+ map_path_.clear();
+ map_retried_ = false;
+ status_.map_open = false;
+ next_attempt_ = 0;
+ }
+ if (status_.pbap_open && !ops_.session_alive(pbap_path_)) {
+ debug::log(WARN, "bluetooth: the PBAP session is gone; reopening it");
+ pbap_path_.clear();
+ pbap_retried_ = false;
+ status_.pbap_open = false;
+ next_attempt_ = 0;
+ }
+ }
+
bool ProfileSupervisor::tick(int64_t now, bool device_ready) {
ProfileStatus previous = status_;
@@ -178,6 +201,8 @@ namespace tether::bluetooth {
return !(status_ == previous);
}
+ verify_sessions(now);
+
if (status_.map_open && status_.pbap_open) {
status_.reason = _("Messages and contacts are connected.");
return !(status_ == previous);
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index f2a6334..b28d6ce 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -436,6 +436,12 @@ namespace tether {
broadcast_local_event(build_bt_status().dump());
}
+ static void restart_supervision(bluetooth::Config config) {
+ if (bluetooth::g_bt_connections)
+ bluetooth::g_bt_connections->set_device(bluetooth::supervised_address(config), config.ancs_enabled);
+ broadcast_local_event(build_bt_status().dump());
+ }
+
static void run_bt_unpair(const std::string& address) {
if (!bluetooth::g_bluez)
return;
@@ -740,16 +746,25 @@ namespace tether {
debug::log(INFO, "UnixServer: New connection (fd: {})", client_fd);
}
+ // Generous against the ~683 KB base64 payloads file transfers push through,
+ // and far short of what an unframed stream would cost.
+ static constexpr size_t MAX_CLIENT_BUFFER_BYTES = 16u * 1024 * 1024;
+
void UnixServer::handle_client(int client_fd) {
// 64k buffer sizes for chunks
char buf[65536];
ssize_t n = read(client_fd, buf, sizeof(buf));
if (n > 0) {
- // Reference + cursor rather than erase(0, ...) per message: the old form
- // shifted the whole remaining buffer down for every line, which is O(n^2)
- // over the ~683 KB base64 payloads file transfers push through here.
std::string& buffer = client_buffers_[client_fd];
buffer.append(buf, n);
+ if (buffer.size() > MAX_CLIENT_BUFFER_BYTES) {
+ debug::log(ERR, "UnixServer: client {} sent an unframed stream; dropping it", client_fd);
+ client_buffers_.erase(client_fd);
+ unregister_client_fd(client_fd);
+ loop_.removeFd(client_fd);
+ close(client_fd);
+ return;
+ }
size_t start = 0;
size_t pos;
@@ -764,19 +779,12 @@ namespace tether {
register_local_subscriber(client_fd);
std::string payload = build_local_state_snapshot().dump() + "\n";
write_plain_packet(client_fd, payload);
- // Replay any current OTP so a freshly reconnected extension
- // (MV3 service worker restart) gets it without waiting for a
- // new_otp push it may have missed while disconnected. Skip the
- // replay once a page has already taken the code, otherwise the
- // restart re-injects it into whatever site the user is on now.
+
if (Otp otp = otp_peek(); otp && !otp_is_claimed()) {
std::string otp_payload = make_otp_event(otp).dump() + "\n";
write_plain_packet(client_fd, otp_payload);
}
- // Same reasoning for Bluetooth: connection status is only
- // broadcast when it changes, so a client that subscribed
- // after the last change would otherwise never learn whether
- // messages are connected, and would keep its composer shut.
+
write_plain_packet(client_fd, build_bt_connection_status().dump() + "\n");
continue;
} else if (j.contains("command") && j["command"] == "unsubscribe") {
@@ -819,10 +827,7 @@ namespace tether {
auto config = bluetooth::load_config();
config.device_address = j["address"];
bluetooth::save_config(config);
- if (bluetooth::g_bt_connections)
- bluetooth::g_bt_connections->set_device(bluetooth::supervised_address(config),
- config.ancs_enabled);
- broadcast_local_event(build_bt_status().dump());
+ std::thread(restart_supervision, config).detach();
} else if (j.contains("command") && j["command"] == "bt_list_threads") {
std::string payload = build_bt_threads().dump() + "\n";
write_plain_packet(client_fd, payload);
@@ -842,10 +847,7 @@ namespace tether {
handles.push_back(j["handle"].get<std::string>());
}
const bool read = j.value("read", true);
- // Each write-through is a blocking OBEX call against a
- // session that serves them one at a time, so the batch gets
- // one worker rather than a thread per message, and reports
- // once rather than making the UI refresh per handle.
+
if (!handles.empty()) {
std::thread([handles, read]() {
int changed = 0;
@@ -886,9 +888,6 @@ namespace tether {
event["thread"] = thread;
event["success"] = bluetooth::send_message(thread, body, sent, err);
if (event["success"]) {
- // The phone reports nothing about a sent message,
- // so the local record is announced the same way an
- // incoming one would be.
nlohmann::json message = bluetooth::to_json(sent);
message["command"] = "bt_message";
broadcast_local_event(message.dump());
@@ -898,17 +897,10 @@ namespace tether {
broadcast_local_event(event.dump());
}).detach();
} else if (j.contains("command") && j["command"] == "bt_solicit") {
- // The advertisement that makes iOS reveal its Messages and
- // Contacts permission toggles is otherwise only on air for a
- // few minutes after pairing, leaving a full unpair/re-pair as
- // the only way back.
std::thread([]() {
nlohmann::json event;
event["command"] = "bt_solicit_result";
- // Telling someone to switch on what is already on and
- // already working reads as the app not knowing its own
- // state. Nothing needs soliciting in that case.
if (build_bt_connection_status().value("ancs_ready", false)) {
event["success"] = true;
event["message"] = _("Notification mirroring is already active; nothing to do.");
@@ -933,18 +925,12 @@ namespace tether {
auto config = bluetooth::load_config();
config.ancs_enabled = j.value("enabled", true);
bluetooth::save_config(config);
- if (bluetooth::g_bt_connections)
- bluetooth::g_bt_connections->set_device(bluetooth::supervised_address(config),
- config.ancs_enabled);
- broadcast_local_event(build_bt_status().dump());
+ std::thread(restart_supervision, config).detach();
} else if (j.contains("command") && j["command"] == "bt_set_enabled") {
auto config = bluetooth::load_config();
config.enabled = j.value("enabled", true);
bluetooth::save_config(config);
- if (bluetooth::g_bt_connections)
- bluetooth::g_bt_connections->set_device(bluetooth::supervised_address(config),
- config.ancs_enabled);
- broadcast_local_event(build_bt_status().dump());
+ std::thread(restart_supervision, config).detach();
} else if (j.contains("command") && j["command"] == "bt_set_ancs_content") {
auto config = bluetooth::load_config();
config.ancs_content_enabled = j.value("enabled", true);
@@ -1135,8 +1121,7 @@ namespace tether {
}).detach();
} else if (j.contains("command") && j["command"] == "send_file" && j.contains("path")) {
std::string path = j["path"];
- int pfd = client_fd; // thread-safe capture
- std::thread([path, pfd]() {
+ std::thread([path]() {
Client local;
if (local.connect("", 0)) { // connects correctly via unix socket
std::string err;
@@ -1146,12 +1131,8 @@ namespace tether {
resp["success"] = ok;
resp["message"] = ok ? ("Sent " + std::filesystem::path(path).filename().string())
: ("Send failed: " + (err.empty() ? "unknown error" : err));
- std::string payload = resp.dump() + "\n";
- // direct write is fine, or we can use broadcast_local_event. We'll reply directly to
- // the GUI socket.
- if (write(pfd, payload.c_str(), payload.size()) < 0) {
- debug::log(ERR, "net write error\n");
- }
+
+ broadcast_local_event(resp.dump());
}
}).detach();
continue; // skip the "OK\n" below because we reply asynchronously
@@ -1339,10 +1320,24 @@ namespace tether {
char buf[65536];
int n = SSL_read(ssl, buf, sizeof(buf));
if (n > 0) {
- // See UnixServer::handle_client — cursor instead of a per-message erase.
- // This is the hot path for inbound file transfers.
+
std::string& buffer = client_buffers_[client_fd];
+
buffer.append(buf, n);
+ if (buffer.size() > MAX_CLIENT_BUFFER_BYTES) {
+ debug::log(ERR, "TcpServer: client {} sent an unframed stream; dropping it", client_fd);
+ SSL_free(ssl);
+ active_ssl_.erase(client_fd);
+ client_buffers_.erase(client_fd);
+ ssl_handshake_complete_.erase(client_fd);
+ client_paired_.erase(client_fd);
+ client_info_.erase(client_fd);
+ connected_remote_clients.erase(client_fd);
+ unregister_client_fd(client_fd);
+ loop_.removeFd(client_fd);
+ close(client_fd);
+ return;
+ }
size_t start = 0;
size_t pos;
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index da3d2e1..ec6dbf3 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
#include <deque>
#include <filesystem>
+#include <memory>
#include <string>
#include <tether/crypto.hpp>
#include <tether/discovery.hpp>
@@ -100,6 +101,15 @@ namespace tether::ui {
return !supervised.empty() && supervised == address;
}
+ std::string connection_reason(const nlohmann::json& connection) {
+ const bool link_degraded =
+ !connection.value("classic_connected", false) || !connection.value("le_connected", false);
+ std::string reason = connection.value(link_degraded ? "link_reason" : "profile_reason", "");
+ if (reason.empty())
+ reason = connection.value("link_reason", "");
+ return reason;
+ }
+
void set_capability_row(GtkWidget* label, const std::string& title, bool ok, const std::string& note) {
std::string markup = std::string(ok ? "\u2713" : "\u2717") + " <b>" + escape_markup(title) + "</b>";
if (!note.empty())
@@ -218,10 +228,7 @@ namespace tether::ui {
// otherwise report no device selected.
reason = _("Bluetooth is switched off for this iPhone.");
} else {
- const bool link_degraded = !classic || !le;
- reason = connection.value(link_degraded ? "link_reason" : "profile_reason", "");
- if (reason.empty())
- reason = connection.value("link_reason", "");
+ reason = connection_reason(connection);
}
set_text(g_devices.lbl_bt_reason, reason);
@@ -962,9 +969,7 @@ namespace tether::ui {
if (command == "bt_connection_changed") {
g_devices.bt_connection = event;
const bool connected = event.value("map_open", false) || event.value("ancs_ready", false);
- std::string detail = event.value("profile_reason", "");
- if (detail.empty())
- detail = event.value("link_reason", "");
+ std::string detail = connection_reason(event);
if (detail.empty() && connected)
detail = _("Messages and notifications are connected.");
set_route_status(Route::Bluetooth, connected, detail);
@@ -992,15 +997,21 @@ namespace tether::ui {
return false;
}
if (command == "bt_pair_confirm_request") {
- GtkWidget* dialog = gtk_message_dialog_new(GTK_WINDOW(main_window()),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
- _("Does the iPhone show this code?\n\n%s"),
- event.value("code", "").c_str());
- const bool confirmed = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK;
- gtk_widget_destroy(dialog);
- daemon_send({{"command", "bt_pair_confirm"}, {"accept", confirmed}});
+ g_idle_add(
+ [](gpointer data) -> gboolean {
+ std::unique_ptr<std::string> code(static_cast<std::string*>(data));
+ GtkWidget* dialog = gtk_message_dialog_new(GTK_WINDOW(main_window()),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ _("Does the iPhone show this code?\n\n%s"),
+ code->c_str());
+ const bool confirmed = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK;
+ gtk_widget_destroy(dialog);
+ daemon_send({{"command", "bt_pair_confirm"}, {"accept", confirmed}});
+ return G_SOURCE_REMOVE;
+ },
+ new std::string(event.value("code", "")));
return true;
}
if (command == "bt_pair_progress") {
diff --git a/test/test_ancs_sequencer.cpp b/test/test_ancs_sequencer.cpp
index 43c7a4a..81c0a98 100644
--- a/test/test_ancs_sequencer.cpp
+++ b/test/test_ancs_sequencer.cpp
@@ -127,6 +127,34 @@ TEST(AncsSequencer, MatchesEachResponseToItsOwnRequest) {
EXPECT_EQ(harness.completions[1].second.attribute(0), "com.example.second");
}
+// Data Source responses carry no request identifier, so a response that arrives
+// after its own request timed out reassembles cleanly against whatever is in
+// flight by then. The sequencer cannot tell them apart -- the echoed uid is the
+// only thing that can, which is why the client compares it before filing the
+// attributes against a notification.
+TEST(AncsSequencer, ALateResponseIsDeliveredAgainstTheWrongRequest) {
+ Harness harness;
+ auto sequencer = harness.make();
+
+ sequencer.submit(build_notification_request(11, {NotificationAttributeId::AppIdentifier}));
+ sequencer.submit(build_notification_request(22, {NotificationAttributeId::AppIdentifier}));
+ sequencer.tick(0);
+
+ // The phone never answers for 11, so it is failed and 22 goes out.
+ sequencer.tick(REQUEST_TIMEOUT_SECONDS);
+ ASSERT_EQ(harness.failures.size(), 1u);
+ ASSERT_EQ(harness.writes.size(), 2u);
+
+ // 11's answer turns up now, while 22 is the one in flight.
+ auto late = notification_response(11, "com.example.first");
+ sequencer.on_data_source(late.data(), late.size(), REQUEST_TIMEOUT_SECONDS + 1);
+
+ ASSERT_EQ(harness.completions.size(), 1u);
+ EXPECT_EQ(harness.completions[0].first.uid, 22u) << "the sequencer credits it to the live request";
+ EXPECT_EQ(harness.completions[0].second.uid, 11u) << "and the echoed uid is what gives it away";
+ EXPECT_NE(harness.completions[0].first.uid, harness.completions[0].second.uid);
+}
+
// An action gets no Data Source response at all, so waiting for one would stall
// every queued request behind it for the full timeout.
TEST(AncsSequencer, DoesNotWaitForAResponseToAnAction) {
@@ -210,8 +238,8 @@ TEST(AncsSequencer, BoundsTheQueue) {
size_t accepted = 0;
for (size_t i = 0; i < MAX_QUEUED_REQUESTS + 10; ++i) {
- if (sequencer.submit(build_notification_request(static_cast<uint32_t>(i),
- {NotificationAttributeId::AppIdentifier})))
+ if (sequencer.submit(
+ build_notification_request(static_cast<uint32_t>(i), {NotificationAttributeId::AppIdentifier})))
++accepted;
}
EXPECT_EQ(accepted, MAX_QUEUED_REQUESTS) << "a notification burst must not grow the daemon without bound";
diff --git a/test/test_bluetooth_supervisor.cpp b/test/test_bluetooth_supervisor.cpp
index ed00dcf..9ff0814 100644
--- a/test/test_bluetooth_supervisor.cpp
+++ b/test/test_bluetooth_supervisor.cpp
@@ -2,6 +2,7 @@
#include <tether/bluetooth/bearer_supervisor.hpp>
#include <tether/bluetooth/profile_supervisor.hpp>
+#include <set>
#include <string>
#include <vector>
@@ -66,6 +67,8 @@ namespace {
int pbap_attempts = 0;
std::vector<std::string> removed;
int session_counter = 0;
+ // Sessions obexd has let go. Everything else answers alive.
+ std::set<std::string> dead;
std::string create_session(const std::string& target, std::string& err) override {
const bool is_map = target == "map";
@@ -79,6 +82,8 @@ namespace {
}
void remove_session(const std::string& path) override { removed.push_back(path); }
+
+ bool session_alive(const std::string& path) override { return !dead.count(path); }
};
} // namespace
@@ -215,6 +220,81 @@ TEST(BearerSupervisor, SolicitationIsHeldOffOnlyWhileTheOneDialIsInFlight) {
}
}
+// A dial outstanding when BR/EDR drops must not latch the solicitation off air.
+// Nothing else on the Classic-down path re-reads it, and the advert is the only
+// thing that brings LE back -- so a stale `true` here is a permanent outage on a
+// host whose Classic link never returns (2026-08-23).
+TEST(BearerSupervisor, ClassicDroppingUnderADialDoesNotLatchTheSolicitationOffAir) {
+ class ListeningBearer : public FakeBearer {
+ public:
+ ConnectResult connect_le(std::string&) override {
+ ++le_attempts;
+ outstanding = true;
+ return ConnectResult::Requested;
+ }
+ } ops;
+
+ BearerSupervisor sup(ops, true);
+ int64_t now = 0;
+ sup.tick(now);
+ sup.tick(++now);
+ now += BEARER_SETTLE_SECONDS;
+ sup.tick(now);
+ ASSERT_EQ(ops.le_attempts, 1);
+ ASSERT_TRUE(sup.status().le_dialling);
+
+ // BR/EDR goes and does not come back, which is what a host with no locally
+ // connectable profile looks like.
+ ops.classic = false;
+ ops.classic_succeeds = false;
+ sup.tick(++now);
+ EXPECT_TRUE(sup.status().le_dialling) << "the dial really is still in flight";
+
+ // BlueZ answers. Nothing re-enters the LE branch, so this is the only place
+ // the flag can be cleared.
+ ops.outstanding = false;
+ for (int i = 0; i < 500; ++i)
+ sup.tick(++now);
+ EXPECT_FALSE(sup.status().le_dialling)
+ << "a finished dial kept the advert off air for the whole time BR/EDR was down";
+
+ BearerStatus bearer = sup.status();
+ bearer.le_available = true;
+ EXPECT_TRUE(should_solicit_ancs(true, bearer, now, -1)) << "the advert is what brings LE back";
+}
+
+// A session obexd has let go still reads open, and the supervisor short-circuits
+// once both are. PBAP has no other liveness signal, and on a host where BlueZ
+// never reports the Classic link up there is no reset() to fall back on either.
+TEST(ProfileSupervisor, ReopensASessionObexdHasDropped) {
+ FakeProfiles ops;
+ ProfileSupervisor sup(ops);
+
+ int64_t now = 0;
+ sup.tick(now, true);
+ ASSERT_TRUE(sup.status().map_open);
+ ASSERT_TRUE(sup.status().pbap_open);
+ const std::string pbap = sup.pbap_session();
+ const int opened = ops.pbap_attempts;
+
+ // Nothing yet: the check is not free, so it runs on its own interval.
+ ops.dead.insert(pbap);
+ sup.tick(++now, true);
+ EXPECT_EQ(ops.pbap_attempts, opened);
+ EXPECT_EQ(sup.pbap_session(), pbap);
+
+ // Dead, with the Classic link never dropping to say so. Noticed and reopened
+ // in the same tick, the way drop_map() already behaves.
+ now += PROFILE_VERIFY_SECONDS;
+ sup.tick(now, true);
+ EXPECT_TRUE(sup.status().pbap_open);
+ EXPECT_GT(ops.pbap_attempts, opened) << "a dropped session read open forever";
+ EXPECT_NE(sup.pbap_session(), pbap);
+
+ EXPECT_TRUE(sup.status().map_open) << "the live session must not be disturbed";
+ EXPECT_EQ(ops.map_attempts, 1);
+}
+
// A dialled LE link can come up carrying no ANCS at all, and while it reads
// connected the solicitation stays off air -- so nothing ever asks the phone for
// the service, and notifications never arrive (2026-08-23).
diff --git a/test/test_bmessage_build.cpp b/test/test_bmessage_build.cpp
index 8889085..cb4e43c 100644
--- a/test/test_bmessage_build.cpp
+++ b/test/test_bmessage_build.cpp
@@ -107,6 +107,31 @@ TEST(BMessageBuild, LengthCountsTheWholeMessageBlock) {
EXPECT_EQ(declared, std::string("hello").size() + 22);
}
+// The block is BEGIN:MSG CRLF <body> CRLF END:MSG, so the CRLF before END:MSG is
+// a delimiter and not content. A body the user ended with a newline used to
+// carry two surplus blank lines into it.
+TEST(BMessageBuild, ATrailingNewlineDoesNotBecomeBlankLines) {
+ auto block = [](const std::string& body) {
+ const std::string out = build_bmessage({tel("+15551234567")}, body);
+ const size_t begin = out.find("BEGIN:MSG\r\n");
+ const size_t end = out.find("END:MSG\r\n", begin);
+ EXPECT_NE(begin, std::string::npos);
+ EXPECT_NE(end, std::string::npos);
+ return out.substr(begin, end + std::string("END:MSG\r\n").size() - begin);
+ };
+
+ EXPECT_EQ(block("hello"), "BEGIN:MSG\r\nhello\r\nEND:MSG\r\n");
+ EXPECT_EQ(block("hello\n"), "BEGIN:MSG\r\nhello\r\nEND:MSG\r\n") << "a trailing newline is not content";
+ EXPECT_EQ(block("a\nb"), "BEGIN:MSG\r\na\r\nb\r\nEND:MSG\r\n");
+ EXPECT_EQ(block("a\n\nb"), "BEGIN:MSG\r\na\r\n\r\nb\r\nEND:MSG\r\n") << "an internal blank line is";
+
+ // LENGTH has to keep counting whatever the block actually became.
+ const std::string out = build_bmessage({tel("+15551234567")}, "hello\n");
+ const size_t length_at = out.find("LENGTH:");
+ ASSERT_NE(length_at, std::string::npos);
+ EXPECT_EQ(std::stoul(out.substr(length_at + 7)), block("hello\n").size());
+}
+
// --- The trust boundary --------------------------------------------------
//
// Every case below is an address that, interpolated verbatim, would add a
diff --git a/test/test_bt_diagnostics.cpp b/test/test_bt_diagnostics.cpp
index 087c079..ee14ce6 100644
--- a/test/test_bt_diagnostics.cpp
+++ b/test/test_bt_diagnostics.cpp
@@ -33,6 +33,35 @@ TEST(BtDiagnostics, RedactsEmailAndPhoneNumber) {
EXPECT_EQ(r.text("sent to [email protected]"), "sent to <email-1>");
}
+// A device alias is chosen by its owner and is usually a person's name. It
+// reaches the report through free-form fields -- a pairing progress detail, a
+// result message -- where no pattern would recognise it.
+TEST(BtDiagnostics, RedactsARegisteredDeviceAlias) {
+ Redactor r;
+ r.hide("Zack's iPhone", "name");
+ EXPECT_EQ(r.text("connecting Zack's iPhone"), "connecting <name-1>");
+ EXPECT_EQ(r.text("Paired with Zack's iPhone."), "Paired with <name-1>.");
+ EXPECT_EQ(r.text("Zack's iPhone"), "<name-1>") << "the same alias keeps the same placeholder";
+}
+
+// Replacing a model name would rewrite the advice strings that name the same
+// word, and it identifies nobody.
+TEST(BtDiagnostics, LeavesAGenericDeviceNameAlone) {
+ Redactor r;
+ r.hide("iPhone", "name");
+ r.hide("AirPods", "name");
+ EXPECT_EQ(r.text("The iPhone is not answering on LE."), "The iPhone is not answering on LE.");
+ EXPECT_EQ(r.text("connecting AirPods"), "connecting AirPods");
+}
+
+// An alias can contain an address or a number, and the whole thing should go as
+// one placeholder rather than being half-eaten by the patterns.
+TEST(BtDiagnostics, AnAliasWinsOverThePatternsInsideIt) {
+ Redactor r;
+ r.hide("Zack 60:57:C8:30:6A:F7", "name");
+ EXPECT_EQ(r.text("connecting Zack 60:57:C8:30:6A:F7"), "connecting <name-1>");
+}
+
TEST(BtDiagnostics, LeavesTimestampsAndErrorCodesAlone) {
Redactor r;
const std::string out = r.text("2026-08-16T10:11:12 failed with 0x43 after 30000 ms");