diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-30 22:29:55 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-30 22:29:55 +0000 |
commit | b4bdec4436190d7ccb6252be388b5ee70c5c36f5 (patch) | |
tree | 5b80eb0eab42f347575c05dbff3361f9955cd6ee /src/irc | |
parent | cf7eb945ea769b51622a1c1cbbbc7e7a6a494df9 (diff) | |
download | irssi-b4bdec4436190d7ccb6252be388b5ee70c5c36f5.zip |
Object type checking fixes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@638 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc-channels.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-channels.h | 10 | ||||
-rw-r--r-- | src/irc/core/irc-chatnets.h | 9 | ||||
-rw-r--r-- | src/irc/core/irc-commands.c | 6 | ||||
-rw-r--r-- | src/irc/core/irc-queries.h | 10 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.h | 10 | ||||
-rw-r--r-- | src/irc/core/irc-servers.h | 20 |
7 files changed, 32 insertions, 35 deletions
diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c index ba44a7d5..de0822bd 100644 --- a/src/irc/core/irc-channels.c +++ b/src/irc/core/irc-channels.c @@ -181,6 +181,7 @@ static void sig_connected(SERVER_REC *server) void irc_channels_init(void) { signal_add("server connected", (SIGNAL_FUNC) sig_connected); + signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed); channel_events_init(); channel_rejoin_init(); @@ -197,6 +198,7 @@ void irc_channels_init(void) void irc_channels_deinit(void) { signal_remove("server connected", (SIGNAL_FUNC) sig_connected); + signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed); channel_events_deinit(); channel_rejoin_deinit(); diff --git a/src/irc/core/irc-channels.h b/src/irc/core/irc-channels.h index 9a331082..b4040bf5 100644 --- a/src/irc/core/irc-channels.h +++ b/src/irc/core/irc-channels.h @@ -4,14 +4,12 @@ #include "channels.h" #include "irc-servers.h" -#define IS_IRC_CHANNEL(channel) \ - ((channel) != NULL && \ - module_find_id("IRC CHANNEL", \ - ((IRC_CHANNEL_REC *) (channel))->chat_type) != -1) - /* Returns IRC_CHANNEL_REC if it's IRC channel, NULL if it isn't. */ #define IRC_CHANNEL(channel) \ - (IS_IRC_CHANNEL(channel) ? (IRC_CHANNEL_REC *) (channel) : NULL) + MODULE_CHECK_CAST(channel, IRC_CHANNEL_REC, chat_type, "IRC CHANNEL") + +#define IS_IRC_CHANNEL(channel) \ + (IRC_CHANNEL(channel) ? TRUE : FALSE) #define STRUCT_SERVER_REC IRC_SERVER_REC typedef struct { diff --git a/src/irc/core/irc-chatnets.h b/src/irc/core/irc-chatnets.h index 25ce05e8..151bca8e 100644 --- a/src/irc/core/irc-chatnets.h +++ b/src/irc/core/irc-chatnets.h @@ -1,13 +1,14 @@ #ifndef __IRC_CHATNETS_H #define __IRC_CHATNETS_H -#define IS_IRC_CHATNET(chatnet) \ - ((chatnet) != NULL && \ - module_find_id("IRC CHATNET", (chatnet)->chat_type) != -1) +#include "modules.h" /* returns IRC_CHATNET_REC if it's IRC network, NULL if it isn't */ #define IRC_CHATNET(chatnet) \ - (IS_IRC_CHATNET(chatnet) ? (IRC_CHATNET_REC *) (chatnet) : NULL) + MODULE_CHECK_CAST(chatnet, IRC_CHATNET_REC, chat_type, "IRC CHATNET") + +#define IS_IRC_CHATNET(chatnet) \ + (IRC_CHATNET(chatnet) ? TRUE : FALSE) #define IS_IRCNET(ircnet) IS_IRC_CHATNET(ircnet) #define IRCNET(ircnet) IRC_CHATNET(ircnet) diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 860e4737..c5d91ef6 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -86,7 +86,7 @@ IRC_SERVER_REC *irccmd_options_get_server(const char *cmd, return (IRC_SERVER_REC *) server; } -static SERVER_REC *connect_server(const char *data) +static SERVER_REC *irc_connect_server(const char *data) { SERVER_CONNECT_REC *conn; SERVER_REC *server; @@ -137,7 +137,7 @@ static SERVER_REC *connect_server(const char *data) static void cmd_connect(const char *data) { if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS); - connect_server(data); + irc_connect_server(data); } @@ -202,7 +202,7 @@ static void cmd_server(const char *data, IRC_SERVER_REC *server) cmd_disconnect("* Changing server", server); } - server = IRC_SERVER(connect_server(data)); + server = IRC_SERVER(irc_connect_server(data)); if (*addr == '+' || server == NULL || (ircnet != NULL && server->connrec->chatnet != NULL && g_strcasecmp(ircnet, server->connrec->chatnet) != 0)) { diff --git a/src/irc/core/irc-queries.h b/src/irc/core/irc-queries.h index 5c2725ac..c217c9be 100644 --- a/src/irc/core/irc-queries.h +++ b/src/irc/core/irc-queries.h @@ -4,14 +4,12 @@ #include "queries.h" #include "irc-servers.h" -#define IS_IRC_QUERY(query) \ - ((query) != NULL && \ - module_find_id("IRC QUERY", \ - ((QUERY_REC *) (query))->chat_type) != -1) - /* Returns IRC_QUERY_REC if it's IRC query, NULL if it isn't. */ #define IRC_QUERY(query) \ - (IS_IRC_QUERY(query) ? (QUERY_REC *) (query) : NULL) + MODULE_CHECK_CAST(query, QUERY_REC, chat_type, "IRC QUERY") + +#define IS_IRC_QUERY(query) \ + (IRC_QUERY(query) ? TRUE : FALSE) void irc_queries_init(void); void irc_queries_deinit(void); diff --git a/src/irc/core/irc-servers-setup.h b/src/irc/core/irc-servers-setup.h index f29f55c0..818611fe 100644 --- a/src/irc/core/irc-servers-setup.h +++ b/src/irc/core/irc-servers-setup.h @@ -1,13 +1,13 @@ #ifndef __IRC_SERVERS_SETUP_H #define __IRC_SERVERS_SETUP_H -#define IS_IRC_SERVER_SETUP(server) \ - ((server) != NULL && \ - module_find_id("IRC SERVER SETUP", (server)->chat_type) != -1) #define IRC_SERVER_SETUP(server) \ - (IS_IRC_SERVER_SETUP(server) ? \ - (IRC_SERVER_SETUP_REC *) (server) : NULL) + MODULE_CHECK_CAST(server, IRC_SERVER_SETUP_REC, \ + chat_type, "IRC SERVER SETUP") + +#define IS_IRC_SERVER_SETUP(server) \ + (IRC_SERVER_SETUP(server) ? TRUE : FALSE) typedef struct { #include "server-setup-rec.h" diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 9199a698..e1fd333d 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -3,21 +3,19 @@ #include "servers.h" -#define IS_IRC_SERVER(server) \ - ((server) != NULL && \ - module_find_id("IRC SERVER", (server)->chat_type) != -1) - -#define IS_IRC_SERVER_CONNECT(conn) \ - ((conn) != NULL && \ - module_find_id("IRC SERVER CONNECT", (conn)->chat_type) != -1) - /* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */ #define IRC_SERVER(server) \ - (IS_IRC_SERVER(server) ? (IRC_SERVER_REC *) (server) : NULL) + MODULE_CHECK_CAST(server, IRC_SERVER_REC, chat_type, "IRC SERVER") #define IRC_SERVER_CONNECT(conn) \ - (IS_IRC_SERVER_CONNECT(conn) ? \ - (IRC_SERVER_CONNECT_REC *) (conn) : NULL) + MODULE_CHECK_CAST(conn, IRC_SERVER_CONNECT_REC, \ + chat_type, "IRC SERVER CONNECT") + +#define IS_IRC_SERVER(server) \ + (IRC_SERVER(server) ? TRUE : FALSE) + +#define IS_IRC_SERVER_CONNECT(conn) \ + (IRC_SERVER_CONNECT(conn) ? TRUE : FALSE) /* all strings should be either NULL or dynamically allocated */ /* address and nick are mandatory, rest are optional */ |