1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 19:45:41 +02:00

core: add new plugin "script" (scripts manager, replacing scripts weeget.py and script.pl)

This commit is contained in:
Sebastien Helleu
2012-08-14 18:29:32 +02:00
parent 3a245686ca
commit a99d136018
84 changed files with 10881 additions and 1208 deletions
+43
View File
@@ -0,0 +1,43 @@
#
# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
ADD_LIBRARY(script MODULE
script.c script.h
script-action.c script-action.h
script-buffer.c script-buffer.h
script-command.c script-command.h
script-completion.c script-completion.h
script-config.c script-config.h
script-info.c script-info.h
script-repo.c script-repo.h)
SET_TARGET_PROPERTIES(script PROPERTIES PREFIX "")
SET (LINK_LIBS)
IF(ZLIB_FOUND)
LIST(APPEND LINK_LIBS ${ZLIB_LIBRARY})
ENDIF(ZLIB_FOUND)
IF(GCRYPT_FOUND)
LIST(APPEND LINK_LIBS gcrypt)
ENDIF(GCRYPT_FOUND)
TARGET_LINK_LIBRARIES(script ${LINK_LIBS})
INSTALL(TARGETS script LIBRARY DESTINATION ${LIBDIR}/plugins)
+46
View File
@@ -0,0 +1,46 @@
#
# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(ZLIB_CFLAGS) $(GCRYPT_CFLAGS)
libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = script.la
script_la_SOURCES = script.c \
script.h \
script-action.c \
script-action.h \
script-buffer.c \
script-buffer.h \
script-command.c \
script-command.h \
script-completion.c \
script-completion.h \
script-config.c \
script-config.h \
script-info.c \
script-info.h \
script-repo.c \
script-repo.h
script_la_LDFLAGS = -module
script_la_LIBADD = $(SCRIPT_LFLAGS) $(ZLIB_LFLAGS) $(GCRYPT_LFLAGS)
EXTRA_DIST = CMakeLists.txt
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_ACTION_H
#define __WEECHAT_SCRIPT_ACTION_H 1
extern char *script_actions;
extern int script_action_run ();
extern void script_action_schedule (const char *action, int need_repository,
int quiet);
#endif /* __WEECHAT_SCRIPT_ACTION_H */
File diff suppressed because it is too large Load Diff
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_BUFFER_H
#define __WEECHAT_SCRIPT_BUFFER_H 1
#define SCRIPT_BUFFER_NAME "scripts"
struct t_repo_script;
extern struct t_gui_buffer *script_buffer;
extern int script_buffer_selected_line;
extern struct t_repo_script *script_buffer_detail_script;
extern void script_buffer_refresh (int clear);
extern void script_buffer_set_current_line (int line);
extern void script_buffer_show_detail_script (struct t_repo_script *script);
extern void script_buffer_check_line_outside_window ();
extern int script_buffer_window_scrolled_cb (void *data, const char *signal,
const char *type_data,
void *signal_data);
extern int script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data);
extern int script_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
extern void script_buffer_set_callbacks ();
extern void script_buffer_open ();
#endif /* __WEECHAT_SCRIPT_BUFFER_H */
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_COMMAND_H
#define __WEECHAT_SCRIPT_COMMAND_H 1
extern void script_command_init ();
#endif /* __WEECHAT_SCRIPT_COMMAND_H */
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_COMPLETION_H
#define __WEECHAT_SCRIPT_COMPLETION_H 1
extern void script_completion_init ();
#endif /* __WEECHAT_SCRIPT_COMPLETION_H */
File diff suppressed because it is too large Load Diff
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_CONFIG_H
#define __WEECHAT_SCRIPT_CONFIG_H 1
#define SCRIPT_CONFIG_NAME "script"
struct t_repo_script;
extern struct t_config_option *script_config_look_columns;
extern struct t_config_option *script_config_look_sort;
extern struct t_config_option *script_config_color_status_popular;
extern struct t_config_option *script_config_color_status_installed;
extern struct t_config_option *script_config_color_status_held;
extern struct t_config_option *script_config_color_status_running;
extern struct t_config_option *script_config_color_status_obsolete;
extern struct t_config_option *script_config_color_status_unknown;
extern struct t_config_option *script_config_color_text;
extern struct t_config_option *script_config_color_text_date;
extern struct t_config_option *script_config_color_text_delimiters;
extern struct t_config_option *script_config_color_text_description;
extern struct t_config_option *script_config_color_text_extension;
extern struct t_config_option *script_config_color_text_name;
extern struct t_config_option *script_config_color_text_tags;
extern struct t_config_option *script_config_color_text_version;
extern struct t_config_option *script_config_color_text_version_loaded;
extern struct t_config_option *script_config_color_text_bg;
extern struct t_config_option *script_config_color_text_selected;
extern struct t_config_option *script_config_color_text_date_selected;
extern struct t_config_option *script_config_color_text_description_selected;
extern struct t_config_option *script_config_color_text_extension_selected;
extern struct t_config_option *script_config_color_text_name_selected;
extern struct t_config_option *script_config_color_text_tags_selected;
extern struct t_config_option *script_config_color_text_version_selected;
extern struct t_config_option *script_config_color_text_version_loaded_selected;
extern struct t_config_option *script_config_color_text_bg_selected;
extern struct t_config_option *script_config_scripts_cache_expire;
extern struct t_config_option *script_config_scripts_dir;
extern struct t_config_option *script_config_scripts_hold;
extern struct t_config_option *script_config_scripts_url;
extern char *script_config_get_dir ();
extern char *script_config_get_xml_filename ();
extern char *script_config_get_script_download_filename (struct t_repo_script *script);
extern void script_config_hold (const char *name_with_extension);
extern void script_config_unhold (const char *name_with_extension);
extern int script_config_init ();
extern int script_config_read ();
extern int script_config_write ();
extern void script_config_free ();
#endif /* __WEECHAT_SCRIPT_CONFIG_H */
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_INFO_H
#define __WEECHAT_SCRIPT_INFO_H 1
extern void script_info_init ();
#endif /* __WEECHAT_SCRIPT_INFO_H */
File diff suppressed because it is too large Load Diff
+83
View File
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_REPO_H
#define __WEECHAT_SCRIPT_REPO_H 1
/* status for script */
#define SCRIPT_STATUS_INSTALLED 1
#define SCRIPT_STATUS_HELD 2
#define SCRIPT_STATUS_RUNNING 4
#define SCRIPT_STATUS_NEW_VERSION 8
struct t_repo_script
{
char *name; /* script name */
char *name_with_extension; /* script name with extension */
int language; /* language index */
char *author; /* author */
char *mail; /* author's mail */
char *version; /* plugin version */
char *license; /* license */
char *description; /* description */
char *tags; /* comma-separated list of tags */
char *requirements; /* requirements */
char *min_weechat; /* min WeeChat version */
char *max_weechat; /* max WeeChat version */
char *md5sum; /* md5sum of script content */
char *url; /* URL to download script */
int popularity; /* >0 for popular scripts only */
time_t date_added; /* date added */
time_t date_updated; /* date updated */
int status; /* installed/running/new version */
char *version_loaded; /* version of script loaded */
int displayed; /* script displayed? */
int install_order; /* order for install script (if >0)*/
struct t_repo_script *prev_script; /* link to previous script */
struct t_repo_script *next_script; /* link to next script */
};
extern struct t_repo_script *repo_scripts;
extern struct t_repo_script *last_repo_script;
extern int script_repo_count, script_repo_count_displayed;
struct t_hashtable *script_repo_max_length_field;
extern char *script_repo_filter;
extern int script_repo_script_valid (struct t_repo_script *script);
extern struct t_repo_script *script_repo_search_displayed_by_number (int number);
extern struct t_repo_script *script_repo_search_by_name (const char *name);
extern struct t_repo_script *script_repo_search_by_name_ext (const char *name_with_extension);
extern const char *script_repo_get_status_for_display (struct t_repo_script *script,
const char *list,
int collapse);
extern void script_repo_remove_all ();
extern void script_repo_update_status (struct t_repo_script *script);
extern void script_repo_update_status_all ();
extern int script_repo_file_exists ();
extern int script_repo_file_is_uptodate ();
extern int script_repo_file_read (int quiet);
extern void script_repo_file_update (int quiet);
extern void script_repo_filter_scripts (const char *search);
extern struct t_hdata *script_repo_hdata_script_cb (void *data,
const char *hdata_name);
extern int script_repo_add_to_infolist (struct t_infolist *infolist,
struct t_repo_script *script);
extern void script_repo_print_log ();
#endif /* __WEECHAT_SCRIPT_REPO_H */
File diff suppressed because it is too large Load Diff
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_SCRIPT_H
#define __WEECHAT_SCRIPT_H 1
#define weechat_plugin weechat_script_plugin
#define SCRIPT_PLUGIN_NAME "script"
extern struct t_weechat_plugin *weechat_script_plugin;
extern char *script_language[];
extern char *script_extension[];
extern struct t_hashtable *script_loaded;
extern int script_language_search (const char *language);
extern int script_language_search_by_extension (const char *extension);
extern void script_actions_add (const char *action);
extern void script_get_loaded_scripts ();
#endif /* __WEECHAT_SCRIPT_H */