]> code.citadel.org Git - citadel.git/blobdiff - citadel/internet_addressing.c
SMTP: fix authentication.
[citadel.git] / citadel / internet_addressing.c
index 05f07860d4a6c339177a763adf0d6942062cd370..3237007d60a27d6a06d8153697f972049c49490b 100644 (file)
 #include "room_ops.h"
 #include "parsedate.h"
 #include "database.h"
-
 #include "ctdl_module.h"
-
-#ifndef HAVE_SNPRINTF
-#include "snprintf.h"
-#endif
-
-
 #ifdef HAVE_ICONV
 #include <iconv.h>
 
@@ -608,7 +601,6 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) {
                snprintf(addr, sizeof addr, "%s@%s", user, node);
                if (msg->cm_fields['A'] == NULL)
                        msg->cm_fields['A'] = strdup(name);
-               processed = 1;
                if (msg->cm_fields['F'] == NULL)
                        msg->cm_fields['F'] = strdup(addr);
                processed = 1;
@@ -679,6 +671,14 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) {
                processed = 1;
        }
 
+       else if (!strcasecmp(key, "Reply-To")) {
+               if (msg->cm_fields['K'] != NULL) {
+                       free(msg->cm_fields['K']);
+               }
+               msg->cm_fields['K'] = strndup(value, valuelen);
+               processed = 1;
+       }
+
        else if (!strcasecmp(key, "In-reply-to")) {
                if (msg->cm_fields['W'] == NULL) {              /* References: supersedes In-reply-to: */
                        msg->cm_fields['W'] = strndup(value, valuelen);
@@ -951,13 +951,15 @@ void CtdlDirectoryInit(void) {
 /*
  * Add an Internet e-mail address to the directory for a user
  */
-void CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
+int CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
        char key[SIZ];
 
-       if (IsDirectory(internet_addr, 0) == 0) return;
+       if (IsDirectory(internet_addr, 0) == 0) 
+               return 0;
        syslog(LOG_DEBUG, "Create directory entry: %s --> %s\n", internet_addr, citadel_addr);
        directory_key(key, internet_addr);
        cdb_store(CDB_DIRECTORY, key, strlen(key), citadel_addr, strlen(citadel_addr)+1 );
+       return 1;
 }
 
 
@@ -967,12 +969,12 @@ void CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
  * (NOTE: we don't actually use or need the citadel_addr variable; it's merely
  * here because the callback API expects to be able to send it.)
  */
-void CtdlDirectoryDelUser(char *internet_addr, char *citadel_addr) {
+int CtdlDirectoryDelUser(char *internet_addr, char *citadel_addr) {
        char key[SIZ];
 
        syslog(LOG_DEBUG, "Delete directory entry: %s --> %s\n", internet_addr, citadel_addr);
        directory_key(key, internet_addr);
-       cdb_delete(CDB_DIRECTORY, key, strlen(key) );
+       return cdb_delete(CDB_DIRECTORY, key, strlen(key) ) == 0;
 }