@@ -8050,30 +8050,32 @@ static bool bInPluginListChanged = false;
8050
8050
} // end CMUSHclientDoc::PluginListChanged
8051
8051
8052
8052
8053
- void CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName ) // no arguments
8053
+ void CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName ) // no arguments
8054
8054
{
8055
8055
CPlugin * pSavedPlugin = m_CurrentPlugin;
8056
- m_CurrentPlugin = NULL ; // not sure about this
8057
8056
8058
8057
// tell a plugin the message
8059
8058
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
8060
8059
{
8061
8060
CPlugin * pPlugin = m_PluginList.GetNext (pluginpos);
8062
8061
8063
- if (pPlugin->m_bEnabled ) // ignore disabled plugins
8064
- pPlugin-> ExecutePluginScript ( sName ) ;
8062
+ if (!( pPlugin->m_bEnabled ) ) // ignore disabled plugins
8063
+ continue ;
8065
8064
8066
- } // end of doing each plugin
8065
+ // change to this plugin, call function, put current plugin back
8066
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8067
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8068
+ pPlugin->ExecutePluginScript (callinfo);
8069
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8067
8070
8068
- m_CurrentPlugin = pSavedPlugin;
8071
+ } // end of doing each plugin
8069
8072
8070
8073
} // end of CMUSHclientDoc::SendToAllPluginCallbacks
8071
8074
8072
8075
// this is for when we want the first available plugin to handle something (eg. Trace, Sound)
8073
8076
bool CMUSHclientDoc::SendToFirstPluginCallbacks (const char * sName , const char * sText ) // one argument
8074
8077
{
8075
8078
CPlugin * pSavedPlugin = m_CurrentPlugin;
8076
- m_CurrentPlugin = NULL ; // not sure about this
8077
8079
8078
8080
// tell a plugin the message
8079
8081
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
@@ -8083,19 +8085,20 @@ bool CMUSHclientDoc::SendToFirstPluginCallbacks (const char * sName, const char
8083
8085
if (!(pPlugin->m_bEnabled )) // ignore disabled plugins
8084
8086
continue ;
8085
8087
8086
- // see what the plugin makes of this,
8087
- pPlugin->ExecutePluginScript (sName , sText );
8088
+ // change to this plugin, call function, put current plugin back
8089
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8090
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8091
+ pPlugin->ExecutePluginScript (callinfo, sText );
8092
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8088
8093
8089
- if (pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8094
+ if (callinfo. _dispid_info .isvalid ())
8090
8095
{
8091
8096
m_CurrentPlugin = pSavedPlugin;
8092
8097
return true ; // indicate we found it
8093
8098
}
8094
8099
8095
8100
} // end of doing each plugin
8096
8101
8097
- m_CurrentPlugin = pSavedPlugin;
8098
-
8099
8102
return false ; // didn't find one
8100
8103
} // end of CMUSHclientDoc::SendToFirstPluginCallbacks
8101
8104
@@ -8107,25 +8110,28 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8107
8110
const bool bStopOnFalse)
8108
8111
{
8109
8112
CPlugin * pSavedPlugin = m_CurrentPlugin;
8110
- m_CurrentPlugin = NULL ; // not sure about this
8111
8113
bool bResult = true ; // assume they OK'd something
8112
8114
8113
8115
// tell a plugin the message
8114
8116
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
8115
8117
{
8116
8118
CPlugin * pPlugin = m_PluginList.GetNext (pluginpos);
8117
8119
8118
- if (pPlugin->m_bEnabled ) // ignore disabled plugins
8119
- if (!pPlugin->ExecutePluginScript (sName , sText ))
8120
+ if (!(pPlugin->m_bEnabled )) // ignore disabled plugins
8121
+ continue ;
8122
+
8123
+ // change to this plugin, call function, put current plugin back
8124
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8125
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8126
+ if (!pPlugin->ExecutePluginScript (callinfo, sText ))
8120
8127
bResult = false ;
8128
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8121
8129
8122
- if (bStopOnFalse && !bResult && pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8130
+ if (bStopOnFalse && !bResult && callinfo. _dispid_info .isvalid ())
8123
8131
return false ;
8124
8132
8125
8133
} // end of doing each plugin
8126
8134
8127
- m_CurrentPlugin = pSavedPlugin;
8128
-
8129
8135
return bResult;
8130
8136
} // end of CMUSHclientDoc::SendToAllPluginCallbacks
8131
8137
@@ -8134,19 +8140,22 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8134
8140
void CMUSHclientDoc::SendToAllPluginCallbacksRtn (const char * sName , CString & strResult) // taking and returning a string
8135
8141
{
8136
8142
CPlugin * pSavedPlugin = m_CurrentPlugin;
8137
- m_CurrentPlugin = NULL ; // not sure about this
8138
8143
8139
8144
// tell a plugin the message
8140
8145
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
8141
8146
{
8142
8147
CPlugin * pPlugin = m_PluginList.GetNext (pluginpos);
8143
8148
8144
- if (pPlugin->m_bEnabled ) // ignore disabled plugins
8145
- pPlugin-> ExecutePluginScriptRtn ( sName , strResult) ;
8149
+ if (!( pPlugin->m_bEnabled ) ) // ignore disabled plugins
8150
+ continue ;
8146
8151
8147
- } // end of doing each plugin
8152
+ // change to this plugin, call function, put current plugin back
8153
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8154
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8155
+ pPlugin->ExecutePluginScriptRtn (callinfo, strResult);
8156
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8148
8157
8149
- m_CurrentPlugin = pSavedPlugin;
8158
+ } // end of doing each plugin
8150
8159
8151
8160
} // end of CMUSHclientDoc::SendToAllPluginCallbacks
8152
8161
@@ -8159,7 +8168,6 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8159
8168
const bool bStopOnFalse)
8160
8169
{
8161
8170
CPlugin * pSavedPlugin = m_CurrentPlugin;
8162
- m_CurrentPlugin = NULL ; // not sure about this
8163
8171
8164
8172
// tell a plugin the message
8165
8173
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
@@ -8169,17 +8177,20 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8169
8177
if (!(pPlugin->m_bEnabled )) // ignore disabled plugins
8170
8178
continue ;
8171
8179
8172
- bool bResult = pPlugin->ExecutePluginScript (sName , arg1, sText );
8180
+ // change to this plugin, call function, put current plugin back
8181
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8182
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8183
+ bool bResult = pPlugin->ExecutePluginScript (callinfo, arg1, sText );
8184
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8173
8185
8174
- if (bStopOnTrue && bResult && pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8186
+ if (bStopOnTrue && bResult && callinfo. _dispid_info .isvalid ())
8175
8187
return true ;
8176
8188
8177
- if (bStopOnFalse && !bResult && pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8189
+ if (bStopOnFalse && !bResult && callinfo. _dispid_info .isvalid ())
8178
8190
return false ;
8179
8191
8180
8192
} // end of doing each plugin
8181
8193
8182
- m_CurrentPlugin = pSavedPlugin;
8183
8194
8184
8195
if (bStopOnTrue)
8185
8196
return false ;
@@ -8197,7 +8208,6 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8197
8208
const bool bStopOnFalse)
8198
8209
{
8199
8210
CPlugin * pSavedPlugin = m_CurrentPlugin;
8200
- m_CurrentPlugin = NULL ; // not sure about this
8201
8211
8202
8212
// tell a plugin the message
8203
8213
for (POSITION pluginpos = m_PluginList.GetHeadPosition (); pluginpos; )
@@ -8207,18 +8217,20 @@ bool CMUSHclientDoc::SendToAllPluginCallbacks (const char * sName,
8207
8217
if (!(pPlugin->m_bEnabled )) // ignore disabled plugins
8208
8218
continue ;
8209
8219
8210
- bool bResult = pPlugin->ExecutePluginScript (sName , arg1, arg2, sText );
8220
+ // change to this plugin, call function, put current plugin back
8221
+ m_CurrentPlugin = pPlugin; // so plugin knows who it is
8222
+ CScriptCallInfo callinfo (sName , pPlugin->m_PluginCallbacks [sName ]);
8223
+ bool bResult = pPlugin->ExecutePluginScript (callinfo, arg1, arg2, sText );
8224
+ m_CurrentPlugin = pSavedPlugin; // back to current plugin
8211
8225
8212
- if (bStopOnTrue && bResult && pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8226
+ if (bStopOnTrue && bResult && callinfo. _dispid_info .isvalid ())
8213
8227
return true ;
8214
8228
8215
- if (bStopOnFalse && !bResult && pPlugin-> m_PluginCallbacks [ sName ] .isvalid ())
8229
+ if (bStopOnFalse && !bResult && callinfo. _dispid_info .isvalid ())
8216
8230
return false ;
8217
8231
8218
8232
} // end of doing each plugin
8219
8233
8220
- m_CurrentPlugin = pSavedPlugin;
8221
-
8222
8234
if (bStopOnTrue)
8223
8235
return false ;
8224
8236
else
0 commit comments