diff options
Diffstat (limited to 'src/modules/history/history.cpp')
-rw-r--r-- | src/modules/history/history.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp index 6e502790b9..ee3f039624 100644 --- a/src/modules/history/history.cpp +++ b/src/modules/history/history.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -33,19 +33,19 @@ static HANDLE hWindowList=0; static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM)
{
- HWND hwnd = WindowList_Find( hWindowList,( HANDLE )wParam );
+ HWND hwnd = WindowList_Find( hWindowList, ( HANDLE )wParam );
if ( hwnd ) {
SetForegroundWindow(hwnd);
SetFocus(hwnd);
return 0;
}
- CreateDialogParam(hMirandaInst,MAKEINTRESOURCE(IDD_HISTORY),NULL,DlgProcHistory,wParam);
+ CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam);
return 0;
}
static int HistoryContactDelete(WPARAM wParam, LPARAM)
{
- HWND hwnd = WindowList_Find(hWindowList,(HANDLE)wParam);
+ HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam);
if ( hwnd != NULL )
DestroyWindow(hwnd);
return 0;
@@ -54,7 +54,7 @@ static int HistoryContactDelete(WPARAM wParam, LPARAM) int PreShutdownHistoryModule(WPARAM, LPARAM)
{
if (hWindowList)
- WindowList_BroadcastAsync(hWindowList,WM_DESTROY,0,0);
+ WindowList_BroadcastAsync(hWindowList, WM_DESTROY, 0, 0);
return 0;
}
@@ -67,12 +67,12 @@ int LoadHistoryModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_HISTORY );
mi.pszName = LPGEN("View &History");
mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
- CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi);
+ Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY,UserHistoryCommand);
- hWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
- HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule);
+ CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, UserHistoryCommand);
+ hWindowList=(HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule);
return 0;
}
@@ -195,42 +195,42 @@ static void FillHistoryThread(void* param) TCHAR str[200], eventText[256], strdatetime[64];
HANDLE hDbEvent;
DBEVENTINFO dbei;
- int newBlobSize,oldBlobSize,i;
+ int newBlobSize, oldBlobSize, i;
HWND hwndList;
THistoryThread *hInfo = ( THistoryThread* )param;
- SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_RESETCONTENT,0,0);
- i=CallService(MS_DB_EVENT_GETCOUNT,(WPARAM)hInfo->hContact,0);
- SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_INITSTORAGE,i,i*40);
+ SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0);
+ i=CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)hInfo->hContact, 0);
+ SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_INITSTORAGE, i, i*40);
- ZeroMemory(&dbei,sizeof(dbei));
+ ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize=sizeof(dbei);
oldBlobSize=0;
- hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST,(WPARAM)hInfo->hContact,0);
- hwndList = GetDlgItem(hInfo->hwnd,IDC_LIST);
+ hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hInfo->hContact, 0);
+ hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST);
while ( hDbEvent != NULL ) {
if ( !IsWindow( hInfo->hwnd ))
break;
- newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0);
+ newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
if (newBlobSize>oldBlobSize) {
- dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob,newBlobSize);
+ dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob, newBlobSize);
oldBlobSize=newBlobSize;
}
dbei.cbBlob = oldBlobSize;
CallService( MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei );
- GetObjectSummary(&dbei,str,SIZEOF(str));
+ GetObjectSummary(&dbei, str, SIZEOF(str));
if (str[0]) {
tmi.printTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, SIZEOF(strdatetime), 0);
mir_sntprintf( eventText, SIZEOF(eventText), _T("%s: %s"), strdatetime, str );
i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText );
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
- hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDPREV,(WPARAM)hDbEvent,0);
+ hDbEvent=(HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
}
mir_free(dbei.pBlob);
- SendDlgItemMessage(hInfo->hwnd,IDC_LIST,LB_SETCURSEL,0,0);
- SendMessage(hInfo->hwnd,WM_COMMAND,MAKEWPARAM(IDC_LIST,LBN_SELCHANGE),0);
+ SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_SETCURSEL, 0, 0);
+ SendMessage(hInfo->hwnd, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
EnableWindow(GetDlgItem(hInfo->hwnd, IDC_LIST), TRUE);
mir_free(hInfo);
}
@@ -255,22 +255,22 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
HANDLE hContact;
- hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ hContact=(HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
hContact = (HANDLE)lParam;
- WindowList_Add(hWindowList,hwndDlg,hContact);
- Utils_RestoreWindowPosition(hwndDlg,hContact,"History","");
+ WindowList_Add(hWindowList, hwndDlg, hContact);
+ Utils_RestoreWindowPosition(hwndDlg, hContact, "History", "");
{
TCHAR* contactName, str[200];
contactName = cli.pfnGetContactDisplayName( hContact, 0 );
- mir_sntprintf(str,SIZEOF(str),TranslateT("History for %s"),contactName);
- SetWindowText(hwndDlg,str);
+ mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"), contactName);
+ SetWindowText(hwndDlg, str);
}
Window_SetIcon_IcoLib(hwndDlg, SKINICON_OTHER_HISTORY);
- SendMessage(hwndDlg,DM_HREBUILD,0,0);
+ SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
return TRUE;
case DM_HREBUILD:
@@ -285,8 +285,8 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
- Utils_SaveWindowPosition(hwndDlg,hContact,"History","");
- WindowList_Remove(hWindowList,hwndDlg);
+ Utils_SaveWindowPosition(hwndDlg, hContact, "History", "");
+ WindowList_Remove(hWindowList, hwndDlg);
return TRUE;
case WM_GETMINMAXINFO:
@@ -302,7 +302,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP urd.lpTemplate=MAKEINTRESOURCEA(IDD_HISTORY);
urd.lParam=(LPARAM)NULL;
urd.pfnResizer=HistoryDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
return TRUE;
}
case WM_COMMAND:
@@ -319,37 +319,37 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_DELETEHISTORY:
{
HANDLE hDbevent;
- int index = SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0);
+ int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if ( index == LB_ERR )
break;
- if ( MessageBox(hwndDlg,TranslateT("Are you sure you want to delete this history item?"),TranslateT("Delete History"),MB_YESNO|MB_ICONQUESTION) == IDYES) {
- hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,index,0);
- CallService(MS_DB_EVENT_DELETE,(WPARAM)hContact,(LPARAM)hDbevent);
- SendMessage(hwndDlg,DM_HREBUILD,0,0);
+ if ( MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete History"), MB_YESNO|MB_ICONQUESTION) == IDYES) {
+ hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
+ CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hDbevent);
+ SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
}
return TRUE;
}
case IDC_LIST:
if ( HIWORD(wParam) == LBN_SELCHANGE ) {
- TCHAR str[8192],*contactName;
+ TCHAR str[8192], *contactName;
HANDLE hDbEvent;
DBEVENTINFO dbei;
int sel;
- sel=SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0);
- if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),FALSE); break; }
- EnableWindow(GetDlgItem(hwndDlg,IDC_DELETEHISTORY),TRUE);
+ sel=SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
+ if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), FALSE); break; }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), TRUE);
contactName = cli.pfnGetContactDisplayName( hContact, 0 );
- hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,sel,0);
- ZeroMemory(&dbei,sizeof(dbei));
+ hDbEvent=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0);
+ ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize=sizeof(dbei);
- dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0);
+ dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
if ((int)dbei.cbBlob != -1)
{
dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei) == 0)
+ if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0)
{
- GetObjectDescription(&dbei,str,SIZEOF(str));
+ GetObjectDescription(&dbei, str, SIZEOF(str));
if ( str[0] )
SetDlgItemText(hwndDlg, IDC_EDIT, str);
}
@@ -362,39 +362,39 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP case DM_FINDNEXT:
{
TCHAR str[1024];
- HANDLE hDbEvent,hDbEventStart;
+ HANDLE hDbEvent, hDbEventStart;
DBEVENTINFO dbei;
- int newBlobSize,oldBlobSize;
+ int newBlobSize, oldBlobSize;
- int index = SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETCURSEL,0,0);
+ int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if ( index == LB_ERR )
break;
- hDbEventStart=(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,index,0);
- ZeroMemory(&dbei,sizeof(dbei));
+ hDbEventStart=(HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
+ ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize=sizeof(dbei);
dbei.pBlob=NULL;
oldBlobSize=0;
for (;;) {
- hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,LB_GETITEMDATA,++index,0);
+ hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, ++index, 0);
if (hDbEvent == ( HANDLE )LB_ERR) {
index = -1;
continue;
}
if (hDbEvent == hDbEventStart) break;
- newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)hDbEvent,0);
+ newBlobSize=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
if (newBlobSize>oldBlobSize) {
- dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob,newBlobSize);
+ dbei.pBlob=(PBYTE)mir_realloc(dbei.pBlob, newBlobSize);
oldBlobSize=newBlobSize;
}
dbei.cbBlob=oldBlobSize;
- CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- GetObjectDescription(&dbei,str,SIZEOF(str));
+ CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ GetObjectDescription(&dbei, str, SIZEOF(str));
if (str[0]) {
- CharUpperBuff(str,lstrlen(str));
- if ( _tcsstr(str,(const TCHAR*)lParam) != NULL) {
- SendDlgItemMessage(hwndDlg,IDC_LIST,LB_SETCURSEL,index,0);
- SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_LIST,LBN_SELCHANGE),0);
+ CharUpperBuff(str, lstrlen(str));
+ if ( _tcsstr(str, (const TCHAR*)lParam) != NULL) {
+ SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
break;
} } }
@@ -420,8 +420,8 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam TCHAR str[128];
HWND hwndParent = ( HWND )GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, SIZEOF(str));
- CharUpperBuff(str,lstrlen(str));
- SendMessage(hwndParent,DM_FINDNEXT,0,(LPARAM)str);
+ CharUpperBuff(str, lstrlen(str));
+ SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return TRUE;
}
case IDCANCEL:
|