/[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.66 by flashcode, Sat Sep 3 12:37:22 2005 UTC revision 1.67 by flashcode, Sun Sep 4 12:55:26 2005 UTC
# Line 72  t_weechat_command weechat_commands[] = Line 72  t_weechat_command weechat_commands[] =
72    { "help", N_("display help about commands"),    { "help", N_("display help about commands"),
73      N_("[command]"), N_("command: name of a WeeChat or IRC command"),      N_("[command]"), N_("command: name of a WeeChat or IRC command"),
74      0, 1, weechat_cmd_help, NULL },      0, 1, weechat_cmd_help, NULL },
75      { "ignore", N_("ignore IRC messages and/or hosts"),
76        N_("[mask [[type | command] [channel [server]]]]"),
77        N_("   mask: nick or host mask to ignore\n"
78           "   type: type of message to ignore (action, ctcp, dcc, pv)\n"
79           "command: IRC command\n"
80           "channel: name of channel for ignore\n"
81           " server: name of server for ignore\n\n"
82           "For each argument, '*' means all.\n"
83           "Without argument, /ignore command lists all defined ignore."),
84        0, 4, weechat_cmd_ignore, NULL },
85    { "key", N_("bind/unbind keys"),    { "key", N_("bind/unbind keys"),
86      N_("[key function/command] [unbind key] [functions] [reset -yes]"),      N_("[key function/command] [unbind key] [functions] [reset -yes]"),
87      N_("key: bind this key to an internal function or a command (beginning by \"/\")\n"      N_("key: bind this key to an internal function or a command (beginning by \"/\")\n"
# Line 81  t_weechat_command weechat_commands[] = Line 91  t_weechat_command weechat_commands[] =
91      0, MAX_ARGS, NULL, weechat_cmd_key },      0, MAX_ARGS, NULL, weechat_cmd_key },
92    { "perl", N_("list/load/unload Perl scripts"),    { "perl", N_("list/load/unload Perl scripts"),
93      N_("[load filename] | [autoload] | [reload] | [unload]"),      N_("[load filename] | [autoload] | [reload] | [unload]"),
94      N_("filename: Perl script (file) to load\n"      N_("filename: Perl script (file) to load\n\n"
95         "Without argument, /perl command lists all loaded Perl scripts."),         "Without argument, /perl command lists all loaded Perl scripts."),
96      0, 2, weechat_cmd_perl, NULL },      0, 2, weechat_cmd_perl, NULL },
97    { "python", N_("list/load/unload Python scripts"),    { "python", N_("list/load/unload Python scripts"),
98      N_("[load filename] | [autoload] | [reload] | [unload]"),      N_("[load filename] | [autoload] | [reload] | [unload]"),
99      N_("filename: Python script (file) to load\n"      N_("filename: Python script (file) to load\n\n"
100         "Without argument, /python command lists all loaded Python scripts."),         "Without argument, /python command lists all loaded Python scripts."),
101      0, 2, weechat_cmd_python, NULL },      0, 2, weechat_cmd_python, NULL },
102    { "ruby", N_("list/load/unload Ruby scripts"),    { "ruby", N_("list/load/unload Ruby scripts"),
103      N_("[load filename] | [autoload] | [reload] | [unload]"),      N_("[load filename] | [autoload] | [reload] | [unload]"),
104      N_("filename: Ruby script (file) to load\n"      N_("filename: Ruby script (file) to load\n\n"
105         "Without argument, /ruby command lists all loaded Ruby scripts."),         "Without argument, /ruby command lists all loaded Ruby scripts."),
106      0, 2, weechat_cmd_ruby, NULL },      0, 2, weechat_cmd_ruby, NULL },
107    { "server", N_("list, add or remove servers"),    { "server", N_("list, add or remove servers"),
# Line 121  t_weechat_command weechat_commands[] = Line 131  t_weechat_command weechat_commands[] =
131    { "unalias", N_("remove an alias"),    { "unalias", N_("remove an alias"),
132      N_("alias_name"), N_("alias_name: name of alias to remove"),      N_("alias_name"), N_("alias_name: name of alias to remove"),
133      1, 1, NULL, weechat_cmd_unalias },      1, 1, NULL, weechat_cmd_unalias },
134      { "unignore", N_("unignore IRC messages and/or hosts"),
135        N_("[number | [mask [[type | command] [channel [server]]]]]"),
136        N_(" number: # of ignore to unignore (number is displayed by list of ignore)\n"
137           "   mask: nick or host mask to unignore\n"
138           "   type: type of message to unignore (action, ctcp, dcc, pv)\n"
139           "command: IRC command\n"
140           "channel: name of channel for unignore\n"
141           " server: name of server for unignore\n\n"
142           "For each argument, '*' means all.\n"
143           "Without argument, /unignore command lists all defined ignore."),
144        0, 4, weechat_cmd_unignore, NULL },
145    { "window", N_("manage windows"),    { "window", N_("manage windows"),
146      N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),      N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
147      N_("list: list opened windows (no parameter implies this list)\n"      N_("list: list opened windows (no parameter implies this list)\n"
# Line 874  weechat_cmd_buffer_display_info (t_gui_b Line 895  weechat_cmd_buffer_display_info (t_gui_b
895                            "%s", SERVER(buffer)->name);                            "%s", SERVER(buffer)->name);
896          gui_printf (NULL, ")\n");          gui_printf (NULL, ")\n");
897      }      }
898        else
899        {
900            gui_printf (NULL, _("not connected"));
901            gui_printf (NULL, "\n");
902        }
903  }  }
904    
905  /*  /*
# Line 1352  weechat_cmd_help (int argc, char **argv) Line 1378  weechat_cmd_help (int argc, char **argv)
1378  }  }
1379    
1380  /*  /*
1381     * weechat_cmd_ignore_display: display an ignore entry
1382     */
1383    
1384    void
1385    weechat_cmd_ignore_display (char *text, t_irc_ignore *ptr_ignore)
1386    {
1387        if (text)
1388            gui_printf (NULL, "%s ", text);
1389        
1390        gui_printf (NULL, _("on"));
1391        gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", ptr_ignore->server_name);
1392        gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "/");
1393        gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->channel_name);
1394        gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
1395        gui_printf (NULL, _(" ignoring "));
1396        gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->type);
1397        gui_printf (NULL, _(" from "));
1398        gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s\n", ptr_ignore->mask);
1399    }
1400    
1401    /*
1402     * weechat_cmd_ignore: ignore IRC commands and/or hosts
1403     */
1404    
1405    int
1406    weechat_cmd_ignore (int argc, char **argv)
1407    {
1408        t_irc_ignore *ptr_ignore;
1409        int i;
1410        
1411        ptr_ignore = NULL;
1412        switch (argc)
1413        {
1414            case 0:
1415                /* List all ignore */
1416                if (irc_ignore)
1417                {
1418                    gui_printf (NULL, "\n");
1419                    gui_printf (NULL, _("List of ignore:\n"));
1420                    i = 0;
1421                    for (ptr_ignore = irc_ignore; ptr_ignore;
1422                         ptr_ignore = ptr_ignore->next_ignore)
1423                    {
1424                        i++;
1425                        gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
1426                        gui_printf (NULL, "%d", i);
1427                        gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
1428                        weechat_cmd_ignore_display (NULL, ptr_ignore);
1429                    }
1430                }
1431                else
1432                {
1433                    irc_display_prefix (NULL, PREFIX_INFO);
1434                    gui_printf (NULL, _("No ignore defined.\n"));
1435                }
1436                return 0;
1437                break;
1438            case 1:
1439                ptr_ignore = ignore_add (argv[0], "*", "*",
1440                                         (SERVER(gui_current_window->buffer)) ?
1441                                         SERVER(gui_current_window->buffer)->name : "*");
1442                break;
1443            case 2:
1444                ptr_ignore = ignore_add (argv[0], argv[1], "*",
1445                                         (SERVER(gui_current_window->buffer)) ?
1446                                         SERVER(gui_current_window->buffer)->name : "*");
1447                break;
1448            case 3:
1449                ptr_ignore = ignore_add (argv[0], argv[1], argv[2],
1450                                         (SERVER(gui_current_window->buffer)) ?
1451                                         SERVER(gui_current_window->buffer)->name : "*");
1452                break;
1453            case 4:
1454                ptr_ignore = ignore_add (argv[0], argv[1], argv[2], argv[3]);
1455                break;
1456        }
1457        if (ptr_ignore)
1458        {
1459            gui_printf (NULL, "\n");
1460            weechat_cmd_ignore_display (_("New ignore:"), ptr_ignore);
1461            return 0;
1462        }
1463        else
1464            return -1;
1465    }
1466    
1467    /*
1468   * weechat_cmd_key_display: display a key binding   * weechat_cmd_key_display: display a key binding
1469   */   */
1470    
# Line 2410  weechat_cmd_set (char *arguments) Line 2523  weechat_cmd_set (char *arguments)
2523          {          {
2524              section_displayed = 0;              section_displayed = 0;
2525              if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)              if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
2526                  && (i != CONFIG_SECTION_SERVER))                  && (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
2527              {              {
2528                  for (j = 0; weechat_options[i][j].option_name; j++)                  for (j = 0; weechat_options[i][j].option_name; j++)
2529                  {                  {
# Line 2519  weechat_cmd_unalias (char *arguments) Line 2632  weechat_cmd_unalias (char *arguments)
2632      return 0;      return 0;
2633  }  }
2634    
2635    /*
2636     * weechat_cmd_unignore: unignore IRC commands and/or hosts
2637     */
2638    
2639    int
2640    weechat_cmd_unignore (int argc, char **argv)
2641    {
2642        char *error;
2643        int number, ret;
2644        
2645        ret = 0;
2646        switch (argc)
2647        {
2648            case 0:
2649                /* List all ignore */
2650                weechat_cmd_ignore (argc, argv);
2651                return 0;
2652                break;
2653            case 1:
2654                error = NULL;
2655                number = strtol (argv[0], &error, 10);
2656                if ((error) && (error[0] == '\0'))
2657                    ret = ignore_search_free_by_number (number);
2658                else
2659                    ret = ignore_search_free (argv[0], "*", "*",
2660                                        (SERVER(gui_current_window->buffer)) ?
2661                                         SERVER(gui_current_window->buffer)->name : "*");
2662                break;
2663            case 2:
2664                ret = ignore_search_free (argv[0], argv[1], "*",
2665                                          (SERVER(gui_current_window->buffer)) ?
2666                                          SERVER(gui_current_window->buffer)->name : "*");
2667                break;
2668            case 3:
2669                ret = ignore_search_free (argv[0], argv[1], argv[2],
2670                                          (SERVER(gui_current_window->buffer)) ?
2671                                          SERVER(gui_current_window->buffer)->name : "*");
2672                break;
2673            case 4:
2674                ret = ignore_search_free (argv[0], argv[1], argv[2], argv[3]);
2675                break;
2676        }
2677        
2678        if (ret)
2679        {
2680            irc_display_prefix (NULL, PREFIX_INFO);
2681            gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", ret);
2682            if (ret > 1)
2683                gui_printf (NULL, _("ignore were removed.\n"));
2684            else
2685                gui_printf (NULL, _("ignore was removed.\n"));
2686        }
2687        else
2688        {
2689            irc_display_prefix (NULL, PREFIX_ERROR);
2690            gui_printf (NULL, _("%s no ignore found\n"),
2691                        WEECHAT_ERROR);
2692            return -1;
2693        }
2694        
2695        return 0;
2696    }
2697    
2698  /*  /*
2699   * weechat_cmd_window: manage windows   * weechat_cmd_window: manage windows
2700   */   */

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67

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