• How to create options for modopt

    From martylake@1:103/705 to All on Tue Dec 7 01:31:32 2021
    Dear All,

    Following up on today's (yesterday?) discussion on IRC, I am trying to load modpots.js for irc.js to have a new option utf8_support. However, I get an error typeerror options is null.

    How do you create new option types or category ?

    Best,
    martylake
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to martylake on Tue Dec 7 12:54:02 2021
    Re: How to create options for modopt
    By: martylake to All on Tue Dec 07 2021 01:31 am

    Dear All,

    Following up on today's (yesterday?) discussion on IRC, I am trying to load modpots.js for irc.js to have a new option utf8_support. However, I get an error typeerror options is null.

    How do you create new option types or category ?

    Did you read this: http://wiki.synchro.net/config:modopts.ini ?
    --
    digital man (rob)

    This Is Spinal Tap quote #30:
    Big bottom, big bottom / Talk about mud flaps, my girl's got 'em!
    Norco, CA WX: 59.6F, 80.0% humidity, 3 mph NW wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From martylake@1:103/705 to Digital Man on Tue Dec 7 23:40:50 2021
    Re: How to create options for modopt
    By: martylake to All on Tue Dec 07 2021 01:31 am

    Did you read this: http://wiki.synchro.net/config:modopts.ini ?

    Not yet ! Thank you very much for the link.

    Here is a patch for fixing irc.js encoding scrambling, it consists of two parts:
    * convert incoming UTF8 to CP437 when communicating with a server, but the client is not UTF8
    * convert to UTF8 when sending messages to the client, if supported

    Not sure if it's the optimal way of implementing this, I had the expected behavior with thes two test setup:
    * synchronet's irc server:
    * syncterm
    * ubuntu terminal utf8 ssh
    * irc client via znc utf8
    * inspircd server
    * syncterm
    * ubuntu terminal utf8 ssh
    * irc client via znc utf8

    Best,
    martylake



    From 1414ee4803d1e71749a160a56d783df68668b4a5 Mon Sep 17 00:00:00 2001
    From: martylake <redactedmail@example.com>
    Date: Wed, 8 Dec 2021 08:15:12 +0100
    Subject: [PATCH 1/2] When the user console is not UTF8, encode and decode
    from/to CP437

    ---
    exec/irc.js | 9 +++++++++
    1 file changed, 9 insertions(+)

    diff --git a/exec/irc.js b/exec/irc.js
    index 233bbef77..ad1afd246 100644
    --- a/exec/irc.js
    +++ b/exec/irc.js
    @@ -34,6 +34,8 @@ var real_names=true;
    js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
    console.ctrlkey_passthru=~(134217728);

    +var options = load('modopts.js', 'fseditor');
    +var utf8_support = ((options && options.utf8_support) || true) && console.term_supports(USER_UTF8); //default to true
    // Commands to send...
    var client_cmds = {
    'PASS':{minparam:1,maxparam:1}, // Must be sent before NICK/USER
    @@ -223,6 +225,10 @@ function send_cmd(command, params)
    screen.print_line("\x01H\x01R!! \x01N\x01R"+command+" requires at least "+cmd.minparam+" parameters\x01N\x01W");
    return;
    }
    + if(!utf8_support)
    + {
    + snd = utf8_encode(snd);
    + }
    sock.send(snd+"\r\n");
    }

    @@ -566,6 +572,9 @@ function get_command()
    line=sock.recvline();
    if(!line)
    return;
    + if(!utf8_support
  • From Digital Man@1:103/705 to martylake on Wed Dec 8 09:33:01 2021
    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Tue Dec 07 2021 11:40 pm

    +var utf8_support = ((options && options.utf8_support) || true) && console.term_supports(USER_UTF8); //default to true

    Did you try setting utf8_support = false in the modopts.ini file? It doesn't look like this logic would work to me. The "|| true" would make the UTF-8 support *always* enabled (when the terminal supports UTF-8).
    --
    digital man (rob)

    Breaking Bad quote #39:
    Vacuum cleaner repair? What did you expect? Haji's quick vanish? - Saul
    Norco, CA WX: 55.7F, 94.0% humidity, 0 mph S wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From martylake@1:103/705 to Digital Man on Wed Dec 8 21:28:52 2021
    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Tue Dec 07 2021 11:40 pm

    Did you try setting utf8_support = false in the modopts.ini file? It doesn't look like this logic would work to me. The "|| true" would make the UTF-8 support *always* enabled (when the terminal supports UTF-8).

    No I had not tried to set utf8_support in the modopt.ini . After trying, the option is indeed ignored by " || true".
    What I wanted to express is: "true unless the option exists and is set". See diff below, this time I manually tested that it works for all 3 cases: option section missing, option disabled and option enabled.

    Also the option should probably sit in "chat_sec" section, not "fseditor". Reflected in bellow's diff.



    diff --git a/exec/irc.js b/exec/irc.js
    index 672dc73c0..44e21620c 100644
    --- a/exec/irc.js
    +++ b/exec/irc.js
    @@ -35,8 +35,12 @@ js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
    console.ctrlkey_passthru=~(134217728);
    var pmode = 0;

    -var options = load('modopts.js', 'fseditor');
    +var options = load('modopts.js', 'chat_sec');
    -var utf8_support = ((options && options.utf8_support) || true) && console.term_supports(USER_UTF8); //default to true
    +var utf8_support = true;
    +if(options && options.utf8_support)
    +{
    + utf8_support = console.term_supports(USER_UTF8);
    +}
    if(utf8_support)
    {
    pmode |= P_UTF8;
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to martylake on Thu Dec 9 11:55:22 2021
    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Wed Dec 08 2021 09:28 pm

    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Tue Dec 07 2021 11:40 pm

    Did you try setting utf8_support = false in the modopts.ini file? It doesn't look like this logic would work to me. The "|| true" would make the UTF-8 support *always* enabled (when the terminal supports UTF-8).

    No I had not tried to set utf8_support in the modopt.ini . After trying, the option is indeed ignored by " || true".
    What I wanted to express is: "true unless the option exists and is set". See diff below, this time I manually tested that it works for all 3 cases: option section missing, option disabled and option enabled.

    Also the option should probably sit in "chat_sec" section, not "fseditor". Reflected in bellow's diff.

    Actually, the appropriate module name would be "irc" (and thus the section in modopts.ini would be [irc]). :-)
    --
    digital man (rob)

    Breaking Bad quote #11:
    My apologies to the HR department: Grow tumescent with anticipation. - Hank Norco, CA WX: 53.7F, 92.0% humidity, 8 mph N wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to martylake on Thu Jan 6 22:20:40 2022
    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Wed Dec 08 2021 09:28 pm

    Re: Re: How to create options for modopt
    By: martylake to Digital Man on Tue Dec 07 2021 11:40 pm

    Did you try setting utf8_support = false in the modopts.ini file? It doesn't look like this logic would work to me. The "|| true" would make the UTF-8 support *always* enabled (when the terminal supports UTF-8).

    No I had not tried to set utf8_support in the modopt.ini . After trying, the option is indeed ignored by " || true".
    What I wanted to express is: "true unless the option exists and is set". See diff below, this time I manually tested that it works for all 3 cases: option section missing, option disabled and option enabled.

    Also the option should probably sit in "chat_sec" section, not "fseditor". Reflected in bellow's diff.



    diff --git a/exec/irc.js b/exec/irc.js
    index 672dc73c0..44e21620c 100644
    --- a/exec/irc.js
    +++ b/exec/irc.js
    @@ -35,8 +35,12 @@ js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
    console.ctrlkey_passthru=~(134217728);
    var pmode = 0;

    -var options = load('modopts.js', 'fseditor');
    +var options = load('modopts.js', 'chat_sec');
    -var utf8_support = ((options && options.utf8_support) || true) && console.term_supports(USER_UTF8); //default to true
    +var utf8_support = true;
    +if(options && options.utf8_support)
    +{
    + utf8_support = console.term_supports(USER_UTF8);
    +}
    if(utf8_support)
    {
    pmode |= P_UTF8;

    Did you ever get this patch into a final state? The ideal thing would be to submit a merge request at gitlab.synchro.net. I'd be happy to accept/merge it into our master branch if you're happy with it.
    --
    digital man (rob)

    Rush quote #41:
    Angels and demons dancing in my head, lunatics and monsters underneath my bed Norco, CA WX: 57.4F, 71.0% humidity, 2 mph E wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to martylake on Mon Jan 17 22:18:23 2022
    Re: Re: How to create options for modopt
    By: Digital Man to martylake on Thu Jan 06 2022 10:20 pm

    Did you ever get this patch into a final state? The ideal thing would be to submit a merge request at gitlab.synchro.net. I'd be happy to accept/merge it into our master branch if you're happy with it.

    I never heard back, so I went ahead and committed a change base mostly on your patch set. Hopefully that works as expected for everyone.
    --
    digital man (rob)

    Synchronet "Real Fact" #57:
    Synchronet introduced Telnet, FTP, SMTP and POP3 support w/v3.00a-Win32 in 2000 Norco, CA WX: 55.9F, 91.0% humidity, 0 mph SE wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)