bool cDirCrawler::AddPathToDatabase(const cPath & path) { // check if the following file is "allowed" if (IsIgnored(path.path.c_str())) return false; std::deque<std::string> fields; fields.push_back("path"); fields.push_back("available"); std::deque<std::string> values; values.push_back(path.path); // abs. path values.push_back("1"); // available if (!path.filename.empty()) { fields.push_back("filename"); values.push_back(path.filename); // just the name of the file } std::string where = std::string("path=\"") + path.path + std::string("\""); // Insert or update fields //writer->Write(fields, values, where); //std::string sqlQuery = "INSERT INTO " + table + " (path, available) VALUES (" + path.path, "1 )"; // INSERT // if INSERT fails try UPDATE // if both fail ==> error return writer->Write(METADATA_TABLE, fields, values, where); }
static int IgnoreAddedNotify(WPARAM, LPARAM lParam) { DBEVENTINFO *dbei=(DBEVENTINFO*)lParam; if (dbei && dbei->eventType==EVENTTYPE_ADDED && dbei->pBlob!=NULL) { HANDLE hContact; hContact=*((PHANDLE)(dbei->pBlob+sizeof(DWORD))); if (CallService(MS_DB_CONTACT_IS,(WPARAM)hContact,0) && IsIgnored((WPARAM)hContact,IGNOREEVENT_YOUWEREADDED)) return 1; } return 0; }
// Parse switches stored in gpConEmu during initialization (AppendExtraArgs) // These are, for example, `-lngfile`, `-fontdir`, and so on. void ParseStdSwitches() { _ASSERTE(stdSwitches.empty()); CEStr szArg, szNext, lsExta; LPCWSTR psz, pszExtraArgs; pszExtraArgs = gpConEmu->MakeConEmuStartArgs(lsExta); psz = pszExtraArgs; while (psz && *psz) { Switch* ps = GetNextPair(psz); if (!ps) { continue; } if (IsIgnored(ps, GetSkipSwitches())) { SafeDelete(ps); continue; } stdSwitches.push_back(ps); } };
static INT_PTR IgnoreRecvAuth(WPARAM wParam,LPARAM lParam) { if(IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_AUTHORIZATION)) return 1; return CallService(MS_PROTO_CHAINRECV,wParam,lParam); }
static INT_PTR IgnoreRecvMessage(WPARAM wParam,LPARAM lParam) { if(IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact,IGNOREEVENT_MESSAGE)) return 1; return CallService(MS_PROTO_CHAINRECV,wParam,lParam); }
BOOL checkIgnore(MCONTACT hContact, WORD eventType) { return !IsIgnored(hContact, eventType); }
// pszFull comes from registry's [HKCR\Directory\shell\...\command] // Example: // "C:\Tools\ConEmu.exe" -inside -LoadCfgFile "C:\Tools\ConEmu.xml" -FontDir C:\Tools\ConEmu // -lngfile C:\Tools\ConEmu\ConEmu.l10n -lng ru -dir "%1" -run {cmd} -cur_console:n // Strip switches which match current instance startup arguments // No sense to show them (e.g. "-lng ru") in the Integration dialog page void StripDupSwitches(LPCWSTR pszFull) { bCmdList = false; szCmd = L""; szDirSync = L""; szConfig = L""; ReleaseVectors(); CEStr szArg, szNext; LPCWSTR psz; Switch* ps = NULL; // First, parse our extra args (passed to current ConEmu.exe) ParseStdSwitches(); // Now parse new switches (command from registry or from field on Integration page) // Drop `-dir "..."` (especially from registry) always! psz = pszFull; while (0 == NextArg(&psz, szArg)) { if (!szArg.IsPossibleSwitch()) continue; if (szArg.OneOfSwitches(L"-inside", L"-here")) { // Nop } else if (szArg.IsSwitch(L"-inside:")) // Both "-inside:" and "-inside=" notations are supported { szDirSync.Set(szArg.Mid(8)); // may be empty! } else if (szArg.IsSwitch(L"-config")) { if (0 != NextArg(&psz, szArg)) break; szConfig.Set(szArg); } else if (szArg.IsSwitch(L"-dir")) { if (0 != NextArg(&psz, szArg)) break; _ASSERTE(lstrcmpi(szArg, L"%1")==0); } else if (szArg.OneOfSwitches(L"-Single", L"-NoSingle", L"-ReUse")) { ps = new Switch(szArg.Detach(), NULL); ourSwitches.push_back(ps); } else if (szArg.OneOfSwitches(L"-run", L"-cmd", L"-runlist", L"-cmdlist")) { // FIN! LAST SWITCH! szCmd.Set(psz); bCmdList = szArg.OneOfSwitches(L"-runlist",L"-cmdlist"); break; } else if (NULL != (ps = GetNextSwitch(psz, szArg))) { if (IsIgnored(ps, GetSkipSwitches()) || IsIgnored(ps, stdSwitches)) { SafeDelete(ps); } else { ourSwitches.push_back(ps); } } } };