Nicklist updates so that protocol specific xxx_NICK_REC can be used

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1177 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-02 22:10:20 +00:00 committed by cras
commit e387516951
8 changed files with 58 additions and 42 deletions

View file

@ -29,6 +29,26 @@
#include "modes.h"
#include "servers.h"
/* Add new nick to list */
NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
int op, int voice, int send_massjoin)
{
NICK_REC *rec;
g_return_val_if_fail(IS_IRC_CHANNEL(channel), NULL);
g_return_val_if_fail(nick != NULL, NULL);
rec = g_new0(NICK_REC, 1);
rec->nick = g_strdup(nick);
if (op) rec->op = TRUE;
if (voice) rec->voice = TRUE;
rec->send_massjoin = send_massjoin;
nicklist_insert(CHANNEL(channel), rec);
return rec;
}
#define isnickchar(a) \
(isalnum((int) (a)) || (a) == '`' || (a) == '-' || (a) == '_' || \
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
@ -53,16 +73,16 @@ char *irc_nick_strip(const char *nick)
return stripped;
}
static void event_names_list(SERVER_REC *server, const char *data)
static void event_names_list(IRC_SERVER_REC *server, const char *data)
{
CHANNEL_REC *chanrec;
IRC_CHANNEL_REC *chanrec;
char *params, *type, *channel, *names, *ptr;
g_return_if_fail(data != NULL);
params = event_get_params(data, 4, NULL, &type, &channel, &names);
chanrec = channel_find(server, channel);
chanrec = irc_channel_find(server, channel);
if (chanrec == NULL || chanrec->names_got) {
/* unknown channel / names list already read */
g_free(params);
@ -85,8 +105,8 @@ static void event_names_list(SERVER_REC *server, const char *data)
while (*names != '\0' && *names != ' ') names++;
if (*names != '\0') *names++ = '\0';
nicklist_insert(chanrec, ptr+isnickflag(*ptr),
*ptr == '@', *ptr == '+', FALSE);
irc_nicklist_insert(chanrec, ptr+isnickflag(*ptr),
*ptr == '@', *ptr == '+', FALSE);
}
g_free(params);