mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Added support for 326 and 327 whois numerics in OPN.
Removed keeping track of ban exceptions and invite list. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2212 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
fe8971ac8f
commit
3f275ebd55
@ -147,10 +147,6 @@ massjoin.c:
|
||||
mode-lists.c:
|
||||
"ban new", CHANNEL_REC, BAN_REC
|
||||
"ban remove", CHANNEL_REC, BAN_REC
|
||||
"ban exception new", CHANNEL_REC, BAN_REC
|
||||
"ban exception remove", CHANNEL_REC, BAN_REC
|
||||
"invitelist new", CHANNEL_REC, char *mask
|
||||
"invitelist remove", CHANNEL_REC, char *mask
|
||||
|
||||
modes.c:
|
||||
"channel mode changed", CHANNEL_REC
|
||||
|
@ -455,7 +455,7 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
|
||||
|
||||
if (hostname != NULL) {
|
||||
printformat(server, nick, MSGLEVEL_CRAP,
|
||||
IRCTXT_WHOIS_REALHOST, nick, hostname);
|
||||
IRCTXT_WHOIS_REALHOST, nick, hostname, "");
|
||||
} else {
|
||||
/* OPN's dancer uses for end of /MAP */
|
||||
g_free(params);
|
||||
@ -465,6 +465,19 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_whois_usermode326(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *nick, *usermode;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
/* <yournick> <nick> :has oper privs: <mode> */
|
||||
params = event_get_params(data, 3, NULL, &nick, &usermode);
|
||||
printformat(server, nick, MSGLEVEL_CRAP,
|
||||
IRCTXT_WHOIS_USERMODE, nick, usermode);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_whois_realhost327(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *nick, *hostname, *ip, *text;
|
||||
@ -480,7 +493,7 @@ static void event_whois_realhost327(IRC_SERVER_REC *server, const char *data)
|
||||
printtext(server, NULL, MSGLEVEL_CRAP, "%s", text);
|
||||
} else {
|
||||
printformat(server, nick, MSGLEVEL_CRAP,
|
||||
IRCTXT_WHOIS_REALHOST, nick, hostname);
|
||||
IRCTXT_WHOIS_REALHOST, nick, hostname, ip);
|
||||
}
|
||||
g_free(params);
|
||||
}
|
||||
@ -813,6 +826,8 @@ void fe_events_numeric_init(void)
|
||||
signal_add("event 313", (SIGNAL_FUNC) event_whois_oper);
|
||||
signal_add("event 307", (SIGNAL_FUNC) event_whois_registered);
|
||||
signal_add("event 310", (SIGNAL_FUNC) event_whois_help);
|
||||
signal_add("event 326", (SIGNAL_FUNC) event_whois_usermode326);
|
||||
signal_add("event 327", (SIGNAL_FUNC) event_whois_realhost327);
|
||||
signal_add("event 379", (SIGNAL_FUNC) event_whois_modes);
|
||||
signal_add("event 378", (SIGNAL_FUNC) event_whois_realhost);
|
||||
signal_add("event 377", (SIGNAL_FUNC) event_whois_usermode);
|
||||
@ -891,6 +906,8 @@ void fe_events_numeric_deinit(void)
|
||||
signal_remove("event 313", (SIGNAL_FUNC) event_whois_oper);
|
||||
signal_remove("event 307", (SIGNAL_FUNC) event_whois_registered);
|
||||
signal_remove("event 310", (SIGNAL_FUNC) event_whois_help);
|
||||
signal_remove("event 326", (SIGNAL_FUNC) event_whois_usermode326);
|
||||
signal_remove("event 327", (SIGNAL_FUNC) event_whois_realhost327);
|
||||
signal_remove("event 379", (SIGNAL_FUNC) event_whois_modes);
|
||||
signal_remove("event 378", (SIGNAL_FUNC) event_whois_realhost);
|
||||
signal_remove("event 377", (SIGNAL_FUNC) event_whois_usermode);
|
||||
|
@ -227,7 +227,7 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
|
||||
if (!channel->synced)
|
||||
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
if (channel->banlist == NULL && channel->ebanlist == NULL) {
|
||||
if (channel->banlist == NULL) {
|
||||
printformat(server, channel->name, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_NO_BANS, channel->name);
|
||||
return;
|
||||
@ -245,17 +245,6 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
|
||||
(int) (time(NULL)-rec->time));
|
||||
counter++;
|
||||
}
|
||||
|
||||
/* ..and show ban exceptions.. */
|
||||
for (tmp = channel->ebanlist; tmp != NULL; tmp = tmp->next) {
|
||||
BAN_REC *rec = tmp->data;
|
||||
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
(rec->setby == NULL || *rec->setby == '\0') ?
|
||||
IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG,
|
||||
channel->name, rec->ban, rec->setby,
|
||||
(int) (time(NULL)-rec->time));
|
||||
}
|
||||
}
|
||||
|
||||
/* SYNTAX: BAN [<channel>] [<nicks>] */
|
||||
@ -300,37 +289,6 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
|
||||
}
|
||||
|
||||
/* SYNTAX: INVITELIST [<channel>] */
|
||||
static void cmd_invitelist(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
|
||||
{
|
||||
IRC_CHANNEL_REC *channel, *cur_channel;
|
||||
GSList *tmp;
|
||||
|
||||
CMD_IRC_SERVER(server);
|
||||
|
||||
cur_channel = IRC_CHANNEL(item);
|
||||
if (cur_channel == NULL) cmd_return_error(CMDERR_NOT_JOINED);
|
||||
|
||||
if (strcmp(data, "*") == 0 || *data == '\0')
|
||||
channel = cur_channel;
|
||||
else
|
||||
channel = irc_channel_find(server, data);
|
||||
if (channel == NULL) cmd_return_error(CMDERR_CHAN_NOT_FOUND);
|
||||
|
||||
if (!channel->synced)
|
||||
cmd_return_error(CMDERR_CHAN_NOT_SYNCED);
|
||||
|
||||
if (channel->invitelist == NULL) {
|
||||
printformat(server, channel->name, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_NO_INVITELIST, channel->name);
|
||||
} else {
|
||||
for (tmp = channel->invitelist; tmp != NULL; tmp = tmp->next) {
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
IRCTXT_INVITELIST,
|
||||
channel->name, tmp->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SYNTAX: VER [<target>] */
|
||||
static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
|
||||
{
|
||||
@ -464,7 +422,6 @@ void fe_irc_commands_init(void)
|
||||
command_bind_irc("wall", NULL, (SIGNAL_FUNC) cmd_wall);
|
||||
command_bind_irc("wallchops", NULL, (SIGNAL_FUNC) cmd_wallchops);
|
||||
command_bind_irc("ban", NULL, (SIGNAL_FUNC) cmd_ban);
|
||||
command_bind_irc("invitelist", NULL, (SIGNAL_FUNC) cmd_invitelist);
|
||||
command_bind_irc("ver", NULL, (SIGNAL_FUNC) cmd_ver);
|
||||
command_bind_irc("topic", NULL, (SIGNAL_FUNC) cmd_topic);
|
||||
command_bind_irc("ts", NULL, (SIGNAL_FUNC) cmd_ts);
|
||||
@ -482,7 +439,6 @@ void fe_irc_commands_deinit(void)
|
||||
command_unbind("wall", (SIGNAL_FUNC) cmd_wall);
|
||||
command_unbind("wallchops", (SIGNAL_FUNC) cmd_wallchops);
|
||||
command_unbind("ban", (SIGNAL_FUNC) cmd_ban);
|
||||
command_unbind("invitelist", (SIGNAL_FUNC) cmd_invitelist);
|
||||
command_unbind("ver", (SIGNAL_FUNC) cmd_ver);
|
||||
command_unbind("topic", (SIGNAL_FUNC) cmd_topic);
|
||||
command_unbind("ts", (SIGNAL_FUNC) cmd_ts);
|
||||
|
@ -102,7 +102,7 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "whois_registered", "{whois has registered this nick}", 1, { 0 } },
|
||||
{ "whois_help", "{whois is available for help}", 1, { 0 } },
|
||||
{ "whois_modes", " {whois modes $1}", 2, { 0, 0 } },
|
||||
{ "whois_realhost", "{whois hostname $1}", 2, { 0, 0 } },
|
||||
{ "whois_realhost", "{whois hostname $1-}", 3, { 0, 0, 0 } },
|
||||
{ "whois_usermode", "{whois usermode $1}", 2, { 0, 0 } },
|
||||
{ "whois_channels", "{whois channels %|$1}", 2, { 0, 0 } },
|
||||
{ "whois_away", "{whois away %|$1}", 2, { 0, 0 } },
|
||||
|
@ -254,24 +254,6 @@ static void query_send(IRC_SERVER_REC *server, int query)
|
||||
"", "chanquery abort", NULL);
|
||||
break;
|
||||
|
||||
case CHANNEL_QUERY_EMODE:
|
||||
cmd = g_strdup_printf("MODE %s e", chanstr_commas);
|
||||
server_redirect_event(server, "mode e", count, chanstr, -1,
|
||||
"chanquery abort",
|
||||
"event 348", "chanquery eban",
|
||||
"event 349", "chanquery eban end",
|
||||
"", "chanquery abort", NULL);
|
||||
break;
|
||||
|
||||
case CHANNEL_QUERY_IMODE:
|
||||
cmd = g_strdup_printf("MODE %s I", chanstr_commas);
|
||||
server_redirect_event(server, "mode I", count, chanstr, -1,
|
||||
"chanquery abort",
|
||||
"event 346", "chanquery ilist",
|
||||
"event 347", "chanquery ilist end",
|
||||
"", "chanquery abort", NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
cmd = NULL;
|
||||
}
|
||||
@ -503,38 +485,6 @@ static void event_end_of_banlist(IRC_SERVER_REC *server, const char *data)
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_end_of_ebanlist(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *params, *channel;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &channel);
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
|
||||
if (chanrec != NULL)
|
||||
channel_got_query(chanrec, CHANNEL_QUERY_EMODE);
|
||||
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_end_of_invitelist(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *params, *channel;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &channel);
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
|
||||
if (chanrec != NULL)
|
||||
channel_got_query(chanrec, CHANNEL_QUERY_IMODE);
|
||||
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
void channels_query_init(void)
|
||||
{
|
||||
settings_add_bool("misc", "channel_sync", TRUE);
|
||||
@ -547,9 +497,7 @@ void channels_query_init(void)
|
||||
signal_add("chanquery mode", (SIGNAL_FUNC) event_channel_mode);
|
||||
signal_add("chanquery who end", (SIGNAL_FUNC) event_end_of_who);
|
||||
|
||||
signal_add("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
||||
signal_add("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
||||
signal_add("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
||||
signal_add("chanquery abort", (SIGNAL_FUNC) query_current_error);
|
||||
}
|
||||
|
||||
@ -563,8 +511,6 @@ void channels_query_deinit(void)
|
||||
signal_remove("chanquery mode", (SIGNAL_FUNC) event_channel_mode);
|
||||
signal_remove("chanquery who end", (SIGNAL_FUNC) event_end_of_who);
|
||||
|
||||
signal_remove("chanquery eban end", (SIGNAL_FUNC) event_end_of_ebanlist);
|
||||
signal_remove("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
|
||||
signal_remove("chanquery ilist end", (SIGNAL_FUNC) event_end_of_invitelist);
|
||||
signal_remove("chanquery abort", (SIGNAL_FUNC) query_current_error);
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ struct _IRC_CHANNEL_REC {
|
||||
#include "channel-rec.h"
|
||||
|
||||
GSList *banlist; /* list of bans */
|
||||
GSList *ebanlist; /* list of ban exceptions */
|
||||
GSList *invitelist; /* invite list */
|
||||
|
||||
time_t massjoin_start; /* Massjoin start time */
|
||||
int massjoins; /* Number of nicks waiting for massjoin signal.. */
|
||||
|
@ -94,81 +94,12 @@ void banlist_remove(IRC_CHANNEL_REC *channel, const char *ban)
|
||||
}
|
||||
}
|
||||
|
||||
BAN_REC *banlist_exception_add(IRC_CHANNEL_REC *channel, const char *ban,
|
||||
const char *nick, time_t time)
|
||||
{
|
||||
BAN_REC *rec;
|
||||
|
||||
g_return_val_if_fail(channel != NULL, NULL);
|
||||
g_return_val_if_fail(ban != NULL, NULL);
|
||||
|
||||
rec = g_new(BAN_REC, 1);
|
||||
rec->ban = g_strdup(ban);
|
||||
rec->setby = nick == NULL || *nick == '\0' ? NULL :
|
||||
g_strdup(nick);
|
||||
rec->time = time;
|
||||
|
||||
channel->ebanlist = g_slist_append(channel->ebanlist, rec);
|
||||
|
||||
signal_emit("ban exception new", 2, channel, rec);
|
||||
return rec;
|
||||
}
|
||||
|
||||
void banlist_exception_remove(IRC_CHANNEL_REC *channel, const char *ban)
|
||||
{
|
||||
BAN_REC *rec;
|
||||
|
||||
g_return_if_fail(channel != NULL);
|
||||
g_return_if_fail(ban != NULL);
|
||||
|
||||
rec = banlist_find(channel->ebanlist, ban);
|
||||
if (rec != NULL) {
|
||||
signal_emit("ban exception remove", 2, channel, rec);
|
||||
ban_free(&channel->ebanlist, rec);
|
||||
}
|
||||
}
|
||||
|
||||
static void invitelist_free(IRC_CHANNEL_REC *channel)
|
||||
{
|
||||
g_return_if_fail(channel != NULL);
|
||||
|
||||
g_slist_foreach(channel->invitelist, (GFunc) g_free, NULL);
|
||||
g_slist_free(channel->invitelist);
|
||||
}
|
||||
|
||||
void invitelist_add(IRC_CHANNEL_REC *channel, const char *mask)
|
||||
{
|
||||
g_return_if_fail(channel != NULL);
|
||||
g_return_if_fail(mask != NULL);
|
||||
|
||||
channel->invitelist = g_slist_append(channel->invitelist, g_strdup(mask));
|
||||
|
||||
signal_emit("invitelist new", 2, channel, mask);
|
||||
}
|
||||
|
||||
void invitelist_remove(IRC_CHANNEL_REC *channel, const char *mask)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
g_return_if_fail(channel != NULL);
|
||||
g_return_if_fail(mask != NULL);
|
||||
|
||||
tmp = gslist_find_icase_string(channel->invitelist, mask);
|
||||
if (tmp == NULL) return;
|
||||
|
||||
signal_emit("invitelist remove", 2, channel, tmp->data);
|
||||
g_free(tmp->data);
|
||||
channel->invitelist = g_slist_remove(channel->invitelist, tmp->data);
|
||||
}
|
||||
|
||||
static void channel_destroyed(IRC_CHANNEL_REC *channel)
|
||||
{
|
||||
if (!IS_IRC_CHANNEL(channel))
|
||||
return;
|
||||
|
||||
banlist_free(channel->banlist);
|
||||
banlist_free(channel->ebanlist);
|
||||
invitelist_free(channel);
|
||||
}
|
||||
|
||||
static void event_banlist(IRC_SERVER_REC *server, const char *data)
|
||||
@ -188,46 +119,11 @@ static void event_banlist(IRC_SERVER_REC *server, const char *data)
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_ebanlist(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *params, *channel, *ban, *setby, *tims;
|
||||
time_t tim;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims);
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
if (chanrec != NULL) {
|
||||
tim = (time_t) atol(tims);
|
||||
banlist_exception_add(chanrec, ban, setby, tim);
|
||||
}
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *params, *channel, *invite;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &invite);
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
|
||||
if (chanrec != NULL)
|
||||
invitelist_add(chanrec, invite);
|
||||
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
void mode_lists_init(void)
|
||||
{
|
||||
signal_add("channel destroyed", (SIGNAL_FUNC) channel_destroyed);
|
||||
|
||||
signal_add("chanquery ban", (SIGNAL_FUNC) event_banlist);
|
||||
signal_add("chanquery eban", (SIGNAL_FUNC) event_ebanlist);
|
||||
signal_add("chanquery ilist", (SIGNAL_FUNC) event_invite_list);
|
||||
}
|
||||
|
||||
void mode_lists_deinit(void)
|
||||
@ -235,6 +131,4 @@ void mode_lists_deinit(void)
|
||||
signal_remove("channel destroyed", (SIGNAL_FUNC) channel_destroyed);
|
||||
|
||||
signal_remove("chanquery ban", (SIGNAL_FUNC) event_banlist);
|
||||
signal_remove("chanquery eban", (SIGNAL_FUNC) event_ebanlist);
|
||||
signal_remove("chanquery ilist", (SIGNAL_FUNC) event_invite_list);
|
||||
}
|
||||
|
@ -232,19 +232,6 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
|
||||
else
|
||||
banlist_remove(channel, arg);
|
||||
break;
|
||||
case 'e':
|
||||
if (type == '+')
|
||||
banlist_exception_add(channel, arg, setby,
|
||||
time(NULL));
|
||||
else
|
||||
banlist_exception_remove(channel, arg);
|
||||
break;
|
||||
case 'I':
|
||||
if (type == '+')
|
||||
invitelist_add(channel, arg);
|
||||
else
|
||||
invitelist_remove(channel, arg);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
case 'O': /* channel owner in !channels */
|
||||
|
@ -49,26 +49,6 @@ PPCODE:
|
||||
XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Irc::Ban")));
|
||||
}
|
||||
|
||||
void
|
||||
ebans(channel)
|
||||
Irssi::Irc::Channel channel
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
PPCODE:
|
||||
for (tmp = channel->ebanlist; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Irc::Ban")));
|
||||
}
|
||||
|
||||
void
|
||||
invites(channel)
|
||||
Irssi::Irc::Channel channel
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
PPCODE:
|
||||
for (tmp = channel->invitelist; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(new_pv(tmp->data));
|
||||
}
|
||||
|
||||
Irssi::Irc::Nick
|
||||
irc_nick_insert(channel, nick, op, voice, send_massjoin)
|
||||
Irssi::Irc::Channel channel
|
||||
|
@ -30,25 +30,3 @@ void
|
||||
banlist_remove(channel, ban)
|
||||
Irssi::Irc::Channel channel
|
||||
char *ban
|
||||
|
||||
Irssi::Irc::Ban
|
||||
banlist_exception_add(channel, ban, nick, time)
|
||||
Irssi::Irc::Channel channel
|
||||
char *ban
|
||||
char *nick
|
||||
time_t time
|
||||
|
||||
void
|
||||
banlist_exception_remove(channel, ban)
|
||||
Irssi::Irc::Channel channel
|
||||
char *ban
|
||||
|
||||
void
|
||||
invitelist_add(channel, mask)
|
||||
Irssi::Irc::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
invitelist_remove(channel, mask)
|
||||
Irssi::Irc::Channel channel
|
||||
char *mask
|
||||
|
Loading…
Reference in New Issue
Block a user