Package: coolmail Version: 1.3-7 Severity: wishlist Tags: patch
I wanted coolmail to be able to track more than one mail spool. Here's a patch that will accept up to MAX_MAIL_FILES mail spools as -f arguments (and silently ignores any extra -f arguments). Here's the patch: ----------------------- BEGIN PATCH ----------------------- *** coolmail.c-new Fri Jun 3 23:23:07 2005 --- coolmail.c Fri Jun 3 23:14:38 2005 *************** *** 36,44 **** #include "render1.h" #include "mailbox.h" - #ifndef MAX_MAIL_FILES - #define MAX_MAIL_FILES 5 - #endif #define DEFAULT_MAIL_DIR "/var/spool/mail/" #define DEFAULT_COMMAND "xterm -n Elm -e mail\0" --- 36,41 ---- *************** *** 53,60 **** #define PI 3.1415926536 #endif - char *cuserid(char *); - polygon_t flag[2], cube2[5], letter[1], post[6], ground[1]; int_point_t flag_ints[2][4], cube2_ints[5][4], --- 50,55 ---- *************** *** 63,70 **** ground_ints[1][4]; char command_str[1024] = DEFAULT_COMMAND; ! char mailfile_str[MAX_MAIL_FILES][1024]; ! unsigned int mailfiles = 0; unsigned long interval = DEFAULT_INTERVAL*1000; unsigned int frames = DEFAULT_FRAMES; int verbose = 0; --- 58,64 ---- ground_ints[1][4]; char command_str[1024] = DEFAULT_COMMAND; ! char mailfile_str[1024] = DEFAULT_MAIL_DIR; unsigned long interval = DEFAULT_INTERVAL*1000; unsigned int frames = DEFAULT_FRAMES; int verbose = 0; *************** *** 113,136 **** return(0); /* Get the username and use it to create a default mailfile name */ - strcpy(mailfile_str[0], DEFAULT_MAIL_DIR); #ifdef SUPPORT_MAILDIR if (getenv("MAILDIR") && strlen(getenv("MAILDIR"))) { ! strcpy(mailfile_str[0],getenv("MAILDIR")); } else if (getenv("MAIL") && strlen(getenv("MAIL"))) { ! strcpy(mailfile_str[0],getenv("MAIL")); } else #endif ! strcat(mailfile_str[0], cuserid(username)); /* Initialize the renderer */ rend_init(&argc, argv, (float)150.0); cool_parseargs(argc, argv); - if (!mailfiles) - mailfiles = 1; if (verbose) ! printf("Coolmail %s watching file: %s\n", Version, mailfile_str[0]); define_shapes(); rend_register_obj(1, 2); --- 107,127 ---- return(0); /* Get the username and use it to create a default mailfile name */ #ifdef SUPPORT_MAILDIR if (getenv("MAILDIR") && strlen(getenv("MAILDIR"))) { ! strcpy(mailfile_str,getenv("MAILDIR")); } else if (getenv("MAIL") && strlen(getenv("MAIL"))) { ! strcpy(mailfile_str,getenv("MAIL")); } else #endif ! strcat(mailfile_str, cuserid(username)); /* Initialize the renderer */ rend_init(&argc, argv, (float)150.0); cool_parseargs(argc, argv); if (verbose) ! printf("Coolmail %s watching file: %s\n", Version, mailfile_str); define_shapes(); rend_register_obj(1, 2); *************** *** 345,372 **** time_t newsize; int anymail, newmail, unreadmail; - int anymails, newmails, unreadmails; - int i; ! anymails = newmails = unreadmails = 0; ! for (i=0; i<mailfiles; ++i) ! { ! cool_get_inboxstatus(mailfile_str[i], &anymail, &unreadmail, &newmail); ! anymails += anymail; ! newmails += newmail; ! unreadmails += unreadmail; ! } ! if (anymails) cool_put_envelope(); else cool_remove_envelope(); ! if (unreadmails) cool_raise_flag(frames); else cool_lower_flag(frames); ! if (newmails) cool_alarm(); } --- 336,354 ---- time_t newsize; int anymail, newmail, unreadmail; ! cool_get_inboxstatus(mailfile_str, &anymail, &unreadmail, &newmail); ! if (anymail) cool_put_envelope(); else cool_remove_envelope(); ! if (unreadmail) cool_raise_flag(frames); else cool_lower_flag(frames); ! if (newmail) cool_alarm(); } *************** *** 380,392 **** if (!strcmp(argv[i], "-f")) { i++; ! if (mailfiles<MAX_MAIL_FILES) ! { ! strncpy(mailfile_str[mailfiles++], argv[i], 1023); ! #ifdef SUPPORT_MAILDIR_DEBUG ! printf("mailfiles=%d\n", mailfiles); ! #endif ! } } else if (!strcmp(argv[i], "-e")) { --- 362,368 ---- if (!strcmp(argv[i], "-f")) { i++; ! strncpy(mailfile_str, argv[i], 1023); } else if (!strcmp(argv[i], "-e")) { ------------------------ END PATCH ------------------------ -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: powerpc (ppc) Kernel: Linux 2.6.11-powerpc-smp Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages coolmail depends on: ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an ii libx11-6 4.3.0.dfsg.1-13 X Window System protocol client li ii libxext6 4.3.0.dfsg.1-13 X Window System miscellaneous exte ii libxt6 4.3.0.dfsg.1-13 X Toolkit Intrinsics ii xlibs 4.3.0.dfsg.1-13 X Keyboard Extension (XKB) configu -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]