]> jfr.im git - irc/quakenet/newserv.git/commitdiff
newsearch: Add missing file.
authorGunnar Beutner <redacted>
Tue, 13 Aug 2013 05:52:30 +0000 (07:52 +0200)
committerGunnar Beutner <redacted>
Tue, 13 Aug 2013 05:52:30 +0000 (07:52 +0200)
newsearch/ns-message.c [new file with mode: 0644]

diff --git a/newsearch/ns-message.c b/newsearch/ns-message.c
new file mode 100644 (file)
index 0000000..748fdec
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * MESSAGE functionality 
+ */
+
+#include "newsearch.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void *message_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
+void message_free(searchCtx *ctx, struct searchNode *thenode);
+
+struct searchNode *message_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_STRING;
+  thenode->localdata = NULL;
+  thenode->exe = message_exe;
+  thenode->free = message_free;
+
+  return thenode;
+}
+
+void *message_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
+  nick *np = (nick *)theinput;
+
+  return (np->message) ? np->message->content : "";
+}
+
+void message_free(searchCtx *ctx, struct searchNode *thenode) {
+  free(thenode);
+}
+