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
This commit is contained in:
Timo Sirainen 2001-01-01 07:45:54 +00:00 committed by cras
commit 4a33801669
50 changed files with 316 additions and 266 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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"

View file

@ -2,7 +2,6 @@
#define __EXPANDOS_H
#include "signals.h"
#include "servers.h"
/* first argument of signal must match to active .. */
typedef enum {

View file

@ -1,7 +1,6 @@
#ifndef __IGNORE_H
#define __IGNORE_H
#include "servers.h"
#ifdef HAVE_REGEX_H
# include <regex.h>
#endif

View file

@ -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)
{

View file

@ -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);

View file

@ -1,8 +1,6 @@
#ifndef __LOG_H
#define __LOG_H
#include "servers.h"
enum {
LOG_ITEM_TARGET, /* channel, query, .. */
LOG_ITEM_WINDOW_REFNUM

View file

@ -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,

View file

@ -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);

View file

@ -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

View file

@ -22,6 +22,8 @@
#include "signals.h"
#include "misc.h"
#include "servers.h"
#include "channels.h"
#include "nicklist.h"
#include "masks.h"

View file

@ -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,

View file

@ -22,6 +22,7 @@
#include "signals.h"
#include "misc.h"
#include "servers.h"
#include "queries.h"
GSList *queries;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -23,6 +23,7 @@
#include "network.h"
#include "signals.h"
#include "servers.h"
#include "servers-setup.h"
#include "servers-reconnect.h"

View file

@ -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 */

View file

@ -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;

View file

@ -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;

View file

@ -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,

View file

@ -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 */

View file

@ -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

View file

@ -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;