1.1 --- a/sourcehook/sourcehook.cpp Sat Apr 16 19:59:26 2005 +0000
1.2 +++ b/sourcehook/sourcehook.cpp Sat Apr 16 20:26:33 2005 +0000
1.3 @@ -87,6 +87,10 @@
1.4 // Iterate through their hooks
1.5 // If a hook from an other plugin is found, return true
1.6 // Return false otherwise
1.7 +#define TMP_CHECK_LIST(name) \
1.8 + for (iter3 = iter2->name.begin(); iter3 != iter2->name.end(); ++iter3) \
1.9 + if (iter3->plug == plug) \
1.10 + return true;
1.11
1.12 for (HookManInfoList::iterator iter = m_HookMans.begin(); iter != m_HookMans.end(); ++iter)
1.13 {
1.14 @@ -95,15 +99,12 @@
1.15 for (std::list<HookManagerInfo::Iface>::iterator iter2 = iter->ifaces.begin(); iter2 != iter->ifaces.end(); ++iter2)
1.16 {
1.17 std::list<HookManagerInfo::Iface::Hook>::iterator iter3;
1.18 - for (iter3 = iter2->hooks_pre.begin(); iter3 != iter2->hooks_pre.end(); ++iter3)
1.19 - if (iter3->plug == plug)
1.20 - return true;
1.21 - for (iter3 = iter2->hooks_post.begin(); iter3 != iter2->hooks_post.end(); ++iter3)
1.22 - if (iter3->plug == plug)
1.23 - return true;
1.24 + TMP_CHECK_LIST(hooks_pre);
1.25 + TMP_CHECK_LIST(hooks_post);
1.26 }
1.27 }
1.28 }
1.29 +#undef TMP_CHECK_LIST
1.30 return false;
1.31 }
1.32
1.33 @@ -255,6 +256,7 @@
1.34 HookManagerInfo::Iface::Hook hookinfo;
1.35 hookinfo.handler = handler;
1.36 hookinfo.plug = plug;
1.37 + hookinfo.paused = false;
1.38 if (post)
1.39 ifsiter->hooks_post.push_back(hookinfo);
1.40 else
1.41 @@ -479,6 +481,43 @@
1.42 return hookmaniter;
1.43 }
1.44
1.45 + void CSourceHookImpl::PausePlugin(Plugin plug)
1.46 + {
1.47 + // Go through all hook managers, all interfaces, and set the status of all hooks of this plugin to paused
1.48 + for (HookManInfoList::iterator hookmaniter = m_HookMans.begin(); hookmaniter != m_HookMans.end(); ++hookmaniter)
1.49 + for (std::list<HookManagerInfo::Iface>::iterator ifaceiter = hookmaniter->ifaces.begin();
1.50 + ifaceiter != hookmaniter->ifaces.end(); ++ifaceiter)
1.51 + {
1.52 + for (std::list<HookManagerInfo::Iface::Hook>::iterator hookiter = ifaceiter->hooks_pre.begin();
1.53 + hookiter != ifaceiter->hooks_pre.end(); ++hookiter)
1.54 + if (plug == hookiter->plug)
1.55 + hookiter->paused = true;
1.56 +
1.57 + for (std::list<HookManagerInfo::Iface::Hook>::iterator hookiter = ifaceiter->hooks_post.begin();
1.58 + hookiter != ifaceiter->hooks_post.end(); ++hookiter)
1.59 + if (plug == hookiter->plug)
1.60 + hookiter->paused = true;
1.61 + }
1.62 + }
1.63 +
1.64 + void CSourceHookImpl::UnpausePlugin(Plugin plug)
1.65 + {
1.66 + // Go through all hook managers, all interfaces, and set the status of all hooks of this plugin to normal
1.67 + for (HookManInfoList::iterator hookmaniter = m_HookMans.begin(); hookmaniter != m_HookMans.end(); ++hookmaniter)
1.68 + for (std::list<HookManagerInfo::Iface>::iterator ifaceiter = hookmaniter->ifaces.begin();
1.69 + ifaceiter != hookmaniter->ifaces.end(); ++ifaceiter)
1.70 + {
1.71 + for (std::list<HookManagerInfo::Iface::Hook>::iterator hookiter = ifaceiter->hooks_pre.begin();
1.72 + hookiter != ifaceiter->hooks_pre.end(); ++hookiter)
1.73 + if (plug == hookiter->plug)
1.74 + hookiter->paused = false;
1.75 +
1.76 + for (std::list<HookManagerInfo::Iface::Hook>::iterator hookiter = ifaceiter->hooks_post.begin();
1.77 + hookiter != ifaceiter->hooks_post.end(); ++hookiter)
1.78 + if (plug == hookiter->plug)
1.79 + hookiter->paused = false;
1.80 + }
1.81 + }
1.82
1.83 void CSourceHookImpl::SetRes(META_RES res)
1.84 {