diff options
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc-nicklist.c | 30 | ||||
-rw-r--r-- | src/irc/core/irc-nicklist.h | 8 | ||||
-rw-r--r-- | src/irc/core/massjoin.c | 4 |
3 files changed, 33 insertions, 9 deletions
diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index 57c4ccc8..ddfbd686 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -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); diff --git a/src/irc/core/irc-nicklist.h b/src/irc/core/irc-nicklist.h index f6c7be51..7d0ae2f4 100644 --- a/src/irc/core/irc-nicklist.h +++ b/src/irc/core/irc-nicklist.h @@ -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 diff --git a/src/irc/core/massjoin.c b/src/irc/core/massjoin.c index 1c7d55fb..13df8694 100644 --- a/src/irc/core/massjoin.c +++ b/src/irc/core/massjoin.c @@ -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) { |