split lines before commands dispatch + irssi recev code 001 + command PING ok-tiers
This commit is contained in:
parent
d52b0cc3c2
commit
e88d706ae0
4 changed files with 43 additions and 24 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/12 13:24:55 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/14 23:25:45 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
using namespace cmd;
|
||||
|
||||
e_code Ping::checkArgs() {
|
||||
if (_args.size() < 3) {
|
||||
if (_args.size() < 2) {
|
||||
WARNING_MSG("Not enough arguments for PING command");
|
||||
return ERR_NEEDMOREPARAMS;
|
||||
}
|
||||
|
|
@ -32,11 +32,10 @@ e_code Ping::checkArgs() {
|
|||
*/
|
||||
|
||||
void Ping::execute() {
|
||||
clock_t start = clock() / CLOCKS_PER_SEC;
|
||||
if (checkArgs() != _PARSING_OK) {
|
||||
ERROR_MSG("Invalid arguments for PRIVMSG command (see warning message)");
|
||||
return;
|
||||
}
|
||||
clock_t diff = Pong().answer(start);
|
||||
INFO_MSG(diff);
|
||||
_sender->appendToWriteBuffer("PONG " + _args[1] + "\r\n");
|
||||
DEBUG_MSG(_sender->getWriteBuffer());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue