From b665a90f50f09435aef5bc3b5b9da710e4558690 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 16:54:27 +0000 Subject: various menu items quirks, simplifications & optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@4319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/clist.cpp | 221 ++++++++++++++++------------------ plugins/Scriver/src/chat/log.cpp | 16 +-- plugins/Scriver/src/chat/main.cpp | 2 +- plugins/Scriver/src/chat/manager.cpp | 6 +- plugins/Scriver/src/chat/options.cpp | 34 +++--- plugins/Scriver/src/chat/services.cpp | 16 +-- plugins/Scriver/src/chat/tools.cpp | 4 +- plugins/Scriver/src/chat/window.cpp | 62 +++++----- 8 files changed, 175 insertions(+), 186 deletions(-) (limited to 'plugins/Scriver/src/chat') diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 9ce653839e..697d46c94d 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" -extern HANDLE hJoinMenuItem, hLeaveMenuItem; +extern HGENMENU hJoinMenuItem, hLeaveMenuItem; HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType) { @@ -30,58 +30,57 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p TCHAR pszGroup[50]; *pszGroup = '\0'; - if ( !DBGetContactSettingTString( NULL, "Chat", "AddToGroup", &dbv )) { - if ( lstrlen( dbv.ptszVal ) > 0 ) + if ( !DBGetContactSettingTString(NULL, "Chat", "AddToGroup", &dbv)) { + if ( lstrlen(dbv.ptszVal) > 0 ) lstrcpyn( pszGroup, dbv.ptszVal, 50); - DBFreeVariant(&dbv); + db_free(&dbv); } else lstrcpyn( pszGroup, _T("Chat rooms"), 50); - if ( pszGroup[0] ) + if (pszGroup[0]) CList_CreateGroup(pszGroup); - if ( hContact ) { //contact exist, make sure it is in the right group - DBVARIANT dbv; - DBVARIANT dbv2; - char str[50]; - int i; - - if ( pszGroup[0] ) { - for (i = 0;; i++) { + if (hContact) { //contact exist, make sure it is in the right group + if (pszGroup[0]) { + for (int i = 0;; i++) { + char str[50]; _itoa(i, str, 10); - if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) { - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup); + + DBVARIANT dbv, dbv2; + if (DBGetContactSettingTString( NULL, "CListGroups", str, &dbv)) { + db_set_ts(hContact, "CList", "Group", pszGroup); goto END_GROUPLOOP; } if ( !DBGetContactSettingTString( hContact, "CList", "Group", &dbv2 )) { if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) { - DBFreeVariant(&dbv); - DBFreeVariant(&dbv2); - goto END_GROUPLOOP; - } - DBFreeVariant(&dbv2); + db_free(&dbv); + db_free(&dbv2); + goto END_GROUPLOOP; } - DBFreeVariant(&dbv); - } } + db_free(&dbv2); + } + db_free(&dbv); + } + } END_GROUPLOOP: db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE); - DBWriteContactSettingTString(hContact, pszModule, "Nick", pszDisplayName ); + db_set_ts(hContact, pszModule, "Nick", pszDisplayName ); return hContact; } // here we create a new one since no one is to be found - if (( hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL ) + if ((hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL) return NULL; - CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule); + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)pszModule); if ( lstrlen( pszGroup ) > 0 ) - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup ); + db_set_ts(hContact, "CList", "Group", pszGroup); else - DBDeleteContactSetting(hContact, "CList", "Group"); - DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName ); - DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom ); + db_unset(hContact, "CList", "Group"); + db_set_ts( hContact, pszModule, "Nick", pszDisplayName); + db_set_ts( hContact, pszModule, "ChatRoomID", pszRoom); db_set_b(hContact, pszModule, "ChatRoom", (BYTE)iType); db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE); return hContact; @@ -89,9 +88,9 @@ END_GROUPLOOP: BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) { - if ( hContact ) { - char * szProto = GetContactProto(hContact); - db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0); + if (hContact) { + char *szProto = GetContactProto(hContact); + db_set_w(hContact, szProto,"ApparentMode",(LPARAM)0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); return TRUE; } @@ -101,27 +100,25 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) { - HANDLE hContact = db_find_first(); - while ( hContact ) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); - if ( MM_FindModule( szProto )) { + if ( MM_FindModule(szProto)) { if (!pszModule || (pszModule && !strcmp(pszModule, szProto))) { int i = db_get_b(hContact, szProto, "ChatRoom", 0); - if ( i != 0 ) { - db_set_w(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0); + if (i != 0) { + db_set_w(hContact, szProto, "ApparentMode", 0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } } } - hContact = db_find_next(hContact); } return TRUE; } -int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) +int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) { - DBVARIANT dbv; - char *szProto; + DBVARIANT dbv; + char *szProto; HANDLE hContact = (HANDLE)wParam; if (!hContact) @@ -136,19 +133,18 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto ); if ( si ) { // is the "toggle visibility option set, so we need to close the window? - if (si->hWnd != NULL - && db_get_b(NULL, "Chat", "ToggleVisibility", 0)==1 - && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) - && IsWindowVisible(si->hWnd) - && !IsIconic(si->hWnd)) - { + if (si->hWnd != NULL && + db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1 && + !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && + IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) + { PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0); - DBFreeVariant(&dbv); + db_free(&dbv); return 1; } ShowRoom(si, WINDOW_VISIBLE, TRUE); } - DBFreeVariant(&dbv); + db_free(&dbv); return 1; } } @@ -157,7 +153,7 @@ int CList_RoomDoubleclicked(WPARAM wParam,LPARAM lParam) int CList_EventDoubleclicked(WPARAM wParam,LPARAM lParam) { - return CList_RoomDoubleclicked((WPARAM) ((CLISTEVENT*)lParam)->hContact,(LPARAM) 0); + return CList_RoomDoubleclicked((WPARAM) ((CLISTEVENT*)lParam)->hContact,(LPARAM)0); } INT_PTR CList_EventDoubleclickedSvc(WPARAM wParam,LPARAM lParam) @@ -168,15 +164,16 @@ INT_PTR CList_EventDoubleclickedSvc(WPARAM wParam,LPARAM lParam) INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); - if ( szProto ) { - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); - else - CList_RoomDoubleclicked( wParam, 0 ); - } } + if (hContact == NULL) + return 0; + char* szProto = GetContactProto(hContact); + if ( szProto ) { + if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) + CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); + else + CList_RoomDoubleclicked( wParam, 0 ); + } return 0; } @@ -194,31 +191,28 @@ INT_PTR CList_LeaveChat(WPARAM wParam, LPARAM lParam) int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - if ( hContact ) { - char* szProto = GetContactProto(hContact); - - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; - - if ( szProto ) { - // display this menu item only for chats - if ( db_get_b( hContact, szProto, "ChatRoom", 0 )) { - // still hide it for offline protos - if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) { - clmi.flags &= ~CMIF_HIDDEN; - clmi.flags |= CMIM_NAME; - - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - clmi.pszName = ( char* )LPGEN("Join chat"); - else - clmi.pszName = ( char* )LPGEN("Open chat window"); - } } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&clmi ); + if (hContact == NULL) + return 0; - clmi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); - clmi.flags |= CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&clmi ); - } + bool bEnabled = false; + char *szProto = GetContactProto(hContact); + if (szProto) { + // display this menu item only for chats + if (db_get_b(hContact, szProto, "ChatRoom", 0)) { + // still hide it for offline protos + if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) { + CLISTMENUITEM clmi = { sizeof(clmi) }; + clmi.flags = CMIM_NAME; + if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) + clmi.pszName = (char*)LPGEN("Join chat"); + else + clmi.pszName = (char*)LPGEN("Open chat window"); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hJoinMenuItem, (LPARAM)&clmi); + bEnabled = true; + } } } + + Menu_ShowItem(hJoinMenuItem, bEnabled); + Menu_ShowItem(hLeaveMenuItem, bEnabled); return 0; } @@ -230,83 +224,78 @@ INT_PTR CList_PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam) void CList_CreateGroup(TCHAR* group) { int i; - char str[50]; + char str[50]; TCHAR name[256]; - DBVARIANT dbv; + DBVARIANT dbv; if (!group) return; - for (i = 0;; i++) - { - _itoa(i, str, 10); + for (i = 0;; i++) { + _itoa(i, str, 10); if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) - break; + break; if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) { - DBFreeVariant(&dbv); - return; - } + db_free(&dbv); + return; + } - DBFreeVariant(&dbv); - } + db_free(&dbv); + } - // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0); + // CallService(MS_CLIST_GROUPCREATE, (WPARAM)group, 0); name[0] = 1 | GROUPF_EXPANDED; _tcsncpy(name + 1, group, SIZEOF(name) - 1); name[ lstrlen(group) + 1] = '\0'; - DBWriteContactSettingTString(NULL, "CListGroups", str, name); - CallService(MS_CLUI_GROUPADDED, i + 1, 0); + db_set_ts(NULL, "CListGroups", str, name); + CallService(MS_CLUI_GROUPADDED, i + 1, 0); } BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR* fmt, ... ) { - CLISTEVENT cle; - va_list marker; - TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR)); - if (!fmt || lstrlen(fmt) < 1 || lstrlen(fmt) > 2000) return FALSE; + TCHAR* szBuf = (TCHAR*)alloca(4096 * sizeof(TCHAR)); + va_list marker; va_start(marker, fmt); _vsntprintf(szBuf, 4096, fmt, marker); va_end(marker); - cle.cbSize=sizeof(cle); - cle.hContact=(HANDLE)hContact; - cle.hDbEvent=(HANDLE)event; + CLISTEVENT cle = { sizeof(cle) }; + cle.hContact = (HANDLE)hContact; + cle.hDbEvent = (HANDLE)event; cle.flags = type | CLEF_TCHAR; - cle.hIcon=Icon; - cle.pszService= "GChat/DblClickEvent" ; + cle.hIcon = Icon; + cle.pszService = "GChat/DblClickEvent" ; cle.ptszTooltip = TranslateTS(szBuf); if ( type ) { if (!CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) - CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM) &cle); - } else { + CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM)&cle); + } + else { if (CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)event); - CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM) &cle); + CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM)&cle); } return TRUE; } HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) { - HANDLE hContact = db_find_first(); - while (hContact) { + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto && !lstrcmpiA(szProto, pszModule)) { - if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0 ) { + if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0) { DBVARIANT dbv; - if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) { + if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv)) { if ( !lstrcmpi(dbv.ptszVal, pszRoom)) { - DBFreeVariant(&dbv); + db_free(&dbv); return hContact; } - DBFreeVariant(&dbv); + db_free(&dbv); } } } - - hContact = db_find_next(hContact); } return 0; } diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index ad3b3092e6..ac05d01576 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -780,17 +780,17 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr scroll.cbSize= sizeof(SCROLLINFO); scroll.fMask= SIF_RANGE | SIF_POS|SIF_PAGE; GetScrollInfo(hwndRich, SB_VERT, &scroll); - SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM) &point); + SendMessage(hwndRich, EM_GETSCROLLPOS, 0, (LPARAM)&point); // do not scroll to bottom if there is a selection - SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM) &oldsel); + SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&oldsel); if (oldsel.cpMax != oldsel.cpMin) SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); //set the insertion point at the bottom sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel); - SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM) & sel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)& sel); // fix for the indent... must be a M$ bug if (sel.cpMax == 0) @@ -810,7 +810,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr // stream in the event(s) streamData.lin = lin; streamData.bRedraw = bRedraw; - SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM) & stream); + SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM)& stream); // do smileys if (g_dat.smileyAddInstalled && (bRedraw @@ -843,12 +843,12 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr SendMessage(GetParent(hwndRich), GC_SCROLLTOBOTTOM, 0, 0); } else - SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM) &point); + SendMessage(hwndRich, EM_SETSCROLLPOS, 0, (LPARAM)&point); // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & oldsel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& oldsel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } @@ -857,7 +857,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr if (bFlag) { sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& sel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } } } diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 5009e3bdbc..56ca3965ef 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -25,7 +25,7 @@ void RegisterChatFonts( void ); //globals HMENU g_hMenu = NULL; -HANDLE hJoinMenuItem, hLeaveMenuItem; +HGENMENU hJoinMenuItem, hLeaveMenuItem; FONTINFO aFonts[OPTIONS_FONTCOUNT]; HBRUSH hListBkgBrush = NULL; diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 28eb7e91ff..5d1ef90de1 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -121,7 +121,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta } DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule , "Topic", ""); DBWriteContactSettingString(pTemp->windowData.hContact, pTemp->pszModule, "StatusBar", ""); - DBDeleteContactSetting(pTemp->windowData.hContact, "CList", "StatusMsg"); + db_unset(pTemp->windowData.hContact, "CList", "StatusMsg"); if (removeContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)pTemp->windowData.hContact, 0); @@ -585,7 +585,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) if ( pTemp->windowData.hContact ) { if ( pTemp->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE ) - DBDeleteContactSetting(pTemp->windowData.hContact, "CList", "Hidden"); + db_unset(pTemp->windowData.hContact, "CList", "Hidden"); db_set_w(pTemp->windowData.hContact, pTemp->pszModule, "Status", (WORD)wStatus); } @@ -682,7 +682,7 @@ BOOL SM_RemoveAll (void) if (m_WndList->windowData.hContact) CList_SetOffline(m_WndList->windowData.hContact, m_WndList->iType == GCW_CHATROOM?TRUE:FALSE); DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule , "Topic", ""); - DBDeleteContactSetting(m_WndList->windowData.hContact, "CList", "StatusMsg"); + db_unset(m_WndList->windowData.hContact, "CList", "StatusMsg"); DBWriteContactSettingString(m_WndList->windowData.hContact, m_WndList->pszModule, "StatusBar", ""); UM_RemoveAll(&m_WndList->pUsers); diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 4a82d7da0d..e2826f56f1 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -236,7 +236,7 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) DBVARIANT dbv; if ( !DBGetContactSettingTString(NULL, "Chat", pszSetting, &dbv )) { replaceStr( ppPointer, dbv.ptszVal ); - DBFreeVariant(&dbv); + db_free(&dbv); } else replaceStr( ppPointer, pszDefault ); } @@ -338,7 +338,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if (iLen > 0) db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); else - DBDeleteContactSetting(NULL, "Chat", "NicklistRowDist"); + db_unset(NULL, "Chat", "NicklistRowDist"); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, SIZEOF(branch4)); @@ -371,9 +371,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHAT_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETRANGE,0,MAKELONG(5000,0)); - SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LogLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LogLimit",100),0)); SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0)); - SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LoggingLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LoggingLimit",100),0)); { TCHAR tszTemp[MAX_PATH]; PathToRelativeT(g_Settings.pszLogDir, tszTemp); @@ -546,23 +546,23 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa *p2 = ' '; p2 = _tcschr(ptszText, (TCHAR)','); } - DBWriteContactSettingTString(NULL, "Chat", "HighlightWords", ptszText); + db_set_ts(NULL, "Chat", "HighlightWords", ptszText); mir_free(ptszText); } } - else DBDeleteContactSetting(NULL, "Chat", "HighlightWords"); + else db_unset(NULL, "Chat", "HighlightWords"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); if ( iLen > 0 ) { TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2); GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); - DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText1); + db_set_ts(NULL, "Chat", "LogDirectory", pszText1); PathToAbsoluteT(pszText1, g_Settings.pszLogDir); free(pszText1); } else { lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); - DBDeleteContactSetting(NULL, "Chat", "LogDirectory"); + db_unset(NULL, "Chat", "LogDirectory"); } iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); @@ -571,7 +571,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "LogTimestamp"); + else db_unset(NULL, "Chat", "LogTimestamp"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_TIMESTAMP)); if ( iLen > 0 ) { @@ -579,7 +579,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderTime"); + else db_unset(NULL, "Chat", "HeaderTime"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_INSTAMP)); if ( iLen > 0 ) { @@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderIncoming"); + else db_unset(NULL, "Chat", "HeaderIncoming"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_OUTSTAMP)); if ( iLen > 0 ) { @@ -595,7 +595,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText); } - else DBDeleteContactSetting(NULL, "Chat", "HeaderOutgoing"); + else db_unset(NULL, "Chat", "HeaderOutgoing"); g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE; db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled); @@ -778,11 +778,11 @@ void LoadGlobalSettings(void) g_Settings.SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0); g_Settings.ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0); g_Settings.TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0); - g_Settings.iEventLimit = DBGetContactSettingWord(NULL, "Chat", "LogLimit", 100); + g_Settings.iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100); g_Settings.dwIconFlags = DBGetContactSettingDword(NULL, "Chat", "IconFlags", 0x0000); g_Settings.dwTrayIconFlags = DBGetContactSettingDword(NULL, "Chat", "TrayIconFlags", 0x1000); g_Settings.dwPopupFlags = DBGetContactSettingDword(NULL, "Chat", "PopupFlags", 0x0000); - g_Settings.LoggingLimit = DBGetContactSettingWord(NULL, "Chat", "LoggingLimit", 100); + g_Settings.LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100); g_Settings.LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0); g_Settings.FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0); g_Settings.HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1); @@ -796,7 +796,7 @@ void LoadGlobalSettings(void) g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1); g_Settings.AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1); g_Settings.iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1); - g_Settings.iPopupTimeout = DBGetContactSettingWord(NULL, "Chat", "PopupTimeout", 3); + g_Settings.iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3); g_Settings.crPUBkgColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW)); g_Settings.crPUTextColour = DBGetContactSettingDword(NULL, "Chat", "PopupColorText", 0); g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0); @@ -812,7 +812,7 @@ void LoadGlobalSettings(void) g_Settings.pszLogDir = (TCHAR *)mir_realloc(g_Settings.pszLogDir, MAX_PATH*sizeof(TCHAR)); if ( !DBGetContactSettingTString(NULL, "Chat", "LogDirectory", &dbv)) { lstrcpyn(g_Settings.pszLogDir, dbv.ptszVal, MAX_PATH); - DBFreeVariant(&dbv); + db_free(&dbv); } else lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); @@ -890,7 +890,7 @@ int OptionsInit(void) g_Settings.UserListFont = NULL; g_Settings.UserListHeadingsFont = NULL; g_Settings.MessageBoxFont = NULL; - g_Settings.iSplitterX = DBGetContactSettingWord(NULL, "Chat", "SplitterX", 105); + g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105); LoadGlobalSettings(); SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message")); diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index 6e798f364e..c9a578e76d 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -244,12 +244,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) else mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName); si->windowData.hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType); - si->windowData.codePage = DBGetContactSettingWord(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP); + si->windowData.codePage = db_get_w(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP); si->pszHeader = Log_CreateRtfHeader(mi, si); DBWriteContactSettingString(si->windowData.hContact, si->pszModule , "Topic", ""); - DBDeleteContactSetting(si->windowData.hContact, "CList", "StatusMsg"); + db_unset(si->windowData.hContact, "CList", "StatusMsg"); if (si->ptszStatusbarText) - DBWriteContactSettingTString(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", ""); } @@ -368,7 +368,7 @@ static INT_PTR DoControl(GCEVENT * gce, WPARAM wp) if (si) { replaceStr( &si->ptszStatusbarText, gce->ptszText ); if ( si->ptszStatusbarText ) - DBWriteContactSettingTString(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else DBWriteContactSettingString(si->windowData.hContact, si->pszModule, "StatusBar", ""); if (si->hWnd) @@ -430,8 +430,8 @@ void ShowRoom(SESSION_INFO * si, WPARAM wp, BOOL bSetForeground) si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), hParent, RoomWndProc, (LPARAM)si); } SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si); - SendMessage(GetParent(si->hWnd), CM_ACTIVATECHILD, 0, (LPARAM) si->hWnd); - SendMessage(GetParent(si->hWnd), CM_POPUPWINDOW, 0, (LPARAM) si->hWnd); + SendMessage(GetParent(si->hWnd), CM_ACTIVATECHILD, 0, (LPARAM)si->hWnd); + SendMessage(GetParent(si->hWnd), CM_POPUPWINDOW, 0, (LPARAM)si->hWnd); SendMessage(si->hWnd, WM_MOUSEACTIVATE, 0, 0); SetFocus(GetDlgItem(si->hWnd, IDC_CHAT_MESSAGE)); } @@ -505,9 +505,9 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if ( si ) { if ( gce->pszText ) { replaceStr( &si->ptszTopic, gce->ptszText); - DBWriteContactSettingTString( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); + db_set_ts( si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 )) - DBWriteContactSettingTString( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); + db_set_ts( si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); } } break; } diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 5d528f75dc..f30fefb135 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -283,7 +283,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh if (bInactive && si->hWnd && db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0) SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0); if (db_get_b(si->windowData.hContact, "CList", "Hidden", 0) != 0) - DBDeleteContactSetting(si->windowData.hContact, "CList", "Hidden"); + db_unset(si->windowData.hContact, "CList", "Hidden"); if (bInactive) DoTrayIcon(si, gce); if (bInactive || !g_Settings.PopUpInactiveOnly) @@ -779,7 +779,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int gcd->iType = iType; gch->dwData = dwItem; gch->pDest = gcd; - PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM) gch); + PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch); return TRUE; } diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 406207adbb..fa803330ce 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -97,7 +97,7 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO* si) SendDlgItemMessage(hwndDlg,IDC_CHAT_CHANMGR,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_settings")); SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2")); SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2")); - SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM) GetCachedIcon("scriver_SEND")); + SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND")); SendDlgItemMessage(hwndDlg,IDC_CHAT_SMILEY, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD, BUTTONSETASFLATBTN, TRUE, 0); @@ -349,7 +349,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (pszName == NULL) { if (end !=start) { SendMessage(hwnd, EM_SETSEL, start, end); - SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) dat->szSearchQuery); + SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery); } mir_free(dat->szSearchQuery); dat->szSearchQuery = NULL; @@ -363,7 +363,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, pszName = pszText; } SendMessage(hwnd, EM_SETSEL, start, end); - SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) pszName); + SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName); } mir_free(pszText); } @@ -665,12 +665,12 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR { CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { SendMessage(hwnd, WM_COPY, 0, 0); sel.cpMin = sel.cpMax ; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); } SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE)); break; @@ -679,10 +679,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_ACTIVATE: if (LOWORD(wParam) == WA_INACTIVE) { CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { sel.cpMin = sel.cpMax ; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); } } break; @@ -695,9 +695,9 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR TCHAR *pszWord = NULL; POINTL ptl; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); if (lParam == 0xFFFFFFFF) { - SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM) sel.cpMax); + SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM)sel.cpMax); ClientToScreen(hwnd, &pt); } else { pt.x = (short) LOWORD(lParam); @@ -716,10 +716,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case ID_COPYALL: - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); SendMessage(hwnd, WM_COPY, 0, 0); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 ); break; @@ -825,7 +825,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS } } - SendMessage( hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM) &ti); + SendMessage( hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); SendMessage( hwndToolTip, TTM_ACTIVATE, (ti.lpszText!=NULL) , 0 ); SendMessage( hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400 ); if (ti.lpszText) @@ -1116,7 +1116,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); if (db_get_b(NULL, "Chat", "UseIEView", 0)) { IEVIEWWINDOW ieWindow; @@ -1152,7 +1152,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0); SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0); - SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM) psi->windowData.hContact); + SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM)psi->windowData.hContact); PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0); NotifyLocalWinEvent(psi->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPEN); } @@ -1238,7 +1238,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } tbd.iFlags = TBDF_TEXT | TBDF_ICON; tbd.pszText = szTemp; - SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM)hwndDlg); SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0); } break; @@ -1256,17 +1256,17 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) sbd.iFlags = SBDF_TEXT | SBDF_ICON; sbd.hIcon = hIcon; sbd.pszText = szTemp; - SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg); sbd.iItem = 1; sbd.hIcon = NULL; sbd.pszText = _T(""); - SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg); sid.cbSize = sizeof(sid); sid.szModule = SRMMMOD; sid.dwId = 0; sid.flags = 0; - ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid); + ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM)&sid); } break; @@ -1357,7 +1357,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) TabControlData tcd; tcd.iFlags = TCDF_TEXT; tcd.pszText = si->ptszName; - SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg); } case GC_FIXTABICONS: @@ -1375,7 +1375,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } tcd.iFlags = TCDF_ICON; tcd.hIcon = hIcon; - SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg); } break; @@ -1403,7 +1403,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (si->wState & STATE_TALK) { si->wState &= ~STATE_TALK; - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); } if (si->wState & GC_EVENT_HIGHLIGHT) { @@ -1553,7 +1553,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon"); si->wState &= ~STATE_TALK; - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0); return TRUE; @@ -1659,7 +1659,7 @@ LABEL_SHOWWINDOW: pCC->bForeground = bFG; pCC->si = si; - ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM) pCC); + ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC); } break; @@ -1675,7 +1675,7 @@ LABEL_SHOWWINDOW: si.nPos = si.nMax - si.nPage + 1; SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE); - SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM) & sel); + SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)& sel); PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); } } break; @@ -1692,8 +1692,8 @@ LABEL_SHOWWINDOW: SetActiveSession(si->ptszID, si->pszModule); - if (DBGetContactSettingWord(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0) - db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); + if (db_get_w(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0) + db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0); if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon"); } @@ -1762,7 +1762,7 @@ LABEL_SHOWWINDOW: break; case WM_COMMAND: - if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) si->windowData.hContact)) + if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)si->windowData.hContact)) break; switch (LOWORD(wParam)) { case IDC_CHAT_LIST: @@ -1787,7 +1787,7 @@ LABEL_SHOWWINDOW: else mir_sntprintf(pszName, lstrlen(ui->pszUID)+2, _T("%s "), ui->pszUID); - SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM) pszName); + SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName); PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0); } else DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0); @@ -1873,7 +1873,7 @@ LABEL_SHOWWINDOW: smaddInfo.xPosition = rc.left; smaddInfo.yPosition = rc.bottom; smaddInfo.hContact = si->windowData.hContact; - CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM) &smaddInfo); + CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo); } break; @@ -2105,7 +2105,7 @@ LABEL_SHOWWINDOW: SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0); - SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM) hwndDlg); + SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM)hwndDlg); if (si->windowData.hwndLog != NULL) { IEVIEWWINDOW ieWindow; ieWindow.cbSize = sizeof(IEVIEWWINDOW); -- cgit v1.2.3