1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 01:05:41 +02:00

fset: add fset (Fast Set) plugin skeleton (WIP)

This commit is contained in:
Sébastien Helleu
2017-05-18 18:32:02 +02:00
parent 9de297100a
commit 2a5eb1564f
23 changed files with 2196 additions and 0 deletions
+1
View File
@@ -93,6 +93,7 @@ option(ENABLE_BUFLIST "Enable Buflist plugin" ON)
option(ENABLE_CHARSET "Enable Charset plugin" ON)
option(ENABLE_EXEC "Enable Exec plugin" ON)
option(ENABLE_FIFO "Enable FIFO plugin" ON)
option(ENABLE_FSET "Enable Fast Set plugin" ON)
option(ENABLE_IRC "Enable IRC plugin" ON)
option(ENABLE_LOGGER "Enable Logger plugin" ON)
option(ENABLE_RELAY "Enable Relay plugin" ON)
+15
View File
@@ -113,6 +113,7 @@ AH_VERBATIM([PLUGIN_BUFLIST], [#undef PLUGIN_BUFLIST])
AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
AH_VERBATIM([PLUGIN_EXEC], [#undef PLUGIN_EXEC])
AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
AH_VERBATIM([PLUGIN_FSET], [#undef PLUGIN_FSET])
AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC])
AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER])
AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY])
@@ -144,6 +145,7 @@ AC_ARG_ENABLE(buflist, [ --disable-buflist turn off Buflist plugin (
AC_ARG_ENABLE(charset, [ --disable-charset turn off Charset plugin (default=compiled)],enable_charset=$enableval,enable_charset=yes)
AC_ARG_ENABLE(exec, [ --disable-exec turn off Exec plugin (default=compiled)],enable_exec=$enableval,enable_exec=yes)
AC_ARG_ENABLE(fifo, [ --disable-fifo turn off Fifo plugin (default=compiled)],enable_fifo=$enableval,enable_fifo=yes)
AC_ARG_ENABLE(fset, [ --disable-fset turn off Fast Set plugin (default=compiled)],enable_fset=$enableval,enable_fset=yes)
AC_ARG_ENABLE(irc, [ --disable-irc turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes)
AC_ARG_ENABLE(logger, [ --disable-logger turn off Logger plugin (default=compiled)],enable_logger=$enableval,enable_logger=yes)
AC_ARG_ENABLE(relay, [ --disable-relay turn off Relay plugin (default=compiled)],enable_relay=$enableval,enable_relay=yes)
@@ -421,6 +423,14 @@ else
not_asked="$not_asked fifo"
fi
# --------------------------------- fset ---------------------------------------
if test "x$enable_fset" = "xyes" ; then
AC_DEFINE(PLUGIN_FSET)
else
not_asked="$not_asked fset"
fi
# ----------------------------------- irc --------------------------------------
if test "x$enable_irc" = "xyes" ; then
@@ -1259,6 +1269,7 @@ AM_CONDITIONAL(PLUGIN_BUFLIST, test "$enable_buflist" = "yes")
AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
AM_CONDITIONAL(PLUGIN_EXEC, test "$enable_exec" = "yes")
AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
AM_CONDITIONAL(PLUGIN_FSET, test "$enable_fset" = "yes")
AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
@@ -1296,6 +1307,7 @@ AC_OUTPUT([Makefile
src/plugins/charset/Makefile
src/plugins/exec/Makefile
src/plugins/fifo/Makefile
src/plugins/fset/Makefile
src/plugins/irc/Makefile
src/plugins/logger/Makefile
src/plugins/relay/Makefile
@@ -1349,6 +1361,9 @@ fi
if test "x$enable_fifo" = "xyes"; then
listplugins="$listplugins fifo"
fi
if test "x$enable_fset" = "xyes"; then
listplugins="$listplugins fset"
fi
if test "x$enable_irc" = "xyes" ; then
listplugins="$listplugins irc"
fi
+4
View File
@@ -86,6 +86,10 @@ if(ENABLE_FIFO)
add_subdirectory(fifo)
endif()
if(ENABLE_FSET)
add_subdirectory(fset)
endif()
if(ENABLE_IRC)
add_subdirectory(irc)
endif()
+5
View File
@@ -61,6 +61,10 @@ if PLUGIN_FIFO
fifo_dir = fifo
endif
if PLUGIN_FSET
fset_dir = fset
endif
if PLUGIN_IRC
irc_dir = irc
endif
@@ -120,6 +124,7 @@ SUBDIRS = . \
$(charset_dir) \
$(exec_dir) \
$(fifo_dir) \
$(fset_dir) \
$(irc_dir) \
$(logger_dir) \
$(relay_dir) \
+33
View File
@@ -0,0 +1,33 @@
#
# Copyright (C) 2003-2017 Sébastien 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(fset MODULE
fset.c fset.h
fset-bar-item.c fset-bar-item.h
fset-buffer.c fset-buffer.h
fset-command.c fset-command.h
fset-config.c fset-config.h
fset-info.c fset-info.h
fset-mouse.c fset-mouse.h
fset-option.c fset-option.h)
set_target_properties(fset PROPERTIES PREFIX "")
target_link_libraries(fset)
install(TARGETS fset LIBRARY DESTINATION ${LIBDIR}/plugins)
+46
View File
@@ -0,0 +1,46 @@
#
# Copyright (C) 2003-2017 Sébastien 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/>.
#
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(FSET_CFLAGS)
libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = fset.la
fset_la_SOURCES = fset.c \
fset.h \
fset-bar-item.c \
fset-bar-item.h \
fset-buffer.c \
fset-buffer.h \
fset-command.c \
fset-command.h \
fset-config.c \
fset-config.h \
fset-info.c \
fset-info.h \
fset-mouse.c \
fset-mouse.h \
fset-option.c \
fset-option.h
fset_la_LDFLAGS = -module -no-undefined
fset_la_LIBADD = $(FSET_LFLAGS)
EXTRA_DIST = CMakeLists.txt
+84
View File
@@ -0,0 +1,84 @@
/*
* fset-bar-item.c - bar item for Fast Set plugin
*
* Copyright (C) 2003-2017 Sébastien 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/>.
*/
#include <stdlib.h>
#include "../weechat-plugin.h"
#include "fset.h"
#include "fset-bar-item.h"
#include "fset-config.h"
struct t_gui_bar_item *fset_bar_item_fset = NULL;
/*
* Updates fset bar item if fset is enabled.
*/
void
fset_bar_item_update ()
{
if (weechat_config_boolean (fset_config_look_enabled))
weechat_bar_item_update (FSET_BAR_ITEM_NAME);
}
/*
* Returns content of bar item "buffer_plugin": bar item with buffer plugin.
*/
char *
fset_bar_item_fset_cb (const void *pointer, void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
return NULL;
}
/*
* Initializes fset bar items.
*
* Returns:
* 1: OK
* 0: error
*/
int
fset_bar_item_init ()
{
fset_bar_item_fset = weechat_bar_item_new (
FSET_BAR_ITEM_NAME,
&fset_bar_item_fset_cb, NULL, NULL);
return 1;
}
/*
* Ends fset bar items.
*/
void
fset_bar_item_end ()
{
weechat_bar_item_remove (fset_bar_item_fset);
}
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_BAR_ITEM_H
#define WEECHAT_FSET_BAR_ITEM_H 1
#define FSET_BAR_ITEM_NAME "fset"
extern void fset_bar_item_update ();
extern int fset_bar_item_init ();
extern void fset_bar_item_end ();
#endif /* WEECHAT_FSET_BAR_ITEM_H */
File diff suppressed because it is too large Load Diff
+41
View File
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_BUFFER_H
#define WEECHAT_FSET_BUFFER_H 1
#define FSET_BUFFER_NAME "fset"
extern struct t_gui_buffer *fset_buffer;
extern int fset_buffer_selected_line;
extern void fset_buffer_refresh (int clear);
extern void fset_buffer_set_current_line (int line);
extern void fset_buffer_check_line_outside_window ();
extern int fset_buffer_window_scrolled_cb (const void *pointer,
void *data,
const char *signal,
const char *type_data,
void *signal_data);
extern void fset_buffer_set_keys ();
extern void fset_buffer_open ();
extern int fset_buffer_init ();
extern void fset_buffer_end ();
#endif /* WEECHAT_FSET_BUFFER_H */
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_COMMAND_H
#define WEECHAT_FSET_COMMAND_H 1
extern void fset_command_init ();
#endif /* WEECHAT_FSET_COMMAND_H */
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_CONFIG_H
#define WEECHAT_FSET_CONFIG_H 1
#define FSET_CONFIG_NAME "fset"
extern struct t_config_file *fset_config_file;
extern struct t_config_option *fset_config_look_enabled;
extern struct t_config_option *fset_config_look_use_keys;
extern struct t_config_option *fset_config_format_option;
extern struct t_config_option *fset_config_format_option_current;
extern char *fset_config_eval_format_option_current;
extern int fset_config_init ();
extern int fset_config_read ();
extern int fset_config_write ();
extern void fset_config_free ();
#endif /* WEECHAT_FSET_CONFIG_H */
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_INFO_H
#define WEECHAT_FSET_INFO_H 1
extern void fset_info_init ();
#endif /* WEECHAT_FSET_INFO_H */
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_MOUSE_H
#define WEECHAT_FSET_MOUSE_H 1
#define FSET_MOUSE_HSIGNAL "fset_mouse"
extern int fset_mouse_init ();
extern void fset_mouse_end ();
#endif /* WEECHAT_FSET_MOUSE_H */
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_OPTION_H
#define WEECHAT_FSET_OPTION_H 1
#include <time.h>
/* status for fset */
#define FSET_STATUS_INSTALLED 1
#define FSET_STATUS_AUTOLOADED 2
#define FSET_STATUS_HELD 4
#define FSET_STATUS_RUNNING 8
#define FSET_STATUS_NEW_VERSION 16
struct t_fset_option
{
char *name; /* option name */
char *type; /* option type */
char *default_value; /* option default value */
char *value; /* option value */
struct t_fset_option *prev_option; /* link to previous option */
struct t_fset_option *next_option; /* link to next option */
};
extern struct t_arraylist *fset_options;
extern struct t_hashtable *fset_option_max_length_field;
extern char *fset_option_filter;
extern int fset_option_valid (struct t_fset_option *option);
extern struct t_fset_option *fset_option_search_by_name (const char *name);
extern void fset_option_set_filter (const char *filter);
extern void fset_option_get_options ();
extern void fset_option_filter_options (const char *search);
extern struct t_hdata *fset_option_hdata_option_cb (const void *pointer,
void *data,
const char *hdata_name);
extern int fset_option_add_to_infolist (struct t_infolist *infolist,
struct t_fset_option *option);
extern void fset_option_print_log ();
extern int fset_option_init ();
extern void fset_option_end ();
#endif /* WEECHAT_FSET_OPTION_H */
File diff suppressed because it is too large Load Diff
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2003-2017 Sébastien 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_FSET_H
#define WEECHAT_FSET_H 1
#define weechat_plugin weechat_fset_plugin
#define FSET_PLUGIN_NAME "fset"
#define FSET_BAR_NAME "fset"
extern struct t_weechat_plugin *weechat_fset_plugin;
extern struct t_hdata *fset_hdata_config_file;
extern struct t_hdata *fset_hdata_config_section;
extern struct t_hdata *fset_hdata_config_option;
extern struct t_hdata *fset_hdata_fset_option;
#endif /* WEECHAT_FSET_H */
+1
View File
@@ -26,6 +26,7 @@
extern "C" {
#endif /* __cplusplus */
#include <stddef.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>