From 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 22:27:16 +0000 Subject: - rest of menus cleared; - old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/chat.h | 2 + src/core/stdchat/src/clist.cpp | 107 +++++++++++----------- src/core/stdchat/src/log.cpp | 2 +- src/core/stdchat/src/main.cpp | 2 +- src/core/stdchat/src/manager.cpp | 14 +-- src/core/stdchat/src/options.cpp | 188 +++++++++++++++++++------------------- src/core/stdchat/src/services.cpp | 36 ++++---- src/core/stdchat/src/tools.cpp | 6 +- src/core/stdchat/src/window.cpp | 66 ++++++------- 9 files changed, 210 insertions(+), 213 deletions(-) (limited to 'src/core/stdchat') diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 34562d4d52..0aee3295ba 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -398,6 +398,8 @@ typedef struct{ COLORCHOOSER; //main.c +extern HGENMENU hJoinMenuItem, hLeaveMenuItem; + void LoadIcons(void); void LoadLogIcons(void); void FreeIcons(void); diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index 7761fdab1c..31e47b1f6a 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" -extern HANDLE hJoinMenuItem, hLeaveMenuItem; - HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType) { HANDLE hContact = CList_FindRoom(pszModule, pszRoom); @@ -29,10 +27,10 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p TCHAR pszGroup[50]; *pszGroup = '\0'; - if ( !DBGetContactSettingTString( NULL, "Chat", "AddToGroup", &dbv )) { + if ( !db_get_ts( 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); @@ -48,25 +46,25 @@ HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* p if ( pszGroup[0] ) { for (i = 0;; i++) { _itoa( i, str, 10 ); - if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) { - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup); + if ( db_get_ts( NULL, "CListGroups", str, &dbv )) { + db_set_ts(hContact, "CList", "Group", pszGroup); goto END_GROUPLOOP; } - if ( !DBGetContactSettingTString( hContact, "CList", "Group", &dbv2 )) { + if ( !db_get_ts( hContact, "CList", "Group", &dbv2 )) { if ( dbv.ptszVal[0] != '\0' && dbv2.ptszVal[0] != '\0' && !lstrcmpi( dbv.ptszVal + 1, dbv2.ptszVal )) { - DBFreeVariant( &dbv ); - DBFreeVariant( &dbv2 ); + db_free( &dbv ); + db_free( &dbv2 ); goto END_GROUPLOOP; } - DBFreeVariant(&dbv2); + db_free(&dbv2); } - DBFreeVariant(&dbv); + 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; } @@ -76,12 +74,12 @@ END_GROUPLOOP: CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule ); if ( pszGroup && lstrlen( pszGroup ) > 0 ) - DBWriteContactSettingTString(hContact, "CList", "Group", pszGroup ); + db_set_ts(hContact, "CList", "Group", pszGroup ); else db_unset( hContact, "CList", "Group" ); - DBWriteContactSettingTString( hContact, pszModule, "Nick", pszDisplayName ); - DBWriteContactSettingTString( hContact, pszModule, "ChatRoomID", pszRoom ); - DBWriteContactSettingByte( hContact, pszModule, "ChatRoom", (BYTE)iType ); + 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; } @@ -90,7 +88,7 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) { if ( hContact ) { char* szProto = GetContactProto(hContact); - int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); + int i = db_get_b(hContact, szProto, "ChatRoom", 0); db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); return TRUE; @@ -109,7 +107,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) szProto = GetContactProto(hContact); if ( MM_FindModule( szProto )) { if ( !pszModule || ( pszModule && !strcmp( pszModule, szProto ))) { - int i = DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0); + int i = db_get_b(hContact, szProto, "ChatRoom", 0); if ( i != 0 ) { db_set_w(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0); db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); @@ -131,15 +129,15 @@ int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam ) szProto = GetContactProto(hContact); if ( MM_FindModule(szProto)) { - if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 ) == 0 ) + if ( db_get_b( hContact, szProto, "ChatRoom", 0 ) == 0 ) return 0; - if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) { + if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv )) { 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 - && DBGetContactSettingByte(NULL, "Chat", "ToggleVisibility", 0)==1 + && db_get_b(NULL, "Chat", "ToggleVisibility", 0)==1 && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) @@ -148,12 +146,12 @@ int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam ) SendMessage(si->hWnd, GC_REMOVETAB, 1, (LPARAM) si ); else 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; } } @@ -171,7 +169,7 @@ INT_PTR CList_JoinChat(WPARAM wParam, LPARAM lParam) if ( hContact ) { char* szProto = GetContactProto(hContact); if ( szProto ) { - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) + if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) CallProtoService( szProto, PS_JOINCHAT, wParam, lParam ); else CList_RoomDoubleclicked( wParam, 0 ); @@ -194,31 +192,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 mi = { sizeof(mi) }; - mi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN; - - if ( szProto ) { - // display this menu item only for chats - if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0 )) { - // still hide it for offline protos - if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) != ID_STATUS_OFFLINE ) { - mi.flags &= ~CMIF_HIDDEN; - mi.flags |= CMIM_NAME; - - if ( DBGetContactSettingWord( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) - mi.pszName = ( char* )LPGEN("Join chat"); - else - mi.pszName = ( char* )LPGEN("Open chat window"); - } } } - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hJoinMenuItem, ( LPARAM )&mi ); + if (hContact == NULL) + return 0; - mi.flags &= ~(CMIM_NAME | CMIF_DEFAULT); - mi.flags |= CMIF_NOTOFFLINE; - CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hLeaveMenuItem, ( LPARAM )&mi ); - } + 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 mi = { sizeof(mi) }; + mi.flags = CMIM_NAME; + if ( db_get_w( hContact, szProto, "Status", 0 ) == ID_STATUS_OFFLINE ) + mi.pszName = ( char* )LPGEN("Join chat"); + else + mi.pszName = ( char* )LPGEN("Open chat window"); + Menu_ModifyItem(hJoinMenuItem, &mi); + bEnabled = true; + } } } + + Menu_ShowItem(hJoinMenuItem, bEnabled); + Menu_ShowItem(hLeaveMenuItem, bEnabled); return 0; } @@ -241,21 +236,21 @@ void CList_CreateGroup(TCHAR* group) for (i = 0;; i++) { _itoa(i, str, 10); - if ( DBGetContactSettingTString( NULL, "CListGroups", str, &dbv )) + if ( db_get_ts( NULL, "CListGroups", str, &dbv )) break; if ( dbv.pszVal[0] != '\0' && !lstrcmpi(dbv.ptszVal + 1, group)) { - DBFreeVariant(&dbv); + db_free(&dbv); return; } - DBFreeVariant(&dbv); + db_free(&dbv); } name[0] = 1 | GROUPF_EXPANDED; _tcsncpy(name + 1, group, SIZEOF(name) - 1); name[ lstrlen(group) + 1] = '\0'; - DBWriteContactSettingTString(NULL, "CListGroups", str, name); + db_set_ts(NULL, "CListGroups", str, name); CallService(MS_CLUI_GROUPADDED, i + 1, 0); } @@ -297,14 +292,14 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) while (hContact) { char *szProto = GetContactProto(hContact); if ( szProto && !lstrcmpiA( szProto, pszModule )) { - if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0) != 0 ) { + if ( db_get_b( hContact, szProto, "ChatRoom", 0) != 0 ) { DBVARIANT dbv; - if ( !DBGetContactSettingTString( hContact, szProto, "ChatRoomID", &dbv )) { + if ( !db_get_ts( 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); diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 7720d1dddf..85b52d5262 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -664,7 +664,7 @@ void LoadMsgLogBitmaps(void) int rtfHeaderSize; PBYTE pBmpBits; - hBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW))); + hBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW))); bih.biSize = sizeof(bih); bih.biBitCount = 24; bih.biCompression = BI_RGB; diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 92be0f2cce..d3a8c58007 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -117,7 +117,7 @@ extern "C" __declspec(dllexport) int Unload(void) void UpgradeCheck(void) { - DWORD dwVersion = DBGetContactSettingDword(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9)); + DWORD dwVersion = db_get_dw(NULL, "Chat", "OldVersion", PLUGIN_MAKE_VERSION(0,2,9,9)); if (pluginInfo.version > dwVersion && dwVersion < PLUGIN_MAKE_VERSION(0,3,0,0)) { db_unset(NULL, "ChatFonts", "Font18"); db_unset(NULL, "ChatFonts", "Font18Col"); diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp index 00f6aa4d3b..5dead6fe83 100644 --- a/src/core/stdchat/src/manager.cpp +++ b/src/core/stdchat/src/manager.cpp @@ -130,14 +130,14 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta pTemp->nUsersInNicklist = 0; // contact may have been deleted here already, since function may be called after deleting - // contact so the handle may be invalid, therefore DBGetContactSettingByte shall return 0 - if (pTemp->hContact && DBGetContactSettingByte( pTemp->hContact, pTemp->pszModule, "ChatRoom", 0 ) != 0) + // contact so the handle may be invalid, therefore db_get_b shall return 0 + if (pTemp->hContact && db_get_b( pTemp->hContact, pTemp->pszModule, "ChatRoom", 0 ) != 0) { CList_SetOffline(pTemp->hContact, pTemp->iType == GCW_CHATROOM?TRUE:FALSE); /* if (pTemp->iType != GCW_SERVER) - DBWriteContactSettingByte(pTemp->hContact, "CList", "Hidden", 1);*/ - DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "Topic", ""); - DBWriteContactSettingString(pTemp->hContact, pTemp->pszModule, "StatusBar", ""); + db_set_b(pTemp->hContact, "CList", "Hidden", 1);*/ + db_set_s(pTemp->hContact, pTemp->pszModule, "Topic", ""); + db_set_s(pTemp->hContact, pTemp->pszModule, "StatusBar", ""); db_unset(pTemp->hContact, "CList", "StatusMsg"); if (removeContact) @@ -774,9 +774,9 @@ BOOL SM_RemoveAll (void) DoEventHook(m_WndList->ptszID, m_WndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)m_WndList->dwItemData); if (m_WndList->hContact) CList_SetOffline(m_WndList->hContact, m_WndList->iType == GCW_CHATROOM?TRUE:FALSE); - DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule , "Topic", ""); + db_set_s(m_WndList->hContact, m_WndList->pszModule , "Topic", ""); db_unset(m_WndList->hContact, "CList", "StatusMsg"); - DBWriteContactSettingString(m_WndList->hContact, m_WndList->pszModule, "StatusBar", ""); + db_set_s(m_WndList->hContact, m_WndList->pszModule, "StatusBar", ""); UM_RemoveAll(&m_WndList->pUsers); TM_RemoveAll(&m_WndList->pStatuses); diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index d184b976ef..c0107ea3b5 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -220,9 +220,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, const struct branch_t * tvis.item.pszText = TranslateTS(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) - iState = ((DBGetContactSettingDword(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1; + iState = ((db_get_dw(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode)!=0?2:1; else - iState = DBGetContactSettingByte(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1; + iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault)!=0?2:1; tvis.item.state=INDEXTOSTATEIMAGEMASK(iState); hItemB[i] = TreeView_InsertItem(hwndTree, &tvis); } } @@ -246,7 +246,7 @@ static void SaveBranch(HWND hwndTree, const struct branch_t *branch, HTREEITEM * iState |= GC_EVENT_REMOVESTATUS; db_set_dw(NULL, "Chat", branch[i].szDBName, (DWORD)iState); } - else DBWriteContactSettingByte(NULL, "Chat", branch[i].szDBName, bChecked); + else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked); } } static void CheckHeading(HWND hwndTree, HTREEITEM hHeading) @@ -327,32 +327,32 @@ void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour) if (colour) { wsprintfA(str, "Font%dCol", i); - *colour = DBGetContactSettingDword(NULL, "ChatFonts", str, fontOptionsList[i].defColour); + *colour = db_get_dw(NULL, "ChatFonts", str, fontOptionsList[i].defColour); } if (lf) { wsprintfA(str, "Font%dSize", i); - lf->lfHeight = (char) DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defSize); + lf->lfHeight = (char) db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; wsprintfA(str, "Font%dSty", i); - style = DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defStyle); + style = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defStyle); lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & FONTF_ITALIC ? 1 : 0; lf->lfUnderline = 0; lf->lfStrikeOut = 0; wsprintfA(str, "Font%dSet", i); - lf->lfCharSet = DBGetContactSettingByte(NULL, "ChatFonts", str, fontOptionsList[i].defCharset); + lf->lfCharSet = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defCharset); lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; wsprintfA(str, "Font%d", i); - if (DBGetContactSettingTString(NULL, "ChatFonts", str, &dbv)) + if (db_get_ts(NULL, "ChatFonts", str, &dbv)) lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else { lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); - DBFreeVariant(&dbv); + db_free(&dbv); } } } void RegisterFonts( void ) @@ -484,9 +484,9 @@ HICON LoadIconEx( char* pszIcoLibName, BOOL big ) static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) { DBVARIANT dbv; - if ( !DBGetContactSettingTString(NULL, "Chat", pszSetting, &dbv )) { + if ( !db_get_ts(NULL, "Chat", pszSetting, &dbv )) { replaceStr( ppPointer, dbv.ptszVal ); - DBFreeVariant(&dbv); + db_free(&dbv); } else replaceStr( ppPointer, pszDefault ); } @@ -509,14 +509,14 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); - hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), DBGetContactSettingByte(NULL, "Chat", "Branch0Exp", 0)?TRUE:FALSE); - hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), DBGetContactSettingByte(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE); - hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), DBGetContactSettingByte(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE); - hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), DBGetContactSettingByte(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE); - hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), DBGetContactSettingByte(NULL, "Chat", "Branch4Exp", 0)?TRUE:FALSE); - hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), DBGetContactSettingByte(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE); + hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, "Chat", "Branch0Exp", 0)?TRUE:FALSE); + hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE); + hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE); + hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), db_get_b(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE); + hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, "Chat", "Branch4Exp", 0)?TRUE:FALSE); + hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE); if (PopUpInstalled) - hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Pop-ups to display"), DBGetContactSettingByte(NULL, "Chat", "Branch6Exp", 0)?TRUE:FALSE); + hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Pop-ups to display"), db_get_b(NULL, "Chat", "Branch6Exp", 0)?TRUE:FALSE); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, SIZEOF(branch0), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, SIZEOF(branch1), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, SIZEOF(branch2), 0); @@ -585,7 +585,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { - BYTE b = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1); + BYTE b = db_get_b(NULL, "Chat", "Tabs", 1); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, SIZEOF(branch0)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, SIZEOF(branch2)); @@ -594,17 +594,17 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, SIZEOF(branch5)); if (PopUpInstalled) SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, SIZEOF(branch6)); - 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.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrimFormatting", 0); - g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1); - g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1); - g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; - - if (b != DBGetContactSettingByte(NULL, "Chat", "Tabs", 1)) { + g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000); + g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000); + g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000); + g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "TrimFormatting", 0); + g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1); + g_Settings.PopUpInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1); + g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; + + if (b != db_get_b(NULL, "Chat", "Tabs", 1)) { SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE); - g_Settings.TabsEnable = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1); + g_Settings.TabsEnable = db_get_b(NULL, "Chat", "Tabs", 1); } else SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); } @@ -615,20 +615,20 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_DESTROY: { BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch1Exp", b); + db_set_b(NULL, "Chat", "Branch1Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch2Exp", b); + db_set_b(NULL, "Chat", "Branch2Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch3Exp", b); + db_set_b(NULL, "Chat", "Branch3Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch4Exp", b); + db_set_b(NULL, "Chat", "Branch4Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch5Exp", b); + db_set_b(NULL, "Chat", "Branch5Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch0Exp", b); + db_set_b(NULL, "Chat", "Branch0Exp", b); if (PopUpInstalled) { b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - DBWriteContactSettingByte(NULL, "Chat", "Branch6Exp", b); + db_set_b(NULL, "Chat", "Branch6Exp", b); } } break; } @@ -644,11 +644,11 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETRANGE,0,MAKELONG(5000,0)); - SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LogLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LogLimit",100),0)); SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0)); - SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"Chat","LoggingLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"Chat","LoggingLimit",100),0)); SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETRANGE,0,MAKELONG(255,10)); - SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"Chat","NicklistRowDist",12),0)); + SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"Chat","NicklistRowDist",12),0)); { TCHAR* pszGroup = NULL; InitSetting(&pszGroup, "AddToGroup", _T("Chat rooms")); @@ -742,7 +742,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA *p2 = ' '; p2 = _tcschr(ptszText, ','); } - DBWriteContactSettingTString(NULL, "Chat", "HighlightWords", ptszText); + db_set_ts(NULL, "Chat", "HighlightWords", ptszText); mir_free(ptszText); } } @@ -752,7 +752,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText,iLen + 1); - DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText); + db_set_ts(NULL, "Chat", "LogDirectory", pszText); } else db_unset(NULL, "Chat", "LogDirectory"); @@ -762,7 +762,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen+1); - DBWriteContactSettingTString(NULL, "Chat", "LogTimestamp", pszText); + db_set_ts(NULL, "Chat", "LogTimestamp", pszText); } else db_unset(NULL, "Chat", "LogTimestamp"); @@ -770,7 +770,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen+1); - DBWriteContactSettingTString(NULL, "Chat", "HeaderTime", pszText); + db_set_ts(NULL, "Chat", "HeaderTime", pszText); } else db_unset(NULL, "Chat", "HeaderTime"); @@ -778,7 +778,7 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText,iLen+1); - DBWriteContactSettingTString(NULL, "Chat", "HeaderIncoming", pszText); + db_set_ts(NULL, "Chat", "HeaderIncoming", pszText); } else db_unset(NULL, "Chat", "HeaderIncoming"); @@ -786,15 +786,15 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if ( iLen > 0 ) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText,iLen+1); - DBWriteContactSettingTString(NULL, "Chat", "HeaderOutgoing", pszText); + db_set_ts(NULL, "Chat", "HeaderOutgoing", pszText); } else db_unset(NULL, "Chat", "HeaderOutgoing"); g_Settings.HighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED?TRUE:FALSE; - DBWriteContactSettingByte(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled); + db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.HighlightEnabled); g_Settings.LoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED?TRUE:FALSE; - DBWriteContactSettingByte(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled); + db_set_b(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.LoggingEnabled); if ( g_Settings.LoggingEnabled ) CreateDirectoryTreeT(g_Settings.pszLogDir); @@ -807,14 +807,14 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen+1); - DBWriteContactSettingTString(NULL, "Chat", "AddToGroup", pszText); + db_set_ts(NULL, "Chat", "AddToGroup", pszText); } - else DBWriteContactSettingString(NULL, "Chat", "AddToGroup", ""); + else db_set_s(NULL, "Chat", "AddToGroup", ""); mir_free(pszText); iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN4,UDM_GETPOS,0,0); if (iLen > 0) - DBWriteContactSettingByte(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); + db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); else db_unset(NULL, "Chat", "NicklistRowDist"); @@ -884,7 +884,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam iLen = 1; g_Settings.iPopupStyle = iLen; - DBWriteContactSettingByte(NULL, "Chat", "PopupStyle", (BYTE)iLen); + db_set_b(NULL, "Chat", "PopupStyle", (BYTE)iLen); iLen = SendDlgItemMessage(hwndDlg,IDC_SPIN1,UDM_GETPOS,0,0); g_Settings.iPopupTimeout = iLen; @@ -938,38 +938,38 @@ void LoadGlobalSettings(void) { LOGFONT lf; - g_Settings.LogLimitNames = DBGetContactSettingByte(NULL, "Chat", "LogLimitNames", 1); - g_Settings.ShowTime = DBGetContactSettingByte(NULL, "Chat", "ShowTimeStamp", 1); - g_Settings.TabsEnable = DBGetContactSettingByte(NULL, "Chat", "Tabs", 1); - g_Settings.TabsAtBottom = DBGetContactSettingByte(NULL, "Chat", "TabBottom", 0); - g_Settings.TabCloseOnDblClick = DBGetContactSettingByte(NULL, "Chat", "TabCloseOnDblClick", 0); - g_Settings.TabRestore = DBGetContactSettingByte(NULL, "Chat", "TabRestore", 0); - g_Settings.SoundsFocus = DBGetContactSettingByte(NULL, "Chat", "SoundsFocus", 0); - g_Settings.ShowTimeIfChanged = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowTimeStampIfChanged", 0); - g_Settings.TimeStampEventColour = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TimeStampEventColour", 0); - g_Settings.iEventLimit = DBGetContactSettingWord(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.LoggingEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "LoggingEnabled", 0); - g_Settings.FlashWindow = (BOOL)DBGetContactSettingByte(NULL, "Chat", "FlashWindow", 0); - g_Settings.HighlightEnabled = (BOOL)DBGetContactSettingByte(NULL, "Chat", "HighlightEnabled", 1); - g_Settings.crUserListColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font18Col", RGB(0,0,0)); - g_Settings.crUserListBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)); - g_Settings.crUserListSelectedBGColor = DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)); - g_Settings.crUserListHeadingsColor = DBGetContactSettingDword(NULL, "ChatFonts", "Font19Col", RGB(170,170,170)); - g_Settings.crLogBackground = DBGetContactSettingDword(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)); - g_Settings.StripFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "StripFormatting", 0); - g_Settings.TrayIconInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "TrayIconInactiveOnly", 1); - g_Settings.PopUpInactiveOnly = (BOOL)DBGetContactSettingByte(NULL, "Chat", "PopUpInactiveOnly", 1); - g_Settings.AddColonToAutoComplete = (BOOL)DBGetContactSettingByte(NULL, "Chat", "AddColonToAutoComplete", 1); - g_Settings.iPopupStyle = DBGetContactSettingByte(NULL, "Chat", "PopupStyle", 1); - g_Settings.iPopupTimeout = DBGetContactSettingWord(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 = DBGetContactSettingByte(NULL, "Chat", "ShowContactStatus", 0); - g_Settings.ContactStatusFirst = DBGetContactSettingByte(NULL, "Chat", "ContactStatusFirst", 0); + g_Settings.LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1); + g_Settings.ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1); + g_Settings.TabsEnable = db_get_b(NULL, "Chat", "Tabs", 1); + g_Settings.TabsAtBottom = db_get_b(NULL, "Chat", "TabBottom", 0); + g_Settings.TabCloseOnDblClick = db_get_b(NULL, "Chat", "TabCloseOnDblClick", 0); + g_Settings.TabRestore = db_get_b(NULL, "Chat", "TabRestore", 0); + 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 = db_get_w(NULL, "Chat", "LogLimit", 100); + g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000); + g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000); + g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000); + 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); + g_Settings.crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0,0,0)); + g_Settings.crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)); + g_Settings.crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)); + g_Settings.crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170,170,170)); + g_Settings.crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)); + g_Settings.StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0); + g_Settings.TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1); + 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 = db_get_w(NULL, "Chat", "PopupTimeout", 3); + g_Settings.crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW)); + g_Settings.crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0); + g_Settings.ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0); + g_Settings.ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0); InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]")); InitSetting( &g_Settings.pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]")); @@ -981,9 +981,9 @@ void LoadGlobalSettings(void) TCHAR pszTemp[MAX_PATH]; DBVARIANT dbv; g_Settings.pszLogDir = (TCHAR *)mir_realloc(g_Settings.pszLogDir, MAX_PATH*sizeof(TCHAR)); - if (!DBGetContactSettingTString(NULL, "Chat", "LogDirectory", &dbv)) { + if (!db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) { lstrcpyn(pszTemp, dbv.ptszVal, MAX_PATH); - DBFreeVariant(&dbv); + db_free(&dbv); } else { TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_logpath%\\Chat")); @@ -994,7 +994,7 @@ void LoadGlobalSettings(void) PathToAbsoluteT(pszTemp, g_Settings.pszLogDir); } - g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; + g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; if ( g_Settings.MessageBoxFont ) DeleteObject( g_Settings.MessageBoxFont ); @@ -1013,11 +1013,11 @@ void LoadGlobalSettings(void) if (hListBkgBrush != NULL) { DeleteObject(hListBkgBrush); } - hListBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW))); + hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW))); if (hListSelectedBkgBrush != NULL) { DeleteObject(hListSelectedBkgBrush); } - hListSelectedBkgBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT))); + hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT))); } static void FreeGlobalSettings(void) @@ -1052,12 +1052,12 @@ 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.iSplitterY = DBGetContactSettingWord(NULL, "Chat", "SplitterY", 90); - g_Settings.iX = DBGetContactSettingDword(NULL, "Chat", "roomx", -1); - g_Settings.iY = DBGetContactSettingDword(NULL, "Chat", "roomy", -1); - g_Settings.iWidth = DBGetContactSettingDword(NULL, "Chat", "roomwidth", -1); - g_Settings.iHeight = DBGetContactSettingDword(NULL, "Chat", "roomheight", -1); + g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105); + g_Settings.iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90); + g_Settings.iX = db_get_dw(NULL, "Chat", "roomx", -1); + g_Settings.iY = db_get_dw(NULL, "Chat", "roomy", -1); + g_Settings.iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1); + g_Settings.iHeight = db_get_dw(NULL, "Chat", "roomheight", -1); LoadGlobalSettings(); SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message")); diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp index 9a65d483ac..6a2cc1db9a 100644 --- a/src/core/stdchat/src/services.cpp +++ b/src/core/stdchat/src/services.cpp @@ -31,8 +31,8 @@ extern BOOL PopUpInstalled; extern BOOL IEviewInstalled; HANDLE hSendEvent; -HANDLE hBuildMenuEvent ; -HANDLE hJoinMenuItem, hLeaveMenuItem; +HANDLE hBuildMenuEvent; +HGENMENU hJoinMenuItem, hLeaveMenuItem; SESSION_INFO g_TabSession; CRITICAL_SECTION cs; @@ -169,7 +169,7 @@ static int FontsChanged(WPARAM wParam,LPARAM lParam) DeleteObject(hFont); g_Settings.LogTextIndent = iText; g_Settings.LogTextIndent = g_Settings.LogTextIndent*12/10; - g_Settings.LogIndentEnabled = (DBGetContactSettingByte(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; + g_Settings.LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0)?TRUE:FALSE; } MM_FontsChanged(); MM_FixColors(); @@ -342,9 +342,9 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->ptszStatusbarText = a2tf( gcw->ptszStatusbarText, gcw->dwFlags ); si->iSplitterX = g_Settings.iSplitterX; si->iSplitterY = g_Settings.iSplitterY; - si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0); - si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0); - si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1); + si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0); + si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0); + si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1); if ( !( gcw->dwFlags & GC_UNICODE )) { si->pszID = mir_strdup( gcw->pszID ); si->pszName = mir_strdup( gcw->pszName ); @@ -363,12 +363,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) else mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName); si->hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType); - DBWriteContactSettingString(si->hContact, si->pszModule , "Topic", ""); + db_set_s(si->hContact, si->pszModule , "Topic", ""); db_unset(si->hContact, "CList", "StatusMsg"); if (si->ptszStatusbarText) - DBWriteContactSettingTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else - DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", ""); + db_set_s(si->hContact, si->pszModule, "StatusBar", ""); } else { SESSION_INFO* si2 = SM_FindSession( ptszID, gcw->pszModule ); @@ -423,7 +423,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp) SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule); if (si) { si->bInitDone = TRUE; - if (wp != SESSION_INITDONE || DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0) == 0) + if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0) ShowRoom(si, wp, TRUE); return 0; } } @@ -495,9 +495,9 @@ static int DoControl(GCEVENT * gce, WPARAM wp) if (si) { replaceStr( &si->ptszStatusbarText, gce->ptszText ); if ( si->ptszStatusbarText ) - DBWriteContactSettingTString(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); + db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText); else - DBWriteContactSettingString(si->hContact, si->pszModule, "StatusBar", ""); + db_set_s(si->hContact, si->pszModule, "StatusBar", ""); if ( si->hWnd ) { g_TabSession.ptszStatusbarText = si->ptszStatusbarText; SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0); @@ -611,9 +611,9 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) replaceStr( &si->ptszTopic, gce->ptszText); if ( si->hWnd ) g_TabSession.ptszTopic = si->ptszTopic; - DBWriteContactSettingTString( si->hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); - if ( DBGetContactSettingByte( NULL, "Chat", "TopicOnClist", 0 )) - DBWriteContactSettingTString( si->hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); + db_set_ts( si->hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic )); + if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 )) + db_set_ts( si->hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic )); } } break; } @@ -843,9 +843,9 @@ void TabsInit(void) g_TabSession.iType = GCW_TABROOM; g_TabSession.iSplitterX = g_Settings.iSplitterX; g_TabSession.iSplitterY = g_Settings.iSplitterY; - g_TabSession.iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0); - g_TabSession.bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0); - g_TabSession.bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1); + g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0); + g_TabSession.bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0); + g_TabSession.bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1); g_TabSession.iFG = 4; g_TabSession.bFGSet = TRUE; g_TabSession.iBG = 2; diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index d27c147617..45ef0ed99a 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -299,9 +299,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighligh gce->pDest->iType |= GC_EVENT_HIGHLIGHT; if (bInactive || !g_Settings.SoundsFocus) SkinPlaySound("ChatHighlight"); - if (!g_Settings.TabsEnable && bInactive && si->hWnd && DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0) + if (!g_Settings.TabsEnable && bInactive && si->hWnd && db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0) SetTimer(si->hWnd, TIMERID_FLASHWND, 900, NULL); - if (DBGetContactSettingByte(si->hContact, "CList", "Hidden", 0) != 0) + if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0) db_unset(si->hContact, "CList", "Hidden"); if (bInactive) DoTrayIcon(si, gce); @@ -404,7 +404,7 @@ void CheckColorsInModule(const char* pszModule) MODULEINFO * pMod = MM_FindModule( pszModule ); int i = 0; COLORREF crFG; - COLORREF crBG = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crBG = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); LoadMsgDlgFont(17, NULL, &crFG); diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 0627dfbea1..c56f80b6c7 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -134,10 +134,10 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc) RECT rc, rcTabs; SESSION_INFO* si = (SESSION_INFO*)lParam; int TabHeight; - BOOL bControl = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowTopButtons", 1); - BOOL bFormat = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowFormatButtons", 1); + BOOL bControl = (BOOL)db_get_b(NULL, "Chat", "ShowTopButtons", 1); + BOOL bFormat = (BOOL)db_get_b(NULL, "Chat", "ShowFormatButtons", 1); BOOL bToolbar = bFormat || bControl; - BOOL bSend = (BOOL)DBGetContactSettingByte(NULL, "Chat", "ShowSend", 0); + BOOL bSend = (BOOL)db_get_b(NULL, "Chat", "ShowSend", 0); BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled; BOOL bTabs = g_Settings.TabsEnable; BOOL bTabBottom = g_Settings.TabsAtBottom; @@ -298,11 +298,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE; if (wParam == '\n' || wParam == '\r') { - if ((isCtrl != 0) ^ (0 != DBGetContactSettingByte(NULL, "Chat", "SendOnEnter", 1))) { + if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) { PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } - if (DBGetContactSettingByte(NULL, "Chat", "SendOnDblEnter", 0)) { + if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) { if (dat->lastEnterTime + 2 < time(NULL)) dat->lastEnterTime = time(NULL); else { @@ -330,10 +330,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isAlt = GetKeyState(VK_MENU) & 0x8000; if (wParam == VK_RETURN) { dat->szTabSave[0] = '\0'; - if ((isCtrl != 0) ^ (0 != DBGetContactSettingByte(NULL, "Chat", "SendOnEnter", 1))) + if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) return 0; - if (DBGetContactSettingByte(NULL, "Chat", "SendOnDblEnter", 0)) + if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) if (dat->lastEnterTime + 2 >= time(NULL)) return 0; @@ -681,7 +681,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBkgColor) { int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor); - COLORREF crB = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crB = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR); if (index >= 0) { @@ -812,7 +812,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L HWND hColor = GetDlgItem(GetParent(hwnd), IDC_COLOR); HWND hBGColor = GetDlgItem(GetParent(hwnd), IDC_BKGCOLOR); - if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) != 0) { + if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) { if (hFilter == hwnd) SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0); if (hColor == hwnd) @@ -894,7 +894,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR s = (SESSION_INFO* ) tc.lParam; if (s) { - BOOL bOnline = DBGetContactSettingWord(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE?TRUE:FALSE; + BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE?TRUE:FALSE; bDragging = TRUE; iBeginIndex = i; ImageList_BeginDrag(hIconsList, bOnline?(MM_FindModule(s->pszModule))->OnlineIconIndex:(MM_FindModule(s->pszModule))->OfflineIconIndex, 8, 8); @@ -1112,13 +1112,13 @@ static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, ch wp.length=sizeof(wp); GetWindowPlacement(hwnd,&wp); wsprintfA(szSettingName,"%sx",szNamePrefix); - x=DBGetContactSettingDword(hContact,szModule,szSettingName,-1); + x=db_get_dw(hContact,szModule,szSettingName,-1); wsprintfA(szSettingName,"%sy",szNamePrefix); - y=(int)DBGetContactSettingDword(hContact,szModule,szSettingName,-1); + y=(int)db_get_dw(hContact,szModule,szSettingName,-1); wsprintfA(szSettingName,"%swidth",szNamePrefix); - width=DBGetContactSettingDword(hContact,szModule,szSettingName,-1); + width=db_get_dw(hContact,szModule,szSettingName,-1); wsprintfA(szSettingName,"%sheight",szNamePrefix); - height=DBGetContactSettingDword(hContact,szModule,szSettingName,-1); + height=db_get_dw(hContact,szModule,szSettingName,-1); if (x==-1) return 0; @@ -1218,7 +1218,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } // restore previous tabs - if (g_Settings.TabsEnable && DBGetContactSettingByte(NULL, "Chat", "TabRestore", 0)) { + if (g_Settings.TabsEnable && db_get_b(NULL, "Chat", "TabRestore", 0)) { TABLIST * node = g_TabList; while (node) { SESSION_INFO* s = SM_FindSession(node->pszID, node->pszModule); @@ -1279,8 +1279,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR; cf.dwEffects = 0; cf.crTextColor = crFore; - cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); - SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW))); + cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW))); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0)); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf); } @@ -1292,7 +1292,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) ih = GetTextPixelSize( _T("AQGglo"), g_Settings.UserListFont,FALSE); ih2 = GetTextPixelSize( _T("AQGglo"), g_Settings.UserListHeadingsFont,FALSE); - height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12); + height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); font = ih > ih2?ih:ih2; // make sure we have space for icon! @@ -1365,7 +1365,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SESSION_INFO* pActive = GetActiveSession(); WINDOWPLACEMENT wp; RECT screen; - int savePerContact = DBGetContactSettingByte(NULL, "Chat", "SavePosition", 0); + int savePerContact = db_get_b(NULL, "Chat", "SavePosition", 0); wp.length=sizeof(wp); GetWindowPlacement(hwndDlg,&wp); @@ -1388,7 +1388,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) } else SetWindowPos(hwndDlg, 0, (screen.right-screen.left)/2- (550)/2,(screen.bottom-screen.top)/2- (400)/2, (550), (400), SWP_NOZORDER |SWP_HIDEWINDOW|SWP_NOACTIVATE); - if (!g_Settings.TabsEnable && pActive && pActive->hWnd && DBGetContactSettingByte(NULL, "Chat", "CascadeWindows", 1)) { + if (!g_Settings.TabsEnable && pActive && pActive->hWnd && db_get_b(NULL, "Chat", "CascadeWindows", 1)) { RECT rcThis, rcNew; int dwFlag = SWP_NOZORDER|SWP_NOACTIVATE; if (!IsWindowVisible ((HWND)wParam)) @@ -1598,7 +1598,7 @@ END_REMOVETAB: indexfound = i; } } - w = DBGetContactSettingWord(s2->hContact, s2->pszModule, "TabPosition", 0); + w = db_get_w(s2->hContact, s2->pszModule, "TabPosition", 0); if (w) lastlocked = (int)w; } } @@ -1618,7 +1618,7 @@ END_REMOVETAB: tci.lParam = lParam; // determine insert position - w = DBGetContactSettingWord(s1->hContact, s1->pszModule, "TabPosition", 0); + w = db_get_w(s1->hContact, s1->pszModule, "TabPosition", 0); if (wParam == -1) insertat = w == 0?tabId:(int)w-1; else @@ -1687,7 +1687,7 @@ END_REMOVETAB: if (SM_FindSession(si->ptszID, si->pszModule) == s2) si->wState = s2->wState; SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s2); - if (DBGetContactSettingByte(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg) + if (db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != hwndDlg) SetTimer(hwndDlg, TIMERID_FLASHWND, 900, NULL); break; } } @@ -1780,7 +1780,7 @@ END_REMOVETAB: for (i = 0; i< tabId ; i++) { TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB),i, &tci); s = (SESSION_INFO*)tci.lParam; - if (s && s->hContact && DBGetContactSettingWord(s->hContact, s->pszModule, "TabPosition", 0) != 0) + if (s && s->hContact && db_get_w(s->hContact, s->pszModule, "TabPosition", 0) != 0) db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1)); } } } break; @@ -1827,7 +1827,7 @@ END_REMOVETAB: int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE); int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE); int font = ih > ih2?ih:ih2; - int height = DBGetContactSettingByte(NULL, "Chat", "NicklistRowDist", 12); + int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); // make sure we have space for icon! if (g_Settings.ShowContactStatus) @@ -1931,7 +1931,7 @@ END_REMOVETAB: case SESSION_TERMINATE: SendMessage(hwndDlg,GC_SAVEWNDPOS,0,0); - if (DBGetContactSettingByte(NULL, "Chat", "SavePosition", 0)) { + if (db_get_b(NULL, "Chat", "SavePosition", 0)) { db_set_dw(si->hContact, "Chat", "roomx", si->iX); db_set_dw(si->hContact, "Chat", "roomy", si->iY); db_set_dw(si->hContact, "Chat", "roomwidth" , si->iWidth); @@ -1953,7 +1953,7 @@ END_REMOVETAB: goto LABEL_SHOWWINDOW; case SESSION_INITDONE: - if (DBGetContactSettingByte(NULL, "Chat", "PopupOnJoin", 0)!=0) + if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0) return TRUE; // fall through case WINDOW_VISIBLE: @@ -2124,7 +2124,7 @@ LABEL_SHOWWINDOW: if (KillTimer(hwndDlg, TIMERID_FLASHWND)) FlashWindow(hwndDlg, FALSE); - if (DBGetContactSettingWord(si->hContact, si->pszModule ,"ApparentMode", 0) != 0) + if (db_get_w(si->hContact, si->pszModule ,"ApparentMode", 0) != 0) db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0); if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon"); @@ -2163,7 +2163,7 @@ LABEL_SHOWWINDOW: hSubMenu = GetSubMenu(g_hMenu, 5); TranslateMenu(hSubMenu); if (s) { - WORD w = DBGetContactSettingWord(s->hContact, s->pszModule, "TabPosition", 0); + WORD w = db_get_w(s->hContact, s->pszModule, "TabPosition", 0); if ( w == 0) CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND|MF_UNCHECKED); else @@ -2549,7 +2549,7 @@ LABEL_SHOWWINDOW: si->bFilterEnabled = !si->bFilterEnabled; SendDlgItemMessage(hwndDlg,IDC_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIconEx( si->bFilterEnabled ? "filter" : "filter2", FALSE )); - if (si->bFilterEnabled && DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) { + if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) { SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0); break; } @@ -2567,7 +2567,7 @@ LABEL_SHOWWINDOW: break; if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR )) { - if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR); else if (si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; @@ -2576,7 +2576,7 @@ LABEL_SHOWWINDOW: } } else { cf.dwMask = CFM_BACKCOLOR; - cf.crBackColor = (COLORREF)DBGetContactSettingDword(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } break; @@ -2591,7 +2591,7 @@ LABEL_SHOWWINDOW: break; if (IsDlgButtonChecked(hwndDlg, IDC_COLOR )) { - if (DBGetContactSettingByte(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR); else if (si->bFGSet) { cf.dwMask = CFM_COLOR; -- cgit v1.2.3