[cvslog] (2004-10-01 15:31:29 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Fri Oct 1 09:31:29 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2004-10-01 15:31:29 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/eggdrop.h lib/eggdrop/users.c lib/eggdrop/users.h
     lib/eggdrop/xml.c lib/eggdrop/xml.h modules/server/Makefile.am
     modules/server/scriptcmds.c modules/server/server.c
     modules/server/server.h

Log message:

* User and channel extended settings accessible by xml dom

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/eggdrop.h
diff -u eggdrop1.9/lib/eggdrop/eggdrop.h:1.44 eggdrop1.9/lib/eggdrop/eggdrop.h:1.45
--- eggdrop1.9/lib/eggdrop/eggdrop.h:1.44	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/lib/eggdrop/eggdrop.h	Fri Oct  1 10:31:18 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: eggdrop.h,v 1.44 2004/09/26 09:42:09 stdarg Exp $
+ * $Id: eggdrop.h,v 1.45 2004/10/01 15:31:18 stdarg Exp $
  */
 
 #ifndef _EGG_EGGDROP_H_
@@ -27,6 +27,7 @@
 #endif
 
 #include <eggdrop/common.h>
+#include <eggdrop/xml.h>
 #include <eggdrop/flags.h>
 #include <eggdrop/ircmasks.h>
 #include <eggdrop/hash_table.h>
@@ -56,7 +57,6 @@
 #include <eggdrop/sockbuf.h>
 #include <eggdrop/script.h>
 #include <eggdrop/throttle.h>
-#include <eggdrop/xml.h>
 #include <eggdrop/timeutil.h>
 
 /* Gettext macros */
Index: eggdrop1.9/lib/eggdrop/users.c
diff -u eggdrop1.9/lib/eggdrop/users.c:1.41 eggdrop1.9/lib/eggdrop/users.c:1.42
--- eggdrop1.9/lib/eggdrop/users.c:1.41	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/lib/eggdrop/users.c	Fri Oct  1 10:31:18 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: users.c,v 1.41 2004/09/26 09:42:09 stdarg Exp $";
+static const char rcsid[] = "$Id: users.c,v 1.42 2004/10/01 15:31:18 stdarg Exp $";
 #endif
 
 #include <stdio.h>
@@ -75,6 +75,7 @@
 static int cache_check_add(const void *key, void *dataptr, void *client_data);
 static int cache_check_del(const void *key, void *dataptr, void *client_data);
 static int cache_user_del(user_t *u, const char *ircmask);
+static void append_setting(user_t *u, const char *chan, const char *flag_str, xml_node_t *extended);
 
 int user_init(void)
 {
@@ -112,42 +113,34 @@
 
 int user_load(const char *fname)
 {
-	int j, k, uid;
-	xml_node_t *doc, *root, *user_node, *setting_node;
-	user_setting_t *setting;
-	char *handle, *ircmask, *chan, *name, *value, *flag_str;
+	int uid;
+	xml_node_t *root, *user_node, *ircmask_node, *setting_node, *extended_node;
+	char *handle, *ircmask, *chan, *flag_str;
 	user_t *u;
 
-	if (!(doc = xml_parse_file(fname))) {
+	if (!(root = xml_parse_file(fname))) {
 		putlog(LOG_MISC, "*", _("Failed to load userfile '%s': %s"), fname, xml_last_error());
 		return -1;
 	}
 
-	root = xml_root_element(doc);
-
-	if (xml_node_get_int(&uid, root, "next_uid", 0, 0)) {
-		putlog(LOG_MISC, "*", _("Failed to load userfile '%s': Missing next_uid attribute."), fname);
-		xml_node_delete(root);
-		return -1;
-	}
-
+	xml_node_get_vars(root, "ii", "next_uid", &uid, "uid_wraparound", &uid_wraparound);
 	g_uid = uid;
-	xml_node_get_int(&uid_wraparound, root, "uid_wraparound", 0, 0);
+
 	user_node = xml_node_lookup(root, 0, "user", 0, 0);
 	for (; user_node; user_node = user_node->next_sibling) {
 		/* The only required user fields are 'handle' and 'uid'. */
-		xml_node_get_str(&handle, user_node, "handle", 0, 0);
-		xml_node_get_int(&uid, user_node, "uid", 0, 0);
-		if (!handle || !uid) break;
+		xml_node_get_vars(user_node, "sinn", "handle", &handle, "uid", &uid, "ircmask", &ircmask_node, "setting", &setting_node);
+
+		if (!handle || !uid) continue;
 		u = real_user_new(handle, uid);
 
 		/* User already exists? */
 		if (!u) continue;
 
 		/* Irc masks. */
-		for (j = 0; ; j++) {
-			xml_node_get_str(&ircmask, user_node, "ircmask", j, 0);
-			if (!ircmask) break;
+		for (; ircmask_node; ircmask_node = ircmask_node->next_sibling) {
+			ircmask = xml_node_str(ircmask_node, NULL);
+			if (!ircmask) continue;
 			u->ircmasks = realloc(u->ircmasks, sizeof(char *) * (u->nircmasks+1));
 			u->ircmasks[u->nircmasks] = strdup(ircmask);
 			u->nircmasks++;
@@ -155,43 +148,17 @@
 		}
 
 		/* Settings. */
-		for (j = 0; ; j++) {
-			setting_node = xml_node_lookup(user_node, 0, "setting", j, 0);
-			if (!setting_node) break;
-			u->settings = realloc(u->settings, sizeof(*u->settings) * (j+1));
-			u->nsettings++;
-			setting = u->settings+j;
-			xml_node_get_str(&flag_str, setting_node, "flags", 0, 0);
-			if (flag_str) flag_from_str(&setting->flags, flag_str);
-			else memset(&setting->flags, 0, sizeof(setting->flags));
-
-			setting->nextended = 0;
-			setting->extended = NULL;
-			xml_node_get_str(&chan, setting_node, "chan", 0, 0);
-
-			if (chan) setting->chan = strdup(chan);
-			else if (j) continue;
-			else setting->chan = NULL;
-
-			for (k = 0; ; k++) {
-				xml_node_get_str(&name, setting_node, "extended", k, "name", 0, 0);
-				xml_node_get_str(&value, setting_node, "extended", k, "value", 0, 0);
-				if (!name || !value) break;
-				setting->extended = realloc(setting->extended, sizeof(*setting->extended) * (k+1));
-				setting->nextended++;
-				setting->extended[k].name = strdup(name);
-				setting->extended[k].value = strdup(value);
-			}
-		}
 		/* They have to have at least 1 setting, the global one. */
-		if (!j) {
-			u->settings = calloc(1, sizeof(u->settings));
-			u->nsettings = 1;
+		if (!setting_node) append_setting(u, NULL, NULL, NULL);
+		for (; setting_node; setting_node = setting_node->next_sibling) {
+			xml_node_get_vars(setting_node, "ssn", "chan", &chan, "flags", &flag_str, "extended", &extended_node);
+			append_setting(u, chan, flag_str, extended_node);
 		}
 	}
-	xml_node_delete(doc);
+	xml_doc_delete(root);
 
-	putlog(LOG_MISC, "*", _("Loaded %i user(s)"), nusers);
+	if (nusers == 1) putlog(LOG_MISC, "*", _("Loaded 1 user"));
+	else putlog(LOG_MISC, "*", _("Loaded %d users"), nusers);
 
 	return(0);
 }
@@ -201,8 +168,8 @@
 	xml_node_t *root = param;
 	user_t *u = *(user_t **)dataptr;
 	user_setting_t *setting;
-	xml_node_t *user_node;
-	int i, j;
+	xml_node_t *user_node, *setting_node;
+	int i;
 	char flag_str[128];
 
 	user_node = xml_node_new();
@@ -212,18 +179,29 @@
 	for (i = 0; i < u->nircmasks; i++) xml_node_set_str(u->ircmasks[i], user_node, "ircmask", i, 0);
 	for (i = 0; i < u->nsettings; i++) {
 		setting = u->settings+i;
-		if (setting->chan) xml_node_set_str(setting->chan, user_node, "setting", i, "chan", 0, 0);
+		setting_node = xml_node_new();
+		setting_node->name = strdup("setting");
+		if (setting->chan) xml_node_set_str(setting->chan, setting_node, "chan", 0, 0);
 		flag_to_str(&u->settings[i].flags, flag_str);
-		xml_node_set_str(flag_str, user_node, "setting", i, "flags", 0, 0);
-		for (j = 0; j < setting->nextended; j++) {
-			xml_node_set_str(setting->extended[j].name, user_node, "setting", i, "extended", j, "name", 0, 0);
-			xml_node_set_str(setting->extended[j].value, user_node, "setting", i, "extended", j, "value", 0, 0);
-		}
+		xml_node_set_str(flag_str, setting_node, "flags", 0, 0);
+		xml_node_append(setting_node, u->settings[i].extended);
+		xml_node_append(user_node, setting_node);
 	}
 	xml_node_append(root, user_node);
 	return(0);
 }
 
+static int unlink_walker(const void *key, void *dataptr, void *param)
+{
+	user_t *u = *(user_t **)dataptr;
+	int i;
+
+	for (i = 0; i < u->nsettings; i++) {
+		xml_node_unlink(u->settings[i].extended);
+	}
+	return(0);
+}
+
 int user_save(const char *fname)
 {
 	xml_node_t *root;
@@ -237,6 +215,8 @@
 
 	xml_save_file((fname) ? fname : "users.xml", root, XML_INDENT);
 
+	hash_table_walk(uid_ht, unlink_walker, NULL);
+
 	xml_node_delete(root);
 	return(0);
 }
@@ -292,13 +272,15 @@
 	/* All users have the global setting by default. */
 	u->settings = calloc(1, sizeof(*u->settings));
 	u->nsettings = 1;
+	u->settings[0].extended = xml_node_new();
+	u->settings[0].extended->name = strdup("extended");
 
 	return(u);
 }
 
 static int user_really_delete(void *client_data)
 {
-	int i, j;
+	int i;
 	user_t *u = client_data;
 	user_setting_t *setting;
 
@@ -309,11 +291,7 @@
 	/* And all of the settings. */
 	for (i = 0; i < u->nsettings; i++) {
 		setting = u->settings+i;
-		for (j = 0; j < setting->nextended; j++) {
-			if (setting->extended[j].name) free(setting->extended[j].name);
-			if (setting->extended[j].value) free(setting->extended[j].value);
-		}
-		if (setting->extended) free(setting->extended);
+		xml_node_delete(setting->extended);
 		if (setting->chan) free(setting->chan);
 	}
 	if (u->settings) free(u->settings);
@@ -567,76 +545,62 @@
 	return(0);
 }
 
-static int find_setting(user_t *u, const char *chan, const char *name, int *row, int *col)
+static void append_setting(user_t *u, const char *chan, const char *flag_str, xml_node_t *extended)
+{
+	user_setting_t *setting;
+	u->settings = realloc(u->settings, sizeof(*u->settings) * (u->nsettings+1));
+	setting = u->settings + u->nsettings;
+	u->nsettings++;
+	memset(setting, 0, sizeof(*setting));
+	if (chan) setting->chan = strdup(chan);
+	if (flag_str) flag_from_str(&setting->flags, flag_str);
+	if (extended) {
+		xml_node_unlink(extended);
+		setting->extended = extended;
+	}
+	else {
+		setting->extended = xml_node_new();
+		setting->extended->name = strdup("extended");
+	}
+}
+
+static xml_node_t *find_setting(user_t *u, const char *chan, const char *name, int create)
 {
 	user_setting_t *setting;
 	int i = 0;
 
-	*row = -1;
-	*col = -1;
 	if (chan) for (i = 1; i < u->nsettings; i++) {
 		if (!strcasecmp(chan, u->settings[i].chan)) break;
 	}
-	if (i >= u->nsettings) return(-1);
-	*row = i;
-	setting = u->settings+i;
-	for (i = 0; i < setting->nextended; i++) {
-		if (!strcasecmp(name, setting->extended[i].name)) {
-			*col = i;
-			return(i);
-		}
+	if (i >= u->nsettings) {
+		if (!create) return(NULL);
+		append_setting(u, chan, NULL, NULL);
 	}
-	return(-1);
+	setting = u->settings+i;
+	return xml_node_lookup(setting->extended, create, name, 0, NULL);
 }
 
 int user_get_setting(user_t *u, const char *chan, const char *setting, char **valueptr)
 {
-	int i, j;
+	xml_node_t *node = find_setting(u, chan, setting, 0);
 
-	if (find_setting(u, chan, setting, &i, &j) < 0) {
-		*valueptr = NULL;
-		return(-1);
-	}
-	*valueptr = u->settings[i].extended[j].value;
-	return(0);
+	return xml_node_get_str(valueptr, node, NULL);
 }
 
-int user_set_setting(user_t *u, const char *chan, const char *setting, const char *newvalue)
+int user_set_setting(user_t *u, const char *chan, const char *setting, const char *value)
 {
-	int i, j, r;
-	char **value, *change;
-	user_setting_t *setptr;
+	int r;
+	char *change, buf[64];
+	xml_node_t *node;
 
-	change = egg_msprintf(NULL, 0, NULL, "%s %s", chan ? chan : "", setting);
-	r = bind_check(BT_uset, NULL, change, u->handle, chan, setting, newvalue);
-	free(change);
+	change = egg_msprintf(buf, sizeof(buf), NULL, "%s %s", chan ? chan : "", setting);
+	r = bind_check(BT_uset, NULL, change, u->handle, chan, setting, value);
+	if (change != buf) free(change);
 
 	if (r & BIND_RET_BREAK) return(0);
 
-	if (find_setting(u, chan, setting, &i, &j) < 0) {
-		/* See if we need to add the channel. */
-		if (i < 0) {
-			u->settings = realloc(u->settings, sizeof(*u->settings) * (u->nsettings+1));
-			i = u->nsettings;
-			u->nsettings++;
-			memset(u->settings+i, 0, sizeof(*u->settings));
-			u->settings[i].chan = strdup(chan);
-		}
-		setptr = u->settings+i;
-
-		/* And then the setting. */
-		if (j < 0) {
-			setptr->extended = realloc(setptr->extended, sizeof(*setptr->extended) * (setptr->nextended+1));
-			j = setptr->nextended;
-			setptr->nextended++;
-			setptr->extended[j].name = strdup(setting);
-			setptr->extended[j].value = NULL;
-		}
-	}
-	value = &(u->settings[i].extended[j].value);
-	if (*value) free(*value);
-	*value = strdup(newvalue);
-	return(0);
+	node = find_setting(u, chan, setting, 1);
+	return xml_node_set_str(value, node, NULL);
 }
 
 int user_has_pass(user_t *u)
@@ -714,8 +678,7 @@
 	return(0);
 }
 
-int
-user_check_flags (user_t *u, const char *chan, flags_t *flags)
+int user_check_flags(user_t *u, const char *chan, flags_t *flags)
 {
 	flags_t f;
 
@@ -724,8 +687,7 @@
 	return flag_match_subset (flags, &f);
 }
 
-int
-user_check_flags_str (user_t *u, const char *chan, const char *flags)
+int user_check_flags_str(user_t *u, const char *chan, const char *flags)
 {
 	flags_t f;
 
@@ -749,8 +711,7 @@
 	return(0);
 }
 
-static int
-ircmask_matches_user(user_t *u, const char *wild)
+static int ircmask_matches_user(user_t *u, const char *wild)
 {
 	int i;
 
Index: eggdrop1.9/lib/eggdrop/users.h
diff -u eggdrop1.9/lib/eggdrop/users.h:1.14 eggdrop1.9/lib/eggdrop/users.h:1.15
--- eggdrop1.9/lib/eggdrop/users.h:1.14	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/lib/eggdrop/users.h	Fri Oct  1 10:31:18 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: users.h,v 1.14 2004/09/26 09:42:09 stdarg Exp $
+ * $Id: users.h,v 1.15 2004/10/01 15:31:18 stdarg Exp $
  */
 
 #ifndef _EGG_USERS_H_
@@ -25,6 +25,7 @@
 #define USER_HASH_SIZE	50
 #define HOST_HASH_SIZE	50
 
+/* User structure flags. */
 #define USER_DELETED 1
 
 /* Bind table names for user events */
@@ -33,20 +34,14 @@
 #define BTN_USER_DELETE			"udelete"
 
 typedef struct {
-	char *name;
-	char *value;
-} extended_setting_t;
-
-typedef struct {
-	/* The channel these settings apply to, or NULL for global. */
+	/* The virtual channel these settings apply to, or NULL for global. */
 	char *chan;
 
 	/* Builtin flags and user defined flags. */
 	flags_t flags;
 
 	/* Extended settings done by modules/scripts. */
-	extended_setting_t *extended;
-	int nextended;
+	xml_node_t *extended;
 } user_setting_t;
 
 typedef struct user {
Index: eggdrop1.9/lib/eggdrop/xml.c
diff -u eggdrop1.9/lib/eggdrop/xml.c:1.22 eggdrop1.9/lib/eggdrop/xml.c:1.23
--- eggdrop1.9/lib/eggdrop/xml.c:1.22	Wed Sep 29 13:03:53 2004
+++ eggdrop1.9/lib/eggdrop/xml.c	Fri Oct  1 10:31:18 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: xml.c,v 1.22 2004/09/29 18:03:53 stdarg Exp $";
+static const char rcsid[] = "$Id: xml.c,v 1.23 2004/10/01 15:31:18 stdarg Exp $";
 #endif
 
 #include <stdio.h>
@@ -116,6 +116,12 @@
 	xml_node_free(node);
 }
 
+void xml_doc_delete(xml_node_t *root)
+{
+	while (root->parent) root = root->parent;
+	xml_node_delete(root);
+}
+
 xml_node_t *xml_node_vlookup(xml_node_t *root, va_list args, int create)
 {
 	char *path;
Index: eggdrop1.9/lib/eggdrop/xml.h
diff -u eggdrop1.9/lib/eggdrop/xml.h:1.21 eggdrop1.9/lib/eggdrop/xml.h:1.22
--- eggdrop1.9/lib/eggdrop/xml.h:1.21	Wed Sep 29 13:03:53 2004
+++ eggdrop1.9/lib/eggdrop/xml.h	Fri Oct  1 10:31:18 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Id: xml.h,v 1.21 2004/09/29 18:03:53 stdarg Exp $
+ * $Id: xml.h,v 1.22 2004/10/01 15:31:18 stdarg Exp $
  */
 
 #ifndef _EGG_XML_H_
@@ -95,6 +95,7 @@
 void xml_node_unlink(xml_node_t *node);
 void xml_node_delete(xml_node_t *node);
 void xml_node_delete_callbacked(xml_node_t *node, void (*callback)(void *));
+void xml_doc_delete(xml_node_t *root);
 void xml_node_append(xml_node_t *parent, xml_node_t *child);
 
 xml_node_t *xml_root_element(xml_node_t *node);
Index: eggdrop1.9/modules/server/Makefile.am
diff -u eggdrop1.9/modules/server/Makefile.am:1.16 eggdrop1.9/modules/server/Makefile.am:1.17
--- eggdrop1.9/modules/server/Makefile.am:1.16	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/modules/server/Makefile.am	Fri Oct  1 10:31:18 2004
@@ -1,9 +1,9 @@
-# $Id: Makefile.am,v 1.16 2004/09/26 09:42:09 stdarg Exp $
+# $Id: Makefile.am,v 1.17 2004/10/01 15:31:18 stdarg Exp $
 
 include $(top_srcdir)/$(ac_aux_dir)/module.mk
 
 pkglib_LTLIBRARIES	= server.la
-server_la_SOURCES	= server.c server.h binds.c binds.h channels.c channels.h input.c input.h output.c output.h serverlist.c serverlist.h nicklist.c nicklist.h scriptcmds.c servsock.c servsock.h party_commands.c dcc.c dcc.h egg_server_api.c egg_server_api.h
+server_la_SOURCES	= server.c server.h binds.c binds.h channels.c channels.h input.c input.h output.c output.h serverlist.c serverlist.h nicklist.c nicklist.h schan.c schan.h scriptcmds.c servsock.c servsock.h party_commands.c dcc.c dcc.h egg_server_api.c egg_server_api.h
 server_la_LDFLAGS	= -module -avoid-version -no-undefined
 server_la_LIBADD	= @LIBS@ $(top_builddir)/lib/eggdrop/libeggdrop.la
 
Index: eggdrop1.9/modules/server/scriptcmds.c
diff -u eggdrop1.9/modules/server/scriptcmds.c:1.44 eggdrop1.9/modules/server/scriptcmds.c:1.45
--- eggdrop1.9/modules/server/scriptcmds.c:1.44	Fri Aug 13 15:49:57 2004
+++ eggdrop1.9/modules/server/scriptcmds.c	Fri Oct  1 10:31:18 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: scriptcmds.c,v 1.44 2004/08/13 20:49:57 darko Exp $";
+static const char rcsid[] = "$Id: scriptcmds.c,v 1.45 2004/10/01 15:31:18 stdarg Exp $";
 #endif
 
 #include "server.h"
@@ -238,6 +238,26 @@
 	return(-1);
 }
 
+/* Schan commands. */
+
+static char *script_schan_get(char *chan_name, char *setting)
+{
+	schan_t *chan = schan_lookup(chan_name, 0);
+	char *value;
+
+	if (!chan) return(NULL);
+	schan_get(chan, &value, setting, 0, NULL);
+	return(value);
+}
+
+static int script_schan_set(char *chan_name, char *setting, char *value)
+{
+	schan_t *chan = schan_lookup(chan_name, 1);
+
+	if (!chan) return(-1);
+	return schan_set(chan, value, setting, 0, NULL);
+}
+
 /* Output queue commands. */
 
 static int script_queue_len(char *qname, char *next)
@@ -397,6 +417,10 @@
 	{"", "channel_key", script_channel_key, NULL, 1, "s", "channel", SCRIPT_STRING, 0},					/* DDC */
 	{"", "channel_limit", script_channel_limit, NULL, 1, "s", "channel", SCRIPT_INTEGER, 0},				/* DDC */
 
+	/* Schan commands. */
+	{"", "channel_get", script_schan_get, NULL, 2, "ss", "channel setting", SCRIPT_STRING, 0},
+	{"", "channel_set", script_schan_set, NULL, 3, "sss", "channel setting value", SCRIPT_INTEGER, 0},
+
 	/* Input / Output commands. */
 	{"", "server_fake_input", server_parse_input, NULL, 1, "s", "text", SCRIPT_INTEGER, 0},						/* DDC */
 	{"", "putserv", script_putserv, NULL, 1, "sss", "?queue? ?next? text", SCRIPT_INTEGER, SCRIPT_VAR_ARGS | SCRIPT_VAR_FRONT},	/* DDC */
Index: eggdrop1.9/modules/server/server.c
diff -u eggdrop1.9/modules/server/server.c:1.60 eggdrop1.9/modules/server/server.c:1.61
--- eggdrop1.9/modules/server/server.c:1.60	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/modules/server/server.c	Fri Oct  1 10:31:18 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: server.c,v 1.60 2004/09/26 09:42:09 stdarg Exp $";
+static const char rcsid[] = "$Id: server.c,v 1.61 2004/10/01 15:31:18 stdarg Exp $";
 #endif
 
 #include "server.h"
@@ -151,6 +151,10 @@
 	for (i = 0; i < nick_list_len; i++) {
 		config_set_str(nick_list[i], list, "nick", i, NULL);
 	}
+
+	/* Save the channel file. */
+	putlog(LOG_MISC, "*", "Saving channels file...");
+	schan_save(server_config.chanfile);
 	return(0);
 }
 
@@ -173,6 +177,8 @@
 
 	server_channel_destroy();
 
+	server_schan_destroy();
+
 	server_script_destroy();
 
 	return(0);
@@ -278,10 +284,10 @@
 
 	/* Initialize channels. */
 	server_channel_init();
+	server_schan_init();
 
 	/* Initialize script interface. */
 	server_script_init();
-	printf("hello there\n");
 
 	return(0);
 }
Index: eggdrop1.9/modules/server/server.h
diff -u eggdrop1.9/modules/server/server.h:1.20 eggdrop1.9/modules/server/server.h:1.21
--- eggdrop1.9/modules/server/server.h:1.20	Fri Jul 23 16:58:55 2004
+++ eggdrop1.9/modules/server/server.h	Fri Oct  1 10:31:18 2004
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: server.h,v 1.20 2004/07/23 21:58:55 darko Exp $
+ * $Id: server.h,v 1.21 2004/10/01 15:31:18 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_SERVER_SERVER_H_
@@ -95,6 +95,7 @@
 #include "servsock.h"
 #include "nicklist.h"
 #include "serverlist.h"
+#include "schan.h"
 
 extern server_config_t server_config;
 extern current_server_t current_server;
----------------------- End of diff -----------------------



More information about the Changes mailing list