X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Finternet_addressing.c;h=ed160fae73f9d5166fd67dbf6e9f65a6f7879fe4;hb=d56a1a82b06ed401324fc252dcd5f29e0c8b3ae5;hp=8902befbdfdbf37dedc21f5a1b389fd17d431949;hpb=727b303736cc95e8be9c7e28c3622eda152584ce;p=citadel.git diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 8902befbd..ed160fae7 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -13,7 +13,6 @@ * GNU General Public License for more details. */ - #include "sysdep.h" #include #include @@ -702,8 +701,8 @@ recptypes *validate_recipients(const char *supplied_recipients, const char *Remo break; case MES_INTERNET: /* Yes, you're reading this correctly: if the target - * domain points back to the local system or an attached - * Citadel directory, the address is invalid. That's + * domain points back to the local system, + * the address is invalid. That's * because if the address were valid, we would have * already translated it to a local address by now. */ @@ -1718,3 +1717,36 @@ void CtdlRebuildDirectoryIndex(void) { ForEachUser(CtdlRebuildDirectoryIndex_backend, NULL); CtdlRebuildDirectoryIndex_backend(NULL, NULL); } + + +/* + * Configure Internet email addresses for a user account, updating the Directory Index in the process + */ +void CtdlSetEmailAddressesForUser(char *requested_user, char *new_emailaddrs) +{ + struct ctdluser usbuf; + int i; + char buf[SIZ]; + + if (CtdlGetUserLock(&usbuf, requested_user) != 0) { // We are relying on the fact that the DirectoryIndex functions don't lock. + return; // Silently fail here if we can't acquire a lock on the user record. + } + + syslog(LOG_DEBUG, "internet_addressing: setting email addresses for <%s> to <%s>", usbuf.fullname, new_emailaddrs); + + /* Delete all of the existing directory index records for the user (easier this way) */ + for (i=0; i