summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-01-01 07:45:54 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-01-01 07:45:54 +0000
commit4a33801669f183f6df05276320a063ec19aa34bc (patch)
tree23198b42789cec54a0020456ac34715f4fca3af1 /src/core
parent21f9da6092161f217d88f76986328f9a42ef95e3 (diff)
downloadirssi-4a33801669f183f6df05276320a063ec19aa34bc.zip
Added/moved several "typedef struct _XXX XXX;" to common.h so that
they're known to all files and I don't need those stupid "void *xxx" anymore just to avoid useless #include. Header files themselves don't either include others as often anymore. Added channel->ownnick to point to our NICK_REC in channel's nicks. Gives a minor speedup in few places :) Moved completion specific lastmsgs from channel/server core records to fe-common/core specific records. Also changed the nick completion logic a bit so it should work better now. Removed completion_keep_publics_count setting, but changed the meaning of completion_keep_publics to same as _count was before. Nick completion doesn't have any time specific code anymore. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1034 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/channel-rec.h5
-rw-r--r--src/core/channels-setup.h4
-rw-r--r--src/core/channels.h6
-rw-r--r--src/core/chatnets.c10
-rw-r--r--src/core/chatnets.h8
-rw-r--r--src/core/expandos.c2
-rw-r--r--src/core/expandos.h1
-rw-r--r--src/core/ignore.h1
-rw-r--r--src/core/line-split.c4
-rw-r--r--src/core/line-split.h2
-rw-r--r--src/core/log.h2
-rw-r--r--src/core/masks.h2
-rw-r--r--src/core/net-sendbuffer.h2
-rw-r--r--src/core/network.h4
-rw-r--r--src/core/nicklist.c2
-rw-r--r--src/core/nicklist.h7
-rw-r--r--src/core/queries.c1
-rw-r--r--src/core/queries.h6
-rw-r--r--src/core/rawlog.h4
-rw-r--r--src/core/server-rec.h16
-rw-r--r--src/core/servers-reconnect.c1
-rw-r--r--src/core/servers-redirect.h2
-rw-r--r--src/core/servers-setup.h6
-rw-r--r--src/core/servers.h17
-rw-r--r--src/core/settings.h4
-rw-r--r--src/core/special-vars.h1
-rw-r--r--src/core/window-item-def.h4
-rw-r--r--src/core/window-item-rec.h1
28 files changed, 47 insertions, 78 deletions
diff --git a/src/core/channel-rec.h b/src/core/channel-rec.h
index 2f7c7dec..4e5d17c8 100644
--- a/src/core/channel-rec.h
+++ b/src/core/channel-rec.h
@@ -5,7 +5,9 @@
char *topic;
char *topic_by;
time_t topic_time;
+
GHashTable *nicks; /* list of nicks */
+NICK_REC *ownnick; /* our own nick */
unsigned int no_modes:1; /* channel doesn't support modes */
char *mode;
@@ -21,6 +23,3 @@ unsigned int joined:1; /* Have we even received JOIN event for this channel? */
unsigned int left:1; /* You just left the channel */
unsigned int kicked:1; /* You just got kicked */
unsigned int destroying:1;
-
-GSList *lastmsgs; /* List of nicks who last send message */
-GSList *lastownmsgs; /* List of nicks who last send message to you */
diff --git a/src/core/channels-setup.h b/src/core/channels-setup.h
index acb24242..b07d9a4f 100644
--- a/src/core/channels-setup.h
+++ b/src/core/channels-setup.h
@@ -3,7 +3,7 @@
#include "modules.h"
-typedef struct {
+struct _CHANNEL_SETUP_REC {
char *name;
char *chatnet;
char *password;
@@ -13,7 +13,7 @@ typedef struct {
unsigned int autojoin:1;
GHashTable *module_data;
-} CHANNEL_SETUP_REC;
+};
extern GSList *setupchannels;
diff --git a/src/core/channels.h b/src/core/channels.h
index 1ebf7abb..b571a5d4 100644
--- a/src/core/channels.h
+++ b/src/core/channels.h
@@ -1,7 +1,7 @@
#ifndef __CHANNELS_H
#define __CHANNELS_H
-#include "servers.h"
+#include "modules.h"
/* Returns CHANNEL_REC if it's channel, NULL if it isn't. */
#define CHANNEL(channel) \
@@ -12,9 +12,9 @@
(CHANNEL(channel) ? TRUE : FALSE)
#define STRUCT_SERVER_REC SERVER_REC
-typedef struct {
+struct _CHANNEL_REC {
#include "channel-rec.h"
-} CHANNEL_REC;
+};
extern GSList *channels;
diff --git a/src/core/chatnets.c b/src/core/chatnets.c
index 465eaa66..def9eb68 100644
--- a/src/core/chatnets.c
+++ b/src/core/chatnets.c
@@ -30,10 +30,8 @@
GSList *chatnets; /* list of available chat networks */
-void chatnet_read(CHATNET_REC *chatnet, void *nodep)
+void chatnet_read(CHATNET_REC *chatnet, CONFIG_NODE *node)
{
- CONFIG_NODE *node = nodep;
-
g_return_if_fail(chatnet != NULL);
g_return_if_fail(node != NULL);
g_return_if_fail(node->key != NULL);
@@ -49,11 +47,9 @@ void chatnet_read(CHATNET_REC *chatnet, void *nodep)
chatnets = g_slist_append(chatnets, chatnet);
}
-void *chatnet_save(CHATNET_REC *chatnet, void *parentnode)
+CONFIG_NODE *chatnet_save(CHATNET_REC *chatnet, CONFIG_NODE *node)
{
- CONFIG_NODE *node = parentnode;
-
- g_return_val_if_fail(parentnode != NULL, NULL);
+ g_return_val_if_fail(node != NULL, NULL);
g_return_val_if_fail(chatnet != NULL, NULL);
node = config_node_section(node, chatnet->name, NODE_TYPE_BLOCK);
diff --git a/src/core/chatnets.h b/src/core/chatnets.h
index 7170c478..8a17a451 100644
--- a/src/core/chatnets.h
+++ b/src/core/chatnets.h
@@ -10,15 +10,15 @@
#define IS_CHATNET(chatnet) \
(CHATNET(chatnet) ? TRUE : FALSE)
-typedef struct {
+struct _CHATNET_REC {
#include "chatnet-rec.h"
-} CHATNET_REC;
+};
extern GSList *chatnets; /* list of available chat networks */
/* read/save to configuration file */
-void chatnet_read(CHATNET_REC *chatnet, void *node);
-void *chatnet_save(CHATNET_REC *chatnet, void *parentnode);
+void chatnet_read(CHATNET_REC *chatnet, CONFIG_NODE *node);
+CONFIG_NODE *chatnet_save(CHATNET_REC *chatnet, CONFIG_NODE *parentnode);
/* add the chatnet to chat networks list */
void chatnet_create(CHATNET_REC *chatnet);
diff --git a/src/core/expandos.c b/src/core/expandos.c
index 37f770a3..006dd443 100644
--- a/src/core/expandos.c
+++ b/src/core/expandos.c
@@ -19,6 +19,7 @@
*/
#include "module.h"
+#include "modules.h"
#include "signals.h"
#include "expandos.h"
#include "settings.h"
@@ -26,6 +27,7 @@
#include "misc.h"
#include "irssi-version.h"
+#include "servers.h"
#include "channels.h"
#include "queries.h"
#include "window-item-def.h"
diff --git a/src/core/expandos.h b/src/core/expandos.h
index a937fcd1..3dcb527e 100644
--- a/src/core/expandos.h
+++ b/src/core/expandos.h
@@ -2,7 +2,6 @@
#define __EXPANDOS_H
#include "signals.h"
-#include "servers.h"
/* first argument of signal must match to active .. */
typedef enum {
diff --git a/src/core/ignore.h b/src/core/ignore.h
index db88d9a4..21433a06 100644
--- a/src/core/ignore.h
+++ b/src/core/ignore.h
@@ -1,7 +1,6 @@
#ifndef __IGNORE_H
#define __IGNORE_H
-#include "servers.h"
#ifdef HAVE_REGEX_H
# include <regex.h>
#endif
diff --git a/src/core/line-split.c b/src/core/line-split.c
index 9d4c0ab0..2810a0d5 100644
--- a/src/core/line-split.c
+++ b/src/core/line-split.c
@@ -31,12 +31,12 @@
too high. */
#define MAX_CHARS_IN_LINE 65536
-typedef struct {
+struct _LINEBUF_REC {
int len;
int alloc;
int remove;
char *str;
-} LINEBUF_REC;
+};
static inline int nearest_power(int num)
{
diff --git a/src/core/line-split.h b/src/core/line-split.h
index 56d694c3..7c101ddd 100644
--- a/src/core/line-split.h
+++ b/src/core/line-split.h
@@ -1,8 +1,6 @@
#ifndef __LINE_SPLIT_H
#define __LINE_SPLIT_H
-typedef struct _LINEBUF_REC LINEBUF_REC;
-
/* line-split `data'. Initially `*buffer' should contain NULL. */
int line_split(const char *data, int len, char **output, LINEBUF_REC **buffer);
void line_split_free(LINEBUF_REC *buffer);
diff --git a/src/core/log.h b/src/core/log.h
index 8d151c26..2fd97a1c 100644
--- a/src/core/log.h
+++ b/src/core/log.h
@@ -1,8 +1,6 @@
#ifndef __LOG_H
#define __LOG_H
-#include "servers.h"
-
enum {
LOG_ITEM_TARGET, /* channel, query, .. */
LOG_ITEM_WINDOW_REFNUM
diff --git a/src/core/masks.h b/src/core/masks.h
index 437c8cb4..b6ce20d8 100644
--- a/src/core/masks.h
+++ b/src/core/masks.h
@@ -1,8 +1,6 @@
#ifndef __MASKS_H
#define __MASKS_H
-#include "servers.h"
-
int mask_match(SERVER_REC *server, const char *mask,
const char *nick, const char *user, const char *host);
int mask_match_address(SERVER_REC *server, const char *mask,
diff --git a/src/core/net-sendbuffer.h b/src/core/net-sendbuffer.h
index 54f2e5ba..bb6d8e07 100644
--- a/src/core/net-sendbuffer.h
+++ b/src/core/net-sendbuffer.h
@@ -3,8 +3,6 @@
#define DEFAULT_BUFFER_SIZE 8192
-typedef struct _NET_SENDBUF_REC NET_SENDBUF_REC;
-
/* Create new buffer - if `bufsize' is zero or less, DEFAULT_BUFFER_SIZE
is used */
NET_SENDBUF_REC *net_sendbuffer_create(GIOChannel *handle, int bufsize);
diff --git a/src/core/network.h b/src/core/network.h
index 38484665..159bda3e 100644
--- a/src/core/network.h
+++ b/src/core/network.h
@@ -7,7 +7,7 @@
# include <netinet/in.h>
#endif
-struct _ipaddr {
+struct _IPADDR {
unsigned short family;
union {
#ifdef HAVE_IPV6
@@ -18,8 +18,6 @@ struct _ipaddr {
} addr;
};
-typedef struct _ipaddr IPADDR;
-
/* maxmimum string length of IP address */
#ifdef HAVE_IPV6
# define MAX_IP_LEN INET6_ADDRSTRLEN
diff --git a/src/core/nicklist.c b/src/core/nicklist.c
index 50623dcf..16453330 100644
--- a/src/core/nicklist.c
+++ b/src/core/nicklist.c
@@ -22,6 +22,8 @@
#include "signals.h"
#include "misc.h"
+#include "servers.h"
+#include "channels.h"
#include "nicklist.h"
#include "masks.h"
diff --git a/src/core/nicklist.h b/src/core/nicklist.h
index 5f857e60..6d278a2e 100644
--- a/src/core/nicklist.h
+++ b/src/core/nicklist.h
@@ -1,9 +1,6 @@
#ifndef __NICKLIST_H
#define __NICKLIST_H
-#include "servers.h"
-#include "channels.h"
-
/* Returns NICK_REC if it's nick, NULL if it isn't. */
#define NICK(server) \
MODULE_CHECK_CAST(server, NICK_REC, type, "NICK")
@@ -11,9 +8,9 @@
#define IS_NICK(server) \
(NICK(server) ? TRUE : FALSE)
-typedef struct {
+struct _NICK_REC {
#include "nick-rec.h"
-} NICK_REC;
+};
/* Add new nick to list */
NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
diff --git a/src/core/queries.c b/src/core/queries.c
index ca8d78b4..1912faeb 100644
--- a/src/core/queries.c
+++ b/src/core/queries.c
@@ -22,6 +22,7 @@
#include "signals.h"
#include "misc.h"
+#include "servers.h"
#include "queries.h"
GSList *queries;
diff --git a/src/core/queries.h b/src/core/queries.h
index 95fdfdc2..070099c2 100644
--- a/src/core/queries.h
+++ b/src/core/queries.h
@@ -1,7 +1,7 @@
#ifndef __QUERIES_H
#define __QUERIES_H
-#include "servers.h"
+#include "modules.h"
/* Returns QUERY_REC if it's query, NULL if it isn't. */
#define QUERY(query) \
@@ -12,9 +12,9 @@
(QUERY(query) ? TRUE : FALSE)
#define STRUCT_SERVER_REC SERVER_REC
-typedef struct {
+struct _QUERY_REC {
#include "query-rec.h"
-} QUERY_REC;
+};
extern GSList *queries;
diff --git a/src/core/rawlog.h b/src/core/rawlog.h
index 48e48f34..9e460a83 100644
--- a/src/core/rawlog.h
+++ b/src/core/rawlog.h
@@ -1,13 +1,13 @@
#ifndef __RAWLOG_H
#define __RAWLOG_H
-typedef struct {
+struct _RAWLOG_REC {
int logging;
int handle;
int nlines;
GSList *lines;
-} RAWLOG_REC;
+};
RAWLOG_REC *rawlog_create(void);
void rawlog_destroy(RAWLOG_REC *rawlog);
diff --git a/src/core/server-rec.h b/src/core/server-rec.h
index fe10b724..53b9f7f0 100644
--- a/src/core/server-rec.h
+++ b/src/core/server-rec.h
@@ -13,7 +13,7 @@ char *nick; /* current nick */
unsigned int connected:1; /* connected to server */
unsigned int connection_lost:1; /* Connection lost unintentionally */
-void *handle; /* NET_SENDBUF_REC socket */
+NET_SENDBUF_REC *handle;
int readtag; /* input tag */
/* for net_connect_nonblock() */
@@ -26,8 +26,8 @@ GHashTable *eventtable; /* "event xxx" : GSList* of REDIRECT_RECs */
GHashTable *eventgrouptable; /* event group : GSList* of REDIRECT_RECs */
GHashTable *cmdtable; /* "command xxx" : REDIRECT_CMD_REC* */
-void *rawlog;
-void *buffer; /* receive buffer */
+RAWLOG_REC *rawlog;
+LINEBUF_REC *buffer; /* receive buffer */
GHashTable *module_data;
char *version; /* server version */
@@ -41,8 +41,6 @@ time_t lag_sent; /* 0 or time when last lag query was sent to server */
time_t lag_last_check; /* last time we checked lag */
int lag; /* server lag in milliseconds */
-GSList *lastmsgs; /* List of nicks who last send you msg */
-
GSList *channels;
GSList *queries;
@@ -52,7 +50,7 @@ GSList *queries;
/* join to a number of channels, channels are specified in `data' separated
with commas. there can exist other information after first space like
channel keys etc. */
-void (*channels_join)(void *server, const char *data, int automatic);
+void (*channels_join)(SERVER_REC *server, const char *data, int automatic);
/* returns true if `flag' indicates a nick flag (op/voice/halfop) */
int (*isnickflag)(char flag);
/* returns true if `flag' indicates a channel */
@@ -61,11 +59,11 @@ int (*ischannel)(char flag);
of them aren't supported '\0' can be used. */
const char *(*get_nick_flags)(void);
/* send public or private message to server */
-void (*send_message)(void *server, const char *target, const char *msg);
+void (*send_message)(SERVER_REC *server, const char *target, const char *msg);
/* -- Default implementations are used if NULL -- */
-void *(*channel_find_func)(void *server, const char *name);
-void *(*query_find_func)(void *server, const char *nick);
+CHANNEL_REC *(*channel_find_func)(SERVER_REC *server, const char *name);
+QUERY_REC *(*query_find_func)(SERVER_REC *server, const char *nick);
int (*mask_match_func)(const char *mask, const char *data);
/* returns true if `msg' was meant for `nick' */
int (*nick_match_msg)(const char *nick, const char *msg);
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index 91e4c883..808dd803 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -23,6 +23,7 @@
#include "network.h"
#include "signals.h"
+#include "servers.h"
#include "servers-setup.h"
#include "servers-reconnect.h"
diff --git a/src/core/servers-redirect.h b/src/core/servers-redirect.h
index b47f7b3d..c9e45ce3 100644
--- a/src/core/servers-redirect.h
+++ b/src/core/servers-redirect.h
@@ -1,8 +1,6 @@
#ifndef __SERVERS_REDIRECT_H
#define __SERVERS_REDIRECT_H
-#include "servers.h"
-
typedef struct {
int last; /* number of "last" events at the start of the events list */
GSList *events; /* char* list of events */
diff --git a/src/core/servers-setup.h b/src/core/servers-setup.h
index 4b22c542..55785e80 100644
--- a/src/core/servers-setup.h
+++ b/src/core/servers-setup.h
@@ -1,7 +1,7 @@
#ifndef __SERVERS_SETUP_H
#define __SERVERS_SETUP_H
-#include "servers.h"
+#include "modules.h"
#define SERVER_SETUP(server) \
MODULE_CHECK_CAST(server, SERVER_SETUP_REC, type, "SERVER SETUP")
@@ -10,9 +10,9 @@
(SERVER_SETUP(server) ? TRUE : FALSE)
/* servers */
-typedef struct {
+struct _SERVER_SETUP_REC {
#include "server-setup-rec.h"
-} SERVER_SETUP_REC;
+};
extern GSList *setupservers;
diff --git a/src/core/servers.h b/src/core/servers.h
index e5ea787b..4ed9a34b 100644
--- a/src/core/servers.h
+++ b/src/core/servers.h
@@ -3,10 +3,6 @@
#include "modules.h"
-#ifndef __NETWORK_H
-typedef struct _ipaddr IPADDR;
-#endif
-
/* Returns SERVER_REC if it's server, NULL if it isn't. */
#define SERVER(server) \
MODULE_CHECK_CAST(server, SERVER_REC, type, "SERVER")
@@ -23,19 +19,14 @@ typedef struct _ipaddr IPADDR;
/* all strings should be either NULL or dynamically allocated */
/* address and nick are mandatory, rest are optional */
-typedef struct {
+struct _SERVER_CONNECT_REC {
#include "server-connect-rec.h"
-} SERVER_CONNECT_REC;
+};
#define STRUCT_SERVER_CONNECT_REC SERVER_CONNECT_REC
-typedef struct {
+struct _SERVER_REC {
#include "server-rec.h"
-} SERVER_REC;
-
-typedef struct {
- time_t time;
- char *nick;
-} LAST_MSG_REC;
+};
extern GSList *servers, *lookup_servers;
diff --git a/src/core/settings.h b/src/core/settings.h
index a878fcfb..72cf6193 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -1,10 +1,6 @@
#ifndef __SETTINGS_H
#define __SETTINGS_H
-#ifndef __ICONFIG_H
-typedef struct _config_rec CONFIG_REC;
-#endif
-
enum {
SETTING_TYPE_STRING,
SETTING_TYPE_INT,
diff --git a/src/core/special-vars.h b/src/core/special-vars.h
index deb4de40..e55996b1 100644
--- a/src/core/special-vars.h
+++ b/src/core/special-vars.h
@@ -2,7 +2,6 @@
#define __SPECIAL_VARS_H
#include "signals.h"
-#include "servers.h"
#define PARSE_FLAG_GETNAME 0x01 /* return argument name instead of it's value */
#define PARSE_FLAG_ISSET_ANY 0x02 /* arg_used field specifies that at least one of the $variables was non-empty */
diff --git a/src/core/window-item-def.h b/src/core/window-item-def.h
index 5b54414a..4364c66e 100644
--- a/src/core/window-item-def.h
+++ b/src/core/window-item-def.h
@@ -2,8 +2,8 @@
#define __WINDOW_ITEM_DEF_H
#define STRUCT_SERVER_REC SERVER_REC
-typedef struct {
+struct _WI_ITEM_REC {
#include "window-item-rec.h"
-} WI_ITEM_REC;
+};
#endif
diff --git a/src/core/window-item-rec.h b/src/core/window-item-rec.h
index 801a471e..ea5365a9 100644
--- a/src/core/window-item-rec.h
+++ b/src/core/window-item-rec.h
@@ -4,6 +4,7 @@ int type; /* module_get_uniq_id("CHANNEL/QUERY/xxx", 0) */
int chat_type; /* chat_protocol_lookup(xx) */
GHashTable *module_data;
+void *window;
STRUCT_SERVER_REC *server;
char *name;