From 16f091d587d6e16cecb468e041e4a2f138901be0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Apr 2019 17:58:52 +0200 Subject: Add output when login/register --- src/main.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 2be28b2..1ae5eb6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -211,7 +211,7 @@ int main(int argc, char **argv) }; // Login to account - Command::add("login", [&channelMessageMutex](const vector &args) + Command::add("login", [&channelMessageMutex, &addSystemMessage](const vector &args) { lock_guard lock(channelMessageMutex); if(args.size() != 2) @@ -227,7 +227,10 @@ int main(int argc, char **argv) try { rooms->loginUser(args[0], args[1]); - printf("Successfully logged into user %s\n", args[0].c_str()); + std::string msg = "Successfully logged into user "; + msg += args[0]; + addSystemMessage(msg); + printf("%s\n", msg.c_str()); } catch(std::exception &e) { @@ -236,7 +239,7 @@ int main(int argc, char **argv) }); // Register account - Command::add("register", [&channelMessageMutex](const vector &args) + Command::add("register", [&channelMessageMutex, &addSystemMessage](const vector &args) { lock_guard lock(channelMessageMutex); if(args.size() != 2) @@ -252,7 +255,10 @@ int main(int argc, char **argv) try { rooms->registerUser(args[0], args[1]); - printf("Successfully registered user %s\n", args[0].c_str()); + std::string msg = "Successfully registered user "; + msg += args[0]; + addSystemMessage(msg); + printf("%s\n", msg.c_str()); } catch(odhtdb::SqlExecException &e) { -- cgit v1.2.3