/[weechat]/weechat/src/common/command.c
ViewVC logotype

Diff of /weechat/src/common/command.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by flashcode, Thu Feb 17 22:48:44 2005 UTC revision 1.46 by flashcode, Sun Feb 20 13:37:49 2005 UTC
# Line 58  t_weechat_command weechat_commands[] = Line 58  t_weechat_command weechat_commands[] =
58      N_("-all: clear all windows"),      N_("-all: clear all windows"),
59      0, 1, weechat_cmd_clear, NULL },      0, 1, weechat_cmd_clear, NULL },
60    { "connect", N_("connect to a server"),    { "connect", N_("connect to a server"),
61      N_("servername"),      N_("[servername]"),
62      N_("servername: server name to connect"),      N_("servername: server name to connect"),
63      1, 1, weechat_cmd_connect, NULL },      0, 1, weechat_cmd_connect, NULL },
64    { "disconnect", N_("disconnect from a server"),    { "disconnect", N_("disconnect from a server"),
65      N_("servername"),      N_("[servername]"),
66      N_("servername: server name to disconnect"),      N_("servername: server name to disconnect"),
67      1, 1, weechat_cmd_disconnect, NULL },      0, 1, weechat_cmd_disconnect, NULL },
68    { "help", N_("display help about commands"),    { "help", N_("display help about commands"),
69      N_("[command]"), N_("command: name of a WeeChat or IRC command"),      N_("[command]"), N_("command: name of a WeeChat or IRC command"),
70      0, 1, weechat_cmd_help, NULL },      0, 1, weechat_cmd_help, NULL },
# Line 506  exec_weechat_command (t_irc_server *serv Line 506  exec_weechat_command (t_irc_server *serv
506                      {                      {
507                          irc_display_prefix (NULL, PREFIX_ERROR);                          irc_display_prefix (NULL, PREFIX_ERROR);
508                          gui_printf (NULL,                          gui_printf (NULL,
509                                      _("%s %s command \"%s\" failed\n"),                                      _("%s command \"%s\" failed\n"),
510                                      WEECHAT_ERROR, PACKAGE_NAME, command + 1);                                      WEECHAT_ERROR, command + 1);
511                      }                      }
512                  }                  }
513                  if (argv)                  if (argv)
# Line 576  exec_weechat_command (t_irc_server *serv Line 576  exec_weechat_command (t_irc_server *serv
576                      {                      {
577                          irc_display_prefix (NULL, PREFIX_ERROR);                          irc_display_prefix (NULL, PREFIX_ERROR);
578                          gui_printf (NULL,                          gui_printf (NULL,
579                                      _("%s IRC command \"%s\" failed\n"),                                      _("%s command \"%s\" failed\n"),
580                                      WEECHAT_ERROR, command + 1);                                      WEECHAT_ERROR, command + 1);
581                      }                      }
582                  }                  }
# Line 1060  weechat_cmd_connect (int argc, char **ar Line 1060  weechat_cmd_connect (int argc, char **ar
1060      /* make gcc happy */      /* make gcc happy */
1061      (void) argc;      (void) argc;
1062            
1063      ptr_server = server_search (argv[0]);      if (argc == 1)
1064            ptr_server = server_search (argv[0]);
1065        else
1066            ptr_server = SERVER(gui_current_window->buffer);
1067      if (ptr_server)      if (ptr_server)
1068      {      {
1069          if (ptr_server->is_connected)          if (ptr_server->is_connected)
# Line 1071  weechat_cmd_connect (int argc, char **ar Line 1074  weechat_cmd_connect (int argc, char **ar
1074                          WEECHAT_ERROR, argv[0]);                          WEECHAT_ERROR, argv[0]);
1075              return -1;              return -1;
1076          }          }
1077            if (ptr_server->child_pid > 0)
1078            {
1079                irc_display_prefix (NULL, PREFIX_ERROR);
1080                gui_printf (NULL,
1081                            _("%s currently connecting to server \"%s\"!\n"),
1082                            WEECHAT_ERROR, argv[0]);
1083                return -1;
1084            }
1085          if (!ptr_server->buffer)          if (!ptr_server->buffer)
1086          {          {
1087              if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1))              if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1))
# Line 1080  weechat_cmd_connect (int argc, char **ar Line 1091  weechat_cmd_connect (int argc, char **ar
1091          {          {
1092              ptr_server->reconnect_start = 0;              ptr_server->reconnect_start = 0;
1093              ptr_server->reconnect_join = (ptr_server->channels) ? 1 : 0;              ptr_server->reconnect_join = (ptr_server->channels) ? 1 : 0;
             irc_login (ptr_server);  
1094          }          }
1095      }      }
1096      else      else
1097      {      {
1098          irc_display_prefix (NULL, PREFIX_ERROR);          irc_display_prefix (NULL, PREFIX_ERROR);
1099          gui_printf (NULL,          gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
                     _("%s server \"%s\" not found\n"),  
                     WEECHAT_ERROR, argv[0]);  
1100          return -1;          return -1;
1101      }      }
1102      return 0;      return 0;
# Line 1106  weechat_cmd_disconnect (int argc, char * Line 1114  weechat_cmd_disconnect (int argc, char *
1114      /* make gcc happy */      /* make gcc happy */
1115      (void) argc;      (void) argc;
1116            
1117      ptr_server = server_search (argv[0]);      if (argc == 1)
1118            ptr_server = server_search (argv[0]);
1119        else
1120            ptr_server = SERVER(gui_current_window->buffer);
1121      if (ptr_server)      if (ptr_server)
1122      {      {
1123          if ((!ptr_server->is_connected) && (ptr_server->reconnect_start == 0))          if ((!ptr_server->is_connected) && (ptr_server->child_pid == 0)
1124                && (ptr_server->reconnect_start == 0))
1125          {          {
1126              irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);              irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
1127              gui_printf (ptr_server->buffer,              gui_printf (ptr_server->buffer,
# Line 1129  weechat_cmd_disconnect (int argc, char * Line 1141  weechat_cmd_disconnect (int argc, char *
1141      else      else
1142      {      {
1143          irc_display_prefix (NULL, PREFIX_ERROR);          irc_display_prefix (NULL, PREFIX_ERROR);
1144          gui_printf (NULL,          gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
                     _("%s server \"%s\" not found\n"),  
                     WEECHAT_ERROR, argv[0]);  
1145          return -1;          return -1;
1146      }      }
1147      return 0;      return 0;
# Line 1645  weechat_cmd_server (int argc, char **arg Line 1655  weechat_cmd_server (int argc, char **arg
1655          if (new_server->autoconnect)          if (new_server->autoconnect)
1656          {          {
1657              (void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);              (void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);
1658              if (server_connect (new_server))              server_connect (new_server);
                 irc_login (new_server);  
1659          }          }
1660                    
1661          server_destroy (&server);          server_destroy (&server);

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26