mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #1067 from ailin-nemui/irc-module
modularise irc component
This commit is contained in:
commit
aa9bb36a0d
@ -247,14 +247,24 @@ MODULE_REC *module_find(const char *name)
|
|||||||
MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name)
|
MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
char *tmpname, *p;
|
||||||
|
tmpname = g_strdup(name);
|
||||||
|
for (p = tmpname; *p != '\0'; p++) {
|
||||||
|
if (*p == '_')
|
||||||
|
*p = '-';
|
||||||
|
}
|
||||||
|
|
||||||
for (tmp = module->files; tmp != NULL; tmp = tmp->next) {
|
for (tmp = module->files; tmp != NULL; tmp = tmp->next) {
|
||||||
MODULE_FILE_REC *rec = tmp->data;
|
MODULE_FILE_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (g_strcmp0(rec->name, name) == 0)
|
if (g_strcmp0(rec->name, name) == 0 ||
|
||||||
|
g_strcmp0(rec->name, tmpname) == 0) {
|
||||||
|
g_free(tmpname);
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(tmpname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
# define MODULE_IS_STATIC(rec) TRUE
|
# define MODULE_IS_STATIC(rec) TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MODULE_ABICHECK(fn_modulename) \
|
||||||
|
void fn_modulename ## _abicheck(int *version) \
|
||||||
|
{ \
|
||||||
|
*version = IRSSI_ABI_VERSION; \
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MODULE_ERROR_ALREADY_LOADED,
|
MODULE_ERROR_ALREADY_LOADED,
|
||||||
MODULE_ERROR_LOAD,
|
MODULE_ERROR_LOAD,
|
||||||
|
@ -191,3 +191,5 @@ void fe_irc_dcc_deinit(void)
|
|||||||
command_unbind("dcc", (SIGNAL_FUNC) cmd_dcc);
|
command_unbind("dcc", (SIGNAL_FUNC) cmd_dcc);
|
||||||
command_unbind("dcc list", (SIGNAL_FUNC) cmd_dcc_list);
|
command_unbind("dcc list", (SIGNAL_FUNC) cmd_dcc_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(fe_irc_dcc)
|
||||||
|
@ -102,7 +102,7 @@ void fe_common_irc_init(void)
|
|||||||
irc_completion_init();
|
irc_completion_init();
|
||||||
|
|
||||||
settings_check();
|
settings_check();
|
||||||
module_register("core", "fe-irc");
|
module_register("irc", "fe-common");
|
||||||
|
|
||||||
fe_irc_modules_init();
|
fe_irc_modules_init();
|
||||||
}
|
}
|
||||||
@ -130,3 +130,5 @@ void fe_common_irc_deinit(void)
|
|||||||
|
|
||||||
theme_unregister();
|
theme_unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(fe_common_irc)
|
||||||
|
@ -246,3 +246,5 @@ void fe_irc_notifylist_deinit(void)
|
|||||||
signal_remove("notifylist left", (SIGNAL_FUNC) notifylist_left);
|
signal_remove("notifylist left", (SIGNAL_FUNC) notifylist_left);
|
||||||
signal_remove("notifylist away changed", (SIGNAL_FUNC) notifylist_away);
|
signal_remove("notifylist away changed", (SIGNAL_FUNC) notifylist_away);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(fe_irc_notifylist)
|
||||||
|
@ -125,7 +125,7 @@ void irc_core_init(void)
|
|||||||
sasl_init();
|
sasl_init();
|
||||||
|
|
||||||
settings_check();
|
settings_check();
|
||||||
module_register("core", "irc");
|
module_register("irc", "core");
|
||||||
}
|
}
|
||||||
|
|
||||||
void irc_core_deinit(void)
|
void irc_core_deinit(void)
|
||||||
@ -149,3 +149,5 @@ void irc_core_deinit(void)
|
|||||||
|
|
||||||
chat_protocol_unregister("IRC");
|
chat_protocol_unregister("IRC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(irc_core)
|
||||||
|
@ -597,3 +597,4 @@ void irc_dcc_deinit(void)
|
|||||||
g_source_remove(dcc_timeouttag);
|
g_source_remove(dcc_timeouttag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(irc_dcc)
|
||||||
|
@ -346,3 +346,5 @@ void irc_flood_deinit(void)
|
|||||||
signal_remove("server connected", (SIGNAL_FUNC) flood_init_server);
|
signal_remove("server connected", (SIGNAL_FUNC) flood_init_server);
|
||||||
signal_remove("server destroyed", (SIGNAL_FUNC) flood_deinit_server);
|
signal_remove("server destroyed", (SIGNAL_FUNC) flood_deinit_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(irc_flood)
|
||||||
|
@ -358,3 +358,5 @@ void irc_notifylist_deinit(void)
|
|||||||
|
|
||||||
notifylist_destroy_all();
|
notifylist_destroy_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MODULE_ABICHECK(irc_notifylist)
|
||||||
|
@ -584,6 +584,9 @@ static void perl_register_protocol(CHAT_PROTOCOL_REC *rec)
|
|||||||
chat_type = chat_protocol_lookup(rec->name);
|
chat_type = chat_protocol_lookup(rec->name);
|
||||||
g_return_if_fail(chat_type >= 0);
|
g_return_if_fail(chat_type >= 0);
|
||||||
|
|
||||||
|
if (rec->not_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
name = g_ascii_strdown(rec->name,-1);
|
name = g_ascii_strdown(rec->name,-1);
|
||||||
*name = *(rec->name);
|
*name = *(rec->name);
|
||||||
|
|
||||||
|
@ -31,9 +31,13 @@
|
|||||||
#include <irssi/src/irc/core/irc-servers.h>
|
#include <irssi/src/irc/core/irc-servers.h>
|
||||||
#include <irssi/src/irc/core/irc-channels.h>
|
#include <irssi/src/irc/core/irc-channels.h>
|
||||||
|
|
||||||
/* irc.c */
|
/* flood.c */
|
||||||
void irc_init(void);
|
void irc_flood_init(void);
|
||||||
void irc_deinit(void);
|
void irc_flood_deinit(void);
|
||||||
|
|
||||||
|
/* irc-core.c */
|
||||||
|
void irc_core_init(void);
|
||||||
|
void irc_core_deinit(void);
|
||||||
|
|
||||||
/* irc-session.c */
|
/* irc-session.c */
|
||||||
void irc_session_init(void);
|
void irc_session_init(void);
|
||||||
@ -72,7 +76,8 @@ static void server_destroy_flood_set_up(ServerDestroyFloodData *fixture, const v
|
|||||||
{
|
{
|
||||||
args_execute(0, NULL);
|
args_execute(0, NULL);
|
||||||
core_init();
|
core_init();
|
||||||
irc_init();
|
irc_core_init();
|
||||||
|
irc_flood_init();
|
||||||
fe_common_core_init();
|
fe_common_core_init();
|
||||||
fe_common_irc_init();
|
fe_common_irc_init();
|
||||||
signal_emit("irssi init finished", 0);
|
signal_emit("irssi init finished", 0);
|
||||||
@ -90,7 +95,8 @@ static void server_destroy_flood_tear_down(ServerDestroyFloodData *fixture, cons
|
|||||||
command_unbind("echo", (SIGNAL_FUNC) cmd_echo);
|
command_unbind("echo", (SIGNAL_FUNC) cmd_echo);
|
||||||
fe_common_irc_deinit();
|
fe_common_irc_deinit();
|
||||||
fe_common_core_deinit();
|
fe_common_core_deinit();
|
||||||
irc_deinit();
|
irc_flood_deinit();
|
||||||
|
irc_core_deinit();
|
||||||
core_deinit();
|
core_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user