]> jfr.im git - irc/quakenet/newserv.git/blob - newsearch/ns-nick.c
added LISP style kill/gline functionality
[irc/quakenet/newserv.git] / newsearch / ns-nick.c
1 /*
2 * NICK functionality
3 */
4
5 #include "newsearch.h"
6
7 #include <stdio.h>
8 #include <stdlib.h>
9
10 void *nick_exe(struct searchNode *thenode, int type, void *theinput);
11 void nick_free(struct searchNode *thenode);
12
13 struct searchNode *nick_parse(int type, int argc, char **argv) {
14 struct searchNode *thenode;
15
16 if (type != SEARCHTYPE_NICK) {
17 parseError = "nick: this function is only valid for nick searches.";
18 return NULL;
19 }
20
21 thenode=(struct searchNode *)malloc(sizeof (struct searchNode));
22
23 thenode->returntype = RETURNTYPE_STRING;
24 thenode->localdata = NULL;
25 thenode->exe = nick_exe;
26 thenode->free = nick_free;
27
28 return thenode;
29 }
30
31 void *nick_exe(struct searchNode *thenode, int type, void *theinput) {
32 nick *np = (nick *)theinput;
33
34 if (type != RETURNTYPE_STRING) {
35 return (void *)1;
36 }
37
38 return np->nick;
39 }
40
41 void nick_free(struct searchNode *thenode) {
42 free(thenode);
43 }
44