auto-response-header: add FEATURE_ARH
authorSébastien Marie <semarie@users.noreply.github.com>
Mon, 3 Nov 2014 05:29:56 +0000 (06:29 +0100)
committerSébastien Marie <semarie@users.noreply.github.com>
Mon, 3 Nov 2014 05:29:56 +0000 (06:29 +0100)
add a compilation flag for disable auto-response-header

src/arh.c
src/arh.h
src/config.def.h
src/main.c
src/main.h
src/setting.c

index bcbc2ba..886d6e3 100644 (file)
--- 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
index 24463d4..141b3d2 100644 (file)
--- 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
index 4d34ae7..e99b68e 100644 (file)
@@ -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 */
index e2c5ced..1eb2e08 100644 (file)
@@ -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);
 }
 
index fb52fef..0144a54 100644 (file)
@@ -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 */
index 7190ba2..bacce09 100644 (file)
@@ -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)
 {