[ekg2-commit] ekg2: commands.c (HEAD) stuff.c (HEAD) vars.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Wto, 4 Wrz 2007, 21:47:08 CEST


Module name:	ekg2
Changes by:	peres	2007-09-04 21:47:06

Modified files:
	commands.c stuff.c vars.c

Log message:
Change config_slash_messages to VAR_INT:
	== 1 - works like before (another slash in first word),
	== 2 - treat as message if no such command exists.

Index: commands.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/commands.c,v
diff -d -u -r1.292 -r1.293
--- commands.c	1 Sep 2007 18:35:02 -0000	1.292
+++ commands.c	4 Sep 2007 19:47:05 -0000	1.293
@@ -2544,7 +2544,7 @@
 		if (!correct_command)
 			return command_exec_format(target, session, quiet, ("/ %s"), xline);
 	}
-	if (target && *xline == '/' && config_slash_messages && xstrlen(xline) >= 2) {
+	if (target && *xline == '/' && config_slash_messages == 1) {
 	/* send message if we have two '/' in 1 word for instance /bin/sh /dev/hda1 other... */
 		/* code stolen from ekg1, idea stolen from irssi. */
 		char *p = strchr(xline + 1, '/');
@@ -2756,13 +2756,16 @@
 		return res;
 	}
 
+	xfree(line_save);
+
 	if (cmdlen) {	/* if not empty command typed: ("") and we didn't found handler for it... [was: xstrcmp(cmd, "")] */
+		if (config_slash_messages == 2 && target && *xline == '/')
+			return command_exec_format(target, session, quiet, ("/ %s"), xline);
+
 		quiet = quiet & 2;
 		printq("unknown_command", cmd);	/* display warning, if !(quiet & 2) */
 	}
 
-	xfree(line_save);
-
 	return -1;
 }
 

Index: stuff.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/stuff.c,v
diff -d -u -r1.210 -r1.211
--- stuff.c	1 Sep 2007 10:00:58 -0000	1.210
+++ stuff.c	4 Sep 2007 19:47:05 -0000	1.211
@@ -137,7 +137,7 @@
 char *config_away_reason = NULL;
 char *config_back_reason = NULL;
 int config_query_commands = 0;
-int config_slash_messages = 0;
+int config_slash_messages = 2;
 int quit_message_send = 0;
 int batch_mode = 0;
 char *batch_line = NULL;

Index: vars.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/vars.c,v
diff -d -u -r1.97 -r1.98
--- vars.c	23 Jul 2007 21:53:21 -0000	1.97
+++ vars.c	4 Sep 2007 19:47:06 -0000	1.98
@@ -135,7 +135,7 @@
 	variable_add(NULL, ("session_default"), VAR_STR, 2, &config_session_default, NULL, NULL, NULL);
 	variable_add(NULL, ("session_locks"), VAR_INT, 1, &config_session_locks, changed_session_locks, variable_map(3, 0, 0, "off", 1, 2, "flock", 2, 1, "file"), NULL);
 	variable_add(NULL, ("sessions_save"), VAR_BOOL, 1, &config_sessions_save, NULL, NULL, NULL);
-	variable_add(NULL, ("slash_messages"), VAR_BOOL, 1, &config_slash_messages, NULL, NULL, NULL);
+	variable_add(NULL, ("slash_messages"), VAR_INT, 1, &config_slash_messages, NULL, variable_map(3, 0, 0, "off", 1, 2, "moreslashes", 2, 1, "unknowncmd"), NULL);
 	variable_add(NULL, ("sort_windows"), VAR_BOOL, 1, &config_sort_windows, NULL, NULL, NULL);
 	variable_add(NULL, ("sound_app"), VAR_STR, 1, &config_sound_app, NULL, NULL, NULL);
 	variable_add(NULL, ("sound_chat_file"), VAR_FILE, 1, &config_sound_chat_file, NULL, NULL, dd_sound);


Więcej informacji o liście dyskusyjnej ekg2-commit