Skip to content
Snippets Groups Projects
Commit 86ee9c7b authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Replace SUB_HDRMOD sub_t.misc flag with bool cfg_modified

No reason waste a (stored) config/settings flag (bit) for this purpose
parent d4396f5d
Branches
Tags
No related merge requests found
...@@ -240,7 +240,6 @@ ...@@ -240,7 +240,6 @@
#define SUB_EDIT (1 << 28) /* Users can edit message text after posting */ #define SUB_EDIT (1 << 28) /* Users can edit message text after posting */
#define SUB_EDITLAST (1 << 29) /* Users can edit last message only */ #define SUB_EDITLAST (1 << 29) /* Users can edit last message only */
#define SUB_NOUSERSIG (1 << 30) /* Suppress user signatures */ #define SUB_NOUSERSIG (1 << 30) /* Suppress user signatures */
#define SUB_HDRMOD (1U << 31) /* Modified sub-board header info (SCFG) */
/* Bit values for lib[x].misc */ /* Bit values for lib[x].misc */
#define LIB_DIRS (1 << 0) /* Local directory (sub-directory of lib parent) access */ #define LIB_DIRS (1 << 0) /* Local directory (sub-directory of lib parent) access */
......
...@@ -810,7 +810,7 @@ void msgs_cfg() ...@@ -810,7 +810,7 @@ void msgs_cfg()
template = cfg.sub[j]; template = cfg.sub[j];
else if (cfg.sub[j] != template) { else if (cfg.sub[j] != template) {
uifc.changes = 1; uifc.changes = 1;
cfg.sub[j]->misc = template->misc | SUB_HDRMOD; cfg.sub[j]->misc = template->misc;
cfg.sub[j]->misc &= ~SUB_TEMPLATE; cfg.sub[j]->misc &= ~SUB_TEMPLATE;
SAFECOPY(cfg.sub[j]->post_arstr, template->post_arstr); SAFECOPY(cfg.sub[j]->post_arstr, template->post_arstr);
SAFECOPY(cfg.sub[j]->read_arstr, template->read_arstr); SAFECOPY(cfg.sub[j]->read_arstr, template->read_arstr);
...@@ -826,6 +826,7 @@ void msgs_cfg() ...@@ -826,6 +826,7 @@ void msgs_cfg()
cfg.sub[j]->pmode = template->pmode; cfg.sub[j]->pmode = template->pmode;
cfg.sub[j]->n_pmode = template->n_pmode; cfg.sub[j]->n_pmode = template->n_pmode;
cfg.sub[j]->faddr = template->faddr; cfg.sub[j]->faddr = template->faddr;
cfg.sub[j]->cfg_modified = true;
} }
} }
} }
......
...@@ -50,7 +50,7 @@ bool new_sub(int new_subnum, int group_num, sub_t* pasted_sub, long misc) ...@@ -50,7 +50,7 @@ bool new_sub(int new_subnum, int group_num, sub_t* pasted_sub, long misc)
break; break;
} }
} }
new_subboard->misc |= SUB_HDRMOD; new_subboard->cfg_modified = true;
if (pasted_sub != NULL) { if (pasted_sub != NULL) {
*new_subboard = *pasted_sub; *new_subboard = *pasted_sub;
if (cut_qhub_sub != NULL && (*cut_qhub_sub) == NULL) { if (cut_qhub_sub != NULL && (*cut_qhub_sub) == NULL) {
...@@ -539,7 +539,7 @@ void sub_cfg(int grpnum) ...@@ -539,7 +539,7 @@ void sub_cfg(int grpnum)
uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Number of Messages (0=Unlimited)" uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Number of Messages (0=Unlimited)"
, str, 9, K_EDIT | K_NUMBER); , str, 9, K_EDIT | K_NUMBER);
cfg.sub[i]->maxmsgs = atoi(str); cfg.sub[i]->maxmsgs = atoi(str);
cfg.sub[i]->misc |= SUB_HDRMOD; cfg.sub[i]->cfg_modified = true;
break; break;
case 12: case 12:
sprintf(str, "%u", cfg.sub[i]->maxage); sprintf(str, "%u", cfg.sub[i]->maxage);
...@@ -561,7 +561,7 @@ void sub_cfg(int grpnum) ...@@ -561,7 +561,7 @@ void sub_cfg(int grpnum)
uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Age of Messages (in days)" uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Age of Messages (in days)"
, str, 5, K_EDIT | K_NUMBER); , str, 5, K_EDIT | K_NUMBER);
cfg.sub[i]->maxage = atoi(str); cfg.sub[i]->maxage = atoi(str);
cfg.sub[i]->misc |= SUB_HDRMOD; cfg.sub[i]->cfg_modified = true;
break; break;
case 13: case 13:
sprintf(str, "%" PRIu32, cfg.sub[i]->maxcrcs); sprintf(str, "%" PRIu32, cfg.sub[i]->maxcrcs);
...@@ -582,7 +582,7 @@ void sub_cfg(int grpnum) ...@@ -582,7 +582,7 @@ void sub_cfg(int grpnum)
uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Number of CRCs" uifc.input(WIN_MID | WIN_SAV, 0, 17, "Maximum Number of CRCs"
, str, 9, K_EDIT | K_NUMBER); , str, 9, K_EDIT | K_NUMBER);
cfg.sub[i]->maxcrcs = atol(str); cfg.sub[i]->maxcrcs = atol(str);
cfg.sub[i]->misc |= SUB_HDRMOD; cfg.sub[i]->cfg_modified = true;
break; break;
case 14: case 14:
while (1) { while (1) {
...@@ -1585,7 +1585,7 @@ void sub_cfg(int grpnum) ...@@ -1585,7 +1585,7 @@ void sub_cfg(int grpnum)
uifc.changes = TRUE; uifc.changes = TRUE;
cfg.sub[i]->misc |= SUB_HYPER; cfg.sub[i]->misc |= SUB_HYPER;
cfg.sub[i]->misc &= ~SUB_FAST; cfg.sub[i]->misc &= ~SUB_FAST;
cfg.sub[i]->misc |= SUB_HDRMOD; cfg.sub[i]->cfg_modified = true;
break; break;
} }
if (!n) if (!n)
...@@ -1610,7 +1610,7 @@ void sub_cfg(int grpnum) ...@@ -1610,7 +1610,7 @@ void sub_cfg(int grpnum)
} }
if (cfg.sub[i]->misc & SUB_HYPER) if (cfg.sub[i]->misc & SUB_HYPER)
cfg.sub[i]->misc |= SUB_HDRMOD; cfg.sub[i]->cfg_modified = true;
if (n == 1 && !(cfg.sub[i]->misc & SUB_FAST)) { if (n == 1 && !(cfg.sub[i]->misc & SUB_FAST)) {
uifc.changes = TRUE; uifc.changes = TRUE;
cfg.sub[i]->misc |= SUB_FAST; cfg.sub[i]->misc |= SUB_FAST;
......
...@@ -57,6 +57,7 @@ typedef struct { /* Message sub board info */ ...@@ -57,6 +57,7 @@ typedef struct { /* Message sub board info */
int32_t pmode; /* printfile()/putmsg() mode flags */ int32_t pmode; /* printfile()/putmsg() mode flags */
int32_t n_pmode; /* set of negated pmode flags */ int32_t n_pmode; /* set of negated pmode flags */
faddr_t faddr; /* FidoNet address */ faddr_t faddr; /* FidoNet address */
bool cfg_modified; /* Update SMB header for this sub */
} sub_t; } sub_t;
......
...@@ -411,7 +411,7 @@ bool write_msgs_cfg(scfg_t* cfg) ...@@ -411,7 +411,7 @@ bool write_msgs_cfg(scfg_t* cfg)
iniSetString(&section, name, "read_ars", cfg->sub[i]->read_arstr, &ini_style); iniSetString(&section, name, "read_ars", cfg->sub[i]->read_arstr, &ini_style);
iniSetString(&section, name, "post_ars", cfg->sub[i]->post_arstr, &ini_style); iniSetString(&section, name, "post_ars", cfg->sub[i]->post_arstr, &ini_style);
iniSetString(&section, name, "operator_ars", cfg->sub[i]->op_arstr, &ini_style); iniSetString(&section, name, "operator_ars", cfg->sub[i]->op_arstr, &ini_style);
iniSetHexInt(&section, name, "settings", cfg->sub[i]->misc & (~SUB_HDRMOD), &ini_style); /* Don't write mod bit */ iniSetHexInt(&section, name, "settings", cfg->sub[i]->misc, &ini_style); /* Don't write mod bit */
iniSetString(&section, name, "qwknet_tagline", cfg->sub[i]->tagline, &ini_style); iniSetString(&section, name, "qwknet_tagline", cfg->sub[i]->tagline, &ini_style);
iniSetString(&section, name, "fidonet_origin", cfg->sub[i]->origline, &ini_style); iniSetString(&section, name, "fidonet_origin", cfg->sub[i]->origline, &ini_style);
iniSetString(&section, name, "post_sem", cfg->sub[i]->post_sem, &ini_style); iniSetString(&section, name, "post_sem", cfg->sub[i]->post_sem, &ini_style);
...@@ -429,7 +429,7 @@ bool write_msgs_cfg(scfg_t* cfg) ...@@ -429,7 +429,7 @@ bool write_msgs_cfg(scfg_t* cfg)
strListMerge(&ini, section); strListMerge(&ini, section);
free(section); free(section);
if (all_msghdr || (cfg->sub[i]->misc & SUB_HDRMOD && !no_msghdr)) { if (all_msghdr || (cfg->sub[i]->cfg_modified && !no_msghdr)) {
if (!cfg->sub[i]->data_dir[0]) if (!cfg->sub[i]->data_dir[0])
SAFEPRINTF(smb.file, "%ssubs", cfg->data_dir); SAFEPRINTF(smb.file, "%ssubs", cfg->data_dir);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment