nicknamemohaji / ft_irc

42cursus irc
0 stars 0 forks source link

JOIN Command Flow #7

Closed alsksssass closed 1 month ago

alsksssass commented 2 months ago

IRC JOIN 명령어 코딩 시나리오

목적

IRC 프로토콜의 JOIN 명령어를 구현하여 사용자가 채널에 참여할 수 있도록 합니다.

에러 처리

코드 진행 순서

  1. 파싱 에러 처리 (에러 시 461)
  2. 채널 존재 확인 (403)
  3. 사용자의 채널 가입 횟수 확인 (405)
  4. 채널 비밀번호 확인 (475)
  5. 사용자 밴 여부 확인 (474)
  6. 채널 내 사용자 수 확인 (471)
  7. 초대 모드 확인 (473)
  8. 채널 클래스에 채널 추가 (신규 채널인 경우)
  9. 클라이언트 클래스에 채널 추가
  10. 성공 시 진입 메시지 출력
    • RPL_TOPIC (332) 또는 RPL_NOTOPIC (331)
    • RPL_TOPICWHOTIME (333) (수정시간과 수정한 유저닉 전송)
    • RPL_NAMREPLY (353)
    • RPL_ENDOFNAMES (366)

추가해야 할 메소드

Server 클래스

class Server {
 public:
  std::vector<std::string> ParseComma(const std::string& str);
  bool CheckChannelInServer(const std::string& channel_name);
  std::string GetUserListInChannel(const std::string& channel_name);
  // ...
};

Client 클래스

class Client {
 public:
  bool CheckPossibleToJoin();
  // ...
};

Channel 클래스

class Channel {
 public:
  void AddUserInChannel(const std::string& nickname);
  std::string GetTopic();
  std::string GetTopicEditTime();
  // ...
};

메소드 설명

Context::ParseComma

Server::IsChannelInList

Server::GetChannel

Server::GetUserListInChannel

Client::CheckPossibleToJoin

Channel::AddUserInChannel

Channel::GetTopic

Channel::GetTopicEditTime

주의사항

향후 개선 사항

alsksssass commented 2 months ago

서버클래스에서 채널을 생성하여 리스트에 추가하는 메소드 작성