From: Sébastien Marie Date: Mon, 3 Nov 2014 05:29:56 +0000 (+0100) Subject: auto-response-header: add FEATURE_ARH X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=9e1c7c77352f4e8a136e808f52f6551befcee949;p=vimb.git auto-response-header: add FEATURE_ARH add a compilation flag for disable auto-response-header --- diff --git a/src/arh.c b/src/arh.c index bcbc2ba..886d6e3 100644 --- a/src/arh.c +++ b/src/arh.c @@ -18,6 +18,7 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */ #include "config.h" +#ifdef FEATURE_ARH #include "ascii.h" #include "arh.h" #include "util.h" @@ -228,3 +229,4 @@ static char *read_value(char **line) return value; } +#endif diff --git a/src/arh.h b/src/arh.h index 24463d4..141b3d2 100644 --- a/src/arh.h +++ b/src/arh.h @@ -18,6 +18,7 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */ #include "config.h" +#ifdef FEATURE_ARH #ifndef _ARH_H #define _ARH_H @@ -29,3 +30,4 @@ void arh_free(GSList *); void arh_run(GSList *, const char *, SoupMessage *); #endif /* end of include guard: _ARH_H */ +#endif diff --git a/src/config.def.h b/src/config.def.h index 4d34ae7..e99b68e 100644 --- a/src/config.def.h +++ b/src/config.def.h @@ -50,6 +50,8 @@ #define FEATURE_SOUP_CACHE /* enable the :autocmd feature */ #define FEATURE_AUTOCMD +/* enable the :auto-response-header feature */ +#define FEATURE_ARH /* time in seconds after that message will be removed from inputbox if the * message where only temporary */ diff --git a/src/main.c b/src/main.c index e2c5ced..1eb2e08 100644 --- a/src/main.c +++ b/src/main.c @@ -1514,7 +1514,10 @@ static void session_request_queued_cb(SoupSession *session, SoupMessage *msg, gp } #endif +#ifdef FEATURE_ARH arh_run(vb.config.autoresponseheader, uri, msg); +#endif + g_free(uri); } diff --git a/src/main.h b/src/main.h index fb52fef..0144a54 100644 --- a/src/main.h +++ b/src/main.h @@ -317,7 +317,9 @@ typedef struct { guint timeoutlen; /* timeout for ambiguous mappings */ gboolean strict_focus; GHashTable *headers; /* holds user defined header appended to requests */ +#ifdef FEATURE_ARH GSList *autoresponseheader; /* holds user defined list of auto-response-header */ +#endif char *nextpattern; /* regex patter nfor prev link matching */ char *prevpattern; /* regex patter nfor next link matching */ char *file; /* path to the custome config file */ diff --git a/src/setting.c b/src/setting.c index 7190ba2..bacce09 100644 --- a/src/setting.c +++ b/src/setting.c @@ -79,7 +79,9 @@ static int ca_bundle(const char *name, int type, void *value, void *data); static int proxy(const char *name, int type, void *value, void *data); static int user_style(const char *name, int type, void *value, void *data); static int headers(const char *name, int type, void *value, void *data); +#ifdef FEATURE_ARH static int autoresponseheader(const char *name, int type, void *value, void *data); +#endif static int prevnext(const char *name, int type, void *value, void *data); static int fullscreen(const char *name, int type, void *value, void *data); #ifdef FEATURE_HSTS @@ -205,7 +207,9 @@ void setting_init() setting_add("history-max-items", TYPE_INTEGER, &i, internal, 0, &vb.config.history_max); setting_add("editor-command", TYPE_CHAR, &"x-terminal-emulator -e -vi '%s'", NULL, 0, NULL); setting_add("header", TYPE_CHAR, &"", headers, FLAG_LIST|FLAG_NODUP, NULL); +#ifdef FEATURE_ARH setting_add("auto-response-header", TYPE_CHAR, &"", autoresponseheader, FLAG_LIST|FLAG_NODUP, NULL); +#endif setting_add("nextpattern", TYPE_CHAR, &"/\\bnext\\b/i,/^(>\\|>>\\|»)$/,/^(>\\|>>\\|»)/,/(>\\|>>\\|»)$/,/\\bmore\\b/i", prevnext, FLAG_LIST|FLAG_NODUP, NULL); setting_add("previouspattern", TYPE_CHAR, &"/\\bprev\\|previous\\b/i,/^(<\\|<<\\|«)$/,/^(<\\|<<\\|«)/,/(<\\|<<\\|«)$/", prevnext, FLAG_LIST|FLAG_NODUP, NULL); setting_add("fullscreen", TYPE_BOOLEAN, &off, fullscreen, 0, NULL); @@ -815,6 +819,7 @@ static int headers(const char *name, int type, void *value, void *data) return SETTING_OK; } +#ifdef FEATURE_ARH static int autoresponseheader(const char *name, int type, void *value, void *data) { const char *error = NULL; @@ -835,6 +840,7 @@ static int autoresponseheader(const char *name, int type, void *value, void *dat return SETTING_ERROR | SETTING_USER_NOTIFIED; } } +#endif static int prevnext(const char *name, int type, void *value, void *data) {