Fix lots of warnings all over the place, make inbound buffers of FMOUT const.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 24 Jul 2011 13:43:32 +0000 (13:43 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 21:40:58 +0000 (21:40 +0000)
27 files changed:
webcit/auth.c
webcit/bbsview_renderer.c
webcit/blogview_renderer.c
webcit/calendar.c
webcit/calendar_tools.c
webcit/calendar_view.c
webcit/crypto.c
webcit/downloads.c
webcit/event.c
webcit/gettext.c
webcit/groupdav_get.c
webcit/groupdav_main.c
webcit/marchlist.c
webcit/messages.c
webcit/msg_renderers.c
webcit/netconf.c
webcit/notes.c
webcit/roomlist.c
webcit/roomops.c
webcit/serv_func.c
webcit/static.c
webcit/subst.c
webcit/tasks.c
webcit/vcard_edit.c
webcit/webcit.c
webcit/webcit.h
webcit/webserver.c

index a5e357edf7ca646818e6dc991f029de9a08e2dcc..656dfdc6f40a45a92e5ce953dcb8fe083487dce2 100644 (file)
@@ -658,7 +658,7 @@ void validate(void)
                                int haveChar = 0;
                                int haveNum = 0;
                                int haveOther = 0;
-                               int count = 0;
+                               int haveLong = 0;
                                pch = buf;
                                while (!IsEmptyStr(pch))
                                {
@@ -670,10 +670,13 @@ void validate(void)
                                                haveOther = 1;
                                        pch ++;
                                }
-                               count = pch - buf;
-                               if (count > 7)
-                                       count = 0;
-                               switch (count){
+                               if (pch - buf > 7)
+                                       haveLong = 1;
+                               switch (haveLong + 
+                                       haveChar + 
+                                       haveNum + 
+                                       haveOther)
+                               {
                                case 0:
                                        pch = _("very weak");
                                        break;
index 52edd1d343d997cf5ad3f20161f2c2bd526b994c..fe0eb4fae797c550041ac5c1a94e5ff0f522b620 100644 (file)
@@ -359,7 +359,7 @@ int bbsview_RenderView_or_Tail(SharedMessageStatus *Stat,
                                                wc_printf(_("Last"));
                                        }
                                        else {
-                                               wc_printf("%d", i + 1); // change to one-based for display
+                                               wc_printf("%d", i + 1); /* change to one-based for display */
                                        }
                                        if (i == BBS->requested_page) {
                                                wc_printf("]");
index 2254b9c0526c01f49c7b6cbb04e25200c371ec41..0a825327b8f6b558786ad82c104c1f0d9f0d4fc9 100644 (file)
@@ -279,11 +279,11 @@ int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper)
         * which they point are still owned by the hash list.
         */
        if (num_blogposts > 0) {
+               int start_here = 0;
                /* Sort newest-to-oldest */
                qsort(blogposts, num_blogposts, sizeof(void *), blogview_sortfunc);
 
                /* allow the user to select a starting point in the list */
-               int start_here = 0;
                for (i=0; i<num_blogposts; ++i) {
                        if (blogposts[i]->top_level_id == firstp) {
                                start_here = i;
index 1a6f7fa9b8a039bd6914bff131344b402650607a..84493f90f8fbfc22189e1b9373e1945e6c0de1ba 100644 (file)
@@ -673,7 +673,6 @@ void load_ical_object(long msgnum, int unread,
        char mime_filename[256];
        char mime_content_type[256];
        char mime_disposition[256];
-       int mime_length;
        char relevant_partnum[256];
        char *relevant_source = NULL;
        int phase = 0;                          /* 0 = citadel headers, 1 = mime headers, 2 = body */
@@ -703,7 +702,7 @@ void load_ical_object(long msgnum, int unread,
                                extract_token(mime_partnum, &bptr[5], 2, '|', sizeof mime_partnum);
                                extract_token(mime_disposition, &bptr[5], 3, '|', sizeof mime_disposition);
                                extract_token(mime_content_type, &bptr[5], 4, '|', sizeof mime_content_type);
-                               mime_length = extract_int(&bptr[5], 5);
+                               /* do we care? mime_length = */extract_int(&bptr[5], 5);
 
                                if (  (!strcasecmp(mime_content_type, "text/calendar"))
                                      || (!strcasecmp(mime_content_type, "application/ics"))
index b2c12afc70e28363714ea579d4c63001ec44c3b7..b6dd7390cb83ae9f6608ffd407d0e8867391919c 100644 (file)
@@ -53,7 +53,6 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int d
        int i;
        time_t now;
        struct tm tm_now;
-       int this_year;
        time_t tt;
        struct tm tm;
        int all_day_event = 0;
@@ -64,7 +63,6 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int d
 
        now = time(NULL);
        localtime_r(&now, &tm_now);
-       this_year = tm_now.tm_year + 1900;
 
        if (t == NULL) return;
        if (t->is_date) all_day_event = 1;
index 769cd23340de585cae83e909316e057a94f34081..6cde0748ed3a6fbb389cc57a3297a863fac985c5 100644 (file)
@@ -424,7 +424,6 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
        icalproperty *e;
        struct icaltimetype t;
        disp_cal *Cal;
-       int month, day, year;
        int all_day_event = 0;
        char *timeformat;
        int time_format;
@@ -435,9 +434,6 @@ void calendar_month_view_brief_events(time_t thetime, const char *daycolor) {
        else timeformat="%I:%M %p";
 
        localtime_r(&thetime, &today_tm);
-       month = today_tm.tm_mon + 1;
-       day = today_tm.tm_mday;
-       year = today_tm.tm_year + 1900;
 
        Pos = GetNewHashPos(WCC->disp_cal_items, 0);
        while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) {
@@ -1186,9 +1182,11 @@ void calendar_day_view(int year, int month, int day) {
                wc_printf("<dt class=\"extrahour\">"
                        "<a href=\"display_edit_event?msgnum=0"
                        "?calview=day?year=%d?month=%d?day=%d?hour=%d?minute=0\">",
+/* TODO: what have these been used for?
                        (hour * extratimeline ),
                        extratimeline,
                        extrahourlabel,
+*/
                        year, month, day, hour
                        );
 
@@ -1211,9 +1209,11 @@ void calendar_day_view(int year, int month, int day) {
                 wc_printf("<dt class=\"hour\">"
                         "<a href=\"display_edit_event?msgnum=0?calview=day"
                         "?year=%d?month=%d?day=%d?hour=%d?minute=0\">",
+/*TODO: what have these been used for?
                         gap + ((hour - daystart) * timeline ),
                        timeline,
                        hourlabel,
+*/
                         year, month, day, hour
                        );
 
@@ -1236,9 +1236,11 @@ void calendar_day_view(int year, int month, int day) {
                 wc_printf("<dt class=\"extrahour\">"
                         "<a href=\"display_edit_event?msgnum=0?calview=day"
                         "?year=%d?month=%d?day=%d?hour=%d?minute=0\">",
+/*TODO: what have these been used for?
                         gap + ((hour - dayend - 1) * extratimeline ),
                        extratimeline,
                        extrahourlabel,
+*/
                         year, month, day, hour
                 );
 
index 2e8b3aac1c5c5200ea49df0d481bc7e2c47f9374..61c2366f9ec9ea509355fd02ddb0e559393bd013 100644 (file)
@@ -58,7 +58,7 @@ void shutdown_ssl(void)
  */
 void init_ssl(void)
 {
-       SSL_METHOD *ssl_method;
+       const SSL_METHOD *ssl_method;
        RSA *rsa=NULL;
        X509_REQ *req = NULL;
        X509 *cer = NULL;
@@ -391,7 +391,7 @@ void init_ssl(void)
  * starts SSL/TLS encryption for the current session.
  */
 int starttls(int sock) {
-       int retval, bits, alg_bits, r;
+       int retval, bits, alg_bits;/*r; */
        SSL *newssl;
 
        pthread_setspecific(ThreadSSL, NULL);
@@ -448,7 +448,7 @@ int starttls(int sock) {
        else {
                syslog(15, "SSL_accept success\n");
        }
-       r = BIO_set_close(newssl->rbio, BIO_NOCLOSE);
+       /*r = */BIO_set_close(newssl->rbio, BIO_NOCLOSE);
        bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl), &alg_bits);
        syslog(15, "SSL/TLS using %s on %s (%d of %d bits)\n",
                SSL_CIPHER_get_name(SSL_get_current_cipher(newssl)),
@@ -470,13 +470,13 @@ int starttls(int sock) {
  */
 void endtls(void)
 {
-       SSL_CTX *ctx = NULL;
+       /*SSL_CTX *ctx;*/
 
        if (THREADSSL == NULL) return;
 
        syslog(15, "Ending SSL/TLS\n");
        SSL_shutdown(THREADSSL);
-       ctx = SSL_get_SSL_CTX(THREADSSL);
+       /*ctx = */SSL_get_SSL_CTX(THREADSSL);
 
        /* I don't think this is needed, and it crashes the server anyway
         *
index fc06c379bbf047a25bfaa93e0262f34cc86ccefd..a130c6392c86cc27a011039e5c2d2fe9b097242e 100644 (file)
@@ -189,7 +189,7 @@ HashList* LoadFileList(StrBuf *Target, WCTemplputParams *TP)
        int sequence = 0;
        char buf[1024];
        CompareFunc SortIt;
-       int HavePic;
+       int HavePic = 0;
        WCTemplputParams SubTP;
 
        memset(&SubTP, 0, sizeof(WCTemplputParams));
@@ -227,6 +227,8 @@ HashList* LoadFileList(StrBuf *Target, WCTemplputParams *TP)
                }
                Put(Files, SKEY(Entry->Filename), Entry, FreeFiles);
        }
+       if (HavePic)
+               putbstr("__HAVE_PIC", NewStrBufPlain(HKEY("1")));
        SubTP.Filter.ContextType = CTX_FILELIST;
        SortIt = RetrieveSort(&SubTP, NULL, 0, HKEY("fileunsorted"), 0);
        if (SortIt != NULL)
index 80c4f51eb1ccf880b37e9bae4eb0d6f7435ccf95..b0f41ca2d4cf03878ad7805bc55f12a6f068e2e1 100644 (file)
@@ -44,7 +44,10 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        char buf[SIZ];
        int organizer_is_me = 0;
        int i, j = 0;
+       /************************************************************
+        * Uncomment this to see the UID in calendar events for debugging
        int sequence = 0;
+       */
        char weekday_labels[7][32];
        char month_labels[12][32];
        long weekstart = 0;
@@ -157,10 +160,12 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        /* Learn the sequence */
        p = icalcomponent_get_first_property(vevent, ICAL_SEQUENCE_PROPERTY);
+       /************************************************************
+        * Uncomment this to see the UID in calendar events for debugging
        if (p != NULL) {
                sequence = icalproperty_get_sequence(p);
        }
-
+       */
        /* Begin output */
        output_headers(1, 1, 2, 0, 0, 0);
        wc_printf("<div id=\"banner\">\n");
index 30a73258838847a8b3f75fb53b79dfcc52b5815b..62263c8696493b83435a76c2519e498fd16e6c62 100644 (file)
@@ -287,8 +287,6 @@ void initialize_locales(void) {
        int i;
        char buf[32];
        char *language = NULL;
-       char *locale;
-
 
        nLocales = 0; 
        while (!IsEmptyStr(AvailLang[nLocales]))
@@ -368,7 +366,7 @@ void initialize_locales(void) {
        }
 
 #ifdef ENABLE_NLS
-       locale = setlocale(LC_ALL, "");
+       /*locale = */setlocale(LC_ALL, "");
 
        syslog(9, "Message catalog directory: %s\n", bindtextdomain("webcit", LOCALEDIR"/locale"));
        syslog(9, "Text domain: %s\n", textdomain("webcit"));
index 267f4bd6f001d929add1e4546c2d0320f1268a18..b99e7caaf80c008ec1cfefcb7052169ccbabaefd 100644 (file)
@@ -109,7 +109,6 @@ void groupdav_get(void)
        long dav_msgnum = (-1);
        char buf[1024];
        int in_body = 0;
-       int found_content_type = 0;
        char *ptr;
        char *endptr;
        char *msgtext = NULL;
@@ -185,7 +184,6 @@ void groupdav_get(void)
        /* We got it; a message is now arriving from the server.  Read it in. */
 
        in_body = 0;
-       found_content_type = 0;
        strcpy(charset, "UTF-8");
        strcpy(content_type, "text/plain");
        strcpy(date, "");
index 90de73b9937ab7c61c24cfac9b46250887bb8f79..e673a38ff681f03f82783e74d9cccc7dcb4e3baa 100644 (file)
@@ -328,7 +328,9 @@ void
 InitModule_GROUPDAV
 (void)
 {
-//     WebcitAddUrlHandler(HKEY("groupdav"), "", 0, groupdav_main, XHTTP_COMMANDS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
+/*
+       WebcitAddUrlHandler(HKEY("groupdav"), "", 0, groupdav_main, XHTTP_COMMANDS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
+ */
        RegisterDAVNamespace(HKEY("groupdav"), HKEY("GroupDAV"), 
                             groupdav_main, GroupdavDispatchREST, 
                             XHTTP_COMMANDS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
index 175f780e787fe41a29fa445075db7dcbedd1c7a2..990c24fced27a9b72311bf77c9911e6f75a8beda 100644 (file)
@@ -57,8 +57,6 @@ void remove_march(const StrBuf *aaa)
 char *pop_march(int desired_floor)
 {
        static char TheRoom[128];
-       int TheFloor = 0;
-       int TheOrder = 32767;
        int TheWeight = 0;
        int weight;
        struct march *mptr = NULL;
@@ -80,8 +78,10 @@ char *pop_march(int desired_floor)
                if (weight > TheWeight) {
                        TheWeight = weight;
                        strcpy(TheRoom, mptr->march_name);
+/* TODOO: and now????
                        TheFloor = mptr->march_floor;
                        TheOrder = mptr->march_order;
+*/
                }
        }
        return (TheRoom);
index 63ab14c989aab0c4ef01f221dd4cb56753de38f1..aede383fcb2ab5ef78d08f50bb1b0488d62e6104 100644 (file)
@@ -21,6 +21,7 @@
 #include "webcit.h"
 #include "webserver.h"
 #include "groupdav.h"
+#include "calendar.h"
 
 HashList *MsgHeaderHandler = NULL;
 HashList *MsgEvaluators = NULL;
@@ -246,7 +247,7 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co
 }
 
 
-void
+long
 HttpStatus(long CitadelStatus)
 {
        long httpstatus = 502;
@@ -311,7 +312,7 @@ HttpStatus(long CitadelStatus)
                break;
        }
 
-
+       return httpstatus;
 }
 
 /*
@@ -733,7 +734,7 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
                GetHash(ReadLoopHandler, IKEY(WCC->CurRoom.view), &vViewMsg);
        }
        if (vViewMsg == NULL) {
-               return;                 // TODO: print message
+               return;                 /* TODO: print message */
        }
 
        ViewMsg = (RoomRenderer*) vViewMsg;
@@ -1282,7 +1283,6 @@ void remove_attachment(void) {
 void display_enter(void)
 {
        char buf[SIZ];
-       long now;
        const StrBuf *display_name = NULL;
        int recipient_required = 0;
        int subject_required = 0;
@@ -1290,8 +1290,7 @@ void display_enter(void)
        int is_anonymous = 0;
        wcsession *WCC = WC;
        int i = 0;
-
-       now = time(NULL);
+       long replying_to;
 
        if (havebstr("force_room")) {
                gotoroom(sbstr("force_room"));
@@ -1353,7 +1352,7 @@ void display_enter(void)
         * If the "replying_to" variable is set, it refers to a message
         * number from which we must extract some header fields...
         */
-       long replying_to = lbstr("replying_to");
+       replying_to = lbstr("replying_to");
        if (replying_to > 0) {
                char wefw[1024] = "";
                char msgn[256] = "";
@@ -1383,13 +1382,15 @@ void display_enter(void)
                        }
 
                        else if (!strncasecmp(buf, "wefw=", 5)) {
+                               int rrtok;
+                               int rrlen;
                                safestrncpy(wefw, &buf[5], sizeof wefw);
 
                                /* Trim down excessively long lists of thread references.  We eliminate the
                                 * second one in the list so that the thread root remains intact.
                                 */
-                               int rrtok = num_tokens(wefw, '|');
-                               int rrlen = strlen(wefw);
+                               rrtok = num_tokens(wefw, '|');
+                               rrlen = strlen(wefw);
                                if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) {
                                        remove_token(wefw, 1, '|');
                                }
@@ -1521,7 +1522,7 @@ void display_enter(void)
                        if (havebstr("recp") && 
                            havebstr("cc"  ) && 
                            havebstr("bcc" )) {
-                               recipient_bad = 1;
+                               recipient_bad = 1; /* TODO: and now????? */
                        }
                }
                else if (buf[0] != '2') {       /* Any other error means that we cannot continue */
@@ -1593,13 +1594,9 @@ void move_msg(void)
  */
 void confirm_move_msg(void)
 {
-       long msgid;
        char buf[SIZ];
        char targ[SIZ];
 
-       msgid = lbstr("msgid");
-
-
        output_headers(1, 1, 2, 0, 0, 0);
        wc_printf("<div id=\"banner\">\n");
        wc_printf("<h1>");
index ed58d93d519be015747afa000ddb3b2d4869334a..a01e9e9b1a92b9adaed060fc0637891d8c1c581e 100644 (file)
@@ -1418,9 +1418,9 @@ InitModule_MSGRENDERERS
        RegisterReadLoopHandlerset(
                VIEW_MAILBOX,
                mailview_GetParamsGetServerCall,
-               NULL, /// TODO: is this right?
+               NULL, /* TODO: is this right? */
                ParseMessageListHeaders_Detail,
-               NULL, //// ""
+               NULL,
                mailview_RenderView_or_Tail,
                mailview_Cleanup);
 
index 107328a7c988cb26fe412ee8a10b5581144e1844..a62c96526e5f28800e2f4c6765f8307d0c22d71b 100644 (file)
@@ -78,8 +78,8 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
        HashList *Hash;
        char nnn[64];
        char buf[SIZ];
-       long len;
        int nUsed;
+       long len;
        NodeConf *Node;
 
        serv_puts("CONF getsys|application/x-citadel-ignet-config");
@@ -89,7 +89,7 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP)
 
                Buf = NewStrBuf();
                while ((len = StrBuf_ServGetln(Buf),
-                       strcmp(ChrPtr(Buf), "000"))) {
+                       (len != 3) || !strcmp(ChrPtr(Buf), "000"))) {
                        Node = NewNode(Buf);
                        if (Node == NULL)
                                continue;
index 63fce7f0476db7c840f6509e78343ba9ef776c6f..eb358369d27e53aaefb86c6412f81e4e0e47493d 100644 (file)
@@ -30,7 +30,6 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread)
        char mime_filename[256];
        char mime_content_type[256];
        char mime_disposition[256];
-       int mime_length;
        char relevant_partnum[256];
        int phase = 0;                          /* 0 = citadel headers, 1 = mime headers, 2 = body */
        char msg4_content_type[256] = "";
@@ -64,7 +63,6 @@ struct vnote *vnote_new_from_msg(long msgnum,int unread)
                                extract_token(mime_partnum, &bptr[5], 2, '|', sizeof mime_partnum);
                                extract_token(mime_disposition, &bptr[5], 3, '|', sizeof mime_disposition);
                                extract_token(mime_content_type, &bptr[5], 4, '|', sizeof mime_content_type);
-                               mime_length = extract_int(&bptr[5], 5);
 
                                if (!strcasecmp(mime_content_type, "text/vnote")) {
                                        strcpy(relevant_partnum, mime_partnum);
@@ -292,7 +290,7 @@ void ajax_update_note(void) {
  *
  * msgnum = Message number on the local server of the note to be displayed
  */
-////TODO: falscher hook
+/*TODO: wrong hook */
 int notes_LoadMsgFromServer(SharedMessageStatus *Stat, 
                            void **ViewSpecific, 
                            message_summary* Msg, 
@@ -402,7 +400,7 @@ void tmpl_vcard_put_bgcolor(StrBuf *Target, WCTemplputParams *TP)
 void tmpl_vcard_put_message(StrBuf *Target, WCTemplputParams *TP)
 {
        struct vnote *v = (struct vnote *) CTX;
-       StrEscAppend(Target, NULL, v->body, 0, 0); ///TODO?
+       StrEscAppend(Target, NULL, v->body, 0, 0); /*TODO?*/
 }
 
 void tmpl_vcard_put_uid(StrBuf *Target, WCTemplputParams *TP)
index c86a7f78dcf104cfec004830d9a80c8977432943..d52351a23409d6f35cc598784ef0a0596ae3eb9a 100644 (file)
@@ -607,8 +607,10 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP)
        urlp = GetCount(WCC->Directory);
        delta = Folder->nRoomNameParts - urlp + 1;
 
-       syslog(0, "\n->%s: %ld - %ld ", ChrPtr(Folder->name), urlp, 
-               Folder->nRoomNameParts);
+       syslog(0, "\n->%s: %d - %ld ", 
+              ChrPtr(Folder->name), 
+              urlp, 
+              Folder->nRoomNameParts);
        /* list only the floors which are in relation to the dav_depth header */
        if (WCC->Hdr->HR.dav_depth != delta) {
                syslog(0, "1\n");
index 5029030bb9d231c5fa8398645f5824a0f933d504..ff18f8f691e8ff8996f8a01587fad02a24e991b3 100644 (file)
@@ -260,7 +260,7 @@ void ParseGoto(folder *room, StrBuf *Line)
        memset(room, 0, sizeof(folder));
        room->name = pBuf;
 
-       StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
+       StrBufExtract_NextToken(room->name, Line, &Pos, '|');
 
        room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|'); 
        if (room->nNewMessages > 0)
@@ -270,14 +270,14 @@ void ParseGoto(folder *room, StrBuf *Line)
 
        room->ShowInfo =  StrBufExtractNext_long(Line, &Pos, '|');
        
-       room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
+       room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|');
 
        DBG_QR(room->QRFlags);
 
        room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
        room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
 
-       room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
+       room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|');
 
        flag = StrBufExtractNext_long(Line, &Pos, '|');
        if (WCC->is_aide || flag) {
@@ -286,17 +286,17 @@ void ParseGoto(folder *room, StrBuf *Line)
 
        room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
 
-       room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
+       room->floorid = StrBufExtractNext_int(Line, &Pos, '|');
 
-       room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
+       room->view = StrBufExtractNext_long(Line, &Pos, '|');
 
-       room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
+       room->defview = StrBufExtractNext_long(Line, &Pos, '|');
 
        flag = StrBufExtractNext_long(Line, &Pos, '|');
        if (flag)
-               room->RAFlags |= UA_ISTRASH; // wc_is_trash
+               room->RAFlags |= UA_ISTRASH;
 
-       room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
+       room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|');
        DBG_QR2(room->QRFlags2);
 
        /* find out, whether we are in a sub-room */
index 14a4d655937151e456e1269cad7c6ea03d20fd22..7ee74af2c81c850ee3ff5aa54b6e613b9264953f 100644 (file)
@@ -257,12 +257,12 @@ int GetConnected (void)
  *  Read Citadel variformat text and spit it out as HTML.
  *  align html align string
  */
-inline void fmout(char *align)
+inline void fmout(const char *align)
 {
        _fmout(WC->WBuf, align);
 }
 
-void _fmout(StrBuf *Target, char *align)
+void _fmout(StrBuf *Target, const char *align)
 {
        int intext = 0;
        int bq = 0;
@@ -303,7 +303,7 @@ void _fmout(StrBuf *Target, char *align)
        wc_printf("</div><br>\n");
 }
 
-void FmOut(StrBuf *Target, char *align, StrBuf *Source)
+void FmOut(StrBuf *Target, const char *align, StrBuf *Source)
 {
        const char *ptr, *pte;
        const char *BufPtr = NULL;
index 235322131fa16c93bc117f9f809f85b90d4bc2ef..ece24acf5905d1e76485b0e8d6b499c160bbee52 100644 (file)
 #include "webcit.h"
 #include "webserver.h"
 
+unsigned char OnePixelGif[37] = {
+               0x47,
+               0x49,
+               0x46,
+               0x38,
+               0x37,
+               0x61,
+               0x01,
+               0x00,
+               0x01,
+               0x00,
+               0x80,
+               0x00,
+               0x00,
+               0xff,
+               0xff,
+               0xff,
+               0xff,
+               0xff,
+               0xff,
+               0x2c,
+               0x00,
+               0x00,
+               0x00,
+               0x00,
+               0x01,
+               0x00,
+               0x01,
+               0x00,
+               0x00,
+               0x02,
+               0x02,
+               0x44,
+               0x01,
+               0x00,
+               0x3b 
+};
+
 
 HashList *StaticFilemappings[4] = {NULL, NULL, NULL, NULL};
 /*
-               {
-                       syslog(9, "Suspicious request. Ignoring.");
-                       hprintf("HTTP/1.1 404 Security check failed\r\n");
-                       hprintf("Content-Type: text/plain\r\n\r\n");
-                       wc_printf("You have sent a malformed or invalid request.\r\n");
-                       end_burst();
-               }
+  {
+  syslog(9, "Suspicious request. Ignoring.");
+  hprintf("HTTP/1.1 404 Security check failed\r\n");
+  hprintf("Content-Type: text/plain\r\n\r\n");
+  wc_printf("You have sent a malformed or invalid request.\r\n");
+  end_burst();
+  }
 */
+
+
+void output_error_pic(const char *ErrMsg1, const char *ErrMsg2)
+{
+       hprintf("HTTP/1.1 200 %s\r\n", ErrMsg1);
+       hprintf("Content-Type: image/gif\r\n");
+       hprintf("x-webcit-errormessage: %s\r\n", ErrMsg2);
+       begin_burst();
+       StrBufPlain(WC->WBuf, (const char *)OnePixelGif, sizeof(OnePixelGif));
+       end_burst();
+}
+
 /*
  * dump out static pages from disk
  */
@@ -36,35 +86,46 @@ void output_static(const char *what)
        int fd;
        struct stat statbuf;
        off_t bytes;
-       off_t count = 0;
        const char *content_type;
        int len;
        const char *Err;
 
+       len = strlen (what);
+       content_type = GuessMimeByFilename(what, len);
        fd = open(what, O_RDONLY);
        if (fd <= 0) {
                syslog(9, "output_static('%s') [%s]  -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page));
-               hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
-               hprintf("Content-Type: text/plain\r\n");
-               begin_burst();
-               wc_printf("Cannot open %s: %s\r\n", what, strerror(errno));
-               end_burst();
-       } else {
-               len = strlen (what);
-               content_type = GuessMimeByFilename(what, len);
-
-               if (fstat(fd, &statbuf) == -1) {
-                       syslog(9, "output_static('%s')  -- FSTAT FAILED --\n", what);
+               if (strstr(content_type, "image/") != NULL)
+               {
+                       output_error_pic("the file you requsted is gone.", strerror(errno));
+               }
+               else
+               {
                        hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
                        hprintf("Content-Type: text/plain\r\n");
                        begin_burst();
-                       wc_printf("Cannot fstat %s: %s\n", what, strerror(errno));
+                       wc_printf("Cannot open %s: %s\r\n", what, strerror(errno));
                        end_burst();
+               }
+       } else {
+               if (fstat(fd, &statbuf) == -1) {
+                       syslog(9, "output_static('%s')  -- FSTAT FAILED --\n", what);
+                       if (strstr(content_type, "image/") != NULL)
+                       {
+                               output_error_pic("Stat failed!", strerror(errno));
+                       }
+                       else
+                       {
+                               hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
+                               hprintf("Content-Type: text/plain\r\n");
+                               begin_burst();
+                               wc_printf("Cannot fstat %s: %s\n", what, strerror(errno));
+                               end_burst();
+                       }
                        if (fd > 0) close(fd);
                        return;
                }
 
-               count = 0;
                bytes = statbuf.st_size;
 
                if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
@@ -100,7 +161,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
        struct dirent *filedir_entry;
        int d_type = 0;
         int d_namelen;
-       int d_without_ext;
        int istoplevel;
                
        filedir = opendir (DirName);
@@ -121,7 +181,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
        while ((readdir_r(filedir, d, &filedir_entry) == 0) &&
               (filedir_entry != NULL))
        {
-               char *PStart;
 #ifdef _DIRENT_HAVE_D_NAMELEN
                d_namelen = filedir_entry->d_namelen;
                d_type = filedir_entry->d_type;
@@ -139,8 +198,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
                d_namelen = strlen(filedir_entry->d_name);
                d_type = DT_UNKNOWN;
 #endif
-               d_without_ext = d_namelen;
-
                if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
                        continue; /* Ignore backup files... */
 
@@ -184,7 +241,6 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
                        break;
                case DT_LNK: /* TODO: check whether its a file or a directory */
                case DT_REG:
-                       PStart = filedir_entry->d_name;
                        FileName = NewStrBufDup(Dir);
                        if (ChrPtr(FileName) [ StrLength(FileName) - 1] != '/')
                                StrBufAppendBufPlain(FileName, "/", 1, 0);
@@ -227,7 +283,7 @@ void output_flat_static(void)
            (vFile != NULL))
        {
                File = (StrBuf*) vFile;
-               output_static(ChrPtr(vFile));
+               output_static(ChrPtr(File));
        }
 }
 
@@ -236,18 +292,26 @@ void output_static_safe(HashList *DirList)
        wcsession *WCC = WC;
        void *vFile;
        StrBuf *File;
+       const char *MimeType;
 
        if (GetHash(DirList, SKEY(WCC->Hdr->HR.ReqLine), &vFile) &&
            (vFile != NULL))
        {
                File = (StrBuf*) vFile;
-               output_static(ChrPtr(vFile));
+               output_static(ChrPtr(File));
        }
        else {
                syslog(1, "output_static_safe() file %s not found. \n", 
                        ChrPtr(WCC->Hdr->HR.ReqLine));
-///TODO: detect image & output blank image
-               do_404();
+               MimeType =  GuessMimeByFilename(SKEY(WCC->Hdr->HR.ReqLine));
+               if (strstr(MimeType, "image/") != NULL)
+               {
+                       output_error_pic("the file you requested isn't known to our cache", "maybe reload webcit?");
+               }
+               else
+               {                   
+                       do_404();
+               }
        }
 }
 void output_static_0(void)
index 3b234f042eb11a9d2879e4f3b871cc910c7694f8..4048579ed244c31d4d65b7c126f6638808723508 100644 (file)
@@ -392,35 +392,6 @@ void FreeWCTemplate(void *vFreeMe)
        free(FreeMe);
 }
 
-
-
-/**
- * \brief back end for print_value_of() ... does a server command
- * \param servcmd server command to execute on the citadel server
- */
-void pvo_do_cmd(StrBuf *Target, StrBuf *servcmd) {
-       char buf[SIZ];
-       int len;
-
-       serv_puts(ChrPtr(servcmd));
-       len = serv_getln(buf, sizeof buf);
-
-       switch(buf[0]) {
-               case '2':
-               case '3':
-               case '5':
-                       StrBufAppendPrintf(Target, "%s\n", &buf[4]);
-                       break;
-               case '1':
-                       _fmout(Target, "CENTER");
-                       break;
-               case '4':
-                       StrBufAppendPrintf(Target, "%s\n", &buf[4]);
-                       serv_puts("000");
-                       break;
-       }
-}
-
 int HaveTemplateTokenString(StrBuf *Target, 
                            WCTemplputParams *TP,
                            int N,
@@ -619,7 +590,6 @@ void StrBufAppendTemplate(StrBuf *Target,
                          WCTemplputParams *TP,
                          const StrBuf *Source, int FormatTypeIndex)
 {
-        wcsession *WCC;
        const char *pFmt = NULL;
        char EscapeAs = ' ';
 
@@ -633,7 +603,6 @@ void StrBufAppendTemplate(StrBuf *Target,
        switch(EscapeAs)
        {
        case 'H':
-               WCC = WC;
                StrEscAppend(Target, Source, NULL, 0, 2);
                break;
        case 'X':
@@ -1215,7 +1184,6 @@ void *load_template(WCTemplate *NewTemplate)
        struct stat statbuf;
        const char *pS, *pE, *pch, *Err;
        long Line;
-       int pos;
 
        fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
        if (fd <= 0) {
@@ -1235,7 +1203,6 @@ void *load_template(WCTemplate *NewTemplate)
                close(fd);
                syslog(1, "ERROR: reading template '%s' - %s<br>\n",
                        ChrPtr(NewTemplate->FileName), strerror(errno));
-               //FreeWCTemplate(NewTemplate);/////tODO
                return NULL;
        }
        close(fd);
@@ -1252,7 +1219,6 @@ void *load_template(WCTemplate *NewTemplate)
                void *pv;
 
                /** Find one <? > */
-               pos = (-1);
                for (; pch < pE; pch ++) {
                        if ((*pch=='<')&&(*(pch + 1)=='?') &&
                            !((pch == pS) && /* we must ommit a <?xml */
@@ -1333,7 +1299,7 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *big, const StrBuf *BaseKey)
               (filedir_entry != NULL))
        {
                char *MinorPtr;
-               char *PStart;
+
 #ifdef _DIRENT_HAVE_D_NAMELEN
                d_namelen = filedir_entry->d_namelen;
                d_type = filedir_entry->d_type;
@@ -1410,7 +1376,6 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *big, const StrBuf *BaseKey)
                            (strcmp(&filedir_entry->d_name[d_without_ext], ".orig") == 0) ||
                            (strcmp(&filedir_entry->d_name[d_without_ext], ".swp") == 0))
                                continue; /* Ignore backup files... */
-                       PStart = filedir_entry->d_name;
                        StrBufPrintf(FileName, "%s/%s", ChrPtr(DirName),  filedir_entry->d_name);
                        MinorPtr = strchr(filedir_entry->d_name, '.');
                        if (MinorPtr != NULL)
@@ -2354,7 +2319,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
                         const char *OtherPrefix, long OtherPrefixLen,
                         const char *Default, long ldefault, long DefaultDirection)
 {
-       int isdefault = 0;
        const StrBuf *BSort = NULL;
        SortStruct *SortBy;
        void *vSortBy;
@@ -2388,7 +2352,6 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
 
        if (!GetHash(SortHash, SKEY(BSort), &vSortBy) || 
            (vSortBy == NULL)) {
-               isdefault = 1;
                if (!GetHash(SortHash, Default, ldefault, &vSortBy) || 
                    (vSortBy == NULL)) {
                        LogTemplateError(
index a799794c6a8c71e5192309d0ece2ebdb91590b62..e0d5a55717bb97e2ef9689bf94caa00c21fef5cf 100644 (file)
@@ -179,12 +179,9 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch
        icalcomponent *vtodo;
        icalproperty *p;
        struct icaltimetype IcalTime;
-       time_t now;
        int created_new_vtodo = 0;
        icalproperty_status todoStatus;
 
-       now = time(NULL);
-
        if (supplied_vtodo != NULL) {
                vtodo = supplied_vtodo;
 
index c732144e3c9093e08a9db565bae4a312ed991f88..ca76ec3746ec167b675289b6b07e8a8c1b49a04e 100644 (file)
@@ -561,36 +561,31 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, int full, wc_mim
        StrBuf *Swap = NULL;
        int i, j;
        char buf[SIZ];
-       char *name;
        int is_qp = 0;
        int is_b64 = 0;
        StrBuf *thisname = NULL;
-       char *thisvalue = NULL;
        char firsttoken[SIZ];
-       int pass;
-       long len;
        void *V;
 
        Swap = NewStrBuf ();
        thisname = NewStrBuf();
        for (i=0; i<(v->numprops); ++i) {
-               int len;
                is_qp = 0;
                is_b64 = 0;
                StrBufPlain(thisname, v->prop[i].name, -1);
                StrBufLowerCase(thisname);
                
-               len = extract_token(firsttoken, thisname, 0, ';', sizeof firsttoken);
+               /*len = */extract_token(firsttoken, ChrPtr(thisname), 0, ';', sizeof firsttoken);
                
-               for (j=0; j<num_tokens(thisname, ';'); ++j) {
-                       extract_token(buf, thisname, j, ';', sizeof buf);
+               for (j=0; j<num_tokens(ChrPtr(thisname), ';'); ++j) {
+                       extract_token(buf, ChrPtr(thisname), j, ';', sizeof buf);
                        if (!strcasecmp(buf, "encoding=quoted-printable")) {
                                is_qp = 1;
-                               remove_token(thisname, j, ';');
+/*                             remove_token(thisname, j, ';');*/
                        }
                        if (!strcasecmp(buf, "encoding=base64")) {
                                is_b64 = 1;
-                               remove_token(thisname, j, ';');
+/*                             remove_token(thisname, j, ';');*/
                        }
                }
                
@@ -618,7 +613,7 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, int full, wc_mim
                {
                        eVC evc = (eVC) V;
                        Put(VC, IKEY(evc), Val, HFreeStrBuf);
-                       syslog(1, "[%ld]\n", evc);
+                       syslog(1, "[%ul]\n", evc);
                        Val = NULL;
                }
                else
index 6d9373edb6708071982e4536792b5757bdbf4838..e61243e6a00502aa0d78a21e7396d2cc6afd37d6 100644 (file)
@@ -669,7 +669,6 @@ int Conditional_REST_DEPTH(StrBuf *Target, WCTemplputParams *TP)
  */
 void session_loop(void)
 {
-       int Flags = 0;
        int xhttp;
        StrBuf *Buf;
        
@@ -683,8 +682,6 @@ void session_loop(void)
        WCC->upload_length = 0;
        WCC->upload = NULL;
        WCC->Hdr->nWildfireHeaders = 0;
-       if (WCC->Hdr->HR.Handler != NULL)
-               Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */
 
        if (WCC->Hdr->HR.ContentLength > 0) {
                if (ReadPostData() < 0) {
index 567dc5d4e0b210c4e8e9c2d79ff63db685162a9e..ff7cb680e1afd06422e3e64013fa10f09115b992 100644 (file)
@@ -710,9 +710,9 @@ void CreateMimeStr(void);
 
 void pop_destination(void);
 
-void fmout(char *align);
-void _fmout(StrBuf *Targt, char *align);
-void FmOut(StrBuf *Target, char *align, StrBuf *Source);
+void fmout(const char *align);
+void _fmout(StrBuf *Targt, const char *align);
+void FmOut(StrBuf *Target, const char *align, const StrBuf *Source);
 void wDumpContent(int);
 
 
index cdb8367cd787172b0ad0873d3f4cab7e2a4d074c..603265eca352f4605b881b092b8cec54c760eb19 100644 (file)
@@ -22,7 +22,6 @@ extern int verbosity;         /* Logging level */
 extern char static_icon_dir[PATH_MAX];          /* where should we find our mime icons */
 int is_https = 0;              /* Nonzero if I am an HTTPS service */
 int follow_xff = 0;            /* Follow X-Forwarded-For: header */
-int home_specified = 0;                /* did the user specify a homedir? */
 int DisableGzip = 0;
 struct redirector *redir = NULL;
 char *default_landing_page = NULL;
@@ -158,7 +157,6 @@ int main(int argc, char **argv)
        char ip_addr[256]="*";
        int relh=0;
        int home=0;
-       int home_specified=0;
        char relhome[PATH_MAX]="";
        char webcitdir[PATH_MAX] = DATADIR;
        char *pidfile = NULL;
@@ -211,7 +209,6 @@ int main(int argc, char **argv)
                                safestrncpy(relhome, relhome, sizeof relhome);
                        }
                        /* free(hdir); TODO: SHOULD WE DO THIS? */
-                       home_specified = 1;
                        home=1;
                        break;
                case 'd':