home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!dkuug!login.dkuug.dk!shj
- From: shj@login.dkuug.dk (Stig Jacobsen)
- Newsgroups: comp.mail.elm
- Subject: Unofficial patch - "lastread" pointers
- Keywords: patch,lastread
- Message-ID: <shj.714951852@login.dkuug.dk>
- Date: 27 Aug 92 21:44:12 GMT
- Sender: news@slyrf.dkuug.dk
- Organization: Asis Electronic Intl., Copenhagen, Denmark
- Lines: 94
-
- Crude patch for elm 2.3pl11.. Add -DSHJ=1 to the compiler
- commandline or zap the #if/#endif's to activate after patching.
-
- The patch adds a "lastread" pointer to your alternate folders
- (~/Mail/*), so that when you quit such a folder, elm will record the
- current message in a file and the next time you enter the folder, the
- current message will be set back to the the saved position..
-
- If you are on a couple of mailinglists (I am) and on a bunch of
- aliases (I am!), the "lastread" mechanism avoids the "I can't
- remember how much I've read of this folder, so I'll just read it
- backwards, until I recognize something" cycle.
-
- Also included - your bonus for having read this far - is a
- smallish Perl-script, that lists those folders in which you have
- unread mail (according to the lastread pointer).
- Usage: checklr Mail/*
-
- Enjoy!
-
-
- *** leavembox.c.org Thu Aug 27 22:55:14 1992
- --- leavembox.c Thu Aug 27 23:06:13 1992
- ***************
- *** 318,323 ****
- --- 318,338 ----
- if(headers[i]->status_chgd == TRUE)
- num_chgd_status++;
-
- + #if SHJ
- + if (folder_type == NON_SPOOL) {
- + int h;
- + char tmpname[SLEN];
- +
- + sprintf(tmpname, "%s.lr", cur_folder);
- + if ((h = creat(tmpname, 0600)) < 0) {
- + error1("Can't create %s", tmpname);
- + leave();
- + }
- + write(h, ¤t, sizeof(current));
- + close(h);
- + }
- + #endif
- +
- if(!to_delete && !to_store && !num_chgd_status && !resyncing) {
- dprint(3, (debugfile, "Folder keep as is!\n"));
- error("Folder unchanged.");
- *** newmbox.c.org Thu Aug 27 22:55:21 1992
- --- newmbox.c Thu Aug 27 23:27:09 1992
- ***************
- *** 775,780 ****
- --- 775,798 ----
- }
- }
- }
- +
- + #if SHJ
- + if (folder_type == NON_SPOOL) {
- + int h;
- + char tmpname[SLEN];
- +
- + sprintf(tmpname, "%s.lr", cur_folder);
- + if ((h = open(tmpname, O_RDONLY)) >= 0) {
- + int new_curr;
- +
- + read(h, &new_curr, sizeof(new_curr));
- + close(h);
- + if (new_curr <= count)
- + current = new_curr;
- + }
- + }
- + #endif
- +
- get_page(current);
- return(count);
- }
-
-
- checklr.pl:
-
- #!/usr/local/bin/perl
- foreach $nm (@ARGV) {
- if (open(LR, "$nm" . ".lr")) {
- read(LR, $s, 8);
- $lrpos = unpack("i", $s);
- $n_msgs = `grep -c '^From ' $nm`;
- $n_msgs -= $lrpos;
- printf("%s: %d unread messages.\n",
- substr($nm, rindex($nm, "/")+1), $n_msgs) if ($n_msgs > 0);
- }
- }
- --
- Stig Jacobsen
- shj@login.dkuug.dk
-