.PHONY: all clean distclean
all: newsearch.so
-NSCOMMANDS=ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-away.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o ns-kill.o ns-gline.o ns-exists.o ns-services.o ns-size.o ns-name.o ns-topic.o ns-oppct.o ns-cumodecount.o ns-cumodepct.o ns-hostpct.o ns-authedpct.o ns-length.o ns-kick.o ns-authts.o ns-channels.o ns-server.o ns-authid.o ns-notice.o newsearch_ast.o ns-any.o ns-channeliter.o ns-var.o ns-all.o ns-cumodes.o ns-cidr.o ns-nickiter.o ns-ipv6.o ns-away.o ns-quit.o ns-killed.o ns-renamed.o ns-age.o ns-newnick.o
+NSCOMMANDS=ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-away.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o ns-kill.o ns-gline.o ns-exists.o ns-services.o ns-size.o ns-name.o ns-topic.o ns-oppct.o ns-cumodecount.o ns-cumodepct.o ns-hostpct.o ns-authedpct.o ns-length.o ns-kick.o ns-authts.o ns-channels.o ns-server.o ns-authid.o ns-notice.o newsearch_ast.o ns-any.o ns-channeliter.o ns-var.o ns-all.o ns-cumodes.o ns-cidr.o ns-nickiter.o ns-ipv6.o ns-away.o ns-quit.o ns-killed.o ns-renamed.o ns-age.o ns-newnick.o ns-reason.o
newsearch.so: newsearch.o formats.o y.tab.o lex.yy.o parser.o ${NSCOMMANDS}
registersearchterm(reg_whowassearch, "renamed",renamed_parse, 0, "User changed nick");
registersearchterm(reg_whowassearch, "age",age_parse, 0, "Whowas record age in seconds");
registersearchterm(reg_whowassearch, "newnick",newnick_parse, 0, "New nick (for rename whowas records)");
+ registersearchterm(reg_whowassearch, "reason",reason_parse, 0, "Quit/kill reason");
/* Channel operations */
registersearchterm(reg_chansearch, "exists",exists_parse, 0, "Returns if channel exists on network. Note: newserv may store data on empty channels"); /* channel only */
struct searchNode *renamed_parse(searchCtx *ctx, int argc, char **argv);
struct searchNode *age_parse(searchCtx *ctx, int argc, char **argv);
struct searchNode *newnick_parse(searchCtx *ctx, int argc, char **argv);
+struct searchNode *reason_parse(searchCtx *ctx, int argc, char **argv);
/* Channel functions (various types) */
struct searchNode *exists_parse(searchCtx *ctx, int argc, char **argv);
--- /dev/null
+/*
+ * quit functionality
+ */
+
+#include "newsearch.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void *reason_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void reason_free(searchCtx *ctx, struct searchNode *thenode);
+
+struct searchNode *reason_parse(searchCtx *ctx, int argc, char **argv) {
+ struct searchNode *thenode;
+
+ if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
+ parseError = "malloc: could not allocate memory for this search.";
+ return NULL;
+ }
+
+ thenode->returntype = RETURNTYPE_BOOL;
+ thenode->localdata = NULL;
+ thenode->exe = reason_exe;
+ thenode->free = reason_free;
+
+ return thenode;
+}
+
+void *reason_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
+ nick *np = (nick *)theinput;
+ whowas *ww = (whowas *)np->next;
+
+ if (ww->type != WHOWAS_RENAME)
+ return (void *)0;
+
+ return (void *)ww->reason->content;
+}
+
+void reason_free(searchCtx *ctx, struct searchNode *thenode) {
+ free(thenode);
+}
+