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

@ -58,7 +58,7 @@ static void sig_bot_read(BOT_REC *bot)
for (;;) {
recvlen = bot->handle == NULL ? -1 :
net_receive(bot->handle, tmpbuf, sizeof(tmpbuf));
ret = line_split(tmpbuf, recvlen, &str, (LINEBUF_REC **) &bot->buffer);
ret = line_split(tmpbuf, recvlen, &str, &bot->buffer);
if (ret == 0)
break;

View file

@ -46,7 +46,7 @@ typedef struct {
GIOChannel *handle;
int read_tag;
void *buffer;
LINEBUF_REC *buffer;
int file_handle; /* if bot is sending a file to us */

View file

@ -218,7 +218,7 @@ static void server_rejoin_channels(IRC_SERVER_REC *server)
g_string_truncate(keys, keys->len-1);
if (use_keys) g_string_sprintfa(channels, " %s", keys->str);
server->channels_join(server, channels->str, TRUE);
server->channels_join(SERVER(server), channels->str, TRUE);
}
g_string_free(channels, TRUE);

View file

@ -422,7 +422,6 @@ static void multi_query_remove(IRC_SERVER_REC *server, const char *event, const
static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
{
IRC_CHANNEL_REC *chanrec;
NICK_REC *nick;
char *params, *channel, **chans;
int n, onewho;
@ -441,8 +440,7 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
/* check that the WHO actually did return something
(that it understood #chan1,#chan2,..) */
chanrec = irc_channel_find(server, chans[0]);
nick = nicklist_find(CHANNEL(chanrec), server->nick);
if (nick->host == NULL)
if (chanrec->ownnick->host == NULL)
server->no_multi_who = TRUE;
}

View file

@ -93,14 +93,14 @@ static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
#define get_join_key(key) \
(((key) == NULL || *(key) == '\0') ? "x" : (key))
static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
static void irc_channels_join(SERVER_REC *server, const char *data,
int automatic)
{
CHANNEL_SETUP_REC *schannel;
IRC_CHANNEL_REC *chanrec;
CHANNEL_REC *chanrec;
GString *outchans, *outkeys;
char *channels, *keys, *key;
char **chanlist, **keylist, **tmp, **tmpkey, *channel;
char **chanlist, **keylist, **tmp, **tmpkey, *channel, *channame;
void *free_arg;
int use_keys;
@ -124,7 +124,7 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
channel = ischannel(**tmp) ? g_strdup(*tmp) :
g_strdup_printf("#%s", *tmp);
chanrec = irc_channel_find(server, channel);
chanrec = channel_find(server, channel);
if (chanrec == NULL) {
schannel = channels_setup_find(channel, server->connrec->chatnet);
@ -138,7 +138,10 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
} else key = NULL;
g_string_sprintfa(outkeys, "%s,", get_join_key(key));
chanrec = irc_channel_create(server, channel + (channel[0] == '!' && channel[1] == '!'), automatic);
channame = channel + (channel[0] == '!' &&
channel[1] == '!');
chanrec = channel_create(server->chat_type, server,
channame, automatic);
if (key != NULL) chanrec->key = g_strdup(key);
}
g_free(channel);
@ -150,7 +153,8 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
if (outchans->len > 0) {
g_string_truncate(outchans, outchans->len-1);
g_string_truncate(outkeys, outkeys->len-1);
irc_send_cmdv(server, use_keys ? "JOIN %s %s" : "JOIN %s",
irc_send_cmdv(IRC_SERVER(server),
use_keys ? "JOIN %s %s" : "JOIN %s",
outchans->str, outkeys->str);
}
@ -192,10 +196,8 @@ static void sig_server_looking(SERVER_REC *server)
if (!IS_IRC_SERVER(server))
return;
server->channel_find_func =
(void *(*)(void *, const char *)) irc_channel_find_server;
server->channels_join =
(void (*)(void *, const char *, int)) irc_channels_join;
server->channel_find_func = irc_channel_find_server;
server->channels_join = irc_channels_join;
}
void irc_channels_init(void)

View file

@ -778,7 +778,7 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
NICK_REC *rec = tmp->data;
if (g_strcasecmp(rec->nick, server->nick) != 0)
if (rec != chanrec->ownnick)
irc_send_cmdv(server, "NOTICE %s :%s", rec->nick, msg);
}
g_free(msg);

View file

@ -85,9 +85,6 @@ static void event_names_list(SERVER_REC *server, const char *data)
while (*names != '\0' && *names != ' ') names++;
if (*names != '\0') *names++ = '\0';
if (*ptr == '@' && g_strcasecmp(server->nick, ptr+1) == 0)
chanrec->chanop = TRUE;
nicklist_insert(chanrec, ptr+isnickflag(*ptr),
*ptr == '@', *ptr == '+', FALSE);
}
@ -98,14 +95,16 @@ static void event_names_list(SERVER_REC *server, const char *data)
static void event_end_of_names(SERVER_REC *server, const char *data)
{
char *params, *channel;
IRC_CHANNEL_REC *chanrec;
CHANNEL_REC *chanrec;
g_return_if_fail(server != NULL);
params = event_get_params(data, 2, NULL, &channel);
chanrec = irc_channel_find(server, channel);
chanrec = channel_find(server, channel);
if (chanrec != NULL && !chanrec->names_got) {
chanrec->ownnick = nicklist_find(chanrec, server->nick);
chanrec->chanop = chanrec->ownnick->op;
chanrec->names_got = TRUE;
signal_emit("channel joined", 1, chanrec);
}

View file

@ -73,17 +73,19 @@ static int ischannel_func(char flag)
return ischannel(flag);
}
static void send_message(IRC_SERVER_REC *server, const char *target,
static void send_message(SERVER_REC *server, const char *target,
const char *msg)
{
IRC_SERVER_REC *ircserver;
char *str;
g_return_if_fail(server != NULL);
ircserver = IRC_SERVER(server);
g_return_if_fail(ircserver != NULL);
g_return_if_fail(target != NULL);
g_return_if_fail(msg != NULL);
str = g_strdup_printf("PRIVMSG %s :%s", target, msg);
irc_send_cmd_split(server, str, 2, server->max_msgs_in_cmd);
irc_send_cmd_split(ircserver, str, 2, ircserver->max_msgs_in_cmd);
g_free(str);
}
@ -94,8 +96,7 @@ static void sig_server_looking(IRC_SERVER_REC *server)
server->isnickflag = isnickflag_func;
server->ischannel = ischannel_func;
server->send_message =
(void (*)(void *, const char *, const char *)) send_message;
server->send_message = send_message;
}
static void server_init(IRC_SERVER_REC *server)

View file

@ -291,7 +291,7 @@ static int irc_receive_line(SERVER_REC *server, char **str, int read_socket)
net_receive(net_sendbuffer_handle(server->handle),
tmpbuf, sizeof(tmpbuf));
ret = line_split(tmpbuf, recvlen, str, (LINEBUF_REC **) &server->buffer);
ret = line_split(tmpbuf, recvlen, str, &server->buffer);
if (ret == -1) {
/* connection lost */
server->connection_lost = TRUE;

View file

@ -24,6 +24,7 @@
#include "misc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "netsplit.h"
/* How long to keep netsplits in memory (seconds) */

View file

@ -41,7 +41,7 @@ typedef struct DCC_REC {
long size, transfd, skipped; /* file size / bytes transferred / skipped at start */
GIOChannel *handle; /* socket handle */
void *sendbuf;
NET_SENDBUF_REC *sendbuf;
int tagconn, tagread, tagwrite;
int fhandle; /* file handle */
time_t starttime; /* transfer start time */