void (*h_async_function) (void)
);
-void CtdlRegisterFixedOutputHook(char *content_type,
- void (*output_function) (char *supplied_data, int len)
-);
+void CtdlRegisterFixedOutputHook(char *content_type, void (*output_function) (char *supplied_data, int len));
void CtdlUnRegisterFixedOutputHook(char *content_type);
-
void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
-
void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name);
/*
void CtdlDisableHouseKeeping(void);
void CtdlEnableHouseKeeping(void);
-/*
- * Directory services hooks for LDAP etc
- */
-
-#define DIRECTORY_USER_DEL 1 // Delete a user entry
-#define DIRECTORY_CREATE_HOST 2 // Create a host entry if not already there.
-#define DIRECTORY_CREATE_OBJECT 3 // Create a new object for directory entry
-#define DIRECTORY_ATTRIB_ADD 4 // Add an attribute to the directory entry object
-#define DIRECTORY_SAVE_OBJECT 5 // Save the object to the directory service
-#define DIRECTORY_FREE_OBJECT 6 // Free the object and its attributes
-
-int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **object), int cmd, char *module);
-int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module, int cmd);
-
/* TODODRW: This needs to be changed into a hook type interface
* for now we have this horrible hack
*/
void CtdlPutRoomLock(struct ctdlroom *qrbuf);
typedef void (*ForEachRoomCallBack)(struct ctdlroom *EachRoom, void *out_data);
void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data);
-typedef void (*ForEachRoomNetCfgCallBack)(struct ctdlroom *EachRoom, void *out_data, char *cfg);
char *LoadRoomNetConfigFile(long roomnum);
-void SaveChangedConfigs(void);
+void SaveRoomNetConfigFile(long roomnum, const char *raw_netconfig);
void CtdlDeleteRoom(struct ctdlroom *qrbuf);
int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
void CtdlUserGoto (char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest);
*/
void listdeliver_sweep_room(char *roomname) {
char *netconfig = NULL;
+ char *newnetconfig = NULL;
long lastsent = 0;
char buf[SIZ];
int config_lines;
if (number_of_messages_processed > 0) {
syslog(LOG_DEBUG, "listdeliver: new lastsent is %ld", ld.msgnum);
- // FIXME write lastsent back to netconfig
- syslog(LOG_DEBUG, "\033[31mBEFORE:<%s>\033[0m", netconfig);
- syslog(LOG_DEBUG, "\033[32mAFTER:<%s>\033[0m", netconfig);
-
+ // Update this room's netconfig with the updated lastsent
+ netconfig = LoadRoomNetConfigFile(CC->room.QRnumber);
+ if (!netconfig) {
+ netconfig = strdup("");
+ }
+ // The new netconfig begins with the new lastsent directive
+ newnetconfig = malloc(strlen(netconfig) + 1024);
+ sprintf(newnetconfig, "lastsent|%ld\n", ld.msgnum);
+ // And then we append all of the old netconfig, minus the old lastsent. Also omit blank lines.
+ config_lines = num_tokens(netconfig, '\n');
+ for (i=0; i<config_lines; ++i) {
+ extract_token(buf, netconfig, i, '\n', sizeof buf);
+ if ( (!IsEmptyStr(buf)) && (strncasecmp(buf, "lastsent|", 9)) ) {
+ sprintf(&newnetconfig[strlen(newnetconfig)], "%s\n", buf);
+ }
+ }
+ // Write the new netconfig back to disk
+ SaveRoomNetConfigFile(CC->room.QRnumber, newnetconfig);
+ free(newnetconfig);
}
}
-
free(netconfig);
}
/*
* Given a room number and a textual netconfig, convert to base64 and write to the configdb
*/
-void write_netconfig_to_configdb(long roomnum, const char *raw_netconfig) {
+void SaveRoomNetConfigFile(long roomnum, const char *raw_netconfig) {
char keyname[25];
char *enc;
int enc_len;
}
FreeStrBuf(&Line);
- write_netconfig_to_configdb(CC->room.QRnumber, ChrPtr(TheConfig));
+ SaveRoomNetConfigFile(CC->room.QRnumber, ChrPtr(TheConfig));
FreeStrBuf(&TheConfig);
}
if (v) {
rewind(fp);
if (fread(v, len, 1, fp)) {
- write_netconfig_to_configdb(roomnum, v);
+ SaveRoomNetConfigFile(roomnum, v);
unlink(filename);
}
free(v);