summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 19:01:09 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 19:01:09 +0000
commit0800db775a4da41507478a02fa8cb9e58f35b0c9 (patch)
tree7472a040478be43bf27f27daa16c71c9794e5cb0
parente7f9349e332baac6ae96a93ceca2a2611409966f (diff)
db_mc_isMeta / db_mc_isSub - first functions of the new cache-based MC layer
git-svn-id: http://svn.miranda-ng.org/main/trunk@8311 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin55636 -> 56042 bytes
-rw-r--r--bin10/lib/mir_core64.libbin50896 -> 51264 bytes
-rw-r--r--bin11/lib/mir_core.libbin55636 -> 56042 bytes
-rw-r--r--bin11/lib/mir_core64.libbin50896 -> 51264 bytes
-rw-r--r--bin12/lib/mir_core.libbin55636 -> 56042 bytes
-rw-r--r--bin12/lib/mir_core64.libbin50896 -> 51264 bytes
-rw-r--r--include/delphi/m_metacontacts.inc32
-rw-r--r--include/m_metacontacts.h22
-rw-r--r--src/mir_core/commonheaders.h1
-rw-r--r--src/mir_core/db.cpp21
-rw-r--r--src/mir_core/mir_core.def2
-rw-r--r--src/mir_core/mir_core_12.vcxproj1
-rw-r--r--src/mir_core/mir_core_12.vcxproj.filters3
-rw-r--r--src/miranda32_12.vcxproj1
-rw-r--r--src/miranda32_12.vcxproj.filters11
-rw-r--r--src/modules/metacontacts/meta_utils.cpp4
16 files changed, 75 insertions, 23 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index b17b49a665..7c5813b0ff 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 2ec206c9c1..33b43189cf 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib
index d8c36ebb3d..edc6ccd46e 100644
--- a/bin11/lib/mir_core.lib
+++ b/bin11/lib/mir_core.lib
Binary files differ
diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib
index acf4e7cf28..0d6bfe83fd 100644
--- a/bin11/lib/mir_core64.lib
+++ b/bin11/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 9c8bcce0e2..8bd758cfd1 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index 0068df3f94..6f9817f2b0 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_metacontacts.inc b/include/delphi/m_metacontacts.inc
index 5ff5cf9855..53afbd5850 100644
--- a/include/delphi/m_metacontacts.inc
+++ b/include/delphi/m_metacontacts.inc
@@ -1,19 +1,19 @@
{
- Miranda IM: the free IM client for Microsoft Windows
-
+ Miranda IM: the free IM client for Microsoft Windows
+
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
Copyright © 2004 Scott Ellis (www.scottellis.com.au mail@scottellis.com.au)
-
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -132,30 +132,26 @@ const
wParam=lParam=0 }
MS_MC_GETPROTOCOLNAME = 'MetaContacts/GetProtoName';
- { added 0.9.5.0 (22/3/05)
- wParam=(HANDLE)hContact
+ { wParam=(HANDLE)hContact
lParam=0
convert a given contact into a metacontact
}
MS_MC_CONVERTTOMETA = 'MetaContacts/ConvertToMetacontact';
- { added 0.9.5.0 (22/3/05)
- wParam=(HANDLE)hContact
+ { wParam=(HANDLE)hContact
lParam=(HANDLE)hMeta
add an existing contact to a metacontact
}
MS_MC_ADDTOMETA = 'MetaContacts/AddToMetacontact';
- { added 0.9.5.0 (22/3/05)
- wParam=0
+ { wParam=0
lParam=(HANDLE)hContact
remove a contact from a metacontact
}
MS_MC_REMOVEFROMMETA = 'MetaContacts/RemoveFromMetacontact';
- { added 0.9.13.2 (6/10/05)
- wParam=(BOOL)disable
+ { wParam=(BOOL)disable
lParam=0
enable/disable the 'hidden group hack' - for clists that support subcontact
hiding using 'IsSubcontact' setting. Should be called once in the clist
@@ -165,4 +161,14 @@ const
}
MS_MC_DISABLEHIDDENGROUP = 'MetaContacts/DisableHiddenGroup';
+{ returns true if a contact is a metacontact or false otherwise
+}
+function db_mc_isMeta(hContact:MCONTACT):Boolean; stdcall;
+ external CoreDLL name 'db_mc_isMeta';
+
+{ returns true if a contact is a subcontact or false otherwise
+}
+function db_mc_isSub(hContact:MCONTACT):Boolean; stdcall;
+ external CoreDLL name 'db_mc_isSub';
+
{$ENDIF}
diff --git a/include/m_metacontacts.h b/include/m_metacontacts.h
index 541dfc0251..94cda43bd8 100644
--- a/include/m_metacontacts.h
+++ b/include/m_metacontacts.h
@@ -3,8 +3,8 @@
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2004-07 Scott Ellis (www.scottellis.com.au mail@scottellis.com.au)
Copyright (c) 2004 Universite Louis PASTEUR, STRASBOURG.
-Copyright (c) 2004 Scott Ellis (www.scottellis.com.au mail@scottellis.com.au)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_METACONTACTS_H__
#define M_METACONTACTS_H__ 1
+#include <m_core.h>
+
//get the handle for a contact's parent metacontact
//wParam=(HANDLE)hSubContact
//lParam=0
@@ -160,4 +162,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// before the metacontact onmodulesloaded handler where the subcontact hiding is usually done)
#define MS_MC_DISABLEHIDDENGROUP "MetaContacts/DisableHiddenGroup"
+/////////////////////////////////////////////////////////////////////////////////////////
+// binary interface to MC
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+// checks whether a contact is a metacontact
+MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact);
+
+// checks whether a contact is a subcontact of existing MC
+MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact);
+
+#if defined(__cplusplus)
+}
+#endif
+
#endif
diff --git a/src/mir_core/commonheaders.h b/src/mir_core/commonheaders.h
index 6e0b88f454..31745ac0a8 100644
--- a/src/mir_core/commonheaders.h
+++ b/src/mir_core/commonheaders.h
@@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_string.h>
+#include <m_metacontacts.h>
#include "miranda.h"
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp
index c22b0e1415..2652278143 100644
--- a/src/mir_core/db.cpp
+++ b/src/mir_core/db.cpp
@@ -321,6 +321,27 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// metacontacts
+
+MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact)
+{
+ if (currDb == NULL)
+ return false;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ return (cc == NULL) ? false : cc->nSubs != -1;
+}
+
+MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact)
+{
+ if (currDb == NULL)
+ return false;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ return (cc == NULL) ? false : cc->parentID != INVALID_CONTACT_ID;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// misc functions
MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 6b0244e4db..5ff1a5efb5 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -248,3 +248,5 @@ ProtoLogW @245
db_get_static @246
db_get_wstatic @247
db_get_static_utf @248
+db_mc_isMeta @249
+db_mc_isSub @250
diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj
index 518502e446..c9926e96ef 100644
--- a/src/mir_core/mir_core_12.vcxproj
+++ b/src/mir_core/mir_core_12.vcxproj
@@ -22,6 +22,7 @@
<ClInclude Include="..\..\include\m_core.h" />
<ClInclude Include="..\..\include\m_database.h" />
<ClInclude Include="..\..\include\m_json.h" />
+ <ClInclude Include="..\..\include\m_metacontacts.h" />
<ClInclude Include="..\..\include\m_system.h" />
<ClInclude Include="..\..\include\m_system_cpp.h" />
<ClInclude Include="commonheaders.h" />
diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters
index 43e01d705a..3311ae3578 100644
--- a/src/mir_core/mir_core_12.vcxproj.filters
+++ b/src/mir_core/mir_core_12.vcxproj.filters
@@ -153,5 +153,8 @@
<ClInclude Include="..\..\include\m_system_cpp.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\m_metacontacts.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/src/miranda32_12.vcxproj b/src/miranda32_12.vcxproj
index eece008066..48d1467dcd 100644
--- a/src/miranda32_12.vcxproj
+++ b/src/miranda32_12.vcxproj
@@ -243,6 +243,7 @@
<ClInclude Include="..\include\m_json.h" />
<ClInclude Include="..\include\m_langpack.h" />
<ClInclude Include="..\include\m_message.h" />
+ <ClInclude Include="..\include\m_metacontacts.h" />
<ClInclude Include="..\include\m_netlib.h" />
<ClInclude Include="..\include\m_options.h" />
<ClInclude Include="..\include\m_popup.h" />
diff --git a/src/miranda32_12.vcxproj.filters b/src/miranda32_12.vcxproj.filters
index 77ed2ccd0f..34a4c5bb5c 100644
--- a/src/miranda32_12.vcxproj.filters
+++ b/src/miranda32_12.vcxproj.filters
@@ -273,6 +273,9 @@
<ClInclude Include="modules\metacontacts\metacontacts.h">
<Filter>Modules\metacontacts</Filter>
</ClInclude>
+ <ClInclude Include="..\include\m_metacontacts.h">
+ <Filter>Modules\metacontacts</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="core\commonheaders.cpp">
@@ -596,12 +599,6 @@
<ClCompile Include="modules\chat\tools.cpp">
<Filter>Modules\chat</Filter>
</ClCompile>
- <ClCompile Include="modules\metacontacts\addto.cpp">
- <Filter>Modules\metacontacts</Filter>
- </ClCompile>
- <ClCompile Include="modules\metacontacts\edit.cpp">
- <Filter>Modules\metacontacts</Filter>
- </ClCompile>
<ClCompile Include="modules\metacontacts\meta_api.cpp">
<Filter>Modules\metacontacts</Filter>
</ClCompile>
@@ -620,6 +617,8 @@
<ClCompile Include="modules\metacontacts\meta_utils.cpp">
<Filter>Modules\metacontacts</Filter>
</ClCompile>
+ <ClCompile Include="modules\metacontacts\meta_addto.cpp" />
+ <ClCompile Include="modules\metacontacts\meta_edit.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index dfb7be0685..8a307bbb6c 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -713,12 +713,10 @@ int Meta_SetHandles(void)
if (contact_number < 0) {
// problem!
MessageBox(0, TranslateT("Subcontact contact number < 0 - deleting MetaContact"), nick_buffer, MB_OK | MB_ICONERROR);
- //CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
hNextContact = db_find_next(hContact);
- Meta_Delete(hContact, (LPARAM)1);
+ Meta_Delete(hContact, 1);
hContact = hNextContact;
continue;
- //return 1;
}
// ensure the window open flag is not present