Additional change for r1191.

This commit is contained in:
spx 2012-02-15 07:07:50 +00:00
parent b786c12bac
commit 6fec1dc759

View File

@ -224,41 +224,36 @@ void CRainmeter::BangWithArgs(BANGCOMMAND bang, const WCHAR* arg, size_t numOfAr
if (subStringsSize >= numOfArgs) if (subStringsSize >= numOfArgs)
{ {
if (subStringsSize == numOfArgs) if (subStringsSize == numOfArgs && meterWindow)
{ {
if (meterWindow) meterWindow->RunBang(bang, subStrings);
{
meterWindow->RunBang(bang, subStrings);
}
else
{
Log(LOG_ERROR, L"Bang: Config not specified");
}
} }
else // if (subStringsSize > numOfArgs) else
{ {
// Use the specified window instead of meterWindow parameter // Use the specified window instead of meterWindow parameter
const std::wstring& config = subStrings[numOfArgs]; if (subStringsSize > numOfArgs)
if (!config.empty() && (config.length() != 1 || config[0] != L'*'))
{ {
CMeterWindow* meterWindow = GetMeterWindow(config); const std::wstring& config = subStrings[numOfArgs];
if (meterWindow) if (!config.empty() && (config.length() != 1 || config[0] != L'*'))
{ {
meterWindow->RunBang(bang, subStrings); CMeterWindow* meterWindow = GetMeterWindow(config);
} if (meterWindow)
else {
{ meterWindow->RunBang(bang, subStrings);
LogWithArgs(LOG_ERROR, L"Bang: Config \"%s\" not found", config.c_str()); }
else
{
LogWithArgs(LOG_ERROR, L"Bang: Config \"%s\" not found", config.c_str());
}
return;
} }
} }
else
// No config defined -> apply to all.
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter)
{ {
// No config defined -> apply to all. ((*iter).second)->RunBang(bang, subStrings);
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter)
{
((*iter).second)->RunBang(bang, subStrings);
}
} }
} }
} }