Adding send-banner?type=auto option
authorjongfoster <jongfoster@users.sourceforge.net>
Thu, 21 Feb 2002 00:10:37 +0000 (00:10 +0000)
committerjongfoster <jongfoster@users.sourceforge.net>
Thu, 21 Feb 2002 00:10:37 +0000 (00:10 +0000)
cgisimple.c

index b100094..53634c8 100644 (file)
@@ -1,4 +1,4 @@
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.11 2002/01/23 00:01:04 jongfoster Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.12 2002/01/23 01:03:32 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
@@ -36,6 +36,9 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.11 2002/01/23 00:01:04 jongfo
  *
  * Revisions   :
  *    $Log: cgisimple.c,v $
  *
  * Revisions   :
  *    $Log: cgisimple.c,v $
+ *    Revision 1.12  2002/01/23 01:03:32  jongfoster
+ *    Fixing gcc [CygWin] compiler warnings
+ *
  *    Revision 1.11  2002/01/23 00:01:04  jongfoster
  *    Adding cgi_transparent_gif() for http://i.j.b/t
  *    Adding missing html_encode() to many CGI functions.
  *    Revision 1.11  2002/01/23 00:01:04  jongfoster
  *    Adding cgi_transparent_gif() for http://i.j.b/t
  *    Adding missing html_encode() to many CGI functions.
@@ -308,8 +311,10 @@ jb_err cgi_show_request(struct client_state *csp,
  *           3 :  parameters = map of cgi parameters
  *
  * CGI Parameters :
  *           3 :  parameters = map of cgi parameters
  *
  * CGI Parameters :
- *           type : Selects the type of banner between "trans" and "jb".
- *                  Defaults to "jb" if absent or != "trans".
+ *           type : Selects the type of banner between "trans", "logo",
+ *                  and "auto". Defaults to "logo" if absent or invalid.\r
+ *                  "auto" means to select as if we were image-blocking.\r
+ *                  (Only the first character really counts).
  *
  * Returns     :  JB_ERR_OK on success
  *                JB_ERR_MEMORY on out-of-memory error.  
  *
  * Returns     :  JB_ERR_OK on success
  *                JB_ERR_MEMORY on out-of-memory error.  
@@ -318,8 +323,29 @@ jb_err cgi_show_request(struct client_state *csp,
 jb_err cgi_send_banner(struct client_state *csp,
                        struct http_response *rsp,
                        const struct map *parameters)
 jb_err cgi_send_banner(struct client_state *csp,
                        struct http_response *rsp,
                        const struct map *parameters)
-{
-   if (strcmp(lookup(parameters, "type"), "trans"))
+{\r
+   char imagetype = lookup(parameters, "type")[0];
+\r
+   if (imagetype == 'a') /* auto */\r
+   {\r
+      /* Default to logo */\r
+      imagetype = 'l';\r
+#ifdef FEATURE_IMAGE_BLOCKING\r
+      if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)\r
+      {\r
+         /* determine HOW images should be blocked */\r
+         const char * p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];\r
+\r
+         /* and handle accordingly: */\r
+         if ((p != NULL) && (0 == strcmpic(p, "blank")))\r
+         {\r
+            imagetype = 't';\r
+         }\r
+      }\r
+#endif /* def FEATURE_IMAGE_BLOCKING */\r
+   }\r
+      \r
+   if ((imagetype != 't') && (imagetype != 'b')) /* transparant/blank */
    {
       rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
       rsp->content_length = image_junkbuster_gif_length;
    {
       rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
       rsp->content_length = image_junkbuster_gif_length;