diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-09 21:50:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-09 21:50:49 +0000 |
commit | 0173277372e2962b8f5703a0ebad7892dda15e6c (patch) | |
tree | d1ff4bbecbc00f8d77b9a71c71579de53246303c /plugins/UserInfoEx | |
parent | 61dfdec9a37cc06a6ee624aaaf03df41f821c1c6 (diff) |
end of the old MC API
git-svn-id: http://svn.miranda-ng.org/main/trunk@8534 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/classMAnnivDate.cpp | 14 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.cpp | 46 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.h | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_profile.cpp | 13 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_reminder.cpp | 2 |
7 files changed, 29 insertions, 70 deletions
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 59e861d446..3078c2f4bd 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -482,9 +482,9 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) // try to get birthday date from metacontact's subcontact
else if (DB::Module::IsMetaAndScan(pszProto)) {
// try to get setting from the default subcontact first
- const int def = DB::MetaContact::SubDefNum(hContact);
+ const int def = db_mc_getDefaultNum(hContact);
if (def > -1 && def < INT_MAX) {
- MCONTACT hSubContact = DB::MetaContact::Sub(hContact, def);
+ MCONTACT hSubContact = db_mc_getSub(hContact, def);
if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) {
RemoveFlags(MADF_HASCUSTOM);
SetFlags(MADF_HASMETA);
@@ -493,12 +493,12 @@ int MAnnivDate::DBGetBirthDate(MCONTACT hContact, LPSTR pszProto) // scan all subcontacts for the setting
if (_wFlags == 0) {
- const int cnt = DB::MetaContact::SubCount(hContact);
+ const int cnt = db_mc_getSubCount(hContact);
if (cnt < INT_MAX) {
for (int i = 0; i < cnt; i++) {
if (i != def) {
- MCONTACT hSubContact = DB::MetaContact::Sub(hContact, i);
+ MCONTACT hSubContact = db_mc_getSub(hContact, i);
if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) {
RemoveFlags(MADF_HASCUSTOM);
SetFlags(MADF_HASMETA);
@@ -735,7 +735,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo MAnnivDate mdbNewProto;
MAnnivDate mdbIgnore;
- const int nSubContactCount = (bIsMeta) ? DB::MetaContact::SubCount(hContact) : 0;
+ const int nSubContactCount = (bIsMeta) ? db_mc_getSubCount(hContact) : 0;
BYTE bWantBackup = !mdbNewProto.DBGetDate(hContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)
&& !IsEqual(mdbNewProto.SystemTime())
@@ -744,7 +744,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // allow backup only, if the custom setting differs from all meta subcontacts' protocol based settings, too.
for (int i = 0; (i < nSubContactCount) && bWantBackup && bIsMeta; i++) {
- MCONTACT hSubContact = DB::MetaContact::Sub(hContact, i);
+ MCONTACT hSubContact = db_mc_getSub(hContact, i);
if (hSubContact && !mdbIgnore.DBGetDate(hSubContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
bWantBackup = bWantBackup
&& !IsEqual(mdbIgnore.SystemTime())
@@ -769,7 +769,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo // update metasubcontacts
for (int i = 0; i < nSubContactCount; i++) {
- MCONTACT hSubContact = DB::MetaContact::Sub(hContact, i);
+ MCONTACT hSubContact = db_mc_getSub(hContact, i);
if (hSubContact != NULL) {
if (!mdbIgnore.DBGetDate(hSubContact, DB::Contact::Proto(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR))
mdbIgnore.DBWriteDateStamp(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED);
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index d9188ee74e..9f303cb8a1 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -310,12 +310,12 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) // metacontacts sub pages
if (bScanMetaSubContacts) {
- int numSubs = DB::MetaContact::SubCount(wParam);
+ int numSubs = db_mc_getSubCount(wParam);
psh._dwFlags &= ~PSF_PROTOPAGESONLY_INIT;
psh._dwFlags |= PSF_PROTOPAGESONLY;
for (int i = 0; i < numSubs; i++) {
- psh._hContact = DB::MetaContact::Sub(wParam, i);
+ psh._hContact = db_mc_getSub(wParam, i);
psh._nSubContact = i;
if (psh._hContact) {
psh._pszProto = DB::Contact::Proto(psh._hContact);
@@ -1574,9 +1574,9 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // need meta contact's subcontact information
if (DB::Module::IsMetaAndScan(pPs->pszProto)) {
// count valid subcontacts whose protocol supports the PSS_GETINFO service to update the information
- int numSubs = DB::MetaContact::SubCount(pPs->hContact);
+ int numSubs = db_mc_getSubCount(pPs->hContact);
for (int i = 0; i < numSubs; i++) {
- MCONTACT hSubContact = DB::MetaContact::Sub(pPs->hContact, i);
+ MCONTACT hSubContact = db_mc_getSub(pPs->hContact, i);
if (hSubContact != NULL) {
if (ProtoServiceExists(DB::Contact::Proto(hSubContact), PSS_GETINFO)) {
pPs->infosUpdated = (TAckInfo*)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo)* (pPs->nSubContacts + 1));
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index d253876279..b2c2bf80d4 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -217,9 +217,9 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) if (isMeta()) {
CExImContactXML vContact(_pXmlFile);
- const int cnt = DB::MetaContact::SubCount(_hContact);
- const int def = DB::MetaContact::SubDefNum(_hContact);
- MCONTACT hSubContact = DB::MetaContact::Sub(_hContact, def);
+ const int cnt = db_mc_getSubCount(_hContact);
+ const int def = db_mc_getDefaultNum(_hContact);
+ MCONTACT hSubContact = db_mc_getSub(_hContact, def);
// export default subcontact
if (hSubContact && vContact.fromDB(hSubContact))
@@ -227,7 +227,7 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) for (int i = 0; i < cnt; i++) {
if (i != def) {
- hSubContact = DB::MetaContact::Sub(_hContact, i);
+ hSubContact = db_mc_getSub(_hContact, i);
if (hSubContact && vContact.fromDB(hSubContact))
vContact.ExportSubContact(this, pModules);
}
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 17f77c8161..4a06374b8d 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -23,36 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace DB {
-namespace MetaContact {
-
-INT_PTR SubCount(MCONTACT hMetaContact)
-{
- INT_PTR result = CallService(MS_MC_GETNUMCONTACTS, (WPARAM) hMetaContact, 0);
- return (result == CALLSERVICE_NOTFOUND) ? -1 : result;
-}
-
-INT_PTR SubDefNum(MCONTACT hMetaContact)
-{
- INT_PTR result = CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM) hMetaContact, 0);
- return (result == CALLSERVICE_NOTFOUND) ? -1 : result;
-}
-
-MCONTACT Sub(MCONTACT hMetaContact, int idx)
-{
- if (idx != -1) {
- INT_PTR result = CallService(MS_MC_GETSUBCONTACT, (WPARAM) hMetaContact, (LPARAM) idx);
- return (result == CALLSERVICE_NOTFOUND) ? NULL : (MCONTACT)result;
- }
- return NULL;
-}
-
-MCONTACT GetMeta(MCONTACT hContact)
-{
- return db_mc_getMeta(hContact);
-}
-
-} /* namespace MetaContact */
-
/**
* This namespace contains all functions used to access or modify contacts in the database.
**/
@@ -297,22 +267,22 @@ BYTE GetEx(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetti result = Get(hContact, pszProto, pszSetting, dbv, destType) != 0;
// try to get setting from a metasubcontact
if (result && DB::Module::IsMetaAndScan(pszProto)) {
- const INT_PTR def = DB::MetaContact::SubDefNum(hContact);
+ const INT_PTR def = db_mc_getDefaultNum(hContact);
MCONTACT hSubContact;
// try to get setting from the default subcontact first
if (def > -1 && def < INT_MAX) {
- hSubContact = DB::MetaContact::Sub(hContact, def);
+ hSubContact = db_mc_getSub(hContact, def);
if (hSubContact != NULL)
result = DB::Setting::GetEx(hSubContact, pszModule, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType) != 0;
}
// scan all subcontacts for the setting
if (result) {
- const INT_PTR cnt = DB::MetaContact::SubCount(hContact);
+ const INT_PTR cnt = db_mc_getSubCount(hContact);
if (cnt < INT_MAX) {
INT_PTR i;
for (i = 0; result && i < cnt; i++) {
if (i != def) {
- hSubContact = DB::MetaContact::Sub(hContact, i);
+ hSubContact = db_mc_getSub(hContact, i);
if (hSubContact != NULL)
result = DB::Setting::GetEx(hSubContact, pszModule, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType) != 0;
} } } } } }
@@ -352,11 +322,11 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps // try to read the setting from the sub contacts' modules
else if (DB::Module::IsMetaAndScan(pszProto)) {
- const INT_PTR def = DB::MetaContact::SubDefNum(hContact);
+ const INT_PTR def = db_mc_getDefaultNum(hContact);
MCONTACT hSubContact;
// try to get setting from the default subcontact first
if (def > -1 && def < INT_MAX) {
- hSubContact = DB::MetaContact::Sub(hContact, def);
+ hSubContact = db_mc_getSub(hContact, def);
if (hSubContact != NULL) {
wFlags = GetCtrl(hSubContact, pszSubModule, NULL, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType);
if (wFlags != 0) {
@@ -368,10 +338,10 @@ WORD GetCtrl(MCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR ps // copy the missing settings from the other subcontacts
if (wFlags == 0) {
INT_PTR i;
- const INT_PTR cnt = DB::MetaContact::SubCount(hContact);
+ const INT_PTR cnt = db_mc_getSubCount(hContact);
for (i = 0; i < cnt; i++) {
if (i != def) {
- hSubContact = DB::MetaContact::Sub(hContact, i);
+ hSubContact = db_mc_getSub(hContact, i);
if (hSubContact != NULL) {
wFlags = GetCtrl(hSubContact, pszSubModule, NULL, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType);
if (wFlags != 0) {
diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index ae6ec11c25..93df0f2a36 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -23,14 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace DB {
-namespace MetaContact{
- INT_PTR SubCount(MCONTACT hMetaContact);
- INT_PTR SubDefNum(MCONTACT hMetaContact);
- MCONTACT Sub(MCONTACT hMetaContact, int idx);
-
- MCONTACT GetMeta(MCONTACT hContact);
-} /* namespace MetaContact */
-
/**
* This namespace contains all functions used to access
* or modify contacts in the database.
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index c63bc0e4ab..11a1b73eaf 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -1143,22 +1143,19 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // scan all basic protocols for the subcontacts
if (DB::Module::IsMetaAndScan(pszProto)) {
- int iDefault = CallService(MS_MC_GETDEFAULTCONTACTNUM, hContact, NULL);
+ int iDefault = db_mc_getDefaultNum(hContact);
MCONTACT hSubContact, hDefContact;
LPCSTR pszSubBaseProto;
- int j, numSubs;
- if ((hDefContact = (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, iDefault)) &&
- (pszSubBaseProto = DB::Contact::Proto(hDefContact)))
- {
+ if ((hDefContact = db_mc_getSub(hContact, iDefault)) && (pszSubBaseProto = DB::Contact::Proto(hDefContact))) {
if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
return FALSE;
// copy the missing settings from the other subcontacts
- numSubs = CallService(MS_MC_GETNUMCONTACTS, hContact, NULL);
- for (j = 0; j < numSubs; j++) {
+ int numSubs = db_mc_getSubCount(hContact);
+ for (int j = 0; j < numSubs; j++) {
if (j == iDefault) continue;
- if (!(hSubContact = (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, j))) continue;
+ if (!(hSubContact = db_mc_getSub(hContact, j))) continue;
if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) continue;
if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0)
return FALSE;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index c22b9089c1..e2af3f6161 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -654,7 +654,7 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb !strncmp(pdbcws->szSetting, "Anniv", 5) ||
!strncmp(pdbcws->szSetting, "DOB", 3)))
{
- MCONTACT hMeta = DB::MetaContact::GetMeta(hContact);
+ MCONTACT hMeta = db_mc_getMeta(hContact);
WORD LastAnswer = IDNONE;
CEvent evt;
MTime now;
|