Only replace variables in connect commands

This commit is contained in:
TingPing 2013-08-10 16:51:56 -04:00
parent 1c30e0c124
commit b2d2187b20
3 changed files with 10 additions and 11 deletions

View File

@ -1450,7 +1450,10 @@ nowindow:
static int static int
inbound_exec_eom_cmd (char *str, void *sess) 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; return 1;
} }

View File

@ -4551,7 +4551,6 @@ handle_command (session *sess, char *cmd, int check_spch)
char tbuf_static[TBUFSIZE]; char tbuf_static[TBUFSIZE];
char *pdibuf; char *pdibuf;
char *tbuf; char *tbuf;
char *cmd_vars;
int len; int len;
int ret = TRUE; int ret = TRUE;
@ -4563,9 +4562,7 @@ handle_command (session *sess, char *cmd, int check_spch)
command_level++; command_level++;
/* anything below MUST DEC command_level before returning */ /* anything below MUST DEC command_level before returning */
cmd_vars = command_insert_vars (sess, cmd); len = strlen (cmd);
len = strlen (cmd_vars);
if (len >= sizeof (pdibuf_static)) if (len >= sizeof (pdibuf_static))
{ {
pdibuf = malloc (len + 1); 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 */ /* 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 */ /* ensure an empty string at index 32 for cmd_deop etc */
/* (internal use only, plugins can still only read 1-31). */ /* (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 */ /* redo it without quotes processing, for some commands like /JOIN */
if (int_cmd && !int_cmd->handle_quotes) 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) 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)) if (plugin_emit_command (sess, word[1], word, word_eol))
@ -4668,7 +4665,7 @@ handle_command (session *sess, char *cmd, int check_spch)
} }
else else
{ {
sess->server->p_raw (sess->server, cmd_vars); sess->server->p_raw (sess->server, cmd);
} }
} }
@ -4685,8 +4682,6 @@ xit:
free (tbuf); free (tbuf);
} }
g_free (cmd_vars);
return ret; return ret;
} }

View File

@ -25,6 +25,7 @@ extern GSList *menu_list;
int auto_insert (char *dest, int destlen, unsigned char *src, char *word[], char *word_eol[], 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 *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); 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 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); void handle_multiline (session *sess, char *cmd, int history, int nocommand);