From b194fa23e0f74e609b5aade2967374f390503005 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 18 May 2021 16:14:12 -0400 Subject: Add weechat format to unscoop --- unscoop.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'unscoop.c') diff --git a/unscoop.c b/unscoop.c index 598979b..ac61b88 100644 --- a/unscoop.c +++ b/unscoop.c @@ -50,6 +50,7 @@ struct Matcher { #define P0_MODE "[!~&@%+ ]?" #define P1_TIME "^[[]([^]]+)[]][ \t]" #define P2_USERHOST "[(]([^@]+)@([^)]+)[)]" +#define P2_MESSAGE "( [(]([^)]+)[)])?" static const struct Matcher Catgirl[] = { { @@ -148,7 +149,6 @@ static const struct Matcher IRC[] = { #undef P2_TAGS #undef P3_ORIGIN -#define P2_MESSAGE "( [(]([^)]+)[)])?" static const struct Matcher Textual[] = { { P1_TIME "<" P0_MODE "([^>]+)> (.+)", @@ -185,7 +185,46 @@ static const struct Matcher Textual[] = { Unban, { ":time", ":nick", ":target" }, } }; -#undef P2_MESSAGE + +static const struct Matcher WeeChat[] = { + { + "([^\t]+)\t-->\t([^ ]+) " P2_USERHOST " has joined", + Join, { ":time", ":nick", ":user", ":host" }, + }, { + "([^\t]+)\t<--\t([^ ]+) " P2_USERHOST " has left [^ ]+" P2_MESSAGE, + Part, { ":time", ":nick", ":user", ":host", NULL, ":message" }, + }, { + "([^\t]+)\t<--\t([^ ]+) has kicked ([^ ]+)" P2_MESSAGE, + Kick, { ":time", ":nick", ":target", NULL, ":message" }, + }, { + "([^\t]+)\t<--\t([^ ]+) " P2_USERHOST " has quit" P2_MESSAGE, + Quit, { ":time", ":nick", ":user", ":host", NULL, ":message" }, + }, { + "([^\t]+)\t--\t([^ ]+) is now known as ([^ ]+)", + Nick, { ":time", ":nick", ":target" }, + }, { + "([^\t]+)\t--\t([^ ]+) has changed topic for [^ ]+ to \"(.+)\"", + Topic, { ":time", ":nick", ":message" }, + }, { + "([^\t]+)\t--\t([^ ]+) has unset topic", + Topic, { ":time", ":nick" }, + }, { + "([^\t]+)\t--\tMode [^ ]+ [[][+]b+ ([^]]+)[]] by ([^ ]+)", + Ban, { ":time", ":target", ":nick" }, + }, { + "([^\t]+)\t--\tMode [^ ]+ [[][-]b+ ([^]]+)[]] by ([^ ]+)", + Unban, { ":time", ":target", ":nick" }, + }, { + "([^\t]+)\t--\tNotice[(]([^)]+)[)]: (.+)", + Notice, { ":time", ":nick", ":message" }, + }, { + "([^\t]+)\t [*]\t([^ ]+) (.+)", + Action, { ":time", ":nick", ":message" }, + }, { + "([^\t]+)\t" P0_MODE "([^-][^\t]*)\t(.+)", + Privmsg, { ":time", ":nick", ":message" }, + } +}; static const struct Matcher ZNC[] = { { @@ -255,6 +294,10 @@ static const struct Format { ), 1, 4, 0, }, + { + "weechat", WeeChat, ARRAY_LEN(WeeChat), + "irc[.](.+)[.]([^.]+)[.]weechatlog$", 1, 2, 0, + }, { "znc", ZNC, ARRAY_LEN(ZNC), "([^/]+)/(moddata/log/)?([^/]+)/([0-9-]+)[.]log$", 1, 3, 4, -- cgit 1.4.1 '/litterbox/commit/database.h?h=1.9&id=e2e940b9a898385e00989661ecd371a7984d3e55&follow=1'>Perform all migrations in one transaction 1.3June McEnroe 2020-05-21Clean up unscoop manual pageJune McEnroe 2020-05-21Fix search expression appendJune McEnroe 2020-05-21Fix dbPrepare errx callJune McEnroe 2020-05-21Add only the necessary expressions to scoop's queryJune McEnroe 2020-05-21Explicitly set stdout line buffered when pagingJune McEnroe 2020-05-21Do not sort results in scoop by defaultJune McEnroe 2020-05-21Expand and clarify documentationJune McEnroe 2020-05-21Execute PAGER with the SHELLJune McEnroe 2020-05-21Automatically perform database migrations in litterboxJune McEnroe 2020-05-20Don't install rc scripts on other platformsJune McEnroe 2020-05-20Rewrite build and install like pounce 1.3June McEnroe 2020-05-20Update email addressesJune McEnroe 2020-04-23Call updateConsumer from handleError 1.2p1June McEnroe 2020-04-20Use . as ${LDLIBS.$@} separatorJune McEnroe 2020-04-05Error on invalid ISUPPORT values 1.2June McEnroe 2020-04-05Only set RCS on FreeBSDJune McEnroe 2020-04-05Log bans and unbansJune McEnroe 2020-04-05Parse mode types from ISUPPORTJune McEnroe 2020-04-05Add unscoop matchers for ban/unban eventsJune McEnroe 2020-04-05Check unscoop regexps with make testJune McEnroe 2020-04-05Add unscoop -n flag for checking regexpsJune McEnroe 2020-04-05Add Ban and Unban event typesJune McEnroe 2020-04-02Update styleJune McEnroe 2020-03-31Update unscoop catgirl matchersJune McEnroe 2020-03-31Fix writing verbose to stderrJune McEnroe 2020-03-02Include <>/-/* around nicks in scoop coloring 1.1June McEnroe 2020-03-02Replace .mk files with configure scriptJune McEnroe 2020-02-28Implement the causal.agency/consumer capabilityJune McEnroe 2020-02-22Include <>/-/* around nicks in coloringJune McEnroe 2020-02-22Use (almost) the full range of IRC colors for nicksJune McEnroe