• How to add a switch/toggle in wwivconfig

    From Xenos #1@60.Wwivnet@11:1/101 to All on Thu Dec 25 16:02:34 2025

    How to add a switch/toggle in wwivconfig
    ====[ xenos@aliens.ph - 26 December 2025]======================================

    1) Define what you want to have a switch for in sdk/config.h

    in lines 54-onwards:

    struct system_toggles_t {
    bool lastnet_at_logon{false};
    bool show_chain_usage{false};

    // ADD YOUR TOGGLE VARIABLE HERE;
    // example: bool variable_name{default};
    // default is true or false, I suggest using false as default
    };

    2) Add to sdk/config_cereal.h so we can save it

    template <class Archive> void serialize(Archive& ar, system_toggles_t& n) {
    SERIALIZE(n, lastnet_at_logon);
    SERIALIZE(n, show_chain_usage);

    // ADD A SERIALIZE OF NEW VARIABLE HERE;
    // SERIALIZE(n, variable_name);
    SERIALIZE(n, variable_name);

    }

    3) Add to wwivconfig/toggles.cpp

    Add following lines:

    ++y;
    items.add(new Label("Thingy we wanna toggle:"),
    new BooleanEditItem(&t.variable_name),
    "Variable name toggle here", 1, y);

    4) You can reference the switch/toggle as:

    if (a()->config()->toggles().variable_name) {
    // do something if variable_name is true
    };



    -=<(xenos)>=-


    A .-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
    /*\ ] /\liens' /\lcove! WWIV on Linux, Taguig, Metro Manila, Philippines [
    / v \`-=-=-=-=-=-=-=-=-=-=-=-[ WWIV Development ]-=-=--=-=-=-=-=-=-=-=-=-=-'

    p Æ"
    --- WWIVToss v.1.52
    * Origin: http://www.weather-station.org * Bel Air, MD -USA (11:1/101.0)