Changeset a87ce04 in nscp for service/NSClient++.cpp
- Timestamp:
- 01/08/12 22:29:34 (18 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 7354aa1
- Parents:
- 81a6048
- File:
-
- 1 edited
-
service/NSClient++.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
service/NSClient++.cpp
rf085f9b ra87ce04 1207 1207 } 1208 1208 int query_helper(NSClientT::plugin_type plugin, std::wstring command, std::vector<std::wstring> arguments, std::string request, std::list<std::string> *responses) { 1209 std::string response; 1210 if (!plugin->hasCommandHandler()) 1211 return NSCAPI::returnIgnored; 1212 int ret = plugin->handleCommand(command.c_str(), request, response); 1213 if (ret != NSCAPI::returnIgnored && !response.empty()) 1214 responses->push_back(response); 1215 return ret; 1209 return NSCAPI::returnIgnored; 1210 // std::string response; 1211 // if (!plugin->hasCommandHandler()) 1212 // return NSCAPI::returnIgnored; 1213 // int ret = plugin->handleCommand(command.c_str(), request, response); 1214 // if (ret != NSCAPI::returnIgnored && !response.empty()) 1215 // responses->push_back(response); 1216 // return ret; 1216 1217 } 1217 1218 … … 1223 1224 int ret = load_and_run(module, boost::bind(&query_helper, _1, command, arguments, request, &responses), errors); 1224 1225 1225 BOOST_FOREACH(std::string &r, responses) { 1226 try { 1227 std::wstring msg, perf; 1228 nscapi::functions::parse_simple_query_response(r, msg, perf); 1229 resp.push_back(msg + _T("|") + perf); 1230 } catch (std::exception &e) { 1231 resp.push_back(_T("Failed to extract return message: ") + utf8::cvt<std::wstring>(e.what())); 1232 LOG_ERROR_CORE_STD(resp.back()); 1233 return NSCAPI::returnUNKNOWN; 1234 } 1226 nsclient::commands::plugin_type plugin = commands_.get(command); 1227 if (!plugin) { 1228 LOG_ERROR_CORE(_T("No handler for command: ") + command + _T(" avalible commands: ") + commands_.to_wstring()); 1229 return NSCAPI::returnUNKNOWN; 1230 } 1231 std::string response; 1232 NSCAPI::nagiosReturn c = plugin->handleCommand(command.c_str(), request, response); 1233 try { 1234 std::wstring msg, perf; 1235 nscapi::functions::parse_simple_query_response(response, msg, perf); 1236 resp.push_back(msg + _T("|") + perf); 1237 } catch (std::exception &e) { 1238 resp.push_back(_T("Failed to extract return message: ") + utf8::cvt<std::wstring>(e.what())); 1239 LOG_ERROR_CORE_STD(resp.back()); 1240 return NSCAPI::returnUNKNOWN; 1235 1241 } 1236 1242 BOOST_FOREACH(const std::wstring &e, errors) {
Note: See TracChangeset
for help on using the changeset viewer.








