Index: Shared/PluginClass.cpp |
=================================================================== |
--- a/Shared/PluginClass.cpp |
+++ b/Shared/PluginClass.cpp |
@@ -97,10 +97,9 @@ |
settings->SetFirstRunUpdate(); |
} |
- // First run or deleted settings file) |
- if (!settings->Has(SETTING_PLUGIN_ID)) |
+ // First run or deleted settings file (dictionary version = 1) |
+ if (settings->GetString(SETTING_DICTIONARY_VERSION, L"1").Compare(L"1") == 0) |
{ |
- settings->SetString(SETTING_PLUGIN_ID, system->GetPluginId()); |
settings->SetFirstRun(); |
} |
@@ -110,58 +109,13 @@ |
{ |
settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION); |
- settings->Remove(SETTING_REG_DATE); |
- settings->Remove(SETTING_PLUGIN_UPDATE_TIME); |
+ settings->Remove(SETTING_PLUGIN_UPDATE_TIME); |
settings->Remove(SETTING_PLUGIN_UPDATE_VERSION); |
settings->Remove(SETTING_PLUGIN_UPDATE_URL); |
settings->SetFirstRunUpdate(); |
} |
- // Ensure max REGISTRATION_MAX_ATTEMPTS registration attempts today |
- CString regDate = settings->GetString(SETTING_REG_DATE); |
- |
- SYSTEMTIME systemTime; |
- ::GetSystemTime(&systemTime); |
- |
- CString today; |
- today.Format(L"%d-%d-%d", systemTime.wYear, systemTime.wMonth, systemTime.wDay); |
- |
- if (regDate != today) |
- { |
- if (regDate == "") |
- { |
- settings->SetString(SETTING_REG_DATE, today); |
- settings->SetValue(SETTING_REG_ATTEMPTS, 0); |
- settings->Remove(SETTING_REG_SUCCEEDED); |
- } |
- else |
- { |
- COleDateTime regDateDateTime; |
- if (regDateDateTime.ParseDateTime(regDate)) |
- { |
- COleDateTime todayDateTime; |
- todayDateTime.ParseDateTime(today); |
- COleDateTimeSpan weekDateTime; |
- weekDateTime.SetDateTimeSpan(2, 0, 0, 0); |
- if (((todayDateTime - regDateDateTime) >= weekDateTime) || (todayDateTime < regDateDateTime)) |
- { |
- settings->SetString(SETTING_REG_DATE, today); |
- settings->SetValue(SETTING_REG_ATTEMPTS, 0); |
- settings->Remove(SETTING_REG_SUCCEEDED); |
- } |
- } |
- } |
- } |
- // Only allow one trial, if settings or whitelist changes |
- else if (settings->GetForceConfigurationUpdateOnStart()) |
- { |
- settings->SetValue(SETTING_REG_ATTEMPTS, REGISTRATION_MAX_ATTEMPTS - 1); |
- settings->Remove(SETTING_REG_SUCCEEDED); |
- |
- settings->RemoveForceConfigurationUpdateOnStart(); |
- } |
- |
int info = settings->GetValue(SETTING_PLUGIN_INFO_PANEL, 0); |
#ifdef ENABLE_DEBUG_RESULT |
@@ -632,45 +586,6 @@ |
} |
} |
-void CPluginClass::DisplayActivateMessage() |
-{ |
- CPluginSettings* settings = CPluginSettings::GetInstance(); |
- |
- CString messageString; |
- messageString.Format(L"The daily adblocklimit has been reached and no-more ads are blocked today.\nThe free version of Simple Adblock only blocks %d adrequests a day.\n\nTo enjoy unlimited adblocking please upgrade.", settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0)); |
- |
- settings->SetValue(SETTING_PLUGIN_ADBLOCKCOUNT, settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0) + 1); |
- settings->Write(); |
- |
- LRESULT res = MessageBox(NULL, messageString, L"Upgrade to Simple Adblock Pro", MB_OKCANCEL); |
- if (res == IDOK) |
- { |
- CPluginSettings* settings = CPluginSettings::GetInstance(); |
- CPluginHttpRequest httpRequest(USERS_SCRIPT_UPGRADE); |
- CPluginSystem* system = CPluginSystem::GetInstance(); |
- httpRequest.Add(L"plugin", system->GetPluginId()); |
- httpRequest.Add(L"user", settings->GetString(SETTING_USER_ID)); |
- httpRequest.Add(L"version", settings->GetString(SETTING_PLUGIN_VERSION)); |
- CString url = httpRequest.GetUrl(); |
- |
- CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); |
- CComQIPtr<IWebBrowser2> browser = tab->m_plugin->GetBrowser(); |
- if (!url.IsEmpty() && browser) |
- { |
- VARIANT vFlags; |
- vFlags.vt = VT_I4; |
- vFlags.intVal = navOpenInNewTab; |
- |
- HRESULT hr = browser->Navigate(CComBSTR(url), &vFlags, NULL, NULL, NULL); |
- if (FAILED(hr)) |
- { |
- vFlags.intVal = navOpenInNewWindow; |
- |
- hr = browser->Navigate(CComBSTR(url), &vFlags, NULL, NULL, NULL); |
- } |
- } |
- } |
-} |
void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams) |
{ |
@@ -678,33 +593,10 @@ |
{ |
return; |
} |
- CPluginSettings* settings = CPluginSettings::GetInstance(); |
- //Reset adblockcount every day |
- SYSTEMTIME stNow; |
- GetSystemTime(&stNow); |
- WORD limitDay = settings->GetValue(SETTING_PLUGIN_LIMITDAY, 0); |
- if (limitDay != stNow.wDay) |
+ //Register a mime filter if it's not registered yet |
+ if (s_mimeFilter == NULL) |
{ |
- settings->SetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0); |
- settings->SetValue(SETTING_PLUGIN_LIMITDAY, stNow.wDay); |
- settings->Write(); |
- settings->Read(); |
- |
- //Also register a mime filter if it's not registered yet |
- if (s_mimeFilter == NULL) |
- { |
- s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
- } |
- |
- } |
- |
- if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false)) |
- { |
- if ((settings->GetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0) == settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0)) |
- && (settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0) > 0)) |
- { |
- DisplayActivateMessage(); |
- } |
+ s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
} |
// Get the IWebBrowser2 interface |
@@ -1418,33 +1310,15 @@ |
} |
break; |
- case ID_PLUGIN_ACTIVATE: |
- { |
- url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_ACTIVATE); |
- navigationErrorId = PLUGIN_ERROR_NAVIGATION_ACTIVATE; |
- } |
- break; |
- |
case ID_PLUGIN_ENABLE: |
{ |
CPluginSettings* settings = CPluginSettings::GetInstance(); |
- //Display activation menu if enabling expired plugin |
- if (!settings->GetPluginEnabled()) |
- { |
- if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false) && |
- (settings->GetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0) >=settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0)) && |
- (settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0) > 0)) |
- { |
- DisplayActivateMessage(); |
- return; |
- } |
- } |
+ |
settings->TogglePluginEnabled(); |
// Enable / disable mime filter |
s_criticalSectionLocal.Lock(); |
{ |
- //Display activation menu if enabling expired plugin |
if (settings->GetPluginEnabled()) |
{ |
s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
@@ -1474,10 +1348,7 @@ |
#ifdef PRODUCT_SIMPLEADBLOCK |
CPluginHttpRequest httpRequest(USERS_SCRIPT_USER_SETTINGS); |
- |
- httpRequest.AddPluginId(); |
- httpRequest.Add("username", system->GetUserName(), false); |
- |
+ |
url = httpRequest.GetUrl(); |
navigationErrorId = PLUGIN_ERROR_NAVIGATION_SETTINGS; |
@@ -1705,25 +1576,6 @@ |
// Update settings |
m_tab->OnUpdateSettings(false); |
-#ifndef ENTERPRISE |
- // Plugin activate |
- if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false)) |
- { |
- ctext = dictionary->Lookup("MENU_ACTIVATE"); |
- fmii.fMask = MIIM_STATE | MIIM_STRING; |
- fmii.fState = MFS_ENABLED; |
- fmii.dwTypeData = ctext.GetBuffer(); |
- fmii.cch = ctext.GetLength(); |
- ::SetMenuItemInfo(hMenu, ID_PLUGIN_ACTIVATE, FALSE, &fmii); |
- } |
- else |
- { |
- ::DeleteMenu(hMenu, ID_PLUGIN_ACTIVATE, FALSE); |
- } |
-#else |
- ::DeleteMenu(hMenu, ID_PLUGIN_ACTIVATE, FALSE); |
-#endif |
-#ifndef ENTERPRISE |
// Plugin update |
if (settings->IsPluginUpdateAvailable()) |
{ |
@@ -1738,9 +1590,6 @@ |
{ |
::DeleteMenu(hMenu, ID_PLUGIN_UPDATE, FALSE); |
} |
-#else |
- ::DeleteMenu(hMenu, ID_PLUGIN_UPDATE, FALSE); |
-#endif |
#ifdef SUPPORT_WHITELIST |
{ |
// White list domain |
@@ -2373,9 +2222,7 @@ |
CPluginHttpRequest httpRequest(USERS_SCRIPT_WELCOME); |
- httpRequest.AddPluginId(); |
- httpRequest.Add("username", system->GetUserName(), false); |
- httpRequest.Add("errors", settings->GetErrorList()); |
+ httpRequest.Add("errors", settings->GetErrorList()); |
hr = browser->Navigate(CComBSTR(httpRequest.GetUrl() + "&src=" + DOWNLOAD_SOURCE), NULL, NULL, NULL, NULL); |
@@ -2395,9 +2242,8 @@ |
if (browser) |
{ |
CPluginHttpRequest httpRequest(USERS_SCRIPT_INFO); |
- |
- httpRequest.AddPluginId(); |
- httpRequest.Add("info", wParam); |
+ |
+ httpRequest.Add("info", wParam); |
VARIANT vFlags; |
vFlags.vt = VT_I4; |