2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
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.
16 * IRC encoding commands
23 #include "conn-func.h"
25 #include "conn-encoding.h"
26 #include "irc-write.h"
32 #include "irc-encoding.h"
37 * Handler for the IRC+ "CHARCONV" command.
39 * @param Client The client from which this command has been received.
40 * @param Req Request structure with prefix and all parameters.
41 * @returns CONNECTED or DISCONNECTED.
44 IRC_CHARCONV(CLIENT *Client, REQUEST *Req)
48 assert (Client != NULL);
52 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
53 Client_ID(Client), Req->command);
55 strlcpy(encoding, Req->argv[0], sizeof(encoding));
56 ngt_UpperStr(encoding);
58 if (!Conn_SetEncoding(Client_Conn(Client), encoding))
59 return IRC_WriteStrClient(Client, ERR_IP_CHARCONV_MSG,
60 Client_ID(Client), encoding);
62 return IRC_WriteStrClient(Client, RPL_IP_CHARCONV_MSG,
63 Client_ID(Client), encoding);