]> code.citadel.org Git - citadel.git/blobdiff - citadel/internet_addressing.c
AUTH PLAIN: second try.
[citadel.git] / citadel / internet_addressing.c
index a1b0a37e176c84748abdb35f90d6202a5b2a5720..83fcf4c04eca5a7e3c8433799ef7c84444db2d92 100644 (file)
@@ -331,7 +331,7 @@ int CtdlHostAlias(char *fqdn) {
  */
 int CtdlIsMe(char *addr, int addr_buf_len)
 {
-       struct recptypes *recp;
+       recptypes *recp;
        int i;
 
        recp = validate_recipients(addr, NULL, 0);
@@ -355,25 +355,6 @@ int CtdlIsMe(char *addr, int addr_buf_len)
 }
 
 
-/*
- * Citadel protocol command to do the same
- */
-void cmd_isme(char *argbuf) {
-       char addr[256];
-
-       if (CtdlAccessCheck(ac_logged_in)) return;
-       extract_token(addr, argbuf, 0, '|', sizeof addr);
-
-       if (CtdlIsMe(addr, sizeof addr)) {
-               cprintf("%d %s\n", CIT_OK, addr);
-       }
-       else {
-               cprintf("%d Not you.\n", ERROR + ILLEGAL_VALUE);
-       }
-
-}
-
-
 /* If the last item in a list of recipients was truncated to a partial address,
  * remove it completely in order to avoid choking libSieve
  */
@@ -550,11 +531,11 @@ int alias(char *name)
  *
  * Caller needs to free the result using free_recipients()
  */
-struct recptypes *validate_recipients(const char *supplied_recipients, 
-                                     const char *RemoteIdentifier, 
-                                     int Flags) {
+recptypes *validate_recipients(const char *supplied_recipients, 
+                              const char *RemoteIdentifier, 
+                              int Flags) {
        struct CitContext *CCC = CC;
-       struct recptypes *ret;
+       recptypes *ret;
        char *recipients = NULL;
        char *org_recp;
        char this_recp[256];
@@ -573,11 +554,11 @@ struct recptypes *validate_recipients(const char *supplied_recipients,
        int in_quotes = 0;
 
        /* Initialize */
-       ret = (struct recptypes *) malloc(sizeof(struct recptypes));
+       ret = (recptypes *) malloc(sizeof(recptypes));
        if (ret == NULL) return(NULL);
 
        /* Set all strings to null and numeric values to zero */
-       memset(ret, 0, sizeof(struct recptypes));
+       memset(ret, 0, sizeof(recptypes));
 
        if (supplied_recipients == NULL) {
                recipients = strdup("");
@@ -804,9 +785,9 @@ struct recptypes *validate_recipients(const char *supplied_recipients,
 
 
 /*
- * Destructor for struct recptypes
+ * Destructor for recptypes
  */
-void free_recipients(struct recptypes *valid) {
+void free_recipients(recptypes *valid) {
 
        if (valid == NULL) {
                return;
@@ -1008,11 +989,16 @@ void unfold_rfc822_field(char **field, char **FieldEnd)
             sField < pFieldEnd; 
             pField++, sField++)
        {
-               if ((*sField=='\r') || (*sField=='\n')) {
-                   sField++;
-                   if  (*sField == '\n')
-                       sField++;
-                   *pField = *sField;
+               if ((*sField=='\r') || (*sField=='\n'))
+               {
+                       int Offset = 1;
+                       while (((*(sField + Offset) == '\r') ||
+                               (*(sField + Offset) == '\n') ||
+                               (isspace(*(sField + Offset)))) && 
+                              (sField + Offset < pFieldEnd))
+                               Offset ++;
+                       sField += Offset;
+                       *pField = *sField;
                }
                else {
                        if (*sField=='\"') quote = 1 - quote;
@@ -1703,12 +1689,3 @@ char *harvest_collected_addresses(struct CtdlMessage *msg) {
        }
        return(coll);
 }
-
-
-CTDL_MODULE_INIT(internet_addressing)
-{
-       if (!threading) {
-               CtdlRegisterProtoHook(cmd_isme, "ISME", "Determine whether an email address belongs to a user");
-       }
-       return "internet_addressing";
-}