]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/channelcomment.c
1 /* Automatically generated by refactor.pl.
4 * CMDNAME: channelcomment
7 * CMDDESC: Shows or changes the staff comment for a channel.
8 * CMDFUNC: csc_dochannelcomment
9 * CMDPROTO: int csc_dochannelcomment(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: channelcomment <channel> [<comment>]
11 * CMDHELP: Sets or views a comment for a channel.
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"
25 int csc_dochannelcomment(void *source
, int cargc
, char **cargv
) {
27 reguser
*rup
=getreguserfromnick(sender
);
37 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "channelcomment");
41 if (!(cip
=findchanindex(cargv
[0])) || !(rcp
=cip
->exts
[chanservext
])) {
42 chanservstdmessage(sender
, QM_UNKNOWNCHAN
, cargv
[0]);
47 if (!ircd_strcmp(cargv
[1],"none")) {
48 freesstring(rcp
->comment
);
53 strcpy(buf
,rcp
->comment
->content
);
54 bufpos
=rcp
->comment
->length
;
59 strncpy(buf
+bufpos
, cargv
[1]+1, 250-bufpos
);
61 strncpy(buf
, cargv
[1], 250);
64 freesstring(rcp
->comment
);
65 rcp
->comment
=getsstring(buf
,250);
67 csdb_updatechannel(rcp
);
71 chanservstdmessage(sender
, QM_COMMENT
, cip
->name
->content
, rcp
->comment
->content
);
73 chanservstdmessage(sender
, QM_NOCOMMENT
, cip
->name
->content
);