- CtdlWriteObject(SYSCONFIGROOM, sysconfname, sysconfdata, (strlen(sysconfdata)+1), NULL, 0, 1, 0);
+ long msgnum = -1;
+
+ // Search for the previous copy of this config item, deleting it if it is found.
+ msgnum = CtdlGetConfigLong(sysconfname);
+ if (msgnum > 0) {
+ CtdlDeleteMessages(SYSCONFIGROOM, &msgnum, 1, "");
+ }
+
+ // Go ahead and save it, and write the new msgnum to the config database so we can find it again
+ msgnum = CtdlWriteObject(SYSCONFIGROOM, sysconfname, sysconfdata, (strlen(sysconfdata)+1), NULL, 0, 0);
+ if (msgnum > 0) {
+ CtdlSetConfigLong(sysconfname, msgnum);
+ }