]>
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.
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 "../../nick/nick.h"
18 #include "../../lib/flags.h"
19 #include "../../lib/irc_string.h"
20 #include "../../channel/channel.h"
21 #include "../../parser/parser.h"
22 #include "../../irc/irc.h"
23 #include "../../localuser/localuserchannel.h"
27 int csc_dochannelcomment(void *source
, int cargc
, char **cargv
) {
29 reguser
*rup
=getreguserfromnick(sender
);
39 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "channelcomment");
43 if (!(cip
=findchanindex(cargv
[0])) || !(rcp
=cip
->exts
[chanservext
])) {
44 chanservstdmessage(sender
, QM_UNKNOWNCHAN
, cargv
[0]);
49 if (!ircd_strcmp(cargv
[1],"none")) {
50 freesstring(rcp
->comment
);
55 strcpy(buf
,rcp
->comment
->content
);
56 bufpos
=rcp
->comment
->length
;
61 strncpy(buf
+bufpos
, cargv
[1]+1, 280-bufpos
);
63 strncpy(buf
, cargv
[1], 250);
66 freesstring(rcp
->comment
);
67 rcp
->comment
=getsstring(buf
,250);
69 csdb_updatechannel(rcp
);
73 chanservstdmessage(sender
, QM_COMMENT
, cip
->name
->content
, rcp
->comment
->content
);
75 chanservstdmessage(sender
, QM_NOCOMMENT
, cip
->name
->content
);