Re: Javascript weirdness
By: deon to Digital Man on Mon Apr 18 2022 11:21 am
> Re: Javascript weirdness
> By: Digital Man to deon on Sun Apr 17 2022 05:02 pm
>
> > > if (! this.msgbase.open('r')) {
> > What significance is this 'r'? I don't think that'll have any effect.
>
> Ahh thanks - I just assummed I needed to open it 'r' for read only and 'r+'
> for read write. I see in the spec that it doesnt take any arguments.
>
> > > writeln(ma.areas[i].code+' cannot be opened?');
> > 'ma' and 'i' don't appear to be defined in this scope. I don't this error
> > handler is going to execute as intended.
>
> Thanks, a hang over from before it was in the object.
>
> > > write(); // Needed else this is not working?
> > That's pretty strange.
>
> It is.
>
> I'm seeing this in a few places (when parsing throught the output of
> get_all_msg_headers(). The strange thing is, without it its reporting a
> different numbers of results. For example, if I'm searching for the message
> with tags "1826" it doesnt show unless I have the write() statement there.
>
> > > It reports 36 (which is correct). If I comment out the "write()" in
> > > the function list_tagged, it reports 25. Why? (And I have confirmed
> > > that 23 of the 25 do have a "tags" header.)
>
> > Woudn't 23 be the right answer then?
>
> No - and actually a typo. In the message base, there are 38 messages. 36 are
> tagged (which is correct), and 2 are not (which are the two errors I
> referred to earlier).
>
> When I remove that "write()", I get a list of 15 untagged - and 13 of those
> 15 *do* have tags. (And if I put any debugging "write" statements to test
> the logic, I only get the 2.)
I suspect something else is afoot there.
This method of counting/collecting messages with a 'tags' header field works for
me, without any calls to write():
var base = MsgBase(code);
if(!base.open()) {
alert(base.error);
exit();
}
var list = base.get_all_msg_headers(false, false);
var result = [];
for(var i in list) {
if(list[i].tags)
result.push(list[i]);
}
print(result.length);
> The strange thing, I'm wondering if it is some memory buffer corruption. I'm
> sure when I started removing my writeln debug comments, that it was
> returning a list of 37 of 38, now it is only selecting 15 (and always the
> same 15).
>
> I'll remove some of the tags and re-add them and see what happens.
>
> > If put_msg_header() returns false, the details will be contained in
> > MsgBase.error and MsgBase.status. Check/log those property values upon
> > error.
>
> Ahh thanks, I did that and it reports.
> ERROR:"smb_putmsghdr illegal header length increase: 261 (2 blocks, 11
> hfields, 2 dfields) vs 253 (1 blocks)"
>
> And the only thing I'm doing is setting msg.tags = "xxxx" after
> a "var msg = this.msgbase.get_msg_header(msgs[x].number, /* expand:
> */false)"
>
> What's that error mean?
It means the message header in question doesn't have enough enough room for expa
nsion to accommodate your added data (tags, in this case). Headers are stored in
256-byte blocks (allocation units) and if you're trying to add data that would
exceed its currently allocation (in blocks), that won't be allowed since it woul
d overwrite the next message's header.
Generally, message headers aren't updated/extended after the message has been ad
ded/imported, so this isn't usually a problem.
--
digital man (rob)
Synchronet "Real Fact" #46:
Synchronet External X/Y/ZMODEM protocol driver (SEXYZ) was introduced in 2005
Norco, CA WX: 69.7°F, 52.0% humidity, 11 mph S wind, 0.00 inches rain/24hrs
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
|