Package: xlassie
Version: 1.8-12
Severity: wishlist
Tags: patch
Here is a small patch on xlassie to make it able to retrieve information
from any IMAP folder. It adds a command-line option, --imapfolder, with
the default value "INBOS" so that the default behaviour is unchanged.
It is helpful for one who have a large IMAP box, with various folders,
and a tool like imapfilter which is sorting things out in daemon mode.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages xlassie depends on:
ii libc6 2.3.6-16 GNU C Library: Shared libraries
ii libx11-6 2:1.0.0-7 X11 client-side library
ii libxext6 1:1.0.0-4 X11 miscellaneous extension librar
ii libxt6 1:1.0.0-5 X11 toolkit intrinsics library
xlassie recommends no packages.
-- no debconf information
Here is the patch:
diff -u xlassie-1.8/xlassie.c xlassie-now/xlassie-1.8/xlassie.c
--- xlassie-1.8/xlassie.c 2004-11-24 11:35:31.000000000 +0100
+++ xlassie-now/xlassie-1.8/xlassie.c 2004-11-24 11:31:15.000000000 +0100
@@ -57,6 +57,7 @@
int Number;
int Interval=INTERVAL_SPOOL;
char SpoolFile[256];
+char FolderName[1024];
char Command[256];
char Username[32];
char Password[32];
@@ -271,6 +272,7 @@
printf(" -apop3 <server> Like -pop3, but uses a diferent
method.\n");
printf(" Use when -pop3 doesn't find the
correct number\n");
printf(" -imap <server> Use the IMAP protocol instead of
pop3\n");
+ printf(" -imapfolder <folder> Use this folder instead of
INBOX\n");
printf(" -username <name> Username for pop3/imap server.\n"
" Use when different from local
username\n");
printf(" -password <word> Password to use on pop3/imap
server.\n");
@@ -299,6 +301,7 @@
{
int i;
int intervalused=0;
+ strcpy(FolderName,"INBOX");
for(i=1;i<argc;i++) {
if(!strcmp(argv[i],"-fg")) {
@@ -356,6 +359,9 @@
strcpy(SpoolFile,argv[i]);
Options|=USE_IMAP;
if(!intervalused) Interval=INTERVAL_POP3;
+ } else if(!strcmp(argv[i],"-imapfolder")) {
+ if(++i==argc) { usage(); exit(2); };
+ strcpy(FolderName,argv[i]);
} else if(!strcmp(argv[i],"-username")) {
if(++i==argc) { usage(); exit(2); };
strcpy(Username,argv[i]);
@@ -874,17 +880,23 @@
int count_mail_imap()
{
FILE *f;
+ char srch1[128];
+ char srch2[128];
char buf[128];
int total=0;
f = imap_login();
if(f==NULL) return -1;
- fflush(f); fprintf(f, "a003 STATUS INBOX (UNSEEN)\r\n");
+ verbose("To server: a003 STATUS %s (UNSEEN)\r\n",FolderName);
+ fflush(f); fprintf(f, "a003 STATUS %s (UNSEEN)\r\n",FolderName);
fflush(f); fgets(buf, 127, f);
- if(!sscanf(buf, "* STATUS INBOX (UNSEEN %d)", &total) &&
- !sscanf(buf, "* STATUS \"INBOX\" (UNSEEN %d)", &total)) {
+ sprintf(srch1,"* STATUS %s (UNSEEN %%d)",FolderName);
+ sprintf(srch2,"* STATUS \"%s\" (UNSEEN %%d)",FolderName);
+ if(!sscanf(buf, srch1, &total) &&
+ !sscanf(buf, srch2, &total)) {
fprintf(stderr, "Couldn't understand response from server\n");
+ fprintf(stderr, "while searching: %s\nor %s\n",srch1,srch2);
fprintf(stderr, "%s", buf);
return 0;
}
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]