summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-05-18 03:07:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-05-18 03:07:57 +0000
commit3b5b10791a2be7354a4c30e58887ea7f26fc762e (patch)
treebe42ac62594ac307a914d2d2e9c4535bb0c4170c /src
parent99167ed74d6366364ec0dcd841fa62545a9f0c46 (diff)
downloadirssi-3b5b10791a2be7354a4c30e58887ea7f26fc762e.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c9
-rw-r--r--src/irc/core/mode-lists.c2
-rw-r--r--src/irc/core/mode-lists.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index f5cf2208..42dec0aa 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -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);
}
diff --git a/src/irc/core/mode-lists.c b/src/irc/core/mode-lists.c
index d7fef183..9d85e133 100644
--- a/src/irc/core/mode-lists.c
+++ b/src/irc/core/mode-lists.c
@@ -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;
diff --git a/src/irc/core/mode-lists.h b/src/irc/core/mode-lists.h
index 324b7752..105e1245 100644
--- a/src/irc/core/mode-lists.h
+++ b/src/irc/core/mode-lists.h
@@ -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);