mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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
@ -31,30 +31,15 @@
|
|||||||
(isalnum(a) || (unsigned char) (a) >= 128)
|
(isalnum(a) || (unsigned char) (a) >= 128)
|
||||||
|
|
||||||
/* Add new nick to list */
|
/* Add new nick to list */
|
||||||
NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
|
void nicklist_insert(CHANNEL_REC *channel, NICK_REC *nick)
|
||||||
int op, int voice, int send_massjoin)
|
|
||||||
{
|
{
|
||||||
NICK_REC *rec;
|
MODULE_DATA_INIT(nick);
|
||||||
|
|
||||||
g_return_val_if_fail(IS_CHANNEL(channel), NULL);
|
nick->type = module_get_uniq_id("NICK", 0);
|
||||||
g_return_val_if_fail(nick != NULL, NULL);
|
nick->chat_type = channel->chat_type;
|
||||||
|
|
||||||
rec = g_new0(NICK_REC, 1);
|
g_hash_table_insert(channel->nicks, nick->nick, nick);
|
||||||
|
signal_emit("nicklist new", 2, channel, nick);
|
||||||
MODULE_DATA_INIT(rec);
|
|
||||||
rec->type = module_get_uniq_id("NICK", 0);
|
|
||||||
rec->chat_type = channel->chat_type;
|
|
||||||
|
|
||||||
if (op) rec->op = TRUE;
|
|
||||||
if (voice) rec->voice = TRUE;
|
|
||||||
|
|
||||||
rec->send_massjoin = send_massjoin;
|
|
||||||
rec->nick = g_strdup(nick);
|
|
||||||
rec->host = NULL;
|
|
||||||
|
|
||||||
g_hash_table_insert(channel->nicks, rec->nick, rec);
|
|
||||||
signal_emit("nicklist new", 2, channel, rec);
|
|
||||||
return rec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set host address for nick */
|
/* Set host address for nick */
|
||||||
|
@ -13,8 +13,7 @@ struct _NICK_REC {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Add new nick to list */
|
/* Add new nick to list */
|
||||||
NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
|
void nicklist_insert(CHANNEL_REC *channel, NICK_REC *nick);
|
||||||
int op, int voice, int send_massjoin);
|
|
||||||
/* Set host address for nick */
|
/* Set host address for nick */
|
||||||
void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host);
|
void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host);
|
||||||
/* Remove nick from list */
|
/* Remove nick from list */
|
||||||
|
@ -29,6 +29,26 @@
|
|||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "servers.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) \
|
#define isnickchar(a) \
|
||||||
(isalnum((int) (a)) || (a) == '`' || (a) == '-' || (a) == '_' || \
|
(isalnum((int) (a)) || (a) == '`' || (a) == '-' || (a) == '_' || \
|
||||||
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
|
(a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
|
||||||
@ -53,16 +73,16 @@ char *irc_nick_strip(const char *nick)
|
|||||||
return stripped;
|
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;
|
char *params, *type, *channel, *names, *ptr;
|
||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
params = event_get_params(data, 4, NULL, &type, &channel, &names);
|
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) {
|
if (chanrec == NULL || chanrec->names_got) {
|
||||||
/* unknown channel / names list already read */
|
/* unknown channel / names list already read */
|
||||||
g_free(params);
|
g_free(params);
|
||||||
@ -85,7 +105,7 @@ static void event_names_list(SERVER_REC *server, const char *data)
|
|||||||
while (*names != '\0' && *names != ' ') names++;
|
while (*names != '\0' && *names != ' ') names++;
|
||||||
if (*names != '\0') *names++ = '\0';
|
if (*names != '\0') *names++ = '\0';
|
||||||
|
|
||||||
nicklist_insert(chanrec, ptr+isnickflag(*ptr),
|
irc_nicklist_insert(chanrec, ptr+isnickflag(*ptr),
|
||||||
*ptr == '@', *ptr == '+', FALSE);
|
*ptr == '@', *ptr == '+', FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,14 @@
|
|||||||
|
|
||||||
#include "nicklist.h"
|
#include "nicklist.h"
|
||||||
|
|
||||||
void irc_nicklist_init(void);
|
/* Add new nick to list */
|
||||||
void irc_nicklist_deinit(void);
|
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 */
|
/* Remove all "extra" characters from `nick'. Like _nick_ -> nick */
|
||||||
char *irc_nick_strip(const char *nick);
|
char *irc_nick_strip(const char *nick);
|
||||||
|
|
||||||
|
void irc_nicklist_init(void);
|
||||||
|
void irc_nicklist_deinit(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#include "irc-servers.h"
|
#include "irc-servers.h"
|
||||||
#include "irc-channels.h"
|
#include "irc-channels.h"
|
||||||
#include "nicklist.h"
|
#include "irc-nicklist.h"
|
||||||
|
|
||||||
static int massjoin_tag;
|
static int massjoin_tag;
|
||||||
static int massjoin_max_joins;
|
static int massjoin_max_joins;
|
||||||
@ -58,7 +58,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
|
|||||||
if (chanrec == NULL) return;
|
if (chanrec == NULL) return;
|
||||||
|
|
||||||
/* add user to nicklist */
|
/* 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);
|
nicklist_set_host(CHANNEL(chanrec), nickrec, address);
|
||||||
|
|
||||||
if (chanrec->massjoins == 0) {
|
if (chanrec->massjoins == 0) {
|
||||||
|
@ -83,17 +83,12 @@ void
|
|||||||
channel_destroy(channel)
|
channel_destroy(channel)
|
||||||
Irssi::Channel channel
|
Irssi::Channel channel
|
||||||
|
|
||||||
Irssi::Nick
|
void
|
||||||
nick_insert(channel, nick, op, voice, send_massjoin)
|
nick_insert(channel, nick)
|
||||||
Irssi::Channel channel
|
Irssi::Channel channel
|
||||||
char *nick
|
Irssi::Nick nick
|
||||||
int op
|
|
||||||
int voice
|
|
||||||
int send_massjoin
|
|
||||||
CODE:
|
CODE:
|
||||||
RETVAL = nicklist_insert(channel, nick, op, voice, send_massjoin);
|
nicklist_insert(channel, nick);
|
||||||
OUTPUT:
|
|
||||||
RETVAL
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nick_remove(channel, nick)
|
nick_remove(channel, nick)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = irc_channel_
|
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = irc_
|
||||||
|
|
||||||
void
|
void
|
||||||
bans(channel)
|
bans(channel)
|
||||||
@ -34,6 +34,18 @@ PPCODE:
|
|||||||
XPUSHs(new_pv(tmp->data));
|
XPUSHs(new_pv(tmp->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Irssi::Nick
|
||||||
|
irc_nick_insert(channel, nick, op, voice, send_massjoin)
|
||||||
|
Irssi::Channel channel
|
||||||
|
char *nick
|
||||||
|
int op
|
||||||
|
int voice
|
||||||
|
int send_massjoin
|
||||||
|
CODE:
|
||||||
|
RETVAL = irc_nicklist_insert(channel, nick, op, voice, send_massjoin);
|
||||||
|
OUTPUT:
|
||||||
|
RETVAL
|
||||||
|
|
||||||
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
|
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
|
||||||
|
|
||||||
Irssi::Irc::Channel
|
Irssi::Irc::Channel
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "irc-servers.h"
|
#include "irc-servers.h"
|
||||||
#include "irc-channels.h"
|
#include "irc-channels.h"
|
||||||
#include "irc-queries.h"
|
#include "irc-queries.h"
|
||||||
|
#include "irc-nicklist.h"
|
||||||
|
|
||||||
#include "bans.h"
|
#include "bans.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user