summaryrefslogtreecommitdiff
path: root/src/core/servers.h
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-08-30 22:29:55 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-08-30 22:29:55 +0000
commitb4bdec4436190d7ccb6252be388b5ee70c5c36f5 (patch)
tree5b80eb0eab42f347575c05dbff3361f9955cd6ee /src/core/servers.h
parentcf7eb945ea769b51622a1c1cbbbc7e7a6a494df9 (diff)
downloadirssi-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/core/servers.h')
-rw-r--r--src/core/servers.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/servers.h b/src/core/servers.h
index 169c8e88..25f6ef5e 100644
--- a/src/core/servers.h
+++ b/src/core/servers.h
@@ -7,20 +7,19 @@
typedef struct _ipaddr IPADDR;
#endif
-#define IS_SERVER(server) \
- ((server) != NULL && module_find_id("SERVER", (server)->type) != -1)
-
-#define IS_SERVER_CONNECT(conn) \
- ((conn) != NULL && \
- module_find_id("SERVER CONNECT", (conn)->type) != -1)
-
/* Returns SERVER_REC if it's server, NULL if it isn't. */
#define SERVER(server) \
- (IS_SERVER(server) ? (SERVER_REC *) (server) : NULL)
+ MODULE_CHECK_CAST(server, SERVER_REC, type, "SERVER")
/* Returns SERVER_CONNECT_REC if it's server connection, NULL if it isn't. */
#define SERVER_CONNECT(conn) \
- (IS_SERVER_CONNECT(conn) ? (SERVER_CONNECT_REC *) (conn) : NULL)
+ MODULE_CHECK_CAST(conn, SERVER_CONNECT_REC, type, "SERVER CONNECT")
+
+#define IS_SERVER(server) \
+ (SERVER(server) ? TRUE : FALSE)
+
+#define IS_SERVER_CONNECT(conn) \
+ (SERVER_CONNECT(conn) ? TRUE : FALSE)
/* all strings should be either NULL or dynamically allocated */
/* address and nick are mandatory, rest are optional */