-/*
- * Perform sieve processing for all rooms which require it
- */
-void perform_sieve_processing(void) {
- struct RoomProcList *ptr = NULL;
-
- if (sieve_list != NULL) {
- syslog(LOG_DEBUG, "Begin Sieve processing");
- while (sieve_list != NULL) {
- char spoolroomname[ROOMNAMELEN];
- safestrncpy(spoolroomname, sieve_list->name, sizeof spoolroomname);
- begin_critical_section(S_SIEVELIST);
-
- /* pop this record off the list */
- ptr = sieve_list;
- sieve_list = sieve_list->next;
- free(ptr);
-
- /* invalidate any duplicate entries to prevent double processing */
- for (ptr=sieve_list; ptr!=NULL; ptr=ptr->next) {
- if (!strcasecmp(ptr->name, spoolroomname)) {
- ptr->name[0] = 0;
- }
- }
-
- end_critical_section(S_SIEVELIST);
- if (spoolroomname[0] != 0) {
- sieve_do_room(spoolroomname);
- }
- }
- }
-}
-
-
-void msiv_load(struct sdm_userdata *u) {
- char hold_rm[ROOMNAMELEN];
-
- strcpy(hold_rm, CC->room.QRname); /* save current room */
-
- /* Take a spin through the user's personal address book */
- if (CtdlGetRoom(&CC->room, USERCONFIGROOM) == 0) {
-
- u->config_msgnum = (-1);
- strcpy(u->config_roomname, CC->room.QRname);
- CtdlForEachMessage(MSGS_LAST, 1, NULL, SIEVECONFIG, NULL,
- get_sieve_config_backend, (void *)u );
-
- }
-
- if (strcmp(CC->room.QRname, hold_rm)) {
- CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
- }
-}
-
-void msiv_store(struct sdm_userdata *u, int yes_write_to_disk) {
-/*
- * Initialise the sieve configs last processed message number.
- * We don't need to get the highest message number for the users inbox since the systems
- * highest message number will be higher than that and loer than this scripts message number
- * This prevents this new script from processing any old messages in the inbox.
- * Most importantly it will prevent vacation messages being sent to lots of old messages
- * in the inbox.
- */
- u->lastproc = CtdlGetCurrentMessageNumber();
- rewrite_ctdl_sieve_config(u, yes_write_to_disk);
-}
-
-
-/*
- * Select the active script.
- * (Set script_name to an empty string to disable all scripts)
- *
- * Returns 0 on success or nonzero for error.
- */
-int msiv_setactive(struct sdm_userdata *u, char *script_name) {
- int ok = 0;
- struct sdm_script *s;
-
- /* First see if the supplied value is ok */
-
- if (IsEmptyStr(script_name)) {
- ok = 1;
- }
- else {
- for (s=u->first_script; s!=NULL; s=s->next) {
- if (!strcasecmp(s->script_name, script_name)) {
- ok = 1;
- }
- }
- }
-
- if (!ok) return(-1);
-
- /* Now set the active script */
- for (s=u->first_script; s!=NULL; s=s->next) {
- if (!strcasecmp(s->script_name, script_name)) {
- s->script_active = 1;
- }
- else {
- s->script_active = 0;
- }
- }
-
- return(0);
-}