mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 08:32:07 +02:00
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:
parent
7240717198
commit
e387516951
8 changed files with 58 additions and 42 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -3,10 +3,14 @@
|
|||
|
||||
#include "nicklist.h"
|
||||
|
||||
void irc_nicklist_init(void);
|
||||
void irc_nicklist_deinit(void);
|
||||
/* Add new nick to list */
|
||||
NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,
|
||||
int op, int voice, int send_massjoin);
|
||||
|
||||
/* Remove all "extra" characters from `nick'. Like _nick_ -> nick */
|
||||
char *irc_nick_strip(const char *nick);
|
||||
|
||||
void irc_nicklist_init(void);
|
||||
void irc_nicklist_deinit(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "irc.h"
|
||||
#include "irc-servers.h"
|
||||
#include "irc-channels.h"
|
||||
#include "nicklist.h"
|
||||
#include "irc-nicklist.h"
|
||||
|
||||
static int massjoin_tag;
|
||||
static int massjoin_max_joins;
|
||||
|
|
@ -58,7 +58,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||
if (chanrec == NULL) return;
|
||||
|
||||
/* add user to nicklist */
|
||||
nickrec = nicklist_insert(CHANNEL(chanrec), nick, FALSE, FALSE, TRUE);
|
||||
nickrec = irc_nicklist_insert(chanrec, nick, FALSE, FALSE, TRUE);
|
||||
nicklist_set_host(CHANNEL(chanrec), nickrec, address);
|
||||
|
||||
if (chanrec->massjoins == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue