summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-08-10 16:51:56 -0400
committerTingPing <tingping@tingping.se>2013-08-10 16:51:56 -0400
commitb2d2187b20c95e8583c53c79cb2830ab22094472 (patch)
treeeadbd10eb398bd1d87cf8548e5318e96bef0a84a /src/common
parent1c30e0c124a5ecbec4ccf86be32e9a234efe5822 (diff)
Only replace variables in connect commands
Diffstat (limited to 'src/common')
-rw-r--r--src/common/inbound.c5
-rw-r--r--src/common/outbound.c15
-rw-r--r--src/common/outbound.h1
3 files changed, 10 insertions, 11 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index f57207d1..ec87820a 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -1450,7 +1450,10 @@ nowindow:
 static int
 inbound_exec_eom_cmd (char *str, void *sess)
 {
-	handle_command (sess, (str[0] == '/') ? str + 1 : str, TRUE);
+	char *cmd;
+
+	cmd = command_insert_vars ((session*)sess, (str[0] == '/') ? str + 1 : str);
+	handle_command ((session*)sess, cmd, TRUE);
 	return 1;
 }
 
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 91188a8a..0141cccc 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -4551,7 +4551,6 @@ handle_command (session *sess, char *cmd, int check_spch)
 	char tbuf_static[TBUFSIZE];
 	char *pdibuf;
 	char *tbuf;
-	char *cmd_vars;
 	int len;
 	int ret = TRUE;
 
@@ -4563,9 +4562,7 @@ handle_command (session *sess, char *cmd, int check_spch)
 	command_level++;
 	/* anything below MUST DEC command_level before returning */
 
-	cmd_vars = command_insert_vars (sess, cmd);
-
-	len = strlen (cmd_vars);
+	len = strlen (cmd);
 	if (len >= sizeof (pdibuf_static))
 	{
 		pdibuf = malloc (len + 1);
@@ -4585,7 +4582,7 @@ handle_command (session *sess, char *cmd, int check_spch)
 	}
 
 	/* split the text into words and word_eol */
-	process_data_init (pdibuf, cmd_vars, word, word_eol, TRUE, TRUE);
+	process_data_init (pdibuf, cmd, word, word_eol, TRUE, TRUE);
 
 	/* ensure an empty string at index 32 for cmd_deop etc */
 	/* (internal use only, plugins can still only read 1-31). */
@@ -4596,12 +4593,12 @@ handle_command (session *sess, char *cmd, int check_spch)
 	/* redo it without quotes processing, for some commands like /JOIN */
 	if (int_cmd && !int_cmd->handle_quotes)
 	{
-		process_data_init (pdibuf, cmd_vars, word, word_eol, FALSE, FALSE);
+		process_data_init (pdibuf, cmd, word, word_eol, FALSE, FALSE);
 	}
 
 	if (check_spch && prefs.hex_input_perc_color)
 	{
-		check_special_chars (cmd_vars, prefs.hex_input_perc_ascii);
+		check_special_chars (cmd, prefs.hex_input_perc_ascii);
 	}
 
 	if (plugin_emit_command (sess, word[1], word, word_eol))
@@ -4668,7 +4665,7 @@ handle_command (session *sess, char *cmd, int check_spch)
 		}
 		else
 		{
-			sess->server->p_raw (sess->server, cmd_vars);
+			sess->server->p_raw (sess->server, cmd);
 		}
 	}
 
@@ -4685,8 +4682,6 @@ xit:
 		free (tbuf);
 	}
 
-	g_free (cmd_vars);
-
 	return ret;
 }
 
diff --git a/src/common/outbound.h b/src/common/outbound.h
index 7dc1ba97..81a98666 100644
--- a/src/common/outbound.h
+++ b/src/common/outbound.h
@@ -25,6 +25,7 @@ extern GSList *menu_list;
 
 int auto_insert (char *dest, int destlen, unsigned char *src, char *word[], char *word_eol[],
 				 char *a, char *c, char *d, char *e, char *h, char *n, char *s, char *u);
+char *command_insert_vars (session *sess, char *cmd);
 int handle_command (session *sess, char *cmd, int check_spch);
 void process_data_init (char *buf, char *cmd, char *word[], char *word_eol[], gboolean handle_quotes, gboolean allow_escape_quotes);
 void handle_multiline (session *sess, char *cmd, int history, int nocommand);