From bcce699a176c52da83e7bb6fb588038df9af926a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Mar 2014 20:16:16 +0000 Subject: "MetaContacts Hidden Group" removed forever git-svn-id: http://svn.miranda-ng.org/main/trunk@8389 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clistsettings.cpp | 5 +- plugins/Clist_nicer/src/clc.cpp | 5 +- plugins/Db3x_mmap/src/dbcontacts.cpp | 5 +- protocols/AimOscar/src/server.cpp | 250 +++++++++------------- protocols/AimOscar/src/utility.cpp | 4 +- protocols/MSN/src/msn_srv.cpp | 40 +--- src/modules/metacontacts/meta_utils.cpp | 1 + 7 files changed, 125 insertions(+), 185 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 8eea4be0ea..010b3d5d5a 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -441,9 +441,8 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szModule, pdnce->m_cache_cszProto)) { InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); - // !!!!!!!!!!!!!!!!!!!!!!! - // if (!strcmp(cws->szSetting,"IsSubcontact")) - // PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0); + if (!strcmp(cws->szSetting, "IsSubcontact")) + PostMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0); if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) { if (!mir_strcmp(cws->szModule, META_PROTO) && mir_strcmp(cws->szSetting, "Status")) { diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 3fe336762a..2b19c96016 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -155,9 +155,8 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting)) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); } - // !!!!!!!!!!!!!!!!!! - // if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact")) - // pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); + if (cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, META_PROTO) && !__strcmp(cws->szSetting, "IsSubcontact")) + pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); } } else if (!__strcmp(cws->szModule, META_PROTO)) { diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index d05dac5555..0f3027afb4 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -263,7 +263,7 @@ void CDb3Mmap::FillContacts() DBCachedContact *cc = m_cache->AddContactToCache(dwContactID); cc->dwDriverData = dwOffset; CheckProto(cc, ""); - + DBVARIANT dbv; dbv.type = DBVT_DWORD; cc->nSubs = (0 != GetContactSetting(dwContactID, META_PROTO, "NumContacts", &dbv)) ? -1 : dbv.dVal; if (cc->nSubs != -1) { @@ -286,7 +286,7 @@ void CDb3Mmap::FillContacts() } cc->nDefault = (0 != GetContactSetting(dwContactID, META_PROTO, "Default", &dbv)) ? -1 : dbv.dVal; cc->parentID = (0 != GetContactSetting(dwContactID, META_PROTO, "ParentMeta", &dbv)) ? NULL : dbv.dVal; - + // whether we need conversion or not if (!GetContactSetting(dwContactID, META_PROTO, "MetaID", &dbv)) arMetas.insert((void*)dwContactID); @@ -312,7 +312,6 @@ void CDb3Mmap::FillContacts() // wipe out old data from subcontacts DeleteContactSetting(cc->pSubs[k], META_PROTO, "ContactNumber"); - DeleteContactSetting(cc->pSubs[k], META_PROTO, "IsSubcontact"); DeleteContactSetting(cc->pSubs[k], META_PROTO, "MetaLink"); } } diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index af9c749b44..8407f426fd 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -612,11 +612,11 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 mir_free(sn); } } + void CAimProto::snac_user_offline(SNAC &snac)//family 0x0003 { - if (snac.subcmp(0x000c)) - { - unsigned char buddy_length=snac.ubyte(); + if (snac.subcmp(0x000c)) { + unsigned char buddy_length = snac.ubyte(); char* buddy=snac.part(1,buddy_length); MCONTACT hContact=contact_from_sn(buddy, true); if (hContact) @@ -627,9 +627,7 @@ void CAimProto::snac_user_offline(SNAC &snac)//family 0x0003 void CAimProto::snac_error(SNAC &snac)//family 0x0003 or 0x0004 { if (snac.subcmp(0x0001)) - { get_error(snac.ushort()); - } } void CAimProto::process_ssi_list(SNAC &snac, int &offset) @@ -642,51 +640,31 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) unsigned short tlv_size = snac.ushort(offset+8+name_length); const int tlv_base = offset + name_length + 10; - switch (type) - { - case 0x0000: //buddy record + switch (type) { + case 0x0000: //buddy record { MCONTACT hContact = contact_from_sn(name, true); - if (hContact) - { + if (hContact) { int i; - for (i=1; ; i++) - { - if (!getBuddyId(hContact, i)) - { - setBuddyId(hContact, i, item_id); + for (i = 1;; i++) { + if (!getBuddyId(hContact, i)) { + setBuddyId(hContact, i, item_id); setGroupId(hContact, i, group_id); break; } } - if (i == 1 && getByte(AIM_KEY_MG, 1)) - { + if (i == 1 && getByte(AIM_KEY_MG, 1)) { const char* group = group_list.find_name(group_id); - if (group) - { + if (group) { bool ok = false; DBVARIANT dbv; - if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) - { + if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) { ok = strcmp(group, dbv.pszVal) == 0; - if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0) - { - db_free(&dbv); - if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv)) - { - ok = strcmp(group, dbv.pszVal) == 0; - db_free(&dbv); - } - } - else - db_free(&dbv); + db_free(&dbv); } - else - { - ok = strcmp(group, AIM_DEFAULT_GROUP) == 0; - } - if (!ok) - { + else ok = strcmp(group, AIM_DEFAULT_GROUP) == 0; + + if (!ok) { if (strcmp(group, AIM_DEFAULT_GROUP)) db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, group); else @@ -697,12 +675,10 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) setWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE); bool nickfound = false; - for (int tlv_offset = 0; tlv_offset < tlv_size; ) - { + for (int tlv_offset = 0; tlv_offset < tlv_size;) { TLV tlv(snac.val(tlv_base + tlv_offset)); - if (tlv.cmp(0x0131) && tlv.len()) - { + if (tlv.cmp(0x0131) && tlv.len()) { char* nick = tlv.dup(); db_set_utf(hContact, MOD_KEY_CL, "MyHandle", nick); mir_free(nick); @@ -715,133 +691,119 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - if (!nickfound && getDword(AIM_KEY_LV, 0) >= 0x80500) + if (!nickfound && getDword(AIM_KEY_LV, 0) >= 0x80500) db_unset(hContact, MOD_KEY_CL, "MyHandle"); } - break; - } + } + break; - case 0x0001: //group record - if (group_id) - { - group_list.add(name, group_id); - if (getByte(AIM_KEY_MG, 1)) - create_group(name); - } - break; + case 0x0001: //group record + if (group_id) { + group_list.add(name, group_id); + if (getByte(AIM_KEY_MG, 1)) + create_group(name); + } + break; - case 0x0002: //permit record - allow_list.add(name, item_id); - break; + case 0x0002: //permit record + allow_list.add(name, item_id); + break; - case 0x0003: //deny record - block_list.add(name, item_id); - break; + case 0x0003: //deny record + block_list.add(name, item_id); + break; - case 0x0004: //privacy record - if (group_id == 0) - { - pd_info_id = item_id; + case 0x0004: //privacy record + if (group_id == 0) { + pd_info_id = item_id; - for (int tlv_offset = 0; tlv_offset < tlv_size; ) - { - TLV tlv(snac.val(tlv_base + tlv_offset)); + for (int tlv_offset = 0; tlv_offset < tlv_size;) { + TLV tlv(snac.val(tlv_base + tlv_offset)); - if (tlv.cmp(0x00ca)) - pd_mode = tlv.ubyte(); - else if (tlv.cmp(0x00cc)) - pd_flags = tlv.ulong(); + if (tlv.cmp(0x00ca)) + pd_mode = tlv.ubyte(); + else if (tlv.cmp(0x00cc)) + pd_flags = tlv.ulong(); - tlv_offset += TLV_HEADER_SIZE + tlv.len(); - } + tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - break; - - case 0x0005: //prefernces record - if (group_id == 0) - { - pref1_id = item_id; + } + break; - for (int tlv_offset = 0; tlv_offset < tlv_size; ) - { - TLV tlv(snac.val(tlv_base + tlv_offset)); + case 0x0005: //prefernces record + if (group_id == 0) { + pref1_id = item_id; - if (tlv.cmp(0x00c9)) - pref1_flags = tlv.ulong(); - else if (tlv.cmp(0x00d6)) - pref1_set_flags = tlv.ulong(); - else if (tlv.cmp(0x00d7)) - { - mir_free(pref2_flags); - pref2_flags = tlv.dup(); - pref2_len = tlv.len(); - } - else if (tlv.cmp(0x00d8)) - { - mir_free(pref2_set_flags); - pref2_set_flags = tlv.dup(); - pref2_set_len = tlv.len(); - } + for (int tlv_offset = 0; tlv_offset < tlv_size;) { + TLV tlv(snac.val(tlv_base + tlv_offset)); - tlv_offset += TLV_HEADER_SIZE + tlv.len(); + if (tlv.cmp(0x00c9)) + pref1_flags = tlv.ulong(); + else if (tlv.cmp(0x00d6)) + pref1_set_flags = tlv.ulong(); + else if (tlv.cmp(0x00d7)) { + mir_free(pref2_flags); + pref2_flags = tlv.dup(); + pref2_len = tlv.len(); } + else if (tlv.cmp(0x00d8)) { + mir_free(pref2_set_flags); + pref2_set_flags = tlv.dup(); + pref2_set_len = tlv.len(); + } + + tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - break; + } + break; - case 0x0014: //avatar record - if (!_strcmps(name, "1") || !_strcmps(name, "12")) - { - if (name_length == 1) - avatar_id_sm = item_id; - else - avatar_id_lg = item_id; + case 0x0014: //avatar record + if (!_strcmps(name, "1") || !_strcmps(name, "12")) { + if (name_length == 1) + avatar_id_sm = item_id; + else + avatar_id_lg = item_id; - for (int tlv_offset = 0; tlv_offset < tlv_size; ) - { - TLV tlv(snac.val( tlv_base + tlv_offset)); + for (int tlv_offset = 0; tlv_offset < tlv_size;) { + TLV tlv(snac.val(tlv_base + tlv_offset)); - if (tlv.cmp(0x00d5) && tlv.len() > 2) - { - unsigned char type = tlv.ubyte(0); - if (name_length == 1) - { - mir_free(hash_sm); - hash_sm = bytes_to_string(tlv.val() + 2, tlv.ubyte(1)); - } - else - { - mir_free(hash_lg); - hash_lg = bytes_to_string(tlv.val() + 2, tlv.ubyte(1)); - } + if (tlv.cmp(0x00d5) && tlv.len() > 2) { + unsigned char type = tlv.ubyte(0); + if (name_length == 1) { + mir_free(hash_sm); + hash_sm = bytes_to_string(tlv.val() + 2, tlv.ubyte(1)); + } + else { + mir_free(hash_lg); + hash_lg = bytes_to_string(tlv.val() + 2, tlv.ubyte(1)); } - - tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - if (list_received) - avatar_request_handler(NULL, NULL, 0); + + tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - break; + if (list_received) + avatar_request_handler(NULL, NULL, 0); + } + break; - case 0x001D: // Vanity information - if (group_id == 0) - { - for (int tlv_offset = 0; tlv_offset < tlv_size; ) - { - TLV tlv(snac.val(tlv_base + tlv_offset)); + case 0x001D: // Vanity information + if (group_id == 0) { + for (int tlv_offset = 0; tlv_offset < tlv_size;) { + TLV tlv(snac.val(tlv_base + tlv_offset)); - if (tlv.cmp(0x0150)) // Number of IMs sent - setDword(AIM_KEY_TIS, tlv.ulong()); - else if (tlv.cmp(0x0151)) // Number of seconds a user is online - setDword(AIM_KEY_TTO, tlv.ulong()); - else if (tlv.cmp(0x0152)) // Number of times a user has the away message set - setDword(AIM_KEY_TAM, tlv.ulong()); - else if (tlv.cmp(0x0153)) // Number of IMs received - setDword(AIM_KEY_TIR, tlv.ulong()); + if (tlv.cmp(0x0150)) // Number of IMs sent + setDword(AIM_KEY_TIS, tlv.ulong()); + else if (tlv.cmp(0x0151)) // Number of seconds a user is online + setDword(AIM_KEY_TTO, tlv.ulong()); + else if (tlv.cmp(0x0152)) // Number of times a user has the away message set + setDword(AIM_KEY_TAM, tlv.ulong()); + else if (tlv.cmp(0x0153)) // Number of IMs received + setDword(AIM_KEY_TIR, tlv.ulong()); - tlv_offset += TLV_HEADER_SIZE + tlv.len(); - } + tlv_offset += TLV_HEADER_SIZE + tlv.len(); } - break; + } + break; } mir_free(name); diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 6fa8530527..00af4417d4 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -236,9 +236,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id) void CAimProto::add_contact_to_group(MCONTACT hContact, const char* new_group) { - if (new_group == NULL) return; - - if (strcmp(new_group, "MetaContacts Hidden Group") == 0) + if (new_group == NULL) return; unsigned short old_group_id = getGroupId(hContact, 1); diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index 5d655a2d31..57eee9f381 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -127,7 +127,8 @@ LPCSTR CMsnProto::MSN_GetGroupByName(const char* pName) void CMsnProto::MSN_SetGroupName(const char* pId, const char* pNewName) { ServerGroupItem* p = grpList.find((ServerGroupItem*)&pId); - if (p != NULL) replaceStr(p->name, pNewName); + if (p != NULL) + replaceStr(p->name, pNewName); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -147,14 +148,9 @@ void CMsnProto::MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName) bool bInsert = false, bDelete = szGroupID[0] != 0; - if (grpName != NULL) - { - if (strcmp(grpName, "MetaContacts Hidden Group") == 0) - return; - + if (grpName != NULL) { szId = MSN_GetGroupByName(grpName); - if (szId == NULL) - { + if (szId == NULL) { MSN_ABAddGroup(grpName); szId = MSN_GetGroupByName(grpName); } @@ -163,19 +159,18 @@ void CMsnProto::MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName) else bInsert = true; } - if (bDelete) - { + if (bDelete) { MSN_ABAddDelContactGroup(szContactID, szGroupID, "ABGroupContactDelete"); delSetting(hContact, "GroupID"); } - if (bInsert) - { + if (bInsert) { MSN_ABAddDelContactGroup(szContactID, szId, "ABGroupContactAdd"); setString(hContact, "GroupID", szId); } - if (bDelete) MSN_RemoveEmptyGroups(); + if (bDelete) + MSN_RemoveEmptyGroups(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -258,22 +253,9 @@ void CMsnProto::MSN_SyncContactToServerGroup(MCONTACT hContact, const char* szCo const char* szGrpName = ""; DBVARIANT dbv; - if (!db_get_utf(hContact, "CList", "Group", &dbv)) - { - if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0) - { - db_free(&dbv); - if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv)) - { - szGrpName = NEWSTR_ALLOCA(dbv.pszVal); - db_free(&dbv); - } - } - else - { - szGrpName = NEWSTR_ALLOCA(dbv.pszVal); - db_free(&dbv); - } + if (!db_get_utf(hContact, "CList", "Group", &dbv)) { + szGrpName = NEWSTR_ALLOCA(dbv.pszVal); + db_free(&dbv); } const char* szGrpIdF = NULL; diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index 28e915784b..f4f47cae94 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -316,6 +316,7 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default) // Write the link in the contact db_set_dw(src, META_PROTO, "ParentMeta", dest); + db_set_b(src, META_PROTO, "IsSubcontact", true); // update count of contacts db_set_dw(dest, META_PROTO, "NumContacts", num_contacts); -- cgit v1.2.3