[cvslog] (2004-02-15 05:37:06 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Feb 14 23:37:06 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2004-02-15 05:37:06 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     src/core_party.c

Log message:

* .loadmod and .unloadmod

---------------------- diff included ----------------------
Index: eggdrop1.7/src/core_party.c
diff -u eggdrop1.7/src/core_party.c:1.25 eggdrop1.7/src/core_party.c:1.26
--- eggdrop1.7/src/core_party.c:1.25	Tue Jan 20 16:47:56 2004
+++ eggdrop1.7/src/core_party.c	Sat Feb 14 23:36:56 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: core_party.c,v 1.25 2004/01/20 22:47:56 stdarg Exp $";
+static const char rcsid[] = "$Id: core_party.c,v 1.26 2004/02/15 05:36:56 stdarg Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -460,6 +460,31 @@
 	return(0);
 }
 
+static int party_help(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	help_t *h;
+
+	if (!text || !*text) {
+		partymember_printf(p, _("Syntax: help <section>"));
+		return(0);
+	}
+
+	h = help_lookup_by_name(text);
+	if (!h) {
+		partymember_printf(p, _("No help found for '%s'."), text);
+		return(0);
+	}
+
+	help_print_party(p, h);
+	return(0);
+}
+
+static int party_addlog(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	putlog(LOG_MISC, "*", "%s: %s", nick, text);
+	return(0);
+}
+
 static int party_modules(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
 {
 	const char **modules;
@@ -472,22 +497,49 @@
 	return(0);
 }
 
-static int party_help(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+static int party_loadmod(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
 {
-	help_t *h;
-
 	if (!text || !*text) {
-		partymember_printf(p, _("Syntax: help <section>"));
+		partymember_printf(p, _("Syntax: loadmod <module name>"));
 		return(0);
 	}
+	switch (module_load(text)) {
+		case 0:
+			partymember_printf(p, _("Module '%s' loaded successfully."), text);
+			break;
+		case -1:
+			partymember_printf(p, _("Module '%s' is already loaded."), text);
+			break;
+		case -2:
+			partymember_printf(p, _("Module '%s' could not be loaded."), text);
+			break;
+		case -3:
+			partymember_printf(p, _("Module '%s' does not have a valid initialization function. Perhaps it is not an eggdrop module?"), text);
+			break;
+	}
+	return(0);
+}
 
-	h = help_lookup_by_name(text);
-	if (!h) {
-		partymember_printf(p, _("No help found for '%s'."), text);
+static int party_unloadmod(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	if (!text || !*text) {
+		partymember_printf(p, _("Syntax: unloadmod <module name>"));
 		return(0);
 	}
-
-	help_print_party(p, h);
+	switch (module_unload(text, EGGMOD_USER)) {
+		case 0:
+			partymember_printf(p, _("Module '%s' unloaded successfully."), text);
+			break;
+		case -1:
+			partymember_printf(p, _("Module '%s' is not loaded."), text);
+			break;
+		case -2:
+			partymember_printf(p, _("Module '%s' has dependencies that are still loaded. You must unload them first."), text);
+			break;
+		case -3:
+			partymember_printf(p, _("Module '%s' refuses to be unloaded by you!"), text);
+			break;
+	}
 	return(0);
 }
 
@@ -500,6 +552,7 @@
 	{NULL, "quit", party_quit},
 	{NULL, "who", party_who},
 	{NULL, "whois", party_whois},
+	{"n", "addlog", party_addlog},
 	{"n", "get", party_get},
 	{"n", "set", party_set},
 	{"n", "unset", party_unset},
@@ -510,6 +563,8 @@
 	{"n", "-user", party_minus_user},
 	{"n", "chattr", party_chattr},
 	{"n", "modules", party_modules},
+	{"n", "loadmod", party_loadmod},
+	{"n", "unloadmod", party_unloadmod},
 	{"m", "+host", party_plus_host},
 	{"m", "-host", party_minus_host},
 	{0}
----------------------- End of diff -----------------------



More information about the Changes mailing list