Commits (1)
  • Rob Swindell's avatar
    Fix issue with QWKnet hub sub-board mappings when inserting new sub-boards · cadada4d
    Rob Swindell authored
    The sub_t.subnum's that were being updated as message areas were being saved to
    msgs.ini could not be used as an index into the scfg_t.sub array at this point
    (the subnum would be the new index position when the msgs.ini was re-read/loaded)
    This was not an issue in v3.19 because we just saved the subnum (to msgs.cnf) and
    in v3.20, we save the sub's internal code (to msgs.ini) and were using the newly
    updated sub_t.subnum to find the corresponding sub_t for that internal code. Since
    the subnum is not used now during the save process, no need to update it here
    (this reverses part of the commit 11e529d4 from 5 years ago).
    This fixes issue #502 - thanks to the irc.synchro.netizens that reported it!
......@@ -365,7 +365,6 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
/* Message Sub-boards */
unsigned int subnum = 0; /* New sub-board numbering (as saved) */
for(unsigned grp = 0; grp < cfg->total_grps; grp++) {
for(uint i=0; i<cfg->total_subs; i++) {
if(cfg->sub[i]->lname[0] == 0
......@@ -377,7 +376,6 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
SAFEPRINTF2(name, "sub:%s:%s"
,cfg->grp[grp]->sname, cfg->sub[i]->code_suffix);
str_list_t section = strListInit();
cfg->sub[i]->subnum = subnum++;
iniSetString(&section, name, "description", cfg->sub[i]->lname, NULL);
iniSetString(&section, name, "name", cfg->sub[i]->sname, NULL);
iniSetString(&section, name, "qwk_name", cfg->sub[i]->qwkname, NULL);
......@@ -506,17 +504,15 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
strListMerge(&ini, section);
for(uint j=0; j<cfg->qhub[i]->subs; j++) {
if(cfg->qhub[i]->sub[j] == NULL)
int subnum = cfg->qhub[i]->sub[j]->subnum;
if(!is_valid_subnum(cfg, subnum))
sub_t* sub = cfg->qhub[i]->sub[j];
if(sub == NULL)
SAFEPRINTF2(name, "qhubsub:%s:%u", cfg->qhub[i]->id, cfg->qhub[i]->conf[j]);
str_list_t section = strListInit();
char code[LEN_EXTCODE + 1];
iniSetString(&section, name, "sub", code, NULL);
iniSetHexInt(&section, name, "settings", cfg->qhub[i]->mode[j], NULL);
strListMerge(&ini, section);