]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * qsuspendreason functionality | |
3 | */ | |
4 | ||
5 | #include "../../newsearch/newsearch.h" | |
6 | #include "../chanserv.h" | |
7 | ||
8 | #include <stdlib.h> | |
9 | ||
10 | void *qsuspendreason_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput); | |
11 | void qsuspendreason_free(searchCtx *ctx, struct searchNode *thenode); | |
12 | ||
13 | struct searchNode *qsuspendreason_parse(searchCtx *ctx, int argc, char **argv) { | |
14 | struct searchNode *thenode; | |
15 | ||
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 = qsuspendreason_exe; | |
23 | thenode->free = qsuspendreason_free; | |
24 | ||
25 | return thenode; | |
26 | } | |
27 | ||
28 | void *qsuspendreason_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) { | |
29 | authname *ap = (authname *)theinput; | |
30 | reguser *rup = ap->exts[chanservaext]; | |
31 | if(!rup || !UHasSuspension(rup) || !rup->suspendreason) | |
32 | return ""; | |
33 | ||
34 | return rup->suspendreason->content; | |
35 | } | |
36 | ||
37 | void qsuspendreason_free(searchCtx *ctx, struct searchNode *thenode) { | |
38 | free(thenode); | |
39 | } | |
40 |