diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-20 08:26:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-20 08:26:15 +0000 |
commit | c92e6fa7468cfbbf0e05e611ba0790307fbd953a (patch) | |
tree | e5443fc6c7381a577f1e53af03e2778a616d5a7e | |
parent | c1c83bf5790a1adfeccd1e948e321ac3a7e3e54c (diff) |
andalso another accounts related code fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@1067 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/MyDetails/data.cpp | 14 | ||||
-rw-r--r-- | plugins/Utils/mir_options.cpp | 31 |
2 files changed, 15 insertions, 30 deletions
diff --git a/plugins/MyDetails/data.cpp b/plugins/MyDetails/data.cpp index ffe701cccd..c29af17ed0 100644 --- a/plugins/MyDetails/data.cpp +++ b/plugins/MyDetails/data.cpp @@ -196,21 +196,21 @@ void Protocol::SetStatus(int aStatus) // BEGIN From commomstatus.cpp (KeepStatus)
int i, count, pCount;
- PROTOCOLDESCRIPTOR **protos;
+ PROTOACCOUNT **accs;
pCount = 0;
- CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&protos);
- for (i=0;i<count;i++) {
- if (protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue;
- pCount += 1;
+ CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&accs);
+ for (i=0; i < count; i++) {
+ if (accs[i]->type != PROTOTYPE_PROTOCOL || CallProtoService(accs[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0)==0)
+ continue;
+ pCount++;
}
// END From commomstatus.cpp (KeepStatus)
PROTOCOLSETTINGEX **pse = (PROTOCOLSETTINGEX **) mir_alloc0(pCount * sizeof(PROTOCOLSETTINGEX *));
- for (i = 0; i < pCount; i++)
- {
+ for (i = 0; i < pCount; i++) {
pse[i] = (PROTOCOLSETTINGEX *) mir_alloc0(sizeof(PROTOCOLSETTINGEX));
pse[i]->szName = "";
}
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 8062c1180e..1096f44276 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -241,45 +241,30 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha lvi.iSubItem = 0;
lvi.iItem = 1000;
- PROTOACCOUNT **protos;
int count;
-
- BOOL hasAccounts = ServiceExists(MS_PROTO_ENUMACCOUNTS);
- if (hasAccounts)
- CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&protos);
- else
- CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&count, (LPARAM)&protos);
+ PROTOACCOUNT **protos;
+ CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&protos);
for (int i = 0; i < count; i++) {
- if (protos[i]->type != PROTOTYPE_PROTOCOL)
+ PROTOACCOUNT *p = protos[i];
+ if (p->type != PROTOTYPE_PROTOCOL)
continue;
- if (protos[i]->szModuleName == NULL || protos[i]->szModuleName[0] == '\0')
+ if (p->szModuleName == NULL || p->szModuleName[0] == '\0')
continue;
- if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(protos[i]->szModuleName))
+ if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(p->szModuleName))
continue;
- TCHAR *name;
- if (hasAccounts)
- name = mir_tstrdup(protos[i]->tszAccountName);
- else {
- char szName[128];
- CallProtoService(protos[i]->szModuleName, PS_GETNAME, sizeof(szName), (LPARAM)szName);
- name = mir_a2t(szName);
- }
-
char *setting = (char *) mir_alloc(128 * sizeof(char));
- mir_snprintf(setting, 128, ctrl->setting, protos[i]->szModuleName);
+ mir_snprintf(setting, 128, ctrl->setting, p->szModuleName);
BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue);
lvi.lParam = (LPARAM)setting;
- lvi.pszText = TranslateTS(name);
+ lvi.pszText = TranslateTS(p->tszAccountName);
lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi);
ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show?2:1), LVIS_STATEIMAGEMASK);
-
- mir_free(name);
}
ListView_SetColumnWidth(hwndProtocols, 0, LVSCW_AUTOSIZE);
|