🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
13 messages
13 total messages Started by Gember Breuk Sun, 26 Oct 2003 22:00
{[Dialog] Script writers?
#136217
Author: Gember Breuk
Date: Sun, 26 Oct 2003 22:00
15 lines
1444 bytes
Some friends I tell about Dialog are asking me about some scripts. I'm
not good with them, so I ask here where the good script writers are.

One asks about a script to remove PGP sigs from displayed message, but
my own try did not do it yet. 

Another asks about making space bar make focus go to top of newsgroup
pane after reading new messages, and more new come in above.

I am trying things, but help from experts would be thankful.

Thank you!

-- 
Gem
Re: {[Dialog] Script writers?
#136223
Author: matija
Date: Sun, 26 Oct 2003 23:07
24 lines
2105 bytes
Gember Breuk, completely geschtonkenflapped, wrote:
> Some friends I tell about Dialog are asking me about some scripts. I'm
> not good with them, so I ask here where the good script writers are.

     i'd like to know the same thing ;)


> One asks about a script to remove PGP sigs from displayed message, but
> my own try did not do it yet. 

     that shouldn't be too hard. post your code here and we'll see
     if we can do something about it.


> Another asks about making space bar make focus go to top of newsgroup
> pane after reading new messages, and more new come in above.

     i don't think it's possible.


-- 
there is a cheer. the gnomes have learned a new way to say hooray.   [-shpongle]

address is scrambled - remove SPAMISEVIL to reply
Re: {[Dialog] Script writers?
#136227
Author: Antonio 'Gandalf' Favata
Date: Mon, 27 Oct 2003 00:46
19 lines
2154 bytes
news.software.readers ~ 27/10/2003 00.07 ~ matija:

>> One asks about a script to remove PGP sigs from displayed message, but
>> my own try did not do it yet. 
>      that shouldn't be too hard. post your code here and we'll see
>      if we can do something about it.

I'd like it too.

>> Another asks about making space bar make focus go to top of newsgroup
>> pane after reading new messages, and more new come in above.
>      i don't think it's possible.

This is already in Mantis.
-- 
Fare Well! | 40tude Dialog 2.0.7.1 (in italiano) http://snurl.com/dialog
G          | Advice: News server (it.* e altre) http://news.x-privat.org
                                                     27/10/2003 1.26.51
«'Yes, I am White now,' said Gandalf.»
Re: {[Dialog] Script writers?
#136231
Author: Gember Breuk
Date: Mon, 27 Oct 2003 04:20
85 lines
2965 bytes
On Mon, 27 Oct 2003 00:07:51 +0100, matija wrote:

> Gember Breuk, completely geschtonkenflapped, wrote:
>> Some friends I tell about Dialog are asking me about some scripts. I'm
>> not good with them, so I ask here where the good script writers are.
> 
>      i'd like to know the same thing ;)

Ok, my English is not so good... :-)

>> One asks about a script to remove PGP sigs from displayed message, but
>> my own try did not do it yet. 
> 
>      that shouldn't be too hard. post your code here and we'll see
>      if we can do something about it.

This script works some, but I don't know yet how to do a variable for
different sizes at the bottom.

program OnBeforeSavingMessage;

procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean);
var i,j:integer;
    s:string;
    pgphead:string;
    newhead:string;
    hash:string;
    newhash:string;
    pgpfoot:string;
    newfoot:string;
    
begin
if isemail then exit; 

pgphead:='-----BEGIN PGP SIGNED';
newhead:='(PGP sig removed)';
hash:='Hash: ';
newhash:='';
pgpfoot:='-----BEGIN PGP SIGNAT';
newfoot:='';

for i:=0 to Message.count-1 do
 begin
 s:=message.strings[i];
 j:=pos(pgphead,s);
 if j>0 then
   begin
   delete(s,j,length(pgphead)+15);
   insert(newhead,s,j);
   message.strings[i]:=s;
   end;
 end;
 
for i:=0 to Message.count-1 do 
 begin
 s:=message.strings[i];
 j:=pos(hash,s);
 if j>0 then
   begin
   delete(s,j,length(hash)+10);
   insert(newhash,s,j);  
   message.strings[i]:=s;
  end;
 end;
 
for i:=0 to Message.count-1 do
 begin
 s:=message.strings[i];
 j:=pos(pgpfoot,s);
 if j>0 then
   begin
   delete(s,j,length(pgpfoot)+10);
   insert(newfoot,s,j);
   message.strings[i]:=s;
   end;
 end;
end; 

begin
end.


-- 
Gem
Re: {[Dialog] Script writers?
#136232
Author: Gember Breuk
Date: Mon, 27 Oct 2003 04:24
23 lines
1840 bytes
On Mon, 27 Oct 2003 01:46:50 +0100, Antonio 'Gandalf' Favata wrote:

> news.software.readers ~ 27/10/2003 00.07 ~ matija:
> 
>>> One asks about a script to remove PGP sigs from displayed message, but
>>> my own try did not do it yet. 
>>      that shouldn't be too hard. post your code here and we'll see
>>      if we can do something about it.
> 
> I'd like it too.

Ok, I posted my partly works script for Matija.

>>> Another asks about making space bar make focus go to top of newsgroup
>>> pane after reading new messages, and more new come in above.
>>      i don't think it's possible.
> 
> This is already in Mantis.

Ah good! I can wait then to see if Marcus can fix it. Thank you!

-- 
Gem
Re: {[Dialog] Script writers?
#136236
Author: Jarrod Cifer
Date: Mon, 27 Oct 2003 09:50
12 lines
1962 bytes
Gember Breuk, upon reaching Nirvana, postulated:

> Some friends I tell about Dialog are asking me about some scripts. I'm
> not good with them, so I ask here where the good script writers are. 
> One asks about a script to remove PGP sigs from displayed message, but
> my own try did not do it yet.

You might want to take a look at
http://40tude.com/dialog/wiki/index.php/ScriptNukeYahooAds. You should be
able to change it to meet your needs.
-- 
J. Cifer
Re: {[Dialog] Script writers?
#136245
Author: Gember Breuk
Date: Mon, 27 Oct 2003 12:37
20 lines
1738 bytes
On Mon, 27 Oct 2003 10:50:06 +0100, Jarrod Cifer wrote:

> Gember Breuk, upon reaching Nirvana, postulated:
> 
>> Some friends I tell about Dialog are asking me about some scripts. I'm
>> not good with them, so I ask here where the good script writers are. 
>> One asks about a script to remove PGP sigs from displayed message, but
>> my own try did not do it yet.
> 
> You might want to take a look at
> http://40tude.com/dialog/wiki/index.php/ScriptNukeYahooAds. You should be
> able to change it to meet your needs.

Yes, I think so! Did you just put that on Wiki? I didn't see it before
this... :-)

If I make it work, you will get all credit! Thank you!

-- 
Gem
Re: {[Dialog] Script writers?
#136248
Author: matija
Date: Mon, 27 Oct 2003 13:14
70 lines
3721 bytes
Gember Breuk, completely geschtonkenflapped, wrote:
>>> One asks about a script to remove PGP sigs from displayed message, but
>>> my own try did not do it yet. 
>>      that shouldn't be too hard. post your code here and we'll see
>>      if we can do something about it.
> This script works some, but I don't know yet how to do a variable for
> different sizes at the bottom.

     i think you took a slightly wrong approach. i admit i don't
     have much PGP-signed posts in my database, but from the looks
     of one such post, i assume it follows this structure:


     -----BEGIN PGP SIGNED MESSAGE-----
     Hash: xxx
     
     (regular message)

     -----BEGIN PGP SIGNATURE-----
     Version: yyy
     
     dfkjhdfsiuerwyefijhdfslkjherreiwuwryeuierwyodfisue
     rewoiurwoweriufdfsljkdflkfsdkldfjdsdlkjfsd
     rwepoierweropiopei
     -----END PGP SIGNATURE-----


     so, try this:


     for i := 0 to message.count-1 do
     begin
       if pos(PGPHead, message.strings[i]) > 0 then
       begin
         // delete the '-----BEGIN PGP SIGNED MESSAGE-----' line
         message.delete(i);
         
         // delete the 'Hash: foo' line which is directly below
         // note: i'm guessing that the message will "shift up"
         // and the 'Hash: foo' line will now be at index "i".
         message.delete(i);
         
         // insert notification
         message.insert(i, '(PGP sig removed)');
         
         // exit the "i" loop, we're done with the header
         break;
       end;
     end;

     // get the location of the PGP signature
     for i := 0 to message.count-1 do
     begin
       // PGPFoot = '-----BEGIN PGP SIGNATURE-----'     
       if pos(PGPFoot, message.strings[i]) > 0 then sigStart := i;
       
       // PGPFootEnd = '-----END PGP SIGNATURE-----'
       if pos(PGPFootEnd, message.strings[i]) > 0 then sigEnd := i;     
     end;

     // don't do anything if the PGP signature is missing/invalid     
     if (sigStart <> 0) and (sigEnd <> 0) then
       // delete the PGP signature
       for n := sigStart to sigEnd do message.delete(n);


-- 
there is a cheer. the gnomes have learned a new way to say hooray.   [-shpongle]

address is scrambled - remove SPAMISEVIL to reply
Re: {[Dialog] Script writers?
#136250
Author: Jarrod Cifer
Date: Mon, 27 Oct 2003 16:28
12 lines
1866 bytes
Gember Breuk, upon reaching Nirvana, postulated:

> Yes, I think so! Did you just put that on Wiki? I didn't see it before
> this... :-)

Yes, a few hours ago.  

> If I make it work, you will get all credit! Thank you!

Marcus Mönnig wrote it, so he should get the credit.
-- 
J. Cifer
Re: {[Dialog] Script writers?
#136253
Author: Gember Breuk
Date: Mon, 27 Oct 2003 17:04
73 lines
2775 bytes
On Mon, 27 Oct 2003 17:28:26 +0100, Jarrod Cifer wrote:

> Gember Breuk, upon reaching Nirvana, postulated:
> 
>> Yes, I think so! Did you just put that on Wiki? I didn't see it before
>> this... :-)
> 
> Yes, a few hours ago.  
> 
>> If I make it work, you will get all credit! Thank you!
> 
> Marcus Mönnig wrote it, so he should get the credit.

I see that in Wiki now, but you showed me, so you get some credit
too... :-)

I want to try Matija's script so maybe it might do it better, but this
is script I have working now:

<---------------------->
program OnBeforeSavingMessage;

const pgp_head='-----BEGIN PGP SIGNED MESSAGE-----';
const pgp_hash='Hash:';
const pgp_sig_start='-----BEGIN PGP SIGNATURE-----';
const pgp_sig_end='-----END PGP SIGNATURE-----';
const maxint=2147483647;

procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean);
var i,j:integer;
    s:string;
    blank_line:string;
    pgp_signed:string;
       
begin
if isemail=true then exit;
s:=message.text;
i:=pos(pgp_head,s);
blank_line:='';

if i>0 then
   begin
   j:=i+pos(pgp_hash,copy(s,i,maxint));
   if j>i then
      begin
      delete(s,i,j-i+length(pgp_hash)+8);
      insert(blank_line,s,j);
      message.text:=s;
      end;
   end;

s:=message.text;
i:=pos(pgp_sig_start,s);
pgp_signed:='[PGP signed]';

   begin
   j:=i+pos(pgp_sig_end,copy(s,i,maxint));
   if j>i then
      begin
      delete(s,i,j-i+length(pgp_sig_end)+1);
      insert(pgp_signed,s,j);
      message.text:=s;
      end;
   end;  
end;

begin
end.
<---------------------->

-- 
Gem
Re: {[Dialog] Script writers?
#136257
Author: Gember Breuk
Date: Mon, 27 Oct 2003 17:08
21 lines
1942 bytes
On Mon, 27 Oct 2003 14:14:09 +0100, matija wrote:

> Gember Breuk, completely geschtonkenflapped, wrote:
>>>> One asks about a script to remove PGP sigs from displayed message, but
>>>> my own try did not do it yet. 
>>>      that shouldn't be too hard. post your code here and we'll see
>>>      if we can do something about it.
>> This script works some, but I don't know yet how to do a variable for
>> different sizes at the bottom.
> 
>      i think you took a slightly wrong approach. i admit i don't
>      have much PGP-signed posts in my database, but from the looks
>      of one such post, i assume it follows this structure:
<snipped nice script>

Thank you! I posted my working script for Jarrod, and I want to try
your way too. I did move the "PGP" note to the bottom, but that
doesn't much matter.

-- 
Gem
Re: {[Dialog] Script writers?
#136265
Author: Ray
Date: Mon, 27 Oct 2003 19:03
19 lines
1715 bytes
On Mon, 27 Oct 2003 10:50:06 +0100, Jarrod Cifer wrote:

> Gember Breuk, upon reaching Nirvana, postulated:
> 
>> Some friends I tell about Dialog are asking me about some scripts. I'm
>> not good with them, so I ask here where the good script writers are. 
>> One asks about a script to remove PGP sigs from displayed message, but
>> my own try did not do it yet.
> 
> You might want to take a look at
> http://40tude.com/dialog/wiki/index.php/ScriptNukeYahooAds. You should be
> able to change it to meet your needs.

There is a typo in this script:
const yahoo_end  ='#13#10+------(...)
should be
const yahoo_end  =#13#10+'------(...)

Ray
Re: {[Dialog] Script writers?
#136278
Author: Gember Breuk
Date: Mon, 27 Oct 2003 22:29
55 lines
2248 bytes
On Mon, 27 Oct 2003 12:04:17 -0500, Gember Breuk wrote:

That script did not post right, I try again!

program OnBeforeSavingMessage;

const pgp_head='-----BEGIN PGP SIGNED MESSAGE-----';
const pgp_hash='Hash:';
const pgp_sig_start='-----BEGIN PGP SIGNATURE-----';
const pgp_sig_end='-----END PGP SIGNATURE-----';
const maxint=2147483647;

procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean);
var i,j:integer;
    s:string;
    pgp_signed:string;
       
begin
if isemail=true then exit;
s:=message.text;
i:=pos(pgp_head,s);

if i>0 then
   begin
   j:=i+pos(pgp_hash,copy(s,i,maxint));
   if j>i then
      begin
      delete(s,i,j-i+length(pgp_hash)+8);
      insert('',s,j);
      message.text:=s;
      end;
   end;

s:=message.text;
i:=pos(pgp_sig_start,s);
pgp_signed:='[---PGP signed---]';

   begin
   j:=i+pos(pgp_sig_end,copy(s,i,maxint));
   if j>i then
      begin
      delete(s,i,j-i+length(pgp_sig_end)+1);
      insert(pgp_signed,s,j);
      message.text:=s;
      end;
   end;  
end;

begin
end.


-- 
Gem
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads