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 ?
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 ?
+var utf8_support = ((options && options.utf8_support) || true) && console.term_supports(USER_UTF8); //default to true
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).
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.
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.
Sysop: | Eric Oulashin |
---|---|
Location: | Beaverton, Oregon, USA |
Users: | 90 |
Nodes: | 16 (0 / 16) |
Uptime: | 08:57:58 |
Calls: | 5,073 |
Calls today: | 5 |
Files: | 8,491 |
Messages: | 352,813 |