Skip to content

Commit

Permalink
middle save, nearly done
Browse files Browse the repository at this point in the history
  • Loading branch information
haelime committed Apr 8, 2024
1 parent 149abf0 commit 05ab3d3
Show file tree
Hide file tree
Showing 5 changed files with 735 additions and 454 deletions.
7 changes: 5 additions & 2 deletions include/Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Server

// Try parse RecvMsg
// ClientData Does NOTHING about this recvMsg, only server will handle it.
bool parseReceivedRequestFromClientData(SOCKET_FD client);
bool parseReceivedRequestFromClientData(ClientData *client);

void executeParsedMessages(ClientData* clientData);
bool isValidMessage(const Message& message) const;
Expand All @@ -69,6 +69,9 @@ class Server

void logMessage(const Message &message) const;

void sendChannelJoinSucessMessageToClientData(ClientData *clientData, Channel *channel);
void sendMessagetoChannel(Channel* channel, const Message& message);

private: // server network data
SOCKET_FD mServerListenSocket;
sockaddr_in mServerAddress;
Expand All @@ -87,7 +90,7 @@ class Server
std::map<std::string, ClientData*> mNickToClientGlobalMap;
std::map<std::string, Channel*> mNameToChannelGlobalMap;

std::queue<SOCKET_FD> mClientRecvProcessQueue;
std::queue<SOCKET_FD> mRecvedStrPerClientDataProcessQueue;

time_t mServerStartTime;
time_t mServerLastPingTime; //< to kick if not received in 2 seconds
Expand Down
1 change: 1 addition & 0 deletions include/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ typedef std::string ERROR_NUM_STRING;
#define RPL_MOTDSTART "375"
#define RPL_ENDOFMOTD "376"

#define ERR_USERONCHANNEL "443"
2 changes: 1 addition & 1 deletion include/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum Command
INVITE,
TOPIC,
MODE,
NOTICE, // <- it's similar with PRIVMSG. no need to implement but, just in case
NOTICE, // <- it's similar with PRIVMSG. but only for server to client.
};

struct Message
Expand Down
Loading

0 comments on commit 05ab3d3

Please sign in to comment.