summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp7
-rw-r--r--src/mir_app/src/ExtraIconGroup.cpp4
-rw-r--r--src/mir_app/src/IcolibExtraIcon.cpp3
-rw-r--r--src/mir_app/src/extraicons.cpp44
-rw-r--r--src/mir_app/src/filter.cpp16
5 files changed, 37 insertions, 37 deletions
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index f7eb6e0d84..2690e1da27 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -441,6 +441,8 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW
return 1;
DBCONTACTWRITESETTING dbcwWork = dbcwNotif;
+ char *szCachedSettingName = m_cache->GetCachedSetting(dbcwWork.szModule, dbcwWork.szSetting, moduleNameLen, settingNameLen);
+ bool bIsResident = szCachedSettingName[-1] != 0;
mir_ptr<BYTE> pEncoded(NULL);
bool bIsEncrypted = false;
@@ -449,7 +451,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW
break;
case DBVT_ASCIIZ: case DBVT_UTF8:
- bIsEncrypted = m_bEncrypted || IsSettingEncrypted(dbcws->szModule, dbcws->szSetting);
+ bIsEncrypted = !bIsResident && (m_bEncrypted || IsSettingEncrypted(dbcws->szModule, dbcws->szSetting));
LBL_WriteString:
if (dbcwWork.value.pszVal == NULL)
return 1;
@@ -485,7 +487,6 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW
return 2;
}
- char *szCachedSettingName = m_cache->GetCachedSetting(dbcwWork.szModule, dbcwWork.szSetting, moduleNameLen, settingNameLen);
log3("set [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName);
// we don't cache blobs and passwords
@@ -506,7 +507,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::WriteContactSetting(MCONTACT contactID, DBCONTACTW
}
m_cache->SetCachedVariant(&dbcwWork.value, pCachedValue);
}
- if (szCachedSettingName[-1] != 0) {
+ if (bIsResident) {
lck.unlock();
log2(" set resident as %s (%p)", printVariant(&dbcwWork.value), pCachedValue);
NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwWork);
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp
index 70247ba823..5b7af670f1 100644
--- a/src/mir_app/src/ExtraIconGroup.cpp
+++ b/src/mir_app/src/ExtraIconGroup.cpp
@@ -123,7 +123,7 @@ int ExtraIconGroup::setIconByName(int id, MCONTACT hContact, const char *value)
int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, void *value, bool bByName)
{
if (m_insideApply) {
- for (int i=0; i < m_items.getCount(); i++)
+ for (int i = 0; i < m_items.getCount(); i++)
if (m_items[i]->getID() == id) {
if (bByName)
return m_items[i]->setIconByName(id, hContact, (const char*)value);
@@ -136,7 +136,7 @@ int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, void *value, bool
ExtraIcon *current = getCurrentItem(hContact);
int currentPos = m_items.getCount();
int storePos = m_items.getCount();
- for (int i=0; i < m_items.getCount(); i++) {
+ for (int i = 0; i < m_items.getCount(); i++) {
if (m_items[i]->getID() == id)
storePos = i;
diff --git a/src/mir_app/src/IcolibExtraIcon.cpp b/src/mir_app/src/IcolibExtraIcon.cpp
index 399e19369e..faeb6b072d 100644
--- a/src/mir_app/src/IcolibExtraIcon.cpp
+++ b/src/mir_app/src/IcolibExtraIcon.cpp
@@ -26,8 +26,7 @@ Boston, MA 02111-1307, USA.
#include "IcoLib.h"
-IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const wchar_t *_description, const char *_descIcon,
- MIRANDAHOOKPARAM _OnClick, LPARAM _param) :
+IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const wchar_t *_description, const char *_descIcon, MIRANDAHOOKPARAM _OnClick, LPARAM _param) :
BaseExtraIcon(_id, _name, _description, _descIcon, _OnClick, _param)
{
db_set_resident(MODULE_NAME, _name);
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index f701d94064..499d8d1505 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -35,8 +35,8 @@ int SortFunc(const ExtraIcon *p1, const ExtraIcon *p2)
if (ret != 0)
return ret;
- int id1 = (p1->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*) p1)->getID() : 0;
- int id2 = (p2->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*) p2)->getID() : 0;
+ int id1 = (p1->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*)p1)->getID() : 0;
+ int id2 = (p2->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*)p2)->getID() : 0;
return id1 - id2;
}
@@ -67,12 +67,12 @@ int ConvertToClistSlot(int slot)
if (slot < 0)
return slot;
- return slot+1;
+ return slot + 1;
}
int ExtraImage_ExtraIDToColumnNum(int extra)
{
- return (extra < 1 || extra > EXTRA_ICON_COUNT) ? -1 : extra-1;
+ return (extra < 1 || extra > EXTRA_ICON_COUNT) ? -1 : extra - 1;
}
int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)
@@ -80,7 +80,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)
if (cli.hwndContactTree == 0)
return -1;
- int icol = ExtraImage_ExtraIDToColumnNum( ConvertToClistSlot(slot));
+ int icol = ExtraImage_ExtraIDToColumnNum(ConvertToClistSlot(slot));
if (icol == -1)
return -1;
@@ -88,7 +88,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage)
if (hItem == 0)
return -1;
- SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol,hImage));
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol, hImage));
return 0;
}
@@ -98,7 +98,7 @@ ExtraIcon* GetExtraIcon(HANDLE id)
if (i < 1 || i > extraIconsByHandle.getCount())
return nullptr;
- return extraIconsByHandle[i-1];
+ return extraIconsByHandle[i - 1];
}
ExtraIcon* GetExtraIconBySlot(int slot)
@@ -113,7 +113,7 @@ ExtraIcon* GetExtraIconBySlot(int slot)
BaseExtraIcon* GetExtraIconByName(const char *name)
{
- for (int i=0; i < registeredExtraIcons.getCount(); i++) {
+ for (int i = 0; i < registeredExtraIcons.getCount(); i++) {
BaseExtraIcon *extra = registeredExtraIcons[i];
if (mir_strcmp(name, extra->getName()) == 0)
return extra;
@@ -124,7 +124,7 @@ BaseExtraIcon* GetExtraIconByName(const char *name)
static void LoadGroups(LIST<ExtraIconGroup> &groups)
{
int count = db_get_w(0, MODULE_NAME "Groups", "Count", 0);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
char setting[512];
mir_snprintf(setting, "%d_count", i);
unsigned int items = db_get_w(0, MODULE_NAME "Groups", setting, 0);
@@ -174,26 +174,26 @@ void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
{
extraIconsByHandle.destroy();
- for (int i=0; i < registeredExtraIcons.getCount(); i++)
+ for (int i = 0; i < registeredExtraIcons.getCount(); i++)
extraIconsByHandle.insert(registeredExtraIcons[i]);
- for (int k=0; k < extraIconsBySlot.getCount(); k++) {
+ for (int k = 0; k < extraIconsBySlot.getCount(); k++) {
ExtraIcon *extra = extraIconsBySlot[k];
if (extra->getType() == EXTRAICON_TYPE_GROUP)
delete extra;
}
extraIconsBySlot.destroy();
- for (int i=0; i < groups.getCount(); i++) {
+ for (int i = 0; i < groups.getCount(); i++) {
ExtraIconGroup *group = groups[i];
for (int j = 0; j < group->m_items.getCount(); j++)
- extraIconsByHandle.put(group->m_items[j]->getID()-1, group);
+ extraIconsByHandle.put(group->m_items[j]->getID() - 1, group);
extraIconsBySlot.insert(group);
}
- for (int k=0; k < extraIconsByHandle.getCount(); k++) {
+ for (int k = 0; k < extraIconsByHandle.getCount(); k++) {
ExtraIcon *extra = extraIconsByHandle[k];
if (extra->getType() != EXTRAICON_TYPE_GROUP)
extraIconsBySlot.insert(extra);
@@ -206,7 +206,7 @@ MIR_APP_DLL(void) KillModuleExtraIcons(int _hLang)
{
LIST<ExtraIcon> arDeleted(1);
- for (int i=registeredExtraIcons.getCount()-1; i >= 0; i--) {
+ for (int i = registeredExtraIcons.getCount() - 1; i >= 0; i--) {
BaseExtraIcon *p = registeredExtraIcons[i];
if (p->m_hLangpack == _hLang) {
registeredExtraIcons.remove(i);
@@ -221,7 +221,7 @@ MIR_APP_DLL(void) KillModuleExtraIcons(int _hLang)
LoadGroups(groups);
RebuildListsBasedOnGroups(groups);
- for (int k=0; k < arDeleted.getCount(); k++)
+ for (int k = 0; k < arDeleted.getCount(); k++)
delete arDeleted[k];
}
@@ -233,7 +233,7 @@ int ClistExtraListRebuild(WPARAM, LPARAM)
ResetIcons();
- for (int i=0; i < extraIconsBySlot.getCount(); i++)
+ for (int i = 0; i < extraIconsBySlot.getCount(); i++)
extraIconsBySlot[i]->rebuildIcons();
return 0;
@@ -246,7 +246,7 @@ int ClistExtraImageApply(WPARAM hContact, LPARAM)
clistApplyAlreadyCalled = TRUE;
- for (int i=0; i < extraIconsBySlot.getCount(); i++)
+ for (int i = 0; i < extraIconsBySlot.getCount(); i++)
extraIconsBySlot[i]->applyIcon(hContact);
return 0;
@@ -259,7 +259,7 @@ int ClistExtraClick(WPARAM hContact, LPARAM lParam)
int clistSlot = (int)lParam;
- for (int i=0; i < extraIconsBySlot.getCount(); i++) {
+ for (int i = 0; i < extraIconsBySlot.getCount(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
if (ConvertToClistSlot(extra->getSlot()) == clistSlot) {
extra->onClick(hContact);
@@ -289,7 +289,7 @@ MIR_APP_DLL(HANDLE) ExtraIcon_AddIcon(HICON hIcon)
void fnReloadExtraIcons()
{
- SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(0,"CLUI","ExtraColumnSpace",18), 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(0, "CLUI", "ExtraColumnSpace", 18), 0);
SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
if (hExtraImageList)
@@ -299,7 +299,7 @@ void fnReloadExtraIcons()
SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList);
SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
- NotifyEventHooks(hEventExtraImageListRebuilding,0,0);
+ NotifyEventHooks(hEventExtraImageListRebuilding, 0, 0);
bImageCreated = true;
}
@@ -386,7 +386,7 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int
}
}
-EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon,
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon,
MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon,
MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int flags, int _hLang)
{
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp
index 93544fd63c..245f85a78e 100644
--- a/src/mir_app/src/filter.cpp
+++ b/src/mir_app/src/filter.cpp
@@ -31,7 +31,7 @@ void AddFilterString(const PageHash key, wchar_t *data)
{
if (ContainsFilterString(key, data)) return;
- CPageKeywords * values = filterStrings[key];
+ CPageKeywords *values = filterStrings[key];
if (values == nullptr) {
values = new CPageKeywords(key);
filterStrings.insert(values);
@@ -46,16 +46,16 @@ void ClearFilterStrings()
BOOL ContainsFilterString(const PageHash key, wchar_t *data)
{
- CPageKeywords* values = filterStrings[key];
+ CPageKeywords *values = filterStrings[key];
return (values) ? values->ContainsString(data) : FALSE;
}
void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
{
if (root) {
- wchar_t title[2048] = {0};
+ wchar_t title[2048] = { 0 };
- TVITEM item = {0};
+ TVITEM item = { 0 };
item.mask = TVIF_TEXT;
item.hItem = root;
item.pszText = title;
@@ -94,7 +94,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
if (mir_wstrcmpi(szClass, L"listbox") == 0) {
if (GetWindowStyle(hWndDlg) & LBS_HASSTRINGS) {
int count = ListBox_GetCount(hWndDlg);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
title[0] = 0; //safety
int res = ListBox_GetText(hWndDlg, i, title);
if (res != LB_ERR) {
@@ -109,7 +109,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
if (mir_wstrcmpi(szClass, L"SysListView32") == 0) {
int count = ListView_GetItemCount(hWndDlg);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
title[0] = 0; //safety
ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));
@@ -122,7 +122,7 @@ void AddDialogString(HWND hWndDlg, const PageHash key)
if (mir_wstrcmpi(szClass, L"combobox") == 0) {
if (GetWindowStyle(hWndDlg) & CBS_HASSTRINGS) {
int count = ComboBox_GetCount(hWndDlg);
- for (int i=0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
title[0] = 0; //safety
int res = ComboBox_GetLBText(hWndDlg, i, title);
if (res != CB_ERR) {
@@ -154,6 +154,6 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *p
if ((enableKeywordFiltering) && (hWnd != 0)) {
AddDialogString(hWnd, key);
- EnumChildWindows(hWnd, GetDialogStringsCallback, (LPARAM) key);
+ EnumChildWindows(hWnd, GetDialogStringsCallback, (LPARAM)key);
}
}