move the rest of the places to use AppendImportantMessage() or GetServerStatusMsg()
[citadel.git] / webcit / vcard_edit.c
index c732144e3c9093e08a9db565bae4a312ed991f88..a794dddd3b9de05d199e7986dd6ac54544f55880 100644 (file)
@@ -252,7 +252,7 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) {
                        }
                }
                if (is_qp) {
-                       // %ff can become 6 bytes in utf8 
+                       /* %ff can become 6 bytes in utf8  */
                        *storename = malloc(len * 2 + 3); 
                        j = CtdlDecodeQuotedPrintable(
                                *storename, name,
@@ -260,7 +260,7 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) {
                        (*storename)[j] = 0;
                }
                else if (is_b64) {
-                       // ff will become one byte..
+                       /* ff will become one byte.. */
                        *storename = malloc(len + 50);
                        CtdlDecodeBase64(
                                *storename, name,
@@ -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
@@ -1248,11 +1243,11 @@ void edit_vcard(void) {
  *  parse edited vcard from the browser
  */
 void submit_vcard(void) {
-       wcsession *WCC = WC;
        struct vCard *v;
        char *serialized_vcard;
        char buf[SIZ];
        StrBuf *Buf;
+       const StrBuf *ForceRoom;
        int i;
 
        if (!havebstr("ok_button")) { 
@@ -1261,19 +1256,13 @@ void submit_vcard(void) {
        }
 
        if (havebstr("force_room")) {
-               if (gotoroom(sbstr("force_room")) != 200) {
-                       StrBufAppendBufPlain(WCC->ImportantMsg,
-                                            _("Unable to enter the room to save your message"),
-                                            -1, 0);
-                       StrBufAppendBufPlain(WCC->ImportantMsg,
-                                            HKEY(": "), 0);
-                       StrBufAppendBuf(WCC->ImportantMsg, sbstr("force_room"), 0);
-                       StrBufAppendBufPlain(WCC->ImportantMsg,
-                                            HKEY("; "), 0);
-                                              
-                       StrBufAppendBufPlain(WCC->ImportantMsg,
-                                            _("Aborting."),
-                                            -1, 0);
+               ForceRoom = sbstr("force_room");
+               if (gotoroom(ForceRoom) != 200) {
+                       AppendImportantMessage(_("Unable to enter the room to save your message"), -1);
+                       AppendImportantMessage(HKEY(": "));
+                       AppendImportantMessage(SKEY(ForceRoom));
+                       AppendImportantMessage(HKEY("; "));
+                       AppendImportantMessage(_("Aborting."), -1);
 
                        if (!strcmp(bstr("return_to"), "select_user_to_edit")) {
                                select_user_to_edit(NULL);
@@ -1307,10 +1296,7 @@ void submit_vcard(void) {
        v = VCardLoad(Buf);     /* Start with the extra fields */
        FreeStrBuf(&Buf);
        if (v == NULL) {
-               safestrncpy(WCC->ImportantMessage,
-                       _("An error has occurred."),
-                       sizeof WCC->ImportantMessage
-               );
+               AppendImportantMessage(_("An error has occurred."), -1);
                edit_vcard();
                return;
        }
@@ -1353,10 +1339,7 @@ void submit_vcard(void) {
        serialized_vcard = vcard_serialize(v);
        vcard_free(v);
        if (serialized_vcard == NULL) {
-               safestrncpy(WCC->ImportantMessage,
-                       _("An error has occurred."),
-                       sizeof WCC->ImportantMessage
-               );
+               AppendImportantMessage(_("An error has occurred."), -1);
                edit_vcard();
                return;
        }