]> jfr.im git - irc/quakenet/newserv.git/blame_incremental - newsearch/ns-channels.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / newsearch / ns-channels.c
... / ...
CommitLineData
1/*
2 * CHANNELS functionality
3 */
4
5#include "newsearch.h"
6
7#include <stdio.h>
8#include <stdlib.h>
9
10#include "../irc/irc_config.h"
11#include "../lib/irc_string.h"
12
13void *channels_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
14void channels_free(searchCtx *ctx, struct searchNode *thenode);
15
16struct searchNode *channels_parse(searchCtx *ctx, int argc, char **argv) {
17 struct searchNode *thenode;
18
19 if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
20 parseError = "malloc: could not allocate memory for this search.";
21 return NULL;
22 }
23
24 thenode->returntype = RETURNTYPE_INT;
25 thenode->localdata = NULL;
26 thenode->exe = channels_exe;
27 thenode->free = channels_free;
28
29 return thenode;
30}
31
32void *channels_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
33 nick *np = (nick *)theinput;
34
35 return (void *)(long)np->channels->cursi;
36}
37
38void channels_free(searchCtx *ctx, struct searchNode *thenode) {
39 free(thenode);
40}