]> jfr.im git - irc/quakenet/newserv.git/blame - carrot/carrot.c
Began manual merge.
[irc/quakenet/newserv.git] / carrot / carrot.c
CommitLineData
c86edd1d
Q
1#include "../control/control.h"
2#include "../nick/nick.h"
3#include "../channel/channel.h"
4
5int ca_carrot(void *source, int cargc, char **cargv) {
6 nick *sender=(nick *)source;
7 nick *victim;
8 channel *cp;
9
3e3692bf
CP
10 if (cargc<1)
11 return CMD_USAGE;
c86edd1d
Q
12
13 if ((victim=getnickbynick(cargv[0]))!=NULL) {
14 controlreply(victim,"%cACTION ger %s en morot%c",1,victim->nick,1);
15 controlreply(sender,"Gave %s a carrot.",victim->nick);
16 } else if ((cp=findchannel(cargv[0]))!=NULL) {
17 if (cargc>1) {
18 controlchanmsg(cp,"%cACTION ger %s en morot%c",1,cargv[1],1);
19 } else {
20 controlchanmsg(cp,"%cACTION waves a carrot around menacingly.%c",1,1);
21 }
22
23 controlreply(sender,"Used carrot in %s.",cp->index->name->content);
24 } else {
25 controlreply(sender,"Couldn't find %s.",cargv[0]);
c86edd1d
Q
26 }
27
28 return CMD_OK;
29}
30
31void _init() {
3e3692bf 32 registercontrolhelpcmd("carrot",NO_OPERED,2,ca_carrot,"Usage: carrot <#channel|user> ?user?");
c86edd1d
Q
33}
34
35void _fini() {
36 deregistercontrolcmd("carrot",ca_carrot);
37}
38