{"id":264,"date":"2026-01-01T23:46:38","date_gmt":"2026-01-01T15:46:38","guid":{"rendered":"https:\/\/aliens.ph\/blog\/?p=264"},"modified":"2026-01-01T23:46:38","modified_gmt":"2026-01-01T15:46:38","slug":"how-to-add-a-switch-toggle-in-wwivconfig","status":"publish","type":"post","link":"https:\/\/aliens.ph\/blog\/2026\/01\/01\/how-to-add-a-switch-toggle-in-wwivconfig\/","title":{"rendered":"How to add a switch\/toggle in wwivconfig"},"content":{"rendered":"\n<p><br>How to add a switch\/toggle in wwivconfig<\/p>\n\n\n\n<p>====[ xenos@aliens.ph &#8211; 26 December 2025]===========<\/p>\n\n\n\n<p>1) Define what you want to have a switch for in sdk\/config.h<\/p>\n\n\n\n<p>in lines 54-onwards:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  struct system_toggles_t {\n     bool lastnet_at_logon{false};\n  bool show_chain_usage{false};\n\n      \/\/ ADD YOUR TOGGLE VARIABLE HERE;\n  \/\/ example: bool variable_name{default};\n  \/\/ default is true or false, I suggest using false as default\n  bool variable_name{false};\n  };<\/code><\/pre>\n\n\n\n<p>2) Add to sdk\/config_cereal.h so we can save it<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  template &lt;class Archive> void serialize(Archive&amp; ar, system_toggles_t&amp; n) {\n    SERIALIZE(n, lastnet_at_logon);\n    SERIALIZE(n, show_chain_usage);\n\n    \/\/ ADD A SERIALIZE OF NEW VARIABLE HERE;\n    \/\/ SERIALIZE(n, variable_name);\n    SERIALIZE(n, variable_name);\n\n    }<\/code><\/pre>\n\n\n\n<p>3) Add to wwivconfig\/toggles.cpp<\/p>\n\n\n\n<p>Add the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   ++y;\n   items.add(new Label(\"Thingy we wanna toggle:\"),\n            new BooleanEditItem(&amp;t.variable_name),\n     \"Variable name toggle here\", 1, y);<\/code><\/pre>\n\n\n\n<p>4) You can then reference the switch\/toggle as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  if (a()->config()->toggles().variable_name) {\n         \/\/ do something if variable_name is true\n  };<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to add a switch\/toggle in wwivconfig ====[ xenos@aliens.ph &#8211; 26 December 2025]=========== 1) Define what you want to have a switch for in sdk\/config.h in lines 54-onwards: 2) Add to sdk\/config_cereal.h so we can save it 3) Add to wwivconfig\/toggles.cpp Add the following lines: 4) You can then reference the switch\/toggle as:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":""},"categories":[7],"tags":[],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-wwiv"],"_links":{"self":[{"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/comments?post=264"}],"version-history":[{"count":1,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/posts\/264\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/media?parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/categories?post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aliens.ph\/blog\/wp-json\/wp\/v2\/tags?post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}