Back to index

citadel  8.12
Enumerations | Functions
serv_vcard.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  { V2L_WRITE, V2L_DELETE }

Functions

void extract_inet_email_addrs (char *, size_t, char *, size_t, struct vCard *v, int local_addrs_only)
struct vCard * vcard_get_user (struct ctdluser *u)

Enumeration Type Documentation

anonymous enum
Enumerator:
V2L_WRITE 
V2L_DELETE 

Definition at line 4 of file serv_vcard.h.


Function Documentation

void extract_inet_email_addrs ( char *  ,
size_t  ,
char *  ,
size_t  ,
struct vCard *  v,
int  local_addrs_only 
)

Definition at line 232 of file serv_vcard.c.

{
       struct CitContext *CCC = CC;              /* put this on the stack, just for speed */
       char *s, *k, *addr;
       int instance = 0;
       int IsDirectoryAddress;
       int saved_instance = 0;

       /* Go through the vCard searching for *all* Internet email addresses
        */
       while (s = vcard_get_prop(v, "email", 1, instance, 0),  s != NULL) {
              k = vcard_get_prop(v, "email", 1, instance, 1);
              if ( (s != NULL) && (k != NULL) && (bmstrcasestr(k, "internet")) ) {
                     addr = strdup(s);
                     striplt(addr);
                     if (!IsEmptyStr(addr)) {
                            IsDirectoryAddress = IsDirectory(addr, 1);
                            if ( IsDirectoryAddress || !local_addrs_only)
                            {
                                   ++saved_instance;
                                   if ((saved_instance == 1) && (emailaddrbuf != NULL)) {
                                          safestrncpy(emailaddrbuf, addr, emailaddrbuf_len);
                                   }
                                   else if ((saved_instance == 2) && (secemailaddrbuf != NULL)) {
                                          safestrncpy(secemailaddrbuf, addr, secemailaddrbuf_len);
                                   }
                                   else if ((saved_instance > 2) && (secemailaddrbuf != NULL)) {
                                          if ( (strlen(addr) + strlen(secemailaddrbuf) + 2) 
                                          < secemailaddrbuf_len ) {
                                                 strcat(secemailaddrbuf, "|");
                                                 strcat(secemailaddrbuf, addr);
                                          }
                                   }
                            }
                            if (!IsDirectoryAddress && local_addrs_only)
                            {
                                   StrBufAppendPrintf(CCC->StatusMessage, "\n%d|", ERROR+ ILLEGAL_VALUE);
                                   StrBufAppendBufPlain(CCC->StatusMessage, addr, -1, 0);
                                   StrBufAppendBufPlain(CCC->StatusMessage, HKEY("|"), 0);
                                   StrBufAppendBufPlain(CCC->StatusMessage, _("unable to add this emailaddress; its not matching our domain."), -1, 0);
                            }
                     }
                     free(addr);
              }
              ++instance;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct vCard* vcard_get_user ( struct ctdluser u) [read]

Definition at line 626 of file serv_vcard.c.

                                                 {
       char hold_rm[ROOMNAMELEN];
       char config_rm[ROOMNAMELEN];
       struct CtdlMessage *msg = NULL;
       struct vCard *v;
       long VCmsgnum;

       strcpy(hold_rm, CC->room.QRname);  /* save current room */
       CtdlMailboxName(config_rm, sizeof config_rm, u, USERCONFIGROOM);

       if (CtdlGetRoom(&CC->room, config_rm) != 0) {
              CtdlGetRoom(&CC->room, hold_rm);
              return vcard_new();
       }

       /* We want the last (and probably only) vcard in this room */
       VCmsgnum = (-1);
       CtdlForEachMessage(MSGS_LAST, 1, NULL, "[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
              NULL, vcard_gu_backend, (void *)&VCmsgnum );
       CtdlGetRoom(&CC->room, hold_rm);   /* return to saved room */

       if (VCmsgnum < 0L) return vcard_new();

       msg = CtdlFetchMessage(VCmsgnum, 1);
       if (msg == NULL) return vcard_new();

       v = vcard_load(msg->cm_fields['M']);
       CtdlFreeMessage(msg);
       return v;
}

Here is the call graph for this function:

Here is the caller graph for this function: