1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center.
4 * Copyright (C) 1996-2002 Hybrid Development Team.
5 * Copyright (C) 2002-2005 ircd-ratbox development team.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin St - Fifth Floor
22 * Boston, MA 02110-1301
30 #include "irc_string.h"
42 static int m_away (struct Client
*, struct Client
*, int, const char **);
44 /* {{{ static struct Message away_msgtab = { ... } */
45 static struct Message away_msgtab
=
47 "AWAY", 0, 0, 0, MFLG_SLOW
,
49 mg_unreg
, {m_away
, 0}, {m_away
, 0},
50 mg_ignore
, mg_ignore
, {m_away
, 0},
55 /* {{{ static mapi_clist_av1 away_clist[] = { ... } */
56 static mapi_clist_av1 away_clist
[] =
63 /* {{{ DECLARE_MODULE_AV1(...) */
76 /* {{{ static int m_away()
78 * AWAY message handler.
84 * parv[1] - message, or nothing
87 m_away (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
92 if (!IsClient(source_p
))
94 if (MyClient(source_p
) && !IsFloodDone(source_p
))
95 flood_endgrace(source_p
);
97 away
= source_p
->user
->away
;
98 if (parc
< 2 || EmptyString(parv
[1]))
102 sendto_server(client_p
, NULL
, CAP_TS6
, NOCAPS
,
103 ":%s AWAY", use_id(source_p
));
104 sendto_server(client_p
, NULL
, NOCAPS
, CAP_TS6
,
105 ":%s AWAY", source_p
->name
);
108 source_p
->user
->away
= NULL
;
111 if (MyConnect(source_p
))
112 sendto_one(source_p
, form_str(RPL_UNAWAY
), me
.name
,
118 if (MyConnect(source_p
))
120 if (!IsOper(source_p
) &&
121 (CurrentTime
- source_p
->localClient
->last_away
) < ConfigFileEntry
.pace_wait
)
123 sendto_one(source_p
, form_str(RPL_LOAD2HI
), me
.name
,
124 source_p
->name
, "AWAY");
128 source_p
->localClient
->last_away
= CurrentTime
;
131 away2
= LOCAL_COPY(parv
[1]);
132 if (strlen(away2
) > AWAYLEN
)
133 away2
[AWAYLEN
] = '\0';
137 sendto_server(client_p
, NULL
, CAP_TS6
, NOCAPS
, ":%s AWAY :%s",
138 use_id(source_p
), away2
);
139 sendto_server(client_p
, NULL
, NOCAPS
, CAP_TS6
, ":%s AWAY :%s",
140 source_p
->name
, away2
);
145 DupString(away
, away2
);
146 source_p
->user
->away
= away
;
148 if (MyConnect(source_p
))
149 sendto_one(source_p
, form_str(RPL_NOWAWAY
), me
.name
,
157 * vim: ts=8 sw=8 noet fdm=marker tw=80