diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-10 21:36:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-10 21:36:54 +0000 |
commit | 9c2e0c8b025c98cbff2975e6dd9c86e03cd04244 (patch) | |
tree | bd95b8ef2753ef3f2b3701bfe350eb7682794319 /src/modules | |
parent | f22d8982b41614d703b0db98264e01ef7049a4a0 (diff) |
code cleaning for ME_DB_CONTACT_SETTINGCHANGED in plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@2283 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/clist/clc.cpp | 5 | ||||
-rw-r--r-- | src/modules/extraicons/DefaultExtraIcons.cpp | 30 | ||||
-rw-r--r-- | src/modules/protocols/protoaccs.cpp | 11 |
3 files changed, 16 insertions, 30 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index ea1e92877e..8f44d7bf5e 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -95,15 +95,14 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) else {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL) {
- char *id = NULL;
if ( !strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p"))
cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
// something is being written to a protocol module
if ( !strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
- id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if ((INT_PTR) id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting))
+ char *id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
+ if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting))
cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
}
diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp index 46262f877d..8115e50b07 100644 --- a/src/modules/extraicons/DefaultExtraIcons.cpp +++ b/src/modules/extraicons/DefaultExtraIcons.cpp @@ -215,24 +215,20 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam) bool isProto = (strcmp(cws->szModule, proto) == 0);
- if (isProto && strcmp(cws->szSetting, "ApparentMode") == 0)
- {
+ if (isProto && strcmp(cws->szSetting, "ApparentMode") == 0) {
SetVisibility(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.wVal, TRUE);
return 0;
}
- if (strcmp(cws->szSetting, "Gender") == 0 && (isProto || strcmp(cws->szModule, "UserInfo") == 0))
- {
+ if (strcmp(cws->szSetting, "Gender") == 0 && (isProto || strcmp(cws->szModule, "UserInfo") == 0)) {
SetGender(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal, TRUE);
return 0;
}
- for (unsigned int i = 0; i < SIZEOF(infos); i++)
- {
+ for (unsigned int i = 0; i < SIZEOF(infos); i++) {
Info &info = infos[i];
- for (unsigned int j = 0; j < SIZEOF(info.db); j += 2)
- {
+ for (unsigned int j = 0; j < SIZEOF(info.db); j += 2) {
if (info.db[j + 1] == NULL)
break;
if (info.db[j] == NULL && !isProto)
@@ -267,16 +263,13 @@ static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param) return 0;
bool found = false;
- for (unsigned int j = 0; !found && j < SIZEOF(info->db); j += 2)
- {
+ for (unsigned int j = 0; !found && j < SIZEOF(info->db); j += 2) {
if (info->db[j + 1] == NULL)
break;
DBVARIANT dbv = { 0 };
- if (!DBGetContactSettingString(hContact, info->db[j] == NULL ? proto : info->db[j], info->db[j+1], &dbv))
- {
- if (!IsEmpty(dbv.pszVal))
- {
+ if (!DBGetContactSettingString(hContact, info->db[j] == NULL ? proto : info->db[j], info->db[j+1], &dbv)) {
+ if (!IsEmpty(dbv.pszVal)) {
info->OnClick(info, dbv.pszVal);
found = true;
}
@@ -293,8 +286,7 @@ static void DBExtraIconsInit() hExtraChat = ExtraIcon_Register("chat_activity", "Chat activity", "ChatActivity");
hExtraVisibility = ExtraIcon_Register("visibility", "Visibility", "AlwaysVis");
hExtraGender = ExtraIcon_Register("gender", "Gender", "gender_male");
- for (unsigned int i = 0; i < SIZEOF(infos); i++)
- {
+ for (unsigned int i = 0; i < SIZEOF(infos); i++) {
Info &info = infos[i];
if (info.OnClick)
info.hExtraIcon = ExtraIcon_Register(info.name, info.desc, info.icon, DefaultOnClick, (LPARAM) &info);
@@ -303,8 +295,7 @@ static void DBExtraIconsInit() }
HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
+ while (hContact != NULL) {
SetExtraIcons(hContact);
SetVisibility(hContact, -1, FALSE);
SetGender(hContact, -1, FALSE);
@@ -335,8 +326,7 @@ static int ProtocolRebuildIcons(WPARAM wParam, LPARAM lParam) static ProtoInfo *FindProto(const char * proto)
{
- for (unsigned int i = 0; i < protos.size(); i++)
- {
+ for (unsigned int i = 0; i < protos.size(); i++) {
ProtoInfo *pi = &protos[i];
if (strcmp(pi->proto.c_str(), proto) == 0)
return pi;
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 49c8a87765..b753f78963 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -196,11 +196,9 @@ void WriteDbAccounts() /////////////////////////////////////////////////////////////////////////////////////////
static int OnContactDeleted(WPARAM wParam, LPARAM lParam)
{
- const HANDLE hContact = (HANDLE)wParam;
- if (hContact)
- {
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact) {
PROTOACCOUNT* pa = Proto_GetAccount(hContact);
-
if (Proto_IsAccountEnabled(pa) && pa->ppro)
pa->ppro->OnEvent(EV_PROTO_ONCONTACTDELETED, wParam, lParam);
}
@@ -209,9 +207,8 @@ static int OnContactDeleted(WPARAM wParam, LPARAM lParam) static int OnDbSettingsChanged(WPARAM wParam, LPARAM lParam)
{
- const HANDLE hContact = (HANDLE)wParam;
- if (hContact)
- {
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact) {
PROTOACCOUNT* pa = Proto_GetAccount(hContact);
if (Proto_IsAccountEnabled(pa) && pa->ppro)
pa->ppro->OnEvent(EV_PROTO_DBSETTINGSCHANGED, wParam, lParam);
|