Subj : Fixed possible issue at chat_sec.js?
To   : Karloch
From : Digital Man
Date : Mon Apr 13 2015 07:29 pm

 Re: Fixed possible issue at chat_sec.js?
 By: Karloch to All on Sat Apr 11 2015 08:49 pm

> U have been looking arround the IRC chat feature at Synchronet, and I wanted
> to change the default IRC network and channel, giving the users the
> possibility of writting down their on server. For some reason, the users
> were not able to join another IRC network regardless of writting it when the
> BBS asked.

Thanks for the bug report!

> I spotted this code at chat_sec.js:
>
> case 'R':
> {
>     if(user.security.level >= 90 || user.security.exemptions&UFLAG_C) {
>         write("\r\n\001n\001y\001hIRC Server: ");
>         server=console.getstr(irc_server, 40, K_EDIT|K_LINE|K_AUTODEL);
>         if(console.aborted)
>            break;
>     }
>     write("\r\n\001n\001y\001hIRC Channel: ");
>     var channel=console.getstr(irc_channel, 40, K_EDIT|K_LINE|K_AUTODEL);
>     if(!console.aborted)
>         bbs.exec("?irc -a " + irc_server + " " + channel);
> }
> break;
>
> I though that the vars were not right, so I changed that code to this one:
>
> case 'R':
> {
>     if(user.security.level >= 50 || user.security.exemptions&UFLAG_C) {
>         write("\r\n\001n\001y\001hIRC Server: ");
>         var server=console.getstr(irc_server, 40, K_EDIT|K_LINE|K_AUTODEL);
>         if(console.aborted)
>             break;
>     }
>     write("\r\n\001n\001y\001hIRC Channel: ");
>     var channel=console.getstr(irc_channel, 40, K_EDIT|K_LINE|K_AUTODEL);
>     if(!console.aborted)
>         bbs.exec("?irc -a " + server + " " + channel);
> }
> break;
>
> Everything is working like a charm now. I would like to know if there is an
> official way to contribute with the Synchronet code in order to help the
> development in some way.

The official way is to post or email the patch.

In this case, I couldn't accept the patch exactly as you'd written because it
doesn't appear that it would work for security levels < 50 (the "server"
variable would not be defined and you'd get a JS error). Also, you changed the
minimum security level for changing the IRC server from 90 to 50.

So I'm committing a fix which should be correct for all conditions and also
adding a modopts.ini option to change the minimum security level for entering a
custom IRC server. Just set irc_seclevel in the [chat_sec] of your
ctrl/modopts.ini file to 50 and you should be good to go (after getting the
latest chat_sec.js from CVS).

> Also, many thanks to all the developers for their amazing work!

You're very welcome! And thanks again for the bug report and root-cause
analysis.

                                           digital man

Synchronet "Real Fact" #51:
Answers to Frequently Asked Questions: http://wiki.synchro.net/faq:index
Norco, CA WX: 67.4�F, 59.0% humidity, 5 mph ESE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net