1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-16 06:25:24 +00:00

autoload the IRC module

This commit is contained in:
Ailin Nemui 2021-03-27 11:05:54 +01:00 committed by Ailin Nemui
parent 738931762b
commit 82f8ee57c3
17 changed files with 70 additions and 28 deletions

View File

@ -269,7 +269,7 @@ void core_init(void)
settings_add_str("misc", "ignore_signals", "");
settings_add_bool("misc", "override_coredump_limit", FALSE);
settings_add_bool("misc", "quit_on_hup", FALSE);
settings_add_str("misc", "autoload_modules", "perl otr");
settings_add_str("misc", "autoload_modules", "irc dcc flood notifylist perl otr");
#ifdef HAVE_SYS_RESOURCE_H
getrlimit(RLIMIT_CORE, &orig_core_rlimit);

View File

@ -1,6 +1,6 @@
# this file is part of irssi
libfe_irc_dcc_a = static_library('fe_irc_dcc',
libfe_irc_dcc_a = shared_module('fe_irc_dcc',
files(
'fe-dcc-chat-messages.c',
'fe-dcc-chat.c',
@ -12,6 +12,8 @@ libfe_irc_dcc_a = static_library('fe_irc_dcc',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
c_args : [
def_helpdir,
def_sysconfdir,

View File

@ -30,8 +30,10 @@
#include <irssi/src/fe-common/irc/fe-irc-server.h>
#include <irssi/src/fe-common/irc/fe-irc-channels.h>
#ifdef HAVE_STATIC_IRC
void fe_irc_modules_init(void);
void fe_irc_modules_deinit(void);
#endif
void fe_irc_queries_init(void);
void fe_irc_queries_deinit(void);
@ -104,12 +106,16 @@ void fe_common_irc_init(void)
settings_check();
module_register("irc", "fe-common");
#ifdef HAVE_STATIC_IRC
fe_irc_modules_init();
#endif
}
void fe_common_irc_deinit(void)
{
#ifdef HAVE_STATIC_IRC
fe_irc_modules_deinit();
#endif
fe_irc_channels_deinit();
fe_irc_queries_deinit();

View File

@ -1,4 +1,6 @@
#ifdef HAVE_STATIC_IRC
void fe_irc_dcc_init(void);void fe_irc_notifylist_init(void);
void fe_irc_notifylist_deinit(void);void fe_irc_dcc_deinit(void);
void fe_irc_modules_init(void) { fe_irc_dcc_init(); fe_irc_notifylist_init(); }
void fe_irc_modules_deinit(void) { fe_irc_notifylist_deinit(); fe_irc_dcc_deinit(); }
#endif

View File

@ -1,6 +1,6 @@
# this file is part of irssi
libfe_common_irc_a = static_library('fe_common_irc',
libfe_common_irc_a = shared_module('fe_common_irc',
files(
'fe-cap.c',
'fe-common-irc.c',
@ -25,6 +25,8 @@ libfe_common_irc_a = static_library('fe_common_irc',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
c_args : [
def_helpdir,
def_themesdir,

View File

@ -1,12 +1,14 @@
# this file is part of irssi
libfe_irc_notifylist_a = static_library('fe_irc_notifylist',
libfe_irc_notifylist_a = shared_module('fe_irc_notifylist',
files(
'fe-notifylist.c',
'module-formats.c',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
c_args : [
def_helpdir,
def_sysconfdir,

View File

@ -23,6 +23,7 @@
#include <irssi/src/core/modules-load.h>
#include <irssi/src/core/args.h>
#include <irssi/src/core/signals.h>
#include <irssi/src/core/settings.h>
#include <irssi/src/core/core.h>
#ifdef HAVE_STATIC_PERL
@ -30,8 +31,10 @@ void perl_core_init(void);
void perl_core_deinit(void);
#endif
#ifdef HAVE_STATIC_IRC
void irc_init(void);
void irc_deinit(void);
#endif
static GMainLoop *main_loop;
static char *autoload_module;
@ -47,13 +50,32 @@ static void sig_reload(void)
reload = TRUE;
}
static void autoload_modules(void)
{
char **list, **module;
list = g_strsplit_set(settings_get_str("autoload_modules"), " ,", -1);
for (module = list; *module != NULL; module++) {
char *tmp;
if ((tmp = strchr(*module, ':')) != NULL) {
*tmp = '\0';
tmp++;
module_load_sub(*module, tmp, NULL);
} else {
module_load(*module, NULL);
}
}
g_strfreev(list);
}
void noui_init(void)
{
srand(time(NULL));
irssi_gui = IRSSI_GUI_NONE;
core_init();
#ifdef HAVE_STATIC_IRC
irc_init();
#endif
module_register("core", "fe-none");
@ -64,6 +86,8 @@ void noui_init(void)
perl_core_init();
#endif
autoload_modules();
signal_emit("irssi init finished", 0);
}
@ -75,7 +99,9 @@ void noui_deinit(void)
signal_remove("reload", (SIGNAL_FUNC) sig_reload);
signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
#ifdef HAVE_STATIC_IRC
irc_deinit();
#endif
core_deinit();
}

View File

@ -10,7 +10,6 @@ executable('botti',
link_with : [
libconfig_a,
libcore_a,
libirc_a,
],
install : true,
dependencies : dep

View File

@ -59,11 +59,13 @@ void otr_core_init(void);
void otr_core_deinit(void);
#endif
#ifdef HAVE_STATIC_IRC
void irc_init(void);
void irc_deinit(void);
void fe_common_irc_init(void);
void fe_common_irc_deinit(void);
#endif
void gui_expandos_init(void);
void gui_expandos_deinit(void);
@ -168,9 +170,13 @@ static void textui_init(void)
irssi_gui = IRSSI_GUI_TEXT;
core_init();
#ifdef HAVE_STATIC_IRC
irc_init();
#endif
fe_common_core_init();
#ifdef HAVE_STATIC_IRC
fe_common_irc_init();
#endif
theme_register(gui_text_formats);
signal_add("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed);
@ -301,9 +307,13 @@ static void textui_deinit(void)
theme_unregister();
#ifdef HAVE_STATIC_IRC
fe_common_irc_deinit();
#endif
fe_common_core_deinit();
#ifdef HAVE_STATIC_IRC
irc_deinit();
#endif
core_deinit();
}

View File

@ -35,10 +35,6 @@ executable('irssi',
libconfig_a,
libcore_a,
libfe_common_core_a,
libirc_a,
libfe_common_irc_a,
libfe_irc_dcc_a,
libfe_irc_notifylist_a,
],
install : true,
install_rpath : get_option('prefix') / get_option('libdir'),

View File

@ -1,6 +1,6 @@
# this file is part of irssi
libirc_core_a = static_library('irc_core',
libirc_core_a = shared_module('irc_core',
files(
'bans.c',
'channel-events.c',
@ -33,6 +33,8 @@ libirc_core_a = static_library('irc_core',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
c_args : [
def_moduledir,
def_sysconfdir,

View File

@ -1,6 +1,6 @@
# this file is part of irssi
libirc_dcc_a = static_library('irc_dcc',
libirc_dcc_a = shared_module('irc_dcc',
files(
'dcc-autoget.c',
'dcc-chat.c',
@ -13,6 +13,8 @@ libirc_dcc_a = static_library('irc_dcc',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
dependencies : dep)
install_headers(

View File

@ -1,12 +1,14 @@
# this file is part of irssi
libirc_flood_a = static_library('irc_flood',
libirc_flood_a = shared_module('irc_flood',
files(
'autoignore.c',
'flood.c',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
dependencies : dep)
install_headers(

View File

@ -1,5 +1,7 @@
#ifdef HAVE_STATIC_IRC
void irc_core_init(void); void irc_core_deinit(void);
void irc_dcc_init(void);void irc_flood_init(void);void irc_notifylist_init(void);
void irc_notifylist_deinit(void);void irc_flood_deinit(void);void irc_dcc_deinit(void);
void irc_init(void) { irc_core_init(); irc_dcc_init(); irc_flood_init(); irc_notifylist_init(); }
void irc_deinit(void) { irc_notifylist_deinit(); irc_flood_deinit(); irc_dcc_deinit(); irc_core_deinit(); }
#endif

View File

@ -5,20 +5,6 @@ subdir('dcc')
subdir('flood')
subdir('notifylist')
libirc_a = static_library('irc',
files(
'irc.c',
),
link_with : [
libirc_core_a,
libirc_dcc_a,
libirc_flood_a,
libirc_notifylist_a,
],
include_directories : rootinc,
implicit_include_directories : false,
)
if want_proxy
subdir('proxy')
endif

View File

@ -1,6 +1,6 @@
# this file is part of irssi
libirc_notifylist_a = static_library('irc_notifylist',
libirc_notifylist_a = shared_module('irc_notifylist',
files(
'notify-commands.c',
'notify-ison.c',
@ -10,6 +10,8 @@ libirc_notifylist_a = static_library('irc_notifylist',
),
include_directories : rootinc,
implicit_include_directories : false,
install : true,
install_dir : moduledir,
dependencies : dep)
install_headers(

View File

@ -6,7 +6,8 @@ test_test_796 = executable('test-796',
libconfig_a,
libcore_a,
libfe_common_core_a,
libirc_a,
libirc_core_a,
libirc_flood_a,
libfe_common_irc_a,
libfe_irc_dcc_a,
libfe_irc_notifylist_a,