From 2b49f2b34e0e3cbcda608c07e5cb206c9fa01c9a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 15 Nov 2012 17:08:48 +0000 Subject: core: tabs over spaces git-svn-id: http://svn.miranda-ng.org/main/trunk@2316 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clc.cpp | 8 +-- src/modules/clist/clcfiledrop.cpp | 2 +- src/modules/clist/clcitems.cpp | 8 +-- src/modules/clist/clcmsgs.cpp | 4 +- src/modules/clist/clcutils.cpp | 4 +- src/modules/clist/clistevents.cpp | 8 +-- src/modules/clist/clistmenus.cpp | 4 +- src/modules/clist/clistmod.cpp | 6 +- src/modules/clist/clistsettings.cpp | 4 +- src/modules/clist/clisttray.cpp | 43 ++++++----- src/modules/clist/clui.cpp | 2 +- src/modules/clist/cluiservices.cpp | 6 +- src/modules/clist/contact.cpp | 6 +- src/modules/clist/contacts.cpp | 15 ++-- src/modules/clist/keyboard.cpp | 2 +- src/modules/clist/protocolorder.cpp | 137 ++++++++++++++++-------------------- 16 files changed, 118 insertions(+), 141 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 3c530cff57..81e0fe8ce3 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -196,7 +196,7 @@ static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM) static INT_PTR GetInfoTipHoverTime(WPARAM, LPARAM) { - return DBGetContactSettingWord(NULL, "CLC", "InfoTipHoverTime", 750); + return db_get_w(NULL, "CLC", "InfoTipHoverTime", 750); } static void SortClcByTimer(HWND hwnd) @@ -283,7 +283,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->iInsertionMark = -1; dat->insertionMarkHitHeight = 5; dat->iHotTrack = -1; - dat->infoTipTimeout = DBGetContactSettingWord(NULL, "CLC", "InfoTipHoverTime", 750); + dat->infoTipTimeout = db_get_w(NULL, "CLC", "InfoTipHoverTime", 750); dat->extraColumnSpacing = 20; dat->list.cl.increment = 30; dat->needsResort = 1; @@ -515,7 +515,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (szProto == NULL) status = ID_STATUS_OFFLINE; else - status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); + status = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); // this means an offline msg is flashing, so the contact should be shown DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); @@ -610,7 +610,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (szProto == NULL) break; - WORD apparentMode = DBGetContactSettingWord((HANDLE)wParam, szProto, "ApparentMode", 0); + WORD apparentMode = db_get_w((HANDLE)wParam, szProto, "ApparentMode", 0); contact->flags &= ~(CONTACTF_INVISTO | CONTACTF_VISTO); if (apparentMode == ID_STATUS_OFFLINE) contact->flags |= CONTACTF_INVISTO; diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index aedf412c02..1993936a01 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -83,7 +83,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in DWORD protoCaps = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0); if ( !(protoCaps & PF1_FILESEND)) return NULL; - if (ID_STATUS_OFFLINE == DBGetContactSettingWord(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE)) + if (ID_STATUS_OFFLINE == db_get_w(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE)) return NULL; if (hitLine) *hitLine = hit; diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 16587acc02..e9d280b96f 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -189,9 +189,9 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) group->cl.items[i]->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) hContact, 0); group->cl.items[i]->hContact = hContact; group->cl.items[i]->proto = szProto; - if (szProto != NULL && !cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + if (szProto != NULL && !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) group->cl.items[i]->flags |= CONTACTF_ONLINE; - WORD apparentMode = szProto != NULL ? DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0) : 0; + WORD apparentMode = szProto != NULL ? db_get_w(hContact, szProto, "ApparentMode", 0) : 0; if (apparentMode == ID_STATUS_OFFLINE) group->cl.items[i]->flags |= CONTACTF_INVISTO; else if (apparentMode == ID_STATUS_ONLINE) @@ -225,7 +225,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd checkHideOffline = 0; if (checkHideOffline) if (szProto != NULL) - status = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); + status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) group = &dat->list; @@ -397,7 +397,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) cli.pfnAddContactToGroup(dat, group, hContact); } - else if ( !cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + else if ( !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) cli.pfnAddContactToGroup(dat, group, hContact); } else cli.pfnAddContactToGroup(dat, group, hContact); diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index d6245b49cb..3492ef3438 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -236,7 +236,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (++i >= group->cl.count) return NULL; } - while (group->cl.items[i]->type == CLCIT_DIVIDER); + while (group->cl.items[i]->type == CLCIT_DIVIDER); return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]); case CLGN_PREVIOUS: @@ -244,7 +244,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (--i < 0) return NULL; } - while (group->cl.items[i]->type == CLCIT_DIVIDER); + while (group->cl.items[i]->type == CLCIT_DIVIDER); return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]); case CLGN_NEXTCONTACT: diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index a6326e05fa..8b237e7d8f 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -748,7 +748,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->leftMargin = db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN); dat->exStyle = db_get_dw(NULL, "CLC", "ExStyle", cli.pfnGetDefaultExStyle()); - dat->scrollTime = DBGetContactSettingWord(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME); + dat->scrollTime = db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME); dat->groupIndent = db_get_b(NULL, "CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT); dat->gammaCorrection = db_get_b(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT); dat->showIdle = db_get_b(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE); @@ -768,7 +768,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) mir_free(dbv.pszVal); } } - dat->backgroundBmpUse = DBGetContactSettingWord(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); } dat->greyoutFlags = db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS); dat->offlineModes = db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES); diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 7dae6a7713..5f85903d1d 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -188,7 +188,7 @@ struct CListEvent* fnAddEvent(CLISTEVENT *cle) else szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cle->hContact, 0); iconsOn = 1; - flashTimerId = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), IconFlashTimer); + flashTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "IconFlashTime", 550), IconFlashTimer); cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->cle.ptszTooltip, szProto); } cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex, 1); @@ -423,10 +423,8 @@ struct CListEvent* fnCreateEvent(void) void fnFreeEvent(struct CListEvent* p) { - if (p->cle.pszService) - mir_free(p->cle.pszService); - if (p->cle.pszTooltip) - mir_free(p->cle.pszTooltip); + mir_free(p->cle.pszService); + mir_free(p->cle.pszTooltip); mir_free(p); } diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 094baafc67..5e33c150ce 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -336,7 +336,7 @@ static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) BuildContactParam bcp; bcp.szProto = szProto; bcp.isOnList = (db_get_b(hContact, "CList", "NotOnList", 0) == 0); - bcp.isOnline = (szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)); + bcp.isOnline = (szProto != NULL && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)); ListParam param = { 0 }; param.MenuObjectHandle = hContactMenuObject; @@ -1379,7 +1379,7 @@ void InitCustomMenus(void) HookEvent(ME_HOTKEYS_CHANGED, sttRebuildHotkeys); - // add exit command to menu + // add exit command to menu { CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 60ce86d46d..962b733987 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -191,7 +191,7 @@ static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) HANDLE hContact = (HANDLE)wParam; return cli.pfnIconFromStatusMode(szProto, - szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact); + szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact); } static void AddProtoIconIndex(PROTOACCOUNT* pa) @@ -446,8 +446,8 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) szProto1 = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) a, 0); szProto2 = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) b, 0); - statusa = DBGetContactSettingWord((HANDLE) a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); - statusb = DBGetContactSettingWord((HANDLE) b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); + statusa = db_get_w((HANDLE) a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); + statusb = db_get_w((HANDLE) b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); if (sortByProto) { /* deal with statuses, online contacts have to go above offline */ diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 00b85a2194..504511acd2 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -270,7 +270,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if ( !strcmp(cws->szSetting, "Hidden")) { if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); - cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1); + cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1); } else CallService(MS_CLUI_CONTACTDELETED, wParam, 0); @@ -288,7 +288,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) szProto = cws->value.pszVal; cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, - szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", + szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 0); } } diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 65ca28a352..ae9e9e7da0 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -275,7 +275,6 @@ int fnTrayIconInit(HWND hwnd) cli.trayIcon = (trayIconInfo_t *) mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount()); int trayIconSetting = db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT); - if (trayIconSetting == SETTING_TRAYICON_SINGLE) { DBVARIANT dbv = { DBVT_DELETED }; char *szProto; @@ -288,8 +287,7 @@ int fnTrayIconInit(HWND hwnd) cli.pfnTrayIconAdd(hwnd, NULL, szProto, szProto ? CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)); DBFreeVariant(&dbv); } - else if (trayIconSetting == SETTING_TRAYICON_MULTI && - (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) + else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) { cli.trayIconCount = netProtoCount; for (int i=0; i < accounts.getCount(); i++) { @@ -298,14 +296,14 @@ int fnTrayIconInit(HWND hwnd) PROTOACCOUNT* pa = accounts[j]; if (cli.pfnGetProtocolVisibility(pa->szModuleName)) cli.pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, CallProtoServiceInt(NULL,pa->szModuleName, PS_GETSTATUS, 0, 0)); - } + } } - } + } else { cli.pfnTrayIconAdd(hwnd, NULL, NULL, averageMode); if (trayIconSetting == SETTING_TRAYICON_CYCLE && averageMode < 0) - cli.cycleTimerId = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); + cli.cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); } } else { @@ -423,8 +421,8 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer cli.trayIcon[i].isBase = isBase; if (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) { - DWORD time1 = DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT)*200; - DWORD time2 = DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550)+1000; + DWORD time1 = db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT)*200; + DWORD time2 = db_get_w(NULL, "CList", "IconFlashTime", 550)+1000; DWORD time = max(max(2000, time1), time2); if (RefreshTimerId) {KillTimer(NULL, RefreshTimerId); RefreshTimerId = 0;} RefreshTimerId = SetTimer(NULL, 0, time, RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout @@ -452,10 +450,10 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) cli.trayIcon[i].hBaseIcon = hIcon; ulock; return i; } - if ((cli.pfnGetProtocolVisibility(szPreferredProto)) - && (GetAverageMode() == -1) - && (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) - && !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) + if ((cli.pfnGetProtocolVisibility(szPreferredProto)) && + (GetAverageMode() == -1) && + (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) && + !(db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) goto LBL_Error; } @@ -519,10 +517,9 @@ void fnTrayIconUpdateBase(const char *szChangedProto) cli.cycleTimerId = 0; } - for (i=0; i < accounts.getCount(); i++) { + for (i=0; i < accounts.getCount(); i++) if ( !lstrcmpA(szChangedProto, accounts[i]->szModuleName)) cycleStep = i - 1; - } if (netProtoCount > 0) { int trayIconSetting = db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT); @@ -552,22 +549,24 @@ void fnTrayIconUpdateBase(const char *szChangedProto) szProto = NULL; else szProto = dbv.pszVal; - changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ? CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto); + changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szProto, szProto ? + CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0) : + CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto); DBFreeVariant(&dbv); - break; } + break; + case SETTING_TRAYICON_CYCLE: - cli.cycleTimerId = - SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); + cli.cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); changed = cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0), NULL), ILD_NORMAL), NULL); break; + case SETTING_TRAYICON_MULTI: - if ( !cli.trayIcon) { + if ( !cli.trayIcon) cli.pfnTrayIconRemove(NULL, NULL); - } else if ((cli.trayIconCount > 1 || netProtoCount == 1) || db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoServiceInt(NULL,szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto); else { @@ -643,7 +642,7 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM) if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { if (GetActiveWindow() != cli.hwndContactList) { KillTimer(NULL, autoHideTimerId); - autoHideTimerId = SetTimer(NULL, 0, 1000 * DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); + autoHideTimerId = SetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); } } ulock; return 0; @@ -721,7 +720,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: if (db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) { if (LOWORD(msg->wParam) == WA_INACTIVE) - autoHideTimerId = SetTimer(NULL, 0, 1000 * DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); + autoHideTimerId = SetTimer(NULL, 0, 1000 * db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer); else KillTimer(NULL, autoHideTimerId); } diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 983ff73007..1a0c9e9410 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -523,7 +523,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case M_RESTORESTATUS: #ifndef _DEBUG { - int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); + int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE); if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); } #endif diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index 7f33bc0a3a..6fe9fb8b6f 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -159,11 +159,11 @@ void fnCluiProtocolStatusChanged(int, const char*) int borders[3]; int flags = 0; - if (cli.menuProtoCount == 0) { - SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0); + if (cli.menuProtoCount == 0) { + SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0); SendMessage(cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0); return; - } + } SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders); diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 574ea53bb8..becd06f2a3 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -48,7 +48,7 @@ static int GetContactStatus(HANDLE hContact) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if (szProto == NULL) return ID_STATUS_OFFLINE; - return DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); + return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } void fnChangeContactIcon(HANDLE hContact, int iIcon, int add) @@ -99,8 +99,8 @@ int fnCompareContacts(const ClcContact* c1, const ClcContact* c2) int statusa, statusb; int rc; - statusa = DBGetContactSettingWord((HANDLE) a, c1->proto, "Status", ID_STATUS_OFFLINE); - statusb = DBGetContactSettingWord((HANDLE) b, c2->proto, "Status", ID_STATUS_OFFLINE); + statusa = db_get_w((HANDLE) a, c1->proto, "Status", ID_STATUS_OFFLINE); + statusb = db_get_w((HANDLE) b, c2->proto, "Status", ID_STATUS_OFFLINE); if (sortByProto) { /* deal with statuses, online contacts have to go above offline */ diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index 38fb4d0788..60a2a3d443 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -35,14 +35,13 @@ BYTE nameOrder[NAMEORDERCOUNT]; static int GetDatabaseString(CONTACTINFO *ci, const char* setting, DBVARIANT* dbv) { - if (strcmp(ci->szProto, "CList") && CallProtoService(ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) - { - DBCONTACTGETSETTING cgs = { ci->szProto, setting, dbv }; - dbv->type = (ci->dwFlag & CNF_UNICODE) ? DBVT_WCHAR : DBVT_ASCIIZ; - - int res = CallProtoService(ci->szProto, PS_GETINFOSETTING, (WPARAM)ci->hContact, (LPARAM)&cgs); - if (res != CALLSERVICE_NOTFOUND) return res; - } + if (strcmp(ci->szProto, "CList") && CallProtoService(ci->szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) { + DBCONTACTGETSETTING cgs = { ci->szProto, setting, dbv }; + dbv->type = (ci->dwFlag & CNF_UNICODE) ? DBVT_WCHAR : DBVT_ASCIIZ; + + int res = CallProtoService(ci->szProto, PS_GETINFOSETTING, (WPARAM)ci->hContact, (LPARAM)&cgs); + if (res != CALLSERVICE_NOTFOUND) return res; + } if (ci->dwFlag & CNF_UNICODE) return DBGetContactSettingWString(ci->hContact, ci->szProto, setting, dbv); diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 95df7f4ae2..6da22a5fb7 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -62,7 +62,7 @@ static INT_PTR hkCloseMiranda(WPARAM wParam, LPARAM lParam) INT_PTR hkRestoreStatus(WPARAM wParam, LPARAM lParam) { - int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); + int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE); CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); return 0; } diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index cebda085cb..25e1556c56 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -58,74 +58,58 @@ int isProtoSuitable(PROTO_INTERFACE* ppi) bool CheckProtocolOrder(void) { - bool changed = false; - int i, id = 0; - - for (;;) - { - // Find account with this id - for (i=0; i < accounts.getCount(); i++) - if (accounts[i]->iOrder == id) break; - - // Account with id not found - if (i == accounts.getCount()) - { - // Check if this is skipped id, if it is decrement all other ids - bool found = false; - for (i=0; i < accounts.getCount(); i++) - { - if (accounts[i]->iOrder < 1000000 && accounts[i]->iOrder > id) - { - --accounts[i]->iOrder; - found = true; - } - } - if (found) changed = true; - else break; - } - else - ++id; - } - - if (id < accounts.getCount()) - { - // Remove huge ids - for (i=0; i < accounts.getCount(); i++) - { - if (accounts[i]->iOrder >= 1000000) - accounts[i]->iOrder = id++; - } - changed = true; - } - - if (id < accounts.getCount()) - { - // Remove duplicate ids - for (i=0; i < accounts.getCount(); i++) - { - bool found = false; - for (int j = 0; j < accounts.getCount(); j++) - { - if (accounts[j]->iOrder == i) - { - if (found) accounts[j]->iOrder = id++; - else found = true; - } - } - } - changed = true; - } - - return changed; -} + bool changed = false; + int i, id = 0; + + for (;;) { + // Find account with this id + for (i=0; i < accounts.getCount(); i++) + if (accounts[i]->iOrder == id) break; + + // Account with id not found + if (i == accounts.getCount()) { + // Check if this is skipped id, if it is decrement all other ids + bool found = false; + for (i=0; i < accounts.getCount(); i++) { + if (accounts[i]->iOrder < 1000000 && accounts[i]->iOrder > id) { + --accounts[i]->iOrder; + found = true; + } + } + if (found) changed = true; + else break; + } + else id++; + } + if (id < accounts.getCount()) { + // Remove huge ids + for (i=0; i < accounts.getCount(); i++) + if (accounts[i]->iOrder >= 1000000) + accounts[i]->iOrder = id++; + + changed = true; + } + + if (id < accounts.getCount()) { + // Remove duplicate ids + for (i=0; i < accounts.getCount(); i++) { + bool found = false; + for (int j = 0; j < accounts.getCount(); j++) { + if (accounts[j]->iOrder == i) { + if (found) accounts[j]->iOrder = id++; + else found = true; + } + } + } + changed = true; + } + + return changed; +} int FillTree(HWND hwnd) { - ProtocolData *PD; - int i; - PROTOACCOUNT* pa; - TVINSERTSTRUCT tvis; tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; @@ -135,14 +119,14 @@ int FillTree(HWND hwnd) if (accounts.getCount() == 0) return FALSE; - for (i=0; i < accounts.getCount(); i++) { + for (int i=0; i < accounts.getCount(); i++) { int idx = cli.pfnGetAccountIndexByPos(i); if (idx == -1) continue; - pa = accounts[idx]; + PROTOACCOUNT *pa = accounts[idx]; - PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); + ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); PD->RealName = pa->szModuleName; PD->protopos = pa->iOrder; PD->enabled = Proto_IsAccountEnabled(pa) && isProtoSuitable(pa->ppro); @@ -159,11 +143,10 @@ int FillTree(HWND hwnd) INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HWND hwndProtoOrder = GetDlgItem(hwndDlg, IDC_PROTOCOLORDER); + HWND hwndProtoOrder = GetDlgItem(hwndDlg, IDC_PROTOCOLORDER); struct ProtocolOrderData *dat = (ProtocolOrderData*)GetWindowLongPtr(hwndProtoOrder, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_DESTROY: ImageList_Destroy(TreeView_GetImageList(hwndProtoOrder, TVSIL_NORMAL)); mir_free(dat); @@ -187,14 +170,13 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return TRUE; case WM_COMMAND: - if (LOWORD(wParam) == IDC_RESETPROTOCOLDATA && HIWORD(wParam) == BN_CLICKED) - { + if (LOWORD(wParam) == IDC_RESETPROTOCOLDATA && HIWORD(wParam) == BN_CLICKED) { for (int i=0; i < accounts.getCount(); i++) accounts[i]->iOrder = i; FillTree(hwndProtoOrder); SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); - } + } break; case WM_NOTIFY: @@ -281,8 +263,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ClientToScreen(hwndDlg, &hti.pt); ScreenToClient(hwndProtoOrder, &hti.pt); TreeView_HitTest(hwndProtoOrder, &hti); - if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) - { + if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { HTREEITEM it = hti.hItem; hti.pt.y -= TreeView_GetItemHeight(hwndProtoOrder) / 2; TreeView_HitTest(hwndProtoOrder, &hti); @@ -295,7 +276,8 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (hti.flags&TVHT_ABOVE) SendMessage(hwndProtoOrder, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0); if (hti.flags&TVHT_BELOW) SendMessage(hwndProtoOrder, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0); TreeView_SetInsertMark(hwndProtoOrder, NULL, 0); - } } + } + } break; case WM_LBUTTONUP: @@ -318,8 +300,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.mask = TVIF_HANDLE|TVIF_PARAM; tvi.hItem = dat->hDragItem; TreeView_GetItem(hwndProtoOrder, &tvi); - if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) - { + if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) { TVINSERTSTRUCT tvis; TCHAR name[128]; ProtocolData * lpOldData; -- cgit v1.2.3