X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Finternet_addressing.c;h=ed160fae73f9d5166fd67dbf6e9f65a6f7879fe4;hb=d56a1a82b06ed401324fc252dcd5f29e0c8b3ae5;hp=7730e8794e3039c99b051120959f7f8adb855d0f;hpb=d5283210d4cf1c74fbeea06354d87efbac454471;p=citadel.git diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 7730e8794..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 @@ -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