]> code.citadel.org Git - citadel.git/blobdiff - webcit/vcard_edit.c
* fix memleak in preferences
[citadel.git] / webcit / vcard_edit.c
index bc0ed9174a1b3ec68a987758005faa7c61072882..97ef83fa988c572ba30bf0f002b20c9be5ba3333 100644 (file)
@@ -61,8 +61,8 @@ void display_addressbook(long msgnum, char alpha) {
                        display_vcard(WC->WBuf, vcard_source, alpha, 0, NULL,msgnum);
 
                        /** If it's my vCard I can edit it */
-                       if (    (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
-                               || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
+                       if (    (!strcasecmp(ChrPtr(WC->wc_roomname), USERCONFIGROOM))
+                               || (!strcasecmp(&(ChrPtr(WC->wc_roomname)[11]), USERCONFIGROOM))
                                || (WC->wc_view == VIEW_ADDRESSBOOK)
                        ) {
                                wprintf("<a href=\"edit_vcard?"
@@ -503,7 +503,8 @@ void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int ful
        long msgnum) {
        struct vCard *v;
        char *name;
-       char buf[SIZ];
+       StrBuf *Buf;
+       StrBuf *Buf2;
        char this_alpha = 0;
 
        v = vcard_load((char*)vcard_source); ///TODO
@@ -512,9 +513,12 @@ void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int ful
 
        name = vcard_get_prop(v, "n", 1, 0, 0);
        if (name != NULL) {
-               utf8ify_rfc822_string(name);
-               strcpy(buf, name);
-               this_alpha = buf[0];
+               Buf = NewStrBufPlain(name, -1);
+               Buf2 = NewStrBufPlain(NULL, StrLength(Buf));
+               StrBuf_RFC822_to_Utf8(Buf2, Buf, WC->DefaultCharset, NULL);
+               this_alpha = ChrPtr(Buf)[0];
+               FreeStrBuf(&Buf);
+               FreeStrBuf(&Buf2);
        }
 
        if (storename != NULL) {
@@ -648,7 +652,7 @@ void do_addrbook_view(addrbookent *addrbook, int num_ab) {
  * and MIME part number to fetch.  Or, specify -1 for the message number
  * to start with a blank card.
  */
-void do_edit_vcard(long msgnum, char *partnum, char *return_to, char *force_room) {
+void do_edit_vcard(long msgnum, char *partnum, char *return_to, const char *force_room) {
        char buf[SIZ];
        char *serialized_vcard = NULL;
        size_t total_len = 0;
@@ -1026,7 +1030,7 @@ void submit_vcard(void) {
        }
 
        if (havebstr("force_room")) {
-               gotoroom(bstr("force_room"));
+               gotoroom(sbstr("force_room"));
        }
 
        sprintf(buf, "ENT0 1|||4||");