diff options
author | George Hazan <george.hazan@gmail.com> | 2013-05-23 14:50:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-05-23 14:50:43 +0000 |
commit | d9c995acca09460e8b8533c7efdb5eddd6e61d73 (patch) | |
tree | 77f9a1cd9fe70ccb350d31278a6e9ff92d1c5c22 /src | |
parent | b200631b8fe202bc59a66d2d88cebf40c09059dc (diff) |
fix for invalid account ordering in Options -> Contact List -> Accounts
git-svn-id: http://svn.miranda-ng.org/main/trunk@4810 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/clist/protocolorder.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index 23b88d57e8..953833970c 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct tagProtocolData
{
char *RealName;
- int protopos;
int show, enabled;
}
ProtocolData;
@@ -104,7 +103,16 @@ bool CheckProtocolOrder(void) return changed;
}
-int FillTree(HWND hwnd)
+static bool ProtoToInclude(PROTOACCOUNT *pa)
+{
+ if ( !Proto_IsAccountEnabled(pa))
+ return false;
+
+ PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName);
+ return (pd != NULL && pd->type == PROTOTYPE_PROTOCOL);
+}
+
+static int FillTree(HWND hwnd)
{
TVINSERTSTRUCT tvis;
tvis.hParent = NULL;
@@ -121,16 +129,11 @@ int FillTree(HWND hwnd) continue;
PROTOACCOUNT *pa = accounts[idx];
- if ( !Proto_IsAccountEnabled(pa))
- continue;
-
- PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName);
- if (pd == NULL || pd->type != PROTOTYPE_PROTOCOL)
+ if ( !ProtoToInclude(pa))
continue;
ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = pa->szModuleName;
- PD->protopos = pa->iOrder;
PD->enabled = Proto_IsAccountEnabled(pa) && isProtoSuitable(pa->ppro);
PD->show = PD->enabled ? pa->bIsVisible : 100;
@@ -180,7 +183,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch(((LPNMHDR)lParam)->idFrom) {
case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- int count = 0;
+ int idx = 0;
TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndProtoOrder);
@@ -194,7 +197,8 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ProtocolData* ppd = (ProtocolData*)tvi.lParam;
PROTOACCOUNT* pa = Proto_GetAccount(ppd->RealName);
if (pa != NULL) {
- pa->iOrder = count++;
+ while (idx < accounts.getCount() && !ProtoToInclude(accounts[idx])) idx++;
+ pa->iOrder = idx++;
if (ppd->enabled)
pa->bIsVisible = ppd->show;
}
|