* In the client, check the directory for conflicts when selecting email addr.
$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.)
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
}
-void CtdlRegisterDeleteHook(int (*handler)(char *, long) )
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
{
struct DeleteFunctionHook *newfcn;
}
-void CtdlUnregisterDeleteHook(int (*handler)(char *, long) )
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
{
struct DeleteFunctionHook *cur, *p;
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);
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, "");
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");
}
+/*
+ * 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);
+}
+
+
/*
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);
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