mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 05:16:38 +02:00
New backlog option in logger plugin, added variable names in .h files, replaced "void *" pointers by structures
This commit is contained in:
@@ -95,7 +95,7 @@ weechat_lua_exec (t_weechat_plugin *plugin,
|
||||
ret_value = strdup ((char *) lua_tostring (lua_current_interpreter, -1));
|
||||
else if (ret_type == SCRIPT_EXEC_INT)
|
||||
{
|
||||
ret_i = (int *) malloc (sizeof(int));
|
||||
ret_i = (int *)malloc (sizeof(int));
|
||||
if (ret_i)
|
||||
*ret_i = lua_tonumber (lua_current_interpreter, -1);
|
||||
ret_value = ret_i;
|
||||
|
||||
@@ -131,7 +131,7 @@ weechat_perl_exec (t_weechat_plugin *plugin,
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
int size = strlen (script->interpreter) + strlen(function) + 3;
|
||||
func = (char *) malloc ( size * sizeof(char));
|
||||
func = (char *)malloc (size * sizeof(char));
|
||||
if (!func)
|
||||
return NULL;
|
||||
snprintf (func, size, "%s::%s", (char *) script->interpreter, function);
|
||||
@@ -199,7 +199,7 @@ weechat_perl_exec (t_weechat_plugin *plugin,
|
||||
}
|
||||
else if (ret_type == SCRIPT_EXEC_INT)
|
||||
{
|
||||
ret_i = (int *) malloc (sizeof(int));
|
||||
ret_i = (int *)malloc (sizeof(int));
|
||||
if (ret_i)
|
||||
*ret_i = POPi;
|
||||
ret_value = ret_i;
|
||||
|
||||
@@ -121,7 +121,7 @@ weechat_python_exec (t_weechat_plugin *plugin,
|
||||
else if (PyInt_Check (rc) && (ret_type == SCRIPT_EXEC_INT))
|
||||
{
|
||||
|
||||
ret_i = (int *) malloc (sizeof(int));
|
||||
ret_i = (int *)malloc (sizeof(int));
|
||||
if (ret_i)
|
||||
*ret_i = (int) PyInt_AsLong(rc);
|
||||
ret_value = ret_i;
|
||||
@@ -2279,7 +2279,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
if (w_home)
|
||||
{
|
||||
len = strlen (w_home) + 1 + strlen("python") + 1;
|
||||
p_home = (char *) malloc (len * sizeof(char));
|
||||
p_home = (char *)malloc (len * sizeof(char));
|
||||
if (p_home)
|
||||
{
|
||||
snprintf (p_home, len, "%s/python", w_home);
|
||||
|
||||
@@ -168,7 +168,7 @@ weechat_ruby_exec (t_weechat_plugin *plugin,
|
||||
}
|
||||
else if ((TYPE(rc) == T_FIXNUM) && ret_type == SCRIPT_EXEC_INT)
|
||||
{
|
||||
ret_i = (int *) malloc (sizeof(int));
|
||||
ret_i = (int *)malloc (sizeof(int));
|
||||
if (ret_i)
|
||||
*ret_i = NUM2INT(rc);
|
||||
ret_value = ret_i;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <dirent.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "weechat-script.h"
|
||||
#include "script.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -37,8 +37,8 @@
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
int (*callback)(t_weechat_plugin *, char *))
|
||||
weechat_script_auto_load (struct t_weechat_plugin *plugin, char *language,
|
||||
int (*callback)(void *data, char *filename))
|
||||
{
|
||||
char *dir_home, *dir_name;
|
||||
int dir_length;
|
||||
@@ -49,7 +49,7 @@ weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
return;
|
||||
dir_length = strlen (dir_home) + strlen (language) + 16;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
(char *)malloc (dir_length * sizeof (char));
|
||||
if (!dir_name)
|
||||
{
|
||||
free (dir_home);
|
||||
@@ -57,7 +57,7 @@ weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
}
|
||||
snprintf (dir_name, dir_length, "%s/%s/autoload", dir_home, language);
|
||||
|
||||
plugin->exec_on_files (plugin, dir_name, callback);
|
||||
plugin->exec_on_files (dir_name, plugin, callback);
|
||||
|
||||
free (dir_name);
|
||||
free (dir_home);
|
||||
@@ -68,7 +68,7 @@ weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
weechat_script_search (t_weechat_plugin *plugin,
|
||||
weechat_script_search (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script **list, char *name)
|
||||
{
|
||||
t_plugin_script *ptr_script;
|
||||
@@ -89,7 +89,7 @@ weechat_script_search (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
weechat_script_search_full_name (struct t_weechat_plugin *plugin,
|
||||
char *language, char *filename)
|
||||
{
|
||||
char *final_name, *dir_home, *dir_system;
|
||||
@@ -102,7 +102,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
if (!dir_home)
|
||||
return NULL;
|
||||
length = strlen (dir_home) + strlen (filename + 1) + 1;
|
||||
final_name = (char *) malloc (length);
|
||||
final_name = (char *)malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
snprintf (final_name, length, "%s%s", dir_home, filename + 1);
|
||||
@@ -116,7 +116,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
if (dir_home)
|
||||
{
|
||||
length = strlen (dir_home) + strlen (language) + 8 + strlen (filename) + 16;
|
||||
final_name = (char *) malloc (length);
|
||||
final_name = (char *)malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
snprintf (final_name, length, "%s/%s/autoload/%s", dir_home, language, filename);
|
||||
@@ -135,7 +135,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
if (dir_home)
|
||||
{
|
||||
length = strlen (dir_home) + strlen (language) + strlen (filename) + 16;
|
||||
final_name = (char *) malloc (length);
|
||||
final_name = (char *)malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
snprintf (final_name, length, "%s/%s/%s", dir_home, language, filename);
|
||||
@@ -154,7 +154,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
if (dir_home)
|
||||
{
|
||||
length = strlen (dir_home) + strlen (filename) + 16;
|
||||
final_name = (char *) malloc (length);
|
||||
final_name = (char *)malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
snprintf (final_name, length, "%s/%s", dir_home, filename);
|
||||
@@ -173,7 +173,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
if (dir_system)
|
||||
{
|
||||
length = strlen (dir_system) + strlen (dir_system) + strlen (filename) + 16;
|
||||
final_name = (char *) malloc (length);
|
||||
final_name = (char *)malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
snprintf (final_name,length, "%s/%s/%s", dir_system, language, filename);
|
||||
@@ -195,7 +195,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
weechat_script_add (t_weechat_plugin *plugin,
|
||||
weechat_script_add (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script **script_list,
|
||||
char *filename,
|
||||
char *name, char *version,
|
||||
@@ -245,7 +245,7 @@ weechat_script_add (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove (t_weechat_plugin *plugin,
|
||||
weechat_script_remove (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script **script_list, t_plugin_script *script)
|
||||
{
|
||||
t_plugin_handler *ptr_handler, *next_handler;
|
||||
@@ -310,7 +310,7 @@ weechat_script_remove (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print (t_weechat_plugin *plugin,
|
||||
weechat_script_print (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...)
|
||||
@@ -335,7 +335,7 @@ weechat_script_print (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print_server (t_weechat_plugin *plugin,
|
||||
weechat_script_print_server (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *message, ...)
|
||||
{
|
||||
@@ -359,9 +359,9 @@ weechat_script_print_server (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_print_infobar (t_weechat_plugin *plugin,
|
||||
weechat_script_print_infobar (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
int time_displayed, char *message, ...)
|
||||
int delay, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
@@ -373,7 +373,7 @@ weechat_script_print_infobar (t_weechat_plugin *plugin,
|
||||
|
||||
buf2 = (script->charset && script->charset[0]) ?
|
||||
plugin->iconv_to_internal (plugin, script->charset, buf) : NULL;
|
||||
plugin->print_infobar (plugin, time_displayed, "%s", (buf2) ? buf2 : buf);
|
||||
plugin->print_infobar (plugin, delay, "%s", (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ weechat_script_print_infobar (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_log (t_weechat_plugin *plugin,
|
||||
weechat_script_log (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel, char *message, ...)
|
||||
{
|
||||
@@ -407,7 +407,7 @@ weechat_script_log (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_exec_command (t_weechat_plugin *plugin,
|
||||
weechat_script_exec_command (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *server, char *channel, char *command)
|
||||
{
|
||||
@@ -428,7 +428,7 @@ weechat_script_exec_command (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_handler (t_weechat_plugin *plugin,
|
||||
weechat_script_remove_handler (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *arg1, char *arg2)
|
||||
{
|
||||
@@ -464,7 +464,7 @@ weechat_script_remove_handler (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_timer_handler (t_weechat_plugin *plugin,
|
||||
weechat_script_remove_timer_handler (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function)
|
||||
{
|
||||
@@ -492,7 +492,7 @@ weechat_script_remove_timer_handler (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_keyboard_handler (t_weechat_plugin *plugin,
|
||||
weechat_script_remove_keyboard_handler (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function)
|
||||
{
|
||||
@@ -520,7 +520,7 @@ weechat_script_remove_keyboard_handler (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_event_handler (t_weechat_plugin *plugin,
|
||||
weechat_script_remove_event_handler (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function)
|
||||
{
|
||||
@@ -549,7 +549,7 @@ weechat_script_remove_event_handler (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_modifier (t_weechat_plugin *plugin,
|
||||
weechat_script_remove_modifier (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *arg1, char *arg2, char *arg3)
|
||||
{
|
||||
@@ -594,7 +594,7 @@ weechat_script_remove_modifier (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_script_get_plugin_config (t_weechat_plugin *plugin,
|
||||
weechat_script_get_plugin_config (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *option)
|
||||
{
|
||||
@@ -621,7 +621,7 @@ weechat_script_get_plugin_config (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_script_set_plugin_config (t_weechat_plugin *plugin,
|
||||
weechat_script_set_plugin_config (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *option, char *value)
|
||||
{
|
||||
@@ -648,7 +648,7 @@ weechat_script_set_plugin_config (t_weechat_plugin *plugin,
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_set_charset (t_weechat_plugin *plugin,
|
||||
weechat_script_set_charset (struct t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *charset)
|
||||
{
|
||||
|
||||
@@ -26,72 +26,80 @@
|
||||
#define SCRIPT_EXEC_INT 1
|
||||
#define SCRIPT_EXEC_STRING 2
|
||||
|
||||
typedef struct t_plugin_script t_plugin_script;
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
/* script variables */
|
||||
char *filename; /* name of script on disk */
|
||||
void *interpreter; /* interpreter for script */
|
||||
char *name; /* script name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *shutdown_func; /* function when script is unloaded */
|
||||
char *charset; /* script charset */
|
||||
char *filename; /* name of script on disk */
|
||||
void *interpreter; /* interpreter for script */
|
||||
char *name; /* script name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *shutdown_func; /* function when script is unloaded*/
|
||||
char *charset; /* script charset */
|
||||
|
||||
t_plugin_script *prev_script; /* link to previous script */
|
||||
t_plugin_script *next_script; /* link to next script */
|
||||
struct t_plugin_script *prev_script; /* link to previous script */
|
||||
struct t_plugin_script *next_script; /* link to next script */
|
||||
};
|
||||
|
||||
extern void weechat_script_auto_load (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
extern t_plugin_script *weechat_script_search (t_weechat_plugin *,
|
||||
t_plugin_script **, char *);
|
||||
extern char *weechat_script_search_full_name (t_weechat_plugin *,
|
||||
char *, char *);
|
||||
extern t_plugin_script *weechat_script_add (t_weechat_plugin *,
|
||||
t_plugin_script **, char *, char *,
|
||||
char *, char *, char *, char *);
|
||||
extern void weechat_script_remove (t_weechat_plugin *,
|
||||
t_plugin_script **, t_plugin_script *);
|
||||
extern void weechat_script_print (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *, ...);
|
||||
extern void weechat_script_print_server (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, ...);
|
||||
extern void weechat_script_print_infobar (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
int, char *, ...);
|
||||
extern void weechat_script_log (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *, ...);
|
||||
extern void weechat_script_exec_command (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *);
|
||||
extern void weechat_script_remove_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
extern void weechat_script_remove_timer_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_remove_keyboard_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_remove_event_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_remove_modifier (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *, char *);
|
||||
extern char *weechat_script_get_plugin_config (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern int weechat_script_set_plugin_config (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
extern void weechat_script_set_charset (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern void weechat_script_auto_load (struct t_weechat_plugin *plugin, char *language,
|
||||
int (*callback)(void *data, char *filename));
|
||||
extern struct t_plugin_script *weechat_script_search (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script **list,
|
||||
char *name);
|
||||
extern char *weechat_script_search_full_name (struct t_weechat_plugin *plugin,
|
||||
char *language, char *filename);
|
||||
extern struct t_plugin_script *weechat_script_add (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script **script_list,
|
||||
char *filename, char *name,
|
||||
char *version,
|
||||
char *shutdown_func,
|
||||
char *description,
|
||||
char *charset);
|
||||
extern void weechat_script_remove (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script **script_list,
|
||||
struct t_plugin_script *script);
|
||||
extern void weechat_script_print (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...);
|
||||
extern void weechat_script_print_server (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *message, ...);
|
||||
extern void weechat_script_print_infobar (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
int delay, char *message, ...);
|
||||
extern void weechat_script_log (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...);
|
||||
extern void weechat_script_exec_command (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *command);
|
||||
extern void weechat_script_remove_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *arg1, char *arg2);
|
||||
extern void weechat_script_remove_timer_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_keyboard_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_event_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_modifier (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *arg1, char *arg2,
|
||||
char *arg3);
|
||||
extern char *weechat_script_get_plugin_config (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *option);
|
||||
extern int weechat_script_set_plugin_config (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *option, char *value);
|
||||
extern void weechat_script_set_charset (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *charset);
|
||||
|
||||
#endif /* weechat-script.h */
|
||||
|
||||
Reference in New Issue
Block a user