<aside> 💡 Using your reference client with your server must be similar to using it with any official IRC server. However, you only have to implement the following features:
enum{
FORMATERR = -4, /* wrong msg format (:) */
WRONGARG = -3, /* wrong argument number */
INVAILDCMD = -2,
EMPTY = -1, /* no cmd or no argu */
NOTICE, /* arg : 2 */
JOIN, /* arg : 1 channels delimeter : ',' */
NICK, /* arg : 1 nickname */
QUIT, /* arg : 0,1 [reason] */
PRIVMSG, /* arg : 2 "ch or user" :msg delimeter : ',' */
KICK, /* arg : 2~3 username [reason] */
PART, /* arg : 1 delimeter : ',' channel */
PASS, /* arg : 1 password */
USER, /* arg : 4 username hostname servername realname */
CAP, // 서버에서 구분용, 구현 필요는 없다.
};
command 기본적인 형태
based on irc 1459
it should be shaped of "jujeon PRIVMSG :#999 :kick #123 hello"
notice : <nickname> <text>
:[email protected] NOTICE root_ :hi
join <channel>[,<channel>]:
: [email protected] JOIN :#999
nick <nickname> :
:[email protected] NICK :hello
quit [<Quit message>] :
:[email protected] QUIT :Quit: leaving
or
:[email protected] QUIT :Quit: reason
or
ERROR :Closing link: ([email protected]) [Quit: leaving]
or
ERROR :Closing link: ([email protected]) [Quit: meesage]
privmsg <receiver>{,<receiver>} <text to be sent> :
:[email protected] PRIVMSG #123 :hi
kick <channel> <user> :
:[email protected] PRIVMSG #123 :kick #123 hello
part <channel>[,<channel>] [:reason] :
pass : <password>
user : <username> <hostname> <servername> <realname>
ERROR SITUATION
(1-r) :irc.local 461 jujeon PART :Not enough parameters.
전체 커맨드 공통
:irc.local 461 jujeon JOIN :Not enough parameters.
if param doesnot exist 461 "<command> :Not enough parameters"
421 ERR_UNKNOWNCOMMAND "<command> :Unknown command"
451 ERR_NOTREGISTERED ":You have not registered"
notice:
<nickname> <text>
user1 :msg
:irc.local 401 jujeon nickname :No such nick
401 ERR_NOSUCHNICK " <nickname>: No such (user1)nick/channel"
#channel :msg
404 ERR_CANNOTSENDTOCHAN "<channel name> :Cannot send to channel"
(notice 는 채널에 보내기안돼)
join :
join 123
:irc.local 476 jujeon 123 :Invalid channel name
ERR_BADCHANMASK (476) "<channel> :Bad Channel Mask"
nick :
:irc.local 433 jujeon root :Nickname is already in use.
:irc.local 432 jujeon *juje :Erroneous Nickname
433 ERR_NICKNAMEINUSE "<nick> :Nickname is already in use"
432 ERR_ERRONEUSNICKNAME "<nick> :Erroneus nickname"
quit :
there is no error number
privmsg:
user1,user1 :msg
407 ERR_TOOMANYTARGETS "<target> :Duplicate recipients. No message delivered"
:irc.local 401 jujeon j :No such nick
401 ERR_NOSUCHNICK " <nickname>: No such (user1)nick/channel"
#channel :msg
:irc.local 404 jujeon #123 :You cannot send external messages to this channel whilst the +n (noextmsg) mode is set.
404 ERR_CANNOTSENDTOCHAN " <#channel> : "
user1 :msg
412 ERR_NOTEXTTOSEND ":No text to send"
part :
:irc.local 403 jujeon #hi :No such channel
403 ERR_NOSUCHCHANNEL "<channel name> :No such channel"
:irc.local 442 jujeon #11 :You're not on that channel
442 ERR_NOTONCHANNEL "<channel> :You're not on that channel"
user: <username> <hostname> <servername> <realname>
:irc.local 462 jujeon :You may not reregister
462 ERR_ALREADYREGISTRED ":You may not reregister"
한번 등록되면 등록안됌
- Returned by the server to any link which tries to
change part of the registered details (such as
password or user details from second USER message).
pass: <password>
user와 동일
kick:
ERR_NOSUCHCHANNEL: 채널 존재하지 않음
:irc.local 403 jujeon #11 :No such channel
- 403 <channel name> :No such channel
ERR_BADCHANMASK: 잘못된 채널 마스크
- 476 <nickname> ERR_BADCHANMASK #channel :Bad Channel Mask
ERR_CHANOPRIVSNEEDED: 채널 관리자 권한 없음
:irc.local 482 root #123 :You must be a channel operator
- 482 <channel> :You're not channel operator
ERR_NOTONCHANNEL: 채널에 속하지 않음
- 442 <channel> :You're not on that channel
인자가 모자란 경우만 에러코드를 넘겨준다. 나머지 경우만 실행부에서 판단후 에러메세지 띄워야하지 않을까?
그럼 우리는 인자가 모자란 에러코드 경우만 추려야한다.