diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-08 20:12:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-08 20:12:26 +0300 |
commit | 8ffc77be71507825a8f7585bcabff8ccc370206a (patch) | |
tree | aa13a8070f31286db6ad22e17a577e547942f951 /plugins/TabSRMM/src | |
parent | 41b2fdfc654e3eec07c97ceba00cda13d988ffff (diff) |
db_get_sa / db_get_wsa to receive the default value, massive code simplification
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat_options.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 23 | ||||
-rw-r--r-- | plugins/TabSRMM/src/functions.h | 2 |
3 files changed, 7 insertions, 26 deletions
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 3b973cc1b2..e7d7be142c 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -218,13 +218,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfCharSet = SYMBOL_CHARSET;
wcsncpy_s(lf->lfFaceName, L"Webdings", _TRUNCATE);
}
- else {
- ptrW tszDefFace(db_get_wsa(0, szMod, str));
- if (tszDefFace == nullptr)
- wcsncpy_s(lf->lfFaceName, fol[i].szDefFace, _TRUNCATE);
- else
- wcsncpy_s(lf->lfFaceName, tszDefFace, _TRUNCATE);
- }
+ else wcsncpy_s(lf->lfFaceName, ptrW(db_get_wsa(0, szMod, str, fol[i].szDefFace)), _TRUNCATE);
}
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 733f760aa3..a3c633d5eb 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2119,34 +2119,21 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) // retrieve the container name for the given contact handle.
// if none is assigned, return the name of the default container
-int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNameLen)
+void TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNameLen)
{
// single window mode using cloned (temporary) containers
if (M.GetByte("singlewinmode", 0)) {
wcsncpy_s(szName, iNameLen, L"Message Session", _TRUNCATE);
- return 0;
+ return;
}
// use clist group names for containers...
if (M.GetByte("useclistgroups", 0)) {
- ptrW tszGroup(db_get_wsa(hContact, "CList", "Group"));
- if (tszGroup == nullptr) {
- wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE);
- return 0;
- }
-
- wcsncpy_s(szName, iNameLen, tszGroup, _TRUNCATE);
- return 1;
- }
-
- ptrW tszContainerName(db_get_wsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY));
- if (tszContainerName == nullptr) {
- wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE);
- return 0;
+ wcsncpy_s(szName, iNameLen, ptrW(db_get_wsa(hContact, "CList", "Group", L"default")), _TRUNCATE);
+ return;
}
- wcsncpy_s(szName, iNameLen, tszContainerName, _TRUNCATE);
- return 1;
+ wcsncpy_s(szName, iNameLen, ptrW(db_get_wsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY, L"default")), _TRUNCATE);
}
void TSAPI DeleteContainer(int iIndex)
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index a4877a57b9..9d3f58b3e9 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -90,7 +90,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer); void TSAPI CloseAllContainers();
void TSAPI DeleteContainer(int iIndex);
void TSAPI RenameContainer(int iIndex, const wchar_t *newName);
-int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNameLen);
+void TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNameLen);
HMENU TSAPI BuildContainerMenu();
void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT mode, bool fForceResize);
void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam);
|