Skip to content

Commit

Permalink
Cleanup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ria9993 committed Apr 8, 2024
1 parent 0d9915b commit b9748c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
12 changes: 7 additions & 5 deletions Source/Server/IrcReplies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ namespace IRC
{

// ---------------------------------------------------------------------------------------------------------------------------------------------------
/** Tuple of the IRC replies | IRC_REPLY_X (reply_code, reply_number, (arguments), (reply_string)) */
/**
* @def IRC_REPLY_TUPLE_LIST
* @brief Tuple of the IRC replies | IRC_REPLY_X (reply_code, reply_number, (arguments), (reply_string))
*/
#define IRC_REPLY_TUPLE_LIST \
IRC_REPLY_X(ERR_NOSUCHNICK , 401, (PARM_X, std::string nickname) , (nickname + " :No such nick/channel")) \
IRC_REPLY_X(ERR_NOSUCHSERVER , 402, (PARM_X, std::string server_name) , (server_name + " :No such server")) \
Expand Down Expand Up @@ -43,17 +46,16 @@ typedef enum {
{ \
outReplyMsg = ":" + serverName + " " + #reply_number + " " + reply_string; \
outReplyCode = reply_code; \
}
} \


#define PARM_X \
EIrcReplyCode& outReplyCode,\
std::string& outReplyMsg, \
std::string serverName

/**
* @name Reply message making functions
* @defgroup ReplyMsgMakingFunctions Reply message making functions
*
* @defgroup ReplyMsgMakingFunctions Reply message making functions
* @brief MakeIrcReplyMsg_<reply_code> functions.
*/
///@{
Expand Down
11 changes: 6 additions & 5 deletions Source/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,21 +498,22 @@ EIrcErrorCode Server::processClientMsg(SharedPtr<ClientControlBlock> client, Sha
const size_t numClientCommandFunc = sizeof(clientCommandFuncPairs) / sizeof(clientCommandFuncPairs[0]);

// Find the matching command
ClientCommandFuncPtr pCoresspondingFunc = NULL;
ClientCommandFuncPtr pCommandExecFunc = NULL;
for (size_t i = 0; i < numClientCommandFunc; i++)
{
if (std::strcmp(msgCommandToken, clientCommandFuncPairs[i].command) == 0)
{
Assert(pCoresspondingFunc == NULL);
pCoresspondingFunc = clientCommandFuncPairs[i].func;
Assert(pCommandExecFunc == NULL);
pCommandExecFunc = clientCommandFuncPairs[i].func;
break;
}
}

EIrcReplyCode replyCode;
std::string replyMsg;
{
// Unknown command name
if (pCoresspondingFunc == NULL)
if (pCommandExecFunc == NULL)
{
const std::string serverName = InetAddrToString(client->Addr);
MakeIrcReplyMsg_ERR_UNKNOWNCOMMAND(replyCode, replyMsg, serverName, msgCommandToken);
Expand All @@ -522,7 +523,7 @@ EIrcErrorCode Server::processClientMsg(SharedPtr<ClientControlBlock> client, Sha
// Otherwise, execute the command
else
{
EIrcErrorCode err = (this->*pCoresspondingFunc)(client, msgArgTokens, replyCode, replyMsg);
EIrcErrorCode err = (this->*pCommandExecFunc)(client, msgArgTokens, replyCode, replyMsg);
if (UNLIKELY(err != IRC_SUCCESS))
{
return err;
Expand Down

0 comments on commit b9748c7

Please sign in to comment.