Add support for the streaming event “filters_changed”.

This commit is contained in:
tastytea 2019-09-20 02:52:56 +02:00
parent f8ed45dcc4
commit 14d2e53cfc
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 9 additions and 5 deletions

View File

@ -53,7 +53,8 @@ const vector<Easy::stream_event_type> Easy::parse_stream(
const std::string &streamdata)
{
string stream = streamdata;
std::regex reevent("event: (update|notification|delete|ERROR)\ndata: (.*)\n");
std::regex reevent("event: (update|notification|delete|filters_changed"
"|ERROR)\ndata: (.*)\n");
std::smatch match;
std::vector<stream_event_type> vec = {};
@ -63,14 +64,16 @@ const vector<Easy::stream_event_type> Easy::parse_stream(
const string &data = match[2].str();
event_type type = event_type::Undefined;
if (event.compare("update") == 0)
if (event == "update")
type = event_type::Update;
else if (event.compare("notification") == 0)
else if (event == "notification")
type = event_type::Notification;
else if (event.compare("delete") == 0)
else if (event == "delete")
type = event_type::Delete;
else if (event.compare("ERROR") == 0)
else if (event == "ERROR")
type = event_type::Error;
else if (event == "filters_changed")
type = event_type::Filters_changed;
vec.push_back({ type, data });
stream = match.suffix().str();

View File

@ -41,6 +41,7 @@ namespace Easy
Notification,
Delete,
Error,
Filters_changed,
Undefined
};