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

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

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

revision 1.5 by flashcode, Tue Oct 25 17:37:13 2005 UTC revision 1.6 by flashcode, Wed Oct 26 23:07:03 2005 UTC
# Line 138  static XS (XS_weechat_register) Line 138  static XS (XS_weechat_register)
138          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
139                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
140                                      "\"register\" function");                                      "\"register\" function");
141          XSRETURN (0);          XSRETURN_NO;
142      }      }
143            
144      name = SvPV (ST (0), integer);      name = SvPV (ST (0), integer);
# Line 154  static XS (XS_weechat_register) Line 154  static XS (XS_weechat_register)
154                                      "\"%s\" script (another script "                                      "\"%s\" script (another script "
155                                      "already exists with this name)",                                      "already exists with this name)",
156                                      name);                                      name);
157          XSRETURN (0);          XSRETURN_NO;
158      }      }
159            
160      /* register script */      /* register script */
# Line 176  static XS (XS_weechat_register) Line 176  static XS (XS_weechat_register)
176                                      "Perl error: unable to load script "                                      "Perl error: unable to load script "
177                                      "\"%s\" (not enough memory)",                                      "\"%s\" (not enough memory)",
178                                      name);                                      name);
179          XSRETURN (0);          XSRETURN_NO;
180      }      }
181            
182      XSRETURN (1);      XSRETURN_YES;
183  }  }
184    
185  /*  /*
# Line 200  static XS (XS_weechat_print) Line 200  static XS (XS_weechat_print)
200          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
201                                      "Perl error: unable to print message, "                                      "Perl error: unable to print message, "
202                                      "script not initialized");                                      "script not initialized");
203          XSRETURN (0);          XSRETURN_NO;
204      }      }
205            
206      if ((items < 1) || (items > 3))      if ((items < 1) || (items > 3))
# Line 208  static XS (XS_weechat_print) Line 208  static XS (XS_weechat_print)
208          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
209                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
210                                      "\"print\" function");                                      "\"print\" function");
211          XSRETURN (0);          XSRETURN_NO;
212      }      }
213            
214      channel_name = NULL;      channel_name = NULL;
# Line 226  static XS (XS_weechat_print) Line 226  static XS (XS_weechat_print)
226                           server_name, channel_name,                           server_name, channel_name,
227                           "%s", message);                           "%s", message);
228            
229      XSRETURN (1);      XSRETURN_YES;
230  }  }
231    
232  /*  /*
# Line 246  static XS (XS_weechat_print_infobar) Line 246  static XS (XS_weechat_print_infobar)
246          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
247                                      "Perl error: unable to print infobar message, "                                      "Perl error: unable to print infobar message, "
248                                      "script not initialized");                                      "script not initialized");
249          XSRETURN (0);          XSRETURN_NO;
250      }      }
251            
252      if (items != 2)      if (items != 2)
# Line 254  static XS (XS_weechat_print_infobar) Line 254  static XS (XS_weechat_print_infobar)
254          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
255                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
256                                      "\"print_infobar\" function");                                      "\"print_infobar\" function");
257          XSRETURN (0);          XSRETURN_NO;
258      }      }
259            
260      perl_plugin->infobar_printf (perl_plugin,      perl_plugin->infobar_printf (perl_plugin,
261                                   SvIV (ST (0)),                                   SvIV (ST (0)),
262                                   SvPV (ST (1), integer));                                   SvPV (ST (1), integer));
263            
264      XSRETURN (1);      XSRETURN_YES;
265  }  }
266    
267  /*  /*
# Line 282  static XS (XS_weechat_command) Line 282  static XS (XS_weechat_command)
282          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
283                                      "Perl error: unable to run command, "                                      "Perl error: unable to run command, "
284                                      "script not initialized");                                      "script not initialized");
285          XSRETURN (0);          XSRETURN_NO;
286      }      }
287            
288      if ((items < 1) || (items > 3))      if ((items < 1) || (items > 3))
# Line 290  static XS (XS_weechat_command) Line 290  static XS (XS_weechat_command)
290          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
291                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
292                                      "\"command\" function");                                      "\"command\" function");
293          XSRETURN (0);          XSRETURN_NO;
294      }      }
295            
296      channel_name = NULL;      channel_name = NULL;
# Line 307  static XS (XS_weechat_command) Line 307  static XS (XS_weechat_command)
307                                 server_name, channel_name,                                 server_name, channel_name,
308                                 SvPV (ST (0), integer));                                 SvPV (ST (0), integer));
309            
310      XSRETURN (1);      XSRETURN_YES;
311  }  }
312    
313  /*  /*
# Line 328  static XS (XS_weechat_add_message_handle Line 328  static XS (XS_weechat_add_message_handle
328          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
329                                      "Perl error: unable to add message handler, "                                      "Perl error: unable to add message handler, "
330                                      "script not initialized");                                      "script not initialized");
331          XSRETURN (0);          XSRETURN_NO;
332      }      }
333            
334      if (items != 2)      if (items != 2)
# Line 336  static XS (XS_weechat_add_message_handle Line 336  static XS (XS_weechat_add_message_handle
336          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
337                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
338                                      "\"add_message_handler\" function");                                      "\"add_message_handler\" function");
339          XSRETURN (0);          XSRETURN_NO;
340      }      }
341            
342      irc_command = SvPV (ST (0), integer);      irc_command = SvPV (ST (0), integer);
# Line 345  static XS (XS_weechat_add_message_handle Line 345  static XS (XS_weechat_add_message_handle
345      if (perl_plugin->msg_handler_add (perl_plugin, irc_command,      if (perl_plugin->msg_handler_add (perl_plugin, irc_command,
346                                        weechat_perl_handler, function,                                        weechat_perl_handler, function,
347                                        (void *)perl_current_script))                                        (void *)perl_current_script))
348          XSRETURN (1);          XSRETURN_YES;
349            
350      XSRETURN (0);      XSRETURN_NO;
351  }  }
352    
353  /*  /*
# Line 368  static XS (XS_weechat_add_command_handle Line 368  static XS (XS_weechat_add_command_handle
368          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
369                                      "Perl error: unable to add command handler, "                                      "Perl error: unable to add command handler, "
370                                      "script not initialized");                                      "script not initialized");
371          XSRETURN (0);          XSRETURN_NO;
372      }      }
373            
374      if (items < 2)      if (items < 2)
# Line 376  static XS (XS_weechat_add_command_handle Line 376  static XS (XS_weechat_add_command_handle
376          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
377                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
378                                      "\"add_command_handler\" function");                                      "\"add_command_handler\" function");
379          XSRETURN (0);          XSRETURN_NO;
380      }      }
381            
382      command = SvPV (ST (0), integer);      command = SvPV (ST (0), integer);
# Line 393  static XS (XS_weechat_add_command_handle Line 393  static XS (XS_weechat_add_command_handle
393                                        weechat_perl_handler,                                        weechat_perl_handler,
394                                        function,                                        function,
395                                        (void *)perl_current_script))                                        (void *)perl_current_script))
396          XSRETURN (1);          XSRETURN_YES;
397            
398      XSRETURN (0);      XSRETURN_NO;
399  }  }
400    
401  /*  /*
# Line 416  static XS (XS_weechat_remove_handler) Line 416  static XS (XS_weechat_remove_handler)
416          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
417                                      "Perl error: unable to remove handler, "                                      "Perl error: unable to remove handler, "
418                                      "script not initialized");                                      "script not initialized");
419          XSRETURN (0);          XSRETURN_NO;
420      }      }
421            
422      if (items != 2)      if (items != 2)
# Line 424  static XS (XS_weechat_remove_handler) Line 424  static XS (XS_weechat_remove_handler)
424          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
425                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
426                                      "\"remove_handler\" function");                                      "\"remove_handler\" function");
427          XSRETURN (0);          XSRETURN_NO;
428      }      }
429            
430      command = SvPV (ST (0), integer);      command = SvPV (ST (0), integer);
# Line 433  static XS (XS_weechat_remove_handler) Line 433  static XS (XS_weechat_remove_handler)
433      weechat_script_remove_handler (perl_plugin, perl_current_script,      weechat_script_remove_handler (perl_plugin, perl_current_script,
434                                     command, function);                                     command, function);
435            
436      XSRETURN (1);      XSRETURN_YES;
437  }  }
438    
439  /*  /*
# Line 454  static XS (XS_weechat_get_info) Line 454  static XS (XS_weechat_get_info)
454          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
455                                      "Perl error: unable to get info, "                                      "Perl error: unable to get info, "
456                                      "script not initialized");                                      "script not initialized");
457          XSRETURN (0);          XSRETURN_NO;
458      }      }
459            
460      if ((items < 1) || (items > 3))      if ((items < 1) || (items > 3))
# Line 462  static XS (XS_weechat_get_info) Line 462  static XS (XS_weechat_get_info)
462          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
463                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
464                                      "\"get_info\" function");                                      "\"get_info\" function");
465          XSRETURN (0);          XSRETURN_NO;
466      }      }
467            
468      server_name = NULL;      server_name = NULL;
# Line 482  static XS (XS_weechat_get_info) Line 482  static XS (XS_weechat_get_info)
482          {          {
483              XST_mPV (0, info);              XST_mPV (0, info);
484              free (info);              free (info);
485              return;              XSRETURN (1);
486          }          }
487      }      }
488            
489      XST_mPV (0, "");      XST_mPV (0, "");
490        XSRETURN (1);
491  }  }
492    
493  /*  /*
# Line 508  static XS (XS_weechat_get_dcc_info) Line 509  static XS (XS_weechat_get_dcc_info)
509          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
510                                      "Perl error: unable to get DCC info, "                                      "Perl error: unable to get DCC info, "
511                                      "script not initialized");                                      "script not initialized");
512          XSRETURN (0);          XSRETURN_NO;
513      }      }
514            
515      dcc_info = perl_plugin->get_dcc_info (perl_plugin);      dcc_info = perl_plugin->get_dcc_info (perl_plugin);
516      dcc_count = 0;      dcc_count = 0;
517            
518      if (!dcc_info)      if (!dcc_info)
519          XSRETURN (0);          XSRETURN_NO;
520            
521      for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)      for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
522      {      {
# Line 565  static XS (XS_weechat_get_config) Line 566  static XS (XS_weechat_get_config)
566          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
567                                      "Perl error: unable to get config option, "                                      "Perl error: unable to get config option, "
568                                      "script not initialized");                                      "script not initialized");
569          XSRETURN (0);          XSRETURN_NO;
570      }      }
571            
572      if (items != 1)      if (items != 1)
# Line 573  static XS (XS_weechat_get_config) Line 574  static XS (XS_weechat_get_config)
574          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
575                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
576                                      "\"get_config\" function");                                      "\"get_config\" function");
577          XSRETURN (0);          XSRETURN_NO;
578      }      }
579            
580      option = SvPV (ST (0), integer);      option = SvPV (ST (0), integer);
# Line 586  static XS (XS_weechat_get_config) Line 587  static XS (XS_weechat_get_config)
587          {          {
588              XST_mPV (0, return_value);              XST_mPV (0, return_value);
589              free (return_value);              free (return_value);
590              return;              XSRETURN (1);
591          }          }
592      }      }
593            
594      XST_mPV (0, "");      XST_mPV (0, "");
595        XSRETURN (1);
596  }  }
597    
598  /*  /*
# Line 611  static XS (XS_weechat_set_config) Line 613  static XS (XS_weechat_set_config)
613          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
614                                      "Perl error: unable to set config option, "                                      "Perl error: unable to set config option, "
615                                      "script not initialized");                                      "script not initialized");
616          XSRETURN (0);          XSRETURN_NO;
617      }      }
618            
619      if (items != 2)      if (items != 2)
# Line 619  static XS (XS_weechat_set_config) Line 621  static XS (XS_weechat_set_config)
621          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
622                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
623                                      "\"set_config\" function");                                      "\"set_config\" function");
624          XSRETURN (0);          XSRETURN_NO;
625      }      }
626            
627      option = SvPV (ST (0), integer);      option = SvPV (ST (0), integer);
# Line 628  static XS (XS_weechat_set_config) Line 630  static XS (XS_weechat_set_config)
630      if (option && value)      if (option && value)
631      {      {
632          if (perl_plugin->set_config (perl_plugin, option, value))          if (perl_plugin->set_config (perl_plugin, option, value))
633              XSRETURN (1);              XSRETURN_YES;
634      }      }
635            
636      XSRETURN (0);      XSRETURN_NO;
637  }  }
638    
639  /*  /*
# Line 652  static XS (XS_weechat_get_plugin_config) Line 654  static XS (XS_weechat_get_plugin_config)
654          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
655                                      "Perl error: unable to get plugin config option, "                                      "Perl error: unable to get plugin config option, "
656                                      "script not initialized");                                      "script not initialized");
657          XSRETURN (0);          XSRETURN_NO;
658      }      }
659            
660      if (items != 1)      if (items != 1)
# Line 660  static XS (XS_weechat_get_plugin_config) Line 662  static XS (XS_weechat_get_plugin_config)
662          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
663                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
664                                      "\"get_plugin_config\" function");                                      "\"get_plugin_config\" function");
665          XSRETURN (0);          XSRETURN_NO;
666      }      }
667            
668      option = SvPV (ST (0), integer);      option = SvPV (ST (0), integer);
# Line 675  static XS (XS_weechat_get_plugin_config) Line 677  static XS (XS_weechat_get_plugin_config)
677          {          {
678              XST_mPV (0, return_value);              XST_mPV (0, return_value);
679              free (return_value);              free (return_value);
680              return;              XSRETURN (1);
681          }          }
682      }          }    
683            
684      XST_mPV (0, "");      XST_mPV (0, "");
685        XSRETURN (1);
686  }  }
687    
688  /*  /*
# Line 700  static XS (XS_weechat_set_plugin_config) Line 703  static XS (XS_weechat_set_plugin_config)
703          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
704                                      "Perl error: unable to set plugin config option, "                                      "Perl error: unable to set plugin config option, "
705                                      "script not initialized");                                      "script not initialized");
706          XSRETURN (0);          XSRETURN_NO;
707      }      }
708            
709      if (items != 2)      if (items != 2)
# Line 708  static XS (XS_weechat_set_plugin_config) Line 711  static XS (XS_weechat_set_plugin_config)
711          perl_plugin->printf_server (perl_plugin,          perl_plugin->printf_server (perl_plugin,
712                                      "Perl error: wrong parameters for "                                      "Perl error: wrong parameters for "
713                                      "\"set_plugin_config\" function");                                      "\"set_plugin_config\" function");
714          XSRETURN (0);          XSRETURN_NO;
715      }      }
716            
717      option = SvPV (ST (0), integer);      option = SvPV (ST (0), integer);
# Line 719  static XS (XS_weechat_set_plugin_config) Line 722  static XS (XS_weechat_set_plugin_config)
722          if (weechat_script_set_plugin_config (perl_plugin,          if (weechat_script_set_plugin_config (perl_plugin,
723                                                perl_current_script,                                                perl_current_script,
724                                                option, value))                                                option, value))
725              XSRETURN (1);              XSRETURN_YES;
726      }      }
727            
728      XSRETURN (0);      XSRETURN_NO;
729  }  }
730    
731  /*  /*

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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