From 10d5a1ea2ded21623d1abcb6a955f5098faad334 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi

Date: Sun, 6 Dec 2020 14:23:15 +0200

Subject: [PATCH 1/1] Report errors in MIME hooks; added to about:debug


src/app.c | 10 +++++++++-

src/mimehooks.c | 41 +++++++++++++++++++++++++++++++++++++++++

src/mimehooks.h | 2 ++

3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/src/app.c b/src/app.c

index ba7d41d2..da6a343f 100644

--- a/src/app.c

+++ b/src/app.c

@@ -502,6 +502,8 @@ const iString *debugInfo_App(void) {

 iConstForEach(StringList, j, d->launchCommands) {

     appendFormat_String(msg, "%s\n", cstr_String(j.value));

 }

 return msg;

}

@@ -1034,7 +1036,13 @@ iBool willUseProxy_App(const iRangecc scheme) {

iBool handleCommand_App(const char *cmd) {

 iApp *d = &app_;

     d->prefs.dialogTab = arg_Command(cmd);

     return iTrue;

 }

diff --git a/src/mimehooks.c b/src/mimehooks.c

index 8bb838ef..fd535643 100644

--- a/src/mimehooks.c

+++ b/src/mimehooks.c

@@ -1,6 +1,8 @@

#include "mimehooks.h"

+#include "app.h"

#include <the_Foundation/file.h>

+#include <the_Foundation/fileinfo.h>

#include <the_Foundation/path.h>

#include <the_Foundation/process.h>

#include <the_Foundation/stringlist.h>

@@ -23,6 +25,7 @@ void deinit_FilterHook(iFilterHook *d) {

void setMimePattern_FilterHook(iFilterHook *d, const iString *pattern) {

 iReleasePtr(&d->mimeRegex);

 d->mimeRegex = new_RegExp(cstr_String(pattern), caseInsensitive_RegExpOption);

}

@@ -105,6 +108,7 @@ iBlock *tryFilter_MimeHooks(const iMimeHooks *d, const iString *mime, const iBlo

static const char *mimeHooksFilename_MimeHooks_ = "mimehooks.txt";

void load_MimeHooks(iMimeHooks *d, const char *saveDir) {

 iFile *f = newCStr_File(concatPath_CStr(saveDir, mimeHooksFilename_MimeHooks_));

 if (open_File(f, read_FileMode | text_FileMode)) {

     iBlock * src     = readAll_File(f);

@@ -124,6 +128,15 @@ void load_MimeHooks(iMimeHooks *d, const char *saveDir) {

             setRange_String(&hook->label, lines[0]);

             setMimePattern_FilterHook(hook, collect_String(newRange_String(lines[1])));

             setCommand_FilterHook(hook, collect_String(newRange_String(lines[2])));

             pushBack_PtrArray(&d->filters, hook);

             pos = 0;

         }

@@ -131,9 +144,37 @@ void load_MimeHooks(iMimeHooks *d, const char *saveDir) {

     delete_Block(src);

 }

 iRelease(f);

}

void save_MimeHooks(const iMimeHooks *d) {

 iUnused(d);

}

+const iString *debugInfo_MimeHooks(const iMimeHooks *d) {

+}

diff --git a/src/mimehooks.h b/src/mimehooks.h

index c78a3c86..7a8cd2c9 100644

--- a/src/mimehooks.h

+++ b/src/mimehooks.h

@@ -29,3 +29,5 @@ iBlock * tryFilter_MimeHooks (const iMimeHooks *, const iString *mime,

void load_MimeHooks (iMimeHooks *, const char *saveDir);

void save_MimeHooks (const iMimeHooks *);

+const iString *debugInfo_MimeHooks (const iMimeHooks *);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/patch/10d5a1ea2ded21623d1abcb6a955f5098faad334.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
28.125855 milliseconds
Gemini-to-HTML Time
2.394961 milliseconds

This content has been proxied by September (ba2dc).