]> code.citadel.org Git - citadel.git/blobdiff - citadel/internet_addressing.c
* More internet addressing and global directory stuff. I think it's all working now
[citadel.git] / citadel / internet_addressing.c
index a263bf42c0c80eff579a1c7703445ec8698cbe27..3063395025593de3801027dba132f5856a93a906 100644 (file)
@@ -270,119 +270,6 @@ void process_rfc822_addr(char *rfc822, char *user, char *node, char *name)
 
 
 
-/*
- * Back end for convert_internet_address()
- * (Compares an internet name [buffer1] and stores in [buffer2] if found)
- */
-void try_name(struct usersupp *us, void *data) {
-       struct passwd *pw;
-       struct trynamebuf *tnb;
-       tnb = (struct trynamebuf *)data;
-
-       if (!strncasecmp(tnb->buffer1, "cit", 3))
-               if (atol(&tnb->buffer1[3]) == us->usernum)
-                       strcpy(tnb->buffer2, us->fullname);
-
-       if (!collapsed_strcmp(tnb->buffer1, us->fullname)) 
-                       strcpy(tnb->buffer2, us->fullname);
-
-       if (us->uid != BBSUID) {
-               pw = getpwuid(us->uid);
-               if (pw != NULL) {
-                       if (!strcasecmp(tnb->buffer1, pw->pw_name)) {
-                               strcpy(tnb->buffer2, us->fullname);
-                       }
-               }
-       }
-}
-
-
-/*
- * Convert an Internet email address to a Citadel user/host combination
- */
-int convert_internet_address(char *destuser, char *desthost, char *source)
-{
-       char user[SIZ];
-       char node[SIZ];
-       char name[SIZ];
-       struct quickroom qrbuf;
-       int i;
-       int hostalias;
-       struct trynamebuf tnb;
-       char buf[SIZ];
-       int passes = 0;
-       char sourcealias[1024];
-
-       safestrncpy(sourcealias, source, sizeof(sourcealias) );
-       alias(sourcealias);
-
-REALIAS:
-       /* Split it up */
-       process_rfc822_addr(sourcealias, user, node, name);
-       lprintf(9, "process_rfc822_addr() converted to <%s@%s> (%s)\n",
-               user, node, name);
-
-       /* Map the FQDN to a Citadel node name
-        */
-       hostalias =  CtdlHostAlias(node);
-       switch(hostalias) {
-               case hostalias_localhost:
-                       strcpy(node, config.c_nodename);
-                       break;
-
-               case hostalias_gatewaydomain:
-                       extract_token(buf, node, 0, '.');
-                       safestrncpy(node, buf, sizeof buf);
-       }
-
-       /* Now try to resolve the name
-        * FIXME ... do the multiple-addresses thing
-        */
-       if (!strcasecmp(node, config.c_nodename)) {
-
-
-               /* First, see if we hit an alias.  Don't do this more than
-                * a few times, in case we accidentally hit an alias loop
-                */
-               strcpy(sourcealias, user);
-               alias(user);
-               if ( (strcasecmp(user, sourcealias)) && (++passes < 3) )
-                       goto REALIAS;
-
-               /* Try all local rooms */
-               if (!strncasecmp(user, "room_", 5)) {
-                       strcpy(name, &user[5]);
-                       for (i=0; i<strlen(name); ++i) 
-                               if (name[i]=='_') name[i]=' ';
-                       if (getroom(&qrbuf, name) == 0) {
-                               strcpy(destuser, qrbuf.QRname);
-                               strcpy(desthost, config.c_nodename);
-                               return rfc822_room_delivery;
-                       }
-               }
-
-               /* Try all local users */
-               strcpy(destuser, user);
-               strcpy(desthost, config.c_nodename);
-               strcpy(tnb.buffer1, user);
-               strcpy(tnb.buffer2, "");
-               ForEachUser(try_name, &tnb);
-               if (strlen(tnb.buffer2) == 0) return(rfc822_no_such_user);
-               strcpy(destuser, tnb.buffer2);
-               return(rfc822_address_locally_validated);
-       }
-
-       strcpy(destuser, user);
-       strcpy(desthost, node);
-       if (hostalias == hostalias_gatewaydomain) {
-               return(rfc822_address_on_citadel_network);
-       }
-       return(rfc822_address_nonlocal);
-}
-
-
-
-
 /*
  * convert_field() is a helper function for convert_internet_message().
  * Given start/end positions for an rfc822 field, it converts it to a Citadel