1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-01 04:14:16 -04:00

banlist_find() is now public. "event 367" (banlist) shows now ban number in

our list, if it's known.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2807 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-05-18 03:07:57 +00:00 committed by cras
parent 99167ed74d
commit 3b5b10791a
3 changed files with 11 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "irc-servers.h"
#include "irc-channels.h"
#include "nicklist.h"
#include "mode-lists.h"
#include "../core/module-formats.h"
#include "printtext.h"
@ -133,6 +134,8 @@ static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
static void event_ban_list(IRC_SERVER_REC *server, const char *data)
{
IRC_CHANNEL_REC *chanrec;
BAN_REC *banrec;
const char *channel;
char *params, *ban, *setby, *tims;
long secs;
@ -144,10 +147,14 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
secs = *tims == '\0' ? 0 :
(long) (time(NULL) - atol(tims));
chanrec = irc_channel_find(server, channel);
banrec = chanrec == NULL ? NULL : banlist_find(chanrec->banlist, ban);
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP,
*setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
0, channel, ban, setby, secs);
banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1,
channel, ban, setby, secs);
g_free(params);
}

View File

@ -44,7 +44,7 @@ void banlist_free(GSList *banlist)
ban_free(&banlist, banlist->data);
}
static BAN_REC *banlist_find(GSList *list, const char *ban)
BAN_REC *banlist_find(GSList *list, const char *ban)
{
GSList *tmp;

View File

@ -7,6 +7,8 @@ typedef struct {
time_t time;
} BAN_REC;
BAN_REC *banlist_find(GSList *list, const char *ban);
BAN_REC *banlist_add(IRC_CHANNEL_REC *channel, const char *ban, const char *nick, time_t time);
void banlist_remove(IRC_CHANNEL_REC *channel, const char *ban);