====== BBS List ======

The Synchronet BBS List module (''[[dir:exec]]/sbbslist.js'') provides the following functionality:
  * Online BBS List (interactive door mode or just a read-only listing)
  * Exports locally created BBS entries to networked message base (e.g. SYNCDATA)
  * Imported BBS entries from networked message base
  * Generates HTML output (e.g. [[http://synchro.net/sbbslist.html]])
  * Generates Synchronet [[module:sbbsimsg|inter-BBS Instant-Message module]] database (i.e. ''[[dir:ctrl]]/sbbsimsg.lst'')
  * Generates [[http://syncterm.net|SyncTERM]] BBS directory file (i.e. ''syncterm.lst'')
  * Auto-synchronizes statistics (e.g. totals) in the local system's entry in the database
  * Auto-verifies TCP/IP services of listed BBSes and tracks the results

===== Dependencies ===== 

As of this writing, sbbslist v4 is known to be compatible with Synchronet v3.17.

A JavaScript ''printf()'' bug in Synchronet v3.16 causes sbbslist v4 to crash in Synchronet for Linux, but appears to work fine in the Windows build.

Files known to be required by sbbslist v4:
  * ''exec/sbbslist.js''
  * ''exec/load/sbbslist_lib.js''
  * ''exec/load/sbbslist_html.js''
  * ''exec/load/sbbsdefs.js''
  * ''exec/load/sockdefs.js''
  * ''exec/load/portdefs.js''
  * ''exec/load/modopts.js''
  * ''exec/load/graphic.js''
  * ''exec/load/termcapture_lib.js''
  * ''exec/load/synchronet-json.js''

===== History ===== 

The Synchronet BBS List v4 module (''[[dir:exec]]/sbbslist.js'') is the replacement for the old (originally, [[history:Digital_Dynamics]]') door, Synchronet BBS List (SBL).

Whereas the original Synchronet BBS List (SBL) was a native executable (originally for 16-bit MS-DOS, then OS/2, Windows and *nix), version 4 is a complete re-write in JavaScript.

==== SBL v3 Compatibility ====

When sbbslist v4 is run, it looks for its database file, ''[[dir:data]]/sbbslist.json''. If the database file doesn't exist, it'll attempt to upgrade from the old SBL database ''[[dir:xtrn]]/sbl/sbl.dab'' to the new JSON format automatically. This upgrade should normally only happen one time, but you can always force an upgrade again (over-writing your existing v4 database) by running ''sbbslist upgrade'' (e.g. with [[util:jsexec]]).

Probably the most compelling feature of SBL was the ability to share (import-from and export-to) networked message bases (e.g. the [[network:DOVE-Net]] SYNCDATA message conference). This capability has been maintained and enhanced in v4:
  * BBS entries posted using the old ''SBL2SMB'' are imported into the new ''sbbslist.json'' database
  * BBS entries are exported to message base(s) using both the old ''SBL2SMB'' format and a new JSON-encoding for newer features (e.g. answer screen preview)

Whereas SBL stored its configuration, data, and executable files in the ''[[dir:xtrn]]/sbl'' directory, sbbslist v4 uses the following Synchronet directories:
  * ''[[dir:data]]'' for storage of the database file ''sbbslist.json''
  * ''[[dir:ctrl]]'' for storage of its configuration settings, in ''[[config:modopts.ini]]''
  * ''[[dir:text]]'' for the location of its online help file, ''sbbslist.hlp''
  * ''[[dir:temp]]'' for temporary storage of downloadable listings (e.g. ''syncterm.lst'')
  * ''[[dir:exec]]'' for the main 'executable', ''sbbslist.js''
  * ''[[dir:exec]]/[[dir:exec#load]]'' for loadable library files, e.g. ''sbbslist_lib.js''

===== Install  ===== 

From command-line, run ''jsexec sbbslist install''

If all the prerequisites were met, this step will perform all the necessary configuration changes mentioned later in this document and you should be ready to go with the new Synchronet BBS List.

:!: **Note**:
If you previously had the ''SBL'' door in an external program section other than the //first// external program section, you may want to move the new ''SBBSLIST'' configuration to that location (in [[util:SCFG]]->External Programs->Online Programs).

===== Configure ===== 
Other than command-line parameters, the only configuration options for ''sbbslist.js'' are stored in the ''[sbbslist]'' section of the ''[[dir:ctrl]]/[[config:modopts.ini]]'' file:

<file ini>
[sbbslist]
        sort = name
        reverse = false
        format = 0
        add_ars = not guest
        beep = true
        sub = dove-syncdata
        live_preview = true
        backup_level = 5
        export_freq = 7
        max_inactivity = 180
</file>

^ Option       ^ Description ^
| sort         | The default list sort field (default: //none//) |
| reverse      | Reverse the default sort order (default: ''false'') |
| format       | The default browse list format (''0''-''9'', default: ''0'') |
| add_ars      | The access requirements of a user able to //add// a BBS entry (default: none) |
| beep         | Set to false to disable beeps sent to the remote terminal (default: ''true'') |
| sub          | Sub-board internal code for import and export command (default: //auto-detected//) |
| live_preview | Set to true to enable live previews (outbound connections) while in browse mode (default: ''false'') |
| backup_level | Over-ride the default number of backup files to maintain (default: ''5'') |
| export_freq  | Maximum export (to message-base) frequency, in days (default: ''7'') |
| max_inactivity | Maximum number of days of entry inactivity before auto-deletion via ''maint'' command (default: 180) |
==== Sorting ====
The configured/default sort field can also be specified on the ''sbbslist'' command-line (e.g. using the ''-sort'' option). The available sort fields are:

^ Field           ^ Description ^
| name            | BBS name (with "the" prefix and "BBS" suffix removed) |
| sysops          | List of BBS's system operators |
| location        | BBS's location (e.g. city, state, country) |
| phone_number    | BBS's phone number (if it has one) |
| service_address | BBS's primary TCP service address |
| since           | Date the BBS was first placed online |
| software        | BBS software in use |
| web_site        | BBS's web-site address |
| description     | BBS's description |
| networks        | List of message networks to which the BBS belongs |
| nodes           | Total number of terminal server //nodes// |
| users           | Total number of BBS users |
| subs            | Total number of BBS message areas (sub-boards) |
| dirs            | Total number of BBS file directories |
| doors           | Total number of BBS online programs (doors) |
| msgs            | Total number of public messages stored on the BBS |
| files           | Total number of files available for download |
| storage         | Total disk capacity |
| protocols       | List of TCP protocols supported by the BBS |
| created_by      | Name of user that created this BBS entry |
| created_on      | Date that this BBS entry was created |
| updated_by      | Name of user that last updated/edited this BBS entry |
| updated_on      | Date that this BBS entry was last updated |
| verified_by     | Name of user or program that last verified this BBS entry |
| verified_on     | Date that this BBS entry was last verified |
| verify          | Special sort order based on auto-verification results |
| active          | Special sort order based on last-activity (modification or verification) date |

The default sort order is alphabetical for string fields and reversed (descending) for numeric fields.

==== Live Preview ====
This feature allows a browsing user to request a real-time capture and preview of a listed BBS's answer/login screen. This is not an interactive connection and does not allow the user to send data or control the remote BBS in any way. The TCP connection, if successful, lasts about 10 seconds.
===== Invocation ===== 
''sbbslist.js'' can be invoked from [[util:JSexec]] to utilize many of its functions, but for it's primary "browse" (BBS door) functionality, it must run from the Synchronet Terminal Server (e.g. as an ''External Program'', a.k.a. door).

==== Door ====

The Synchronet BBS List may be added to your BBSes list of external programs (doors) available to users by adding it to [[util:SCFG]]->External Programs->Online Programs->Main, like so:

  ╔══════════════════════════════════════════════════════════╗
  ║                    Synchronet BBS List                   ║
  ╠══════════════════════════════════════════════════════════╣
  ║ │Name                       Synchronet BBS List          ║
  ║ │Internal Code              SBBSLIST                     ║
  ║ │Start-up Directory                                      ║
  ║ │Command Line               ?sbbslist browse             ║
  ║ │Clean-up Command Line                                   ║
  ║ │Execution Cost             None                         ║
  ║ │Access Requirements                                     ║
  ║ │Execution Requirements                                  ║
  ║ │Multiple Concurrent Users  Yes                          ║
  ║ │Intercept I/O              No                           ║
  ║ │Native Executable          No                           ║
  ║ │Use Shell to Execute       No                           ║
  ║ │Modify User Data           No                           ║
  ║ │Execute on Event           No                           ║
  ║ │Pause After Execution      No                           ║
  ║ │BBS Drop File Type         None                         ║
  ║ │Place Drop File In         Node Directory               ║
  ╚══════════════════════════════════════════════════════════╝
If you have the old ''SBL'' entry, you should remove it now.

The ''browse'' mode does not *have* to be configured this way. Since ''sbbslist.js'' runs in-process, it can be easily invoked from anywhere that a JavaScript module can be executed within the Synchronet [[server:Terminal]] Server. You just need to pass the ''browse'' argument. No drop files are needed or used.

==== Timed Events ====

''sbbslist.js'' can be invoked as a timed event to provide many important features:

=== Update ===

If the local system is listed in the database, it can be automatically updated (e.g. monthly) by adding a timed event to [[util:SCFG]]->External Programs->Timed Events, like so:

  ╔════════════════════════════════════════════════════════════════════╗
  ║                        SBLUPDAT Timed Event                        ║
  ╠════════════════════════════════════════════════════════════════════╣
  ║ │Internal Code                   SBLUPDAT                          ║
  ║ │Start-up Directory                                                ║
  ║ │Command Line                    ?sbbslist update -preview         ║
  ║ │Enabled                         Yes                               ║
  ║ │Execution Node                  1                                 ║
  ║ │Execution Months                Any                               ║
  ║ │Execution Days of Month         1                                 ║
  ║ │Execution Days of Week          All                               ║
  ║ │Execution Time                  00:00                             ║
  ║ │Requires Exclusive Execution    No                                ║
  ║ │Force Users Off-line For Event  No                                ║
  ║ │Native Executable               No                                ║
  ║ │Use Shell to Execute            No                                ║
  ║ │Background Execution            No                                ║
  ║ │Always Run After Init/Re-init   No                                ║
  ╚════════════════════════════════════════════════════════════════════╝

This will allow your BBS entry to automatically track your local system's statistics (e.g. number of users, door, message areas, etc.). Also, it will routinely re-export your BBS entry to any networked-message bases you have your BBS list linked with.

Remove the ''-preview'' argument if you do **not** want your BBS's login screen to be captured for later preview by potential users.

If you wish to override the address to which the module will connect to capture the preview, specify the IP address or host name like so:
  ?sbbslist update -preview=address

=== Import ===
If your BBS is connected to [[network:DOVE-Net]] or [[network:FidoNet]], you probably will want networked-posted BBS entries to be automatically imported into your database (''sbbslist.json'') from the appropriate message base (e.g. ''SYNCDATA''). To do so, setup a timed event in [[util:SCFG]]->External Programs->Timed Events, like so:

  ╔════════════════════════════════════════════════════════════════════╗
  ║                         SMB2SBL Timed Event                        ║
  ╠════════════════════════════════════════════════════════════════════╣
  ║ │Internal Code                   SMB2SBL                           ║
  ║ │Start-up Directory                                                ║
  ║ │Command Line                    ?sbbslist import                  ║
  ║ │Enabled                         Yes                               ║
  ║ │Execution Node                  1                                 ║
  ║ │Execution Months                Any                               ║
  ║ │Execution Days of Month         Any                               ║
  ║ │Execution Days of Week          All                               ║
  ║ │Execution Frequency             4 times a day                     ║
  ║ │Requires Exclusive Execution    No                                ║
  ║ │Force Users Off-line For Event  No                                ║
  ║ │Native Executable               No                                ║
  ║ │Use Shell to Execute            No                                ║
  ║ │Background Execution            No                                ║
  ║ │Always Run After Init/Re-init   No                                ║
  ╚════════════════════════════════════════════════════════════════════╝

**Note:**
If you have the old ''SMB2SBL'' timed event, you should remove it now.

=== Export ===
If your BBS is connected to [[network:DOVE-Net]] or [[network:FidoNet]], you probably will want your locally created BBS entries to be automatically exported from your database (''sbbslist.json'') to the appropriate message base (e.g. ''SYNCDATA''). To do so, setup a timed event in [[util:SCFG]]->External Programs->Timed Events, like so:

  ╔════════════════════════════════════════════════════════════════════╗
  ║                         SBL2SMB Timed Event                        ║
  ╠════════════════════════════════════════════════════════════════════╣
  ║ │Internal Code                   SBL2SMB                           ║
  ║ │Start-up Directory                                                ║
  ║ │Command Line                    ?sbbslist export                  ║
  ║ │Enabled                         Yes                               ║
  ║ │Execution Node                  1                                 ║
  ║ │Execution Months                Any                               ║
  ║ │Execution Days of Month         Any                               ║
  ║ │Execution Days of Week          All                               ║
  ║ │Execution Frequency             4 times a day                     ║
  ║ │Requires Exclusive Execution    No                                ║
  ║ │Force Users Off-line For Event  No                                ║
  ║ │Native Executable               No                                ║
  ║ │Use Shell to Execute            No                                ║
  ║ │Background Execution            No                                ║
  ║ │Always Run After Init/Re-init   No                                ║
  ╚════════════════════════════════════════════════════════════════════╝

**Note:**
If you have the old ''SBL2SMB'' timed event, you should remove it now.

=== Maintenance ===
This timed event (''SBLMAINT'') is also helpful for auto-purging old/inactive BBS list entries based on the configured ''max_inactivity'' duration (default: 180 days).
  ╔════════════════════════════════════════════════════════════════════╗
  ║                        SBLMAINT Timed Event                        ║
  ╠════════════════════════════════════════════════════════════════════╣
  ║ │Internal Code                   SBLMAINT                          ║
  ║ │Start-up Directory                                                ║
  ║ │Command Line                    ?sbbslist maint                   ║
  ║ │Enabled                         Yes                               ║
  ║ │Execution Node                  1                                 ║
  ║ │Execution Months                Any                               ║
  ║ │Execution Days of Month         Any                               ║
  ║ │Execution Days of Week          All                               ║
  ║ │Execution Time                  00:00                             ║
  ║ │Requires Exclusive Execution    No                                ║
  ║ │Force Users Off-line For Event  No                                ║
  ║ │Native Executable               No                                ║
  ║ │Use Shell to Execute            No                                ║
  ║ │Background Execution            No                                ║
  ║ │Always Run After Init/Re-init   No                                ║
  ╚════════════════════════════════════════════════════════════════════╝
==== Command-line ====

=== Commands ===
Commands are just words passed on the command-line to ''sbbslist.js''. Many commands are only there for trouble-shooting or experimental purposes.

^ Command   ^ Description ^
| browse    | Perform the interactive BBS-user //door// function for listing and adding systems to the list |
| list       | Display all or part of the BBS list |
| dump       | Perform a JSON-dump of the BBS list |
| count      | Count the number of entries in the BBS list|
| upgrade    | Upgrade from the old SBL (''sbl.dab'') list format |
| backup     | Backup the BBS list database file (''sbslist.json'') |
| import     | Import BBS entries from a networked message base |
| export     | Export BBS entries to a networked message base |
| syncterm   | Export the BBS List to a SyncTERM compatible list file (''syncterm.lst'') |
| html       | Export the BBS List to an HTML file (''sbbslist.html'') |
| imsglist   | Export the BBS List to an instant-message system list file (''sbbsimsg.lst'') | 
| sort=field | Sort the BBS List by the specified field |
| randomize  | Randomize the BBS List |
| find=value | Find a string in the BBS List |
| verify     | Verify the BBS List |
| save       | Save the BBS List back to the database file |
| show       | Show, in a basic plain format, the BBS List |
| add        | Add the local system to the BBS List |
| update         | Update the local system in the BBS List |
| delete         | Remove the local system from the BBS List (see also ''-remote'') |
| remove=<name>  | Remove an entry from the BBS List (see also ''-remote'') |
| preview=<name> | Capture the preview of the specified BBS entry |
| active         | Display the last activity date of each entry in the BBS List |
| dedupe         | Remove duplicate entries from the BBS List (''-v'') |
| maint          | Delete old/inactive entries from the BBS List (''-v'') |
| install        | Install the Synchronet BBS List in a Synchronet BBS |

=== Options === 
Command-line options begin with a ''-'' and modify the default behavior of ''sbbslist.js''.

^ Option   ^ Description ^
| -v       | Increase console output verbosity (e.g. for trouble-shooting) |
| -f=<file>| Specify an alternate JSON database path/filename  (default is ''[[dir:data]]/sbbslist.json'') |
| -quiet   | Minimize console output |
| -exclude=<value> | Exclude select entries from the BBS List |
| -format=<value> | Specify the default list format (''-format='' for a list of formats) |
| -filter=<value> | Filter BBS List based on specified value |
| -all            | Import/export all entries (even those locally created) - not normally recommended |
| -ptr=<value>    | Over-ride the stored import/export message base pointer value |
| -addr=<value>   | Specify the address to capture a BBS preview from |
| -preview        | Include a preview with a BBS List ''update'' |
| -sort=<value>   | Sort the BBS List based on specified field |
| -reverse        | Reverse the natural/default sort order |
| -remote         | Remove/delete an entry in remote/networked databases too (use with the ''delete'' or ''remove'' command) |
| -debug          | Enable debug console/log output |
| -test           | Perform non-destructive maintenance and de-duplication operations |
| -#              | Limit the number of entries listed |

===== See Also =====
  * [[:module:|Modules]]
  * [[:bbs:|BBS Lists]]
  * [[faq:misc#sbbslist|How do I get my BBS listed in the Synchronet BBS List?]]

{{tag>sbbslist}}
