From e1bf53d90a54732f1bf55c598a50a12b0257cad6 Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 16 Jul 2016 09:31:33 -0400 Subject: [PATCH] handle status command --- BOB.cpp | 10 ++++++++++ BOB.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/BOB.cpp b/BOB.cpp index c074b53b..b241e740 100644 --- a/BOB.cpp +++ b/BOB.cpp @@ -545,6 +545,15 @@ namespace client else SendReplyError ("malformed"); } + + void BOBCommandSession::StatusCommandHandler (const char * operand, size_t len) + { + LogPrint (eLogDebug, "BOB: status ", operand); + if (m_Owner.FindDestination (operand)) + SendReplyOK ("") + else + SendReplyError ("no nickname has been set"); + } BOBCommandChannel::BOBCommandChannel (const std::string& address, int port): m_IsRunning (false), m_Thread (nullptr), @@ -570,6 +579,7 @@ namespace client m_CommandHandlers[BOB_COMMAND_CLEAR] = &BOBCommandSession::ClearCommandHandler; m_CommandHandlers[BOB_COMMAND_LIST] = &BOBCommandSession::ListCommandHandler; m_CommandHandlers[BOB_COMMAND_OPTION] = &BOBCommandSession::OptionCommandHandler; + m_CommandHandlers[BOB_COMMAND_STATUS] = &BOBCommandSession::StatusCommandHandler; } BOBCommandChannel::~BOBCommandChannel () diff --git a/BOB.h b/BOB.h index a6a6fa11..7e6696a7 100644 --- a/BOB.h +++ b/BOB.h @@ -36,6 +36,7 @@ namespace client const char BOB_COMMAND_CLEAR[] = "clear"; const char BOB_COMMAND_LIST[] = "list"; const char BOB_COMMAND_OPTION[] = "option"; + const char BOB_COMMAND_STATUS[] = "status"; const char BOB_VERSION[] = "BOB 00.00.10\nOK\n"; const char BOB_REPLY_OK[] = "OK %s\n"; @@ -170,6 +171,7 @@ namespace client void ClearCommandHandler (const char * operand, size_t len); void ListCommandHandler (const char * operand, size_t len); void OptionCommandHandler (const char * operand, size_t len); + void StatusCommandHandler (const char * operand, size_t len); private: