[cvslog] (2004-10-06 02:35:26 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Tue Oct 5 20:35:26 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2004-10-06 02:35:26 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Modified files:
     lib/eggdrop/users.c lib/eggdrop/users.h modules/server/channels.h
     modules/server/party_commands.c modules/server/server.c
     modules/server/server.h modules/server/uhost_cache.c
     modules/server/help/en_US/commands.xml src/core_config.c

Log message:

* added some irc partyline commands (op, deop, etc)
* added some help

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/users.c
diff -u eggdrop1.9/lib/eggdrop/users.c:1.42 eggdrop1.9/lib/eggdrop/users.c:1.43
--- eggdrop1.9/lib/eggdrop/users.c:1.42	Fri Oct  1 10:31:18 2004
+++ eggdrop1.9/lib/eggdrop/users.c	Tue Oct  5 21:35:15 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: users.c,v 1.42 2004/10/01 15:31:18 stdarg Exp $";
+static const char rcsid[] = "$Id: users.c,v 1.43 2004/10/06 02:35:15 stdarg Exp $";
 #endif
 
 #include <stdio.h>
@@ -682,18 +682,32 @@
 {
 	flags_t f;
 
-	user_get_flags (u, chan, &f);
-
-	return flag_match_subset (flags, &f);
+	user_get_flags(u, chan, &f);
+	return flag_match_subset(flags, &f);
 }
 
 int user_check_flags_str(user_t *u, const char *chan, const char *flags)
 {
 	flags_t f;
 
-	flag_from_str (&f, flags);
+	flag_from_str(&f, flags);
+	return user_check_flags(u, chan, &f);
+}
+
+int user_check_partial_flags(user_t *u, const char *chan, flags_t *flags)
+{
+	flags_t f;
+
+	user_get_flags(u, chan, &f);
+	return flag_match_partial(flags, &f);
+}
+
+int user_check_partial_flags_str(user_t *u, const char *chan, const char *flags)
+{
+	flags_t f;
 
-	return user_check_flags (u, chan, &f);
+	flag_from_str(&f, flags);
+	return user_check_partial_flags(u, chan, &f);
 }
 
 int user_change_handle(user_t *u, const char *newhandle)
Index: eggdrop1.9/lib/eggdrop/users.h
diff -u eggdrop1.9/lib/eggdrop/users.h:1.15 eggdrop1.9/lib/eggdrop/users.h:1.16
--- eggdrop1.9/lib/eggdrop/users.h:1.15	Fri Oct  1 10:31:18 2004
+++ eggdrop1.9/lib/eggdrop/users.h	Tue Oct  5 21:35:15 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.15 2004/10/01 15:31:18 stdarg Exp $
+ * $Id: users.h,v 1.16 2004/10/06 02:35:15 stdarg Exp $
  */
 
 #ifndef _EGG_USERS_H_
@@ -78,12 +78,14 @@
 int user_get_setting(user_t *u, const char *chan, const char *setting, char **valueptr);
 int user_set_setting(user_t *u, const char *chan, const char *setting, const char *newvalue);
 
-int	user_get_flags		(user_t *u, const char *chan, flags_t *flags);
-int	user_set_flags		(user_t *u, const char *chan, flags_t *flags);
-int	user_set_flags_str	(user_t *u, const char *chan, const char *flags);
-
-int	user_check_flags	(user_t *u, const char *chan, flags_t *flags);
-int	user_check_flags_str	(user_t *u, const char *chan, const char *flags);
+int user_get_flags(user_t *u, const char *chan, flags_t *flags);
+int user_set_flags(user_t *u, const char *chan, flags_t *flags);
+int user_set_flags_str(user_t *u, const char *chan, const char *flags);
+
+int user_check_flags(user_t *u, const char *chan, flags_t *flags);
+int user_check_flags_str(user_t *u, const char *chan, const char *flags);
+int user_check_partial_flags(user_t *u, const char *chan, flags_t *flags);
+int user_check_partial_flags_str(user_t *u, const char *chan, const char *flags);
 
 int user_has_pass(user_t *u);
 int user_check_pass(user_t *u, const char *pass);
Index: eggdrop1.9/modules/server/channels.h
diff -u eggdrop1.9/modules/server/channels.h:1.21 eggdrop1.9/modules/server/channels.h:1.22
--- eggdrop1.9/modules/server/channels.h:1.21	Mon Oct  4 10:48:30 2004
+++ eggdrop1.9/modules/server/channels.h	Tue Oct  5 21:35:15 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: channels.h,v 1.21 2004/10/04 15:48:30 stdarg Exp $
+ * $Id: channels.h,v 1.22 2004/10/06 02:35:15 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_SERVER_CHANNELS_H_
@@ -104,8 +104,6 @@
 extern channel_t *channel_head;
 extern int nchannels;
 
-extern hash_table_t *uhost_cache_ht;
-
 /* channels.c */
 extern void channel_init();
 extern void channel_reset();
Index: eggdrop1.9/modules/server/help/en_US/commands.xml
diff -u eggdrop1.9/modules/server/help/en_US/commands.xml:1.2 eggdrop1.9/modules/server/help/en_US/commands.xml:1.3
--- eggdrop1.9/modules/server/help/en_US/commands.xml:1.2	Wed Sep 29 13:03:53 2004
+++ eggdrop1.9/modules/server/help/en_US/commands.xml	Tue Oct  5 21:35:15 2004
@@ -107,4 +107,96 @@
 			<see>servers</see>
 		</seealso>
 	</help>
+	<help>
+		<name>servers</name>
+		<summary>displays the current server list</summary>
+		<desc>
+<line>The servers command displays the list of servers known to the bot.</line>
+		</desc>
+		<seealso>
+			<see>+server</see>
+			<see>-server</see>
+			<see>jump</see>
+		</seealso>
+	</help>
+	<help>
+		<name>op</name>
+		<summary>give ops to a nick on a channel</summary>
+		<args>
+			<arg>
+				<name>channel</name>
+				<optional>1</optional>
+				<desc>channel to give ops on, or partyline channel if omitted</desc>
+			</arg>
+			<arg>
+				<name>nick</name>
+				<desc>nick to give ops to</desc>
+			</arg>
+		</args>
+		<desc>
+<line>The op command gives ops (+o) to the specified nick. If a channel</line>
+<line>is not specified, the current partyline channel name is used.</line>
+		</desc>
+		<seealso>
+			<see>deop</see>
+			<see>halfop</see>
+			<see>deehalfop</see>
+			<see>voice</see>
+			<see>devoice</see>
+		</seealso>
+	</help>
+	<help>
+		<name>deop</name>
+		<summary>take ops from a nick on a channel</summary>
+		<args>
+			<arg>
+				<name>channel</name>
+				<optional>1</optional>
+				<desc>channel to remove ops on, or partyline channel if omitted</desc>
+			</arg>
+			<arg>
+				<name>nick</name>
+				<desc>nick to take ops from</desc>
+			</arg>
+		</args>
+		<desc>
+<line>The deop command takes ops (-o) from the specified nick. If a</line>
+<line>channel is not specified, the current partyline channel name is</line>
+<line>used.</line>
+		</desc>
+		<seealso>
+			<see>op</see>
+			<see>halfop</see>
+			<see>deehalfop</see>
+			<see>voice</see>
+			<see>devoice</see>
+		</seealso>
+	</help>
+	<help>
+		<name>voice</name>
+		<summary>give voice to a nick on a channel</summary>
+		<args>
+			<arg>
+				<name>channel</name>
+				<optional>1</optional>
+				<desc>channel to remove ops on, or partyline channel if omitted</desc>
+			</arg>
+			<arg>
+				<name>nick</name>
+				<desc>nick to give voice to</desc>
+			</arg>
+		</args>
+		<desc>
+<line>The voice command gives voice (+v) to the specified nick. If a</line>
+<line>channel is not specified, the current partyline channel name is</line>
+<line>used.</line>
+		</desc>
+		<seealso>
+			<see>op</see>
+			<see>deop</see>
+			<see>halfop</see>
+			<see>deehalfop</see>
+			<see>devoice</see>
+		</seealso>
+	</help>
 </helpfile>
Index: eggdrop1.9/modules/server/party_commands.c
diff -u eggdrop1.9/modules/server/party_commands.c:1.18 eggdrop1.9/modules/server/party_commands.c:1.19
--- eggdrop1.9/modules/server/party_commands.c:1.18	Mon Oct  4 10:48:30 2004
+++ eggdrop1.9/modules/server/party_commands.c	Tue Oct  5 21:35:15 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: party_commands.c,v 1.18 2004/10/04 15:48:30 stdarg Exp $";
+static const char rcsid[] = "$Id: party_commands.c,v 1.19 2004/10/06 02:35:15 stdarg Exp $";
 #endif
 
 #include "server.h"
@@ -131,6 +131,78 @@
 	return(0);
 }
 
+static int party_chanmembermode(partymember_t *p, user_t *u, const char *cmd, const char *text, const char *flags, const char *mode)
+{
+	char *nick, *chan;
+	partychan_t *pchan;
+	channel_t *ircchan;
+
+	egg_get_arg(text, &text, &chan);
+
+	if (!chan) {
+		partymember_printf(p, "Syntax: %s [channel] <nick>", cmd);
+		return(0);
+	}
+	if (text && *text) nick = strdup(text);
+	else {
+		nick = chan;
+		pchan = partychan_get_default(p);
+		if (pchan) chan = strdup(pchan->name);
+		else {
+			partymember_printf(p, "You are not on a partyline channel! Please specify a channel: %s [channel] <nick>", cmd);
+			free(nick);
+			return(0);
+		}
+	}
+	ircchan = channel_probe(chan, 0);
+	if (!ircchan) {
+		partymember_printf(p, "I'm not on '%s', as far as I know!", chan);
+		free(nick);
+		free(chan);
+	}
+
+	if (user_check_partial_flags_str(u, NULL, flags) || user_check_flags_str(u, chan, flags)) {
+		partymember_printf(p, "Setting mode %s for %s on %s", mode, nick, ircchan->name);
+		printserv(SERVER_NORMAL, "MODE %s %s %s", ircchan->name, mode, nick);
+	}
+	else {
+		partymember_printf(p, "You need +%s to set that mode!", flags);
+	}
+	free(nick);
+	free(chan);
+	return(BIND_RET_LOG);
+}
+
+static int party_op(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "o", "+o");
+}
+
+static int party_deop(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "o", "-o");
+}
+
+static int party_halfop(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "lo", "+l");
+}
+
+static int party_dehalfop(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "lo", "-l");
+}
+
+static int party_voice(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "lo", "+v");
+}
+
+static int party_devoice(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
+{
+	return party_chanmembermode(p, u, cmd, text, "lo", "-v");
+}
+
 static int party_msg(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
 {
 	char *dest;
@@ -248,6 +320,35 @@
 /* chaninfo <channel> */
 static int party_chaninfo(partymember_t *p, const char *nick, user_t *u, const char *cmd, const char *text)
 {
+	channel_t *chan;
+	char *next, *item, *value;
+
+	while (text && isspace(*text)) text++;
+	if (!text || !*text) {
+		partymember_printf(p, "Syntax: %s <channel>", cmd);
+		return(0);
+	}
+	chan = channel_probe(text, 0);
+	if (!chan) {
+		partymember_printf(p, "Channel not found!");
+		return(0);
+	}
+	partymember_printf(p, "Information about '%s':", chan->name);
+	if (!(chan->flags & CHANNEL_STATIC)) {
+		partymember_printf(p, "Saved settings: none (not a static channel)");
+	}
+	else {
+		next = server_config.chaninfo_items;
+		while (next && *next) {
+			egg_get_arg(next, &next, &item);
+			if (!item) break;
+			channel_get(chan, &value, item, 0, NULL);
+			if (value) {
+				partymember_printf(p, "%s: %s", item, value);
+			}
+			free(item);
+		}
+	}
 	return BIND_RET_LOG;
 }
 
@@ -283,6 +384,18 @@
 
 bind_list_t server_party_commands[] = {					/* Old flag requirements */
 	{"", "servers", party_servers},			/* DDD	*/
+
+	/* Normal irc commands. */
+	{"o", "halfop", party_halfop},
+	{"o", "dehalfop", party_dehalfop},
+	{"o", "op", party_op},
+	{"o", "deop", party_deop},
+	{"o", "voice", party_voice},
+	{"o", "devoice", party_devoice},
+	{"m", "msg", party_msg},			/* DDD	*/
+	{"m", "say", party_msg},			/* DDD	*/
+	{"m", "act", party_act},			/* DDD	*/
+
 	{"l", "+ban", party_plus_mask},			/* DDD	*/	/* lo|lo */
 	{"l", "+invite", party_plus_mask},		/* DDD	*/	/* lo|lo */
 	{"l", "+exempt", party_plus_mask},		/* DDD	*/	/* lo|lo */
@@ -299,9 +412,6 @@
 	{"m", "-server", party_minus_server},		/* DDD	*/
 	{"m", "dump", party_dump},			/* DDD	*/
 	{"m", "jump", party_jump},			/* DDD	*/
-	{"m", "msg", party_msg},			/* DDD	*/
-	{"m", "say", party_msg},			/* DDD	*/
-	{"m", "act", party_act},			/* DDD	*/
 	{"n", "+chan", party_pls_chan},			/* DDC	*/	/* n */
 	{"n", "-chan", party_mns_chan},			/* DDC	*/	/* n */
 	{"n", "chanset", party_chanset},		/* DDC	*/	/* n|n */
Index: eggdrop1.9/modules/server/server.c
diff -u eggdrop1.9/modules/server/server.c:1.62 eggdrop1.9/modules/server/server.c:1.63
--- eggdrop1.9/modules/server/server.c:1.62	Mon Oct  4 10:48:30 2004
+++ eggdrop1.9/modules/server/server.c	Tue Oct  5 21:35:15 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: server.c,v 1.62 2004/10/04 15:48:30 stdarg Exp $";
+static const char rcsid[] = "$Id: server.c,v 1.63 2004/10/06 02:35:15 stdarg Exp $";
 #endif
 
 #include "server.h"
@@ -205,6 +205,8 @@
 	{"default_port", &server_config.default_port, CONFIG_INT},
 	{"max_line_len", &server_config.max_line_len, CONFIG_INT},
 
+	{"chaninfo_items", &server_config.chaninfo_items, CONFIG_STRING},
+
 	{"fake005", &server_config.fake005, CONFIG_STRING},
 
 	{"raw_log", &server_config.raw_log, CONFIG_INT},
@@ -233,6 +235,7 @@
 	server_config.default_port = 6667;
 	server_config.fake005 = NULL;
 	server_config.max_line_len = 510;
+	server_config.chaninfo_items = strdup("Inactive");
 
 	/* Link our config vars. */
 	config_root = config_get_root("eggdrop");
Index: eggdrop1.9/modules/server/server.h
diff -u eggdrop1.9/modules/server/server.h:1.22 eggdrop1.9/modules/server/server.h:1.23
--- eggdrop1.9/modules/server/server.h:1.22	Mon Oct  4 10:48:30 2004
+++ eggdrop1.9/modules/server/server.h	Tue Oct  5 21:35:15 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.22 2004/10/04 15:48:30 stdarg Exp $
+ * $Id: server.h,v 1.23 2004/10/06 02:35:15 stdarg Exp $
  */
 
 #ifndef _EGG_MOD_SERVER_SERVER_H_
@@ -47,6 +47,9 @@
 	char *chanfile;
 	int max_line_len;
 
+	/* Items to display on .chaninfo */
+	char *chaninfo_items;
+
 	/* Override the 005 sent by the server. */
 	char *fake005;
 
Index: eggdrop1.9/modules/server/uhost_cache.c
diff -u eggdrop1.9/modules/server/uhost_cache.c:1.1 eggdrop1.9/modules/server/uhost_cache.c:1.2
--- eggdrop1.9/modules/server/uhost_cache.c:1.1	Mon Oct  4 10:48:30 2004
+++ eggdrop1.9/modules/server/uhost_cache.c	Tue Oct  5 21:35:15 2004
@@ -88,7 +88,7 @@
 	cache->ref_count--;
 	if (cache->ref_count <= 0) {
 		hash_table_remove(uhost_cache_ht, cache->nick, NULL);
-		uhost_cache_delete(NULL, cache, NULL);
+		uhost_cache_delete(NULL, &cache, NULL);
 	}
 }
 
Index: eggdrop1.9/src/core_config.c
diff -u eggdrop1.9/src/core_config.c:1.22 eggdrop1.9/src/core_config.c:1.23
--- eggdrop1.9/src/core_config.c:1.22	Sun Sep 26 04:42:09 2004
+++ eggdrop1.9/src/core_config.c	Tue Oct  5 21:35:15 2004
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: core_config.c,v 1.22 2004/09/26 09:42:09 stdarg Exp $";
+static const char rcsid[] = "$Id: core_config.c,v 1.23 2004/10/06 02:35:15 stdarg Exp $";
 #endif
 
 #include <string.h>
@@ -53,6 +53,7 @@
 	{"logging.quick", &core_config.logging.quick, CONFIG_INT},
 	{"logging.max_size", &core_config.logging.max_size, CONFIG_INT},
 	{"logging.switch_at", &core_config.logging.switch_at, CONFIG_INT},
+	{"logging.suffix", &core_config.logging.suffix, CONFIG_STRING},
 
 	/* Other. */
 	{"die_on_sigterm", &core_config.die_on_sigterm, CONFIG_INT},/* DDD*/
@@ -77,6 +78,7 @@
 	if (!core_config.userfile) core_config.userfile = strdup("users.xml");
 	if (!core_config.lockfile) core_config.lockfile = strdup("lock");
 	if (!core_config.help_path) core_config.help_path = strdup("help/");
+	if (!core_config.logging.suffix) core_config.logging.suffix = strdup(".%d%b%Y");
 
 	config_update_table(core_config_vars, config_root, "eggdrop", 0, NULL);
 
----------------------- End of diff -----------------------



More information about the Changes mailing list