]> jfr.im git - irc/quakenet/newserv.git/blame - chanserv/newsearch/csns-qemail.c
newsearch changes to support addition of trust_search/patriciasearch
[irc/quakenet/newserv.git] / chanserv / newsearch / csns-qemail.c
CommitLineData
6d349eb0
CP
1/*
2 * qemail functionality
3 */
4
5#include "../../newsearch/newsearch.h"
6#include "../chanserv.h"
7
8#include <stdlib.h>
9
10void *qemail_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
11void qemail_free(searchCtx *ctx, struct searchNode *thenode);
12
a92bb8e1 13struct searchNode *qemail_parse(searchCtx *ctx, int argc, char **argv) {
6d349eb0
CP
14 struct searchNode *thenode;
15
6d349eb0
CP
16 if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
17 parseError = "malloc: could not allocate memory for this search.";
18 return NULL;
19 }
20
21 thenode->returntype = RETURNTYPE_STRING;
22 thenode->exe = qemail_exe;
23 thenode->free = qemail_free;
24
25 return thenode;
26}
27
28void *qemail_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
29 authname *ap = (authname *)theinput;
30 reguser *rup = ap->exts[chanservext];
31 if(!rup || !rup->email)
32 return "";
33
34 return rup->email->content;
35}
36
37void qemail_free(searchCtx *ctx, struct searchNode *thenode) {
38 free(thenode);
39}
40