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 --- depends/dchat_core | 2 +- src/main.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/depends/dchat_core b/depends/dchat_core index 6b46f7e..f8ec6a1 160000 --- a/depends/dchat_core +++ b/depends/dchat_core @@ -1 +1 @@ -Subproject commit 6b46f7eccda2fd415727f731f655c6f03d9f9be5 +Subproject commit f8ec6a14e0c7b3b6da4bbde441242e999a487dfc 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