]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/usercomment.c
1 /* Automatically generated by refactor.pl.
7 * CMDDESC: Shows or changes staff comment for a user.
8 * CMDFUNC: csu_dousercomment
9 * CMDPROTO: int csu_dousercomment(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: usercomment <username> [[+]<comment>]
11 * CMDHELP: Shows or changes the staff comment for the specified user.
12 * CMDHELP: Comments can be appended to by prefixing <comment> with +.
13 * CMDHELP: Use 'none' for <comment> to unset.
16 #include "../chanserv.h"
17 #include "../../lib/irc_string.h"
21 int csu_dousercomment(void *source
, int cargc
, char **cargv
) {
23 reguser
*rup
=getreguserfromnick(sender
), *target
;
31 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "usercomment");
35 if (!(target
=findreguser(sender
, cargv
[0])))
39 if (!ircd_strcmp(cargv
[1],"none")) {
40 freesstring(target
->comment
);
44 if (target
->comment
) {
45 strcpy(buf
,target
->comment
->content
);
46 bufpos
=target
->comment
->length
;
51 strncpy(buf
+bufpos
, cargv
[1]+1, 280-bufpos
);
53 strncpy(buf
, cargv
[1], 250);
56 freesstring(target
->comment
);
57 target
->comment
=getsstring(buf
,250);
59 csdb_updateuser(target
);
63 chanservstdmessage(sender
, QM_COMMENT
, target
->username
, target
->comment
->content
);
65 chanservstdmessage(sender
, QM_NOCOMMENT
, target
->username
);