diff options
Diffstat (limited to 'src/fe-common')
32 files changed, 203 insertions, 203 deletions
diff --git a/src/fe-common/core/Makefile.am b/src/fe-common/core/Makefile.am index ec9d99e9..90e64d55 100644 --- a/src/fe-common/core/Makefile.am +++ b/src/fe-common/core/Makefile.am @@ -1,4 +1,4 @@ -noinst_LTLIBRARIES = libfe_common_core.la +noinst_LIBRARIES = libfe_common_core.a INCLUDES = \ $(GLIB_CFLAGS) \ @@ -6,7 +6,7 @@ INCLUDES = \ -DHELPDIR=\""$(datadir)/irssi/help"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" -libfe_common_core_la_SOURCES = \ +libfe_common_core_a_SOURCES = \ autorun.c \ command-history.c \ completion.c \ diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index d192136b..1a802ace 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -133,6 +133,8 @@ void fe_common_core_finish_init(void) { WINDOW_REC *window; + signal_emit("irssi init read settings", 0); + signal(SIGPIPE, SIG_IGN); windows_restore(); diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index eef4dade..bd1aa2cc 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -22,7 +22,7 @@ #include "module-formats.h" #include "signals.h" #include "commands.h" -#include "server.h" +#include "servers.h" #include "levels.h" #include "misc.h" #include "log.h" diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c index fff3d1fc..5e5483a6 100644 --- a/src/fe-common/core/fe-server.c +++ b/src/fe-common/core/fe-server.c @@ -19,13 +19,13 @@ */ #include "module.h" -#include "module-formats.h" #include "signals.h" -#include "settings.h" #include "network.h" - #include "levels.h" -#include "server.h" +#include "servers.h" +#include "settings.h" + +#include "module-formats.h" static void sig_server_looking(SERVER_REC *server) { diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index f164d130..4c2bf823 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -22,7 +22,7 @@ #include "module-formats.h" #include "signals.h" #include "commands.h" -#include "server.h" +#include "servers.h" #include "misc.h" #include "lib-config/iconfig.h" #include "settings.h" diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 06f30123..b31f9cbd 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -27,7 +27,7 @@ #include "settings.h" #include "levels.h" -#include "server.h" +#include "servers.h" #include "hilight-text.h" diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 85661d6f..155b580f 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -27,7 +27,7 @@ #include "settings.h" #include "levels.h" -#include "server.h" +#include "servers.h" #include "translation.h" #include "themes.h" diff --git a/src/fe-common/core/window-activity.c b/src/fe-common/core/window-activity.c index 47b82079..f86078be 100644 --- a/src/fe-common/core/window-activity.c +++ b/src/fe-common/core/window-activity.c @@ -21,7 +21,7 @@ #include "module.h" #include "signals.h" #include "levels.h" -#include "server.h" +#include "servers.h" #include "misc.h" #include "settings.h" diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 14d1d94a..e31d827b 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -23,7 +23,7 @@ #include "signals.h" #include "commands.h" #include "misc.h" -#include "server.h" +#include "servers.h" #include "levels.h" @@ -183,7 +183,7 @@ static void cmd_window_server(const char *data) else if (active_win->active == NULL) { window_change_server(active_win, server); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_SERVER_CHANGED, server->tag, server->connrec->address, - server->connrec->ircnet == NULL ? "" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "" : server->connrec->chatnet); } } diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c index bda4ee96..443ca586 100644 --- a/src/fe-common/core/window-items.c +++ b/src/fe-common/core/window-items.c @@ -22,7 +22,7 @@ #include "module-formats.h" #include "modules.h" #include "signals.h" -#include "server.h" +#include "servers.h" #include "settings.h" #include "levels.h" diff --git a/src/fe-common/core/window-save.c b/src/fe-common/core/window-save.c index fdf253a3..14174168 100644 --- a/src/fe-common/core/window-save.c +++ b/src/fe-common/core/window-save.c @@ -21,7 +21,7 @@ #include "module.h" #include "signals.h" #include "misc.h" -#include "server.h" +#include "servers.h" #include "lib-config/iconfig.h" #include "settings.h" diff --git a/src/fe-common/core/windows.c b/src/fe-common/core/windows.c index 77b8b3e2..5b362af9 100644 --- a/src/fe-common/core/windows.c +++ b/src/fe-common/core/windows.c @@ -23,7 +23,7 @@ #include "modules.h" #include "signals.h" #include "commands.h" -#include "server.h" +#include "servers.h" #include "misc.h" #include "settings.h" diff --git a/src/fe-common/core/windows.h b/src/fe-common/core/windows.h index 9c40235d..16fff673 100644 --- a/src/fe-common/core/windows.h +++ b/src/fe-common/core/windows.h @@ -1,6 +1,11 @@ #ifndef __WINDOWS_H #define __WINDOWS_H +#include "servers.h" + +#define STRUCT_SERVER_REC SERVER_REC +#include "window-item-def.h" + enum { NEWDATA_TEXT = 1, NEWDATA_MSG, @@ -8,30 +13,13 @@ enum { NEWDATA_CUSTOM }; -/* All window items *MUST* have these variables in same order - at the start of the structure - the server's type can of course be - replaced with the preferred record type. - - !!!! So IF YOU CHANGE THIS: REMEMBER TO UPDATE WI_IRC_REC, CHANNEL_REC - and QUERY_REC !!!! (I already forgot this once :) */ -typedef struct { - int type; - GHashTable *module_data; - - void *server; - char *name; - - int new_data; - int last_color; /* if NEWDATA_HILIGHT is set, color number could be specified here */ -} WI_ITEM_REC; - typedef struct { int refnum; char *name; GSList *items; WI_ITEM_REC *active; - void *active_server; + SERVER_REC *active_server; GSList *waiting_channels; /* list of "<server tag> <channel>" */ diff --git a/src/fe-common/irc/Makefile.am b/src/fe-common/irc/Makefile.am index eeb27f50..1bc23a0d 100644 --- a/src/fe-common/irc/Makefile.am +++ b/src/fe-common/irc/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = dcc flood notifylist -noinst_LTLIBRARIES = libfe_common_irc.la +noinst_LIBRARIES = libfe_common_irc.a INCLUDES = \ $(GLIB_CFLAGS) \ @@ -11,7 +11,7 @@ INCLUDES = \ -DHELPDIR=\""$(datadir)/irssi/help"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" -libfe_common_irc_la_SOURCES = \ +libfe_common_irc_a_SOURCES = \ fe-channels.c \ fe-irc-commands.c \ fe-irc-server.c \ @@ -22,7 +22,7 @@ libfe_common_irc_la_SOURCES = \ fe-ignore.c \ fe-netjoin.c \ fe-netsplit.c \ - fe-query.c \ + fe-queries.c \ fe-common-irc.c \ irc-completion.c \ irc-window-activity.c \ @@ -32,7 +32,7 @@ libfe_common_irc_la_SOURCES = \ noinst_HEADERS = \ fe-common-irc.h \ - fe-query.h \ + fe-queries.h \ irc-hilight-text.h \ module.h \ module-formats.h diff --git a/src/fe-common/irc/dcc/fe-dcc.c b/src/fe-common/irc/dcc/fe-dcc.c index 43f8ce32..fb9a8d81 100644 --- a/src/fe-common/irc/dcc/fe-dcc.c +++ b/src/fe-common/irc/dcc/fe-dcc.c @@ -19,7 +19,6 @@ */ #include "module.h" -#include "./module-formats.h" #include "signals.h" #include "commands.h" #include "network.h" @@ -27,7 +26,7 @@ #include "levels.h" #include "irc.h" #include "channels.h" -#include "query.h" +#include "irc-queries.h" #include "irc/dcc/dcc.h" @@ -35,6 +34,8 @@ #include "themes.h" #include "windows.h" +#include "module-formats.h" + static void dcc_connected(DCC_REC *dcc) { char *sender; @@ -47,7 +48,7 @@ static void dcc_connected(DCC_REC *dcc) printformat(dcc->server, sender, MSGLEVEL_DCC, IRCTXT_DCC_CHAT_CONNECTED, dcc->nick, dcc->addrstr, dcc->port); if (query_find(NULL, sender) == NULL) - query_create(dcc->server, sender, TRUE); + irc_query_create(dcc->server, sender, TRUE); g_free(sender); break; case DCC_TYPE_SEND: @@ -278,10 +279,10 @@ static void sig_query_destroyed(QUERY_REC *query) { DCC_REC *dcc; - if (*query->nick != '=') + if (*query->name != '=') return; - dcc = dcc_find_item(DCC_TYPE_CHAT, query->nick+1, NULL); + dcc = dcc_find_item(DCC_TYPE_CHAT, query->name+1, NULL); if (dcc != NULL && !dcc->destroyed) { /* DCC query window closed, close the dcc chat too. */ signal_emit("dcc closed", 1, dcc); @@ -318,7 +319,7 @@ static void cmd_msg(const char *data) cmd_params_free(free_arg); } -static void cmd_me(const char *data, SERVER_REC *server, WI_IRC_REC *item) +static void cmd_me(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { DCC_REC *dcc; @@ -331,7 +332,7 @@ static void cmd_me(const char *data, SERVER_REC *server, WI_IRC_REC *item) IRCTXT_OWN_DCC_ME, dcc->mynick, data); } -static void cmd_action(const char *data, SERVER_REC *server, WI_IRC_REC *item) +static void cmd_action(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { DCC_REC *dcc; char *target, *text; diff --git a/src/fe-common/irc/fe-channels.c b/src/fe-common/irc/fe-channels.c index 1d41c70f..94f56cae 100644 --- a/src/fe-common/irc/fe-channels.c +++ b/src/fe-common/irc/fe-channels.c @@ -28,7 +28,7 @@ #include "settings.h" #include "irc.h" -#include "channels.h" +#include "irc-channels.h" #include "channels-setup.h" #include "nicklist.h" @@ -70,12 +70,12 @@ static void signal_channel_destroyed(CHANNEL_REC *channel) static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item) { - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; g_return_if_fail(window != NULL); - channel = irc_item_channel(item); - if (channel != NULL) channel_destroy(channel); + channel = IRC_CHANNEL(item); + if (channel != NULL) channel_destroy(CHANNEL(channel)); } static void sig_disconnected(IRC_SERVER_REC *server) @@ -84,7 +84,7 @@ static void sig_disconnected(IRC_SERVER_REC *server) GSList *tmp; g_return_if_fail(server != NULL); - if (!irc_server_check(server)) + if (!IS_IRC_SERVER(server)) return; for (tmp = server->channels; tmp != NULL; tmp = tmp->next) { @@ -101,7 +101,7 @@ static void signal_window_item_changed(WINDOW_REC *window, WI_ITEM_REC *item) g_return_if_fail(window != NULL); if (item == NULL) return; - if (g_slist_length(window->items) > 1 && irc_item_channel(item)) { + if (g_slist_length(window->items) > 1 && IS_IRC_CHANNEL(item)) { printformat(item->server, item->name, MSGLEVEL_CLIENTNOTICE, IRCTXT_TALKING_IN, item->name); signal_stop(); @@ -146,7 +146,7 @@ static void cmd_wjoin_post(const char *data) static void cmd_channel_list_joined(void) { - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; GString *nicks; GSList *nicklist, *tmp, *ntmp; @@ -156,7 +156,7 @@ static void cmd_channel_list_joined(void) } /* print active channel */ - channel = irc_item_channel(active_win->active); + channel = IRC_CHANNEL(active_win->active); if (channel != NULL) printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_CURRENT_CHANNEL, channel->name); @@ -165,7 +165,7 @@ static void cmd_channel_list_joined(void) for (tmp = channels; tmp != NULL; tmp = tmp->next) { channel = tmp->data; - nicklist = nicklist_getnicks(channel); + nicklist = nicklist_getnicks(CHANNEL(channel)); nicks = g_string_new(NULL); for (ntmp = nicklist; ntmp != NULL; ntmp = ntmp->next) { NICK_REC *rec = ntmp->data; @@ -191,7 +191,7 @@ static void cmd_channel_list(void) str = g_string_new(NULL); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_CHANSETUP_HEADER); for (tmp = setupchannels; tmp != NULL; tmp = tmp->next) { - SETUP_CHANNEL_REC *rec = tmp->data; + CHANNEL_SETUP_REC *rec = tmp->data; g_string_truncate(str, 0); if (rec->autojoin) @@ -203,7 +203,7 @@ static void cmd_channel_list(void) if (str->len > 2) g_string_truncate(str, str->len-2); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_CHANSETUP_LINE, - rec->name, rec->ircnet == NULL ? "" : rec->ircnet, + rec->name, rec->chatnet == NULL ? "" : rec->chatnet, rec->password == NULL ? "" : rec->password, str->str); } g_string_free(str, TRUE); @@ -225,7 +225,7 @@ static void cmd_channel(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *i static void cmd_channel_add(const char *data) { GHashTable *optlist; - SETUP_CHANNEL_REC *rec; + CHANNEL_SETUP_REC *rec; char *botarg, *botcmdarg, *ircnet, *channel, *password; void *free_arg; @@ -240,9 +240,9 @@ static void cmd_channel_add(const char *data) cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); rec = channels_setup_find(channel, ircnet); if (rec == NULL) { - rec = g_new0(SETUP_CHANNEL_REC, 1); + rec = g_new0(CHANNEL_SETUP_REC, 1); rec->name = g_strdup(channel); - rec->ircnet = g_strdup(ircnet); + rec->chatnet = g_strdup(ircnet); } else { if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks); if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd); @@ -262,7 +262,7 @@ static void cmd_channel_add(const char *data) /* SYNTAX: CHANNEL REMOVE <channel> <ircnet> */ static void cmd_channel_remove(const char *data) { - SETUP_CHANNEL_REC *rec; + CHANNEL_SETUP_REC *rec; char *ircnet, *channel; void *free_arg; diff --git a/src/fe-common/irc/fe-common-irc.c b/src/fe-common/irc/fe-common-irc.c index f1f1a515..651266f5 100644 --- a/src/fe-common/irc/fe-common-irc.c +++ b/src/fe-common/irc/fe-common-irc.c @@ -26,7 +26,7 @@ #include "lib-config/iconfig.h" #include "settings.h" -#include "server-setup.h" +#include "servers-setup.h" #include "themes.h" #include "completion.h" @@ -181,12 +181,12 @@ void fe_common_irc_finish_init(void) /* connect to autoconnect servers */ ircnets = NULL; for (tmp = setupservers; tmp != NULL; tmp = tmp->next) { - SETUP_SERVER_REC *rec = tmp->data; + SERVER_SETUP_REC *rec = tmp->data; - if (rec->autoconnect && (rec->ircnet == NULL || *rec->ircnet == '\0' || - gslist_find_icase_string(ircnets, rec->ircnet) == NULL)) { - if (rec->ircnet != NULL && *rec->ircnet != '\0') - ircnets = g_slist_append(ircnets, rec->ircnet); + if (rec->autoconnect && (rec->chatnet == NULL || *rec->chatnet == '\0' || + gslist_find_icase_string(ircnets, rec->chatnet) == NULL)) { + if (rec->chatnet != NULL && *rec->chatnet != '\0') + ircnets = g_slist_append(ircnets, rec->chatnet); str = g_strdup_printf("%s %d", rec->address, rec->port); signal_emit("command connect", 1, str); diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c index ffb5ae62..e2b3e4ed 100644 --- a/src/fe-common/irc/fe-ctcp.c +++ b/src/fe-common/irc/fe-ctcp.c @@ -25,9 +25,9 @@ #include "irc.h" #include "levels.h" -#include "server.h" +#include "servers.h" #include "channels.h" -#include "query.h" +#include "queries.h" #include "ignore.h" #include "windows.h" diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index ed634ac5..ca739c35 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -26,8 +26,8 @@ #include "irc.h" #include "levels.h" -#include "server.h" -#include "channels.h" +#include "servers.h" +#include "irc-channels.h" #include "nicklist.h" static char *last_away_nick = NULL; @@ -64,7 +64,7 @@ static void event_names_list(const char *data, IRC_SERVER_REC *server) g_return_if_fail(data != NULL); params = event_get_params(data, 4, NULL, NULL, &channel, &names); - if (channel_find(server, channel) == NULL) + if (irc_channel_find(server, channel) == NULL) printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_NAMES, channel, names); g_free(params); } @@ -160,17 +160,17 @@ static void display_nicks(CHANNEL_REC *channel) static void event_end_of_names(const char *data, IRC_SERVER_REC *server) { char *params, *channel; - CHANNEL_REC *chanrec; + IRC_CHANNEL_REC *chanrec; g_return_if_fail(data != NULL); params = event_get_params(data, 2, NULL, &channel); - chanrec = channel_find(server, channel); + chanrec = irc_channel_find(server, channel); if (chanrec == NULL) printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_ENDOFNAMES, channel, 0, 0, 0, 0); else - display_nicks(chanrec); + display_nicks(CHANNEL(chanrec)); g_free(params); } diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index ff37ff69..061a37ac 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -26,15 +26,15 @@ #include "irc.h" #include "levels.h" -#include "server.h" -#include "server-redirect.h" -#include "server-reconnect.h" -#include "channels.h" -#include "query.h" -#include "nicklist.h" +#include "servers.h" +#include "servers-redirect.h" +#include "servers-reconnect.h" +#include "queries.h" #include "ignore.h" -#include "fe-query.h" +#include "fe-queries.h" +#include "irc-channels.h" +#include "irc-nicklist.h" #include "irc-hilight-text.h" #include "windows.h" @@ -47,17 +47,18 @@ static void print_channel_msg(IRC_SERVER_REC *server, const char *msg, const char *nick, const char *addr, const char *target) { - CHANNEL_REC *chanrec; + IRC_CHANNEL_REC *chanrec; NICK_REC *nickrec; const char *nickmode; int for_me, print_channel; char *color; - chanrec = channel_find(server, target); + chanrec = irc_channel_find(server, target); for_me = irc_nick_match(server->nick, msg); color = for_me ? NULL : irc_hilight_find_nick(target, nick, addr, MSGLEVEL_PUBLIC, msg); - nickrec = chanrec == NULL ? NULL : nicklist_find(chanrec, nick); + nickrec = chanrec == NULL ? NULL : + nicklist_find(CHANNEL(chanrec), nick); nickmode = (!settings_get_bool("show_nickmode") || nickrec == NULL) ? "" : (nickrec->op ? "@" : nickrec->voice ? "+" : " "); @@ -139,7 +140,7 @@ static void ctcp_msg_check_action(const char *data, IRC_SERVER_REC *server, if (ischannel(*target)) { /* channel action */ - item = (WI_ITEM_REC *) channel_find(server, target); + item = (WI_ITEM_REC *) irc_channel_find(server, target); if (window_item_is_active(item)) { /* message to active channel in window */ @@ -245,9 +246,10 @@ static void event_quit(const char *data, IRC_SERVER_REC *server, const char *nic count = 0; windows = NULL; chans = !once ? NULL : g_string_new(NULL); for (tmp = channels; tmp != NULL; tmp = tmp->next) { - CHANNEL_REC *rec = tmp->data; + IRC_CHANNEL_REC *rec = tmp->data; - if (rec->server != server || !nicklist_find(rec, nick) || + if (!IS_IRC_CHANNEL(rec) || rec->server != server || + !nicklist_find(CHANNEL(rec), nick) || ignore_check(server, nick, addr, rec->name, data, MSGLEVEL_QUITS)) continue; @@ -338,10 +340,10 @@ static void event_nick(gchar *data, IRC_SERVER_REC *server, gchar *sender, gchar WINDOW_REC *window = window_item_window((WI_ITEM_REC *) query); - if (g_strcasecmp(query->nick, sender) == 0 && + if (g_strcasecmp(query->name, sender) == 0 && g_slist_find(windows, window) == NULL) { windows = g_slist_append(windows, window); - print_nick_change(server, query->nick, newnick, sender, addr, ownnick); + print_nick_change(server, query->name, newnick, sender, addr, ownnick); msgprint = TRUE; } } @@ -561,7 +563,7 @@ static void sig_server_reconnect_removed(RECONNECT_REC *reconnect) printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_RECONNECT_REMOVED, reconnect->conn->address, reconnect->conn->port, - reconnect->conn->ircnet == NULL ? "" : reconnect->conn->ircnet); + reconnect->conn->chatnet == NULL ? "" : reconnect->conn->chatnet); } static void sig_server_reconnect_not_found(const char *tag) diff --git a/src/fe-common/irc/fe-ignore.c b/src/fe-common/irc/fe-ignore.c index 2de35d94..5869b3bc 100644 --- a/src/fe-common/irc/fe-ignore.c +++ b/src/fe-common/irc/fe-ignore.c @@ -26,7 +26,7 @@ #include "misc.h" #include "irc.h" -#include "irc-server.h" +#include "irc-servers.h" #include "ignore.h" static void fe_unignore(IGNORE_REC *rec); diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index 5a3ae50c..2bd0c761 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -28,13 +28,13 @@ #include "levels.h" #include "irc.h" #include "irc-commands.h" -#include "server.h" +#include "servers.h" #include "mode-lists.h" #include "nicklist.h" -#include "channels.h" -#include "query.h" +#include "irc-channels.h" +#include "irc-queries.h" -#include "fe-query.h" +#include "fe-queries.h" #include "windows.h" #include "window-items.h" @@ -42,7 +42,7 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { GHashTable *optlist; WINDOW_REC *window; - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; NICK_REC *nickrec; const char *nickmode; char *target, *msg, *freestr, *newtarget; @@ -67,9 +67,9 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) free_ret = FALSE; if (strcmp(target, ",") == 0 || strcmp(target, ".") == 0) - newtarget = parse_special(&target, server, item, NULL, &free_ret, NULL); + newtarget = parse_special(&target, SERVER(server), item, NULL, &free_ret, NULL); else if (strcmp(target, "*") == 0 && - (irc_item_channel(item) || irc_item_query(item))) + (IS_IRC_CHANNEL(item) || IS_IRC_QUERY(item))) newtarget = item->name; else newtarget = target; @@ -83,7 +83,7 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) target = newtarget; if (server == NULL || !server->connected) cmd_param_error(CMDERR_NOT_CONNECTED); - channel = channel_find(server, target); + channel = irc_channel_find(server, target); freestr = !free_ret ? NULL : target; if (*target == '@' && ischannel(target[1])) @@ -92,7 +92,8 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) if (ischannel(*target)) { /* msg to channel */ - nickrec = channel == NULL ? NULL : nicklist_find(channel, server->nick); + nickrec = channel == NULL ? NULL : + nicklist_find(CHANNEL(channel), server->nick); nickmode = !settings_get_bool("show_nickmode") || nickrec == NULL ? "" : nickrec->op ? "@" : nickrec->voice ? "+" : " "; @@ -128,11 +129,11 @@ static void cmd_msg(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) } /* SYNTAX: ME <message> */ -static void cmd_me(gchar *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_me(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { g_return_if_fail(data != NULL); - if (!irc_item_check(item)) + if (!IS_IRC_ITEM(item)) return; if (server == NULL || !server->connected) @@ -237,21 +238,21 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server) cmd_params_free(free_arg); } -static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { - CHANNEL_REC *chanrec; + IRC_CHANNEL_REC *chanrec; char *channame, *msg; void *free_arg; g_return_if_fail(data != NULL); - if (server == NULL || !server->connected || !irc_server_check(server)) + if (server == NULL || !server->connected || !IS_IRC_SERVER(server)) cmd_return_error(CMDERR_NOT_CONNECTED); if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST, item, &channame, &msg)) return; if (*msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - chanrec = channel_find(server, channame); + chanrec = irc_channel_find(server, channame); if (chanrec == NULL) cmd_param_error(CMDERR_CHAN_NOT_FOUND); printformat(server, chanrec->name, MSGLEVEL_NOTICES, IRCTXT_OWN_WALL, chanrec->name, msg); @@ -260,7 +261,7 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) } static void bans_ask_channel(const char *channel, IRC_SERVER_REC *server, - WI_IRC_REC *item) + WI_ITEM_REC *item) { GString *str; @@ -274,7 +275,7 @@ static void bans_ask_channel(const char *channel, IRC_SERVER_REC *server, g_string_free(str, TRUE); } -static void bans_show_channel(CHANNEL_REC *channel, IRC_SERVER_REC *server) +static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server) { GSList *tmp; @@ -309,9 +310,9 @@ static void bans_show_channel(CHANNEL_REC *channel, IRC_SERVER_REC *server) /* SYNTAX: BAN [<channel>] [<nicks>] */ static void cmd_ban(const char *data, IRC_SERVER_REC *server, - WI_IRC_REC *item) + WI_ITEM_REC *item) { - CHANNEL_REC *chanrec; + IRC_CHANNEL_REC *chanrec; char *channel, *nicks; void *free_arg; @@ -331,12 +332,12 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, } /* display bans */ - chanrec = irc_item_channel(item); + chanrec = IRC_CHANNEL(item); if (chanrec == NULL && *channel == '\0') cmd_param_error(CMDERR_NOT_JOINED); if (*channel != '\0' && strcmp(channel, "*") != 0) - chanrec = channel_find(server, channel); + chanrec = irc_channel_find(server, channel); if (chanrec == NULL) { /* not joined to such channel, @@ -351,21 +352,21 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, } /* SYNTAX: INVITELIST [<channel>] */ -static void cmd_invitelist(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_invitelist(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { - CHANNEL_REC *channel, *cur_channel; + IRC_CHANNEL_REC *channel, *cur_channel; GSList *tmp; g_return_if_fail(data != NULL); if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED); - cur_channel = irc_item_channel(item); + cur_channel = IRC_CHANNEL(item); if (cur_channel == NULL) cmd_return_error(CMDERR_NOT_JOINED); if (strcmp(data, "*") == 0 || *data == '\0') channel = cur_channel; else - channel = channel_find(server, data); + channel = irc_channel_find(server, data); if (channel == NULL) cmd_return_error(CMDERR_CHAN_NOT_FOUND); for (tmp = channel->invitelist; tmp != NULL; tmp = tmp->next) @@ -395,15 +396,15 @@ static void cmd_nick(const char *data, IRC_SERVER_REC *server) } /* SYNTAX: VER [<target>] */ -static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { char *str; g_return_if_fail(data != NULL); - if (!irc_server_check(server)) + if (!IS_IRC_SERVER(server) || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED); - if (*data == '\0' && !irc_item_check(item)) + if (*data == '\0' && !IS_IRC_ITEM(item)) cmd_return_error(CMDERR_NOT_JOINED); str = g_strdup_printf("%s VERSION", *data == '\0' ? item->name : data); diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 3094c5bd..18093737 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -24,10 +24,12 @@ #include "commands.h" #include "misc.h" +#include "servers-setup.h" + #include "levels.h" -#include "irc-server.h" -#include "server-reconnect.h" -#include "server-setup.h" +#include "irc-servers.h" +#include "servers-reconnect.h" +#include "irc-servers-setup.h" #include "windows.h" @@ -40,7 +42,7 @@ static void print_servers(void) printformat(NULL, NULL, MSGLEVEL_CRAP, IRCTXT_SERVER_LIST, rec->tag, rec->connrec->address, rec->connrec->port, - rec->connrec->ircnet == NULL ? "" : rec->connrec->ircnet, rec->connrec->nick); + rec->connrec->chatnet == NULL ? "" : rec->connrec->chatnet, rec->connrec->nick); } } @@ -52,7 +54,7 @@ static void print_lookup_servers(void) printformat(NULL, NULL, MSGLEVEL_CRAP, IRCTXT_SERVER_LOOKUP_LIST, rec->tag, rec->connrec->address, rec->connrec->port, - rec->connrec->ircnet == NULL ? "" : rec->connrec->ircnet, rec->connrec->nick); + rec->connrec->chatnet == NULL ? "" : rec->connrec->chatnet, rec->connrec->nick); } } @@ -64,14 +66,14 @@ static void print_reconnects(void) for (tmp = reconnects; tmp != NULL; tmp = tmp->next) { RECONNECT_REC *rec = tmp->data; - IRC_SERVER_CONNECT_REC *conn = rec->conn; + SERVER_CONNECT_REC *conn = rec->conn; tag = g_strdup_printf("RECON-%d", rec->tag); left = rec->next_connect-time(NULL); next_connect = g_strdup_printf("%02d:%02d", left/60, left%60); printformat(NULL, NULL, MSGLEVEL_CRAP, IRCTXT_SERVER_RECONNECT_LIST, tag, conn->address, conn->port, - conn->ircnet == NULL ? "" : conn->ircnet, + conn->chatnet == NULL ? "" : conn->chatnet, conn->nick, next_connect); g_free(next_connect); g_free(tag); @@ -84,7 +86,7 @@ static void print_reconnects(void) static void cmd_server_add(const char *data) { GHashTable *optlist; - SETUP_SERVER_REC *rec; + IRC_SERVER_SETUP_REC *rec; char *addr, *portstr, *password, *value; void *free_arg; int port; @@ -96,16 +98,16 @@ static void cmd_server_add(const char *data) if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); port = *portstr == '\0' ? 6667 : atoi(portstr); - rec = server_setup_find_port(addr, port); + rec = IRC_SERVER_SETUP(server_setup_find_port(addr, port)); if (rec == NULL) { - rec = g_new0(SETUP_SERVER_REC, 1); + rec = g_new0(IRC_SERVER_SETUP_REC, 1); rec->address = g_strdup(addr); rec->port = port; } else { value = g_hash_table_lookup(optlist, "port"); if (value != NULL && *value != '\0') rec->port = atoi(value); - if (g_hash_table_lookup(optlist, "ircnet")) g_free_and_null(rec->ircnet); + if (g_hash_table_lookup(optlist, "ircnet")) g_free_and_null(rec->chatnet); if (*password != '\0') g_free_and_null(rec->password); if (g_hash_table_lookup(optlist, "host")) { g_free_and_null(rec->own_host); @@ -118,7 +120,7 @@ static void cmd_server_add(const char *data) if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password); value = g_hash_table_lookup(optlist, "ircnet"); - if (value != NULL && *value != '\0') rec->ircnet = g_strdup(value); + if (value != NULL && *value != '\0') rec->chatnet = g_strdup(value); value = g_hash_table_lookup(optlist, "host"); if (value != NULL && *value != '\0') { rec->own_host = g_strdup(value); @@ -129,7 +131,7 @@ static void cmd_server_add(const char *data) value = g_hash_table_lookup(optlist, "cmdmax"); if (value != NULL && *value != '\0') rec->max_cmds_at_once = atoi(value); - server_setup_add(rec); + server_setup_add(SERVER_SETUP(rec)); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_SETUPSERVER_ADDED, addr, port); cmd_params_free(free_arg); @@ -138,7 +140,7 @@ static void cmd_server_add(const char *data) /* SYNTAX: SERVER REMOVE <address> [<port>] */ static void cmd_server_remove(const char *data) { - SETUP_SERVER_REC *rec; + SERVER_SETUP_REC *rec; char *addr, *portstr; void *free_arg; int port; @@ -168,7 +170,7 @@ static void cmd_server_list(const char *data) str = g_string_new(NULL); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_SETUPSERVER_HEADER); for (tmp = setupservers; tmp != NULL; tmp = tmp->next) { - SETUP_SERVER_REC *rec = tmp->data; + IRC_SERVER_SETUP_REC *rec = tmp->data; g_string_truncate(str, 0); if (rec->password != NULL) @@ -185,7 +187,7 @@ static void cmd_server_list(const char *data) if (str->len > 1) g_string_truncate(str, str->len-2); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_SETUPSERVER_LINE, rec->address, rec->port, - rec->ircnet == NULL ? "" : rec->ircnet, + rec->chatnet == NULL ? "" : rec->chatnet, str->str); } printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_SETUPSERVER_FOOTER); diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c index 34f1642a..f770fff6 100644 --- a/src/fe-common/irc/fe-ircnet.c +++ b/src/fe-common/irc/fe-ircnet.c @@ -24,9 +24,10 @@ #include "commands.h" #include "levels.h" #include "misc.h" +#include "chatnets.h" -#include "irc-server.h" -#include "ircnet-setup.h" +#include "irc-servers.h" +#include "irc-chatnets.h" static void cmd_ircnet_list(void) { @@ -35,8 +36,8 @@ static void cmd_ircnet_list(void) str = g_string_new(NULL); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_IRCNET_HEADER); - for (tmp = ircnets; tmp != NULL; tmp = tmp->next) { - IRCNET_REC *rec = tmp->data; + for (tmp = chatnets; tmp != NULL; tmp = tmp->next) { + IRC_CHATNET_REC *rec = tmp->data; g_string_truncate(str, 0); if (rec->nick != NULL) @@ -81,7 +82,7 @@ static void cmd_ircnet_add(const char *data) GHashTable *optlist; char *name, *value; void *free_arg; - IRCNET_REC *rec; + IRC_CHATNET_REC *rec; if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, "ircnet add", &optlist, &name)) @@ -90,7 +91,7 @@ static void cmd_ircnet_add(const char *data) rec = ircnet_find(name); if (rec == NULL) { - rec = g_new0(IRCNET_REC, 1); + rec = g_new0(IRC_CHATNET_REC, 1); rec->name = g_strdup(name); } else { if (g_hash_table_lookup(optlist, "nick")) g_free_and_null(rec->nick); @@ -142,7 +143,7 @@ static void cmd_ircnet_add(const char *data) /* SYNTAX: IRCNET REMOVE <ircnet> */ static void cmd_ircnet_remove(const char *data) { - IRCNET_REC *rec; + IRC_CHATNET_REC *rec; if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS); @@ -151,7 +152,7 @@ static void cmd_ircnet_remove(const char *data) printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_IRCNET_NOT_FOUND, data); else { printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_IRCNET_REMOVED, data); - ircnet_destroy(rec); + chatnet_destroy(CHATNET(rec)); } } diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c index e6c50c1e..ffbd817b 100644 --- a/src/fe-common/irc/fe-netjoin.c +++ b/src/fe-common/irc/fe-netjoin.c @@ -26,7 +26,7 @@ #include "settings.h" #include "irc.h" -#include "irc-server.h" +#include "irc-servers.h" #include "modes.h" #include "ignore.h" #include "netsplit.h" diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index 2d834871..7bb31612 100644 --- a/src/fe-common/irc/fe-netsplit.c +++ b/src/fe-common/irc/fe-netsplit.c @@ -26,7 +26,7 @@ #include "settings.h" #include "irc.h" -#include "irc-server.h" +#include "irc-servers.h" #include "ignore.h" #include "netsplit.h" diff --git a/src/fe-common/irc/fe-query.c b/src/fe-common/irc/fe-queries.c index f48505be..20bea852 100644 --- a/src/fe-common/irc/fe-query.c +++ b/src/fe-common/irc/fe-queries.c @@ -1,5 +1,5 @@ /* - fe-query.c : irssi + fe-queries.c : irssi Copyright (C) 1999-2000 Timo Sirainen @@ -28,7 +28,7 @@ #include "irc.h" #include "irc-commands.h" #include "levels.h" -#include "query.h" +#include "irc-queries.h" #include "windows.h" #include "window-items.h" @@ -40,22 +40,22 @@ QUERY_REC *privmsg_get_query(IRC_SERVER_REC *server, const char *nick, int own) { QUERY_REC *query; - query = query_find(server, nick); + query = irc_query_find(server, nick); if (query == NULL && settings_get_bool("autocreate_query") && (!own || settings_get_bool("autocreate_own_query"))) - query = query_create(server, nick, TRUE); + query = irc_query_create(server, nick, TRUE); return query; } static void signal_query_created(QUERY_REC *query, gpointer automatic) { - if (window_item_find(query->server, query->nick) != NULL) + if (window_item_find(query->server, query->name) != NULL) return; window_item_create((WI_ITEM_REC *) query, GPOINTER_TO_INT(automatic)); - printformat(query->server, query->nick, MSGLEVEL_CLIENTNOTICE, - IRCTXT_QUERY_STARTED, query->nick); + printformat(query->server, query->name, MSGLEVEL_CLIENTNOTICE, + IRCTXT_QUERY_STARTED, query->name); } static void signal_query_created_curwin(QUERY_REC *query) @@ -87,7 +87,7 @@ static void signal_window_item_removed(WINDOW_REC *window, WI_ITEM_REC *item) g_return_if_fail(window != NULL); - query = irc_item_query(item); + query = IRC_QUERY(item); if (query != NULL) query_destroy(query); } @@ -95,7 +95,7 @@ static void sig_server_connected(IRC_SERVER_REC *server) { GSList *tmp; - if (!irc_server_check(server)) + if (!IS_IRC_SERVER(server)) return; /* check if there's any queries without server */ @@ -117,21 +117,20 @@ static void cmd_window_server(const char *data) g_return_if_fail(data != NULL); server = server_find_tag(data); - if (irc_server_check(server) && irc_item_query(active_win->active)) { + if (IS_IRC_SERVER(server) && IS_IRC_QUERY(active_win->active)) { /* /WINDOW SERVER used in a query window */ - query_change_server((QUERY_REC *) active_win->active, - (IRC_SERVER_REC *) server); + query_change_server((QUERY_REC *) active_win->active, server); window_change_server(active_win, server); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_QUERY_SERVER_CHANGED, server->tag, server->connrec->address, - server->connrec->ircnet == NULL ? "" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "" : server->connrec->chatnet); signal_stop(); } } /* SYNTAX: UNQUERY [<nick>] */ -static void cmd_unquery(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_unquery(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { QUERY_REC *query; @@ -139,10 +138,10 @@ static void cmd_unquery(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *it if (*data == '\0') { /* remove current query */ - query = irc_item_query(item); + query = IRC_QUERY(item); if (query == NULL) return; } else { - query = query_find(server, data); + query = irc_query_find(server, data); if (query == NULL) { printformat(server, NULL, MSGLEVEL_CLIENTERROR, IRCTXT_NO_QUERY, data); return; @@ -153,7 +152,7 @@ static void cmd_unquery(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *it } /* SYNTAX: QUERY [-window] <nick> */ -static void cmd_query(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void cmd_query(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { GHashTable *optlist; WINDOW_REC *window; @@ -188,9 +187,9 @@ static void cmd_query(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item (SIGNAL_FUNC) signal_query_created_curwin); } - query = query_find(server, nick); + query = irc_query_find(server, nick); if (query == NULL) - query_create(server, nick, FALSE); + irc_query_create(server, nick, FALSE); else { /* query already existed - change to query window */ window = window_item_window((WI_ITEM_REC *) query); @@ -215,7 +214,7 @@ static int window_has_query(WINDOW_REC *window) g_return_val_if_fail(window != NULL, FALSE); for (tmp = window->items; tmp != NULL; tmp = tmp->next) { - if (irc_item_query(tmp->data)) + if (IS_IRC_QUERY(tmp->data)) return TRUE; } @@ -251,7 +250,7 @@ static void sig_window_restore_item(WINDOW_REC *window, const char *item) server = (IRC_SERVER_REC *) server_find_tag(tag); - rec = query_create(server, nick+1, TRUE); + rec = irc_query_create(server, nick+1, TRUE); if (server == NULL) rec->server_tag = g_strdup(tag); diff --git a/src/fe-common/irc/fe-query.h b/src/fe-common/irc/fe-queries.h index a9cbaaaf..494e277a 100644 --- a/src/fe-common/irc/fe-query.h +++ b/src/fe-common/irc/fe-queries.h @@ -1,5 +1,5 @@ -#ifndef __FE_QUERY_H -#define __FE_QUERY_H +#ifndef __FE_QUERIES_H +#define __FE_QUERIES_H /* Return query where to put the private message. */ QUERY_REC *privmsg_get_query(IRC_SERVER_REC *server, const char *nick, int own); diff --git a/src/fe-common/irc/flood/fe-flood.c b/src/fe-common/irc/flood/fe-flood.c index eca1a3b3..ce96699f 100644 --- a/src/fe-common/irc/flood/fe-flood.c +++ b/src/fe-common/irc/flood/fe-flood.c @@ -23,7 +23,7 @@ #include "signals.h" #include "levels.h" -#include "irc-server.h" +#include "irc-servers.h" #include "irc/flood/autoignore.h" #include "themes.h" diff --git a/src/fe-common/irc/irc-completion.c b/src/fe-common/irc/irc-completion.c index 91e7fecf..1f2bde8e 100644 --- a/src/fe-common/irc/irc-completion.c +++ b/src/fe-common/irc/irc-completion.c @@ -27,10 +27,11 @@ #include "irc.h" #include "irc-commands.h" -#include "server.h" -#include "channels.h" +#include "servers.h" +#include "irc-channels.h" +#include "irc-queries.h" #include "channels-setup.h" -#include "nicklist.h" +#include "irc-nicklist.h" #include "completion.h" #include "window-items.h" @@ -65,7 +66,7 @@ GList *completion_get_channels(IRC_SERVER_REC *server, const char *word) /* get channels from setup */ for (tmp = setupchannels; tmp != NULL; tmp = tmp->next) { - SETUP_CHANNEL_REC *rec = tmp->data; + CHANNEL_SETUP_REC *rec = tmp->data; if (g_strncasecmp(rec->name, word, len) == 0) list = g_list_append(list, g_strdup(rec->name)); @@ -146,7 +147,7 @@ static int nick_completion_timeout(void) for (tmp = servers; tmp != NULL; tmp = tmp->next) { IRC_SERVER_REC *rec = tmp->data; - if (!irc_server_check(rec)) + if (!IS_IRC_SERVER(rec)) continue; mserver = MODULE_DATA(rec); @@ -226,9 +227,9 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char * if (ischannel(*target)) { /* channel message */ MODULE_CHANNEL_REC *mchannel; - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; - channel = channel_find(server, target); + channel = irc_channel_find(server, target); if (channel == NULL) { g_free(params); return; @@ -405,7 +406,7 @@ static void complete_from_nicklist(GList **outlist, GSList *list, } } -static GList *completion_channel_nicks(CHANNEL_REC *channel, const char *nick, const char *prefix) +static GList *completion_channel_nicks(IRC_CHANNEL_REC *channel, const char *nick, const char *prefix) { MODULE_CHANNEL_REC *mchannel; GSList *nicks, *tmp; @@ -424,7 +425,7 @@ static GList *completion_channel_nicks(CHANNEL_REC *channel, const char *nick, c /* and add the rest of the nicks too */ len = strlen(nick); - nicks = nicklist_getnicks(channel); + nicks = nicklist_getnicks(CHANNEL(channel)); for (tmp = nicks; tmp != NULL; tmp = tmp->next) { NICK_REC *rec = tmp->data; @@ -464,7 +465,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window, const char *word, const char *linestart) { IRC_SERVER_REC *server; - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; GList *tmplist; const char *cmdchars, *nickprefix; char *prefix; @@ -480,7 +481,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window, return; } - server = window->active_server; + server = IRC_SERVER(window->active_server); if (server == NULL || !server->connected) return; @@ -498,7 +499,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window, /* nick completion .. we could also be completing a nick after /MSG from nicks in channel */ - channel = irc_item_channel(window->active); + channel = IRC_CHANNEL(window->active); if (channel == NULL) return; @@ -539,7 +540,7 @@ static void sig_complete_msg(GList **list, WINDOW_REC *window, g_return_if_fail(word != NULL); g_return_if_fail(line != NULL); - server = window->active_server; + server = IRC_SERVER(window->active_server); if (server == NULL || !server->connected) return; @@ -549,7 +550,7 @@ static void sig_complete_msg(GList **list, WINDOW_REC *window, } /* expand \n, \t and \\ - FIXME: this doesn't work right */ -static char *expand_escapes(const char *line, IRC_SERVER_REC *server, WI_IRC_REC *item) +static char *expand_escapes(const char *line, IRC_SERVER_REC *server, WI_ITEM_REC *item) { char *ptr, *ret; @@ -590,15 +591,15 @@ static char *expand_escapes(const char *line, IRC_SERVER_REC *server, WI_IRC_REC return ret; } -static void event_text(gchar *line, IRC_SERVER_REC *server, WI_IRC_REC *item) +static void event_text(gchar *line, IRC_SERVER_REC *server, WI_ITEM_REC *item) { - CHANNEL_REC *channel; + IRC_CHANNEL_REC *channel; GList *comp; gchar *str, *ptr; g_return_if_fail(line != NULL); - if (!irc_item_check(item)) + if (!IS_IRC_ITEM(item)) return; /* FIXME: this really should go to fe-common/core. */ @@ -617,10 +618,10 @@ static void event_text(gchar *line, IRC_SERVER_REC *server, WI_IRC_REC *item) ptr = strchr(line, *settings_get_str("completion_char")); if (ptr != NULL) *ptr++ = '\0'; - channel = irc_item_channel(item); + channel = IRC_CHANNEL(item); comp = ptr == NULL || channel == NULL || - nicklist_find(channel, line) != NULL ? NULL : + nicklist_find(CHANNEL(channel), line) != NULL ? NULL : completion_channel_nicks(channel, line, NULL); } @@ -653,7 +654,7 @@ static void completion_init_server(IRC_SERVER_REC *server) g_return_if_fail(server != NULL); - if (!irc_server_check(server)) + if (!IS_IRC_SERVER(server)) return; rec = g_new0(MODULE_SERVER_REC, 1); @@ -666,7 +667,7 @@ static void completion_deinit_server(IRC_SERVER_REC *server) g_return_if_fail(server != NULL); - if (!irc_server_check(server)) + if (!IS_IRC_SERVER(server)) return; mserver = MODULE_DATA(server); diff --git a/src/fe-common/irc/irc-window-activity.c b/src/fe-common/irc/irc-window-activity.c index 16a24256..4cb2fae8 100644 --- a/src/fe-common/irc/irc-window-activity.c +++ b/src/fe-common/irc/irc-window-activity.c @@ -24,8 +24,8 @@ #include "irc.h" #include "ignore.h" -#include "irc-server.h" -#include "nicklist.h" +#include "irc-servers.h" +#include "irc-nicklist.h" #include "completion.h" #include "windows.h" diff --git a/src/fe-common/irc/notifylist/fe-notifylist.c b/src/fe-common/irc/notifylist/fe-notifylist.c index c13e5c8a..b5a87f5d 100644 --- a/src/fe-common/irc/notifylist/fe-notifylist.c +++ b/src/fe-common/irc/notifylist/fe-notifylist.c @@ -23,12 +23,13 @@ #include "signals.h" #include "commands.h" #include "misc.h" +#include "chatnets.h" #include "lib-config/iconfig.h" #include "settings.h" #include "levels.h" -#include "irc-server.h" -#include "ircnet-setup.h" +#include "irc-servers.h" +#include "irc-chatnets.h" #include "irc/notifylist/notifylist.h" #include "themes.h" @@ -100,10 +101,12 @@ static void cmd_notify_show(void) offline = g_slist_copy(nicks); /* print the notifies on specific ircnets */ - for (tmp = ircnets; tmp != NULL; tmp = tmp->next) { - IRCNET_REC *rec = tmp->data; + for (tmp = chatnets; tmp != NULL; tmp = tmp->next) { + IRC_CHATNET_REC *rec = tmp->data; - server = (IRC_SERVER_REC *) server_find_ircnet(rec->name); + if (!IS_IRCNET(rec)) continue; + + server = (IRC_SERVER_REC *) server_find_chatnet(rec->name); if (server == NULL) continue; print_notify_onserver(server, nicks, &offline, rec->name); @@ -113,7 +116,7 @@ static void cmd_notify_show(void) for (tmp = servers; tmp != NULL; tmp = tmp->next) { server = tmp->data; - if (server->connrec->ircnet != NULL) + if (server->connrec->chatnet != NULL) continue; print_notify_onserver(server, nicks, &offline, server->tag); } @@ -182,7 +185,7 @@ static void notifylist_joined(IRC_SERVER_REC *server, const char *nick, printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_JOIN, nick, username, host, realname, - server->connrec->ircnet == NULL ? "IRC" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "IRC" : server->connrec->chatnet); } static void notifylist_left(IRC_SERVER_REC *server, const char *nick, @@ -193,7 +196,7 @@ static void notifylist_left(IRC_SERVER_REC *server, const char *nick, printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_PART, nick, username, host, realname, - server->connrec->ircnet == NULL ? "IRC" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "IRC" : server->connrec->chatnet); } static void notifylist_away(IRC_SERVER_REC *server, const char *nick, @@ -205,11 +208,11 @@ static void notifylist_away(IRC_SERVER_REC *server, const char *nick, if (awaymsg != NULL) { printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_AWAY, nick, username, host, realname, awaymsg, - server->connrec->ircnet == NULL ? "IRC" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "IRC" : server->connrec->chatnet); } else { printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_UNAWAY, nick, username, host, realname, - server->connrec->ircnet == NULL ? "IRC" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "IRC" : server->connrec->chatnet); } } @@ -221,7 +224,7 @@ static void notifylist_unidle(IRC_SERVER_REC *server, const char *nick, printformat(server, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_UNIDLE, nick, username, host, realname, awaymsg != NULL ? awaymsg : "", - server->connrec->ircnet == NULL ? "IRC" : server->connrec->ircnet); + server->connrec->chatnet == NULL ? "IRC" : server->connrec->chatnet); } void fe_irc_notifylist_init(void) |