]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/irc-encoding.c
Re-add #include's for header files of the C file itself
[ngircd-alex.git] / src / ngircd / irc-encoding.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #include "portab.h"
13
14 /**
15  * @file
16  * IRC encoding commands
17  */
18
19 #ifdef ICONV
20
21 #include <assert.h>
22 #include <string.h>
23
24 #include "conn-func.h"
25 #include "channel.h"
26 #include "conn-encoding.h"
27 #include "irc-write.h"
28 #include "messages.h"
29 #include "parse.h"
30 #include "tool.h"
31
32 #include "irc-encoding.h"
33
34 /**
35  * Handler for the IRC+ "CHARCONV" command.
36  *
37  * @param Client The client from which this command has been received.
38  * @param Req Request structure with prefix and all parameters.
39  * @returns CONNECTED or DISCONNECTED.
40  */
41 GLOBAL bool
42 IRC_CHARCONV(CLIENT *Client, REQUEST *Req)
43 {
44         char encoding[20];
45
46         assert (Client != NULL);
47         assert (Req != NULL);
48
49         strlcpy(encoding, Req->argv[0], sizeof(encoding));
50         ngt_UpperStr(encoding);
51
52         if (!Conn_SetEncoding(Client_Conn(Client), encoding))
53                 return IRC_WriteErrClient(Client, ERR_IP_CHARCONV_MSG,
54                                           Client_ID(Client), encoding);
55
56         return IRC_WriteStrClient(Client, RPL_IP_CHARCONV_MSG,
57                                   Client_ID(Client), encoding);
58 } /* IRC_CHARCONV */
59
60 #endif
61
62 /* -eof- */