2012-07-09 20:32:02 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2014-01-09 00:32:11 +01:00
|
|
|
* Copyright (C) 2012-present Icinga Development Team (http://www.icinga.org) *
|
2012-07-09 20:32:02 +02:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
#include "icinga/service.h"
|
2013-03-17 20:19:29 +01:00
|
|
|
#include "icinga/servicegroup.h"
|
2013-06-13 11:33:00 +02:00
|
|
|
#include "icinga/checkcommand.h"
|
2013-03-17 20:19:29 +01:00
|
|
|
#include "icinga/icingaapplication.h"
|
|
|
|
#include "icinga/macroprocessor.h"
|
2013-11-07 14:38:37 +01:00
|
|
|
#include "icinga/pluginutility.h"
|
2014-02-27 11:05:55 +01:00
|
|
|
#include "icinga/dependency.h"
|
2013-03-22 14:40:55 +01:00
|
|
|
#include "config/configitembuilder.h"
|
2013-03-16 21:18:53 +01:00
|
|
|
#include "base/dynamictype.h"
|
|
|
|
#include "base/objectlock.h"
|
2013-03-22 14:40:55 +01:00
|
|
|
#include "base/convert.h"
|
2013-03-25 18:36:15 +01:00
|
|
|
#include "base/utility.h"
|
2013-12-12 06:30:11 +01:00
|
|
|
#include "base/initialize.h"
|
2013-03-16 21:18:53 +01:00
|
|
|
#include <boost/foreach.hpp>
|
2013-09-01 06:01:27 +02:00
|
|
|
#include <boost/bind/apply.hpp>
|
2012-06-13 13:42:55 +02:00
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
2013-03-01 12:07:52 +01:00
|
|
|
REGISTER_TYPE(Service);
|
2012-07-26 12:28:29 +02:00
|
|
|
|
2013-08-29 13:48:18 +02:00
|
|
|
boost::signals2::signal<void (const Service::Ptr&, const String&, const String&, AcknowledgementType, double, const String&)> Service::OnAcknowledgementSet;
|
|
|
|
boost::signals2::signal<void (const Service::Ptr&, const String&)> Service::OnAcknowledgementCleared;
|
|
|
|
|
2013-12-12 06:30:11 +01:00
|
|
|
INITIALIZE_ONCE(&Service::StartDowntimesExpiredTimer);
|
|
|
|
|
2013-09-01 06:01:27 +02:00
|
|
|
Service::Service(void)
|
|
|
|
: m_CheckRunning(false)
|
|
|
|
{ }
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void Service::Start(void)
|
2013-02-26 10:13:54 +01:00
|
|
|
{
|
2013-11-28 20:56:21 +01:00
|
|
|
double now = Utility::GetTime();
|
|
|
|
|
|
|
|
if (GetNextCheck() < now + 300)
|
|
|
|
SetNextCheck(now + Utility::Random() % 300);
|
|
|
|
|
|
|
|
DynamicObject::Start();
|
2013-08-29 16:53:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Service::OnConfigLoaded(void)
|
|
|
|
{
|
2013-08-20 11:06:04 +02:00
|
|
|
Array::Ptr groups = GetGroups();
|
2013-02-20 19:52:25 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
if (groups) {
|
2013-09-09 13:52:37 +02:00
|
|
|
ObjectLock olock(groups);
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
BOOST_FOREACH(const String& name, groups) {
|
|
|
|
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
2012-08-02 09:38:08 +02:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
if (sg)
|
|
|
|
sg->AddMember(GetSelf());
|
|
|
|
}
|
|
|
|
}
|
2013-03-02 09:07:47 +01:00
|
|
|
|
2013-11-10 22:04:18 +01:00
|
|
|
m_Host = Host::GetByName(GetHostRaw());
|
|
|
|
|
|
|
|
if (m_Host)
|
|
|
|
m_Host->AddService(GetSelf());
|
2013-08-29 16:53:57 +02:00
|
|
|
|
|
|
|
UpdateSlaveNotifications();
|
2013-11-13 14:56:31 +01:00
|
|
|
UpdateSlaveScheduledDowntimes();
|
2014-02-27 11:05:55 +01:00
|
|
|
UpdateSlaveDependencies();
|
2013-11-21 16:09:21 +01:00
|
|
|
|
|
|
|
SetSchedulingOffset(Utility::Random());
|
2013-01-24 15:01:06 +01:00
|
|
|
}
|
|
|
|
|
2013-11-13 14:56:31 +01:00
|
|
|
void Service::OnStateLoaded(void)
|
|
|
|
{
|
|
|
|
AddDowntimesToCache();
|
|
|
|
AddCommentsToCache();
|
|
|
|
|
|
|
|
std::vector<String> ids;
|
|
|
|
Dictionary::Ptr downtimes = GetDowntimes();
|
|
|
|
|
|
|
|
{
|
|
|
|
ObjectLock dlock(downtimes);
|
|
|
|
BOOST_FOREACH(const Dictionary::Pair& kv, downtimes) {
|
|
|
|
Downtime::Ptr downtime = kv.second;
|
|
|
|
|
|
|
|
if (downtime->GetScheduledBy().IsEmpty())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ids.push_back(kv.first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOST_FOREACH(const String& id, ids) {
|
|
|
|
RemoveDowntime(id, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-08 15:38:22 +01:00
|
|
|
Service::Ptr Service::GetByNamePair(const String& hostName, const String& serviceName)
|
|
|
|
{
|
|
|
|
if (!hostName.IsEmpty()) {
|
|
|
|
Host::Ptr host = Host::GetByName(hostName);
|
2013-02-27 15:23:25 +01:00
|
|
|
|
|
|
|
if (!host)
|
|
|
|
return Service::Ptr();
|
|
|
|
|
2013-03-02 09:07:47 +01:00
|
|
|
return host->GetServiceByShortName(serviceName);
|
2013-02-08 15:38:22 +01:00
|
|
|
} else {
|
|
|
|
return Service::GetByName(serviceName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-27 16:05:02 +02:00
|
|
|
Host::Ptr Service::GetHost(void) const
|
2012-06-13 13:42:55 +02:00
|
|
|
{
|
2013-11-10 22:04:18 +01:00
|
|
|
return m_Host;
|
2013-02-08 15:38:22 +01:00
|
|
|
}
|
|
|
|
|
2013-07-09 16:59:31 +02:00
|
|
|
bool Service::IsHostCheck(void) const
|
|
|
|
{
|
|
|
|
ASSERT(!OwnsLock());
|
|
|
|
|
2013-09-25 09:12:15 +02:00
|
|
|
Service::Ptr hc = GetHost()->GetCheckService();
|
2013-07-09 16:59:31 +02:00
|
|
|
|
|
|
|
if (!hc)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return (hc->GetName() == GetName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-01-23 13:21:07 +01:00
|
|
|
AcknowledgementType Service::GetAcknowledgement(void)
|
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(OwnsLock());
|
2013-03-06 11:03:50 +01:00
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
AcknowledgementType avalue = static_cast<AcknowledgementType>(GetAcknowledgementRaw());
|
2013-01-23 13:21:07 +01:00
|
|
|
|
|
|
|
if (avalue != AcknowledgementNone) {
|
|
|
|
double expiry = GetAcknowledgementExpiry();
|
|
|
|
|
|
|
|
if (expiry != 0 && expiry < Utility::GetTime()) {
|
|
|
|
avalue = AcknowledgementNone;
|
2013-08-29 13:48:18 +02:00
|
|
|
ClearAcknowledgement();
|
2013-01-23 13:21:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return avalue;
|
|
|
|
}
|
|
|
|
|
2013-02-11 16:38:16 +01:00
|
|
|
bool Service::IsAcknowledged(void)
|
|
|
|
{
|
|
|
|
return GetAcknowledgement() != AcknowledgementNone;
|
|
|
|
}
|
|
|
|
|
2013-08-29 13:48:18 +02:00
|
|
|
void Service::AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, double expiry, const String& authority)
|
2013-02-24 12:47:24 +01:00
|
|
|
{
|
2013-03-08 16:36:26 +01:00
|
|
|
{
|
|
|
|
ObjectLock olock(this);
|
2013-03-02 09:07:47 +01:00
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
SetAcknowledgementRaw(type);
|
|
|
|
SetAcknowledgementExpiry(expiry);
|
2013-03-08 16:36:26 +01:00
|
|
|
}
|
2013-02-24 12:47:24 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
OnNotificationsRequested(GetSelf(), NotificationAcknowledgement, GetLastCheckResult(), author, comment);
|
2013-08-29 13:48:18 +02:00
|
|
|
|
2013-11-10 16:53:57 +01:00
|
|
|
OnAcknowledgementSet(GetSelf(), author, comment, type, expiry, authority);
|
2013-02-24 12:47:24 +01:00
|
|
|
}
|
|
|
|
|
2013-08-29 13:48:18 +02:00
|
|
|
void Service::ClearAcknowledgement(const String& authority)
|
2013-02-24 12:47:24 +01:00
|
|
|
{
|
2013-08-29 13:48:18 +02:00
|
|
|
ASSERT(OwnsLock());
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
SetAcknowledgementRaw(AcknowledgementNone);
|
|
|
|
SetAcknowledgementExpiry(0);
|
2013-03-04 15:52:42 +01:00
|
|
|
|
2013-11-10 16:53:57 +01:00
|
|
|
OnAcknowledgementCleared(GetSelf(), authority);
|
2013-02-24 12:47:24 +01:00
|
|
|
}
|
|
|
|
|
2013-11-26 11:51:06 +01:00
|
|
|
bool Service::GetEnablePerfdata(void) const
|
|
|
|
{
|
|
|
|
if (!GetOverrideEnablePerfdata().IsEmpty())
|
|
|
|
return GetOverrideEnablePerfdata();
|
|
|
|
else
|
|
|
|
return GetEnablePerfdataRaw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Service::SetEnablePerfdata(bool enabled, const String& authority)
|
|
|
|
{
|
|
|
|
SetOverrideEnablePerfdata(enabled);
|
|
|
|
}
|
|
|
|
|
2013-10-16 11:46:54 +02:00
|
|
|
int Service::GetModifiedAttributes(void) const
|
|
|
|
{
|
|
|
|
int attrs = 0;
|
|
|
|
|
2013-11-26 11:18:05 +01:00
|
|
|
if (!GetOverrideEnableNotifications().IsEmpty())
|
|
|
|
attrs |= ModAttrNotificationsEnabled;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
if (!GetOverrideEnableActiveChecks().IsEmpty())
|
2013-10-16 11:46:54 +02:00
|
|
|
attrs |= ModAttrActiveChecksEnabled;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
if (!GetOverrideEnablePassiveChecks().IsEmpty())
|
2013-10-16 11:46:54 +02:00
|
|
|
attrs |= ModAttrPassiveChecksEnabled;
|
|
|
|
|
2013-11-26 11:34:33 +01:00
|
|
|
if (!GetOverrideEnableFlapping().IsEmpty())
|
|
|
|
attrs |= ModAttrFlapDetectionEnabled;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
if (!GetOverrideEnableEventHandler().IsEmpty())
|
2013-10-16 15:20:14 +02:00
|
|
|
attrs |= ModAttrEventHandlerEnabled;
|
|
|
|
|
2013-11-26 11:51:06 +01:00
|
|
|
if (!GetOverrideEnablePerfdata().IsEmpty())
|
|
|
|
attrs |= ModAttrPerformanceDataEnabled;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
if (!GetOverrideCheckInterval().IsEmpty())
|
2013-10-16 13:02:21 +02:00
|
|
|
attrs |= ModAttrNormalCheckInterval;
|
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
if (!GetOverrideRetryInterval().IsEmpty())
|
2013-10-16 13:02:21 +02:00
|
|
|
attrs |= ModAttrRetryCheckInterval;
|
|
|
|
|
2013-11-26 12:31:17 +01:00
|
|
|
if (!GetOverrideEventCommand().IsEmpty())
|
|
|
|
attrs |= ModAttrEventHandlerCommand;
|
|
|
|
|
2013-11-26 12:56:42 +01:00
|
|
|
if (!GetOverrideCheckCommand().IsEmpty())
|
|
|
|
attrs |= ModAttrCheckCommand;
|
|
|
|
|
2013-11-26 13:27:41 +01:00
|
|
|
if (!GetOverrideMaxCheckAttempts().IsEmpty())
|
|
|
|
attrs |= ModAttrMaxCheckAttempts;
|
|
|
|
|
2013-11-26 13:43:56 +01:00
|
|
|
if (!GetOverrideCheckPeriod().IsEmpty())
|
|
|
|
attrs |= ModAttrCheckTimeperiod;
|
|
|
|
|
2013-10-16 11:46:54 +02:00
|
|
|
// TODO: finish
|
|
|
|
|
|
|
|
return attrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Service::SetModifiedAttributes(int flags)
|
|
|
|
{
|
2013-11-26 11:18:05 +01:00
|
|
|
if ((flags & ModAttrNotificationsEnabled) == 0)
|
|
|
|
SetOverrideEnableNotifications(Empty);
|
|
|
|
|
2013-10-16 11:46:54 +02:00
|
|
|
if ((flags & ModAttrActiveChecksEnabled) == 0)
|
2013-10-26 09:41:45 +02:00
|
|
|
SetOverrideEnableActiveChecks(Empty);
|
2013-10-16 11:46:54 +02:00
|
|
|
|
|
|
|
if ((flags & ModAttrPassiveChecksEnabled) == 0)
|
2013-10-26 09:41:45 +02:00
|
|
|
SetOverrideEnablePassiveChecks(Empty);
|
2013-10-16 13:08:55 +02:00
|
|
|
|
2013-11-26 11:34:33 +01:00
|
|
|
if ((flags & ModAttrFlapDetectionEnabled) == 0)
|
|
|
|
SetOverrideEnableFlapping(Empty);
|
|
|
|
|
2013-10-16 15:20:14 +02:00
|
|
|
if ((flags & ModAttrEventHandlerEnabled) == 0)
|
2013-10-26 09:41:45 +02:00
|
|
|
SetOverrideEnableEventHandler(Empty);
|
2013-10-16 15:20:14 +02:00
|
|
|
|
2013-11-26 11:51:06 +01:00
|
|
|
if ((flags & ModAttrPerformanceDataEnabled) == 0)
|
|
|
|
SetOverrideEnablePerfdata(Empty);
|
|
|
|
|
2013-10-16 13:08:55 +02:00
|
|
|
if ((flags & ModAttrNormalCheckInterval) == 0)
|
2013-10-26 09:41:45 +02:00
|
|
|
SetOverrideCheckInterval(Empty);
|
2013-10-16 13:08:55 +02:00
|
|
|
|
|
|
|
if ((flags & ModAttrRetryCheckInterval) == 0)
|
2013-10-26 09:41:45 +02:00
|
|
|
SetOverrideRetryInterval(Empty);
|
2013-11-26 12:31:17 +01:00
|
|
|
|
|
|
|
if ((flags & ModAttrEventHandlerCommand) == 0)
|
|
|
|
SetOverrideEventCommand(Empty);
|
2013-11-26 12:56:42 +01:00
|
|
|
|
|
|
|
if ((flags & ModAttrCheckCommand) == 0)
|
|
|
|
SetOverrideCheckCommand(Empty);
|
2013-11-26 13:27:41 +01:00
|
|
|
|
|
|
|
if ((flags & ModAttrMaxCheckAttempts) == 0)
|
|
|
|
SetOverrideMaxCheckAttempts(Empty);
|
2013-11-26 13:43:56 +01:00
|
|
|
|
|
|
|
if ((flags & ModAttrCheckTimeperiod) == 0)
|
|
|
|
SetOverrideCheckPeriod(Empty);
|
2013-10-16 11:46:54 +02:00
|
|
|
}
|
|
|
|
|
2013-11-09 14:22:38 +01:00
|
|
|
bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const
|
2013-02-09 18:39:43 +01:00
|
|
|
{
|
2013-03-22 14:40:55 +01:00
|
|
|
if (macro == "SERVICEDESC") {
|
|
|
|
*result = GetShortName();
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICEDISPLAYNAME") {
|
|
|
|
*result = GetDisplayName();
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICECHECKCOMMAND") {
|
2013-06-13 11:33:00 +02:00
|
|
|
CheckCommand::Ptr commandObj = GetCheckCommand();
|
|
|
|
|
|
|
|
if (commandObj)
|
|
|
|
*result = commandObj->GetName();
|
|
|
|
else
|
|
|
|
*result = "";
|
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
return true;
|
2013-02-24 01:10:34 +01:00
|
|
|
}
|
2013-02-11 16:29:23 +01:00
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
if (macro == "SERVICESTATE") {
|
|
|
|
*result = StateToString(GetState());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICESTATEID") {
|
|
|
|
*result = Convert::ToString(GetState());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICESTATETYPE") {
|
|
|
|
*result = StateTypeToString(GetStateType());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICEATTEMPT") {
|
2013-10-26 09:41:45 +02:00
|
|
|
*result = Convert::ToString(GetCheckAttempt());
|
2013-03-22 14:40:55 +01:00
|
|
|
return true;
|
|
|
|
} else if (macro == "MAXSERVICEATTEMPT") {
|
|
|
|
*result = Convert::ToString(GetMaxCheckAttempts());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "LASTSERVICESTATE") {
|
|
|
|
*result = StateToString(GetLastState());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "LASTSERVICESTATEID") {
|
|
|
|
*result = Convert::ToString(GetLastState());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "LASTSERVICESTATETYPE") {
|
|
|
|
*result = StateTypeToString(GetLastStateType());
|
|
|
|
return true;
|
|
|
|
} else if (macro == "LASTSERVICESTATECHANGE") {
|
|
|
|
*result = Convert::ToString((long)GetLastStateChange());
|
|
|
|
return true;
|
2013-10-18 11:29:31 +02:00
|
|
|
} else if (macro == "SERVICEDURATIONSEC") {
|
|
|
|
*result = Convert::ToString((long)(Utility::GetTime() - GetLastStateChange()));
|
|
|
|
return true;
|
2013-10-18 11:40:46 +02:00
|
|
|
} else if (macro == "TOTALHOSTSERVICES" || macro == "TOTALHOSTSERVICESOK" || macro == "TOTALHOSTSERVICESWARNING"
|
|
|
|
|| macro == "TOTALHOSTSERVICESUNKNOWN" || macro == "TOTALHOSTSERVICESCRITICAL") {
|
|
|
|
int filter = -1;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
if (macro == "TOTALHOSTSERVICESOK")
|
|
|
|
filter = StateOK;
|
|
|
|
else if (macro == "TOTALHOSTSERVICESWARNING")
|
|
|
|
filter = StateWarning;
|
|
|
|
else if (macro == "TOTALHOSTSERVICESUNKNOWN")
|
|
|
|
filter = StateUnknown;
|
|
|
|
else if (macro == "TOTALHOSTSERVICESCRITICAL")
|
|
|
|
filter = StateCritical;
|
|
|
|
|
|
|
|
BOOST_FOREACH(const Service::Ptr& service, GetHost()->GetServices()) {
|
|
|
|
if (filter != -1 && service->GetState() != filter)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*result = Convert::ToString(count);
|
|
|
|
return true;
|
2013-03-22 14:40:55 +01:00
|
|
|
}
|
2013-03-15 13:29:41 +01:00
|
|
|
|
2013-02-11 16:29:23 +01:00
|
|
|
if (cr) {
|
2013-03-22 14:40:55 +01:00
|
|
|
if (macro == "SERVICELATENCY") {
|
|
|
|
*result = Convert::ToString(Service::CalculateLatency(cr));
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICEEXECUTIONTIME") {
|
|
|
|
*result = Convert::ToString(Service::CalculateExecutionTime(cr));
|
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICEOUTPUT") {
|
2013-11-09 14:22:38 +01:00
|
|
|
*result = cr->GetOutput();
|
2013-03-22 14:40:55 +01:00
|
|
|
return true;
|
|
|
|
} else if (macro == "SERVICEPERFDATA") {
|
2013-11-09 14:22:38 +01:00
|
|
|
*result = PluginUtility::FormatPerfdata(cr->GetPerformanceData());
|
2013-03-22 14:40:55 +01:00
|
|
|
return true;
|
|
|
|
} else if (macro == "LASTSERVICECHECK") {
|
2013-11-09 14:22:38 +01:00
|
|
|
*result = Convert::ToString((long)cr->GetExecutionEnd());
|
2013-03-22 14:40:55 +01:00
|
|
|
return true;
|
|
|
|
}
|
2013-02-11 16:29:23 +01:00
|
|
|
}
|
|
|
|
|
2013-12-18 10:53:26 +01:00
|
|
|
if (macro.SubStr(0, 8) == "_SERVICE") {
|
|
|
|
Dictionary::Ptr custom = GetCustom();
|
|
|
|
*result = custom ? custom->Get(macro.SubStr(8)) : "";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
Dictionary::Ptr macros = GetMacros();
|
2013-03-07 12:04:20 +01:00
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
if (macros && macros->Contains(macro)) {
|
|
|
|
*result = macros->Get(macro);
|
|
|
|
return true;
|
2013-03-07 12:04:20 +01:00
|
|
|
}
|
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
return false;
|
2013-03-07 12:04:20 +01:00
|
|
|
}
|