core/ForwardSys.cpp
changeset 4086 63763f2a5c6c
parent 3995 e94dfd569130
     1.1 --- a/core/ForwardSys.cpp	Tue Aug 27 08:39:15 2013 -0400
     1.2 +++ b/core/ForwardSys.cpp	Tue Aug 27 19:06:18 2013 -0400
     1.3 @@ -208,7 +208,23 @@
     1.4  
     1.5  void CForwardManager::OnPluginPauseChange(IPlugin *plugin, bool paused)
     1.6  {
     1.7 -	/* No longer used */
     1.8 +	if(paused)
     1.9 +		return;
    1.10 +
    1.11 +	/* Attach any globally managed forwards */
    1.12 +	List<CForward *>::iterator iter;
    1.13 +	CForward *fwd;
    1.14 +
    1.15 +	for (iter=m_managed.begin(); iter!=m_managed.end(); iter++)
    1.16 +	{
    1.17 +		fwd = (*iter);
    1.18 +		IPluginFunction *pFunc = plugin->GetBaseContext()->GetFunctionByName(fwd->GetForwardName());
    1.19 +		// Only add functions, if they aren't registered yet!
    1.20 +		if (pFunc && !fwd->IsFunctionRegistered(pFunc))
    1.21 +		{
    1.22 +			fwd->AddFunction(pFunc);
    1.23 +		}
    1.24 +	}
    1.25  }
    1.26  
    1.27  /*************************************
    1.28 @@ -739,6 +755,28 @@
    1.29  	return true;
    1.30  }
    1.31  
    1.32 +bool CForward::IsFunctionRegistered(IPluginFunction *func)
    1.33 +{
    1.34 +	FuncIter iter;
    1.35 +	List<IPluginFunction *> *lst;
    1.36 +
    1.37 +	if (func->IsRunnable())
    1.38 +	{
    1.39 +		lst = &m_functions;
    1.40 +	} else {
    1.41 +		lst = &m_paused;
    1.42 +	}
    1.43 +
    1.44 +	for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
    1.45 +	{
    1.46 +		if ((*iter) == func)
    1.47 +		{
    1.48 +			return true;
    1.49 +		}
    1.50 +	}
    1.51 +	return false;
    1.52 +}
    1.53 +
    1.54  const char *CForward::GetForwardName()
    1.55  {
    1.56  	return m_name;