From: Art Cancro Date: Wed, 14 Sep 2005 03:48:33 +0000 (+0000) Subject: * Bumped internal version number to 5.66 X-Git-Tag: v7.86~4660 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=014488bf8427a20552c3b080076da549c16d45e7 * Bumped internal version number to 5.66 * Checked in an initial but incomplete version of the AUTO command (to be used for address autocompletion) --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 95b531e34..d0ce07a42 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ +Revision 655.1 2005/09/14 03:48:32 ajc +* Bumped internal version number to 5.66 +* Checked in an initial but incomplete version of the AUTO command + (to be used for address autocompletion) + Revision 655.0 2005/09/13 14:00:12 ajc * THIS IS 6.55 @@ -7105,3 +7110,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/Makefile.in b/citadel/Makefile.in index b4f5c1adc..0be26f9f2 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -50,7 +50,8 @@ SERV_MODULES=serv_chat.o \ serv_vandelay.o \ serv_calendar.o \ ical_dezonify.o \ - serv_ldap.o + serv_ldap.o \ + serv_autocompletion.o UTIL_TARGETS=aidepost msgform \ citmail userlist sendcommand \ @@ -90,7 +91,7 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c citadel.c citadel_ipc.c \ domain.c serv_extensions.c file_ops.c genstamp.c getutline.c \ housekeeping.c html.c ical_dezonify.c imap_fetch.c imap_misc.c \ imap_search.c imap_store.c imap_tools.c internet_addressing.c \ - ipc_c_tcp.c locate_host.c md5.c messages.c \ + ipc_c_tcp.c locate_host.c md5.c messages.c serv_autocompletion.c \ mime_parser.c msgbase.c msgform.c parsedate.c policy.c \ room_ops.c rooms.c routines.c routines2.c \ screen.c sendcommand.c serv_bio.c serv_calendar.c serv_chat.c \ diff --git a/citadel/citadel.h b/citadel/citadel.h index 2a631747f..78eb2a4cf 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -45,7 +45,7 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 655 /* This version */ +#define REV_LEVEL 656 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ #define EXPORT_REV_MIN 655 /* Oldest compatible export files */ diff --git a/citadel/serv_autocompletion.c b/citadel/serv_autocompletion.c new file mode 100644 index 000000000..60b369069 --- /dev/null +++ b/citadel/serv_autocompletion.c @@ -0,0 +1,122 @@ +/* + * $Id$ + * + * Autocompletion of email recipients, etc. + */ + +#ifdef DLL_EXPORT +#define IN_LIBCIT +#endif + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include +#include +#include +#include "citadel.h" +#include "server.h" +#include "serv_extensions.h" +#include "sysdep_decls.h" +#include "citserver.h" +#include "support.h" +#include "config.h" +#include "tools.h" +#include "msgbase.h" +#include "user_ops.h" +#include "room_ops.h" +#include "database.h" +#include "vcard.h" +#include "serv_autocompletion.h" + + +#ifndef HAVE_SNPRINTF +#include "snprintf.h" +#endif + + +/* + * Back end for cmd_auto() + */ +void hunt_for_autocomplete(long msgnum, void *data) { + char *search_string; + struct CtdlMessage *msg; + struct vCard *v; + + search_string = (char *) data; + + msg = CtdlFetchMessage(msgnum, 1); + if (msg == NULL) return; + + v = vcard_load(msg->cm_fields['M']); + CtdlFreeMessage(msg); + + /* + * Try to match from a display name or something like that + */ + if ( + (bmstrcasestr(vcard_get_prop(v, "n", 0, 0, 0), search_string)) + ) { + cprintf("%s\n", vcard_get_prop(v, "email", 1, 0, 0)); + } + + vcard_free(v); +} + + + +/* + * Attempt to autocomplete an address based on a partial... + */ +void cmd_auto(char *argbuf) { + char hold_rm[ROOMNAMELEN]; + char search_string[256]; + + if (CtdlAccessCheck(ac_logged_in)) return; + extract_token(search_string, argbuf, 0, '|', sizeof search_string); + if (strlen(search_string) == 0) { + cprintf("%d You supplied an empty partial.\n", ERROR + ILLEGAL_VALUE); + return; + } + + strcpy(hold_rm, CC->room.QRname); /* save current room */ + + if (getroom(&CC->room, USERCONTACTSROOM) != 0) { + getroom(&CC->room, hold_rm); + lprintf(CTDL_CRIT, "cannot get user contacts room\n"); + cprintf("%d Your address book was not found.\n", ERROR + ROOM_NOT_FOUND); + return; + } + + cprintf("%d try these:\n", LISTING_FOLLOWS); + CtdlForEachMessage(MSGS_ALL, 0, "text/x-vcard", NULL, hunt_for_autocomplete, search_string); + cprintf("000\n"); + + getroom(&CC->room, hold_rm); /* return to saved room */ +} + + +char *serv_autocompletion_init(void) +{ + CtdlRegisterProtoHook(cmd_auto, "AUTO", "Perform recipient autocompletion"); + return "$Id$"; +} diff --git a/citadel/serv_autocompletion.h b/citadel/serv_autocompletion.h new file mode 100644 index 000000000..62f550317 --- /dev/null +++ b/citadel/serv_autocompletion.h @@ -0,0 +1,7 @@ +/* + * $Id$ + * + */ + + +char *serv_autocompletion_init(void); diff --git a/citadel/serv_extensions.c b/citadel/serv_extensions.c index e6922b8ce..e5cf68524 100644 --- a/citadel/serv_extensions.c +++ b/citadel/serv_extensions.c @@ -101,29 +101,30 @@ int DLoader_Exec_Cmd(char *cmdbuf) void initialize_server_extensions(void) { - serv_bio_init(); - serv_calendar_init(); - serv_notes_init(); - serv_ldap_init(); - serv_chat_init(); - serv_expire_init(); - serv_imap_init(); - serv_inetcfg_init(); - serv_listsub_init(); - serv_mrtg_init(); - serv_netfilter_init(); - serv_network_init(); - serv_newuser_init(); - serv_pas2_init(); - serv_pop3_init(); - serv_rwho_init(); - serv_smtp_init(); - serv_spam_init(); - /* serv_test_init(); */ - serv_upgrade_init(); - serv_vandelay_init(); - serv_vcard_init(); - serv_fulltext_init(); + lprintf(CTDL_INFO, "%s\n", serv_bio_init()); + lprintf(CTDL_INFO, "%s\n", serv_calendar_init()); + lprintf(CTDL_INFO, "%s\n", serv_notes_init()); + lprintf(CTDL_INFO, "%s\n", serv_ldap_init()); + lprintf(CTDL_INFO, "%s\n", serv_chat_init()); + lprintf(CTDL_INFO, "%s\n", serv_expire_init()); + lprintf(CTDL_INFO, "%s\n", serv_imap_init()); + lprintf(CTDL_INFO, "%s\n", serv_inetcfg_init()); + lprintf(CTDL_INFO, "%s\n", serv_listsub_init()); + lprintf(CTDL_INFO, "%s\n", serv_mrtg_init()); + lprintf(CTDL_INFO, "%s\n", serv_netfilter_init()); + lprintf(CTDL_INFO, "%s\n", serv_network_init()); + lprintf(CTDL_INFO, "%s\n", serv_newuser_init()); + lprintf(CTDL_INFO, "%s\n", serv_pas2_init()); + lprintf(CTDL_INFO, "%s\n", serv_pop3_init()); + lprintf(CTDL_INFO, "%s\n", serv_rwho_init()); + lprintf(CTDL_INFO, "%s\n", serv_smtp_init()); + lprintf(CTDL_INFO, "%s\n", serv_spam_init()); + /* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */ + lprintf(CTDL_INFO, "%s\n", serv_upgrade_init()); + lprintf(CTDL_INFO, "%s\n", serv_vandelay_init()); + lprintf(CTDL_INFO, "%s\n", serv_vcard_init()); + lprintf(CTDL_INFO, "%s\n", serv_fulltext_init()); + lprintf(CTDL_INFO, "%s\n", serv_autocompletion_init()); } diff --git a/citadel/serv_extensions.h b/citadel/serv_extensions.h index 6f6543ab9..a3974ecae 100644 --- a/citadel/serv_extensions.h +++ b/citadel/serv_extensions.h @@ -33,6 +33,7 @@ char *serv_upgrade_init(void); char *serv_vandelay_init(void); char *serv_vcard_init(void); char *serv_fulltext_init(void); +char *serv_autocompletion_init(void); /* */ diff --git a/citadel/techdoc/protocol.txt b/citadel/techdoc/protocol.txt index 85e6de4dc..fac6a6bbe 100644 --- a/citadel/techdoc/protocol.txt +++ b/citadel/techdoc/protocol.txt @@ -2183,6 +2183,17 @@ asynchronous messages as they arrive, before doing anything else. + AUTO (AUTOcompletion of email addresses) + + The AUTO command is used by clients which want to request a list of email +recipients whose names or email addresses match a partial string supplied by +the client. This string is the only parameter passed to this command. The +command will return ERROR if no user is logged in or if no address book could +be found; otherwise, it returns LISTING_FOLLOWS followed by zero or more +candidate recipients. + + + SRCH (SeaRCH the message base) This command's implementation is incomplete and will be documented when it