PROGRAM MsgIdTst;

USES Msgs,
     Trans,
     Cfg,
     Ramon;

VAR Id  : STRING;
    Crc : LONGINT;

BEGIN
     Msg.Date_F:='29 Feb 00  10:20:30';
     Msg.FromUser_F:='Ramon van der Winkel';
     Msg.ToUser_F:='All';
     Msg.FromAddr_F.Zone:=2;
     Msg.FromAddr_F.Net:=200;
     Msg.FromAddr_F.Node:=111;
     Msg.FromAddr_F.Point:=15;
     Config.GateMsgID:=gmInclude;

     WriteLn;
     WriteLn ('MsgID2MessageID:');

     Id:=''; WriteLn (Id+' -> '+MsgID2MessageID (Id));
     Id:='2:200/111.15 9876FEdc'; WriteLn (Id+' -> '+MsgID2MessageID (Id));
     Id:='<mymsgid@perfectly.legal.se> 12345678'; WriteLn (Id+' -> '+MsgID2MessageID (Id));
     Id:='"<mymsgid@perfectly.legal.se>" 12345678'; WriteLn (Id+' -> '+MsgID2MessageID (Id));
     Id:='"<my"" perfect ""msgid@perfectly.legal.se>" 12345678'; WriteLn (Id+' -> '+MsgID2MessageID (Id));
     Id:='R„m”n v†n der Winkel 12345678'; WriteLn (Id+' -> '+MsgID2MessageID (Id));

     WriteLn;
     WriteLn ('TestMessageID2MsgID:');

     Id:=''; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));
     Id:='<NOMSGID_980101_102030_abcd1234@fidonet.org'; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));
     Id:='<msgid@wsd.wline.se>'; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));
     Id:='<MSGID_111=3A254=2F134.46@wsd.wline.se>'; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));
     Id:='<my" perfect "msgid@perfectly.legal.se>'; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));
     Id:='<my also legal msgid@ok.se>'; WriteLn (Id+' -> ',TestMessageID2MsgID (Id));

     WriteLn;
     WriteLn ('MessageID2MsgID:');

     Id:=''; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<NOMSGID_980101_102030_abcd1234@fidonet.org>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<msgid@wsd.wline.se>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<MSGID_111=3A254=2F134.46@wsd.wline.se>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<MSGID_111=3A254=2F134.46=40FIDOnet.org@wsd.wline.se>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<my" perfect "msgid@perfectly.legal.se>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<my also legal msgid@ok.se>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));
     Id:='<MSGID_R=84m=94n_v=86n_der_Winkel_12345678@fidonet.org>'; WriteLn (Id+' -> ',MessageID2MsgID ('*',Id));

     WriteLn;
     WriteLn ('CRC calculation tests:');
     Id:='<1991Aug9.034239.10837@bisun.nbg.sub.org>DE.COMM.GATEWAYS';
     CRC:=UpdateCRC32 ($FFFFFFFF,Id[1],Length (Id)) XOR $FFFFFFFF;
     WriteLn (Id,' ',LoCaseString (Long2HexString (Crc)));

     Id:='<IBNTXSD@methan.chemie.fu-berlin.de>GATEWAYS.GER';
     CRC:=UpdateCRC32 ($FFFFFFFF,Id[1],Length (Id)) XOR $FFFFFFFF;
     WriteLn (Id,' ',LoCaseString (Long2HexString (Crc)));

     Id:=MsgID2MessageID ('"<junk"" id ""@illegal>" 12345678')+'JUNK';
     CRC:=UpdateCRC32 ($FFFFFFFF,Id[1],Length (Id)) XOR $FFFFFFFF;
     WriteLn (Id,' ',LoCaseString (Long2HexString (Crc)));
END.
