diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-04-09 17:58:52 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-19 00:06:02 +0200 |
commit | 16f091d587d6e16cecb468e041e4a2f138901be0 (patch) | |
tree | 328fd2626a5ddf8047baad69f5d8e63e33e4f608 | |
parent | 2de27d958eb3160b36df218b25c36455d5b5a0e3 (diff) |
Add output when login/register
m--------- | depends/dchat_core | 0 | ||||
-rw-r--r-- | src/main.cpp | 14 |
2 files changed, 10 insertions, 4 deletions
diff --git a/depends/dchat_core b/depends/dchat_core -Subproject 6b46f7eccda2fd415727f731f655c6f03d9f9be +Subproject f8ec6a14e0c7b3b6da4bbde441242e999a487df 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<string> &args) + Command::add("login", [&channelMessageMutex, &addSystemMessage](const vector<string> &args) { lock_guard<recursive_mutex> 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<string> &args) + Command::add("register", [&channelMessageMutex, &addSystemMessage](const vector<string> &args) { lock_guard<recursive_mutex> 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) { |