/[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.72 by flashcode, Sat Oct 22 14:04:27 2005 UTC revision 1.73 by flashcode, Tue Oct 25 17:37:13 2005 UTC
# Line 1292  weechat_cmd_help (int argc, char **argv) Line 1292  weechat_cmd_help (int argc, char **argv)
1292      int i;      int i;
1293  #ifdef PLUGINS  #ifdef PLUGINS
1294      t_weechat_plugin *ptr_plugin;      t_weechat_plugin *ptr_plugin;
1295      t_plugin_cmd_handler *ptr_cmd_handler;      t_plugin_handler *ptr_handler;
1296  #endif  #endif
1297    
1298      switch (argc)      switch (argc)
# Line 1325  weechat_cmd_help (int argc, char **argv) Line 1325  weechat_cmd_help (int argc, char **argv)
1325              for (ptr_plugin = weechat_plugins; ptr_plugin;              for (ptr_plugin = weechat_plugins; ptr_plugin;
1326                   ptr_plugin = ptr_plugin->next_plugin)                   ptr_plugin = ptr_plugin->next_plugin)
1327              {              {
1328                  for (ptr_cmd_handler = ptr_plugin->cmd_handlers; ptr_cmd_handler;                  for (ptr_handler = ptr_plugin->handlers;
1329                       ptr_cmd_handler = ptr_cmd_handler->next_handler)                       ptr_handler; ptr_handler = ptr_handler->next_handler)
1330                  {                  {
1331                      gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "   %s",                      if (ptr_handler->type == HANDLER_COMMAND)
1332                                        ptr_cmd_handler->command);                      {
1333                      if (ptr_cmd_handler->description                          gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "   %s",
1334                          && ptr_cmd_handler->description[0])                                            ptr_handler->command);
1335                          gui_printf (NULL, " - %s",                          if (ptr_handler->description
1336                                      ptr_cmd_handler->description);                              && ptr_handler->description[0])
1337                      gui_printf (NULL, "\n");                              gui_printf (NULL, " - %s",
1338                                            ptr_handler->description);
1339                            gui_printf (NULL, "\n");
1340                        }
1341                  }                  }
1342              }              }
1343  #endif  #endif
# Line 1395  weechat_cmd_help (int argc, char **argv) Line 1398  weechat_cmd_help (int argc, char **argv)
1398              for (ptr_plugin = weechat_plugins; ptr_plugin;              for (ptr_plugin = weechat_plugins; ptr_plugin;
1399                   ptr_plugin = ptr_plugin->next_plugin)                   ptr_plugin = ptr_plugin->next_plugin)
1400              {              {
1401                  for (ptr_cmd_handler = ptr_plugin->cmd_handlers; ptr_cmd_handler;                  for (ptr_handler = ptr_plugin->handlers;
1402                       ptr_cmd_handler = ptr_cmd_handler->next_handler)                       ptr_handler; ptr_handler = ptr_handler->next_handler)
1403                  {                  {
1404                      if (ascii_strcasecmp (ptr_cmd_handler->command, argv[0]) == 0)                      if ((ptr_handler->type == HANDLER_COMMAND)
1405                            && (ascii_strcasecmp (ptr_handler->command, argv[0]) == 0))
1406                      {                      {
1407                          gui_printf (NULL, "\n");                          gui_printf (NULL, "\n");
1408                          gui_printf (NULL, "[p]");                          gui_printf (NULL, "[p]");
1409                          gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "  /%s",                          gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "  /%s",
1410                                            ptr_cmd_handler->command);                                            ptr_handler->command);
1411                          if (ptr_cmd_handler->arguments &&                          if (ptr_handler->arguments &&
1412                              ptr_cmd_handler->arguments[0])                              ptr_handler->arguments[0])
1413                              gui_printf (NULL, "  %s\n",                              gui_printf (NULL, "  %s\n",
1414                                          ptr_cmd_handler->arguments);                                          ptr_handler->arguments);
1415                          else                          else
1416                              gui_printf (NULL, "\n");                              gui_printf (NULL, "\n");
1417                          if (ptr_cmd_handler->description &&                          if (ptr_handler->description &&
1418                              ptr_cmd_handler->description[0])                              ptr_handler->description[0])
1419                              gui_printf (NULL, "\n%s\n",                              gui_printf (NULL, "\n%s\n",
1420                                          ptr_cmd_handler->description);                                          ptr_handler->description);
1421                          if (ptr_cmd_handler->arguments_description &&                          if (ptr_handler->arguments_description &&
1422                              ptr_cmd_handler->arguments_description[0])                              ptr_handler->arguments_description[0])
1423                              gui_printf (NULL, "\n%s\n",                              gui_printf (NULL, "\n%s\n",
1424                                          ptr_cmd_handler->arguments_description);                                          ptr_handler->arguments_description);
1425                          return 0;                          return 0;
1426                      }                      }
1427                  }                  }
# Line 1661  weechat_cmd_plugin (int argc, char **arg Line 1665  weechat_cmd_plugin (int argc, char **arg
1665  {  {
1666  #ifdef PLUGINS  #ifdef PLUGINS
1667      t_weechat_plugin *ptr_plugin;      t_weechat_plugin *ptr_plugin;
1668      t_plugin_msg_handler *ptr_msg_handler;      t_plugin_handler *ptr_handler;
1669      t_plugin_cmd_handler *ptr_cmd_handler;      int handler_found;
1670            
1671      switch (argc)      switch (argc)
1672      {      {
# Line 1685  weechat_cmd_plugin (int argc, char **arg Line 1689  weechat_cmd_plugin (int argc, char **arg
1689                  /* message handlers */                  /* message handlers */
1690                  irc_display_prefix (NULL, PREFIX_PLUGIN);                  irc_display_prefix (NULL, PREFIX_PLUGIN);
1691                  gui_printf (NULL, _("     message handlers:\n"));                  gui_printf (NULL, _("     message handlers:\n"));
1692                  for (ptr_msg_handler = ptr_plugin->msg_handlers;                  handler_found = 0;
1693                       ptr_msg_handler;                  for (ptr_handler = ptr_plugin->handlers;
1694                       ptr_msg_handler = ptr_msg_handler->next_handler)                       ptr_handler; ptr_handler = ptr_handler->next_handler)
1695                  {                  {
1696                      irc_display_prefix (NULL, PREFIX_PLUGIN);                      if (ptr_handler->type == HANDLER_MESSAGE)
1697                      gui_printf (NULL, _("       IRC(%s)\n"),                      {
1698                                  ptr_msg_handler->irc_command);                          handler_found = 1;
1699                            irc_display_prefix (NULL, PREFIX_PLUGIN);
1700                            gui_printf (NULL, _("       IRC(%s)\n"),
1701                                        ptr_handler->irc_command);
1702                        }
1703                  }                  }
1704                  if (!ptr_plugin->msg_handlers)                  if (!handler_found)
1705                  {                  {
1706                      irc_display_prefix (NULL, PREFIX_PLUGIN);                      irc_display_prefix (NULL, PREFIX_PLUGIN);
1707                      gui_printf (NULL, _("       (no message handler)\n"));                      gui_printf (NULL, _("       (no message handler)\n"));
# Line 1702  weechat_cmd_plugin (int argc, char **arg Line 1710  weechat_cmd_plugin (int argc, char **arg
1710                  /* command handlers */                  /* command handlers */
1711                  irc_display_prefix (NULL, PREFIX_PLUGIN);                  irc_display_prefix (NULL, PREFIX_PLUGIN);
1712                  gui_printf (NULL, _("     command handlers:\n"));                  gui_printf (NULL, _("     command handlers:\n"));
1713                  for (ptr_cmd_handler = ptr_plugin->cmd_handlers;                  handler_found = 0;
1714                       ptr_cmd_handler;                  for (ptr_handler = ptr_plugin->handlers;
1715                       ptr_cmd_handler = ptr_cmd_handler->next_handler)                       ptr_handler; ptr_handler = ptr_handler->next_handler)
1716                  {                  {
1717                      irc_display_prefix (NULL, PREFIX_PLUGIN);                      if (ptr_handler->type == HANDLER_COMMAND)
1718                      gui_printf (NULL, "       /%s",                      {
1719                                  ptr_cmd_handler->command);                          handler_found = 1;
1720                      if (ptr_cmd_handler->description                          irc_display_prefix (NULL, PREFIX_PLUGIN);
1721                          && ptr_cmd_handler->description[0])                          gui_printf (NULL, "       /%s",
1722                          gui_printf (NULL, " (%s)",                                      ptr_handler->command);
1723                                      ptr_cmd_handler->description);                          if (ptr_handler->description
1724                      gui_printf (NULL, "\n");                              && ptr_handler->description[0])
1725                                gui_printf (NULL, " (%s)",
1726                                            ptr_handler->description);
1727                            gui_printf (NULL, "\n");
1728                        }
1729                  }                  }
1730                  if (!ptr_plugin->cmd_handlers)                  if (!handler_found)
1731                  {                  {
1732                      irc_display_prefix (NULL, PREFIX_PLUGIN);                      irc_display_prefix (NULL, PREFIX_PLUGIN);
1733                      gui_printf (NULL, _("       (no command handler)\n"));                      gui_printf (NULL, _("       (no command handler)\n"));
# Line 1728  weechat_cmd_plugin (int argc, char **arg Line 1740  weechat_cmd_plugin (int argc, char **arg
1740              }              }
1741              break;              break;
1742          case 1:          case 1:
1743              /*if (ascii_strcasecmp (argv[0], "autoload") == 0)              if (ascii_strcasecmp (argv[0], "autoload") == 0)
1744                  plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");                  plugin_auto_load ();
1745              else if (ascii_strcasecmp (argv[0], "reload") == 0)              else if (ascii_strcasecmp (argv[0], "reload") == 0)
1746              {              {
1747                  plugin_unload (PLUGIN_TYPE_PERL, NULL);                  plugin_unload_all ();
1748                  plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");                  plugin_auto_load ();
1749              }              }
1750              else if (ascii_strcasecmp (argv[0], "unload") == 0)              else if (ascii_strcasecmp (argv[0], "unload") == 0)
1751              plugin_unload (PLUGIN_TYPE_PERL, NULL);*/                  plugin_unload_all ();
1752              break;              break;
1753          case 2:          case 2:
1754              if (ascii_strcasecmp (argv[0], "load") == 0)              if (ascii_strcasecmp (argv[0], "load") == 0)
             {  
                 /* load plugin */  
1755                  plugin_load (argv[1]);                  plugin_load (argv[1]);
             }  
1756              else if (ascii_strcasecmp (argv[0], "unload") == 0)              else if (ascii_strcasecmp (argv[0], "unload") == 0)
             {  
                 /* unload plugin */  
1757                  plugin_unload_name (argv[1]);                  plugin_unload_name (argv[1]);
             }  
1758              else              else
1759              {              {
1760                  irc_display_prefix (NULL, PREFIX_ERROR);                  irc_display_prefix (NULL, PREFIX_ERROR);

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73

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