Closed ysengoku closed 3 weeks ago
This class has all ISUPPORT parameters defined in server.conf file:
CASEMAPPING=ascii CHANLIMIT=10 CHANMODES=i,t,k,l CHANNELLEN=50 CHANTYPES=# HOSTLEN=63 KICKLEN=255 MAXLIST=100 MAXTARGETS=4 MODES=3 NETWORK=42IRC NICKLEN=9 PREFIX=(o)@ TOPICLEN=307 USERLEN=10 USERMODES=ior These default values are from RFC1459(IRC 1993).
Add a global variable gConfig so that we can access to configuration from everywhere.
gConfig
USAGE (Arguments are examples.)
gConfig->getLimit("CHANLIMIT")
gConfig->getParam("NETWORK")
typedef std::map<int, Client*>
Usage:
/PING
PING token
PING hello
int fd, const std::string &nick
const Client &client
make debug
getNickName()
getNickname()
std::string _type
std::string _nameWithPrefix
REG_CHAN "#"
PUBLIC_CHAN "="
CHAN_OP "@"
void Server::acceptNewClient()
Previous version
Client cli(); cli.setFd(newClientFd); cli.setIp(inet_ntoa(cliadd.sin_addr));
Update
std::string clientIp = inet_ntoa(cliadd.sin_addr); struct hostent* host = gethostbyaddr(&cliadd.sin_addr, sizeof(cliadd.sin_addr), AF_INET); std::string hostName; if (host->h_name == NULL || sizeof(host->h_name) == 0 || static_cast<size_t> (host->h_length) > gConfig->getLimit("HOSTLEN")) hostName = clientIp; else hostName = host->h_name; Client cli(newClientFd, clientIp, hostName);
Config class
This class has all ISUPPORT parameters defined in server.conf file:
Add a global variable
gConfig
so that we can access to configuration from everywhere.USAGE (Arguments are examples.)
gConfig->getLimit("CHANLIMIT")
gConfig->getParam("NETWORK")
Channel class
typedef std::map<int, Client*>
and related function. We should use pointer to avoid to duplicate Client instance.PING command
Usage:
/PING
without argumentsPING token
(e.g.PING hello
)Other updates
numericReplies
int fd, const std::string &nick
toconst Client &client
make debug
.Client class
getNickName()
togetNickname()
Channel class
std::string _type
andstd::string _nameWithPrefix
REG_CHAN "#"
,PUBLIC_CHAN "="
andCHAN_OP "@"
Server class
void Server::acceptNewClient()
as following: Add host name setting Update Client instance creation timing (After host name setting so that we can call Client constructor with arguments)Previous version
Update