diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/BasicHistory/src/BasicHistory.cpp | 17 | ||||
-rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.cpp | 53 | ||||
-rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.h | 1 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/HistoryForm.pas | 2 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/historypp.dpr | 19 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/hpp_global.pas | 59 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/hpp_options.pas | 3 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/hpp_services.pas | 16 | ||||
-rw-r--r-- | plugins/HistoryPlusPlus/m_historypp.inc | 8 | ||||
-rw-r--r-- | plugins/NewStory/src/history.cpp | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 28 |
12 files changed, 39 insertions, 170 deletions
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 091d9b15d9..5639b63c86 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-#define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory"
#define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask"
HCURSOR hCurSplitNS, hCurSplitWE;
@@ -26,7 +25,7 @@ HCURSOR hCurSplitNS, hCurSplitWE; HANDLE *hEventIcons = nullptr;
int iconsNum = 3;
HANDLE hToolbarButton;
-HGENMENU hContactMenu, hDeleteContactMenu;
+HGENMENU hContactMenu;
HGENMENU hTaskMainMenu;
std::vector<HGENMENU> taskMenus;
bool g_SmileyAddAvail = false;
@@ -67,11 +66,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM lParam); int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
- bool bHasHistory = db_event_last(hContact) != NULL;
- bool isInList = HistoryWindow::IsInList(GetForegroundWindow());
-
- Menu_ShowItem(hContactMenu, bHasHistory);
- Menu_ShowItem(hDeleteContactMenu, bHasHistory && isInList);
+ Menu_ShowItem(hContactMenu, db_event_last(hContact) != NULL);
return 0;
}
@@ -101,13 +96,6 @@ void InitMenuItems() mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
Menu_AddMainMenuItem(&mi);
- SET_UID(mi, 0x63929694, 0x2d3d, 0x4c5d, 0xa5, 0x2b, 0x64, 0x59, 0x72, 0x23, 0xe, 0x66);
- mi.position = 1000090001;
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
- mi.name.a = LPGEN("Delete all user history");
- mi.pszService = MS_HISTORY_DELETEALLCONTACTHISTORY;
- hDeleteContactMenu = Menu_AddContactMenuItem(&mi);
-
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
}
@@ -241,7 +229,6 @@ int CMPlugin::Load() hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE);
CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory);
- CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory);
CreateServiceFunction(MS_HISTORY_EXECUTE_TASK, ExecuteTaskService);
Options::instance = new Options();
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 353de121b9..97471870c4 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -355,57 +355,6 @@ void HistoryWindow::OptionsSearchingChanged() }
}
-INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)
-{
- HWND hWnd = nullptr;
- int count = HistoryEventList::GetContactMessageNumber(hContact);
- if (!count)
- return FALSE;
-
- for (auto it = windows.begin(); it != windows.end(); ++it) {
- if (!it->second->isDestroyed) {
- if (it->second->m_hContact == hContact) {
- if (hWnd == nullptr) {
- hWnd = it->second->m_hWnd;
- }
- else if (GetForegroundWindow() == it->second->m_hWnd) {
- hWnd = it->second->m_hWnd;
- }
- }
- }
- }
-
- for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
- if (!(*it)->isDestroyed) {
- if ((*it)->m_hContact == hContact) {
- if (hWnd == nullptr)
- hWnd = (*it)->m_hWnd;
- else if (GetForegroundWindow() == (*it)->m_hWnd)
- hWnd = (*it)->m_hWnd;
- }
- }
- }
-
- wchar_t *message = TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?");
- if (MessageBox(hWnd, message, TranslateT("Are you sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
- return FALSE;
-
- db_set_safety_mode(FALSE);
- DB::ECPTR cursor(DB::Events(hContact));
- while (cursor.FetchNext())
- cursor.DeleteEvent();
- db_set_safety_mode(TRUE);
-
- if (HistoryEventList::IsImportedHistory(hContact)) {
- message = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
- if (MessageBox(hWnd, message, TranslateT("Are you sure?"), MB_YESNO | MB_ICONERROR) == IDYES)
- HistoryEventList::DeleteImporter(hContact);
- }
-
- RebuildEvents(hContact);
- return TRUE;
-}
-
bool HistoryWindow::IsInList(HWND hWnd)
{
for (auto it = windows.begin(); it != windows.end(); ++it)
@@ -1917,7 +1866,7 @@ void HistoryWindow::Delete(int what) toDelete = (int)end;
}
else {
- DeleteAllUserHistory(m_hContact, 0);
+ CallService(MS_HISTORY_EMPTY, m_hContact, 0);
return;
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h index 8b19d2f439..e7e85d9e7d 100644 --- a/plugins/BasicHistory/src/HistoryWindow.h +++ b/plugins/BasicHistory/src/HistoryWindow.h @@ -80,7 +80,6 @@ public: static void RebuildEvents(MCONTACT hContact);
static bool IsInList(HWND hWnd);
static int FontsChanged(WPARAM wParam, LPARAM lParam);
- static INT_PTR DeleteAllUserHistory(WPARAM wParam, LPARAM lParam);
static void OptionsMainChanged();
static void OptionsGroupChanged();
static void OptionsSearchingChanged();
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index 7df2cae662..c2c25f171f 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -3232,7 +3232,7 @@ end; procedure THistoryFrm.EmptyHistory1Click(Sender: TObject);
begin
- CallService(MS_HPP_EMPTYHISTORY, hContact, 0);
+ CallService(MS_HISTORY_EMPTY, hContact, 0);
end;
procedure THistoryFrm.EndHotFilterTimer(DoClearFilter: Boolean = False);
diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr index 68006d6a92..e0c8c3add6 100644 --- a/plugins/HistoryPlusPlus/historypp.dpr +++ b/plugins/HistoryPlusPlus/historypp.dpr @@ -70,7 +70,7 @@ uses var
MenuCount: Integer = -1;
PrevShowHistoryCount: Boolean = False;
- hmiEmpty, hmiContact: THandle;
+ hmiContact: THandle;
const
hLangpack:THANDLE = 0;
@@ -222,14 +222,6 @@ begin menuItem.hIcon := hppIcons[HPP_ICON_CONTACTHISTORY].handle;
hmiContact := Menu_AddContactMenuItem(@menuItem);
- // create empty item in contact menu
- SET_UID(@menuItem, 'BA23B260-0AF7-4336-9703-D47C9AD7B1B0');
- menuItem.Position := 1000090001;
- menuItem.szName.w := '&Empty History';
- menuItem.pszService := MS_HPP_EMPTYHISTORY;
- menuItem.hIcon := hppIcons[HPP_ICON_TOOL_DELETEALL].handle;
- hmiEmpty := Menu_AddContactMenuItem(@menuItem);
-
// create menu item in main menu for history search
SET_UID(@menuItem, 'A5FE6AE6-7674-4DC0-9F22-9F56AE71E2D7');
menuItem.Position := 500060001;
@@ -238,14 +230,6 @@ begin menuItem.hIcon := hppIcons[HPP_ICON_GLOBALSEARCH].handle;
Menu_AddMainMenuItem(@menuItem);
- // create menu item in main menu for empty system history
- SET_UID(@menuItem, '633AD23C-24B5-4914-B240-AD9FACB564ED');
- menuItem.Position := 500060002;
- menuItem.szName.w := '&Empty System History';
- menuItem.pszService := MS_HPP_EMPTYHISTORY;
- menuItem.hIcon := hppIcons[HPP_ICON_TOOL_DELETEALL].handle;
- Menu_AddMainMenuItem(@menuItem);
-
LoadGridOptions;
HookSettingsChanged := HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingsChanged);
@@ -422,7 +406,6 @@ begin hLast := db_event_last(hContact);
if (PrevShowHistoryCount xor ShowHistoryCount) or (count <> MenuCount) then
begin
- Menu_ShowItem(hmiEmpty, byte(hLast <> 0));
Menu_ShowItem(hmiContact, byte(hLast <> 0));
if ShowHistoryCount then
diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas index 9bae1efa3c..46fb13d739 100644 --- a/plugins/HistoryPlusPlus/hpp_global.pas +++ b/plugins/HistoryPlusPlus/hpp_global.pas @@ -214,37 +214,36 @@ const HPP_ICON_HOTSEARCH = 13;
HPP_ICON_SEARCHUP = 14;
HPP_ICON_SEARCHDOWN = 15;
- HPP_ICON_TOOL_DELETEALL = 16;
- HPP_ICON_TOOL_DELETE = 17;
- HPP_ICON_TOOL_SESSIONS = 18;
- HPP_ICON_TOOL_SAVE = 19;
- HPP_ICON_TOOL_COPY = 20;
- HPP_ICON_SEARCH_ENDOFPAGE = 21;
- HPP_ICON_SEARCH_NOTFOUND = 22;
- HPP_ICON_HOTFILTERCLEAR = 23;
- HPP_ICON_SESS_HIDE = 24;
- HPP_ICON_DROPDOWNARROW = 25;
- HPP_ICON_CONTACDETAILS = 26;
- HPP_ICON_CONTACTMENU = 27;
- HPP_ICON_BOOKMARK = 28;
- HPP_ICON_BOOKMARK_ON = 29;
- HPP_ICON_BOOKMARK_OFF = 30;
- HPP_ICON_SEARCHADVANCED = 31;
- HPP_ICON_SEARCHRANGE = 32;
+ HPP_ICON_TOOL_DELETE = 16;
+ HPP_ICON_TOOL_SESSIONS = 17;
+ HPP_ICON_TOOL_SAVE = 18;
+ HPP_ICON_TOOL_COPY = 29;
+ HPP_ICON_SEARCH_ENDOFPAGE = 20;
+ HPP_ICON_SEARCH_NOTFOUND = 21;
+ HPP_ICON_HOTFILTERCLEAR = 22;
+ HPP_ICON_SESS_HIDE = 23;
+ HPP_ICON_DROPDOWNARROW = 24;
+ HPP_ICON_CONTACDETAILS = 25;
+ HPP_ICON_CONTACTMENU = 26;
+ HPP_ICON_BOOKMARK = 27;
+ HPP_ICON_BOOKMARK_ON = 28;
+ HPP_ICON_BOOKMARK_OFF = 39;
+ HPP_ICON_SEARCHADVANCED = 30;
+ HPP_ICON_SEARCHRANGE = 31;
- HPP_ICON_EVENT_INCOMING = 33;
- HPP_ICON_EVENT_OUTGOING = 34;
- HPP_ICON_EVENT_SYSTEM = 35;
- HPP_ICON_EVENT_CONTACTS = 36;
- HPP_ICON_EVENT_STATUS = 37;
- HPP_ICON_EVENT_SMTPSIMPLE = 38;
- HPP_ICON_EVENT_NICK = 39;
- HPP_ICON_EVENT_AVATAR = 40;
- HPP_ICON_EVENT_WATRACK = 41;
- HPP_ICON_EVENT_STATUSMES = 42;
- HPP_ICON_EVENT_VOICECALL = 43;
-
- HppIconsCount = 44;
+ HPP_ICON_EVENT_INCOMING = 32;
+ HPP_ICON_EVENT_OUTGOING = 33;
+ HPP_ICON_EVENT_SYSTEM = 34;
+ HPP_ICON_EVENT_CONTACTS = 35;
+ HPP_ICON_EVENT_STATUS = 36;
+ HPP_ICON_EVENT_SMTPSIMPLE = 37;
+ HPP_ICON_EVENT_NICK = 38;
+ HPP_ICON_EVENT_AVATAR = 39;
+ HPP_ICON_EVENT_WATRACK = 40;
+ HPP_ICON_EVENT_STATUSMES = 41;
+ HPP_ICON_EVENT_VOICECALL = 42;
+
+ HppIconsCount = 43;
HPP_SKIN_EVENT_MESSAGE = 0;
HPP_SKIN_EVENT_URL = 1;
diff --git a/plugins/HistoryPlusPlus/hpp_options.pas b/plugins/HistoryPlusPlus/hpp_options.pas index 262452821d..103986f9e9 100644 --- a/plugins/HistoryPlusPlus/hpp_options.pas +++ b/plugins/HistoryPlusPlus/hpp_options.pas @@ -98,7 +98,7 @@ const DEFFORMAT_SELECTION = '%selmes%\n';
DEFFORMAT_DATETIME = 'c'; // ShortDateFormat + LongTimeFormat
- hppIconsDefs : array[0..32] of ThppIconsRec = (
+ hppIconsDefs : array[0..31] of ThppIconsRec = (
(name:'historypp_01'; desc:'Contact history'; group: nil; i:HPP_ICON_CONTACTHISTORY),
(name:'historypp_02'; desc:'History search'; group: nil; i:HPP_ICON_GLOBALSEARCH),
(name:'historypp_03'; desc:'Conversation divider'; group: 'Conversations'; i:HPP_ICON_SESS_DIVIDER),
@@ -115,7 +115,6 @@ const (name:'historypp_14'; desc:'Search'; group: 'Toolbar'; i:HPP_ICON_HOTSEARCH),
(name:'historypp_15'; desc:'Search Up'; group: 'Search panel'; i:HPP_ICON_SEARCHUP),
(name:'historypp_16'; desc:'Search Down'; group: 'Search panel'; i:HPP_ICON_SEARCHDOWN),
- (name:'historypp_17'; desc:'Delete All'; group: 'Toolbar'; i:HPP_ICON_TOOL_DELETEALL),
(name:'historypp_18'; desc:'Delete'; group: 'Toolbar'; i:HPP_ICON_TOOL_DELETE),
(name:'historypp_19'; desc:'Conversations'; group: 'Toolbar'; i:HPP_ICON_TOOL_SESSIONS),
(name:'historypp_20'; desc:'Save'; group: 'Toolbar'; i:HPP_ICON_TOOL_SAVE),
diff --git a/plugins/HistoryPlusPlus/hpp_services.pas b/plugins/HistoryPlusPlus/hpp_services.pas index 4ee1d5c161..ba4be43229 100644 --- a/plugins/HistoryPlusPlus/hpp_services.pas +++ b/plugins/HistoryPlusPlus/hpp_services.pas @@ -202,27 +202,11 @@ begin Result := 0;
end;
-// MS_HPP_EMPTYHISTORY service
-// See m_historypp.inc for details
-function HppEmptyHistory(wParam { hContact } : WPARAM; lParam { 0 } : LPARAM): uint_ptr; cdecl;
-var
- wHistory: THistoryFrm;
-begin
- wHistory := FindContactWindow(wParam);
- with TEmptyHistoryFrm.Create(wHistory) do
- begin
- Contact := wParam;
- Result := int_ptr(ShowModal = mrYes);
- Free;
- end;
-end;
-
procedure hppRegisterServices;
begin
HstWindowList := TList.Create;
CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY,@HppShowHistory);
- CreateServiceFunction(MS_HPP_EMPTYHISTORY, @HppEmptyHistory);
CreateServiceFunction(MS_HPP_GETVERSION, @HppGetVersion);
CreateServiceFunction(MS_HPP_SHOWGLOBALSEARCH,@HppShowGlobalSearch);
CreateServiceFunction(MS_HPP_OPENHISTORYEVENT,@HppOpenHistoryEvent);
diff --git a/plugins/HistoryPlusPlus/m_historypp.inc b/plugins/HistoryPlusPlus/m_historypp.inc index 3bd0de87c5..1947ad98e6 100644 --- a/plugins/HistoryPlusPlus/m_historypp.inc +++ b/plugins/HistoryPlusPlus/m_historypp.inc @@ -180,12 +180,4 @@ const // Return - current version, via PLUGIN_MAKE_VERSION macro MS_HPP_GETVERSION = 'History++/GetVersion'; - // MS_HPP_EMPTYHISTORY - // (supported from 1.5.0.118) - // Erases contact's history - // wParam - hContact - // lParam - zero - // Notes - hContact can be NULL(0) to empty system history - MS_HPP_EMPTYHISTORY = 'History++/EmptyHistory'; - {$ENDIF} diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp index d69706efad..78001166de 100644 --- a/plugins/NewStory/src/history.cpp +++ b/plugins/NewStory/src/history.cpp @@ -602,7 +602,7 @@ public: void onClick_Delete(CCtrlButton *) { - svcEmptyHistory(m_hContact, 0); + CallService(MS_HISTORY_EMPTY, m_hContact, 0); m_histControl.SendMsg(NSM_CLEAR, 0, 0); UpdateTitle(); diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h index f7f448abd1..9a8caeca08 100644 --- a/plugins/NewStory/src/history.h +++ b/plugins/NewStory/src/history.h @@ -32,7 +32,6 @@ extern MWindowList hNewstoryWindows; void InitHistory(); void InitMenus(); -INT_PTR svcEmptyHistory(WPARAM hContact, LPARAM); INT_PTR svcShowNewstory(WPARAM wParam, LPARAM lParam); CSrmmLogWindow* __cdecl NewStory_Stub(CMsgDialog &pDlg); diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index 2a5b05c240..f7275a3016 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -1,31 +1,17 @@ #include "stdafx.h" -static HGENMENU hmiHistory, hmiEmpty; - -INT_PTR svcEmptyHistory(WPARAM hContact, LPARAM) -{ - if (IDYES != MessageBoxW(nullptr, TranslateT("Are you sure to remove all events from history?"), _T(MODULETITLE), MB_YESNOCANCEL | MB_ICONQUESTION)) - return 1; - - DB::ECPTR pCursor(DB::Events(hContact)); - while (pCursor.FetchNext()) - pCursor.DeleteEvent(); - return 0; -} +static HGENMENU hmiHistory; static int OnPrebuildContactMenu(WPARAM hContact, LPARAM) { - bool bShow = (db_event_first(hContact) != 0); - Menu_ShowItem(hmiEmpty, bShow); - Menu_ShowItem(hmiHistory, bShow); + Menu_ShowItem(hmiHistory, db_event_first(hContact) != 0); return 0; } void InitMenus() { - CMenuItem mi(&g_plugin); - // Contact menu items + CMenuItem mi(&g_plugin); SET_UID(mi, 0xc20d7a69, 0x7607, 0x4aad, 0xa7, 0x42, 0x10, 0x86, 0xfb, 0x32, 0x49, 0x21); mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; mi.name.a = LPGEN("User history"); @@ -34,13 +20,5 @@ void InitMenus() hmiHistory = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, svcShowNewstory); - SET_UID(mi, 0x0d4306aa, 0xe31e, 0x46ee, 0x89, 0x88, 0x3a, 0x2e, 0x05, 0xa6, 0xf3, 0xbc); - mi.pszService = "Newstory/EmptyHistory"; - mi.name.a = LPGEN("Empty history"); - mi.position = 1000090001; - mi.hIcon = Skin_LoadIcon(SKINICON_OTHER_DELETE); - hmiEmpty = Menu_AddContactMenuItem(&mi); - CreateServiceFunction(mi.pszService, svcEmptyHistory); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); } |