diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-04 04:10:03 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-04 04:10:03 +0000 |
commit | 11b3bc099739ab35d468ef064ebeda756feeeb42 (patch) | |
tree | 47166dcdbacdcac8c13da0ea045d0b920f59d07c | |
parent | 83ac052dbd269015fa458567db4147091b13a39e (diff) |
fix duplicate subcocntacts when importing (reset metaMap before modules loaded)
fix to binary tree node deletion
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@349 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | meta2/collection.h | 3 | ||||
-rw-r--r-- | meta2/common.h | 4 | ||||
-rw-r--r-- | meta2/import.cpp | 11 | ||||
-rw-r--r-- | meta2/proto.h | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/meta2/collection.h b/meta2/collection.h index 725bb1d..af0f781 100644 --- a/meta2/collection.h +++ b/meta2/collection.h @@ -361,6 +361,7 @@ protected: } else {
if(n == root) root = 0;
}
+ n->parent = 0;
delete n;
Collection<T>::count--;
return 0;
@@ -580,7 +581,7 @@ public: virtual const bool remove(A &key) {
TreeNode<Pair< A, B > > *n = find(key);
if(n) {
- delete_node(n);
+ BinaryTree< Pair< A, B > >::remove(n->val);
return true;
} else
return false;
diff --git a/meta2/common.h b/meta2/common.h index 35a0aca..f2e9b74 100644 --- a/meta2/common.h +++ b/meta2/common.h @@ -80,12 +80,14 @@ extern DWORD next_meta_id; #define MAX_SUBCONTACTS 20
+#define META_ID "MetaID"
+
inline bool MetaEnabled() {
return DBGetContactSettingByte(0, MODULE, "Enabled", 1) == 1;
}
inline bool IsMetacontact(HANDLE hContact) {
- return DBGetContactSettingDword(hContact, MODULE, "MetaID", (DWORD)-1) != (DWORD)-1;
+ return DBGetContactSettingDword(hContact, MODULE, META_ID, (DWORD)-1) != (DWORD)-1;
}
inline bool IsSubcontact(HANDLE hContact) {
diff --git a/meta2/import.cpp b/meta2/import.cpp index 7d3204e..8328584 100644 --- a/meta2/import.cpp +++ b/meta2/import.cpp @@ -271,8 +271,14 @@ void DeleteAllModuleContacts() { hMeta = hContact;
hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hMeta, 0);
- } else
+ } else {
+ // just to be safe
+ DBDeleteContactSetting(hContact, MODULE, "ParentMetaID");
+ DBWriteContactSettingDword(hContact, MODULE, "Handle", 0);
+ DBWriteContactSettingByte(hContact, MODULE, "IsSubcontact", 0);
+
hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
}
}
@@ -321,6 +327,9 @@ void ImportOldMetas() { }
}
+ // reset ready for modules loaded event
+ metaMap.clear();
+
if(MessageBox(0, TranslateT("Do you wish to remove your old metacontacts from your profile?"), TranslateT("Delete Old MetaContacts"), MB_YESNO) == IDYES)
DeleteOldMetas();
}
diff --git a/meta2/proto.h b/meta2/proto.h index 176791e..a05693a 100644 --- a/meta2/proto.h +++ b/meta2/proto.h @@ -6,6 +6,4 @@ void DeinitProto(); HANDLE NewMetaContact();
-#define META_ID "MetaID"
-
#endif
|