$Log$
+ Revision 647.18 2005/05/22 16:12:25 ajc
+ * Full text indexer is now switchable on/off
+
Revision 647.17 2005/05/20 20:02:50 ajc
* The IGnet map is now rewritten to disk only when it changes.
* When processing inbound network spool, ignore "." and ".." instead of
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
/*
* Text description of this software
*/
-#define CITADEL "Citadel 6.47"
+#define CITADEL "Citadel 6.51"
/*
* REV_LEVEL is the current version number (multiplied by 100 to avoid having
* usually more strict because you're not really supposed to dump/load and
* upgrade at the same time.
*/
-#define REV_LEVEL 647 /* This version */
+#define REV_LEVEL 651 /* This version */
#define REV_MIN 591 /* Oldest compatible database */
#define EXPORT_REV_MIN 626 /* Oldest compatible export files */
#define EXPIRE_AGE 3 /* Expire messages after n days */
-/*
- * Global system configuration.
- *
- * Developers: please do NOT remove the fields labelled "not in use". We
- * can't simply remove them from the struct, because this gets written to
- * disk, and if you change it then you'll break all existing systems.
- * However, if you'd like to reclaim some of that space for another use, feel
- * free to do so, as long as the sizes are kept identical.
- */
-struct config {
- char c_nodename[16]; /* Unqualified "short" nodename */
- char c_fqdn[64]; /* Fully Qualified Domain Name */
- char c_humannode[21]; /* Long name of system */
- char c_phonenum[16]; /* Dialup number of system */
- uid_t c_ctdluid; /* UID under which we run Citadel */
- char c_creataide; /* room creator = room aide flag */
- int c_sleeping; /* watchdog timer setting */
- char c_initax; /* initial access level */
- char c_regiscall; /* call number to register on */
- char c_twitdetect; /* twit detect flag */
- char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */
- char c_moreprompt[80]; /* paginator prompt */
- char c_restrict; /* restrict Internet mail flag */
- long c_niu_1; /* (not in use) */
- char c_site_location[32]; /* physical location of server */
- char c_sysadm[26]; /* name of system administrator */
- char c_niu_2[15]; /* (not in use) */
- int c_setup_level; /* what rev level we've setup to */
- int c_maxsessions; /* maximum concurrent sessions */
- char c_ip_addr[20]; /* IP address to listen on */
- int c_port_number; /* Cit listener port (usually 504) */
- int c_ipgm_secret; /* Internal program authentication */
- struct ExpirePolicy c_ep; /* System default msg expire policy */
- int c_userpurge; /* System default user purge (days) */
- int c_roompurge; /* System default room purge (days) */
- char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */
- char c_createax; /* Axlevel required to create rooms */
- long c_maxmsglen; /* Maximum message length */
- int c_min_workers; /* Lower limit on number of threads */
- int c_max_workers; /* Upper limit on number of threads */
- int c_pop3_port; /* POP3 listener port (usually 110) */
- int c_smtp_port; /* SMTP listener port (usually 25) */
- int c_rfc822_strict_from; /* 1 = don't correct From: forgeries*/
- int c_aide_zap; /* Are Aides allowed to zap rooms? */
- int c_imap_port; /* IMAP listener port (usually 143) */
- time_t c_net_freq; /* how often to run the networker */
- char c_disable_newu; /* disable NEWU command */
- char c_niu_4; /* (not in use) */
- char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */
- char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */
- int c_purge_hour; /* Hour during which db purges run */
- struct ExpirePolicy c_mbxep; /* Expire policy for mailbox rooms */
- char c_ldap_host[128]; /* Host where LDAP service lives */
- int c_ldap_port; /* Port on host where LDAP lives */
- char c_ldap_base_dn[256]; /* LDAP base DN */
- char c_ldap_bind_dn[256]; /* LDAP bind DN */
- char c_ldap_bind_pw[256]; /* LDAP bind password */
- int c_msa_port; /* SMTP MSA listener port (usu 587) */
- int c_imaps_port; /* IMAPS listener port (usually 993)*/
- int c_pop3s_port; /* POP3S listener port (usually 995)*/
- int c_smtps_port; /* SMTPS listener port (usually 465)*/
-};
-
/*
* This struct stores a list of rooms with new messages which the client
* fetches from the server. This allows the client to "march" through
#include "serv_extensions.h"
+/*
+ * Global system configuration.
+ *
+ * Developers: please do NOT remove the fields labelled "not in use". We
+ * can't simply remove them from the struct, because this gets written to
+ * disk, and if you change it then you'll break all existing systems.
+ * However, if you'd like to reclaim some of that space for another use, feel
+ * free to do so, as long as the sizes are kept identical.
+ */
+struct config {
+ char c_nodename[16]; /* Unqualified "short" nodename */
+ char c_fqdn[64]; /* Fully Qualified Domain Name */
+ char c_humannode[21]; /* Long name of system */
+ char c_phonenum[16]; /* Dialup number of system */
+ uid_t c_ctdluid; /* UID under which we run Citadel */
+ char c_creataide; /* room creator = room aide flag */
+ int c_sleeping; /* watchdog timer setting */
+ char c_initax; /* initial access level */
+ char c_regiscall; /* call number to register on */
+ char c_twitdetect; /* twit detect flag */
+ char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */
+ char c_moreprompt[80]; /* paginator prompt */
+ char c_restrict; /* restrict Internet mail flag */
+ long c_niu_1; /* (not in use) */
+ char c_site_location[32]; /* physical location of server */
+ char c_sysadm[26]; /* name of system administrator */
+ char c_niu_2[15]; /* (not in use) */
+ int c_setup_level; /* what rev level we've setup to */
+ int c_maxsessions; /* maximum concurrent sessions */
+ char c_ip_addr[20]; /* IP address to listen on */
+ int c_port_number; /* Cit listener port (usually 504) */
+ int c_ipgm_secret; /* Internal program authentication */
+ struct ExpirePolicy c_ep; /* System default msg expire policy */
+ int c_userpurge; /* System default user purge (days) */
+ int c_roompurge; /* System default room purge (days) */
+ char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */
+ char c_createax; /* Axlevel required to create rooms */
+ long c_maxmsglen; /* Maximum message length */
+ int c_min_workers; /* Lower limit on number of threads */
+ int c_max_workers; /* Upper limit on number of threads */
+ int c_pop3_port; /* POP3 listener port (usually 110) */
+ int c_smtp_port; /* SMTP listener port (usually 25) */
+ int c_rfc822_strict_from; /* 1 = don't correct From: forgeries*/
+ int c_aide_zap; /* Are Aides allowed to zap rooms? */
+ int c_imap_port; /* IMAP listener port (usually 143) */
+ time_t c_net_freq; /* how often to run the networker */
+ char c_disable_newu; /* disable NEWU command */
+ char c_enable_fulltext; /* enable full text indexing */
+ char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */
+ char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */
+ int c_purge_hour; /* Hour during which db purges run */
+ struct ExpirePolicy c_mbxep; /* Expire policy for mailbox rooms */
+ char c_ldap_host[128]; /* Host where LDAP service lives */
+ int c_ldap_port; /* Port on host where LDAP lives */
+ char c_ldap_base_dn[256]; /* LDAP base DN */
+ char c_ldap_bind_dn[256]; /* LDAP bind DN */
+ char c_ldap_bind_pw[256]; /* LDAP bind password */
+ int c_msa_port; /* SMTP MSA listener port (usu 587) */
+ int c_imaps_port; /* IMAPS listener port (usually 993)*/
+ int c_pop3s_port; /* POP3S listener port (usually 995)*/
+ int c_smtps_port; /* SMTPS listener port (usually 465)*/
+};
+
+
void get_config(void);
void put_config(void);
extern struct config config;
cprintf("%d\n", config.c_imap_port);
cprintf("%ld\n", config.c_net_freq);
cprintf("%d\n", config.c_disable_newu);
- cprintf("1\n"); /* no longer in use */
+ cprintf("%d\n", config.c_enable_fulltext);
cprintf("%d\n", config.c_purge_hour);
#ifdef HAVE_LDAP
cprintf("%s\n", config.c_ldap_host);
config.c_disable_newu = 1;
break;
case 30:
- /* no longer in use */
+ config.c_enable_fulltext = atoi(buf);
break;
case 31:
if ((config.c_purge_hour >= 0)
ret = imap_grabroom(roomname, parms[2], 0);
if (ret != 0) {
- cprintf("%s NO Invalid mailbox name or location, or access denied\r\n",
+ cprintf("%s NO Invalid mailbox name or access denied\r\n",
parms[0]);
return;
}
/* If there is a BODY search criterion in the query, use our full
* text index to disqualify messages that don't have any chance of
- * matching.
+ * matching. (Only do this if the index is enabled!!)
*/
- for (i=0; i<(num_items-1); ++i) {
+ if (config.c_enable_fulltext) for (i=0; i<(num_items-1); ++i) {
if (!strcasecmp(itemlist[i], "BODY")) {
ft_search(&fts_num_msgs, &fts_msgs, itemlist[i+1]);
if (fts_num_msgs > 0) {
#include "room_ops.h"
#include "user_ops.h"
#include "file_ops.h"
+#include "config.h"
#include "control.h"
#include "tools.h"
#include "mime_parser.h"
#include "internet_addressing.h"
#include "serv_fulltext.h"
-extern struct config config;
long config_msgnum;
memset(is_set, 0, (num_msgs * sizeof(char)) );
/* Decide which message set we're manipulating */
- if (which_set == ctdlsetseen_seen) safestrncpy(vset, vbuf.v_seen, sizeof vset);
- if (which_set == ctdlsetseen_answered) safestrncpy(vset, vbuf.v_answered, sizeof vset);
+ switch(which_set) {
+ case ctdlsetseen_seen:
+ safestrncpy(vset, vbuf.v_seen, sizeof vset);
+ break;
+ case ctdlsetseen_answered:
+ safestrncpy(vset, vbuf.v_answered, sizeof vset);
+ break;
+ }
- lprintf(CTDL_DEBUG, "before optimize: %s\n", vset);
+ /* lprintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
/* Translate the existing sequence set into an array of booleans */
num_sets = num_tokens(vset, ',');
}
/* Decide which message set we're manipulating */
- if (which_set == ctdlsetseen_seen) safestrncpy(vbuf.v_seen, vset, sizeof vbuf.v_seen);
- if (which_set == ctdlsetseen_answered) safestrncpy(vbuf.v_answered, vset, sizeof vbuf.v_answered);
+ switch (which_set) {
+ case ctdlsetseen_seen:
+ safestrncpy(vbuf.v_seen, vset, sizeof vbuf.v_seen);
+ break;
+ case ctdlsetseen_answered:
+ safestrncpy(vbuf.v_answered, vset,
+ sizeof vbuf.v_answered);
+ break;
+ }
free(is_set);
- lprintf(CTDL_DEBUG, " after optimize: %s\n", vset);
+ /* lprintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
free(msglist);
CtdlSetRelationship(&vbuf, &CC->user, &CC->room);
}
}
/* Bump this user's messages posted counter. */
- lprintf(CTDL_DEBUG, "Updating user\n");
+ lprintf(CTDL_DEBUG, "Updating user (FIXME defer this)\n");
lgetuser(&CC->user, CC->curr_user);
CC->user.posted = CC->user.posted + 1;
lputuser(&CC->user);
*/
begin_critical_section(S_SUPPMSGMAIN);
GetMetaData(&smi, msgnum);
- lprintf(CTDL_DEBUG, "Ref count for message <%ld> before write is <%d>\n",
- msgnum, smi.meta_refcount);
smi.meta_refcount += incr;
PutMetaData(&smi);
end_critical_section(S_SUPPMSGMAIN);
- lprintf(CTDL_DEBUG, "Ref count for message <%ld> after write is <%d>\n",
- msgnum, smi.meta_refcount);
+ lprintf(CTDL_DEBUG, "msg %ld ref count incr %d, is now %d\n",
+ msgnum, incr, smi.meta_refcount);
/* If the reference count is now zero, delete the message
* (and its supplementary record as well).
cdb_free(cdbfr);
}
- lprintf(CTDL_DEBUG, " *** START COUNT *** \n");
total_messages = 0;
for (a=0; a<num_msgs; ++a) {
if (msglist[a] > 0L) ++total_messages;
}
}
}
- lprintf(CTDL_DEBUG, " *** END COUNT *** \n");
new_messages = total_messages - old_messages;
if (msglist != NULL) free(msglist);
strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
strprompt("Hour to run purges (0-23)", &sc[31][0], 2);
+ snprintf(sc[30], sizeof sc[30], "%d", (boolprompt(
+ "Enable full text search index (warning: resource intensive)",
+ atoi(&sc[30][0]))));
/* Save it */
scr_printf("Save this configuration? ");
static time_t last_index = 0L;
static time_t last_progress = 0L;
+ /*
+ * Don't do this if the site doesn't have it enabled.
+ */
+ if (!config.c_enable_fulltext) {
+ return;
+ }
+
/*
* Make sure we don't run the indexer too frequently.
* FIXME move the setting into config
char search_string[256];
if (CtdlAccessCheck(ac_logged_in)) return;
+
+ if (!config.c_enable_fulltext) {
+ cprintf("%d Full text index is not enabled on this server.\n",
+ ERROR + CMD_NOT_SUPPORTED);
+ }
+
extract_token(search_string, argbuf, 0, '|', sizeof search_string);
ft_search(&num_msgs, &msgs, search_string);
return;
}
- /* Check to see if the room's contents have changed. If not, we can avoid rescan */
+ /*
+ * Check to see if the room's contents have changed.
+ * If not, we can avoid this rescan.
+ */
getroom(&CC->room, CC->room.QRname);
if (IMAP->last_mtime == CC->room.QRmtime) { /* No changes! */
return;
if (message_still_exists == 0) {
cprintf("* %d EXPUNGE\r\n", i + 1);
- /* Here's some nice stupid nonsense. When a message
- * is expunged, we have to slide all the existing
- * messages up in the message array.
+ /* Here's some nice stupid nonsense. When a
+ * message is expunged, we have to slide all
+ * the existing messages up in the message
+ * array.
*/
--IMAP->num_msgs;
memcpy(&IMAP->msgids[i],
/*
* Now peruse the room for *new* messages only.
*/
- if (num_msgs > 0)
+ if (num_msgs > 0) {
for (j = 0; j < num_msgs; ++j) {
if (msglist[j] > original_highest) {
imap_add_single_msgid(msglist[j], NULL);
}
}
+ }
imap_set_seen_flags();
/*
strcpy(config.c_ip_addr, "0.0.0.0");
}
+ if (CitControl.version < 650) {
+ config.c_enable_fulltext = 0;
+ }
+
put_config();
}