/[weechat]/weechat/src/plugins/perl/wee-perl.c
ViewVC logotype

Diff of /weechat/src/plugins/perl/wee-perl.c

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

revision 1.3 by flashcode, Mon Nov 17 21:07:18 2003 UTC revision 1.4 by flashcode, Sat Nov 22 14:14:31 2003 UTC
# Line 31  Line 31 
31  #include <perl.h>  #include <perl.h>
32  #include <XSUB.h>  #include <XSUB.h>
33  #include "../../common/weechat.h"  #include "../../common/weechat.h"
 #include "wee-perl.h"  
34  #include "../plugins.h"  #include "../plugins.h"
35    #include "wee-perl.h"
36    #include "../../common/command.h"
37  #include "../../gui/gui.h"  #include "../../gui/gui.h"
38    
39    
# Line 81  static XS (XS_IRC_register) Line 82  static XS (XS_IRC_register)
82                          name, version, description);                          name, version, description);
83      }      }
84      else      else
85          gui_printf (NULL,          gui_printf (gui_current_window,
86                      _("%s unable to load Perl script \"%s\" (not enough memory)\n"),                      _("%s unable to load Perl script \"%s\" (not enough memory)\n"),
87                      WEECHAT_ERROR, name);                      WEECHAT_ERROR, name);
88      XST_mPV (0, VERSION);      XST_mPV (0, VERSION);
# Line 121  static XS (XS_IRC_add_message_handler) Line 122  static XS (XS_IRC_add_message_handler)
122            
123      name = SvPV (ST (0), integer);      name = SvPV (ST (0), integer);
124      function = SvPV (ST (1), integer);      function = SvPV (ST (1), integer);
125      plugins_msg_handler_add (PLUGIN_PERL, name, function);      plugin_handler_add (&plugin_msg_handlers, &last_plugin_msg_handler,
126                            PLUGIN_PERL, name, function);
127        XSRETURN_EMPTY;
128    }
129    
130    /*
131     * IRC::add_command_handler: add command handler (define/redefine commands)
132     */
133    
134    static XS (XS_IRC_add_command_handler)
135    {
136        char *name, *function;
137        int integer;
138        dXSARGS;
139        
140        name = SvPV (ST (0), integer);
141        function = SvPV (ST (1), integer);
142        if (index_command_search (name))
143        {
144            gui_printf (gui_current_window,
145                        _("Perl error: alias or command \"%s\" already exists!\n"),
146                        name);
147        }
148        else
149        {
150            plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
151                                PLUGIN_PERL, name, function);
152        }
153      XSRETURN_EMPTY;      XSRETURN_EMPTY;
154  }  }
155    
# Line 136  xs_init (pTHX) Line 164  xs_init (pTHX)
164      newXS ("IRC::register", XS_IRC_register, "IRC");      newXS ("IRC::register", XS_IRC_register, "IRC");
165      newXS ("IRC::print", XS_IRC_print, "IRC");      newXS ("IRC::print", XS_IRC_print, "IRC");
166      newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");      newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");
167        newXS ("IRC::add_command_handler", XS_IRC_add_command_handler, "IRC");
168  }  }
169    
170  /*  /*
# Line 232  wee_perl_exec (char *function, char *arg Line 261  wee_perl_exec (char *function, char *arg
261      return_code = 1;      return_code = 1;
262      if (SvTRUE (sv))      if (SvTRUE (sv))
263      {      {
264          gui_printf (NULL,          gui_printf (gui_current_window,
265                      _("Perl error: %s\n"),                      _("Perl error: %s\n"),
266                      SvPV (sv, count));                      SvPV (sv, count));
267          POPs;          POPs;
# Line 241  wee_perl_exec (char *function, char *arg Line 270  wee_perl_exec (char *function, char *arg
270      {      {
271          if (count != 1)          if (count != 1)
272          {          {
273              gui_printf (NULL,              gui_printf (gui_current_window,
274                          _("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),                          _("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
275                          function, count);                          function, count);
276          }          }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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