From 61997912fd8191153c67c38af436980460af7933 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 4 Apr 2016 20:06:07 +0200 Subject: made sure the disco#items query has returned before finalizing the bind --- .../siacs/conversations/xmpp/XmppConnection.java | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 6371f115..b3fd122f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -39,6 +39,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.KeyManager; @@ -114,7 +116,8 @@ public class XmppConnection implements Runnable { private long lastConnect = 0; private long lastSessionStarted = 0; private long lastDiscoStarted = 0; - private int mPendingServiceDiscoveries = 0; + private AtomicInteger mPendingServiceDiscoveries = new AtomicInteger(0); + private AtomicBoolean mIsServiceItemsDiscoveryPending = new AtomicBoolean(true); private final ArrayList mPendingServiceDiscoveriesIds = new ArrayList<>(); private boolean mInteractive = false; private int attempt = 0; @@ -923,7 +926,7 @@ public class XmppConnection implements Runnable { disconnect(true); } } else { - Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure ("+packet.toString()); + Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure (" + packet.toString()); disconnect(true); } } @@ -1008,7 +1011,8 @@ public class XmppConnection implements Runnable { synchronized (this.disco) { this.disco.clear(); } - mPendingServiceDiscoveries = mServerIdentity == Identity.NIMBUZZ ? 1 : 0; + mPendingServiceDiscoveries.set(mServerIdentity == Identity.NIMBUZZ ? 1 : 0); + mIsServiceItemsDiscoveryPending.set(true); lastDiscoStarted = SystemClock.elapsedRealtime(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery"); mXmppConnectionService.scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode()); @@ -1032,7 +1036,7 @@ public class XmppConnection implements Runnable { private void sendServiceDiscoveryInfo(final Jid jid) { if (mServerIdentity != Identity.NIMBUZZ) { - mPendingServiceDiscoveries++; + mPendingServiceDiscoveries.incrementAndGet(); } final IqPacket iq = new IqPacket(IqPacket.TYPE.GET); iq.setTo(jid); @@ -1077,14 +1081,8 @@ public class XmppConnection implements Runnable { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not query disco info for " + jid.toString()); } if (packet.getType() != IqPacket.TYPE.TIMEOUT) { - mPendingServiceDiscoveries--; - if (mPendingServiceDiscoveries == 0) { - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done with service discovery"); - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": online with resource " + account.getResource()); - if (bindListener != null) { - bindListener.onBind(account); - } - changeStatus(Account.State.ONLINE); + if (mPendingServiceDiscoveries.decrementAndGet() == 0 && !mIsServiceItemsDiscoveryPending.get()) { + finalizeBind(); } } } @@ -1094,6 +1092,14 @@ public class XmppConnection implements Runnable { } } + private void finalizeBind() { + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": online with resource " + account.getResource()); + if (bindListener != null) { + bindListener.onBind(account); + } + changeStatus(Account.State.ONLINE); + } + private void enableAdvancedStreamFeatures() { if (getFeatures().carbons() && !features.carbonsEnabled) { sendEnableCarbons(); @@ -1128,6 +1134,12 @@ public class XmppConnection implements Runnable { } else { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not query disco items of " + server); } + if (packet.getType() != IqPacket.TYPE.TIMEOUT) { + mIsServiceItemsDiscoveryPending.set(false); + if (mPendingServiceDiscoveries.get() == 0) { + finalizeBind(); + } + } } }); } -- cgit v1.2.3 From 57876879979a9842d646415139656e3ad5a3d22e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 4 Apr 2016 20:07:09 +0200 Subject: removed unnecessary wait for disconnect --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 28ac4d19..e477046c 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2571,12 +2571,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (!account.isOptionSet(Account.OPTION_DISABLED)) { if (!force) { disconnect(account, false); - try { - Log.d(Config.LOGTAG, "wait for disconnect"); - Thread.sleep(500); //sleep wait for disconnect - } catch (InterruptedException e) { - //ignored - } } Thread thread = new Thread(connection); connection.setInteractive(interactive); -- cgit v1.2.3 From e94e06246b007b5991c1f03e30f5b2ab8604d712 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 4 Apr 2016 20:21:00 +0200 Subject: pulled translations from transifex --- src/main/res/values-bg/strings.xml | 4 ++++ src/main/res/values-de/strings.xml | 8 ++++++-- src/main/res/values-es/strings.xml | 4 ++++ src/main/res/values-eu/strings.xml | 4 ++++ src/main/res/values-fr/strings.xml | 32 ++++++++++++++++---------------- src/main/res/values-it/strings.xml | 5 +++++ src/main/res/values-ja/strings.xml | 4 ++++ src/main/res/values-nl/strings.xml | 4 ++++ src/main/res/values-pt/strings.xml | 20 ++++++++++++-------- src/main/res/values-ro-rRO/strings.xml | 4 ++++ src/main/res/values-sr/strings.xml | 4 ++++ src/main/res/values-sv/strings.xml | 4 ++++ 12 files changed, 71 insertions(+), 26 deletions(-) (limited to 'src/main') diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml index b7589244..daa07b08 100644 --- a/src/main/res/values-bg/strings.xml +++ b/src/main/res/values-bg/strings.xml @@ -71,6 +71,8 @@ доставянето се провали отказано Подготовка на изображението за изпращане + Подготовка на изображенията за изпращане + Споделяне на файлове. Моля, изчакайте… Изчистване на историята Изчистване на историята на разговорите Искате ли да изтриете всички съобщения от този разговор?\n\nВнимание: Това няма да изтрие съобщенията, съхранявани на други устройства или на сървърите. @@ -351,6 +353,7 @@ Изберете файл Получаване на %1$s (%2$d%% завършено) Сваляне на %s + Изтриване на %s файл Отваряне на %s изпращане (%1$d%% завършено) @@ -542,6 +545,7 @@ Зареждане на още съобщения Файлът е споделен с %s Изображението е споделено с %s + Изображения, споделени с %s Conversations се нуждае от достъп до външно място за съхранение Синхронизиране с контактите Conversations иска да съчетае Вашия списък в XMPP с контактите Ви, за да показва пълните им имена и снимки..\n\nConversations единствено ще чете контактите Ви и ще ги използва вътрешно, без да ги качва на сървъра Ви.\n\nЩе бъдете помолен/а за позволение за достъп до контактите Ви. diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 9de60995..68325e00 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -71,6 +71,8 @@ Zustellung fehlgeschlagen abgelehnt Bild wird für Übertragung vorbereitet + Bilder werden für Übertragung vorbereitet + Teile Dateien. Bitte warten… Verlauf löschen Verlauf löschen Möchtest du alle Nachrichten in dieser Unterhaltung löschen?\n\nAchtung: Dies beeinflusst nicht Nachrichten, die auf anderen Geräten oder Servern gespeichert sind. @@ -159,7 +161,7 @@ Vorübergehend abschalten Avatar veröffentlichen Öffentlichen OpenPGP-Schlüssel veröffentlichen - Aktivieren + Konto aktivieren Bist du dir sicher? Wenn du dein Konto löschst, gehen alle Gesprächsverläufe verloren Sprache aufzeichnen @@ -351,6 +353,7 @@ Datei auswählen Empfange %1$s (%2$d%% abgeschlossen) %s herunterladen + %s löschen Datei %s öffnen Senden (%1$d%% abgeschlossen) @@ -542,6 +545,7 @@ Weitere Nachrichten laden Datei mit %s geteilt Bild mit %s geteilt + Bilder mit %s geteilt Conversations benötigt Zugriff auf externen Speicher Mit Kontakten synchronisieren Conversations möchte deine XMPP-Kontaktliste mit deinen Kontakten abgleichen, um deren vollständige Namen und Avatare anzuzeigen.\n\nConversations wird deine Kontakte nur lokal lesen und abgleichen und überträgt diese nicht auf den Server.\n\nDu wirst nun gefragt, ob du den Zugriff auf deine Kontakte erlauben möchtest. @@ -572,5 +576,5 @@ Korrigierte Nachricht senden Du vertraust diesem Kontakt bereits. Durch Auswählen von \"Fertig\" bestätigst du, dass %s Teil dieser Konferenz ist. Bild auswählen und zuschneiden - Du hast diesen Account deaktiviert + Du hast dieses Konto deaktiviert diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index f630f7ca..5af941b3 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -71,6 +71,8 @@ Error al enviar rechazado Preparando imagen para enviar + Preparando imágenes para enviar + Compartiendo ficheros. Por favor, espera... Limpiar historial Limpiar historial de conversación ¿Quieres borrar todos los mensajes de esta conversación?\n\nAviso: Esto no afectará a los mensajes guardados en otros dispositivos o servidores. @@ -351,6 +353,7 @@ Seleccionar archivo Recibiendo %1$s (%2$d%% completado) Descargar %s + Eliminar %s archivo Abrir %s Enviando (%1$d%% completado) @@ -542,6 +545,7 @@ Cargar más mensajes Archivo compartido con %s Imagen compartida con %s + Imágenes compartidas con %s Conversations necesita acceder al almacenamiento externo Sincronizar contactos Conversations quiere cruzar tu lista de contactos de XMPP con tus contactos del móvil para mostrar sus nombres completos y sus fotos de perfil.\n\nConversations solo leerá tus contactos y los cruzará localmente sin subirlos a tu servidor.\n\nEl sistema te preguntará ahora para conceder los permisos de acceso a tus contactos del móvil. diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index e26be004..ed9fbeb5 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -71,6 +71,8 @@ huts bidaltzerakoan ukatua Irudia transmisiorako prestatzen. Mesedez itxaron… + Irudiak transmisiorako prestatzen + Fitxategiak partekatzen. Mesedez itxaron... Historia garbitu Elkarrizketa historia garbitu Elkarrizketa honetako mezu guztiak ezabatu nahi al dituzu?\n\nAbisua: Honek ez du beste gailu edo zerbitzarietan gordetako mezuetan eraginik izango. @@ -351,6 +353,7 @@ Fitxategia aukeratu %1$s jasotzen (%2$d%% osatua) %s deskargatu + Ezabatu %s fitxategia %s ireki bidaltzen (%1$d%% osatua) @@ -542,6 +545,7 @@ Mezu gehiago kargatu Fitxategia %s(r)ekin partekatu da Irudia %s(r)ekin partekatu da + Irudiak %s(r)ekin partekatu dira Conversationsek kanpoko biltegirako sarbidea behar du Kontaktuekin sinkronizatu Conversationsek zure XMPP zerrenda eta zure kontaktuak uztartu nahi ditu haien izenak eta argazkiak erakusteko.\n\nConversationsek zure kontaktuak modu lokalean soilik irakurri eta uztartuko ditu, zure zerbitzarira kargatu gabe.\n\nJarraian baimenak eskatuko zaizkizu zure kontaktuetara sartu ahal izateko. diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 488a4b58..889f5092 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -76,7 +76,7 @@ Voulez-vous supprimer tous les messages de cette conversation ?\n\nAttention : Les messages seront supprimés uniquement sur cet appareil. Supprimer les messages Fermer cette conversation ensuite - Choisir le status de présence + Choisir le statut de présence Envoyer un message non chiffré Envoyer un message chiffré avec OTR Envoyer un message chiffré avec OMEMO @@ -86,7 +86,7 @@ Envoyer en clair Echec du déchiffrement. Avez-vous la bonne clef privée ? OpenKeychain - Conversations requiert une application tierce nommée OpenKeychain pour chiffrer et déchiffrer les messages.\n\nOpenKeychain est sous licence GPLv3 et est disponible sur F-Droid et Google Play.\n\n(Veuillez redémarrer Conversations apres l\'installation de l\'app) + Conversations requiert une application tierce nommée OpenKeychain pour chiffrer et déchiffrer les messages.\n\nOpenKeychain est sous licence GPLv3 et est disponible sur F-Droid et Google Play.\n\n(Veuillez redémarrer Conversations après l\'installation de l\'app) Redémarrer Installer Veuillez installer OpenKeychain @@ -184,9 +184,9 @@ Infos sur le serveur XEP-0313 : MAM XEP-0280 : Copies carbone - XEP-0352 : Indication status client + XEP-0352 : Indication statut client XEP-0191 : Commande de bloquage - XEP-0237 : Versionnement contacts + XEP-0237 : Révision contacts XEP-0198 : Gestion des flux XEP-0163 : PEP (Avatars / OMEMO) XEP-0363 : Envoi de fichiers via HTTP @@ -271,7 +271,7 @@ Veuillez demander à votre contact de partager ses mises à jour de présence.\n\nElles seront utilisées pour déterminer son client. Demander maintenant Supprimer l\'empreinte - Etes-vous sûr de vouloir supprimer l\'empreinte ? + Êtes-vous sûr de vouloir supprimer l\'empreinte ? Ignorer Attention : peut poser problème si l\'un des deux correspondants n\'a pas activé les mises à jour de présence.\n\nVérifiez dans les détails du contact que vous y avez bien souscrit. Sécurité @@ -284,7 +284,7 @@ Paramètres avancés À utiliser avec précaution. À propos - Informations sur la version et les licenses + Informations sur la version et les licences Heures tranquilles Heure de début Heure de fin @@ -297,7 +297,7 @@ Les messages reçus seront marqués d\'une coche verte (si supporté). Le bouton Envoyer change de couleur pour indiquer le statut du contact. Autres - Nom de la conférence + Nom de la conférence Identifier les conférences par leur sujet plutôt que leur JID. Rejoindre automatiquement les conférences Respecter le paramètre de connexion automatique des favoris de conférence @@ -322,7 +322,7 @@ URL copiée dans le presse-papier Message copié dans le presse-papier Échec lors de l\'envoi de l\'image - Scanner un QR code + Scanner un code QR Afficher le code QR Afficher la liste des contacts bloqués Détails du compte @@ -392,7 +392,7 @@ Impossible de changer le mot de passe Envoyez un message pour commencer la conversation chiffrée Poser une question - Si vous et votre contact avez en commun un secret que personne d\'autre ne connait (comme une blague ou ce que vous avez mangé lors de votre dernière rencontre), vous pouvez utiliser ce secret pour vérifier vos empreintes respectives.\n\nVous donnez un indice ou posez votre question à votre contact, qui répondra en faisant attention à la casse. + Si vous et votre contact avez en commun un secret que personne d\'autre ne connaît (comme une blague ou ce que vous avez mangé lors de votre dernière rencontre), vous pouvez utiliser ce secret pour vérifier vos empreintes respectives.\n\nVous donnez un indice ou posez votre question à votre contact, qui répondra en faisant attention à la casse. Votre contact souhaite confirmer votre identité grâce à un secret partagé. Il vous a envoyé le message/indice suivant concernant ce secret. Votre indice ne doit pas être vide Votre secret partagé ne doit pas être vide @@ -438,7 +438,7 @@ Touche Entrée pour envoyer Utiliser la touche Entrée pour envoyer un message. Afficher la touche Entrée - Remplacer le bouton des Émoticônes par un bouton Entrée. + Remplacer la touche Émoticônes par une touche Entrée. audio vidéo image @@ -451,7 +451,7 @@ L\'avatar a été publié ! %s en cours d\'envoi En train de proposer un(e) %s - Se cacher hors-ligne + Cacher contacts hors-ligne Désactiver le compte %s est en train d\'écrire %s a arrêté d\'écrire @@ -477,7 +477,7 @@ %d certificats supprimés - %d contact séléctionné + %d contact sélectionné %d contacts sélectionnés Remplacer le bouton Envoyer par une action rapide. @@ -491,7 +491,7 @@ Identifiant Identifiant Cet identifiant n\'est pas valide - Nom de la conférence + Nom de la conférence Ce nom de conférence n\'est pas valide Échec du téléchargement : impossible de trouver le serveur Échec du téléchargement : impossible de trouver le fichier @@ -507,7 +507,7 @@ Marque cette ressource comme indisponible quand l\'appareil est en mode silencieux Indisponible en mode vibreur Marque cette ressource comme indisponible quand l\'appareil est en mode vibreur - Paramètres de connexioin avancés + Paramètres de connexion avancés Montrer le nom d\'hôte et le port lors du paramétrage d\'un compte xmpp.example.com Ajouter un compte avec un certificat @@ -527,7 +527,7 @@ Clef OMEMO vérifiée avec un certificat ! Votre appareil ne supporte pas la sélection de certificats client ! Connexion - Connection via Tor + Connexion via Tor Rediriger toutes les connexions via le réseau Tor. Nécessite Orbot. Nom d\'hôte Port @@ -544,7 +544,7 @@ Image partagée avec %s Conversations a besoin d\'accéder au stockage externe Synchroniser avec contacts - Conversations souhaite associer vos contacts XMPP avec les contacts de votre appareil, pour utiliser leur nom complet et leur avatar.\n\nConversations va uniquement lire vos contacts et les associer localement, sans les uploader sur le serveur XMPP.\n\nVotre appareil va maintenant vous demander la permission d\'accéder à vos contacts. + Conversations souhaite associer vos contacts XMPP avec les contacts de votre appareil, pour utiliser leur nom complet et leur avatar.\n\nConversations va uniquement lire vos contacts et les associer localement, sans les envoyer sur le serveur XMPP.\n\nVotre appareil va maintenant vous demander la permission d\'accéder à vos contacts. Informations du certificat Sujet Émetteur diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index a512575b..83bcbda0 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -504,6 +504,8 @@ Imposta la tua risorsa come non disponibile quando lo schermo è spento Non disponibile in modalità silenzioso Imposta la tua risorsa come non disponibile quando il dispositivo è in modalità silenziosa + Tratta vibrazione come modalità silenziosa + Segna la tua risorsa come non disponibile quando il dispositivo ha solo la vibrazione Impostazioni estese di connessione Mostra nome host e impostazioni della porta quando configuri un account xmpp.esempio.it @@ -567,4 +569,7 @@ Questo campo è obbligatorio Correggi messaggio Invia messaggio corretto + Ti fidi già di questo contatto. Selezionando \'fatto\' stai solo confermando che %s fa parte di questa conferenza. + Seleziona immagine e ritagliala + Hai disabilitato questo account diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index 41ac0361..2268ca96 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -71,6 +71,8 @@ 配信に失敗しました 拒否されました 転送用画像の準備中 + 転送用画像の準備中 + フィルを共有しています。しばらくお待ちください… 履歴をクリア 会話履歴をクリア この会話のすべてのメッセージを削除しますか?\n\n警告: これは、他のデバイスやサーバーに保存されているメッセージには影響しません。 @@ -351,6 +353,7 @@ ファイルの選択 %1$s 受信中 (%2$d%% 完了) %s のダウンロード + %s を削除 ファイル %s を開く 送信中 (%1$d%% 完了) @@ -539,6 +542,7 @@ さらにメッセージをロード %s でファイルを共有 %s で画像を共有 + %s で画像を共有 Conversations は外部ストレージにアクセスが必要です 連絡先と同期 Conversations はフルネームやアバターを表示するために、連絡先と XMPP 名簿と一致するようにしたいです。\n\nConversations は、サーバーにアップロードすることはなく、ローカルで連絡先を読んで一致させるだけです。\n\n今、連絡先へのアクセス許可を付与するように求められます。 diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 9431e8cf..44e5dab6 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -71,6 +71,8 @@ afleveren mislukt geweigerd Bezig met voorbereiden van versturen van afbeelding + Bezig met voorbereiden van versturen van afbeeldingen + Bestanden delen. Even geduld… Geschiedenis wissen Gespreksgeschiedenis wissen Wil je alle berichten in dit gesprek verwijderen?\n\nWaarschuwing: Dit zal geen invloed hebben op de berichten opgeslagen op andere apparaten of servers. @@ -351,6 +353,7 @@ Bestand kiezen Ontvangen van %1$s (%2$d%% voltooid) %s downloaden + %s verwijderen bestand %s openen versturen (%1$d%% voltooid) @@ -542,6 +545,7 @@ Laad meer berichten Bestand gedeeld met %s Afbeelding gedeeld met %s + Afbeeldingen gedeeld met %s Conversations heeft toegang nodig tot de externe opslag Synchroniseer met contacten Conversations wil je XMPP-rooster met je contacten vergelijken om hun volledige namen en profielfoto\'s te tonen.\n\nConversations zal je contacten enkel lokaal lezen en vergelijken zonder ze te uploaden naar je server.\n\nJe zal nu gevraagd worden Conversations toegang te verlenen tot je contacten. diff --git a/src/main/res/values-pt/strings.xml b/src/main/res/values-pt/strings.xml index b66ecd5e..c779aa7c 100644 --- a/src/main/res/values-pt/strings.xml +++ b/src/main/res/values-pt/strings.xml @@ -1,27 +1,27 @@ - Configurações + Definições Nova conversa Gerir contas Finalizar essa conversa - Detalhes do contato + Detalhes do contacto Detalhes da conferência Conversa segura Adicionar conta Editar nome Adicionar ao livro de endereços Apagar da lista - Bloquear contato - Desbloquear contato + Bloquear contacto + Desbloquear contacto Bloquear domínio Desbloquear domínio Gerir contas - Configurações + Definições Detalhes da conferência - Detalhes do contato + Detalhes do contacto Compartilhar conversa Iniciar conversa - Escolher contato + Escolher contacto Bloquear lista agora há pouco 1 minuto atrás @@ -71,6 +71,8 @@ a entrega falhou rejeitado Preparando a imagem para transmissão + Preparando as imagens para a transmissão + Partilhando os ficheiros. Por favor aguarde... Limpar histórico Limpar o histórico de conversas Deseja remover todas as mensagens nesta conversa?\n\n<b>Aviso:<b> Isto não irá influenciar mensagens guardadas noutros dispositivos ou servidores. @@ -267,7 +269,7 @@ Ativar Esta conferência requer uma palavra-passe Inserir palavra-passe - Atualizações de presença inexistente para o contato + Atualizações de presença inexistente para o contacto Por favor peça atualizações de presença ao seu contacto primeiro.\n\nIsto irá ser utilizado para determinar que cliente(s) o seu contacto está a utilizar. Solicitar agora Remover impressão digital @@ -351,6 +353,7 @@ Escolher ficheiro A receber %1$s (%2$d%% concluído) Transferir %s + Remover %s ficheiro Abrir %s a enviar (%1$d%% concluído) @@ -542,6 +545,7 @@ Carregar mais mensagens Ficheiro partilhado com %s Imagem partilhada com %s + Imagens partilhadas com %s Conversations necessita de acesso ao armazenamento externo Sincronizar com contactos A aplicação Conversations deseja fazer a correspondência entre a sua lista de contactos XMPP e os seus contactos para mostrar os seus nomes completos e os seus avatares.\n\nA aplicação Conversations irá apenas ler os seus contactos e fazer a correspondência localmente sem enviar os dados para o seu servidor.\n\nIrá agora ser-lhe pedido para dar permissão para aceder aos seus contactos. diff --git a/src/main/res/values-ro-rRO/strings.xml b/src/main/res/values-ro-rRO/strings.xml index 35a60872..090d234e 100644 --- a/src/main/res/values-ro-rRO/strings.xml +++ b/src/main/res/values-ro-rRO/strings.xml @@ -71,6 +71,8 @@ trimitere esuata respins Pregatesc imaginea pentru transmisie + Pregatesc imaginile pentru transmisie + Trimitere fisiere. Te rog asteapta... Sterge istoric Sterge istoricul conversatiei Doresti sa stergi toate mesajele din aceasta conversatie?\n\nAtentie: Aceasta actiune nu va influenta mesajele aflate pe alte telefoane/tabelete/servere. @@ -351,6 +353,7 @@ Alege un fisier Primesc %1$s (%2$d%% complet) Descarca %s + Sterge %s fisier Deschide %s trimit (%1$d%% complet) @@ -545,6 +548,7 @@ Incarca mai multe mesaje Partajeaza fisierul cu %s... Partajeaza imaginea cu %s. + Partajeaza imaginile cu %s. Conversations are nevoie de acces la stocarea externa Sincronizeaza cu contactele Conversations doreste sa potriveasta lista de contacte XMPP cu cea din dispozitiv pentru a putea afisa numule lor complete si avatarele.\n\nConversations doar v-a citi si potrivi local fara sa le incarce catre vreun server.\n\nUrmeaza sa fii intrebat daca doresti sa permiti accesul la contacte. diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml index bf816ba2..5ad8362a 100644 --- a/src/main/res/values-sr/strings.xml +++ b/src/main/res/values-sr/strings.xml @@ -71,6 +71,8 @@ испорука није успела одбијено Припремам слику за пренос + Припремам слике за пренос + Делим фајлове, сачекајте… Очисти историјат Брисање историјата преписки Желите ли да обришете све поруке ове преписке?\n\nУпозорење: Ово неће утицати на поруке складиштене на осталим уређајима или серверима. @@ -351,6 +353,7 @@ Изабери фајл Примам %1$s (%2$d%% завршено) Преузми %s + Обриши %s фајл Отвори %s шаљем (%1$d%% завршено) @@ -545,6 +548,7 @@ Учитај још порука Подељен фајл са %s Подељена слика са %s + Подељене слике са %s Конверзацији је потребан приступ спољашњем складишту Синхронизуј са контактима Конверзација жели да поклапи ваш ИксМПП именик са контактима на вашем уређају да би приказала њихова пуна имена и аватаре.\n\nКонверзација ће само да очита ваше контакте и упореди их локално без отпремања на сервер.\n\nСада ћете бити упитани за дозволу приступа вашим контактима. diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index ee6a46ae..370039c1 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -71,6 +71,8 @@ sändning misslyckades avvisad Förbereder bild för sändning + Förbereder bilder för överföring + Delar filer. Vänta... Rensa historik Rensa konversationshistorik Vill du ta bort alla meddelanden i denna konversation?\n\nVarning: Detta kommer inte påverka meddelanden lagrade på andra enheter eller servrar. @@ -351,6 +353,7 @@ Välj fil Tar emot %1$s (%2$d%% klart) Ladda ner %s + Ta bort %s fil Öppna %s skickar (%1$d%% klart) @@ -542,6 +545,7 @@ Ladda fler meddelanden Delade fil med %s Delade bild med %s + Delade bilder med %s Conversations behöver access till extern lagring Synkronisera med kontakter Conversations vill matcha din XMPP-kontaktlista med dina kontakter för att visa deras namn och profilbild.\n\nConversations läser endast dina kontakter för att matcha dem lokalt utan att ladda upp dem till din server.\n\nDu kommer nu få frågan om tillåtelse för att använda kontakterna. -- cgit v1.2.3 From 0385e3a8d62ebe68a8c40a75ea95d3726d3839f3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 4 Apr 2016 20:35:40 +0200 Subject: switched around info and items query to avoid race condition --- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index b3fd122f..58e510e1 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1016,7 +1016,6 @@ public class XmppConnection implements Runnable { lastDiscoStarted = SystemClock.elapsedRealtime(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery"); mXmppConnectionService.scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode()); - sendServiceDiscoveryItems(account.getServer()); Element caps = streamFeatures.findChild("c"); final String hash = caps == null ? null : caps.getAttribute("hash"); final String ver = caps == null ? null : caps.getAttribute("ver"); @@ -1031,6 +1030,7 @@ public class XmppConnection implements Runnable { disco.put(account.getServer(), discoveryResult); } sendServiceDiscoveryInfo(account.getJid().toBareJid()); + sendServiceDiscoveryItems(account.getServer()); this.lastSessionStarted = SystemClock.elapsedRealtime(); } -- cgit v1.2.3 From ecaf75e5ecf785dbe83a4d1ec5f9a76d22e688ad Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 5 Apr 2016 13:31:03 +0200 Subject: better detect broken pep mark pep as broken when publishing bundle or device list failed reset 'brokenness' when account is getting disabled --- .../eu/siacs/conversations/crypto/axolotl/AxolotlService.java | 11 +++++++++-- .../siacs/conversations/services/XmppConnectionService.java | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index cc5c2491..a24e4530 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -314,6 +314,11 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { return this.pepBroken; } + public void resetBrokenness() { + this.pepBroken = false; + numPublishTriesOnEmptyPep = 0; + } + public void regenerateKeys(boolean wipeOther) { axolotlStore.regenerate(); sessions.clear(); @@ -448,7 +453,8 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { mXmppConnectionService.sendIqPacket(account, publish, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { - if (packet.getType() != IqPacket.TYPE.RESULT) { + if (packet.getType() == IqPacket.TYPE.ERROR) { + pepBroken = true; Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error")); } } @@ -612,7 +618,8 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { Log.d(Config.LOGTAG, getLogprefix(account) + "Announcing device " + getOwnDeviceId()); publishOwnDeviceIdIfNeeded(); } - } else { + } else if (packet.getType() == IqPacket.TYPE.ERROR) { + pepBroken = true; Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing bundle: " + packet.findChild("error")); } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index e477046c..e9ac3832 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2581,6 +2581,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa disconnect(account, force); account.getRoster().clearPresences(); connection.resetEverything(); + account.getAxolotlService().resetBrokenness(); } } } -- cgit v1.2.3 From 290f0a123e117ce8e31ef3f9a2d1e896fb4c1ab9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 7 Apr 2016 19:20:45 +0200 Subject: prevent null pointer when checking http upload max size --- .../java/eu/siacs/conversations/ui/ConversationActivity.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 184b5dc6..02a20380 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1301,10 +1301,6 @@ public class ConversationActivity extends XmppActivity } else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) { final List uris = extractUriFromIntent(data); final Conversation c = getSelectedConversation(); - final long max = c.getAccount() - .getXmppConnection() - .getFeatures() - .getMaxHttpUploadSize(); final OnPresenceSelected callback = new OnPresenceSelected() { @Override public void onPresenceSelected() { @@ -1317,8 +1313,8 @@ public class ConversationActivity extends XmppActivity } } }; - if (c.getMode() == Conversation.MODE_MULTI - || FileBackend.allFilesUnderSize(this, uris, max) + if (c == null || c.getMode() == Conversation.MODE_MULTI + || FileBackend.allFilesUnderSize(this, uris, getMaxHttpUploadSize(c)) || c.getNextEncryption() == Message.ENCRYPTION_OTR) { callback.onPresenceSelected(); } else { @@ -1367,6 +1363,10 @@ public class ConversationActivity extends XmppActivity } } + private long getMaxHttpUploadSize(Conversation conversation) { + return conversation.getAccount().getXmppConnection().getFeatures().getMaxHttpUploadSize(); + } + private void setNeverAskForBatteryOptimizationsAgain() { getPreferences().edit().putBoolean("show_battery_optimization", false).commit(); } -- cgit v1.2.3 From 0460702710fd46cac0850224f34a275ceb8e2c1f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 7 Apr 2016 20:29:40 +0200 Subject: check file owner when attaching files or using them as avatar --- .../conversations/persistance/FileBackend.java | 33 ++++++++++++++++++++++ .../services/XmppConnectionService.java | 10 +++++++ .../ui/PublishProfilePictureActivity.java | 13 +++++++-- src/main/res/values/strings.xml | 1 + 4 files changed, 55 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 21ba4509..69b81569 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -1,5 +1,7 @@ package eu.siacs.conversations.persistance; +import android.annotation.TargetApi; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.database.Cursor; @@ -9,8 +11,13 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.RectF; import android.net.Uri; +import android.os.Build; import android.os.Environment; +import android.os.ParcelFileDescriptor; import android.provider.OpenableColumns; +import android.system.ErrnoException; +import android.system.Os; +import android.system.StructStat; import android.util.Base64; import android.util.Base64OutputStream; import android.util.Log; @@ -19,6 +26,7 @@ import android.webkit.MimeTypeMap; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; +import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -646,4 +654,29 @@ public class FileBackend { } } } + + + public static boolean weOwnFile(Uri uri) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + return false; + } else { + return uri != null + && ContentResolver.SCHEME_FILE.equals(uri.getScheme()) + && weOwnFileLollipop(uri); + } + } + + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private static boolean weOwnFileLollipop(Uri uri) { + try { + File file = new File(uri.getPath()); + FileDescriptor fd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY).getFileDescriptor(); + StructStat st = Os.fstat(fd); + return st.st_uid == android.os.Process.myUid(); + } catch (ErrnoException e) { + return true; + } catch (FileNotFoundException e) { + return false; + } + } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index e9ac3832..2aaf9b62 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -403,6 +403,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void attachFileToConversation(final Conversation conversation, final Uri uri, final UiCallback callback) { + if (FileBackend.weOwnFile(uri)) { + Log.d(Config.LOGTAG,"trying to attach file that belonged to us"); + callback.error(R.string.security_error_invalid_file_access, null); + return; + } final Message message; if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) { message = new Message(conversation, "", Message.ENCRYPTION_DECRYPTED); @@ -441,6 +446,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback callback) { + if (FileBackend.weOwnFile(uri)) { + Log.d(Config.LOGTAG,"trying to attach file that belonged to us"); + callback.error(R.string.security_error_invalid_file_access, null); + return; + } final String compressPictures = getCompressPicturesPreference(); if ("never".equals(compressPictures) || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri))) { diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 88645c4a..27a3efe5 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -23,6 +23,7 @@ import java.io.File; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.utils.FileUtils; import eu.siacs.conversations.utils.PhoneHelper; import eu.siacs.conversations.xmpp.pep.Avatar; @@ -187,9 +188,13 @@ public class PublishProfilePictureActivity extends XmppActivity { protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { + Uri source = data.getData(); switch (requestCode) { case REQUEST_CHOOSE_FILE_AND_CROP: - Uri source = data.getData(); + if (FileBackend.weOwnFile(source)) { + Toast.makeText(this,R.string.security_error_invalid_file_access,Toast.LENGTH_SHORT).show(); + return; + } String original = FileUtils.getPath(this, source); if (original != null) { source = Uri.parse("file://"+original); @@ -199,7 +204,11 @@ public class PublishProfilePictureActivity extends XmppActivity { Crop.of(source, destination).asSquare().withMaxSize(size, size).start(this); break; case REQUEST_CHOOSE_FILE: - this.avatarUri = data.getData(); + if (FileBackend.weOwnFile(source)) { + Toast.makeText(this,R.string.security_error_invalid_file_access,Toast.LENGTH_SHORT).show(); + return; + } + this.avatarUri = source; if (xmppConnectionServiceBound) { loadImageIntoPreview(this.avatarUri); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 082c10b9..e991d051 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -609,4 +609,5 @@ You already trust this contact. By selecting \'done\' you are just confirming that %s is part of this conference. Select image and crop You have disabled this account + Security error: Invalid file access -- cgit v1.2.3 From c55f7645a434d6f9c23fe36013c0275d8623d34f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 8 Apr 2016 10:41:37 +0200 Subject: pulled translations from transifex --- src/main/res/values-cs/strings.xml | 10 ++++++++++ src/main/res/values-pt-rBR/strings.xml | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 8979f86f..7642e297 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -71,6 +71,8 @@ doručení selhalo zamítnuto Připravuji obrázek na přenos + Příprava obrázků pro přenos + Sdílení souborů. Chvíli strpení... Smazat historii Smaže historii konverzací Chcete smazat všechny zprávy v této konverzaci?\n\nVarování: Toto neovlivní zprávy uložené na jiných přístrojích nebo serverech. @@ -312,6 +314,7 @@ Ověřuji %s na HTTP hostiteli Bez připojení. Zkus znovu později Ověřit %s velikost + Kontrola %1$s velikosti na %2$s Možnosti zpráv Zkopírovat text Kopírovat originální URL @@ -350,6 +353,7 @@ Vybrat soubor Přijímám %1$s (%2$d%% dokončeno) Stáhnout %s + Smazat %s soubor Otevřít %s odesílám (%1$d%% přeneseno) @@ -506,6 +510,8 @@ Při vypnuté obrazovce označí váš stav jako pryč Nedostupný při vypnutém zvuku Při tichém módu označí váš stav jako nedostupný + Vibrační mód brát stejně jako tichý + Označí vaše zdroje jako nedostupné při přepnutí do vibračního módu Rozšířená nastavení připojení Zobrazovat nastavení hostname a port při vytváření účtu xmpp.server.cz @@ -542,6 +548,7 @@ Načíst více zpráv Soubor sdílen s %s Obrázek sdílen s %s + Obrázky sdíleny s %s Conversations vyžaduje přístup k externímu úložišti Synchronizovat s kontakty Aplikace Conversations by ráda porovnala váš XMPP seznam s vašimi kontakty, aby mohla zobrazit plná jména a avatary.\n\nConversations načte a porovná kontakty pouze lokálně, bez jejich nahrávání na server.\n\nNyní budete dotázáni na udělení práv pro přístup k seznamu kontaktů. @@ -570,4 +577,7 @@ Toto pole je vyžadováno Opravit zprávu Odeslat opravenou zprávu + Tomuto kontaktu již důvěřujete. Vybráním možnosti \'hotovo\' jen potvrzujete, že %s je součástí této konference. + Vybrat obrázek a oříznout + Tento účet byl vypnut diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index 19d25d5d..ea50da43 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -71,6 +71,8 @@ não foi entregue rejeitada Preparando a imagem para transmissão + Preparando as imagens para o envio + Compartilhando arquivos. Por favor, aguarde... Limpar o histórico Limpa o histórico de conversas Deseja excluir todas as mensagens dessa conversa?\n\nAtenção: Isso não afetará mensagens armazenadas em outros dispositivos ou servidores. @@ -97,7 +99,7 @@ Não foi encontrada nenhuma chave OpenPGP O Conversations não conseguiu criptografar suas mensagens porque os seus contatos não estão anunciando a chave pública deles(as).\n\nPor favor, solicite aos seus contatos que configurem o OpenPGP. Geral - Recurso XMPP + Identificação XMPP O nome pelo qual esse cliente se identifica Aceitar arquivos Aceitar automaticamente arquivos menores que... @@ -312,6 +314,7 @@ Verificando %s no host HTTP Você não está conectado. Tente novamente mais tarde. Verificar o tamanho de %s + Verifique o tamanho de %1$s em %2$s Opções da mensagem Copiar o texto Copiar a URL original @@ -350,6 +353,7 @@ Selecione o arquivo Recebendo %1$s (completou %2$d%%) Baixar %s + Excluir %s arquivo Abrir %s enviando (completou %1$d%%) @@ -501,9 +505,11 @@ Quebrado Presença Afastado quando a tela estiver desligada - Marcar o seu status como afastado quando a tela estiver desligada + Definir o seu status como afastado quando a tela estiver desligada Não disponível quando em modo silencioso - Marcar o seu status como não disponível quando o dispositivo estiver em modo silencioso + Definir o seu status como não disponível quando o dispositivo estiver em modo silencioso + Considerar o modo de vibração como silencioso + Definir o seu status como indisponível quando o dispositivo estiver em modo de vibração Configurações detalhadas da conexão Exibe o nome de host e configurações da porta ao configurar uma conta xmpp.example.com @@ -539,6 +545,7 @@ Carregar mais mensagens Arquivo compartilhado com %s Imagem compartilhada com %s + Imagens compartilhadas com %s O Conversations necessita de acesso ao armazenamento externo Sincronizar com os contatos O Conversations quer procurar por correspondências entre contatos da sua conta Jabber e do seu telefone, para complementar as informações de nome completo e avatares\n\nO Conversations fará a verificação localmente, sem enviar nenhuma informação sua para o servidor\n\nVocê será solicitado a fornecer permissão de acesso aos seus contatos agora. @@ -567,4 +574,7 @@ Este campo é necessário Corrigir a mensagem Enviar a mensagem corrigida + Você já confia nesse contato. Ao selecionar \'Concluído\', você está apenas confirmando que %s é parte dessa conferência. + Selecione e recorte a imagem + Você desabilitou essa conta -- cgit v1.2.3 From db0301310bcb4fa238df4839d793162727270dc1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 8 Apr 2016 18:28:40 +0200 Subject: removed ernoexception in exchange for a regular exeption to prevent verify error on <5.0 --- src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 69b81569..0861a3a8 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -15,7 +15,6 @@ import android.os.Build; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.provider.OpenableColumns; -import android.system.ErrnoException; import android.system.Os; import android.system.StructStat; import android.util.Base64; @@ -673,10 +672,10 @@ public class FileBackend { FileDescriptor fd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY).getFileDescriptor(); StructStat st = Os.fstat(fd); return st.st_uid == android.os.Process.myUid(); - } catch (ErrnoException e) { - return true; } catch (FileNotFoundException e) { return false; + } catch (Exception e) { + return true; } } } -- cgit v1.2.3 From a8ebc5fafcd0c200b960015f7a33ce71d1689a7f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 8 Apr 2016 20:20:37 +0200 Subject: add required disco#items query to timeout list --- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 58e510e1..19d4fcba 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1117,7 +1117,7 @@ public class XmppConnection implements Runnable { final IqPacket iq = new IqPacket(IqPacket.TYPE.GET); iq.setTo(server.toDomainJid()); iq.query("http://jabber.org/protocol/disco#items"); - this.sendIqPacket(iq, new OnIqPacketReceived() { + String id = this.sendIqPacket(iq, new OnIqPacketReceived() { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { @@ -1142,6 +1142,9 @@ public class XmppConnection implements Runnable { } } }); + synchronized (this.mPendingServiceDiscoveriesIds) { + this.mPendingServiceDiscoveriesIds.add(id); + } } private void sendEnableCarbons() { -- cgit v1.2.3 From 14b46c3ee7aa860d349bcf8418b6ad35715c9ec4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Apr 2016 08:53:58 +0200 Subject: transform nimbuzz workaround into a more general 'waitForDisco' condition --- .../eu/siacs/conversations/xmpp/XmppConnection.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 19d4fcba..6427c347 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -118,6 +118,7 @@ public class XmppConnection implements Runnable { private long lastDiscoStarted = 0; private AtomicInteger mPendingServiceDiscoveries = new AtomicInteger(0); private AtomicBoolean mIsServiceItemsDiscoveryPending = new AtomicBoolean(true); + private boolean mWaitForDisco = true; private final ArrayList mPendingServiceDiscoveriesIds = new ArrayList<>(); private boolean mInteractive = false; private int attempt = 0; @@ -1011,8 +1012,9 @@ public class XmppConnection implements Runnable { synchronized (this.disco) { this.disco.clear(); } - mPendingServiceDiscoveries.set(mServerIdentity == Identity.NIMBUZZ ? 1 : 0); + mPendingServiceDiscoveries.set(0); mIsServiceItemsDiscoveryPending.set(true); + mWaitForDisco = mServerIdentity != Identity.NIMBUZZ; lastDiscoStarted = SystemClock.elapsedRealtime(); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": starting service discovery"); mXmppConnectionService.scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode()); @@ -1031,13 +1033,14 @@ public class XmppConnection implements Runnable { } sendServiceDiscoveryInfo(account.getJid().toBareJid()); sendServiceDiscoveryItems(account.getServer()); + if (!mWaitForDisco) { + finalizeBind(); + } this.lastSessionStarted = SystemClock.elapsedRealtime(); } private void sendServiceDiscoveryInfo(final Jid jid) { - if (mServerIdentity != Identity.NIMBUZZ) { - mPendingServiceDiscoveries.incrementAndGet(); - } + mPendingServiceDiscoveries.incrementAndGet(); final IqPacket iq = new IqPacket(IqPacket.TYPE.GET); iq.setTo(jid); iq.query("http://jabber.org/protocol/disco#info"); @@ -1081,7 +1084,9 @@ public class XmppConnection implements Runnable { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not query disco info for " + jid.toString()); } if (packet.getType() != IqPacket.TYPE.TIMEOUT) { - if (mPendingServiceDiscoveries.decrementAndGet() == 0 && !mIsServiceItemsDiscoveryPending.get()) { + if (mPendingServiceDiscoveries.decrementAndGet() == 0 + && !mIsServiceItemsDiscoveryPending.get() + && mWaitForDisco) { finalizeBind(); } } @@ -1136,7 +1141,7 @@ public class XmppConnection implements Runnable { } if (packet.getType() != IqPacket.TYPE.TIMEOUT) { mIsServiceItemsDiscoveryPending.set(false); - if (mPendingServiceDiscoveries.get() == 0) { + if (mPendingServiceDiscoveries.get() == 0 && mWaitForDisco) { finalizeBind(); } } -- cgit v1.2.3 From 2713fd50c830e0c139ea4ae3194bdd60126bb968 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Apr 2016 10:29:34 +0200 Subject: use last received message id when querying archive --- .../services/MessageArchiveService.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index e8616bd8..a50b45b1 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -45,8 +45,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } } } - long startCatchup = getLastMessageTransmitted(account); + Pair pair = mXmppConnectionService.databaseBackend.getLastMessageReceived(account); + long startCatchup = pair == null ? 0 : pair.first; long endCatchup = account.getXmppConnection().getLastSessionEstablished(); + final Query query; if (startCatchup == 0) { return; } else if (endCatchup - startCatchup >= Config.MAM_MAX_CATCHUP) { @@ -57,8 +59,14 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { this.query(conversation,startCatchup); } } + query = new Query(account, startCatchup, endCatchup); + } else { + if (pair.second == null) { + query = new Query(account, startCatchup, endCatchup); + } else { + query = new Query(account, pair.second, endCatchup); + } } - final Query query = new Query(account, startCatchup, endCatchup); this.queries.add(query); this.execute(query); } @@ -75,11 +83,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } } - private long getLastMessageTransmitted(final Account account) { - Pair pair = mXmppConnectionService.databaseBackend.getLastMessageReceived(account); - return pair == null ? 0 : pair.first; - } - public Query query(final Conversation conversation) { if (conversation.getLastMessageTransmitted() < 0 && conversation.countMessages() == 0) { return query(conversation, @@ -283,6 +286,13 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { this.queryId = new BigInteger(50, mXmppConnectionService.getRNG()).toString(32); } + public Query(Account account, String reference, long end) { + this.account = account; + this.reference = reference; + this.end = end; + this.queryId = new BigInteger(50, mXmppConnectionService.getRNG()).toString(32); + } + private Query page(String reference) { Query query = new Query(this.account,this.start,this.end); query.reference = reference; -- cgit v1.2.3 From b99d70bfe74ce5dff1c8ed26d7f3dbd577a22125 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Apr 2016 10:59:54 +0200 Subject: don't show contact details when in conversations with self --- src/main/java/eu/siacs/conversations/entities/Conversation.java | 4 ++++ src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 1 + src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 0252ea74..a3ae906b 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -336,6 +336,10 @@ public class Conversation extends AbstractEntity implements Blockable { return this.correctingMessage; } + public boolean withSelf() { + return getContact().isSelf(); + } + public interface OnMessageFound { void onMessageFound(final Message message); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 02a20380..920c07af 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -411,6 +411,7 @@ public class ConversationActivity extends XmppActivity menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite()); menuSecure.setVisible((Config.supportOpenPgp() || Config.supportOmemo()) && Config.multipleEncryptionChoices()); //only if pgp is supported we have a choice } else { + menuContactDetails.setVisible(!this.getSelectedConversation().withSelf()); menuMucDetails.setVisible(false); menuSecure.setVisible(Config.multipleEncryptionChoices()); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 1a834ae5..095bf58f 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -468,7 +468,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa highlightInConference(user); } } else { - activity.switchToContactDetails(message.getContact(), message.getFingerprint()); + if (!message.getContact().isSelf()) { + activity.switchToContactDetails(message.getContact(), message.getFingerprint()); + } } } else { Account account = message.getConversation().getAccount(); -- cgit v1.2.3 From 65548ddccb7f63d623a86ad9a740ded87310e313 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Apr 2016 12:31:08 +0200 Subject: use startdate as lower bound when querying archive with after=x --- .../conversations/services/MessageArchiveService.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index a50b45b1..06df1b38 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -61,11 +61,8 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } query = new Query(account, startCatchup, endCatchup); } else { - if (pair.second == null) { - query = new Query(account, startCatchup, endCatchup); - } else { - query = new Query(account, pair.second, endCatchup); - } + query = new Query(account, startCatchup, endCatchup); + query.reference = pair.second; } this.queries.add(query); this.execute(query); @@ -285,14 +282,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { this.end = end; this.queryId = new BigInteger(50, mXmppConnectionService.getRNG()).toString(32); } - - public Query(Account account, String reference, long end) { - this.account = account; - this.reference = reference; - this.end = end; - this.queryId = new BigInteger(50, mXmppConnectionService.getRNG()).toString(32); - } - + private Query page(String reference) { Query query = new Query(this.account,this.start,this.end); query.reference = reference; -- cgit v1.2.3 From 83fab0650880873f0fb77697acc4c5102ad5f166 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 9 Apr 2016 21:48:06 +0200 Subject: introduced setting to turn of notification led --- .../java/eu/siacs/conversations/services/NotificationService.java | 5 ++++- src/main/res/values/strings.xml | 8 +++++--- src/main/res/xml/preferences.xml | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index cec9a3ef..003f5471 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -180,6 +180,7 @@ public class NotificationService { final String ringtone = preferences.getString("notification_ringtone", null); final boolean vibrate = preferences.getBoolean("vibrate_on_notification", true); + final boolean led = preferences.getBoolean("led", true); if (notifications.size() == 0) { notificationManager.cancel(NOTIFICATION_ID); @@ -210,7 +211,9 @@ public class NotificationService { mBuilder.setDefaults(0); mBuilder.setSmallIcon(R.drawable.ic_notification); mBuilder.setDeleteIntent(createDeleteIntent()); - mBuilder.setLights(0xff00FF00, 2000, 3000); + if (led) { + mBuilder.setLights(0xff00FF00, 2000, 3000); + } final Notification notification = mBuilder.build(); notificationManager.notify(NOTIFICATION_ID, notification); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e991d051..e9e99730 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -108,9 +108,11 @@ Notifications Notify when a new message arrives Vibrate - Also vibrate when a new message arrives - Sound - Play ringtone with notification + Vibrate when a new message arrives + LED Notification + Blink notification light when a new message arrives + Ringtone + Play sound when a new message arrives Notification grace period Disable notifications for a short time after a carbon copy was received Advanced diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index f505baf7..e4b29856 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -79,7 +79,12 @@ android:key="vibrate_on_notification" android:summary="@string/pref_vibrate_summary" android:title="@string/pref_vibrate"/> - + Date: Sun, 10 Apr 2016 00:18:14 +0200 Subject: moved authentication into seperate method. force close socket before changing status --- .../siacs/conversations/xmpp/XmppConnection.java | 82 ++++++++++++---------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 6427c347..30cb96dc 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -183,16 +183,18 @@ public class XmppConnection implements Runnable { if (packet.getType() == IqPacket.TYPE.RESULT) { account.setOption(Account.OPTION_REGISTER, false); + forceCloseSocket(); changeStatus(Account.State.REGISTRATION_SUCCESSFUL); } else if (packet.hasChild("error") && (packet.findChild("error") .hasChild("conflict"))) { + forceCloseSocket(); changeStatus(Account.State.REGISTRATION_CONFLICT); } else { + forceCloseSocket(); changeStatus(Account.State.REGISTRATION_FAILED); Log.d(Config.LOGTAG, packet.toString()); } - disconnect(true); } }; } @@ -739,47 +741,12 @@ public class XmppConnection implements Runnable { } } else if (!this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) { + forceCloseSocket(); changeStatus(Account.State.REGISTRATION_NOT_SUPPORTED); - disconnect(true); } else if (this.streamFeatures.hasChild("mechanisms") && shouldAuthenticate && (features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS)) { - final List mechanisms = extractMechanisms(streamFeatures - .findChild("mechanisms")); - final Element auth = new Element("auth"); - auth.setAttribute("xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); - if (mechanisms.contains("EXTERNAL") && account.getPrivateKeyAlias() != null) { - saslMechanism = new External(tagWriter, account, mXmppConnectionService.getRNG()); - } else if (mechanisms.contains("SCRAM-SHA-1")) { - saslMechanism = new ScramSha1(tagWriter, account, mXmppConnectionService.getRNG()); - } else if (mechanisms.contains("PLAIN")) { - saslMechanism = new Plain(tagWriter, account); - } else if (mechanisms.contains("DIGEST-MD5")) { - saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG()); - } - if (saslMechanism != null) { - final JSONObject keys = account.getKeys(); - try { - if (keys.has(Account.PINNED_MECHANISM_KEY) && - keys.getInt(Account.PINNED_MECHANISM_KEY) > saslMechanism.getPriority()) { - Log.e(Config.LOGTAG, "Auth failed. Authentication mechanism " + saslMechanism.getMechanism() + - " has lower priority (" + String.valueOf(saslMechanism.getPriority()) + - ") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) + - "). Possible downgrade attack?"); - throw new SecurityException(); - } - } catch (final JSONException e) { - Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism"); - } - Log.d(Config.LOGTAG, account.getJid().toString() + ": Authenticating with " + saslMechanism.getMechanism()); - auth.setAttribute("mechanism", saslMechanism.getMechanism()); - if (!saslMechanism.getClientFirstMessage().isEmpty()) { - auth.setContent(saslMechanism.getClientFirstMessage()); - } - tagWriter.writeElement(auth); - } else { - throw new IncompatibleServerException(); - } + authenticate(); } else if (this.streamFeatures.hasChild("sm", "urn:xmpp:sm:" + smVersion) && streamId != null) { if (Config.EXTENDED_SM_LOGGING) { Log.d(Config.LOGTAG,account.getJid().toBareJid()+": resuming after stanza #"+stanzasReceived); @@ -795,6 +762,45 @@ public class XmppConnection implements Runnable { } } + private void authenticate() throws IOException { + final List mechanisms = extractMechanisms(streamFeatures + .findChild("mechanisms")); + final Element auth = new Element("auth"); + auth.setAttribute("xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); + if (mechanisms.contains("EXTERNAL") && account.getPrivateKeyAlias() != null) { + saslMechanism = new External(tagWriter, account, mXmppConnectionService.getRNG()); + } else if (mechanisms.contains("SCRAM-SHA-1")) { + saslMechanism = new ScramSha1(tagWriter, account, mXmppConnectionService.getRNG()); + } else if (mechanisms.contains("PLAIN")) { + saslMechanism = new Plain(tagWriter, account); + } else if (mechanisms.contains("DIGEST-MD5")) { + saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG()); + } + if (saslMechanism != null) { + final JSONObject keys = account.getKeys(); + try { + if (keys.has(Account.PINNED_MECHANISM_KEY) && + keys.getInt(Account.PINNED_MECHANISM_KEY) > saslMechanism.getPriority()) { + Log.e(Config.LOGTAG, "Auth failed. Authentication mechanism " + saslMechanism.getMechanism() + + " has lower priority (" + String.valueOf(saslMechanism.getPriority()) + + ") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) + + "). Possible downgrade attack?"); + throw new SecurityException(); + } + } catch (final JSONException e) { + Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism"); + } + Log.d(Config.LOGTAG, account.getJid().toString() + ": Authenticating with " + saslMechanism.getMechanism()); + auth.setAttribute("mechanism", saslMechanism.getMechanism()); + if (!saslMechanism.getClientFirstMessage().isEmpty()) { + auth.setContent(saslMechanism.getClientFirstMessage()); + } + tagWriter.writeElement(auth); + } else { + throw new IncompatibleServerException(); + } + } + private List extractMechanisms(final Element stream) { final ArrayList mechanisms = new ArrayList<>(stream .getChildren().size()); -- cgit v1.2.3 From 91b17c6925e24f68240b25d26f74a352191ff1af Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 10 Apr 2016 00:19:20 +0200 Subject: =?UTF-8?q?fixed=20'connecting=E2=80=A6'=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 9d73290a..48ccb9f0 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -241,12 +241,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate mFetchingAvatar = true; xmppConnectionService.checkForAvatar(mAccount, mAvatarFetchCallback); } - } else { - updateSaveButton(); } if (mAccount != null) { updateAccountInformation(false); } + updateSaveButton(); } @Override @@ -335,7 +334,8 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mSaveButton.setText(R.string.save); this.mSaveButton.setEnabled(true); this.mSaveButton.setTextColor(getPrimaryTextColor()); - } else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) { + } else if (mAccount != null + && (mAccount.getStatus() == Account.State.CONNECTING || mAccount.getStatus() == Account.State.REGISTRATION_SUCCESSFUL|| mFetchingAvatar)) { this.mSaveButton.setEnabled(false); this.mSaveButton.setTextColor(getSecondaryTextColor()); this.mSaveButton.setText(R.string.account_status_connecting); @@ -536,6 +536,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate protected void onBackendConnected() { if (this.jidToEdit != null) { this.mAccount = xmppConnectionService.findAccountByJid(jidToEdit); + this.mInitMode |= this.mAccount.isOptionSet(Account.OPTION_REGISTER); if (this.mAccount != null) { if (this.mAccount.getPrivateKeyAlias() != null) { this.mPassword.setHint(R.string.authenticate_with_certificate); @@ -631,6 +632,8 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate if (!mInitMode) { this.mAvatar.setVisibility(View.VISIBLE); this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(72))); + } else { + this.mAvatar.setVisibility(View.GONE); } if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { this.mRegisterNew.setVisibility(View.VISIBLE); -- cgit v1.2.3 From 5786e753740065cb2a5398ee964642054074e6f2 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 10 Apr 2016 00:19:53 +0200 Subject: don't throw IO exception at end of stream --- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 30cb96dc..7bc08e9c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -560,7 +560,6 @@ public class XmppConnection implements Runnable { } nextTag = tagReader.readTag(); } - throw new IOException("reached end of stream. last tag was "+nextTag); } private void acknowledgeStanzaUpTo(int serverCount) { -- cgit v1.2.3 From 77f4513862c6d5dbf878bfa14094f20d9fc34811 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 10 Apr 2016 21:19:50 +0200 Subject: pulled translations from transifex --- src/main/res/values-ar/strings.xml | 3 --- src/main/res/values-bg/strings.xml | 9 ++++++--- src/main/res/values-ca/strings.xml | 3 --- src/main/res/values-cs/strings.xml | 3 --- src/main/res/values-de/strings.xml | 3 +++ src/main/res/values-el/strings.xml | 3 --- src/main/res/values-es/strings.xml | 3 --- src/main/res/values-eu/strings.xml | 3 --- src/main/res/values-fr/strings.xml | 3 --- src/main/res/values-gl/strings.xml | 3 --- src/main/res/values-id/strings.xml | 3 --- src/main/res/values-it/strings.xml | 3 --- src/main/res/values-iw/strings.xml | 3 --- src/main/res/values-ja/strings.xml | 3 --- src/main/res/values-ko/strings.xml | 3 --- src/main/res/values-nb-rNO/strings.xml | 3 --- src/main/res/values-nl/strings.xml | 3 --- src/main/res/values-pl/strings.xml | 3 --- src/main/res/values-pt-rBR/strings.xml | 11 +++++++---- src/main/res/values-pt/strings.xml | 3 --- src/main/res/values-ro-rRO/strings.xml | 3 --- src/main/res/values-ru/strings.xml | 3 --- src/main/res/values-sk/strings.xml | 3 --- src/main/res/values-sr/strings.xml | 7 +++++-- src/main/res/values-sv/strings.xml | 3 --- src/main/res/values-tr-rTR/strings.xml | 3 --- src/main/res/values-vi/strings.xml | 3 --- src/main/res/values-zh-rCN/strings.xml | 11 ++++++----- src/main/res/values-zh-rTW/strings.xml | 3 --- 29 files changed, 27 insertions(+), 86 deletions(-) (limited to 'src/main') diff --git a/src/main/res/values-ar/strings.xml b/src/main/res/values-ar/strings.xml index e3a71f69..cefcdf06 100644 --- a/src/main/res/values-ar/strings.xml +++ b/src/main/res/values-ar/strings.xml @@ -95,9 +95,6 @@ الإشعارات أخبرني عندما تصل رساله جديده إعداد الإهتزاز - تفعيل الاهتزاز عندما تصل رساله جديده - التبيه الصوتي - سماع صوت عندما تصل رساله لا ترسل تقارير أخطاء الغاء ارسال تقارير الأخطاء يقلل من فرص حل المشكلة سريعا فكن متعاون تأكيد الرسالة diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml index daa07b08..06463963 100644 --- a/src/main/res/values-bg/strings.xml +++ b/src/main/res/values-bg/strings.xml @@ -107,9 +107,11 @@ Известия Известяване при получаване на ново съобщение Вибрация - Също така да има и вибрация при получаване на ново съобщение - Звук - Изпълнение на звук с известието + Вибриране при получаване на ново съобщение + Известие чрез светодиода + Мигане на индикаторния светодиод при получаване на ново съобщение + Тон на звънене + Изпълнение на звук при получаване на ново съобщение Продължителност на отсрочване на известията Изключва известията за кратко, след като бъде получено копие на съобщение Разширени @@ -577,4 +579,5 @@ Вие вече имате доверие на този контакт. Избирайки „готово“, Вие просто потвърждавате, че %s е част от тази беседа. Изберете изображение и изрежете Вие сте деактивирали този профил + Грешка в сигурността: неправилен достъп до файл diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml index 1c06d9ab..2a9aa8c5 100644 --- a/src/main/res/values-ca/strings.xml +++ b/src/main/res/values-ca/strings.xml @@ -96,9 +96,6 @@ Notificacions Notifica quan arriba un nou missatge Vibra - Vibra quan arriba un nou missatge - So - Reprodueix el to de trucada amb la notificació Notificació del període d\'espera Desactiva les notificacions durant un breu termini després de rebre una còpia de missatges carbon Mai enviïs informes d\'errors diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 7642e297..c70eac63 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -107,9 +107,6 @@ Upozornění Upozornit při přijetí nové zprávy Vibrovat - Vibrovat při přijetí nové zprávy - Zvuk - Přehrát zvuk společně s upozorněním Četnost upozornění Neupozorňovat krátce poté co byla obdržena kopie zprávy Rozšířené diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 68325e00..523dc1e1 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -108,6 +108,8 @@ Benachrichtigen bei Erhalt einer neuen Nachricht Vibrieren Vibrieren bei Erhalt einer neuen Nachricht + LED Benachrichtigung + Blinke bei Erhalt einer neuen Nachricht Benachrichtigungston Benachrichtigungston wiedergeben Gnadenfrist @@ -577,4 +579,5 @@ Du vertraust diesem Kontakt bereits. Durch Auswählen von \"Fertig\" bestätigst du, dass %s Teil dieser Konferenz ist. Bild auswählen und zuschneiden Du hast dieses Konto deaktiviert + Sicherheitsfehler: Dateizugriff nicht erlaubt diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index 804a2146..6a3bec96 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -96,9 +96,6 @@ Ειδοποιήσεις Ειδοποίηση όταν λαμβάνεται ένα νέο μήνυμα Δόνηση - Επίσης δόνηση όταν έρχεται ένα νέο μήνυμα - Ήχος - Αναπαραγωγή ήχου κλήσης με την ειδοποίηση Περίοδος χάριτος ειδοποιήσεων Απενεργοποίηση ειδοποιήσεων για λίγο χρόνο μετά από τη λήψη ακριβούς αντιγράφου Να μην αποστέλλονται αναφορές λαθών diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index 5af941b3..b45a0248 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -107,9 +107,6 @@ Notificaciones Notificar cuando llega un nuevo mensaje Vibrar - Vibra cuando llega un nuevo mensaje - Sonido - Reproduce tono con la notificación Notificaciones Carbons Deshabilita las notificaciones durante un corto periodo de tiempo después de recibir la copia del mensaje carbon Avanzado diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index ed9fbeb5..061d4fd4 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -107,9 +107,6 @@ Jakinarazpenak Mezu berri bat heltzerakoan jakinarazi Dardaratu - Dardaratu ere mezu berri bat heltzerakoan - Soinua - Dei-tonua jo jakinarazpenarekin Jakinarazpenen grazia epea Jakinarazpenak denbora labur baterako ezgaitu ikatz-kopia bat jaso ondoren Aurreratua diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 889f5092..3ddb3e77 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -105,9 +105,6 @@ Notifications Notifier de l\'arrivée d\'un message. Vibration - Vibrer lors de l\'arrivée d\'un message. - Sonore - Jouer une sonnerie pour notifier. Période sans notification Désactiver momentanément les notifications après l\'arrivée d\'une copie carbone. Avancé diff --git a/src/main/res/values-gl/strings.xml b/src/main/res/values-gl/strings.xml index 0a414b9e..cdab2e03 100644 --- a/src/main/res/values-gl/strings.xml +++ b/src/main/res/values-gl/strings.xml @@ -61,9 +61,6 @@ Notificacións Notifica cuando chega unha nova mensaxe Tremer - Treme cando chega unha novo mensaxe - Son - Reproduce un ton ca notificación Notificacións Carbons Deshabilita as notificacións durante un corto periodo de tiempo despois de recibir a copia da mensaxe carbón Nunca enviar informe de erros diff --git a/src/main/res/values-id/strings.xml b/src/main/res/values-id/strings.xml index 3b5d10ff..ab149bf0 100644 --- a/src/main/res/values-id/strings.xml +++ b/src/main/res/values-id/strings.xml @@ -101,9 +101,6 @@ Notifikasi Notifikasikan jika pesan baru tiba Getar - Juga aktifkan getaran bila pesan baru tiba - Suara - mainkan suara saat menerima notifikasi Tenggang waktu pemberitahuan Nonaktifkan pemberitahuan untuk waktu yang singkat setelah salinan diterima Lanjutan diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index 83bcbda0..8f00ad6a 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -105,9 +105,6 @@ Notifiche Notifica quando arriva un nuovo messaggio Vibra - Vibra anche quando arriva un nuovo messaggio - Suono - Riproduci una suoneria con la notifica Periodo tra notifiche Disabilita le notifiche per un breve lasso di tempo dopo che un messaggio è stato ricevuto Avanzate diff --git a/src/main/res/values-iw/strings.xml b/src/main/res/values-iw/strings.xml index 5b640ff2..7d22efb8 100644 --- a/src/main/res/values-iw/strings.xml +++ b/src/main/res/values-iw/strings.xml @@ -102,9 +102,6 @@ התראות תודיע כאשר הודעה חדשה מגיעה הרטט - הרטט גם כאשר הודעה חדשה מגיעה - צליל - נגן צלצול עם כל התראה משך תקופת ארכה נטרל התראות לזמן קצר לאחר שהודעת Carbon Copy מתקבלת לעולם אל תשלח דיווחי קריסה diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index 2268ca96..2ff16d5b 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -107,9 +107,6 @@ 通知 新しいメッセージが到着したときに通知します 振動 - 新しいメッセージが到着したときに振動もします - サウンド - 通知で着信音を再生します 通知猶予期間 カーボンコピーを受信した後、短時間、通知を無効にします 詳細 diff --git a/src/main/res/values-ko/strings.xml b/src/main/res/values-ko/strings.xml index 311d3fdd..b4e0311b 100644 --- a/src/main/res/values-ko/strings.xml +++ b/src/main/res/values-ko/strings.xml @@ -104,9 +104,6 @@ 알림 새 메세지 도착시 알림 진동 - 새 메세지 도착시 진동 - 소리 - 알림과 동시에 벨소리 재생 알림 유예 Carbon Copy 수신 후에 잠시동안 알림 해제 충돌 보고서 보내지 않음 diff --git a/src/main/res/values-nb-rNO/strings.xml b/src/main/res/values-nb-rNO/strings.xml index b78c1fba..d12975bd 100644 --- a/src/main/res/values-nb-rNO/strings.xml +++ b/src/main/res/values-nb-rNO/strings.xml @@ -104,9 +104,6 @@ Varslinger Varsle når en ny melding ankommer Vibrer - Vibrer også når ny melding ankommer - Lyd - Spill av ringetone ved varsel Stilleperiode Deaktiver varslinger for en kort periode etter at en kopi er mottatt Aldri send feilrettingsrapporter diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 44e5dab6..4e742f81 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -107,9 +107,6 @@ Meldingen Melding als een nieuw bericht arriveert Trillen - Tril ook wanneer een nieuw bericht arriveert - Geluid - Speel beltoon af bij melding Uitstelperiode voor meldingen Schakel meldingen voor korte tijd uit als er een carbon copy wordt ontvangen Geavanceerd diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index 15bd0955..658f1711 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -105,9 +105,6 @@ Powiadomienia Powiadamiaj, gdy nadejdzie wiadomość Wibracje - Wibruj, gdy nadejdzie wiadomość - Dźwięk - Odtwórz dźwięk z powiadomieniem Opóźnienie powiadomień Wyłącz powiadomienia przez krótki czas po otrzymaniu kopii wiadomości Zaawansowane diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index ea50da43..3c41c32a 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -105,11 +105,13 @@ Aceitar automaticamente arquivos menores que... Notificação Notificações - Notificar quando uma nova mensagem for recebida + Notificar ao receber uma nova mensagem Vibração - Vibrar quando uma nova mensagem for recebida - Som - Som de notificação + Vibrar ao receber uma nova mensagem + Notificação via LED + Piscar a luz de notificação ao receber uma nova mensagem + Toque + Tocar um som ao receber uma nova mensagem Tempo de espera da notificação Desativar notificações por um curto período após uma copia ser recebida Avançado @@ -577,4 +579,5 @@ Você já confia nesse contato. Ao selecionar \'Concluído\', você está apenas confirmando que %s é parte dessa conferência. Selecione e recorte a imagem Você desabilitou essa conta + Erro de segurança: Acesso inválido ao arquivo diff --git a/src/main/res/values-pt/strings.xml b/src/main/res/values-pt/strings.xml index c779aa7c..8e502797 100644 --- a/src/main/res/values-pt/strings.xml +++ b/src/main/res/values-pt/strings.xml @@ -107,9 +107,6 @@ Notificações Notificar quando uma nova mensagem for recebida Vibrar - Vibrar também quando uma nova mensagem for recebida - Som - Tocar um som com a notificação Período de carência da notificação Desativar notificações por um curto período após a copia oculta ser recebida Avançadas diff --git a/src/main/res/values-ro-rRO/strings.xml b/src/main/res/values-ro-rRO/strings.xml index 090d234e..d8512d6d 100644 --- a/src/main/res/values-ro-rRO/strings.xml +++ b/src/main/res/values-ro-rRO/strings.xml @@ -107,9 +107,6 @@ Notificari Notifica cand un nou mesaj este primit Vibreaza - Vibreaza cand un nou mesaj este primit - Sunet - Ton de apel pentru notificare Perioada de gratie notificari Opreste notificari pentru o scurta perioada dupa ce o copie a mesajului a fost primita Optiuni avansate diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index c050b6db..c206717c 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -105,9 +105,6 @@ Уведомление Использовать звуковое уведомление когда приходят новые сообщения Вибрация - Использовать вибрацию когда приходят новые сообщения - Звуковой сигнал - Выберите звуковой сигнал для сообщений Отсрочка уведомлений Не использовать уведомления, если вы прочитали сообщение на другом устройстве Дополнительно diff --git a/src/main/res/values-sk/strings.xml b/src/main/res/values-sk/strings.xml index 414fdf69..aaa39dd4 100644 --- a/src/main/res/values-sk/strings.xml +++ b/src/main/res/values-sk/strings.xml @@ -99,9 +99,6 @@ Upozornenia Upozorniť pri prijatí novej správy Vibrovať - Vibrovať pri prijatí novej správy - Zvuk - Prehrať zvuk spolu s upozornením Doba na prečítanie upozornenia Neupozorňovať krátko po obdržaní kópie správy Neodosielať detaily o zlyhaní aplikácie diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml index 5ad8362a..f4091e6b 100644 --- a/src/main/res/values-sr/strings.xml +++ b/src/main/res/values-sr/strings.xml @@ -107,9 +107,11 @@ Обавештења Обавести кад стигне нова порука Вибрирај - Вибрирај кад стигне нова порука + Вибрирање кад стигне нова порука + ЛЕД светло + Трептање ЛЕД светла кад стигне нова порука Звук - Звуци обавештења + Пуштање звука кад стигне нова порука Период одгоде обавештења Искључи обавештења на кратко по примању карбон копије Напредно @@ -580,4 +582,5 @@ Већ се поуздате у овог контакта. Избором „Готово“ само потврђујете да је %s део овог групног ћаскања. Изабери слику и опсеци Искључили сте овај налог + Безбедносна грешка: неисправан приступ фајлу diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 370039c1..2834cbb3 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -107,9 +107,6 @@ Notifieringar Notifiera när meddelande tagits emot Vibrera - Vibrera när meddelande tagits emot - Ljud - Spela ljud med notifiering Notifieringsfrist Inaktivera notifieringar en kort stund efter att en carbon copy tagits emot Avancerat diff --git a/src/main/res/values-tr-rTR/strings.xml b/src/main/res/values-tr-rTR/strings.xml index 2d434f03..a1c08516 100644 --- a/src/main/res/values-tr-rTR/strings.xml +++ b/src/main/res/values-tr-rTR/strings.xml @@ -105,9 +105,6 @@ Bildirimler Yeni ileti geldiğinde bildir Titreşim - Yeni bir ileti geldiğinde aynı zamanda titreşsin - Ses - Bildirimle birlikte zil çalsın Bildirim mühleti Karbon kopya alındıktan sonra kısa bir süre için bildirimleri kapa Gelişmiş diff --git a/src/main/res/values-vi/strings.xml b/src/main/res/values-vi/strings.xml index 935e6fa3..2887af13 100644 --- a/src/main/res/values-vi/strings.xml +++ b/src/main/res/values-vi/strings.xml @@ -104,9 +104,6 @@ Thông báo Thông báo khi có tin nhắn mới Rung - Rung khi có tin nhắn mới - Âm báo - Chơi nhạc chuông cùng với thông báo Thời gian gia hạn thông báo Tắt thông báo trong một thời gian ngắn sau khi nhận được bản sao giấy than Không bao giờ gửi báo cáo dừng chạy diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index 8c770537..9f041334 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -71,6 +71,8 @@ 传递失败 拒绝 准备传输图像 + 正在传输图像 + 正在分享文件,请稍候… 清除历史记录 清除会话记录 删除该会话中所有信息?\n\n注: 该操作不会影响其他设备或服务器保存的信息。 @@ -105,9 +107,6 @@ 通知 收到新消息时通知 震动 - 收到新消息时震动 - 声音 - 收到新消息时的铃声 通知限期 接收副本短时间内关闭通知 高级 @@ -351,6 +350,7 @@ 选择文件 接收中 %1$s (已完成 %2$d%%) 下载 %s + 删除 %s 文件 打开 %s 发送中 (已完成 %1$d%%) @@ -505,7 +505,7 @@ 当设备进入静音模式时把资源标识改为不可用 静音模式开启振动 当设备进入振动模式时把资源标识改为不可用 - 高级边接设置 + 高级连接设置 注册账户时显示主机名和端口 xmpp.example.com 使用证书添加账户 @@ -526,7 +526,7 @@ 您的设备不支持设备证书选择! 连接 通过 Tor 连接 - 所有连接使用 Tor 网络隧道。需要 Orbot + 所有连接使用 Tor 网络传输,需要 Orbot 主机名 端口 服务器 - 或者 .orion 地址 @@ -539,6 +539,7 @@ 载入更多消息 用 %s 分享文件 用 %s 分享图片 + 图片分享自 %s Conversations 需要访问外部存储 与联系人同步 Conversations 会匹配你的 XMPP 花名册与你的联系人,以显示他们的全名和头像。\n\nConversations 只会读取你的联系人并在本地匹配,不会上传到你的服务器。\n\n现在将要询问你是否给予访问你联系人的权限。 diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml index 952035f3..de919744 100644 --- a/src/main/res/values-zh-rTW/strings.xml +++ b/src/main/res/values-zh-rTW/strings.xml @@ -80,9 +80,6 @@ 通知 收到新訊息時通知 震動 - 收到新訊息時震動 - 聲音 - 收到新訊息時播放鈴聲 通知限期 收到副本後,關閉通知一小段時間 總是不發送故障報告 -- cgit v1.2.3 From 7ff890e513212f1cf03667e4ea7e429431d811c4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 11 Apr 2016 22:20:32 +0200 Subject: republish avatar if server offers non-persistent pep :-( --- .../conversations/persistance/FileBackend.java | 38 ++++++++ .../conversations/services/AvatarService.java | 23 ++++- .../services/XmppConnectionService.java | 104 ++++++++++++++++----- .../siacs/conversations/xmpp/XmppConnection.java | 16 ++-- 4 files changed, 144 insertions(+), 37 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 0861a3a8..0d770fef 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -26,6 +26,7 @@ import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; import java.io.FileDescriptor; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -402,6 +403,43 @@ public class FileBackend { } } + public Avatar getStoredPepAvatar(String hash) { + if (hash == null) { + return null; + } + Avatar avatar = new Avatar(); + File file = new File(getAvatarPath(hash)); + FileInputStream is = null; + try { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + BitmapFactory.decodeFile(file.getAbsolutePath(), options); + is = new FileInputStream(file); + ByteArrayOutputStream mByteArrayOutputStream = new ByteArrayOutputStream(); + Base64OutputStream mBase64OutputStream = new Base64OutputStream(mByteArrayOutputStream, Base64.DEFAULT); + MessageDigest digest = MessageDigest.getInstance("SHA-1"); + DigestOutputStream os = new DigestOutputStream(mBase64OutputStream, digest); + byte[] buffer = new byte[4096]; + int length; + while ((length = is.read(buffer)) > 0) { + os.write(buffer, 0, length); + } + os.flush(); + os.close(); + avatar.sha1sum = CryptoHelper.bytesToHex(digest.digest()); + avatar.image = new String(mByteArrayOutputStream.toByteArray()); + avatar.height = options.outHeight; + avatar.width = options.outWidth; + return avatar; + } catch (IOException e) { + return null; + } catch (NoSuchAlgorithmException e) { + return null; + } finally { + close(is); + } + } + public boolean isAvatarCached(Avatar avatar) { File file = new File(getAvatarPath(avatar.getFilename())); return file.exists(); diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index 276be10d..bb8ec5f2 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -6,11 +6,13 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Typeface; import android.net.Uri; +import android.util.Log; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import eu.siacs.conversations.Config; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Bookmark; import eu.siacs.conversations.entities.Contact; @@ -19,8 +21,10 @@ import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; +import eu.siacs.conversations.xmpp.XmppConnection; -public class AvatarService { +public class AvatarService implements OnAdvancedStreamFeaturesLoaded { private static final int FG_COLOR = 0xFFFAFAFA; private static final int TRANSPARENT = 0x00000000; @@ -227,8 +231,7 @@ public class AvatarService { if (avatar != null || cachedOnly) { return avatar; } - avatar = mXmppConnectionService.getFileBackend().getAvatar( - account.getAvatar(), size); + avatar = mXmppConnectionService.getFileBackend().getAvatar(account.getAvatar(), size); if (avatar == null) { avatar = get(account.getJid().toBareJid().toString(), size,false); } @@ -387,10 +390,20 @@ public class AvatarService { return false; } - private boolean drawTile(Canvas canvas, Bitmap bm, int dstleft, int dsttop, - int dstright, int dstbottom) { + private boolean drawTile(Canvas canvas, Bitmap bm, int dstleft, int dsttop, int dstright, int dstbottom) { Rect dst = new Rect(dstleft, dsttop, dstright, dstbottom); canvas.drawBitmap(bm, null, dst, null); return true; } + + @Override + public void onAdvancedStreamFeaturesAvailable(Account account) { + XmppConnection.Features features = account.getXmppConnection().getFeatures(); + if (features.pep() && !features.pepPersistent()) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": has pep but is not persistent"); + if (account.getAvatar() != null) { + mXmppConnectionService.republishAvatarIfNeeded(account); + } + } + } } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 2aaf9b62..117ab861 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -840,6 +840,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa connection.setOnBindListener(this.mOnBindListener); connection.setOnMessageAcknowledgeListener(this.mOnMessageAcknowledgedListener); connection.addOnAdvancedStreamFeaturesAvailableListener(this.mMessageArchiveService); + connection.addOnAdvancedStreamFeaturesAvailableListener(this.mAvatarService); AxolotlService axolotlService = account.getAxolotlService(); if (axolotlService != null) { connection.addOnAdvancedStreamFeaturesAvailableListener(axolotlService); @@ -2338,9 +2339,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } - public void publishAvatar(final Account account, - final Uri image, - final UiCallback callback) { + public void publishAvatar(Account account, Uri image, UiCallback callback) { final Bitmap.CompressFormat format = Config.AVATAR_FORMAT; final int size = Config.AVATAR_SIZE; final Avatar avatar = getFileBackend().getPepAvatar(image, size, format); @@ -2358,40 +2357,96 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa callback.error(R.string.error_saving_avatar, avatar); return; } - final IqPacket packet = this.mIqGenerator.publishAvatar(avatar); - this.sendIqPacket(account, packet, new OnIqPacketReceived() { + publishAvatar(account, avatar, callback); + } else { + callback.error(R.string.error_publish_avatar_converting, null); + } + } - @Override - public void onIqPacketReceived(Account account, IqPacket result) { - if (result.getType() == IqPacket.TYPE.RESULT) { - final IqPacket packet = XmppConnectionService.this.mIqGenerator - .publishAvatarMetadata(avatar); - sendIqPacket(account, packet, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket result) { - if (result.getType() == IqPacket.TYPE.RESULT) { - if (account.setAvatar(avatar.getFilename())) { - getAvatarService().clear(account); - databaseBackend.updateAccount(account); - } + public void publishAvatar(Account account, final Avatar avatar, final UiCallback callback) { + final IqPacket packet = this.mIqGenerator.publishAvatar(avatar); + this.sendIqPacket(account, packet, new OnIqPacketReceived() { + + @Override + public void onIqPacketReceived(Account account, IqPacket result) { + if (result.getType() == IqPacket.TYPE.RESULT) { + final IqPacket packet = XmppConnectionService.this.mIqGenerator + .publishAvatarMetadata(avatar); + sendIqPacket(account, packet, new OnIqPacketReceived() { + @Override + public void onIqPacketReceived(Account account, IqPacket result) { + if (result.getType() == IqPacket.TYPE.RESULT) { + if (account.setAvatar(avatar.getFilename())) { + getAvatarService().clear(account); + databaseBackend.updateAccount(account); + } + if (callback != null) { callback.success(avatar); } else { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": published avatar"); + } + } else { + if (callback != null) { callback.error( R.string.error_publish_avatar_server_reject, avatar); } } - }); - } else { + } + }); + } else { + if (callback != null) { callback.error( R.string.error_publish_avatar_server_reject, avatar); } } - }); - } else { - callback.error(R.string.error_publish_avatar_converting, null); + } + }); + } + + public void republishAvatarIfNeeded(Account account) { + if (account.getAxolotlService().isPepBroken()) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": skipping republication of avatar because pep is broken"); + return; } + IqPacket packet = this.mIqGenerator.retrieveAvatarMetaData(null); + this.sendIqPacket(account, packet, new OnIqPacketReceived() { + + private Avatar parseAvatar(IqPacket packet) { + Element pubsub = packet.findChild("pubsub", "http://jabber.org/protocol/pubsub"); + if (pubsub != null) { + Element items = pubsub.findChild("items"); + if (items != null) { + return Avatar.parseMetadata(items); + } + } + return null; + } + + private boolean errorIsItemNotFound(IqPacket packet) { + Element error = packet.findChild("error"); + return packet.getType() == IqPacket.TYPE.ERROR + && error != null + && error.hasChild("item-not-found"); + } + + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + if (packet.getType() == IqPacket.TYPE.RESULT || errorIsItemNotFound(packet)) { + Avatar serverAvatar = parseAvatar(packet); + if (serverAvatar == null && account.getAvatar() != null) { + Avatar avatar = fileBackend.getStoredPepAvatar(account.getAvatar()); + if (avatar != null) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": avatar on server was null. republishing"); + publishAvatar(account, fileBackend.getStoredPepAvatar(account.getAvatar()), null); + } else { + Log.e(Config.LOGTAG, account.getJid().toBareJid()+": error rereading avatar"); + } + } + } + } + }); } public void fetchAvatar(Account account, Avatar avatar) { @@ -2526,8 +2581,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa @Override public void onIqPacketReceived(Account account, IqPacket packet) { if (packet.getType() == IqPacket.TYPE.RESULT) { - Element pubsub = packet.findChild("pubsub", - "http://jabber.org/protocol/pubsub"); + Element pubsub = packet.findChild("pubsub","http://jabber.org/protocol/pubsub"); if (pubsub != null) { Element items = pubsub.findChild("items"); if (items != null) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 7bc08e9c..4dc5492e 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1530,13 +1530,15 @@ public class XmppConnection implements Runnable { public boolean pep() { synchronized (XmppConnection.this.disco) { - ServiceDiscoveryResult info = disco.get(account.getServer()); - if (info != null && info.hasIdentity("pubsub", "pep")) { - return true; - } else { - info = disco.get(account.getJid().toBareJid()); - return info != null && info.hasIdentity("pubsub", "pep"); - } + ServiceDiscoveryResult info = disco.get(account.getJid().toBareJid()); + return info != null && info.hasIdentity("pubsub", "pep"); + } + } + + public boolean pepPersistent() { + synchronized (XmppConnection.this.disco) { + ServiceDiscoveryResult info = disco.get(account.getJid().toBareJid()); + return info != null && info.getFeatures().contains("http://jabber.org/protocol/pubsub#persistent-items"); } } -- cgit v1.2.3 From 7223b5b2746c2250c94965f89d9f636017e447da Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 12 Apr 2016 17:52:58 +0200 Subject: minor code cleanup --- .../java/eu/siacs/conversations/services/XmppConnectionService.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 117ab861..0c4e5f62 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2456,9 +2456,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void fetchAvatar(Account account, final Avatar avatar, final UiCallback callback) { final String KEY = generateFetchKey(account, avatar); synchronized (this.mInProgressAvatarFetches) { - if (this.mInProgressAvatarFetches.contains(KEY)) { - return; - } else { + if (!this.mInProgressAvatarFetches.contains(KEY)) { switch (avatar.origin) { case PEP: this.mInProgressAvatarFetches.add(KEY); -- cgit v1.2.3 From 2a4db01709909c385808f9a42dd9251f9836eed1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 12 Apr 2016 18:29:41 +0200 Subject: reverse order in contact chooser --- .../eu/siacs/conversations/services/ContactChooserTargetService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java b/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java index c2a45bf2..0a8ac98c 100644 --- a/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java +++ b/src/main/java/eu/siacs/conversations/services/ContactChooserTargetService.java @@ -52,7 +52,7 @@ public class ContactChooserTargetService extends ChooserTargetService implements final Conversation conversation = conversations.get(i); final String name = conversation.getName(); final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel)); - final float score = (1.0f / MAX_TARGETS) * i; + final float score = 1 - (1.0f / MAX_TARGETS) * i; final Bundle extras = new Bundle(); extras.putString("uuid", conversation.getUuid()); chooserTargets.add(new ChooserTarget(name, icon, score, componentName, extras)); -- cgit v1.2.3 From 3e654bea0e26616b11166a37bbf7822aef25d2f0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 12 Apr 2016 18:30:02 +0200 Subject: added share uri button to conference details --- .../ui/ConferenceDetailsActivity.java | 17 ++++++++++ src/main/res/drawable-hdpi/ic_action_share.png | Bin 0 -> 513 bytes src/main/res/drawable-hdpi/ic_share_white_24dp.png | Bin 0 -> 506 bytes src/main/res/drawable-mdpi/ic_action_share.png | Bin 0 -> 383 bytes src/main/res/drawable-mdpi/ic_share_white_24dp.png | Bin 0 -> 361 bytes src/main/res/drawable-xhdpi/ic_action_share.png | Bin 0 -> 666 bytes .../res/drawable-xhdpi/ic_share_white_24dp.png | Bin 0 -> 625 bytes src/main/res/drawable-xxhdpi/ic_action_share.png | Bin 0 -> 969 bytes .../res/drawable-xxhdpi/ic_share_white_24dp.png | Bin 0 -> 857 bytes .../res/drawable-xxxhdpi/ic_share_white_24dp.png | Bin 0 -> 1115 bytes src/main/res/menu/muc_details.xml | 35 ++++++++++++--------- src/main/res/values-v21/themes.xml | 1 + src/main/res/values/attrs.xml | 1 + src/main/res/values/strings.xml | 2 ++ src/main/res/values/themes.xml | 1 + 15 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 src/main/res/drawable-hdpi/ic_action_share.png create mode 100644 src/main/res/drawable-hdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-mdpi/ic_action_share.png create mode 100644 src/main/res/drawable-mdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xhdpi/ic_action_share.png create mode 100644 src/main/res/drawable-xhdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xxhdpi/ic_action_share.png create mode 100644 src/main/res/drawable-xxhdpi/ic_share_white_24dp.png create mode 100644 src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png (limited to 'src/main') diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index adbb0953..a2757070 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -3,8 +3,10 @@ package eu.siacs.conversations.ui; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.PendingIntent; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.os.Build; import android.os.Bundle; @@ -281,6 +283,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers quickEdit(mConversation.getName(),this.onSubjectEdited); } break; + case R.id.action_share: + share(); + break; case R.id.action_save_as_bookmark: saveAsBookmark(); break; @@ -308,6 +313,18 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } } + private void share() { + Intent shareIntent = new Intent(); + shareIntent.setAction(Intent.ACTION_SEND); + shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri()); + shareIntent.setType("text/plain"); + try { + startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with))); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show(); + } + } + @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark); diff --git a/src/main/res/drawable-hdpi/ic_action_share.png b/src/main/res/drawable-hdpi/ic_action_share.png new file mode 100644 index 00000000..a36464b8 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-hdpi/ic_share_white_24dp.png b/src/main/res/drawable-hdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..93b3c219 Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-mdpi/ic_action_share.png b/src/main/res/drawable-mdpi/ic_action_share.png new file mode 100644 index 00000000..7362f0d7 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-mdpi/ic_share_white_24dp.png b/src/main/res/drawable-mdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..4d019722 Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xhdpi/ic_action_share.png b/src/main/res/drawable-xhdpi/ic_action_share.png new file mode 100644 index 00000000..40771e48 Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-xhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..dd536bca Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_action_share.png b/src/main/res/drawable-xxhdpi/ic_action_share.png new file mode 100644 index 00000000..22ed428f Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_action_share.png differ diff --git a/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..9963c6a0 Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png new file mode 100644 index 00000000..bb521c14 Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png differ diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml index 51de4e75..ad79f577 100644 --- a/src/main/res/menu/muc_details.xml +++ b/src/main/res/menu/muc_details.xml @@ -1,5 +1,5 @@ - + + + + android:showAsAction="never" + android:title="@string/show_qr_code"/> + android:showAsAction="never" + android:title="@string/save_as_bookmark"/> - + android:showAsAction="never" + android:title="@string/delete_bookmark"/> + @drawable/ic_lock_open_white_24dp @drawable/ic_settings_grey600_24dp @drawable/ic_import_export_white_24dp + @drawable/ic_share_white_24dp diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index d471e54a..901ea754 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -24,6 +24,7 @@ + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e9e99730..97ba18af 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -612,4 +612,6 @@ Select image and crop You have disabled this account Security error: Invalid file access + No application found to share URI + Share URI with… diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 0f8b95bb..424db4c9 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -30,6 +30,7 @@ @drawable/ic_action_secure @drawable/ic_action_settings @drawable/ic_stat_communication_import_export + @drawable/ic_action_share