diff --git a/ChangeLog b/ChangeLog index b0399dd66..e016c468c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -96,6 +96,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * lua: fix crash on calls to callbacks during load of script * python: fix load of scripts with python >= 3.3 * ruby: fix ruby init with ruby >= 2.0 (bug #41115) +* xfer: add option xfer.file.auto_check_crc32 (patch #7963) == Version 0.4.2 (2013-10-06) diff --git a/doc/de/autogen/user/xfer_options.txt b/doc/de/autogen/user/xfer_options.txt index 76d840d88..b8d29e694 100644 --- a/doc/de/autogen/user/xfer_options.txt +++ b/doc/de/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** Typ: Zeichenkette ** Werte: beliebige Zeichenkette (Standardwert: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** Beschreibung: `automatically check CRC32 file checksum if it is found in the filename (8 hexadecimal chars)` +** Typ: boolesch +** Werte: on, off (Standardwert: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** Beschreibung: `eingehende Dateien werden automatisch umbenannt um ein Überschreiben zu vermeiden (dabei wird dem Dateinamen '.1', '.2', ... hinzugefügt)` ** Typ: boolesch diff --git a/doc/en/autogen/user/xfer_options.txt b/doc/en/autogen/user/xfer_options.txt index 254288cc4..8cbd1c6b8 100644 --- a/doc/en/autogen/user/xfer_options.txt +++ b/doc/en/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** type: string ** values: any string (default value: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** description: `automatically check CRC32 file checksum if it is found in the filename (8 hexadecimal chars)` +** type: boolean +** values: on, off (default value: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** description: `rename incoming files if already exists (add ".1", ".2", ...)` ** type: boolean diff --git a/doc/fr/autogen/user/xfer_options.txt b/doc/fr/autogen/user/xfer_options.txt index 45a712b3b..79464c1c4 100644 --- a/doc/fr/autogen/user/xfer_options.txt +++ b/doc/fr/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** type: chaîne ** valeurs: toute chaîne (valeur par défaut: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** description: `vérifier automatiquement la somme de contrôle CRC32 du fichier si elle est trouvée dans le nom de fichier (8 caractères hexadécimaux)` +** type: booléen +** valeurs: on, off (valeur par défaut: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** description: `renommer les fichiers reçus s'ils existent déjà (ajoute ".1", ".2", ...)` ** type: booléen diff --git a/doc/it/autogen/user/xfer_options.txt b/doc/it/autogen/user/xfer_options.txt index 9fb8f9ed5..c3070bf7d 100644 --- a/doc/it/autogen/user/xfer_options.txt +++ b/doc/it/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** tipo: stringa ** valori: qualsiasi stringa (valore predefinito: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** descrizione: `automatically check CRC32 file checksum if it is found in the filename (8 hexadecimal chars)` +** tipo: bool +** valori: on, off (valore predefinito: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** descrizione: `rinomina i file in ingresso se esistenti (aggiunge ".1", ".2", ...)` ** tipo: bool diff --git a/doc/ja/autogen/user/xfer_options.txt b/doc/ja/autogen/user/xfer_options.txt index 235b6af8d..095b35452 100644 --- a/doc/ja/autogen/user/xfer_options.txt +++ b/doc/ja/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** タイプ: 文字列 ** 値: 未制約文字列 (デフォルト値: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** 説明: `automatically check CRC32 file checksum if it is found in the filename (8 hexadecimal chars)` +** タイプ: ブール +** 値: on, off (デフォルト値: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** 説明: `既に存在する場合、受信ファイルをリネームする (".1"、".2"、...を追加)` ** タイプ: ブール diff --git a/doc/pl/autogen/user/xfer_options.txt b/doc/pl/autogen/user/xfer_options.txt index c38cfcf86..4758209d1 100644 --- a/doc/pl/autogen/user/xfer_options.txt +++ b/doc/pl/autogen/user/xfer_options.txt @@ -58,6 +58,11 @@ ** typ: ciąg ** wartości: dowolny ciąg (domyślna wartość: `""`) +* [[option_xfer.file.auto_check_crc32]] *xfer.file.auto_check_crc32* +** opis: `automatically check CRC32 file checksum if it is found in the filename (8 hexadecimal chars)` +** typ: bool +** wartości: on, off (domyślna wartość: `off`) + * [[option_xfer.file.auto_rename]] *xfer.file.auto_rename* ** opis: `zmień nazwę pliku przychodzącego jeśli juz istnieje (dodaj ".1", ".2", ...)` ** typ: bool diff --git a/po/cs.po b/po/cs.po index 78ca86c8b..79ba71c95 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:03+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" "Language: cs\n" @@ -9573,6 +9573,21 @@ msgstr "selhalo" msgid "aborted" msgstr "zrušeno" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +msgid "CRC error" +msgstr "" + #, fuzzy, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: soubor %s %s %s: %s" @@ -9601,6 +9616,10 @@ msgstr "%s%s: ruším aktivní xfer: \"%s\" od %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: nedostatek paměti pro nový xfer" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: chyba inicializace TLS" + #, fuzzy, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -9829,6 +9848,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "přejmenovat příchozí soubory, jestliže již existují (přídat \".1\", " @@ -9900,6 +9924,14 @@ msgstr "%s%s: nemohu zapisovat do lokálního souboru" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: nemohu se připojit k odesílateli" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: špatné parametry pro funkci \"%s\" (skript: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: chyba při načítání souboru \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: nemohu provést fork" @@ -9961,7 +9993,3 @@ msgstr "" msgid "Constants" msgstr "" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Připojeno na %s (%d.%d.%d.%d) přes xfer rozhovor" diff --git a/po/de.po b/po/de.po index c1d2251dc..b7f7fd593 100644 --- a/po/de.po +++ b/po/de.po @@ -22,8 +22,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:03+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" "Language: de\n" @@ -10660,6 +10660,22 @@ msgstr "fehlgeschlagen" msgid "aborted" msgstr "abgebrochen" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "Fehler" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: Datei %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -10689,6 +10705,10 @@ msgid "%s%s: not enough memory for new xfer" msgstr "" "%s%s: Für einen neuen Transfer steht nicht ausreichend Speicher zur Verfügung" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: TLS Initialisierungsfehler" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10928,6 +10948,11 @@ msgstr "" "speziellen Server) oder \"nick\" (global, für alle Server); Beispiel: " "\"freenode.FlashCode,andrew\"" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "eingehende Dateien werden automatisch umbenannt um ein Überschreiben zu " @@ -11002,6 +11027,14 @@ msgstr "%s%s: Die lokale Datei kann nicht erstellt werden" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: ACK kann nicht an Absender verschickt werden" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: Fehlerhafte Argumente für die Funktion \"%s\" (Skript: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: Fehler beim Laden der Datei \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: es kann kein fork erstellt werden" @@ -11064,7 +11097,3 @@ msgstr "Type" msgid "Constants" msgstr "Konstanten" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Verbindung zu %s (%ld.%ld.%ld.%ld) via Transfer-Chat aufgebaut" diff --git a/po/es.po b/po/es.po index 4e56bc01a..034e664c4 100644 --- a/po/es.po +++ b/po/es.po @@ -22,8 +22,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:04+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" "Language: es\n" @@ -9830,6 +9830,22 @@ msgstr "falló" msgid "aborted" msgstr "abortado" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "error" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: archivo %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -9858,6 +9874,10 @@ msgstr "%s%s: abortando la transferencia activa: \"%s\" desde %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: no hay memoria suficiente para una nueva transferencia" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: error de inicialización de TLS" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10094,6 +10114,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "renombrar los archivos entrantes si ya existen (añadir \".1\", \".2\", ...)" @@ -10165,6 +10190,14 @@ msgstr "%s%s: no es posible escribir el archivo local" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: no es posible conectarse al transmisor" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: argumentos incorrectos para la función \"%s\" (script: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: error mientras se cargaba el archivo \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: no es posible bifurcarse" @@ -10227,7 +10260,3 @@ msgstr "Tipo" msgid "Constants" msgstr "Constantes" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Conectado a %s (%ld.%ld.%ld.%ld) vía charla xfer" diff --git a/po/fr.po b/po/fr.po index d2347802a..3829e6935 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2014-01-02 15:19+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:23+0100\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -10384,6 +10384,21 @@ msgstr "échoué" msgid "aborted" msgstr "interrompu" +msgid "hashing" +msgstr "hachage" + +msgid "CRC in progress" +msgstr "CRC en cours" + +msgid "CRC OK" +msgstr "CRC OK" + +msgid "wrong CRC" +msgstr "mauvais CRC" + +msgid "CRC error" +msgstr "erreur CRC" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: fichier %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -10412,6 +10427,10 @@ msgstr "%s%s: abandon du xfer actif: \"%s\" de %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: pas assez de mémoire pour un nouveau xfer" +#, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: erreur de hash" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10653,6 +10672,13 @@ msgstr "" "format est \"serveur.pseudo\" (pour un serveur spécifique) ou \"pseudo" "\" (pour tous les serveurs); exemple: \"freenode.FlashCode,andrew\"" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" +"vérifier automatiquement la somme de contrôle CRC32 du fichier si elle est " +"trouvée dans le nom de fichier (8 caractères hexadécimaux)" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "renommer les fichiers reçus s'ils existent déjà (ajoute \".1\", \".2\", ...)" @@ -10724,6 +10750,14 @@ msgstr "%s%s: impossible d'écrire dans le fichier local" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: impossible d'envoyer l'accusé de réception à l'envoyeur" +#, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: mauvais CRC32 pour le fichier %s" + +#, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: erreur CRC32 durant la reprise" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: impossible de créer un processus" @@ -10786,6 +10820,3 @@ msgstr "Type" msgid "Constants" msgstr "Constantes" - -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "%sConnecté à %s (%ld.%ld.%ld.%ld) via discussion xfer" diff --git a/po/hu.po b/po/hu.po index 77773de82..ee1126fa2 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:04+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" "Language: hu\n" @@ -8984,6 +8984,21 @@ msgstr "Sikertelen" msgid "aborted" msgstr "Megszakítva" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +msgid "CRC error" +msgstr "" + #, fuzzy, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "DCC: fájl %s%s%s" @@ -9014,6 +9029,10 @@ msgstr "\"%s\" aktív DCC megszakítása a következővel: %s\n" msgid "%s%s: not enough memory for new xfer" msgstr "%s nincs elegendő memória új DCC számára\n" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s gnutls inicializációs hiba\n" + #, fuzzy, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -9246,6 +9265,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + #, fuzzy msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" @@ -9319,6 +9343,14 @@ msgstr "%s DCC: nem sikerült a helyi fájlt írni\n" msgid "%s%s: unable to send ACK to sender" msgstr "%s DCC: nem sikerült kapcsolódni a küldőhöz\n" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s rossz argumentum a \"%s\" parancsnak\n" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" + #, fuzzy, c-format msgid "%s%s: unable to fork" msgstr "%s DCC: nem sikerült forkolni\n" @@ -9383,9 +9415,3 @@ msgstr "" msgid "Constants" msgstr "" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "" -#~ "Csatlakozás a %s%s %s(%s%d.%d.%d.%d%s)%s partnerhez DCC beszélgetésen " -#~ "keresztül\n" diff --git a/po/it.po b/po/it.po index f03764d32..5399e8027 100644 --- a/po/it.po +++ b/po/it.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:05+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" "Language: it\n" @@ -9986,6 +9986,22 @@ msgstr "fallito" msgid "aborted" msgstr "annullato" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "errore" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -10014,6 +10030,10 @@ msgstr "%s%s: annullamento xfer attivo: \"%s\" da %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: memoria non sufficiente per nuovo xfer" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: errore avvio TLS" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10242,6 +10262,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "rinomina i file in ingresso se esistenti (aggiunge \".1\", \".2\", ...)" @@ -10311,6 +10336,14 @@ msgstr "%s%s: impossibile scrivere il file locale" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: impossibile inviare ACK al mittente" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: argomenti errati per la funzione \"%s\" (script: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: errore durante il caricamento del file \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: impossibile effettuare il fork" @@ -10375,7 +10408,3 @@ msgstr "Tipo" msgid "Constants" msgstr "Costanti" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Connesso a %s (%ld.%ld.%ld.%ld) via chat xfer" diff --git a/po/ja.po b/po/ja.po index 993451369..c89446baf 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:05+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:16+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -9964,6 +9964,22 @@ msgstr "失敗" msgid "aborted" msgstr "中止" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "エラー" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: ファイル %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -9992,6 +10008,10 @@ msgstr "%s%s: アクティブな xfer を中断しています: \"%s\" %s から msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: 新しい xfer 用のメモリ不足" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: TLS 初期化エラー" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10221,6 +10241,11 @@ msgstr "" "ト; フォーマットは \"server.nick\" (サーバを特定する場合) または \"nick\" (す" "べてのサーバ); 例: \"freenode.FlashCode,andrew\"" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "既に存在する場合、受信ファイルをリネームする (\".1\"、\".2\"、...を追加)" @@ -10290,6 +10315,14 @@ msgstr "%s%s: ローカルファイルに書き込めません" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: 送信者に ACK を送信できません" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: 関数 \"%s\" の不正な引数 (スクリプト: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: ファイル \"%s\" の読み込み中にエラー" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: フォークできません" @@ -10352,7 +10385,3 @@ msgstr "タイプ" msgid "Constants" msgstr "定数" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "xfer チャットで %s (%ld.%ld.%ld.%ld) に接続" diff --git a/po/pl.po b/po/pl.po index e89bb79e7..d20179f3c 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:05+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" "Language: pl\n" @@ -10205,6 +10205,22 @@ msgstr "nie powodzenie" msgid "aborted" msgstr "przerwano" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "błąd" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: plik %s %s %s (%ld.%ld.%ld.%ld): %s" @@ -10233,6 +10249,10 @@ msgstr "%s%s: przerywam aktywny xfer: \"%s\" od %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: za mało pamięci na nowy xfer" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: błąd inicjacji TLS" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -10464,6 +10484,11 @@ msgstr "" "serwera) lub \"nick\" (dla wszystkich serwerów; przykład \"freenode." "FlashCode,andrew\"" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "zmień nazwę pliku przychodzącego jeśli juz istnieje (dodaj \".1\", " @@ -10532,6 +10557,14 @@ msgstr "%s%s: nie można zapisać pliku" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: nie można wysłać ACK do nadawcy" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: nieprawidłowe argumenty dla funkcji \"%s\" (skrypt: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: błąd podczas ładowania pliku \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: nie można uruchomić procesu potomnego" @@ -10591,7 +10624,3 @@ msgstr "Typ" msgid "Constants" msgstr "Stałe" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Połączono z %s (%ld.%ld.%ld.%ld) poprzez rozmowę xfer" diff --git a/po/pt_BR.po b/po/pt_BR.po index ba22fd8b2..c70295886 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:06+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" "Language: pt_BR\n" @@ -9198,6 +9198,21 @@ msgstr "falhou" msgid "aborted" msgstr "abortado" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +msgid "CRC error" +msgstr "" + #, fuzzy, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "%s%s: arquivo %s %s %s: %s" @@ -9226,6 +9241,10 @@ msgstr "%s%s: abortando transferência ativa: \"%s\" de %s" msgid "%s%s: not enough memory for new xfer" msgstr "%s%s: memória insuficiente para nova transferência" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: erro de inicialização do TLS" + #, fuzzy, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -9462,6 +9481,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" "renomear arquivos recebidos se nome já existir (adiciona \".1\", \".2\", ...)" @@ -9533,6 +9557,14 @@ msgstr "%s%s: não foi possível escrever o arquivo local" msgid "%s%s: unable to send ACK to sender" msgstr "%s%s: não foi possível conectar ao remetente" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s%s: argumentos inválidos para a função \"%s\" (script: %s)" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "%s%s: erro na leitura do arquivo \"%s\"" + #, c-format msgid "%s%s: unable to fork" msgstr "%s%s: não foi possível efetuar o fork" @@ -9595,7 +9627,3 @@ msgstr "" msgid "Constants" msgstr "" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Conectado a %s (%d.%d.%d.%d) via chat de transferência" diff --git a/po/ru.po b/po/ru.po index 965bc2382..fd00031d8 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-12-31 10:06+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" "Language: ru\n" @@ -9011,6 +9011,21 @@ msgstr "Неудача" msgid "aborted" msgstr "Отменено" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +msgid "CRC error" +msgstr "" + #, fuzzy, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "DCC: файл %s%s%s" @@ -9041,6 +9056,10 @@ msgstr "Отменяю активное DCC-сединение: \"%s\" от %s\n msgid "%s%s: not enough memory for new xfer" msgstr "%s недостаточно памяти для нового DCC\n" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s ошибка инициализации gnutls\n" + #, fuzzy, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -9270,6 +9289,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + #, fuzzy msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" @@ -9344,6 +9368,14 @@ msgstr "%s DCC: не могу записать локальный файл\n" msgid "%s%s: unable to send ACK to sender" msgstr "%s DCC: не могу соединиться с отправителем\n" +#, fuzzy, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "%s некорректные аргументы команды \"%s\"\n" + +#, fuzzy, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "Не могу записать лог-файл \"%s\"\n" + #, fuzzy, c-format msgid "%s%s: unable to fork" msgstr "%s DCC: не могу forkнуться\n" @@ -9406,7 +9438,3 @@ msgstr "" msgid "Constants" msgstr "" - -#, fuzzy -#~ msgid "%sConnected to %s (%ld.%ld.%ld.%ld) via xfer chat" -#~ msgstr "Соединён с %s%s %s(%s%d.%d.%d.%d%s)%s DCC-чатом\n" diff --git a/po/tr.po b/po/tr.po index a845b57d8..a1646a028 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" -"PO-Revision-Date: 2013-11-09 10:13+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" +"PO-Revision-Date: 2014-01-06 10:17+0100\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" "Language: tr\n" @@ -8062,6 +8062,22 @@ msgstr "başarısız" msgid "aborted" msgstr "" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +#, fuzzy +msgid "CRC error" +msgstr "hata" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "" @@ -8090,6 +8106,10 @@ msgstr "" msgid "%s%s: not enough memory for new xfer" msgstr "" +#, fuzzy, c-format +msgid "%s%s: hashing error" +msgstr "%s%s: hata: %s" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -8290,6 +8310,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" @@ -8351,6 +8376,14 @@ msgstr "" msgid "%s%s: unable to send ACK to sender" msgstr "" +#, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "" + +#, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "" + #, c-format msgid "%s%s: unable to fork" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index e92c8f8c3..e539a0b2b 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-01-02 15:18+0100\n" +"POT-Creation-Date: 2014-01-06 11:16+0100\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -8018,6 +8018,21 @@ msgstr "" msgid "aborted" msgstr "" +msgid "hashing" +msgstr "" + +msgid "CRC in progress" +msgstr "" + +msgid "CRC OK" +msgstr "" + +msgid "wrong CRC" +msgstr "" + +msgid "CRC error" +msgstr "" + #, c-format msgid "%s%s: file %s %s %s (%ld.%ld.%ld.%ld): %s" msgstr "" @@ -8046,6 +8061,10 @@ msgstr "" msgid "%s%s: not enough memory for new xfer" msgstr "" +#, c-format +msgid "%s%s: hashing error" +msgstr "" + #, c-format msgid "" "%s: incoming file from %s (%ld.%ld.%ld.%ld, %s.%s), name: %s, %llu bytes " @@ -8246,6 +8265,11 @@ msgid "" "\"nick\" (for all servers); example: \"freenode.FlashCode,andrew\"" msgstr "" +msgid "" +"automatically check CRC32 file checksum if it is found in the filename (8 " +"hexadecimal chars)" +msgstr "" + msgid "rename incoming files if already exists (add \".1\", \".2\", ...)" msgstr "" @@ -8307,6 +8331,14 @@ msgstr "" msgid "%s%s: unable to send ACK to sender" msgstr "" +#, c-format +msgid "%s%s: wrong CRC32 for file %s" +msgstr "" + +#, c-format +msgid "%s%s: CRC32 error while resuming" +msgstr "" + #, c-format msgid "%s%s: unable to fork" msgstr "" diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c index 0addbfee3..7a88c2e82 100644 --- a/src/plugins/xfer/xfer-buffer.c +++ b/src/plugins/xfer/xfer-buffer.c @@ -44,7 +44,7 @@ xfer_buffer_refresh (const char *hotlist) { struct t_xfer *ptr_xfer, *xfer_selected; char str_color[256], suffix[32], status[64], date[128], eta[128]; - char str_ip[32]; + char str_ip[32], str_hash[128]; char *progress_bar, *str_pos, *str_total, *str_bytes_per_sec; int i, length, line, progress_bar_size, num_bars; unsigned long long pos, pct_complete; @@ -103,9 +103,22 @@ xfer_buffer_refresh (const char *hotlist) ptr_xfer->remote_address & 0xff); } + str_hash[0] = '\0'; + if (ptr_xfer->hash_target + && ptr_xfer->hash_handle + && (ptr_xfer->hash_status != XFER_HASH_STATUS_UNKNOWN) + && ((ptr_xfer->status == XFER_STATUS_ACTIVE) + || (ptr_xfer->status == XFER_STATUS_DONE) + || (ptr_xfer->status == XFER_STATUS_HASHING))) + { + snprintf (str_hash, sizeof (str_hash), + " (%s)", + _(xfer_hash_status_string[ptr_xfer->hash_status])); + } + /* display first line with remote nick, filename and plugin name/id */ weechat_printf_y (xfer_buffer, (line * 2) + 2, - "%s%s%-24s %s%s%s%s (%s.%s)%s", + "%s%s%-24s %s%s%s%s (%s.%s)%s%s", weechat_color(str_color), (line == xfer_buffer_selected_line) ? "*** " : " ", @@ -117,7 +130,8 @@ xfer_buffer_refresh (const char *hotlist) suffix, ptr_xfer->plugin_name, ptr_xfer->plugin_id, - str_ip); + str_ip, + str_hash); snprintf (status, sizeof (status), "%s", _(xfer_status_string[ptr_xfer->status])); diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c index 2a8c2993f..f81197d21 100644 --- a/src/plugins/xfer/xfer-config.c +++ b/src/plugins/xfer/xfer-config.c @@ -57,6 +57,7 @@ struct t_config_option *xfer_config_network_timeout; struct t_config_option *xfer_config_file_auto_accept_chats; struct t_config_option *xfer_config_file_auto_accept_files; struct t_config_option *xfer_config_file_auto_accept_nicks; +struct t_config_option *xfer_config_file_auto_check_crc32; struct t_config_option *xfer_config_file_auto_rename; struct t_config_option *xfer_config_file_auto_resume; struct t_config_option *xfer_config_file_convert_spaces; @@ -65,7 +66,6 @@ struct t_config_option *xfer_config_file_upload_path; struct t_config_option *xfer_config_file_use_nick_in_filename; - /* * Callback for changes on an option that requires a refresh of xfer list. */ @@ -287,6 +287,12 @@ xfer_config_init () "specific server) or \"nick\" (for all servers); example: " "\"freenode.FlashCode,andrew\""), NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_check_crc32 = weechat_config_new_option ( + xfer_config_file, ptr_section, + "auto_check_crc32", "boolean", + N_("automatically check CRC32 file checksum if it is found in the " + "filename (8 hexadecimal chars)"), + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_rename = weechat_config_new_option ( xfer_config_file, ptr_section, "auto_rename", "boolean", diff --git a/src/plugins/xfer/xfer-config.h b/src/plugins/xfer/xfer-config.h index d515d74e0..65f38538d 100644 --- a/src/plugins/xfer/xfer-config.h +++ b/src/plugins/xfer/xfer-config.h @@ -47,6 +47,7 @@ struct t_config_option *xfer_config_file_auto_accept_files; struct t_config_option *xfer_config_file_auto_accept_nicks; extern struct t_config_option *xfer_config_file_auto_rename; extern struct t_config_option *xfer_config_file_auto_resume; +extern struct t_config_option *xfer_config_file_auto_check_crc32; extern struct t_config_option *xfer_config_file_convert_spaces; extern struct t_config_option *xfer_config_file_download_path; extern struct t_config_option *xfer_config_file_upload_path; diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c index b186e1627..8060ac8b8 100644 --- a/src/plugins/xfer/xfer-dcc.c +++ b/src/plugins/xfer/xfer-dcc.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include "../weechat-plugin.h" #include "xfer.h" @@ -218,6 +220,79 @@ xfer_dcc_recv_file_send_ack (struct t_xfer *xfer) return 2; } +/* + * Reads a resumed xfer from disk for hashing. + * + * Returns: + * 1: OK + * 0: error + */ + +int +xfer_dcc_resume_hash (struct t_xfer *xfer) +{ + char *buf; + unsigned long long total_read; + ssize_t length_buf, to_read, num_read; + int ret, fd; + + total_read = 0; + ret = 1; + fd = 0; + + length_buf = 1024 * 1024; + buf = malloc (length_buf); + if (!buf) + return 0; + + while (fd <= 0) + { + fd = open (xfer->local_filename, O_RDONLY); + if (fd < 0) + { + if (errno == EINTR) + continue; + fd = 0; + ret = 0; + break; + } + } + + if (fd) + { + while (total_read < xfer->start_resume) + { + to_read = xfer->start_resume - total_read; + if (to_read > length_buf) + num_read = read (fd, buf, length_buf); + else + num_read = read (fd, buf, to_read); + if (num_read > 0) + { + gcry_md_write (*xfer->hash_handle, buf, num_read); + total_read += num_read; + } + else if (num_read < 0) + { + if (errno == EINTR) + continue; + ret = 0; + break; + } + } + + while (close (fd) < 0) + { + if (errno != EINTR) + break; + } + } + + free (buf); + + return ret; +} + /* * Child process for receiving file with DCC protocol. */ @@ -230,6 +305,26 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) time_t last_sent, new_time; unsigned long long pos_last_ack; fd_set read_fds, write_fds, except_fds; + ssize_t written, total_written; + unsigned char *bin_hash; + char hash[9]; + + /* if resuming, hash the portion of the file we have */ + if ((xfer->start_resume > 0) && xfer->hash_handle) + { + xfer_network_write_pipe (xfer, XFER_STATUS_HASHING, + XFER_NO_ERROR); + if (!xfer_dcc_resume_hash (xfer)) + { + gcry_md_close (*xfer->hash_handle); + free (xfer->hash_handle); + xfer->hash_handle = NULL; + xfer_network_write_pipe (xfer, XFER_STATUS_HASHING, + XFER_ERROR_HASH_RESUME_ERROR); + } + xfer_network_write_pipe (xfer, XFER_STATUS_CONNECTING, + XFER_NO_ERROR); + } /* first connect to sender (blocking) */ if (!weechat_network_connect_to (xfer->proxy, xfer->sock, @@ -289,6 +384,8 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) } else { + total_written = 0; + if (num_read == 0) { xfer_network_write_pipe (xfer, XFER_STATUS_FAILED, @@ -296,11 +393,30 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) return; } - if (write (xfer->file, buffer, num_read) == -1) + /* bytes received, write to disk */ + while (total_written < num_read) { - xfer_network_write_pipe (xfer, XFER_STATUS_FAILED, - XFER_ERROR_WRITE_LOCAL); - return; + written = write (xfer->file, + buffer + total_written, + num_read - total_written); + if (written < 0) + { + if (errno == EINTR) + continue; + xfer_network_write_pipe (xfer, XFER_STATUS_FAILED, + XFER_ERROR_WRITE_LOCAL); + return; + } + else + { + if (xfer->hash_handle) + { + gcry_md_write (*xfer->hash_handle, + buffer + total_written, + written); + } + total_written += written; + } } xfer->pos += (unsigned long long) num_read; @@ -308,6 +424,34 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) /* file received OK? */ if (xfer->pos >= xfer->size) { + /* check hash and report result to pipe */ + if (xfer->hash_handle) + { + gcry_md_final (*xfer->hash_handle); + bin_hash = gcry_md_read (*xfer->hash_handle, 0); + if (bin_hash) + { + snprintf (hash, 9, "%.2X%.2X%.2X%.2X", + bin_hash[0], bin_hash[1], bin_hash[2], + bin_hash[3]); + if (weechat_strcasecmp (hash, + xfer->hash_target) == 0) + { + xfer_network_write_pipe (xfer, + XFER_STATUS_HASHED, + XFER_NO_ERROR); + } + else + { + xfer_network_write_pipe (xfer, + XFER_STATUS_HASHED, + XFER_ERROR_HASH_MISMATCH); + } + } + } + + fsync (xfer->file); + /* * extra delay before sending ACK, otherwise the send of ACK * may fail diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c index 5e5acc8d8..57d163f92 100644 --- a/src/plugins/xfer/xfer-network.c +++ b/src/plugins/xfer/xfer-network.c @@ -151,11 +151,28 @@ xfer_network_child_read_cb (void *arg_xfer, int fd) _("%s%s: unable to send ACK to sender"), weechat_prefix ("error"), XFER_PLUGIN_NAME); break; + case XFER_ERROR_HASH_MISMATCH: + weechat_printf (NULL, + _("%s%s: wrong CRC32 for file %s"), + weechat_prefix ("error"), XFER_PLUGIN_NAME, + xfer->filename); + xfer->hash_status = XFER_HASH_STATUS_MISMATCH; + break; + case XFER_ERROR_HASH_RESUME_ERROR: + weechat_printf (NULL, + _("%s%s: CRC32 error while resuming"), + weechat_prefix ("error"), XFER_PLUGIN_NAME); + xfer->hash_status = XFER_HASH_STATUS_RESUME_ERROR; + break; } /* read new DCC status */ switch (bufpipe[0] - '0') { + case XFER_STATUS_CONNECTING: + xfer->status = XFER_STATUS_CONNECTING; + xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + break; case XFER_STATUS_ACTIVE: if (xfer->status == XFER_STATUS_CONNECTING) { @@ -176,6 +193,15 @@ xfer_network_child_read_cb (void *arg_xfer, int fd) xfer_close (xfer, XFER_STATUS_FAILED); xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); break; + case XFER_STATUS_HASHING: + xfer->status = XFER_STATUS_HASHING; + xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + break; + case XFER_STATUS_HASHED: + if (bufpipe[1] - '0' == XFER_NO_ERROR) + xfer->hash_status = XFER_HASH_STATUS_MATCH; + xfer_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + break; } } diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 2db2cdafd..20733edd4 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "../weechat-plugin.h" #include "xfer.h" @@ -51,19 +52,25 @@ WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); struct t_weechat_plugin *weechat_xfer_plugin = NULL; -char *xfer_type_string[] = /* strings for types */ +char *xfer_type_string[] = /* strings for types */ { "file_recv", "file_send", "chat_recv", "chat_send" }; -char *xfer_protocol_string[] = /* strings for protocols */ +char *xfer_protocol_string[] = /* strings for protocols */ { "none", "dcc" }; -char *xfer_status_string[] = /* strings for status */ +char *xfer_status_string[] = /* strings for status */ { N_("waiting"), N_("connecting"), N_("active"), N_("done"), N_("failed"), - N_("aborted") + N_("aborted"), N_("hashing") +}; + +char *xfer_hash_status_string[] = /* strings for hash status */ +{ "?", + N_("CRC in progress"), N_("CRC OK"), + N_("wrong CRC"), N_("CRC error") }; struct t_xfer *xfer_list = NULL; /* list of files/chats */ @@ -72,7 +79,6 @@ int xfer_count = 0; /* number of xfer */ int xfer_signal_upgrade_received = 0; /* signal "upgrade" received ? */ - void xfer_disconnect_all (); @@ -567,6 +573,59 @@ xfer_nick_auto_accepted (const char *server, const char *nick) return rc; } +/* + * Searches CRC32 in a filename. + * + * If more than one CRC32 are found, the last one is returned + * (with the higher index in filename). + * + * The chars before/after CRC32 must be either beginning/end of string or + * non-hexadecimal chars. + * + * Examples: + * + * test_filename => -1 (not found: no CRC32) + * test_1234abcd => 5 ("1234abcd") + * 1234abcd_test => 0 ("1234abcd") + * 1234abcd_12345678 => 9 ("12345678") + * 123456789abcdef => -1 (not found: missing delimiter around CRC32) + * + * Returns pointer to last CRC32 in string, NULL if no CRC32 was found. + */ + +const char * +xfer_filename_crc32 (const char *filename) +{ + int length; + const char *ptr_string, *ptr_crc32; + + length = 0; + ptr_crc32 = NULL; + + ptr_string = filename; + while (ptr_string && ptr_string[0]) + { + if (((ptr_string[0] >= '0') && (ptr_string[0] <= '9')) + || ((ptr_string[0] >= 'A') && (ptr_string[0] <= 'F')) + || ((ptr_string[0] >= 'a') && (ptr_string[0] <= 'f'))) + { + length++; + } + else + { + if (length == 8) + ptr_crc32 = ptr_string - 8; + length = 0; + } + + ptr_string = weechat_utf8_next_char (ptr_string); + } + if (length == 8) + ptr_crc32 = ptr_string - 8; + + return ptr_crc32; +} + /* * Adds a xfer to list. * @@ -582,7 +641,7 @@ xfer_new (const char *plugin_name, const char *plugin_id, int port, int sock, const char *local_filename) { struct t_xfer *new_xfer; - const char *ptr_color; + const char *ptr_color, *ptr_crc32; new_xfer = xfer_alloc (); if (!new_xfer) @@ -634,6 +693,36 @@ xfer_new (const char *plugin_name, const char *plugin_id, else xfer_file_find_filename (new_xfer); + new_xfer->hash_handle = NULL; + new_xfer->hash_target = NULL; + new_xfer->hash_status = XFER_HASH_STATUS_UNKNOWN; + + if ((type == XFER_TYPE_FILE_RECV) + && weechat_config_boolean (xfer_config_file_auto_check_crc32)) + { + ptr_crc32 = xfer_filename_crc32 (new_xfer->filename); + if (ptr_crc32) + { + new_xfer->hash_handle = malloc (sizeof (gcry_md_hd_t)); + if (new_xfer->hash_handle) + { + if (gcry_md_open (new_xfer->hash_handle, GCRY_MD_CRC32, 0) == 0) + { + new_xfer->hash_target = weechat_strndup (ptr_crc32, 8); + new_xfer->hash_status = XFER_HASH_STATUS_IN_PROGRESS; + } + else + { + free (new_xfer->hash_handle); + new_xfer->hash_handle = NULL; + weechat_printf (NULL, + _("%s%s: hashing error"), + weechat_prefix ("error"), XFER_PLUGIN_NAME); + } + } + } + } + /* write info message on core buffer */ switch (type) { @@ -788,6 +877,13 @@ xfer_free (struct t_xfer *xfer) free (xfer->unterminated_message); if (xfer->local_filename) free (xfer->local_filename); + if (xfer->hash_handle) + { + gcry_md_close (*xfer->hash_handle); + free (xfer->hash_handle); + } + if (xfer->hash_target) + free (xfer->hash_target); free (xfer); @@ -1450,6 +1546,12 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer) snprintf (value, sizeof (value), "%llu", xfer->eta); if (!weechat_infolist_new_var_string (ptr_item, "eta", value)) return 0; + if (!weechat_infolist_new_var_string (ptr_item, "hash_target", xfer->hash_target)) + return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "hash_status", xfer->hash_status)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "hash_status_string", xfer_hash_status_string[xfer->hash_status])) + return 0; return 1; } @@ -1512,6 +1614,10 @@ xfer_print_log () weechat_log_printf (" last_activity . . . : %ld", ptr_xfer->last_activity); weechat_log_printf (" bytes_per_sec . . . : %llu", ptr_xfer->bytes_per_sec); weechat_log_printf (" eta . . . . . . . . : %llu", ptr_xfer->eta); + weechat_log_printf (" hash_target . . . . : '%s'", ptr_xfer->hash_target); + weechat_log_printf (" hash_status . . . . : %d (%s)", + ptr_xfer->hash_status, + xfer_hash_status_string[ptr_xfer->hash_status]); weechat_log_printf (" prev_xfer . . . . . : 0x%lx", ptr_xfer->prev_xfer); weechat_log_printf (" next_xfer . . . . . : 0x%lx", ptr_xfer->next_xfer); } diff --git a/src/plugins/xfer/xfer.h b/src/plugins/xfer/xfer.h index 962d4a00e..2afbd50b3 100644 --- a/src/plugins/xfer/xfer.h +++ b/src/plugins/xfer/xfer.h @@ -21,6 +21,7 @@ #define __WEECHAT_XFER_H 1 #include +#include #define weechat_plugin weechat_xfer_plugin #define XFER_PLUGIN_NAME "xfer" @@ -57,6 +58,8 @@ enum t_xfer_status XFER_STATUS_DONE, /* transfer done */ XFER_STATUS_FAILED, /* transfer failed */ XFER_STATUS_ABORTED, /* transfer aborted by user */ + XFER_STATUS_HASHING, /* partial local file is being hashed*/ + XFER_STATUS_HASHED, /* received file has been hashed */ /* number of xfer status */ XFER_NUM_STATUS, }; @@ -75,10 +78,25 @@ enum t_xfer_error XFER_ERROR_RECV_BLOCK, /* unable to recv block from sender */ XFER_ERROR_WRITE_LOCAL, /* unable to write to local file */ XFER_ERROR_SEND_ACK, /* unable to send ACK to sender */ + XFER_ERROR_HASH_MISMATCH, /* CRC32 does not match */ + XFER_ERROR_HASH_RESUME_ERROR, /* other error with CRC32 hash */ /* number of errors */ XFER_NUM_ERRORS, }; +/* hash status */ + +enum t_xfer_hash_status +{ + XFER_HASH_STATUS_UNKNOWN = 0, /* hashing not being performed */ + XFER_HASH_STATUS_IN_PROGRESS, /* hash in progress */ + XFER_HASH_STATUS_MATCH, /* hash finished and matches target */ + XFER_HASH_STATUS_MISMATCH, /* hash finished with mismatch */ + XFER_HASH_STATUS_RESUME_ERROR, /* hash failed while resuming */ + /* number of hash status */ + XFER_NUM_HASH_STATUS, +}; + /* xfer block size */ #define XFER_BLOCKSIZE_MIN 1024 /* min block size */ @@ -153,6 +171,9 @@ struct t_xfer time_t last_activity; /* time of last byte received/sent */ unsigned long long bytes_per_sec; /* bytes per second */ unsigned long long eta; /* estimated time of arrival */ + gcry_md_hd_t *hash_handle; /* handle for CRC32 hash */ + char *hash_target; /* the CRC32 hash to check against */ + enum t_xfer_hash_status hash_status; /* hash status */ struct t_xfer *prev_xfer; /* link to previous xfer */ struct t_xfer *next_xfer; /* link to next xfer */ }; @@ -161,6 +182,7 @@ extern struct t_weechat_plugin *weechat_xfer_plugin; extern char *xfer_type_string[]; extern char *xfer_protocol_string[]; extern char *xfer_status_string[]; +extern char *xfer_hash_status_string[]; extern struct t_xfer *xfer_list, *last_xfer; extern int xfer_count;