Index: src/common/command.c =================================================================== RCS file: /sources/weechat/weechat/src/common/command.c,v retrieving revision 1.158 diff -u -d -1 -0 -r1.158 command.c --- src/common/command.c 12 Feb 2007 17:39:35 -0000 1.158 +++ src/common/command.c 1 Mar 2007 02:28:22 -0000 @@ -142,21 +142,21 @@ N_(" list: list loaded plugins\n" "listfull: list loaded plugins with detailed info for each plugin\n" " load: load a plugin\n" "autoload: autoload plugins in system or user directory\n" " reload: reload one plugin (if no name given, unload all plugins, then autoload plugins)\n" " unload: unload one or all plugins\n\n" "Without argument, /plugin command lists loaded plugins."), "list|listfull|load|autoload|reload|unload %P", 0, 2, 0, weechat_cmd_plugin, NULL }, { "server", N_("list, add or remove servers"), N_("[servername] | " - "[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " + "[servername hostname port [-auto | -noauto] [-noproxy] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " "nick2 nick3] [-username username] [-realname realname] " "[-command command] [-autojoin channel[,channel]] ] | " "[del servername]"), N_("servername: server name, for internal and display use\n" " hostname: name or IP address of server\n" " port: port for server (integer)\n" " ipv6: use IPv6 protocol\n" " ssl: use SSL protocol\n" " password: password for server\n" " nick1: first nick for server\n" @@ -737,20 +737,35 @@ user_message_display (server, buffer, text); if (next) { next[0] = saved_char; user_message (server, buffer, next); } } /* + * is_cmdlike: returns true if line looks like cmd, + * returns false if it should me treated as message + */ + +static +int is_cmdlike(char *cmdline) +{ + char *slash = strchr(cmdline+1, '/'); + char *space = strchr(cmdline+1, ' '); + // in exec_weechat_command space is the only delimiter + + return (cmdline[0] == '/') && (!slash || (space && slash > space)); +} + +/* * user_command: interprets user command (if beginning with '/') * any other text is sent to the server, if connected */ void user_command (t_irc_server *server, t_irc_channel *channel, char *command, int only_builtin) { t_gui_buffer *buffer; char *new_cmd, *ptr_cmd, *pos; char *command_with_colors; @@ -780,21 +795,21 @@ ptr_cmd = (new_cmd) ? new_cmd : command; while (ptr_cmd && ptr_cmd[0]) { pos = strchr (ptr_cmd, '\n'); if (pos) pos[0] = '\0'; irc_find_context (server, channel, NULL, &buffer); - if ((ptr_cmd[0] == '/') && (ptr_cmd[1] != '/')) + if (is_cmdlike(ptr_cmd)) { /* WeeChat internal command (or IRC command) */ (void) exec_weechat_command (server, channel, ptr_cmd, only_builtin); } else { if ((ptr_cmd[0] == '/') && (ptr_cmd[1] == '/')) ptr_cmd++; if (server && (!BUFFER_IS_SERVER(buffer))) @@ -2765,20 +2780,22 @@ server_tmp.name = strdup (argv[0]); server_tmp.address = strdup (argv[1]); server_tmp.port = atoi (argv[2]); /* parse arguments */ for (i = 3; i < argc; i++) { if (argv[i][0] == '-') { + if (ascii_strcasecmp (argv[i], "-noproxy") == 0) + server_tmp.proxy_disable = 1; if (ascii_strcasecmp (argv[i], "-auto") == 0) server_tmp.autoconnect = 1; if (ascii_strcasecmp (argv[i], "-noauto") == 0) server_tmp.autoconnect = 0; if (ascii_strcasecmp (argv[i], "-ipv6") == 0) server_tmp.ipv6 = 1; if (ascii_strcasecmp (argv[i], "-ssl") == 0) server_tmp.ssl = 1; if (ascii_strcasecmp (argv[i], "-pwd") == 0) { @@ -2857,21 +2874,22 @@ WEECHAT_ERROR, "-autojoin"); server_destroy (&server_tmp); return -1; } server_tmp.autojoin = strdup (argv[++i]); } } } /* create new server */ - new_server = server_new (server_tmp.name, server_tmp.autoconnect, + new_server = server_new (server_tmp.name, server_tmp.proxy_disable, + server_tmp.autoconnect, server_tmp.autoreconnect, server_tmp.autoreconnect_delay, 0, server_tmp.address, server_tmp.port, server_tmp.ipv6, server_tmp.ssl, server_tmp.password, server_tmp.nick1, server_tmp.nick2, server_tmp.nick3, server_tmp.username, server_tmp.realname, server_tmp.hostname, server_tmp.command, 1, server_tmp.autojoin, 1, NULL); if (new_server)