]> code.citadel.org Git - citadel.git/commitdiff
* Minor vCard fixes
authorArt Cancro <ajc@citadel.org>
Mon, 4 Oct 1999 02:04:02 +0000 (02:04 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 4 Oct 1999 02:04:02 +0000 (02:04 +0000)
citadel/citserver.c
citadel/msgbase.c
citadel/serv_vcard.c
citadel/vcard.c

index ef7cb29ed609ef56ea5a086db1ca2f45ca09ad83..d800ad5dbcb88366afff2566dc2e6ac63d1388e6 100644 (file)
@@ -195,15 +195,14 @@ void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
 
        lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
 
 
        lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
 
+       /* Fail silently if the symbol is already registered. */
        for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)  {
                if (ptr->sym_id == requested_sym) {
        for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)  {
                if (ptr->sym_id == requested_sym) {
-                       lprintf(2, "ERROR: CtdlAllocUserData() requested for"
-                               " symbol id %ld already registered\n", 
-                               requested_sym);
                        return;
                }
        }
 
                        return;
                }
        }
 
+       /* Grab us some memory!  Dem's good eatin' !!  */
        ptr = mallok(sizeof(struct CtdlSessData));
        ptr->sym_id = requested_sym;
        ptr->sym_data = mallok(num_bytes);
        ptr = mallok(sizeof(struct CtdlSessData));
        ptr->sym_id = requested_sym;
        ptr->sym_data = mallok(num_bytes);
index ca2d130f4e50bacd770247508643034700d9c9dc..8e48ee92e3bfc6e3ed175074d11dc2e8b56013e9 100644 (file)
@@ -1975,7 +1975,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
        msg->cm_anon_type = MES_NORMAL;
        msg->cm_format_type = 4;
        msg->cm_fields['A'] = strdoop(CC->usersupp.fullname);
        msg->cm_anon_type = MES_NORMAL;
        msg->cm_format_type = 4;
        msg->cm_fields['A'] = strdoop(CC->usersupp.fullname);
-       msg->cm_fields['O'] = strdoop(roomname);
+       msg->cm_fields['O'] = strdoop(req_room);
        msg->cm_fields['N'] = strdoop(config.c_nodename);
        msg->cm_fields['H'] = strdoop(config.c_humannode);
        
        msg->cm_fields['N'] = strdoop(config.c_nodename);
        msg->cm_fields['H'] = strdoop(config.c_humannode);
        
index 3cfe4f1cd593588561f27a1322c4e2fa8c170af4..0150a074864fa9eb02d84bd96494739278907792 100644 (file)
@@ -8,6 +8,8 @@
  *
  */
 
  *
  */
 
+#define ADDRESS_BOOK_ROOM      "Global Address Book"
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -51,6 +53,16 @@ unsigned long SYM_VCARD;
 #define VC ((struct vcard_internal_info *)CtdlGetUserData(SYM_VCARD))
 
 
 #define VC ((struct vcard_internal_info *)CtdlGetUserData(SYM_VCARD))
 
 
+
+/*
+ * back end function used by several functions in this module
+ */
+void vcard_gm_backend(long msgnum) {
+       VC->msgnum = msgnum;
+}
+
+
+
 /*
  * This handler detects whether the user is attempting to save a new
  * vCard as part of his/her personal configuration, and handles the replace
 /*
  * This handler detects whether the user is attempting to save a new
  * vCard as part of his/her personal configuration, and handles the replace
@@ -90,14 +102,6 @@ int vcard_personal_upload(struct CtdlMessage *msg) {
 
 
 
 
 
 
-/*
- * back end function used by vcard_get_user()
- */
-void vcard_gm_backend(long msgnum) {
-       VC->msgnum = msgnum;
-}
-
-
 /*
  * If this user has a vcard on disk, read it into memory, otherwise allocate
  * and return an empty vCard.
 /*
  * If this user has a vcard on disk, read it into memory, otherwise allocate
  * and return an empty vCard.
@@ -157,8 +161,18 @@ void vcard_write_user(struct usersupp *u, struct vCard *v) {
        }
         fclose(fp);
 
        }
         fclose(fp);
 
-        /* This handy API function does all the work for us */
-        CtdlWriteObject(CONFIGROOM, "text/x-vcard", temp, u, 0, 1);
+        /* This handy API function does all the work for us.
+        * NOTE: normally we would want to set that last argument to 1, to
+        * force the system to delete the user's old vCard.  But it doesn't
+        * have to, because the vcard_personal_upload() hook above is going to
+        * notice what we're trying to do, and delete the old vCard.
+        */
+        CtdlWriteObject(CONFIGROOM,    /* which room */
+                       "text/x-vcard", /* MIME type */
+                       temp,           /* temp file */
+                       u,              /* which user */
+                       0,              /* not binary */
+                       0);             /* don't delete others of this type */
 
         unlink(temp);
 }
 
         unlink(temp);
 }
@@ -282,7 +296,6 @@ void cmd_greg(char *argbuf)
 
        sprintf(adr, "%s", vcard_get_prop(v, "adr", 0));/* address... */
 
 
        sprintf(adr, "%s", vcard_get_prop(v, "adr", 0));/* address... */
 
-       lprintf(9, "adr is <%s>\n", adr);
        extract_token(buf, adr, 2, ';');
        cprintf("%s\n", buf);                           /* street */
        extract_token(buf, adr, 3, ';');
        extract_token(buf, adr, 2, ';');
        cprintf("%s\n", buf);                           /* street */
        extract_token(buf, adr, 3, ';');
index e7836516e239822055c590ff0fbfac655db89ce0..a34a466b0306800270a033358f41142254da1b3f 100644 (file)
@@ -131,7 +131,6 @@ struct vCard *vcard_load(char *vtext) {
 char *vcard_get_prop(struct vCard *v, char *propname, int is_partial) {
        int i;
 
 char *vcard_get_prop(struct vCard *v, char *propname, int is_partial) {
        int i;
 
-       lprintf(9, "vcard_get_prop(%s, %d) called\n", propname, is_partial);
        if (v->numprops) for (i=0; i<(v->numprops); ++i) {
                if ( (!strcasecmp(v->prop[i].name, propname))
                   || (  (!strncasecmp(v->prop[i].name,
        if (v->numprops) for (i=0; i<(v->numprops); ++i) {
                if ( (!strcasecmp(v->prop[i].name, propname))
                   || (  (!strncasecmp(v->prop[i].name,
@@ -139,11 +138,9 @@ char *vcard_get_prop(struct vCard *v, char *propname, int is_partial) {
                         && (v->prop[i].name[strlen(propname)] == ';')
                         && (is_partial) ) ) {
                        return(v->prop[i].value);
                         && (v->prop[i].name[strlen(propname)] == ';')
                         && (is_partial) ) ) {
                        return(v->prop[i].value);
-                       lprintf(9, "found: value is <%s>\n", v->prop[i].value);
                }
        }
 
                }
        }
 
-       lprintf(9, "not found: returning null\n");
        return NULL;
 }
 
        return NULL;
 }