]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/unsuspenduser.c
846fc346cc9c01e47ea81e6c288448956077398d
1 /* Automatically generated by refactor.pl.
4 * CMDNAME: unsuspenduser
7 * CMDDESC: Unsuspend a user.
8 * CMDFUNC: csu_dounsuspenduser
9 * CMDPROTO: int csu_dounsuspenduser(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: unsuspenduser <username>
11 * CMDHELP: Unsuspends the specified user.
14 #include "../chanserv.h"
15 #include "../../lib/irc_string.h"
19 int csu_dounsuspenduser(void *source
, int cargc
, char **cargv
) {
21 reguser
*rup
=getreguserfromnick(sender
);
29 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "unsuspenduser");
33 if (cargv
[0][0] == '#') {
34 if (!(vrup
=findreguserbynick(&cargv
[0][1]))) {
35 chanservstdmessage(sender
, QM_UNKNOWNUSER
, &cargv
[0][1]);
42 if (!(np
=getnickbynick(cargv
[0]))) {
43 chanservstdmessage(sender
, QM_UNKNOWNUSER
, cargv
[0]);
47 if (!(vrup
=getreguserfromnick(np
)) && sender
) {
48 chanservstdmessage(sender
, QM_USERNOTAUTHED
, cargv
[0]);
53 if (!UHasSuspension(vrup
)) {
54 chanservstdmessage(sender
, QM_USERNOTSUSPENDED
, cargv
[0]);
58 if (UHasOperPriv(vrup
) && !UHasAdminPriv(rup
)) {
59 snprintf(action
, 99, "unsuspenduser on %s", vrup
->username
);
60 chanservstdmessage(sender
, QM_NOACCESS
, action
);
61 chanservwallmessage("%s (%s) FAILED to unsuspend %s", sender
->nick
, rup
->username
, vrup
->username
);
65 if (UIsDelayedGline(vrup
)) {
66 strcpy(action
, "removed delayed gline on");
68 else if (UIsGline(vrup
)) {
69 strcpy(action
, "removed instant gline on");
71 else if (UIsSuspended(vrup
)) {
72 strcpy(action
, "unsuspended");
75 chanservsendmessage(sender
, "Unknown suspend type encountered.");
79 vrup
->flags
&=(~(QUFLAG_GLINE
|QUFLAG_DELAYEDGLINE
|QUFLAG_SUSPENDED
));
82 freesstring(vrup
->suspendreason
);
83 vrup
->suspendreason
=0;
84 csdb_updateuser(vrup
);
86 chanservwallmessage("%s (%s) %s %s", sender
->nick
, rup
->username
, action
, vrup
->username
);
87 chanservstdmessage(sender
, QM_DONE
);