Commit 563e289c authored by Dominik Charousset's avatar Dominik Charousset

Fix group_chat example

parent 41888dc5
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <iostream> #include <iostream>
#include "caf/all.hpp" #include "caf/all.hpp"
#include "caf/io/all.hpp"
// the options_description API is deprecated // the options_description API is deprecated
#include "cppa/opt.hpp" #include "cppa/opt.hpp"
...@@ -101,8 +102,10 @@ int main(int argc, char** argv) { ...@@ -101,8 +102,10 @@ int main(int argc, char** argv) {
<< ", expected format: <module_name>:<group_id>"; << ", expected format: <module_name>:<group_id>";
} else { } else {
try { try {
auto g = group::get(group_id.substr(0, p), auto module = group_id.substr(0, p);
group_id.substr(p + 1)); auto group_uri = group_id.substr(p + 1);
auto g = (module == "remote") ? io::remote_group(group_uri)
: group::get(module, group_uri);
anon_send(client_actor, atom("join"), g); anon_send(client_actor, atom("join"), g);
} }
catch (exception& e) { catch (exception& e) {
...@@ -127,7 +130,9 @@ int main(int argc, char** argv) { ...@@ -127,7 +130,9 @@ int main(int argc, char** argv) {
match_each (lines, eof, split_line) ( match_each (lines, eof, split_line) (
on("/join", arg_match) >> [&](const string& mod, const string& id) { on("/join", arg_match) >> [&](const string& mod, const string& id) {
try { try {
anon_send(client_actor, atom("join"), group::get(mod, id)); group grp = (mod == "remote") ? io::remote_group(id)
: group::get(mod, id);
anon_send(client_actor, atom("join"), grp);
} }
catch (exception& e) { catch (exception& e) {
cerr << "*** exception: " << to_verbose_string(e) << endl; cerr << "*** exception: " << to_verbose_string(e) << endl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment