* buybuy serv_read
authorWilfried Göesgens <willi@citadel.org>
Sat, 25 Apr 2009 21:56:29 +0000 (21:56 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 25 Apr 2009 21:56:29 +0000 (21:56 +0000)
* fix some warnings

webcit/graphics.c
webcit/html2html.c
webcit/mainmenu.c
webcit/tcp_sockets.c
webcit/vcard_edit.c
webcit/webcit.c
webcit/webcit.h

index b62dd374a310531c61a2099b2d710bb0a4a2c22a..6aab9381ae1392e6d66b22ceb4b602fa0d611668 100644 (file)
@@ -22,7 +22,7 @@ void display_graphics_upload(char *description, char *filename, char *uplurl)
                display_main_menu();
                return;
        }
-       //output_headers(1, 1, 0, 0, 0, 0);
+       /*output_headers(1, 1, 0, 0, 0, 0); */
 
        output_headers(1, 1, 1, 0, 0, 0);
 
index 2e19e58e9eecb08b40c269573a11173b817532dc..dea5647c7c00b2a9d797b1fff7278e0f1d25674d 100644 (file)
@@ -397,8 +397,9 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
                }
                /** Fixup <img src="cid:... ...> to fetch the mime part */
                else if (!strncasecmp(ptr, "<img ", 5)) {
+                       char *cid_start, *cid_end;
                        char* tag_end=strchr(ptr,'>');
-
+                       char* src;
                        /* FIXME - handle this situation (maybe someone opened an <img cid... 
                         * and then ended the message)
                         */
@@ -408,8 +409,7 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
                                lprintf(9, "Theoretical bytes remaining: %d\n", msgend - ptr);
                        }
 
-                       char* src=strstr(ptr, " src=\"cid:");
-                       char *cid_start, *cid_end;
+                       src=strstr(ptr, " src=\"cid:");
                        ++brak;
 
                        if (src
index 5233204e15f740a03af1078766a321ced9c25537..f4420d978805626864bd98c32889894656f656f7 100644 (file)
@@ -259,8 +259,10 @@ void display_generic(void)
  */
 void do_generic(void)
 {
-       char buf[SIZ];
-       char gcontent[SIZ];
+
+       wcsession *WCC = WC;
+       int Done = 0;
+       StrBuf *Buf;
        char *junk;
        size_t len;
 
@@ -271,45 +273,53 @@ void do_generic(void)
 
        output_headers(1, 1, 0, 0, 0, 0);
 
-       serv_printf("%s", bstr("g_cmd"));
-       serv_getln(buf, sizeof buf);
+       serv_puts(bstr("g_cmd"));
 
        svput("BOXTITLE", WCS_STRING, _("Server command results"));
        do_template("beginboxx", NULL);
 
        wprintf("<table border=0><tr><td>Command:</td><td><tt>");
-       escputs(bstr("g_cmd"));
+       StrEscAppend(WCC->WBuf, sbstr("g_cmd"), NULL, 0, 0);
        wprintf("</tt></td></tr><tr><td>Result:</td><td><tt>");
-       escputs(buf);
+       StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0);
+       StrBufAppendBufPlain(WCC->WBuf, HKEY("<br>\n"), 0);
        wprintf("</tt></td></tr></table><br />\n");
-
-       if (buf[0] == '8') {
-               serv_printf("\n\n000");
-       }
-       if ((buf[0] == '1') || (buf[0] == '8')) {
-               while (serv_getln(gcontent, sizeof gcontent), strcmp(gcontent, "000")) {
-                       escputs(gcontent);
-                       wprintf("<br />\n");
+       
+       switch (GetServerStatus(Buf, NULL)) {
+       case 8:
+               serv_puts("\n\n000");
+               if ( (StrLength(Buf)==3) && 
+                    !strcmp(ChrPtr(Buf), "000")) {
+                       StrBufAppendBufPlain(WCC->WBuf, HKEY("\000"), 0);
+                       break;
                }
-               wprintf("000");
-       }
-       if (buf[0] == '4') {
+       case 1:
+               while (!Done) {
+                       StrBuf_ServGetlnBuffered(Buf);
+                       if ( (StrLength(Buf)==3) && 
+                            !strcmp(ChrPtr(Buf), "000")) {
+                               Done = 1;
+                       }
+                       StrEscAppend(WCC->WBuf, Buf, NULL, 0, 0);
+                       StrBufAppendBufPlain(WCC->WBuf, HKEY("<br>\n"), 0);
+               }
+               break;
+       case 4:
                text_to_server(bstr("g_input"));
                serv_puts("000");
-       }
-       if (buf[0] == '6') {
-               len = atol(&buf[4]);
-               junk = malloc(len);
-               serv_read(junk, len);
-               free(junk);
-       }
-       if (buf[0] == '7') {
-               len = atol(&buf[4]);
+               break;
+       case 6:
+               len = atol(&ChrPtr(Buf)[4]);
+               StrBuf_ServGetBLOBBuffered(Buf, len);
+               break;
+       case 7:
+               len = atol(&ChrPtr(Buf)[4]);
                junk = malloc(len);
                memset(junk, 0, len);
                serv_write(junk, len);
                free(junk);
        }
+       
        wprintf("<hr />");
        wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
        wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
index 345b1d56eb5e8277d23f671744a19c184b121bd5..b1205c7e8dd2eb4f58878e3888406059b23b7c77 100644 (file)
@@ -143,15 +143,6 @@ inline void _serv_read(char *buf, int bytes, wcsession *WCC)
        }
 }
 
-void serv_read(char *buf, int bytes)
-{
-       wcsession *WCC = WC;
-
-       WCC->ReadPos = NULL;
-
-       _serv_read(buf, bytes, WCC);
-}
-
 /*
  *  input string from pipe
  */
index 5846fa80ac03c3d1b774228283769b89504afdf2..311fb3aa83e1f4bf29faa9f2f5fdafb626f7e709 100644 (file)
@@ -699,7 +699,6 @@ void do_addrbook_view(addrbookent *addrbook, int num_ab) {
 void do_edit_vcard(long msgnum, char *partnum, char *return_to, const char *force_room) {
        StrBuf *Buf;
        char buf[SIZ];
-       StrBuf *serialized_vcard = NULL;
        size_t total_len = 0;
        struct vCard *v;
        int i;
index f304e6506c69c532c1cda18315ed757be49b6680..b2060a16b00368a4decb63f7e172a58f59d3d7db 100644 (file)
@@ -469,7 +469,6 @@ void ajax_servcmd(void)
                             !strcmp(ChrPtr(Buf), "000")) {
                                Done = 1;
                        }
-                       lprintf (1,"ajax: [%s]\n",ChrPtr(Buf));
                        StrBufAppendBuf(WCC->WBuf, Buf, 0);
                        StrBufAppendBufPlain(WCC->WBuf, HKEY("\n"), 0);
                }
index 77451ed53e4f603f1143a95649adfc4bc2bd785a..f0e19f6ddaf077d2fb9b403a39a4c47baeefa715 100644 (file)
@@ -589,7 +589,6 @@ void msgescputs(char *strbuf);
 void msgescputs1(char *strbuf);
 void dump_vars(void);
 void embed_main_menu(void);
-void serv_read(char *buf, int bytes);
 
 void SetAccessCommand(long Oper);
 void do_addrbook_view(addrbookent *addrbook, int num_ab);