]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chancmds/welcome.c
1 /* Automatically generated by refactor.pl.
5 * CMDLEVEL: QCMD_AUTHED
7 * CMDDESC: Shows or changes the welcome message on a channel.
8 * CMDFUNC: csc_dowelcome
9 * CMDPROTO: int csc_dowelcome(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: WELCOME <channel> [<message>]
11 * CMDHELP: This shows the current welcome message set on a channel and allows it to be
12 * CMDHELP: changed. In order to be displayed to users, the feature must be enabled
13 * CMDHELP: by the +w chanflag (see CHANFLAGS). Where:
14 * CMDHELP: channel - channel to use
15 * CMDHELP: message - welcome message to set. If this is not provided the existing welcome
16 * CMDHELP: message is displayed.
17 * CMDHELP: Displaying the message requires operator (+o) access on the named channel.
18 * CMDHELP: Changing the message requires master (+m) access on the named channel.
21 #include "../chanserv.h"
22 #include "../../nick/nick.h"
23 #include "../../lib/flags.h"
24 #include "../../lib/irc_string.h"
25 #include "../../channel/channel.h"
26 #include "../../parser/parser.h"
27 #include "../../irc/irc.h"
28 #include "../../localuser/localuserchannel.h"
32 int csc_dowelcome(void *source
, int cargc
, char **cargv
) {
39 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "welcome");
43 if (!(cip
=cs_checkaccess(sender
, cargv
[0], CA_OPPRIV
, NULL
, "welcome",
44 QPRIV_VIEWWELCOME
, 0)))
47 rcp
=cip
->exts
[chanservext
];
50 if (!cs_checkaccess(sender
, NULL
, CA_MASTERPRIV
, cip
, "welcome",
51 QPRIV_CHANGEWELCOME
, 0))
54 oldwelcome
=rcp
->welcome
;
56 rcp
->welcome
=getsstring(cargv
[1], 500);
57 csdb_updatechannel(rcp
);
59 cs_log(sender
,"WELCOME %s %s (was %s)",cip
->name
->content
,rcp
->welcome
->content
,oldwelcome
?oldwelcome
->content
:"unset");
60 freesstring(oldwelcome
);
61 chanservstdmessage(sender
, QM_DONE
);
64 chanservstdmessage(sender
, QM_WELCOMEMESSAGEIS
, rcp
->index
->name
->content
,
65 rcp
->welcome
?rcp
->welcome
->content
:"(none)");