Making ListPlus switchable in WWIV part 3

In a previous post, I modified the Main Defaults screen to display the ListPlus Enabled switch status. This status simply reads the variable lp_options and shows whether the cfl_enable bit is on or off, which we had defined in an earlier post. I’ll write about what I did to give the WWIV BBS user the ability to toggle that bit.

Since I want ListPlus to be available to users who have ANSI enabled, it makes sense to make the toggle as well as the switch visible to users who have okansi() = True. In defaults(), a section of code adds keys that the BBS tests for input. I simply add L to our allowable keys.

    737     bout.outstr("|#9Defaults: ");
    738     std::string allowable = "Q?1234567BCDIKMNTUW";
    739     if (okansi()) {
    740       allowable.append("89AS");
    741       if (a()->fullscreen_read_prompt()) {
    742         allowable.push_back('G');
    743       }
    744     }
    745     switch (const auto ch = onek(allowable, true); ch) {

I modify line 740 to:

    740       allowable.append("89ALS");

This makes the onek() function call in line 745, to accept L as input, aside from the other keys in the string allowable.

Now that onek() will accept L, I need to define a switch case, to handle what to do if the BBS receives an L. To make it easier to find the code, I insert the case definition for ‘L’ right after that for ‘K’.

    802     case 'K':
    803       wwiv::bbs::menus::ConfigUserMenuSet("");
    804       need_menu_reload = true;
    805       break;
       +    case 'L':
       +      a()->user()->data.lp_options ^= cfl_enable;
       +      break;
    806     case 'M':
    807       a()->user()->toggle_flag(User::noMsgs);
    808       break;

I used XOR assignment to toggle the cfl_enable bit of lp_options of the user. If it is currently on, XOR will set it off. If it is currently off, XOR will set it on.

That’s it. I’ve made the user’s cfl_enable bit (ListPlus) toggleable from the Main Defaults menu of WWIV.

Next time, I’ll describe the rest of the code modifications needed to make the switch actually turn ListPlus on or off in WWIV.

Getting back in the saddle…

After a long drought, I am back to writing stuff for WWIV.

I did a little bit of Python coding here and there, with some updates to my old scripts written in Python 2 so that they will now work nicely in Python 3.

I finished my wwiv5ibbslastcall package, which consists of two Python scripts. The first one, which originally was named wwivibbslastcaller, is now xwibbslastcaller.py. The second, originally just ibbs-extract, is now ibbs-extract3. Both of these are now written in Python 3.

xwibbslastcaller.py is responsible for getting the user’s info from the BBS drop files, then posting to the appropriate SUB or ECHO with the caller’s info in rot47. This script is usually part of the LOGON command and can be added to WWIV.INI in the LOGON_CMD setting like this:

LOGON_CMD = xwibbslastcaller.py %R

The other script, ibbs-extract3, reads in configuration settings from WWIV.INI, then proceeds to read message posts from the SUB or ECHO where IBBSLASTCALLER data is posted. It reads in data from the posts and writes out a laston.txt file for each network that it reads data from.

Here’s sample output of the package.

wwiv5ibbslastcall output showing InterBBS Last Callers for WWIVnet and fsxNet.

You can get the scripts from https://github.com/ericpareja/xenos-wwiv-utils/.