diff options
author | Timo Sirainen <cras@irssi.org> | 2001-01-01 07:45:54 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-01-01 07:45:54 +0000 |
commit | 4a33801669f183f6df05276320a063ec19aa34bc (patch) | |
tree | 23198b42789cec54a0020456ac34715f4fca3af1 /src/irc | |
parent | 21f9da6092161f217d88f76986328f9a42ef95e3 (diff) | |
download | irssi-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/irc')
-rw-r--r-- | src/irc/bot/botnet-connection.c | 2 | ||||
-rw-r--r-- | src/irc/bot/botnet.h | 2 | ||||
-rw-r--r-- | src/irc/core/channel-rejoin.c | 2 | ||||
-rw-r--r-- | src/irc/core/channels-query.c | 4 | ||||
-rw-r--r-- | src/irc/core/irc-channels.c | 22 | ||||
-rw-r--r-- | src/irc/core/irc-commands.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-nicklist.c | 9 | ||||
-rw-r--r-- | src/irc/core/irc-servers.c | 11 | ||||
-rw-r--r-- | src/irc/core/irc.c | 2 | ||||
-rw-r--r-- | src/irc/core/netsplit.c | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc.h | 2 |
11 files changed, 30 insertions, 29 deletions
diff --git a/src/irc/bot/botnet-connection.c b/src/irc/bot/botnet-connection.c index bd25d30b..d1a583e1 100644 --- a/src/irc/bot/botnet-connection.c +++ b/src/irc/bot/botnet-connection.c @@ -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; diff --git a/src/irc/bot/botnet.h b/src/irc/bot/botnet.h index 44b09bf7..0372de22 100644 --- a/src/irc/bot/botnet.h +++ b/src/irc/bot/botnet.h @@ -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 */ diff --git a/src/irc/core/channel-rejoin.c b/src/irc/core/channel-rejoin.c index d3d4059b..e18da65e 100644 --- a/src/irc/core/channel-rejoin.c +++ b/src/irc/core/channel-rejoin.c @@ -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); diff --git a/src/irc/core/channels-query.c b/src/irc/core/channels-query.c index 10ab90f9..0152606e 100644 --- a/src/irc/core/channels-query.c +++ b/src/irc/core/channels-query.c @@ -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; } diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c index 4ee9f371..bdef9468 100644 --- a/src/irc/core/irc-channels.c +++ b/src/irc/core/irc-channels.c @@ -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) diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 67a91b5e..945bd1cf 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -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); diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index 036a3e9f..391399bf 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -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); } diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 0bd19e4b..ca548400 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -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) diff --git a/src/irc/core/irc.c b/src/irc/core/irc.c index 24a2c757..c894adc5 100644 --- a/src/irc/core/irc.c +++ b/src/irc/core/irc.c @@ -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; diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c index 3abd1717..a825ba1a 100644 --- a/src/irc/core/netsplit.c +++ b/src/irc/core/netsplit.c @@ -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) */ diff --git a/src/irc/dcc/dcc.h b/src/irc/dcc/dcc.h index 5f67991b..8aef0c82 100644 --- a/src/irc/dcc/dcc.h +++ b/src/irc/dcc/dcc.h @@ -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 */ |