• Comparing UserLastOn with modification date of file (MPL)

    From boraxman@21:1/101 to All on Tue Feb 15 22:40:55 2022
    I am trying to work out a persistent issue I am having with the latest Mystic BBS version, Mystic 1.12 Alpha 47.

    I am running this on a Raspberry Pi, on the EXT4 filesystem. The issue is that the new bulletin notifications do not work as expected. Mystic almost always fails to detect when a bulletin is new.

    I tried a different package to display bulletins, "BULLS - Mystic Bulletins Alternative" by Gary Crunk, version 1.0, and it has has the exact opposite problem, it always considered the bulletins as new, regardless of how many times one has logged in since updating the file.

    I suspect the problem is the comparison between the UserLastOn and the date of the file.

    Bulletin.mps which comes with mystic does the comparison as such

    If DirTime > DateU2D(UserLastOn) And Upper(Copy(DirName, 1,
    ) - 1)) <> 'BULLETIN' Then Begin

    The bulls.mps from the BULLS package, does it this way

    if UserLastOn > GetFileDate(Entry.Bullfile) then S:='*NEW*'
    if UserLastOn < GetFileDate(Entry.Bullfile) then S:=' '

    The reverse order of the comparison in the second examples is why bulls.mps always says its new, whereas bulletin.mps always says its old. These values are not valid values, and I don't know why. UserLastOn seems to always be less than the filedate.

    Either the UserLastOn is incorrect, or the filedate. However, I'm not sure how to print these values, or determine whether the functions are returning valid results.

    I barely know MPL. If someone knows how I can print out the date, or see the values, I'll be closer to troubleshooting and solving this problem.

    By the way, the function in BULLS.MPS to get the file date is below

    Function GetFileDate (F : String) : LongInt
    Begin
    FindFirst (F, 7)
    TempLI:=DirTime
    FindClose
    GetFileDate:=TempLI
    End

    Regards,
    BoraxMan

    --- Mystic BBS v1.12 A47 2021/12/24 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From seeLive@21:2/128 to boraxman on Tue Feb 15 12:27:11 2022
    On 15 Feb 2022, boraxman said the following...
    I am trying to work out a persistent issue I am having with the latest Mystic BBS version, Mystic 1.12 Alpha 47.

    I suspect the problem is the comparison between the UserLastOn and the date of the file.

    Yep, they are not the same date type as g00r00 explained to me... I ran into the same thing... this will work because it will convert the UserLastOn, which is a dos date, I belive to a unix date...

    if Dateu2d(UserLastOn) <= GetFileDate(Entry.Bullfile) then S:='[NEW]'
    if Dateu2d(UserLastOn) > GetFileDate(Entry.Bullfile) then S:=' '

    Hope that helps...


    (,``,"> rusty sez... Re-livin' the dream...

    --- Mystic BBS v1.12 A47 2021/12/24 (Raspberry Pi/32)
    * Origin: seeLive's rustyHedgehog - therhh.dynv6.net:2300 (21:2/128)
  • From boraxman@21:1/101 to seeLive on Wed Feb 16 22:23:41 2022
    Yep, they are not the same date type as g00r00 explained to me... I ran into the same thing... this will work because it will convert the UserLastOn, which is a dos date, I belive to a unix date...

    if Dateu2d(UserLastOn) <= GetFileDate(Entry.Bullfile) then S:='[NEW]'
    if Dateu2d(UserLastOn) > GetFileDate(Entry.Bullfile) then S:=' '

    Hope that helps...


    I did try it before, and it didn't work. I suspect maybe GetFileDate isn't returning a unix date either.

    Do you know how I can print the values?

    --- Mystic BBS v1.12 A47 2021/12/24 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From seeLive@21:2/128 to boraxman on Wed Feb 16 11:43:35 2022
    On 16 Feb 2022, boraxman said the following...

    I did try it before, and it didn't work. I suspect maybe GetFileDate isn't returning a unix date either.

    Odd... that works for me

    Do you know how I can print the values?

    I believe just printing the dates will work like...
    writeln(GetFileDate)

    It won't tell you the type, obviously, but you'll see the values are too far apart to work in a comparison.


    (,``,"> rusty sez... Re-livin' the dream...

    --- Mystic BBS v1.12 A47 2021/12/24 (Raspberry Pi/32)
    * Origin: seeLive's rustyHedgehog - therhh.dynv6.net:2300 (21:2/128)
  • From boraxman@21:1/101 to seeLive on Fri Feb 18 01:19:12 2022
    I believe just printing the dates will work like...
    writeln(GetFileDate)

    It won't tell you the type, obviously, but you'll see the values are too far apart to work in a comparison.

    I have used the following lines to print values...

    writeln('User last on ='+datestr(dateu2d(UserLastOn),1))
    writeln('File date = '+datestr(dateu2d(GetFileDate(Entry.Bullfile)),1))

    The filedate seems right, but the userlast on is 00/14/229, way too high!


    I'm thinking there is dud data there. When I chnage the second line to

    writeln('User '+username+' last on ='+datestr(dateu2d(UserLastOn),1))

    I now get the right date, but the filedate is 10/04/14, way too old.

    UserLastOn is read from the GetUser function. Does this need to be called in the script, or is the value fed to the script regardless?

    For some reason, adding the printing of 'username' changes the dates! If I remove it, it goes back to its old behaviour.

    ... Error, no Keyboard - Press F1 to Continue.

    --- Mystic BBS v1.12 A47 2021/12/24 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From boraxman@21:1/101 to boraxman on Fri Feb 18 01:20:32 2022
    I'm thinking there is dud data there. When I chnage the second line to

    writeln('User '+username+' last on ='+datestr(dateu2d(UserLastOn),1))

    Oops, I mean that I'm changing the first line, the ones that prints the UserLastOn, not the second line, the filedate.

    --- Mystic BBS v1.12 A47 2021/12/24 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From seeLive@21:2/128 to boraxman on Thu Feb 17 12:15:45 2022
    On 18 Feb 2022, boraxman said the following...
    I have used the following lines to print values...

    writeln('User last on ='+datestr(dateu2d(UserLastOn),1))
    writeln('File date = '+datestr(dateu2d(GetFileDate(Entry.Bullfile)),1))

    The filedate seems right, but the userlast on is 00/14/229, way too high!

    I'm thinking there is dud data there. When I chnage the second line to

    writeln('User '+username+' last on ='+datestr(dateu2d(UserLastOn),1))

    I now get the right date, but the filedate is 10/04/14, way too old.

    UserLastOn is read from the GetUser function. Does this need to be
    called in the script, or is the value fed to the script regardless?

    In the examples I've seen, you need to call 'GetThisUser' to populate the vars in the script.

    For some reason, adding the printing of 'username' changes the dates!
    If I remove it, it goes back to its old behaviour.

    Perhaps, it's the datestr that's further confusing things... I was comparing the raw numbers as well... If you like, I can send you a copy of mine that's working...


    (,``,"> rusty sez... Re-livin' the dream...

    --- Mystic BBS v1.12 A47 2021/12/24 (Raspberry Pi/32)
    * Origin: seeLive's rustyHedgehog - therhh.dynv6.net:2300 (21:2/128)
  • From boraxman@21:1/101 to seeLive on Fri Feb 18 12:33:13 2022
    Perhaps, it's the datestr that's further confusing things... I was comparing the raw numbers as well... If you like, I can send you a copy
    of mine that's working...


    I think I solved it.

    Firstly, we need to convert userlaston using dateu2d, but not the filedate.

    Secondly, there was a bug in the original file where the < and > comparison operators were the wrong way around!

    Thirdly, there was a copy of bulls.mps and bulls.mpx in the /mystic directory, outside of the scripts directory, and this was occasionally being run instead.

    So it seems to work. I will make afew tweaks, and probably upload it. There were some other changes I had to make to get it running in the first place, and I'd like to add functionality to allow users to add, but not delete bulletins with a specific access level.

    Thanks for your help!

    --- Mystic BBS v1.12 A47 2021/12/24 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From seeLive@21:2/128 to boraxman on Thu Feb 17 19:40:19 2022
    On 18 Feb 2022, boraxman said the following...
    Thanks for your help!

    Glad, I could help!


    (,``,"> rusty sez... Re-livin' the dream...

    --- Mystic BBS v1.12 A47 2021/12/24 (Raspberry Pi/32)
    * Origin: seeLive's rustyHedgehog - therhh.dynv6.net:2300 (21:2/128)