]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/unsuspenduser.c
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);
12 #include "../chanserv.h"
13 #include "../../lib/irc_string.h"
17 int csu_dounsuspenduser(void *source
, int cargc
, char **cargv
) {
19 reguser
*rup
=getreguserfromnick(sender
);
27 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "unsuspenduser");
31 if (cargv
[0][0] == '#') {
32 if (!(vrup
=findreguserbynick(&cargv
[0][1]))) {
33 chanservstdmessage(sender
, QM_UNKNOWNUSER
, &cargv
[0][1]);
40 if (!(np
=getnickbynick(cargv
[0]))) {
41 chanservstdmessage(sender
, QM_UNKNOWNUSER
, cargv
[0]);
45 if (!(vrup
=getreguserfromnick(np
)) && sender
) {
46 chanservstdmessage(sender
, QM_USERNOTAUTHED
, cargv
[0]);
51 if (!UHasSuspension(vrup
)) {
52 chanservstdmessage(sender
, QM_USERNOTSUSPENDED
, cargv
[0]);
56 if (UHasOperPriv(vrup
) && !UHasAdminPriv(rup
)) {
57 snprintf(action
, 99, "unsuspenduser on %s", vrup
->username
);
58 chanservstdmessage(sender
, QM_NOACCESS
, action
);
59 chanservwallmessage("%s (%s) FAILED to unsuspend %s", sender
->nick
, rup
->username
, vrup
->username
);
63 if (UIsDelayedGline(vrup
)) {
64 strcpy(action
, "removed delayed gline on");
66 else if (UIsGline(vrup
)) {
67 strcpy(action
, "removed instant gline on");
69 else if (UIsSuspended(vrup
)) {
70 strcpy(action
, "unsuspended");
73 chanservsendmessage(sender
, "Unknown suspend type encountered.");
77 vrup
->flags
&=(~(QUFLAG_GLINE
|QUFLAG_DELAYEDGLINE
|QUFLAG_SUSPENDED
));
80 freesstring(vrup
->suspendreason
);
81 vrup
->suspendreason
=0;
82 csdb_updateuser(vrup
);
84 chanservwallmessage("%s (%s) %s %s", sender
->nick
, rup
->username
, action
, vrup
->username
);
85 chanservstdmessage(sender
, QM_DONE
);