Re: MsgBase first_msg property.
By: deon to Digital Man on Sat May 07 2022 10:19 pm
> > > => first_msg has been zeroed
>
> > As I would expect. These property values are dynamic (query the open
> > message base), so the msgbase needs to be open.
>
> > > So why when the message base, is the "first_msg" attribute set to
> > > zero, but all other attributes are untouched?
>
> > The others are stale values from the previous time you queried the
> > properties contained in the status header.
>
> > > Can it be left untouched?
>
> > You can copy the value if you want to save a snapshot of it.
>
> > > (This is on a build as of yesterday - commit 6de0ebc0d.)
>
> > It's not a bug. If anything, I'd just work to make all the other cached
> > values 'undefined' rather than return stale values. That's not going to
> > help you either.
>
> When the message base is closed (is_open = false), what would change the
> other values?
I'm not clear on the question. The improvement I proposed would just change the
MsgBase property 'getter' to return 'undefined' when the message base isn't open
ed. If you're curious about the implementation, that'd be changing js_msgbase_ge
t() in js_msgbase.c
> If the values are only guaranteed to be correct when the message base is
> open, then programatically, you know when you can trust the values, by
> checking "is_open", right?
Yup.
> So instead of scrubbing the "cached values", does it impact anything if they
> are left intact as at the last time the message base was open? (Including
> first_msg.)
Currently, I'm not scrubbing any cached values (namely, the contents of the SMB
"status header", which includes such things as the last message number). The fir
st message number must be queried every time the property is read, that value is
not cached in any SMB data structure.
> I know I can create new variables with those values that I need, but that
> does seem a waste when I have a variable that has this object already
> (especially if it is updated when I reopen the message base).
You can look at js_msgbase.c if you're curious how/why it works the way it does
and offer suggestions, but right now, it's working as designed and expected.
--
digital man (rob)
Sling Blade quote #7:
Karl: I don't reckon the Good Lord would send anybody like you to Hades.
Norco, CA WX: 63.5°F, 81.0% humidity, 1 mph ESE wind, 0.00 inches rain/24hrs
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
|