]> code.citadel.org Git - citadel.git/commitdiff
* Added a QDIR protocol command to do quick-and-dirty queries of the directory
authorArt Cancro <ajc@citadel.org>
Fri, 1 Feb 2002 05:11:26 +0000 (05:11 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 1 Feb 2002 05:11:26 +0000 (05:11 +0000)
* In the client, check the directory for conflicts when selecting email addr.

citadel/ChangeLog
citadel/dynloader.c
citadel/dynloader.h
citadel/routines2.c
citadel/serv_vcard.c
citadel/techdoc/session.txt

index 4ba7f6739dcd5fd20768511d9814990813dc64f5..a6fb24357cadbc5d91980141cedfe847dc6d5af5 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 590.97  2002/02/01 05:11:26  ajc
+ * Added a QDIR protocol command to do quick-and-dirty queries of the directory
+ * In the client, check the directory for conflicts when selecting email addr.
+
  Revision 590.96  2002/01/31 05:13:44  ajc
  * When deleting a vCard from the Global Address Book room, remove the
    corresponding address in the directory.  (Not tested.)
@@ -3278,4 +3282,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 5842971d154d1ae4eaa38243c1e557b57e5a4a99..00bd8091aac80468df0332ba26a63f859cc6324d 100644 (file)
@@ -399,7 +399,7 @@ void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) )
 }
 
 
-void CtdlRegisterDeleteHook(int (*handler)(char *, long) )
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
 {
        struct DeleteFunctionHook *newfcn;
 
@@ -413,7 +413,7 @@ void CtdlRegisterDeleteHook(int (*handler)(char *, long) )
 }
 
 
-void CtdlUnregisterDeleteHook(int (*handler)(char *, long) )
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
 {
        struct DeleteFunctionHook *cur, *p;
 
index 737384a352301efcd6e2710190524229bcbeaeef..b8491e1caba9083512c1b9e90274ab23e1c64389 100644 (file)
@@ -37,8 +37,8 @@ void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
 void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
 int PerformNetprocHooks(struct CtdlMessage *, char *);
 
-void CtdlRegisterDeleteHook(int (*handler)(char *, long) );
-void CtdlUnregisterDeleteHook(int (*handler)(char *, long) );
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
 void PerformDeleteHooks(char *, long);
 
 
index 01d591d4e4c368c89dc23a6410ebc076fc30fdee..d6d3f8d96a7f15097c7f9fec9d4a5d4881944493 100644 (file)
@@ -101,7 +101,11 @@ void entregis(void)
        char tmpphone[SIZ];
        char tmpemail[SIZ];
        char tmpcountry[SIZ];
+       char diruser[SIZ];
+       char dirnode[SIZ];
+       char holdemail[SIZ];
        int a;
+       int ok = 0;
 
        strcpy(tmpname, "");
        strcpy(tmpaddr, "");
@@ -143,7 +147,32 @@ void entregis(void)
        strprompt("ZIP/Postal Code", tmpzip, 10);
        strprompt("Country", tmpcountry, 31);
        strprompt("Telephone number", tmpphone, 14);
-       strprompt("Email address", tmpemail, 31);
+
+       do {
+               ok = 1;
+               strcpy(holdemail, tmpemail);
+               strprompt("Email address", tmpemail, 31);
+               sprintf(buf, "QDIR %s", tmpemail);
+               serv_puts(buf);
+               serv_gets(buf);
+               if (buf[0]=='2') {
+                       extract_token(diruser, &buf[4], 0, '@');
+                       extract_token(dirnode, &buf[4], 1, '@');
+                       striplt(diruser);
+                       striplt(dirnode);
+                       if ((strcasecmp(diruser, fullname))
+                          || (strcasecmp(dirnode, serv_info.serv_nodename))) {
+                               scr_printf(
+                                       "\nYou can't use %s as your address.\n",
+                                       tmpemail);
+                               scr_printf(
+                                       "It is already in use by %s @ %s.\n",
+                                       diruser, dirnode);
+                               ok = 0;
+                               strcpy(tmpemail, holdemail);
+                       }
+               }
+       } while (ok == 0);
 
        /* now send the registration info back to the server */
        serv_puts("REGI");
index 7982075b52f626dda41683c9624b306c0c5b17b0..eeb9e192143b1e78e683540b4d82d4fdb514d146 100644 (file)
@@ -608,6 +608,27 @@ void vcard_delete_remove(char *room, long msgnum) {
 }
 
 
+/*
+ * Query Directory
+ */
+void cmd_qdir(char *argbuf) {
+       char citadel_addr[SIZ];
+       char internet_addr[SIZ];
+
+       if (CtdlAccessCheck(ac_logged_in)) return;
+
+       extract(internet_addr, argbuf, 0);
+
+       if (CtdlDirectoryLookup(citadel_addr, internet_addr) != 0) {
+               cprintf("%d %s was not found.\n",
+                       ERROR+NO_SUCH_USER, internet_addr);
+               return;
+       }
+
+       cprintf("%d %s\n", OK, citadel_addr);
+}
+
+
 
 
 /*
@@ -629,6 +650,7 @@ char *Dynamic_Module_Init(void)
        CtdlRegisterProtoHook(cmd_greg, "GREG", "Get registration info");
        CtdlRegisterProtoHook(cmd_igab, "IGAB",
                                        "Initialize Global Address Book");
+       CtdlRegisterProtoHook(cmd_qdir, "QDIR", "Query Directory");
        CtdlRegisterUserHook(vcard_purge, EVT_PURGEUSER);
        CtdlRegisterNetprocHook(vcard_extract_from_network);
        create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1);
index ebac8ec3504d6d5ba736535b0e0d969136dacce3..9f92efa5e65150b8b6e7ff5a70dc027845d65ca3 100644 (file)
@@ -1887,8 +1887,16 @@ is normally run internally when the server determines it necessary, but is
 also provided as a server command to be used as a troubleshooting/maintenenance
 tool.  Only a system Aide can run the command.  It returns OK on success or
 ERROR on failure.
-
-
+ QDIR   (Query global DIRectory)
+ Look up an internet address in the global directory.  Any logged-in user may
+call QDIR with one parameter, the Internet e-mail address to look up.  QDIR
+returns OK followed by a Citadel address if there is a match, otherwise it
+returns ERROR+NOT_LOGGED_IN.
  ASYN   (ASYNchronous message support)
  
  Negotiate the use of asynchronous, or unsolicited, protocol messages.  The