• Creating message menu

    From Amessyroom@VERT/TL-QWK to All on Tue Sep 24 22:41:15 2024
    I've taken code from default.js to create a message menu but there are
    two components, that I don't understand that are in the code:
    What are node_action: value? NODE_XFER was just copied from the file
    menu definition.
    What is the "eval: 'bbs.messages_cmds++' used for?

    const message_menu = {
    file: "messages",
    eval: 'bbs.message_cmds++',
    node_action: NODE_XFER,
    prompt: "\x01-\x01c\xfe \x01b\x01h" + gettext("Messages") + " \x01n\x01c\xfe \x01h" + time_code +
    " \x01n\x01c[\x01h@GN@\x01n\x01c] @GRP@\x01\\ [\x01h@SN@\x01n\x01c] @SUB@: \x01n",
    num_input: shell.get_sub_num,
    slash_num_input: shell.get_grp_num,
    command: {
    '&': { exec: 'msgscancfg.js' },
    'F': { eval: 'bbs.scan_subs(SCAN_FIND)'
    ,msg: '\r\n\x01c\x01h' + gettext("Find Text in Messages") + '\r\n' },
    'J': { eval: 'shell.select_msg_area()' },
    'L': { eval: 'bbs.list_msgs()' },
    'M': { eval: 'bbs.scan_subs(SCAN_NEW, /* all */true)' },
    'P': { eval: 'bbs.post_msg()' },
    '/P': { exec: 'postpoll.js' },
    'R': { eval: 'bbs.scan_msgs()' },
    'S': { eval: 'bbs.scan_subs(SCAN_TOYOU)'
    ,msg: '\r\n\x01c\x01h' + gettext("Scan for Messages Posted to You") + '\r\n' },
    'U': { eval: 'bbs.scan_subs(SCAN_TOYOU, /* all */true)' },
    'V': { exec: 'scanpolls.js' },
    '/V': { exec: 'scanpolls.js', args: ['all'] },
    },
    nav: {
    '\r': { },
    'Q': { eval: 'menu = main_menu' },
    '>': { eval: 'shell.sub_up()' },
    '}': { eval: 'shell.sub_up()' },
    ')': { eval: 'shell.sub_up()' },
    '+': { eval: 'shell.sub_up()' },
    '=': { eval: 'shell.sub_up()' },
    '<': { eval: 'shell.sub_down()' },
    '{': { eval: 'shell.sub_down()' },
    '(': { eval: 'shell.sub_down()' },
    '-': { eval: 'shell.sub_down()' },
    ']': { eval: 'shell.grp_up()' },
    '[': { eval: 'shell.grp_down()' },
    },
    };

    ---
    þ Synchronet þ Too Lazy BBS - toolazy.synchro.net:2323
  • From Digital Man@VERT to Amessyroom on Tue Sep 24 23:16:56 2024
    Re: Creating message menu
    By: Amessyroom to All on Tue Sep 24 2024 10:41 pm

    I've taken code from default.js to create a message menu but there are
    two components, that I don't understand that are in the code:
    What are node_action: value? NODE_XFER was just copied from the file
    menu definition.

    "XFER" in this context means "file transfer". Probably not what you want.
    The possible values for the node_action can be found in load/nodedefs.js.
    For a "message menu", you'd probably want to use NODE_RMSG (reading messages).

    What is the "eval: 'bbs.messages_cmds++' used for?

    It's not. I suspect you might've create that property yourself via search/replace maybe? The built-in command counters are bbs.main_cmds and bbs.xfer_cmds and their used for special actions that only occur before/during/after a specific number of user commands have been entered. It's not a common use case. If you want to create and increment bbs.message_cmds in your script, that's fine. No harm.
    --
    digital man (rob)

    Synchronet "Real Fact" #22:
    The second ever Synchronet BBS was the Mid-Nite Hacker BBS (sysop: The Zapper) Norco, CA WX: 62.2øF, 85.0% humidity, 0 mph W wind, 0.00 inches rain/24hrs
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Amessyroom on Wed Sep 25 11:30:09 2024
    Re: Creating message menu
    By: Amessyroom to All on Tue Sep 24 2024 22:41:15

    I've taken code from default.js to create a message menu but there are two components, that I don't understand that are in the code: What are node_action: value? NODE_XFER was just copied from the file menu
    What is the "eval: 'bbs.messages_cmds++' used for?

    The "message_menu" variable contains values that the script uses to take a few actions when the user opens that menu. The "file", "prompt", and "command" properties are fairly obvious.

    "eval" is a place where you can specify some JS code that will be executed when the menu loads (including when a user returns from a command, I think). So the bbs.messages_cmds variable is being incremented when this happens. For reasons I don't know.

    (And each command can have an "eval" or "exec" depending on whether you want to run script from a string or execute a file to fulfill the command.)

    As an aside, these "menu objects" seem very much like they were meant to be stored in JSON files. "eval" would make some sense there; inside the script itself these could just be functions.

    node_action: NODE_XFER,

    https://synchro.net/docs/jsobjs.html#bbs_object

    The "bbs" object has a "node_action" property which says what the user is currently doing. This is used in things like a "who's online" list. As DM said, look at "exec/load/nodedefs.js" for possible values.

    This script takes the "node_action" value from the menu object and applies it when the menu loads. So it's setting "bbs.node_action = NODE_XFER", which corresponds to "at transfer menu". I would say NODE_RMSG is probably the best fit when the user is viewing the messages menu.

    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ---
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com