On Sun, Sep 26, 1999 at 01:04:12AM +0200, Stasinos Konstantopoulos wrote: > I do have strict_threads set, and I think it's a good thing to have it > so, but I would also like to be able to manually, explicitly add the > odd message to a thread if I need to. The following solution is kind of a hack, but you might like it. If have tested the code a little, but be careful with it. It is probably not that robust yet. I have a attached two files: getreply and setreply. The first one takes a email message as standard input and saves the message-id in a file /home/user/Mail/id-file (change this file to what you like). In my .muttrc I put: macro index "\Cxg" "|getreply\n" So, typing Control-g on a message will set the message id. The second script will open a file given on the command line and try to set the in-reply-to field with the message-id found in the file /home/user/Mail/id-file. Then it saves the file. In my .muttrc I put macro index "\Cxs" ":set editor=setreply\new\nqnd:set editor=vi\n" So, first the editor is set to setreply. Then e for edit is pressed (this might be something else in your settings). Then w for write and \n to accept the current mailbox. Then q for abort en n for not postponing and finally d to delete the old message. Then set the editor back to vi (of whatever you had before). Anyhow, read the code of setreply and improve on it, because it is not very good yet. Also, if somebody sees that I am doing something fundamentally wrong, I would like to know. Hope this helps, Richard -- So what's the speed of dark?
#!/usr/bin/perl $/ = ""; $header = <>; $header =~ /\nMessage-Id\: (.*)\n/; $id = $1; open(ID, ">/home/user/Mail/id-file") or die "Cannot open id-file: $!\n"; print ID $id, "\n"; print "Wrote id: $id\n"; close ID;
#!/usr/bin/perl $arg = shift; open(MAIL, $arg) or die "Cannot open $arg: $!\n"; open(ID, "/home/user/Mail/id-file") or die "Cannot open file-id: $!\n"; while (<ID>) { $id = $_; last; } exit(1) unless $id; chomp($id); $id .= "\n"; $message = ""; while (<MAIL>) { if (/^In-Reply-To:/) { print; # don't fiddle with this, ok already last; } if (/^\s*$/) { $message .= "In-Reply-To: $id\n"; last; } $message .= $_; } while (<MAIL>) { $message .= $_; } close MAIL; open(MAIL, ">$arg") or die "Cannot open $arg: $!\n"; print MAIL "$message"; close MAIL; close ID;