diff --git a/README.md b/README.md index bfaafd7..e2398e2 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,9 @@ qmllint qml/pages/*.qml qml/cover/*.qml # sintassi (Silica assente: filtr Le schermate sono lavoro nuovo, ma il progetto nasce da GrumpyDove (EUPL-1.2): la licenza del porting resta la stessa. + +**Icone**: l'icona dell'app e quelle delle cartelle vengono da `icons/` +dell'originale — le bitmap Eudora rilasciate dal Computer History Museum, BSD +3-Clause. Il testo della licenza è in `icons/license/LICENSE` e la provenienza +è dichiarata nello spec del pacchetto: la clausola BSD chiede che l'avviso di +copyright accompagni la redistribuzione, anche in forma binaria. diff --git a/documenti/piano-porting.md b/documenti/piano-porting.md index 53de267..10aa927 100644 --- a/documenti/piano-porting.md +++ b/documenti/piano-porting.md @@ -112,6 +112,21 @@ Quello che lo spike **non** ha provato, e che resta il lavoro successivo: `/usr/lib` dal device). 3. **L'esecuzione sul telefono** con l'app vera (SailJail, sandbox, spazio). +### Il motore completo, con le librerie (stesso giorno) + +Punto 1 chiuso. Costruito un sysroot aarch64 dai `.deb` di Debian senza root +(`spike/cross_sysroot.py`, 123 pacchetti, 67 MB), poi: + +| prova | esito | +|---|---| +| i 5 shim C (IMAP, JMAP, SMTP, CardDAV, immagini) compilati per aarch64 | ok | +| link del motore con libetpan, gpgme, jansson, curl, gnutls, libxml2 | ok (2,3 MB, ARM aarch64) | +| esecuzione su una Maildir vera, con le callback della vista al posto di Qt | ok: cartelle elencate, «In» aperta, messaggio letto, `colonna 4: Luca Bianchi` | + +Restano aperti: `gpg_shim.cpp` (PGP e S/MIME veri) vuole `g++-12-aarch64-linux-gnu`, +non installato — nel test è uno stub che risponde «non incluso»; il sysroot Debian +va sostituito con quello del telefono; l'esecuzione sul device. + ## Alternative, per completezza - **Non portare il motore, riscriverlo**: si perde l'unica cosa che rende diff --git a/harbour-grumpydove.pro b/harbour-grumpydove.pro index 4d6791e..0593c40 100644 --- a/harbour-grumpydove.pro +++ b/harbour-grumpydove.pro @@ -11,6 +11,7 @@ OTHER_FILES += \ qml/pages/*.qml \ qml/cover/*.qml \ qml/js/*.js \ + qml/images/*.png \ rpm/harbour-grumpydove.spec \ rpm/harbour-grumpydove.desktop diff --git a/icons/108x108/harbour-grumpydove.png b/icons/108x108/harbour-grumpydove.png index d405f05..c32be42 100644 Binary files a/icons/108x108/harbour-grumpydove.png and b/icons/108x108/harbour-grumpydove.png differ diff --git a/icons/128x128/harbour-grumpydove.png b/icons/128x128/harbour-grumpydove.png index fda1efa..f664dd1 100644 Binary files a/icons/128x128/harbour-grumpydove.png and b/icons/128x128/harbour-grumpydove.png differ diff --git a/icons/172x172/harbour-grumpydove.png b/icons/172x172/harbour-grumpydove.png index 9ba268c..624c2bc 100644 Binary files a/icons/172x172/harbour-grumpydove.png and b/icons/172x172/harbour-grumpydove.png differ diff --git a/icons/86x86/harbour-grumpydove.png b/icons/86x86/harbour-grumpydove.png index 55c7715..60c678d 100644 Binary files a/icons/86x86/harbour-grumpydove.png and b/icons/86x86/harbour-grumpydove.png differ diff --git a/icons/license/LICENSE b/icons/license/LICENSE new file mode 100644 index 0000000..b1a30b1 --- /dev/null +++ b/icons/license/LICENSE @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (c) 2017, Computer History Museum. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted (subject to the limitations in the disclaimer +below) provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Computer History Museum nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY +THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/qml/images/icona-account.png b/qml/images/icona-account.png new file mode 100644 index 0000000..8b22d98 Binary files /dev/null and b/qml/images/icona-account.png differ diff --git a/qml/images/icona-allegato.png b/qml/images/icona-allegato.png new file mode 100644 index 0000000..d657d10 Binary files /dev/null and b/qml/images/icona-allegato.png differ diff --git a/qml/images/icona-cartella.png b/qml/images/icona-cartella.png new file mode 100644 index 0000000..4c16842 Binary files /dev/null and b/qml/images/icona-cartella.png differ diff --git a/qml/images/icona-in.png b/qml/images/icona-in.png new file mode 100644 index 0000000..82b6e03 Binary files /dev/null and b/qml/images/icona-in.png differ diff --git a/qml/images/icona-junk.png b/qml/images/icona-junk.png new file mode 100644 index 0000000..6de7681 Binary files /dev/null and b/qml/images/icona-junk.png differ diff --git a/qml/images/icona-out.png b/qml/images/icona-out.png new file mode 100644 index 0000000..693c9b9 Binary files /dev/null and b/qml/images/icona-out.png differ diff --git a/qml/images/icona-trash.png b/qml/images/icona-trash.png new file mode 100644 index 0000000..7cdf06a Binary files /dev/null and b/qml/images/icona-trash.png differ diff --git a/qml/pages/MailboxesPage.qml b/qml/pages/MailboxesPage.qml index c9066f4..2685c61 100644 --- a/qml/pages/MailboxesPage.qml +++ b/qml/pages/MailboxesPage.qml @@ -28,6 +28,18 @@ Page { { cartella: box, titolo: nome }); } + // Le icone vengono dagli sprite dell'originale (icons/ di GrumpyDove, + // BSD 3-Clause, © Computer History Museum): cartella, In, Out, Trash, + // Junk, account. + function iconaDi(tipo) { + if (tipo === "account") return "../images/icona-account.png"; + if (tipo === "in") return "../images/icona-in.png"; + if (tipo === "out") return "../images/icona-out.png"; + if (tipo === "trash") return "../images/icona-trash.png"; + if (tipo === "junk") return "../images/icona-junk.png"; + return "../images/icona-cartella.png"; + } + SilicaListView { id: lista anchors.fill: parent @@ -55,21 +67,22 @@ Page { height: Math.max(Theme.itemSizeMedium, etichetta.implicitHeight + Theme.paddingLarge) onClicked: page.apriCartella(model.nome, model.mailbox) - // Rientro per profondita': la gerarchia si vede, non si spiega. - Rectangle { - id: barra + // Rientro per profondita': la gerarchia si vede dall'icona. + Image { + id: icona x: Theme.horizontalPageMargin + model.livello * Theme.paddingLarge - width: Theme.paddingSmall / 3 - height: parent.height - Theme.paddingMedium + width: Theme.iconSizeSmall + height: width anchors.verticalCenter: parent.verticalCenter - color: model.tipo === "account" ? Theme.highlightColor : "transparent" - visible: model.tipo !== "account" + source: page.iconaDi(model.tipo) + // pixel art dell'originale: niente sfumature inventate + smooth: false } Column { id: etichetta - anchors.left: parent.left - anchors.leftMargin: Theme.horizontalPageMargin + model.livello * Theme.paddingLarge + anchors.left: icona.right + anchors.leftMargin: Theme.paddingMedium anchors.right: conteggio.left anchors.rightMargin: Theme.paddingMedium anchors.verticalCenter: parent.verticalCenter diff --git a/qml/pages/MessagesPage.qml b/qml/pages/MessagesPage.qml index cf949d6..38c8875 100644 --- a/qml/pages/MessagesPage.qml +++ b/qml/pages/MessagesPage.qml @@ -113,12 +113,27 @@ Page { truncationMode: TruncationMode.Fade color: riga.highlighted ? Theme.highlightColor : Theme.primaryColor } - Label { + Row { width: parent.width - text: model.allegato ? model.oggetto + " \u2022" : model.oggetto - font.pixelSize: Theme.fontSizeSmall - truncationMode: TruncationMode.Fade - color: Theme.secondaryColor + spacing: Theme.paddingSmall + + Label { + width: parent.width - (model.allegato + ? Theme.iconSizeExtraSmall + Theme.paddingSmall : 0) + text: model.oggetto + font.pixelSize: Theme.fontSizeSmall + truncationMode: TruncationMode.Fade + color: Theme.secondaryColor + } + Image { + visible: model.allegato + width: Theme.iconSizeExtraSmall + height: width + anchors.verticalCenter: parent.verticalCenter + // graffetta degli sprite originali (BSD 3-Clause, CHM) + source: "../images/icona-allegato.png" + smooth: false + } } } diff --git a/rpm/harbour-grumpydove.spec b/rpm/harbour-grumpydove.spec index a904910..94626a6 100644 --- a/rpm/harbour-grumpydove.spec +++ b/rpm/harbour-grumpydove.spec @@ -1,9 +1,11 @@ Name: harbour-grumpydove Summary: Eudora-style mail interface, mobile prototype -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Qt/Qt -License: EUPL-1.2 +# Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause +# (© Computer History Museum), vedi icons/license/LICENSE +License: EUPL-1.2 and BSD URL: https://git.keinpfusch.net/loweel/grumpydove Source0: %{name}-%{version}.tar.gz Source1: %{name}.desktop @@ -21,6 +23,16 @@ mail client written in Ada and Qt 6 by LowEel (EUPL-1.2). Screens only, with fake data: it exists to judge the mobile layout on a real phone before investing in the engine port. +Icons come from the original project's Eudora bitmaps (BSD 3-Clause, +Computer History Museum). + +%changelog +* Wed Nov 11 2026 Carlo Baratto - 0.1.1-1 +- Icone dell'originale: icona dell'app dal grumpydove.png 512x512 e sprite + Eudora ritagliati (cartella, In, Out, Trash, Junk, account, allegato), + BSD 3-Clause del Computer History Museum; la barra di rientro delle + cartelle lascia il posto all'icona indentata + %prep %setup -q -n %{name}-%{version} diff --git a/spike/README.md b/spike/README.md new file mode 100644 index 0000000..cbc9c3a --- /dev/null +++ b/spike/README.md @@ -0,0 +1,94 @@ +# Spike: il motore di GrumpyDove su ARM + +Due prove separate, entrambe riproducibili senza telefono. + +## 1. Il motore gira (`run.sh`) + +Compila con il cross Debian e esegue in emulazione aarch64: + +- un «hello Ada»; +- tutti i file Ada del motore (verifica semantica); +- un programma che legge una Maildir vera con il motore; +- un test di tasking (3 task, protected object, 30.000 incrementi). + +```sh +./run.sh /percorso/grumpydove/src +``` + +## 2. Il motore completo, con gli shim C (questo file) + +Serve a provare che il motore si linka **con libetpan, gpgme, jansson, curl, +gnutls e libxml2** — cioè come sarà nell'app — senza Qt e senza telefono. + +### Sysroot aarch64 senza root + +`cross_sysroot.py` scarica dai repo Debian i `.deb` arm64 delle librerie (e +delle loro dipendenze) e li estrae in un albero locale, da passare come +`--sysroot` al compilatore cross. + +```sh +curl -o /tmp/arm64-Packages.xz \ + http://ftp.it.debian.org/debian/dists/bookworm/main/binary-arm64/Packages.xz +python3 cross_sysroot.py sysroot /tmp/arm64-Packages.xz # ~120 pacchetti, 67 MB +``` + +Note che sono costate tempo: + +- l'indice va decompresso con `xz` (1,8 s), **non** con `lzma` di Python (oltre + 120 s su questo host); +- `libc6` **non** va escluso dalle dipendenze: senza, il linker non trova + `libc.so.6` né `ld-linux-aarch64.so.1`; +- serve anche `zlib1g-dev`, altrimenti `-lz` fallisce; +- il runtime Ada (`libgnat-12.so`, `libgnarl-12.so`) va copiato dal cross dentro + il sysroot, o il binario non parte. + +### Compilare e linkare + +```sh +SYS=$PWD/sysroot +# Ada (motore) +aarch64-linux-gnu-gnatmake -c -gnat2022 -O2 -Isrc src/grumpydove.adb +# shim C +aarch64-linux-gnu-gcc-12 --sysroot=$SYS -O2 -fPIC -Isrc \ + -I$SYS/usr/include/libxml2 -c imap_shim.c jmap_shim.c smtp_bridge.c \ + carddav_shim.c image_fetch.c +# stub della vista (gd_run) e di PGP/S-MIME: sostituiscono qt_shim.cpp e +# gpg_shim.cpp, che richiedono Qt 6 e g++, non disponibili nel cross +aarch64-linux-gnu-gcc-12 --sysroot=$SYS -O2 -fPIC -Isrc -c stub_gui.c stub_pgp.c +# link +aarch64-linux-gnu-gnatmake -gnat2022 -O2 -Isrc src/grumpydove.adb -largs *.o \ + --sysroot=$SYS -L$SYS/usr/lib/aarch64-linux-gnu \ + -letpan -lgpgme -ljansson -lcurl -lgnutls -lxml2 -lz -lpthread -ldl +``` + +`gnatlink` diretto su questo host risponde `Failed to open binder output`: +si passa da `gnatmake ... -largs`, che fa le stesse cose e funziona. + +### Eseguire + +```sh +HOME= qemu-aarch64-static -L $SYS ./grumpydove +``` + +Esito (11 novembre 2026): + +``` +--- cartelle viste dal motore (senza Qt) --- +Local / In / Out / Junk / Trash / In / Out / progetti / In / Out +--- messaggio in testa a ogni cartella --- +cartella 5 (In): 1 KB + colonna 1: 3 + colonna 4: Luca Bianchi +``` + +Il motore elenca le cartelle, apre «In», legge il messaggio e ne restituisce i +campi attraverso le callback che riceve dalla vista: è esattamente il contratto +che il bridge QML dovrà fornire. + +### Cosa manca + +- `gpg_shim.cpp` (OpenPGP e S/MIME veri) richiede `g++-12-aarch64-linux-gnu`, + non installato: nel test è sostituito da `stub_pgp.c`, che risponde «non + incluso in questa build». +- Il sysroot è Debian: prima della consegna va rifatto contro le librerie del + telefono (un `tar` di `/lib` e `/usr/lib` dal device). diff --git a/spike/cross_sysroot.py b/spike/cross_sysroot.py new file mode 100644 index 0000000..33851b4 --- /dev/null +++ b/spike/cross_sysroot.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +"""Costruisce un sysroot aarch64 dai .deb di Debian, senza root. + +Risolve le dipendenze delle librerie che servono al motore di GrumpyDove +(libetpan, gpgme, jansson, curl, gnutls, libxml2) e le estrae in un albero +locale, da usare come --sysroot del compilatore cross. + +Uso: cross_sysroot.py [indice Packages.xz] +""" +import os +import subprocess +import sys +import urllib.request + +BASE = "http://ftp.it.debian.org/debian" +ROOTS = ["libetpan-dev", "libjansson-dev", "libgpgme-dev", + "libcurl4-gnutls-dev", "libgnutls28-dev", "libxml2-dev", + "libc6-dev", "zlib1g-dev"] + +# gia' forniti dal compilatore cross o non servono per compilare +SKIP = {"libgcc-12-dev", "gcc-12-base", "dpkg", "debconf", "libcrypt1", + "rpcsvc-proto"} + + +def parse_index(path): + # Python decompresso questo indice in minuti: si usa xz, che lo fa in + # un secondo (verificato: 47 MB in 1,8 s contro oltre 120 s). + text_path = path[:-3] + ".txt" if path.endswith(".xz") else path + if path.endswith(".xz") and not os.path.exists(text_path): + with open(text_path, "w") as out: + subprocess.run(["xz", "-dc", path], stdout=out, check=True) + with open(text_path, "r", encoding="utf-8", errors="replace") as fh: + data = fh.read() + pkgs = {} + for block in data.split("\n\n"): + d = {} + for line in block.split("\n"): + if line[:1] in (" ", "") or ":" not in line: + continue + k, v = line.split(":", 1) + d[k] = v.strip() + if "Package" in d and "Filename" in d: + pkgs[d["Package"]] = d + return pkgs + + +def deps_of(pkg): + out = [] + for field in ("Pre-Depends", "Depends"): + raw = pkg.get(field, "") + for item in raw.split(","): + item = item.strip() + if not item: + continue + first = item.split("|")[0].strip() + name = first.split(" ")[0].split(":")[0] + if name: + out.append(name) + return out + + +def main(): + dest = sys.argv[1] if len(sys.argv) > 1 else "cross-sysroot" + index = sys.argv[2] if len(sys.argv) > 2 else "/tmp/arm64-Packages.xz" + pkgs = parse_index(index) + print("indice:", len(pkgs), "pacchetti") + + queue = list(ROOTS) + chosen, missing = {}, set() + while queue: + name = queue.pop() + if name in chosen or name in SKIP: + continue + pkg = pkgs.get(name) + if not pkg: + missing.add(name) + continue + chosen[name] = pkg + queue.extend(deps_of(pkg)) + + if missing: + print("non trovati (ignorati):", ", ".join(sorted(missing))) + + os.makedirs(dest, exist_ok=True) + debs = os.path.join(dest, ".debs") + os.makedirs(debs, exist_ok=True) + total = 0 + for name, pkg in sorted(chosen.items()): + fn = pkg["Filename"] + out = os.path.join(debs, os.path.basename(fn)) + if not os.path.exists(out): + url = "%s/%s" % (BASE, fn) + urllib.request.urlretrieve(url, out) + total += os.path.getsize(out) + subprocess.run(["dpkg-deb", "-x", out, dest], check=True) + print(" estratto %-28s %s" % (name, pkg.get("Version", ""))) + + print("pacchetti: %d, scaricati %.1f MB -> %s" % (len(chosen), total / 1e6, dest)) + + +if __name__ == "__main__": + main() diff --git a/spike/stub_gui.c b/spike/stub_gui.c new file mode 100644 index 0000000..754572d --- /dev/null +++ b/spike/stub_gui.c @@ -0,0 +1,85 @@ +/* Sostituto della vista Qt per provare il motore senza GUI. + * + * Implementa le due funzioni che il main Ada si aspetta dalla vista + * (gd_single_instance, gd_already_open) e la gd_run: invece di aprire + * finestre, usa le callback che il motore le passa per elencare le cartelle + * e leggere la prima riga della prima cartella. Serve a provare il motore + * completo su ARM senza Qt. + */ +#include +#include +#include "qt_shim.h" + +int gd_single_instance(void) { return 1; } + +void gd_already_open(void) { printf("un'altra istanza e' aperta\n"); } + +int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell, + gd_body_fn body, gd_sort_fn sort, gd_read_fn mark_read, + gd_id_of_fn id_of, gd_row_of_fn row_of, gd_move_fn move, + gd_commit_fn commit, gd_empty_fn empty, gd_log_fn log, + gd_set_fn priority, gd_set_fn label, gd_text_fn decrypt, + gd_text_fn sender, gd_text_fn key_of, gd_header_fn header, + gd_text_fn plain, gd_text_fn sheet, gd_compose_fn compose, + gd_filter_fn filter, gd_last_id_fn last_id, + gd_find_start_fn find_start, gd_find_poll_fn find_poll, + gd_find_cancel_fn find_cancel, gd_id_named_fn id_named, + gd_claim_fn claim, gd_send_done_fn send_done, + gd_send_start_fn send_start, gd_find_poll_fn send_poll, + gd_find_start_fn imap_start, gd_find_poll_fn imap_poll, + gd_absorb_fn absorb, gd_rescan_fn rescan, gd_shown_at_fn shown_at, + gd_can_hold_fn can_hold, gd_make_folder_fn make_folder, + gd_can_hold_fn can_change, gd_make_folder_fn change_folder, + gd_can_hold_fn forget, gd_can_hold_fn has_box, + gd_place_fn place, gd_find_start_fn imap_create, + gd_find_start_fn book_start, gd_find_poll_fn book_poll, + gd_place_fn book_list, gd_queue_sent_fn queue_sent, gd_text_fn html, + gd_text_fn images, gd_text_fn attachments, gd_text_fn path, + gd_can_hold_fn unread) +{ + char buf[512]; + long total_k = 0; + int depth = 0, len, i; + + (void)body; (void)sort; (void)mark_read; (void)id_of; (void)row_of; + (void)move; (void)commit; (void)empty; (void)log; (void)priority; + (void)label; (void)decrypt; (void)sender; (void)key_of; (void)header; + (void)plain; (void)sheet; (void)compose; (void)filter; (void)last_id; + (void)find_start; (void)find_poll; (void)find_cancel; (void)id_named; + (void)claim; (void)send_done; (void)send_start; (void)send_poll; + (void)imap_start; (void)imap_poll; (void)absorb; (void)rescan; + (void)shown_at; (void)can_hold; (void)make_folder; (void)can_change; + (void)change_folder; (void)forget; (void)has_box; (void)place; + (void)imap_create; (void)book_start; (void)book_poll; (void)book_list; + (void)queue_sent; (void)html; (void)images; (void)attachments; + (void)path; (void)unread; + + printf("--- cartelle viste dal motore (senza Qt) ---\n"); + for (i = 0; i < 40; i++) { + len = folder(i, &depth, buf, (int)sizeof buf); + if (len < 0) break; + if (len > (int)sizeof buf) len = (int)sizeof buf; + buf[len] = '\0'; + printf("%*s%s\n", depth * 2, "", buf); + } + + printf("--- messaggio in testa a ogni cartella ---\n"); + for (i = 0; i < 40; i++) { + char name[512]; + int d = 0, n = folder(i, &d, name, (int)sizeof name - 1); + if (n < 0) break; + if (n > (int)sizeof name - 1) n = (int)sizeof name - 1; + name[n] = '\0'; + total_k = 0; + if (open(i, &total_k) == 0 || total_k == 0) continue; + printf("cartella %d (%s): %ld KB\n", i, name, total_k); + for (int c = 0; c < 5; c++) { + len = cell(i, 0, c, buf, (int)sizeof buf - 1); + if (len <= 0) continue; + if (len > (int)sizeof buf - 1) len = (int)sizeof buf - 1; + buf[len] = '\0'; + printf(" colonna %d: %s\n", c, buf); + } + } + return 0; +} diff --git a/spike/stub_pgp.c b/spike/stub_pgp.c new file mode 100644 index 0000000..e72e7e1 --- /dev/null +++ b/spike/stub_pgp.c @@ -0,0 +1,83 @@ +/* Sostituto dello shim OpenPGP per il test di link senza Qt. + * + * gpg_shim.cpp e' C++ e usa gpgme: qui le stesse funzioni rispondono + * "non disponibile", cosi' il motore si linka e gira per tutto il resto. + * Le firme sono quelle di gpg_shim.h. + */ +#include + +static void dire(char *status, int cap, const char *msg) +{ + if (status && cap > 0) { + strncpy(status, msg, (size_t)cap - 1); + status[cap - 1] = '\0'; + } +} + +int gd_pgp_verify_detached(const char *data, int len, const char *sig, + int sig_len, char *status, int cap) +{ + (void)data; (void)len; (void)sig; (void)sig_len; + dire(status, cap, "OpenPGP non incluso in questa build"); + return -1; +} + +int gd_pgp_verify_clear(const char *data, int len, char *status, int cap) +{ + (void)data; (void)len; + dire(status, cap, "OpenPGP non incluso in questa build"); + return -1; +} + +int gd_pgp_decrypt(const char *data, int len, char **plain, int *plain_len, + char *status, int cap) +{ + (void)data; (void)len; + if (plain) *plain = NULL; + if (plain_len) *plain_len = 0; + dire(status, cap, "OpenPGP non incluso in questa build"); + return -1; +} + +int gd_pgp_protect(const char *data, int len, int mode, const char *recipients, + const char *signer, char **output, int *output_len, + char *micalg, int micalg_cap, char *status, int cap) +{ + (void)data; (void)len; (void)mode; (void)recipients; (void)signer; + (void)micalg; (void)micalg_cap; + if (output) *output = NULL; + if (output_len) *output_len = 0; + dire(status, cap, "OpenPGP non incluso in questa build"); + return -1; +} + +void gd_pgp_free(char *plain) { (void)plain; } + +/* S/MIME (gpgsm), stesso trattamento: non incluso in questa build. */ +int gd_smime_verify_detached(const char *data, int len, const char *sig, + int sig_len, char *status, int cap) +{ + (void)data; (void)len; (void)sig; (void)sig_len; + dire(status, cap, "S/MIME non incluso in questa build"); + return -1; +} + +int gd_smime_decrypt(const char *data, int len, char **plain, int *plain_len, + char *status, int cap) +{ + (void)data; (void)len; + if (plain) *plain = NULL; + if (plain_len) *plain_len = 0; + dire(status, cap, "S/MIME non incluso in questa build"); + return -1; +} + +int gd_smime_open_signed(const char *data, int len, char **plain, + int *plain_len, char *status, int cap) +{ + (void)data; (void)len; + if (plain) *plain = NULL; + if (plain_len) *plain_len = 0; + dire(status, cap, "S/MIME non incluso in questa build"); + return -1; +} diff --git a/src/main.cpp b/src/main.cpp index 2663a6f..d4ede4b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,9 +14,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) app->setOrganizationName(QStringLiteral("harbour")); app->setApplicationName(QStringLiteral("grumpydove")); - app->setApplicationVersion(QStringLiteral("0.1.0")); + app->setApplicationVersion(QStringLiteral("0.1.1")); - qDebug() << "harbour-grumpydove v0.1.0 build" << __DATE__ << __TIME__; + qDebug() << "harbour-grumpydove v0.1.1 build" << __DATE__ << __TIME__; QTranslator translator; if (translator.load(QLocale(), QStringLiteral("harbour-grumpydove"),