Enhancement at the request of Nightfox:
Optionally, external modules may be executed in place of "built-in" operations for:
- reading mail (email or netmail)
- scanning posts (searching/scanning/reading a single sub-board)
- scanning sub-boards (all, one, or a group)
Re: src/sbbs3/main.cpp readmail.cpp readmsgs.cpp sbbs.h scansubs.cpp scfgd
By: rswindell to CVS commit on Mon Apr 27 2015 03:45:05
Enhancement at the request of Nightfox:
Optionally, external modules may be executed in place of "built-in" operations for:
- reading mail (email or netmail)
- scanning posts (searching/scanning/reading a single sub-board)
- scanning sub-boards (all, one, or a group)
Thanks for the update! I'm having a look at the new options now. I've put a JS script in place for the Read Mail option, and that seems to work as expected. I'm about to look into the others.
Cool. Are you testing the Kill/Read Sent Mail feature as well as the Read All Mail feature (e.g. the ;MAIL sysop command)?
If you don't want your module to handle those scenarios, you can just call bbs.read_mail() in those situations if you like (one use case for the recursion protection).
For the Scan Posts module, the sub-board number and scan mode (both in decimal) and the 'find' string (text being searched for) are passed as arguments (in that order). The scan mode values (defined in sbbsdefs.js) are the same as those supported by bbs.scan_posts(). All of the values should be supported and they can be combined (e.g. SCAN_CONST|SCAN_NEW and SCAN_NEW|SCAN_TOYOU). The 'find' string is only used if the SCAN_FIND mode bit is set. It is the responsibilty of the module (if configured) to enforce sub-board read access restrictions.
For the Scan Subs module, the first argument is 1 if "all subs" are being scanned, 0 otherwise (normally the user is prompted for the breadth of the scan in this case, but that's up to the module author), and the scan 'mode' is passed in decimal, in that order. If the SCAN_FIND mode flag is passed in, this module should prompt the user for the text string to search for. If this module is not configured, the Scan Posts module will be executed for each sub-board scanned.
Re: src/sbbs3/main.cpp readmail.cpp readmsgs.cpp sbbs.h scansubs.cpp scfgd
By: rswindell to CVS commit on Mon Apr 27 2015 03:45:05
For the Scan Posts module, the sub-board number and scan mode (both in decimal) and the 'find' string (text being searched for) are passed as arguments (in that order). The scan mode values (defined in sbbsdefs.js) are the same as those supported by bbs.scan_posts(). All of the values should be supported and they can be combined (e.g. SCAN_CONST|SCAN_NEW and SCAN_NEW|SCAN_TOYOU). The 'find' string is only used if the SCAN_FIND mode bit is set. It is the responsibilty of the module (if configured) to enforce sub-board read access restrictions.
For the Scan Subs module, the first argument is 1 if "all subs" are being scanned, 0 otherwise (normally the user is prompted for the breadth of the scan in this case, but that's up to the module author), and the scan 'mode' is passed in decimal, in that order. If the SCAN_FIND mode flag is passed in, this module should prompt the user for the text string to search for. If this module is not configured, the Scan Posts module will be executed for each sub-board scanned.
Hi DM,
I am a little confused on the difference between Scan Posts and Scan Subs, as well as the behavior of some of the SCAN_* bits defined in sbbsdefs.js.
One thing is, from the Synchronet JS documentation, it looks like bbs.scan_msgs() performs the Scan Posts functionality?
The JS documentation
doesn't include scan_posts() as a function in the bbs object, but it says scan_msgs() is AKA scan_posts(). And indeed, if I set up a JS script for the Scan Posts module, that script gets called for bbs.scan_msgs(). The naming thew me off a bit (Scan Posts vs. scan_msgs).
This is the JS
documentation I am referring to:
http://www.synchro.net/docs/jsobjs.html
Also, I was having a look at classic_shell.js to see what it does for the 'S' command (scan for messages posted to you), and it calls bbs.scan_subs(SCAN_TOYOU). In my custom command shell, I was also using that for the same feature. When that runs, it asks whether you want to show only the message subjects. If you choose Yes, then it shows the message subjects for all messages posted to you. If you choose No, it lets you read the messages, but only new messages to you (not all messages to you, as the comment for SCAN_TOYOU suggests). So the messages it shows seems to be inconsistent depending on whether you choose to see only the message subjects or not.
Also, from the JS documentation, it looks like the only major difference between scan_subs and scan_msgs (or Scan Posts) is that scan_msgs includes search text, whereas scan_subs doesn't - Is that correct?
Another thing I noticed is that sbbsdefs.js defines SCAN_UNREAD, but I don't see that used anywhere in classic_shell.js. Is that equivalent to SCAN_NEW|SCAN_TOYOU?
Re: src/sbbs3/main.cpp readmail.cpp readmsgs.cpp sbbs.h scansubs.cpp scfgd
By: rswindell to CVS commit on Mon Apr 27 2015 03:45:05
Hi DM,
I've started to set up a JS script for the Scan Subs loadable module. My reader doesn't yet handle all scan scenarios, so for the scenarios it doesn't handle, I plan to call bbs.scan_subs() and pass along the arguments that are passed to the Scan Subs module. As a test, I tried having my Scan Subs module just call bbs.scan_subs(), and I noticed that the mode bits don't seem to be passed through properly. For instance, if my Scan Subs module contains this code:
var scanAllSubs = (argv[0] == 1);
var scanMode = argv[1];
bbs.scan_subs(scanMode, scanAllSubs);
I noticed that if I then call bbs.scan_subs() from my command shell, it seems to do the same type of scan whether I pass SCAN_TOYOU or SCAN_NEW for the scan type. Both of those seem to end up doing a newscan (passing SCAN_TOYOU behaves the same as passing SCAN_NEW). If I then remove my Scan Subs module from the Loadable Modules configuration in SCFG, bbs.scan_subs() then behaves as expected.
I am a little confused on the difference between Scan Posts and Scan
Subs, as well as the behavior of some of the SCAN_* bits defined in
sbbsdefs.js.
Scan Posts is what happens when you hit 'R' from the main menu of the classic shell to read a sub-board. It's also what is called for *each* sub-board you choose the scan in the various scan/search methods.
Scan Subs is what happens when you hit 'N', '/N', 'S', '/S', 'F', 'Z', '/Z', 'B' or '/B', from the main menu of the classic shell. The non-slash variant prompts you for the scope of what to scan. The 'F' command prompts you for a string to search for. These prompts are handled by the "Scan Subs" code which then calls the Scan Posts code for each sub-board being scanned.
Also, from the JS documentation, it looks like the only major
difference between scan_subs and scan_msgs (or Scan Posts) is that
scan_msgs includes search text, whereas scan_subs doesn't - Is that
correct?
No, bbs.scan_subs() will prompt the user for the scope of the scan and prompt you for the find string (like I described above). bbs.scan_subs() actually calls bbs.scan_msgs() (not exactly, but logically).
Another thing I noticed is that sbbsdefs.js defines SCAN_UNREAD, but I
Another thing I noticed is that sbbsdefs.js defines SCAN_UNREAD, but I
don't see that used anywhere in classic_shell.js. Is that equivalent
to SCAN_NEW|SCAN_TOYOU?
The SCAN_UNREAD mode flag appears to have never been used in Synchronet (going back to Synchronet v2) so I guess it needs to be removed from sbbsdefs.js :-) SCAN_TOYOU performs this function.
that the mode bits don't seem to be passed through properly. For
instance, if my Scan Subs module contains this code:
var scanAllSubs = (argv[0] == 1);
var scanMode = argv[1];
bbs.scan_subs(scanMode, scanAllSubs);
I noticed that if I then call bbs.scan_subs() from my command shell,
it seems to do the same type of scan whether I pass SCAN_TOYOU or
SCAN_NEW for the scan type. Both of those seem to end up doing a
newscan (passing SCAN_TOYOU behaves the same as passing SCAN_NEW). If
I then remove my Scan Subs module from the Loadable Modules
configuration in SCFG, bbs.scan_subs() then behaves as expected.
The bbs.scan_subs() method uses the type of the arguments to determine which is being passed (the order or arity is not significant), so scanMode in this case is going to be a string (and ignored) unless you "cast" it to a Number, like so:
bbs.scan_subs(Number(scanMode), scanAllSubs);
For the Scan Posts module, the sub-board number and scan mode (both in decimal) and the 'find' string (text being searched for) are passed as arguments (in that order).
Is there an efficient way to get a sub-board internal code from the sub-board number in JS? Perhaps an array of sub-boards in JS indexed by the sub-board number? If I needed to get the sub-board code from the sub-board number, I suppose I could loop through the msg_area.sub array (which is indexed by internal code) and look for the sub-board with the matching number, but I'm wondering if there's a method that would be faster than doing a linear search.
Is there an efficient way to get a sub-board internal code from the
sub-board number in JS? Perhaps an array of sub-boards in JS indexed
by the sub-board number? If I needed to get the sub-board code from
the sub-board number, I suppose I could loop through the msg_area.sub
array (which is indexed by internal code) and look for the sub-board
with the matching number, but I'm wondering if there's a method that
would be faster than doing a linear search.
It's pretty trivial to create this array yourself using the method you suggested.
It's pretty trivial to create this array yourself using the method you suggested.
I don't need to create such an array; All I want to do is look up a sub-board code from its number without having to take time to loop through an array to search for it. I was just wondering if there was already some structure where it could be looked up or some function to look it up.
It's pretty trivial to create this array yourself using the method you suggested.
I don't need to create such an array; All I want to do is look up a sub-board code from its number without having to take time to loop through an array to search for it. I was just wondering if there was already some structure where it could be looked up or some function to look it up.
If you created the array once, you would then have a structure where it could be looked up is what I was pointing out.
It's pretty trivial to create this array yourself using the method you suggested.
I don't need to create such an array; All I want to do is look up a sub-board code from its number without having to take time to loop through an array to search for it. I was just wondering if there was already some structure where it could be looked up or some function to look it up.
If you created the array once, you would then have a structure where it could be looked up is what I was pointing out.
True - but this is something my script will only do once. Building a structure would be more worth it if my script would be doing it multiple times. This is something I'll be doing with the new 'Scan Posts' loadable module, where one of the parameters Synchronet passes is a sub-board number. I want my script to look up the sub-board code based on that, which will happen only once.
True - but this is something my script will only do once. Building a
structure would be more worth it if my script would be doing it
multiple times. This is something I'll be doing with the new 'Scan
Posts' loadable module, where one of the parameters Synchronet passes
is a sub-board number. I want my script to look up the sub-board code
based on that, which will happen only once.
If I change that argument (to the module) from the subnum (which really is an sbbs internal concept) to the sub-board internal code, would that resolve it?
Re: src/sbbs3/main.cpp readmail.cpp readmsgs.cpp sbbs.h scansubs.cpp scfgd
By: Digital Man to Nightfox on Mon May 04 2015 17:43:31
True - but this is something my script will only do once. Building a
structure would be more worth it if my script would be doing it
multiple times. This is something I'll be doing with the new 'Scan
Posts' loadable module, where one of the parameters Synchronet passes
is a sub-board number. I want my script to look up the sub-board code
based on that, which will happen only once.
If I change that argument (to the module) from the subnum (which really is an sbbs internal concept) to the sub-board internal code, would that resolve it?
Yes, it would.
If I change that argument (to the module) from the subnum (which
really is an sbbs internal concept) to the sub-board internal
code, would that resolve it?
Yes, it would.
Okay, I'll do that then. You'll need to change your mod accordingly. :-)
Re: src/sbbs3/main.cpp readmail.cpp readmsgs.cpp sbbs.h scansubs.cpp scfgd
By: Digital Man to Nightfox on Mon May 04 2015 23:15:38
If I change that argument (to the module) from the subnum (which DM>> really is an sbbs internal concept) to the sub-board internal
code, would that resolve it?
Yes, it would.
Okay, I'll do that then. You'll need to change your mod accordingly. :-)
Thanks. :)
Thank you. You're the guinea pig for that feature. I wasn't too thrilled with using arguments to pass the mode/state information, but in the end it seemed the best option that would work with both JS and Baja (though it seems very unlikely someone would be able to write one of these mods in Baja).
Thank you. You're the guinea pig for that feature. I wasn't too
thrilled with using arguments to pass the mode/state information, but
in the end it seemed the best option that would work with both JS and
Baja (though it seems very unlikely someone would be able to write one
of these mods in Baja).
Thank you. You're the guinea pig for that feature. I wasn't too
thrilled with using arguments to pass the mode/state information,
but in the end it seemed the best option that would work with both
JS and Baja (though it seems very unlikely someone would be able to
write one of these mods in Baja).
Oh you know damn well who would contradict you on that by saying they've already done it even though it's nowhere to be found. :)
Sysop: | MCMLXXIX |
---|---|
Location: | Prospect, CT |
Users: | 326 |
Nodes: | 10 (0 / 10) |
Uptime: | 217:09:41 |
Calls: | 516 |
Messages: | 223256 |