long CMUSHclientDoc::GetTimer(LPCTSTR TimerName, VARIANT FAR* Hour, VARIANT FAR* Minute, VARIANT FAR* Second, VARIANT FAR* ResponseText, VARIANT FAR* Flags, VARIANT FAR* ScriptName) { CString strTimerName = TimerName; CTimer * timer_item; // trim spaces from name, make lower-case CheckObjectName (strTimerName, false); if (!GetTimerMap ().Lookup (strTimerName, timer_item)) return eTimerNotFound; if (timer_item->iType == CTimer::eAtTime) { SetUpVariantShort (*Hour, timer_item->iAtHour); SetUpVariantShort (*Minute, timer_item->iAtMinute); SetUpVariantDouble (*Second, timer_item->fAtSecond); } else { SetUpVariantShort (*Hour, timer_item->iEveryHour); SetUpVariantShort (*Minute, timer_item->iEveryMinute); SetUpVariantDouble (*Second, timer_item->fEverySecond); } SetUpVariantString (*ResponseText, timer_item->strContents); SetUpVariantString (*ScriptName, timer_item->strProcedure); short iFlags = 0; if (timer_item->bEnabled) iFlags |= eEnabled; if (timer_item->bOneShot) iFlags |= eOneShot; if (timer_item->iSendTo == eSendToSpeedwalk) iFlags |= eTimerSpeedWalk; if (timer_item->iSendTo == eSendToOutput) iFlags |= eTimerNote; if (timer_item->bActiveWhenClosed) iFlags |= eActiveWhenClosed; SetUpVariantShort (*Flags, iFlags); return eOK; } // end of CMUSHclientDoc::GetTimer
VARIANT CMUSHclientDoc::GetTriggerInfo(LPCTSTR TriggerName, short InfoType) { CString strTriggerName = TriggerName; CTrigger * trigger_item; VARIANT vaResult; VariantInit(&vaResult); vaResult.vt = VT_NULL; // trim spaces from name, make lower-case CheckObjectName (strTriggerName, false); vaResult.vt = VT_EMPTY; // see if trigger exists, if not return EMPTY if (!GetTriggerMap ().Lookup (strTriggerName, trigger_item)) return vaResult; switch (InfoType) { case 1: SetUpVariantString (vaResult, trigger_item->trigger); break; case 2: SetUpVariantString (vaResult, trigger_item->contents); break; case 3: SetUpVariantString (vaResult, trigger_item->sound_to_play); break; case 4: SetUpVariantString (vaResult, trigger_item->strProcedure); break; case 5: SetUpVariantBool (vaResult, trigger_item->omit_from_log); break; case 6: SetUpVariantBool (vaResult, trigger_item->bOmitFromOutput); break; case 7: SetUpVariantBool (vaResult, trigger_item->bKeepEvaluating); break; case 8: SetUpVariantBool (vaResult, trigger_item->bEnabled); break; case 9: SetUpVariantBool (vaResult, trigger_item->bRegexp); break; case 10: SetUpVariantBool (vaResult, trigger_item->ignore_case); break; case 11: SetUpVariantBool (vaResult, trigger_item->bRepeat); break; case 12: SetUpVariantBool (vaResult, trigger_item->bSoundIfInactive); break; case 13: SetUpVariantBool (vaResult, trigger_item->bExpandVariables); break; case 14: SetUpVariantShort (vaResult, trigger_item->iClipboardArg); break; case 15: SetUpVariantShort (vaResult, trigger_item->iSendTo); break; case 16: SetUpVariantShort (vaResult, trigger_item->iSequence); break; case 17: SetUpVariantShort (vaResult, trigger_item->iMatch); break; case 18: SetUpVariantShort (vaResult, trigger_item->iStyle); break; case 19: SetUpVariantShort (vaResult, trigger_item->colour); break; case 20: SetUpVariantLong (vaResult, trigger_item->nInvocationCount); break; case 21: SetUpVariantLong (vaResult, trigger_item->nMatched); break; case 22: if (trigger_item->tWhenMatched.GetTime ()) // only if non-zero, otherwise return empty SetUpVariantDate (vaResult, COleDateTime (trigger_item->tWhenMatched.GetTime ())); break; case 23: SetUpVariantBool (vaResult, trigger_item->bTemporary); break; case 24: SetUpVariantBool (vaResult, trigger_item->bIncluded); break; case 25: SetUpVariantBool (vaResult, trigger_item->bLowercaseWildcard); break; case 26: SetUpVariantString (vaResult, trigger_item->strGroup); break; case 27: SetUpVariantString (vaResult, trigger_item->strVariable); break; case 28: SetUpVariantLong (vaResult, trigger_item->iUserOption); break; case 29: SetUpVariantLong (vaResult, trigger_item->iOtherForeground); break; case 30: SetUpVariantLong (vaResult, trigger_item->iOtherBackground); break; case 31: // number of matches to regexp if (trigger_item->regexp) SetUpVariantLong (vaResult, trigger_item->regexp->m_iCount); else SetUpVariantLong (vaResult, 0); break; case 32: // last matching string if (trigger_item->regexp) SetUpVariantString (vaResult, trigger_item->regexp->m_sTarget.c_str ()); else SetUpVariantString (vaResult, ""); break; case 33: SetUpVariantBool (vaResult, trigger_item->bExecutingScript); break; case 34: SetUpVariantBool (vaResult, trigger_item->dispid != DISPID_UNKNOWN); break; case 35: if (trigger_item->regexp && trigger_item->regexp->m_program == NULL) SetUpVariantLong (vaResult, trigger_item->regexp->m_iExecutionError); else SetUpVariantLong (vaResult, 0); break; case 36: SetUpVariantBool (vaResult, trigger_item->bOneShot); break; case 37: if (trigger_item->regexp && App.m_iCounterFrequency) { double elapsed_time; elapsed_time = ((double) trigger_item->regexp->iTimeTaken) / ((double) App.m_iCounterFrequency); SetUpVariantDouble (vaResult, elapsed_time); } break; case 38: if (trigger_item->regexp) SetUpVariantLong (vaResult, trigger_item->regexp->m_iMatchAttempts); break; #ifdef PANE case 38: SetUpVariantString (vaResult, trigger_item->strPane); break; #endif // PANE case 101: SetUpVariantString (vaResult, trigger_item->wildcards [1].c_str ()); break; case 102: SetUpVariantString (vaResult, trigger_item->wildcards [2].c_str ()); break; case 103: SetUpVariantString (vaResult, trigger_item->wildcards [3].c_str ()); break; case 104: SetUpVariantString (vaResult, trigger_item->wildcards [4].c_str ()); break; case 105: SetUpVariantString (vaResult, trigger_item->wildcards [5].c_str ()); break; case 106: SetUpVariantString (vaResult, trigger_item->wildcards [6].c_str ()); break; case 107: SetUpVariantString (vaResult, trigger_item->wildcards [7].c_str ()); break; case 108: SetUpVariantString (vaResult, trigger_item->wildcards [8].c_str ()); break; case 109: SetUpVariantString (vaResult, trigger_item->wildcards [9].c_str ()); break; case 110: SetUpVariantString (vaResult, trigger_item->wildcards [0].c_str ()); break; default: vaResult.vt = VT_NULL; break; } // end of switch return vaResult; } // end of CMUSHclientDoc::GetTriggerInfo
VARIANT CMUSHclientDoc::GetPluginInfo(LPCTSTR PluginID, short InfoType) { VARIANT vaResult; VariantInit(&vaResult); vaResult.vt = VT_NULL; CPlugin * pPlugin = GetPlugin (PluginID); if (!pPlugin) return vaResult; // plugin not found switch (InfoType) { case 1: SetUpVariantString (vaResult, pPlugin->m_strName); break; case 2: SetUpVariantString (vaResult, pPlugin->m_strAuthor); break; case 3: SetUpVariantString (vaResult, pPlugin->m_strDescription); break; case 4: SetUpVariantString (vaResult, pPlugin->m_strScript); break; case 5: SetUpVariantString (vaResult, pPlugin->m_strLanguage); break; case 6: SetUpVariantString (vaResult, pPlugin->m_strSource); break; case 7: SetUpVariantString (vaResult, pPlugin->m_strID); break; case 8: SetUpVariantString (vaResult, pPlugin->m_strPurpose); break; case 9: SetUpVariantLong (vaResult, pPlugin->m_TriggerMap.GetCount ()); break; case 10: SetUpVariantLong (vaResult, pPlugin->m_AliasMap.GetCount ()); break; case 11: SetUpVariantLong (vaResult, pPlugin->m_TimerMap.GetCount ()); break; case 12: SetUpVariantLong (vaResult, pPlugin->m_VariableMap.GetCount ()); break; case 13: if (pPlugin->m_tDateWritten.GetTime ()) // only if non-zero, otherwise return empty SetUpVariantDate (vaResult, COleDateTime (pPlugin->m_tDateWritten.GetTime ())); break; case 14: if (pPlugin->m_tDateModified.GetTime ()) // only if non-zero, otherwise return empty SetUpVariantDate (vaResult, COleDateTime (pPlugin->m_tDateModified.GetTime ())); break; case 15: SetUpVariantBool (vaResult, pPlugin->m_bSaveState); break; // 16: is scripting enabled? case 16: SetUpVariantBool (vaResult, pPlugin->m_ScriptEngine != NULL); break; case 17: SetUpVariantBool (vaResult, pPlugin->m_bEnabled); break; case 18: SetUpVariantDouble (vaResult, pPlugin->m_dRequiredVersion); break; case 19: SetUpVariantDouble (vaResult, pPlugin->m_dVersion); break; case 20: SetUpVariantString (vaResult, pPlugin->m_strDirectory); break; case 21: { int iCount = 0; // first work out what order each plugin is in *now* for (PluginListIterator pit = m_PluginList.begin (); pit != m_PluginList.end (); ++pit) (*pit)->m_iLoadOrder = ++iCount; // now return the order of *this* one SetUpVariantLong (vaResult, pPlugin->m_iLoadOrder); } break; case 22: SetUpVariantDate (vaResult, COleDateTime (pPlugin->m_tDateInstalled.GetTime ())); break; case 23: SetUpVariantString (vaResult, pPlugin->m_strCallingPluginID); break; case 24: { double elapsed_time = 0.0; if (App.m_iCounterFrequency > 0) elapsed_time = ((double) pPlugin->m_iScriptTimeTaken) / ((double) App.m_iCounterFrequency); SetUpVariantDouble (vaResult, elapsed_time); break; } default: vaResult.vt = VT_NULL; break; } // end of switch return vaResult; } // end of CMUSHclientDoc::GetPluginInfo
VARIANT CMUSHclientDoc::GetTimerOption(LPCTSTR TimerName, LPCTSTR OptionName) { CString strTimerName = TimerName; CTimer * Timer_item; VARIANT vaResult; VariantInit(&vaResult); vaResult.vt = VT_NULL; // trim spaces from name, make lower-case CheckObjectName (strTimerName, false); vaResult.vt = VT_EMPTY; // see if Timer exists, if not return EMPTY if (!GetTimerMap ().Lookup (strTimerName, Timer_item)) return vaResult; CString strOptionName = OptionName; strOptionName.MakeLower(); strOptionName.TrimLeft (); strOptionName.TrimRight (); int iItem; int iResult = FindBaseOption (strOptionName, TimerOptionsTable, iItem); if (iResult == eOK) { // numeric option if (m_CurrentPlugin && (TimerOptionsTable [iItem].iFlags & OPT_PLUGIN_CANNOT_READ)) return vaResult; // not available to plugin double Value; // this is a pest! if (strOptionName == "hour") { if (Timer_item->iType == CTimer::eInterval) Value = Timer_item->iEveryHour; else Value = Timer_item->iAtHour; } // end of option "hour" else if (strOptionName == "minute") { if (Timer_item->iType == CTimer::eInterval) Value = Timer_item->iEveryMinute; else Value = Timer_item->iAtMinute; } // end of option "minute" else if (strOptionName == "second") { if (Timer_item->iType == CTimer::eInterval) Value = Timer_item->fEverySecond; else Value = Timer_item->fAtSecond; } // end of option "second" else Value = GetBaseOptionItem (iItem, TimerOptionsTable, NUMITEMS (TimerOptionsTable), (char *) Timer_item); SetUpVariantDouble (vaResult, Value); } // end of found numeric option else { // not numeric option, try alpha int iResult = FindBaseAlphaOption (OptionName, TimerAlphaOptionsTable, iItem); if (iResult == eOK) { // alpha option if (m_CurrentPlugin && (TimerAlphaOptionsTable [iItem].iFlags & OPT_PLUGIN_CANNOT_READ)) return vaResult; // not available to plugin CString strValue = GetBaseAlphaOptionItem (iItem, TimerAlphaOptionsTable, NUMITEMS (TimerAlphaOptionsTable), (char *) Timer_item); SetUpVariantString (vaResult, strValue); } // end of found } return vaResult; } // end of GetTimerOption
VARIANT CMUSHclientDoc::GetTimerInfo(LPCTSTR TimerName, short InfoType) { CString strTimerName = TimerName; CTimer * timer_item; VARIANT vaResult; VariantInit(&vaResult); vaResult.vt = VT_NULL; // trim spaces from name, make lower-case CheckObjectName (strTimerName, false); vaResult.vt = VT_EMPTY; // see if timer exists, if not return EMPTY if (!GetTimerMap ().Lookup (strTimerName, timer_item)) return vaResult; switch (InfoType) { case 1: if (timer_item->iType == CTimer::eAtTime) SetUpVariantShort (vaResult, timer_item->iAtHour); else SetUpVariantShort (vaResult, timer_item->iEveryHour); break; case 2: if (timer_item->iType == CTimer::eAtTime) SetUpVariantShort (vaResult, timer_item->iAtMinute); else SetUpVariantShort (vaResult, timer_item->iEveryMinute); break; case 3: if (timer_item->iType == CTimer::eAtTime) SetUpVariantDouble (vaResult, timer_item->fAtSecond); else SetUpVariantDouble (vaResult, timer_item->fEverySecond); break; case 4: SetUpVariantString (vaResult, timer_item->strContents); break; case 5: SetUpVariantString (vaResult, timer_item->strProcedure); break; case 6: SetUpVariantBool (vaResult, timer_item->bEnabled); break; case 7: SetUpVariantBool (vaResult, timer_item->bOneShot); break; case 8: SetUpVariantBool (vaResult, timer_item->iType == CTimer::eAtTime); break; case 9: SetUpVariantLong (vaResult, timer_item->nInvocationCount); break; case 10: SetUpVariantLong (vaResult, timer_item->nMatched); break; case 11: if (timer_item->tWhenFired.GetTime ()) // only if non-zero, otherwise return empty SetUpVariantDate (vaResult, COleDateTime (timer_item->tWhenFired.GetTime ())); break; case 12: if (timer_item->tFireTime.GetTime ()) // only if non-zero, otherwise return empty SetUpVariantDate (vaResult, COleDateTime (timer_item->tFireTime.GetTime ())); break; case 13: { CmcDateTime tDue = CmcDateTime (timer_item->tFireTime.GetTime ()); CmcDateTime tNow = CmcDateTime::GetTimeNow (); if (tDue < tNow) SetUpVariantDouble (vaResult, 0); // due immediately else { CmcDateTimeSpan ts = tDue - tNow; SetUpVariantDouble (vaResult, ts.GetTotalSeconds ()); // how many seconds to go } } break; case 14: SetUpVariantBool (vaResult, timer_item->bTemporary); break; case 15: SetUpVariantBool (vaResult, timer_item->iSendTo == eSendToSpeedwalk); break; case 16: SetUpVariantBool (vaResult, timer_item->iSendTo == eSendToOutput); break; case 17: SetUpVariantBool (vaResult, timer_item->bActiveWhenClosed); break; case 18: SetUpVariantBool (vaResult, timer_item->bIncluded); break; case 19: SetUpVariantString (vaResult, timer_item->strGroup); break; case 20: SetUpVariantLong (vaResult, timer_item->iSendTo); break; case 21: SetUpVariantLong (vaResult, timer_item->iUserOption); break; case 22: SetUpVariantString (vaResult, timer_item->strLabel); break; case 23: SetUpVariantBool (vaResult, timer_item->bOmitFromOutput); break; case 24: SetUpVariantBool (vaResult, timer_item->bOmitFromLog); break; case 25: SetUpVariantBool (vaResult, timer_item->bExecutingScript); break; case 26: SetUpVariantBool (vaResult, timer_item->dispid != DISPID_UNKNOWN); break; default: vaResult.vt = VT_NULL; break; } // end of switch return vaResult; } // end of CMUSHclientDoc::GetTimerInfo