Copy Link
Add to Bookmark
Report

NULL mag Issue 08 21 Message base re-indexing

eZine's profile picture
Published in 
null magazine
 · 3 years ago

  




one common problem of all mystic sysops, is that in some time in the
past, we had to delete a message base (or even a file base), which
lead to the problem of having index numbers, for the bases, that are
not consecutive. this should be of a problem, but mystic bbs,
specially when using MPS/MPY, needs the index numbers to be
consecutive or perhaps the sysop/modder thinks that some specific
functions work in a different way... :?

what i mean is this... lets see an example... in pseudo-code... lets
say you want to write a script that takes some info from the message
base, so you have to "sweep" them one by one to take this info. you
should write something like:

i:=1;
while getmbase(i) = True do begin
...
...
...
i:=i+1;
end;

if the index numbers are not consecutive, the code above, will end
"pre-maturely" :) with out passing all msg.bases. when it reaches an
index number that it doesn't exist any more, it will break the loop.
there are other ways to avoid this situation, but new mystic
modders/scripters, discover this in a hard way :) i was also very
troubled in the beginning, until i found why this was happening.

so to avoid this, but also other problems, the easy solution is to
re-index the mbases.dat file. and following script does exactly that.
make sure to make a backup, even if the script doesn't affect the
original mbases.dat file, but just to be sure.

the code is in MPS to be cross-platform and you can execute it via
your bbs or even from the terminal/shell like this:

mystic -uuser -ppassword -xNameOfScript

make sure to compile it first with MPLC.

Note...
if you want to make a file base re-indexer, you can, by just altering
the base record with the one for the file bases. you will find it
inside the records.112 file, inside the /DOCS directory. have fun!


--- xq-mbrindx.mps ----------------------------------------------------------

uses cfg;

Const
mysMaxAcsSize = 30;
mysMaxPathSize = 80;

Type
RecMessageBase = Record
Index : Word;
Name : String[60];
QWKName : String[13];
NewsName : String[60];
FileName : String[40];
Path : String[mysMaxPathSize];
NetType : Byte;
ReadType : Byte;
ListType : Byte;
ListACS : String[mysMaxAcsSize];
ReadACS : String[mysMaxAcsSize];
PostACS : String[mysMaxAcsSize];
SysopACS : String[mysMaxAcsSize];
ListEACS : String[mysMaxAcsSize];
PostEACS : String[mysMaxAcsSize];
ColQuote : Byte;
ColText : Byte;
ColTear : Byte;
ColOrigin : Byte;
ColKludge : Byte;
NetAddr : Byte;
Origin : String[50];
DefNScan : Byte;
DefQScan : Byte;
MaxMsgs : LongInt;
MaxAge : Word;
Header : String[20];
RTemplate : String[20];
ITemplate : String[20];
Flags : LongInt;
Created : LongInt;
EchoTag : String[40];
QwkNetID : LongInt;
QwkConfID : Word;
Res : Array[1..136] of Byte;
End;

Procedure ReIndex;
Var
f : file;
fp : file;
i : integer = 1;
baserec : RecMessageBase;
Begin
fassign(f,CfgDataPath+'mbases.dat',66);
freset(f);
fassign(fp,CfgDataPath+'new_mbases.dat',66);
frewrite(fp);
While Not fEof(f) Do Begin
fillchar(baserec,sizeof(baserec),#0);
fread(f,baserec,sizeof(baserec));
baserec.index := i;
fwrite(fp,baserec,sizeof(baserec));
i := i + 1;
End;
fclose(fp)
fclose(f);
End;


Begin
Clrscr;
TextColor(15);
Writeln('Message Base Re-Indexer, for Mystic BBS 1.12A43');
writeln(' ')
TextColor(7);
Writeln('This script will re-index your Message Bases. It will give them '+
'a ');
writeln('continues index number, in case you have deleted some of them and');
writeln('that broke the index order.');
writeln(' ');
textcolor(11);
writeln('The script will create a new MBASES.DAT file named as '+
'NEW_MBASES.DAT');
writeln('inside the /DATA directory. Make a backup of your current file '+
'and then');
writeln('replace it with the new one. Test things, and if all is good '+
'you are OK.');
writeln('In case of problems, replace your backup file and it will '+
'fix things.')
textcolor(14);
Writeln(' ');
if inputyn('Proceed?') then Begin
ReIndex;
textcolor(7);
writeln('File NEW_MBASES.DAT, created.')
end else begin
textcolor(7);
writeln('Operation aborted.')
end;
End;

-----------------------------------------------------------------------------


<<< null e-magazine x008 (text edition) >>>
____ _____ _____ _____ http://github.com/xqtr/null
___/. \/ /_________/. /__/. /__jp!_ andr01d.zapto.org:9999
//_ \ . / / \ / _// agency.bbs.nz
/____/\____/ / /__________________\ d1st.org
\________/

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT