Article View: news.software.readers
Article #127439Re: slrn - Will it show uptime like Mutt?
From: Matt H
Date: Tue, 01 Jul 2003 04:12
Date: Tue, 01 Jul 2003 04:12
83 lines
4123 bytes
4123 bytes
On Sun, 29 Jun 2003 23:43:09 GMT,
Crashdamage <tmeador@nospam.invalid> wrote:
> On Sun, 29 Jun 2003 22:22:09 GMT, Matt H <nntp@cox.net> wrote:
>> On Sun, 29 Jun 2003 22:29:23 GMT,
>> Crashdamage <tmeador@nospam.invalid> wrote:
>>
>>> But neither one works like I'd like. Both knock out any custom headers
>>> and ingore the sed command to strip away unecessary uptime info, so I'll
>>> work on getting Emannuele Bassi's new macro working. That, particulary
>>> when used with the "set_preferences" macro, seems like they'll make a
>>> nice combination that will do what I want - hopefully including picking
>>> up on that sed string - and make future header changes easy.
>>
>> This might help,
>> Message-ID: <slrnbfuo41.ci4.nntp@distraction.ath.cx>
>
> Thanks, I'll look into it later.
>
> Meanwhile, I tried your macro - it works, partially. It's ok on new posts,
> leaves "X-Newsreader: SLRN..." custom_header alone and adds the uptime
> header, just perfect (except, of course, for the verbose uptime). But on
> followups, the uptime is there but the X-Newsreader followup_custom_header
> is still trashed.
> A little cut+paste action to try and fix it didn't work - don't even ask
> what I tried, it was raw noob stuff, that's all that needs to be said about
> that. Anyway, it's close, very close...
Okay, here's one that keeps custom_headers and followup_custom_headers:
======================================================================
% hooks.sl
define get_uptime () {
variable uptime;
variable buf;
variable fp;
variable cmd;
uptime = "";
cmd = sprintf("uptime");
fp = popen(cmd,"r");
if (fp == NULL) {
message("Can not include uptime...");
}
else {
buf = "";
while (-1 != fgets(&buf, fp)) {
uptime = sprintf("%s%s", uptime, buf);
} () = pclose(fp);
} return uptime;
}
define post_hook_uptime () {
variable uptime;
variable och;
och = get_variable_value ("custom_headers");
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("custom_headers", sprintf("%s%s%s", och, "\n", uptime));
}
define followup_hook_uptime () {
variable uptime;
variable ofch;
ofch = get_variable_value("followup_custom_headers");
uptime = get_uptime();
uptime = sprintf("X-Uptime: %s", uptime);
set_string_variable("followup_custom_headers", sprintf("%s%s%s", ofch, "\n", uptime));
}
define post_hook () {
post_hook_uptime();
}
define followup_hook () {
followup_hook_uptime();
% end hooks.sl
===============================================================================
Let me know if there are any problems with this one, and if I can I'll try
to fix them.
Technical Details
Message-ID:
<slrnbg22i2.h3o.nntp@distraction.ath.cx>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!east.cox.net!cox.net!p01!fed1read07.POSTED!not-for-mailReferences:
<5b5d4e99f7010bc79d6f175b05231f5a@free.teranews.com> <slrnbfrmte.l0t.preater@preater.com> <84cd9d5b82ec8563b17b9f8e4007df6a@free.teranews.com> <slrnbfujts.ctj.preater@preater.com> <d28b118311b518af9114bc6dc4a187d5@free.teranews.com> <slrnbfupkf.d5l.nntp@distraction.ath.cx> <b5db14ca5772350c9eb02d88da1b7ae6@free.teranews.com>Show Full Headers
Complete Article Headers
Message-ID: <slrnbg22i2.h3o.nntp@distraction.ath.cx> Subject: Re: slrn - Will it show uptime like Mutt? Date: Tue, 01 Jul 2003 04:12:56 GMT From: Matt H <nntp@cox.net> References: <5b5d4e99f7010bc79d6f175b05231f5a@free.teranews.com> <slrnbfrmte.l0t.preater@preater.com> <84cd9d5b82ec8563b17b9f8e4007df6a@free.teranews.com> <slrnbfujts.ctj.preater@preater.com> <d28b118311b518af9114bc6dc4a187d5@free.teranews.com> <slrnbfupkf.d5l.nntp@distraction.ath.cx> <b5db14ca5772350c9eb02d88da1b7ae6@free.teranews.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!east.cox.net!cox.net!p01!fed1read07.POSTED!not-for-mail Newsgroups: news.software.readers X-Operating-System: RedHat 9 X-Kernel-Version: 2.4.20-18.9 X-Uptime: 21:08:46 up 20:11, 3 users, load average: 1.62, 1.40, 1.13 User-Agent: slrn/0.9.7.4 (Linux) Lines: 83 NNTP-Posting-Host: 68.3.8.202 X-Complaints-To: abuse@cox.net X-Trace: fed1read07 1057032776 68.3.8.202 (Tue, 01 Jul 2003 00:12:56 EDT) NNTP-Posting-Date: Tue, 01 Jul 2003 00:12:56 EDT Organization: Cox Communications