]>
Commit | Line | Data |
---|---|---|
1dd6d55d | 1 | /* Automatically generated by refactor.pl. |
2 | * | |
3 | * | |
4 | * CMDNAME: unsuspendchan | |
5 | * CMDLEVEL: QCMD_OPER | |
6 | * CMDARGS: 1 | |
7 | * CMDDESC: Unsuspends a channel from the bot. | |
8 | * CMDFUNC: csc_dounsuspendchan | |
9 | * CMDPROTO: int csc_dounsuspendchan(void *source, int cargc, char **cargv); | |
94e4d2f4 CP |
10 | * CMDHELP: Usage: unsuspendchan <channel> |
11 | * CMDHELP: Unsuspends specified channel. | |
1dd6d55d | 12 | */ |
13 | ||
14 | #include "../chanserv.h" | |
15 | #include "../../nick/nick.h" | |
16 | #include "../../lib/flags.h" | |
17 | #include "../../lib/irc_string.h" | |
18 | #include "../../channel/channel.h" | |
19 | #include "../../parser/parser.h" | |
20 | #include "../../irc/irc.h" | |
21 | #include "../../localuser/localuserchannel.h" | |
22 | #include <string.h> | |
23 | #include <stdio.h> | |
24 | ||
25 | int csc_dounsuspendchan(void *source, int cargc, char **cargv) { | |
26 | nick *sender=source; | |
27 | reguser *rup=getreguserfromnick(sender); | |
28 | chanindex *cip; | |
29 | regchan *rcp; | |
30 | ||
31 | if (!rup) | |
32 | return CMD_ERROR; | |
33 | ||
34 | if (cargc<1) { | |
35 | chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "unsuspendchan"); | |
36 | return CMD_ERROR; | |
37 | } | |
38 | ||
39 | if (!(cip=findchanindex(cargv[0])) || !(rcp=cip->exts[chanservext])) { | |
40 | chanservstdmessage(sender, QM_UNKNOWNCHAN, cargv[0]); | |
41 | return CMD_ERROR; | |
42 | } | |
43 | ||
44 | if(!CIsSuspended(rcp)) { | |
45 | chanservstdmessage(sender, QM_CHANNELNOTSUSPENDED, cip->name->content); | |
46 | cs_log(sender,"UNSUSPENDCHAN %s is not suspended",cip->name->content); | |
47 | return CMD_ERROR; | |
48 | } | |
49 | ||
50 | CClearSuspended(rcp); | |
51 | cs_log(sender,"UNSUSPENDCHAN %s (%s)",cip->name->content,rcp->suspendreason->content); | |
52 | freesstring(rcp->suspendreason); | |
53 | rcp->suspendreason = NULL; | |
54 | rcp->suspendby = 0; | |
55 | ||
9d53322f CP |
56 | if(cip->channel) |
57 | chanservjoinchan(cip->channel); | |
1dd6d55d | 58 | |
59 | csdb_updatechannel(rcp); | |
60 | chanservstdmessage(sender, QM_DONE); | |
61 | ||
62 | return CMD_OK; | |
63 | } |