Util merge-age

This commit is contained in:
Thulinma 2011-10-17 08:42:26 +02:00
commit 72278f28b8
4 changed files with 42 additions and 9 deletions

View file

@ -1,4 +1,4 @@
SRC = main.cpp ../util/json/json_reader.cpp ../util/json/json_value.cpp ../util/json/json_writer.cpp ../util/socket.cpp ../util/http_parser.cpp ../util/md5.cpp
SRC = main.cpp ../util/json/json_reader.cpp ../util/json/json_value.cpp ../util/json/json_writer.cpp ../util/socket.cpp ../util/http_parser.cpp ../util/md5.cpp ../util/util.cpp
OBJ = $(SRC:.cpp=.o)
OUT = DDV_Controller
INCLUDES =

View file

@ -116,15 +116,15 @@ void CheckStreams(Json::Value & in, Json::Value & out){
if (in.isObject() && (in.size() > 0)){
for (Json::ValueIterator jit = in.begin(); jit != in.end(); jit++){
if (out.isObject() && out.isMember(jit.memberName())){
Log("CONF", std::string("Updated stream ")+jit.memberName(), Storage);
Log("STRM", std::string("Updated stream ")+jit.memberName(), Storage);
}else{
Log("CONF", std::string("New stream ")+jit.memberName(), Storage);
Log("STRM", std::string("New stream ")+jit.memberName(), Storage);
}
}
if (out.isObject() && (out.size() > 0)){
for (Json::ValueIterator jit = out.begin(); jit != out.end(); jit++){
if (!in.isMember(jit.memberName())){
Log("CONF", std::string("Deleted stream ")+jit.memberName(), Storage);
Log("STRM", std::string("Deleted stream ")+jit.memberName(), Storage);
}
}
}
@ -169,7 +169,7 @@ int main() {
if (it->Authorized){
//Parse config and streams from the request.
if (Request.isMember("config")){CheckConfig(Request["config"], Storage["config"]);}
//if (Request.isMember("streams")){CheckStreams(Request["streams"], Storage["streams"]);}
if (Request.isMember("streams")){CheckStreams(Request["streams"], Storage["streams"]);}
//sent current configuration, no matter if it was changed or not
//Response["streams"] = Storage["streams"];
Response["config"] = Storage["config"];