diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-10 14:42:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-10 14:42:51 +0000 |
commit | 33953cc6a0fab6a91af293c6838f8a46dd7922da (patch) | |
tree | 2dbbe718ad42545bde6c9f7672387827c530550a /plugins/UserInfoEx/src | |
parent | e190a7fde521bd6af9ea485cc730f854aaf38e11 (diff) |
HCONTACT, part 3
git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r-- | plugins/UserInfoEx/src/classMAnnivDate.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/classMTime.cpp | 19 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 10 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.h | 30 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactBase.h | 37 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp | 10 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 6 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 8 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImXML.h | 30 |
11 files changed, 76 insertions, 88 deletions
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 2731b85bca..f23bf33c74 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -257,8 +257,9 @@ MZodiac MAnnivDate::Zodiac() **/
int MAnnivDate::DBGetReminderOpts(HCONTACT hContact)
{
- if (!hContact || hContact == INVALID_HANDLE_VALUE)
+ if (!hContact || hContact == (HCONTACT)INVALID_HANDLE_VALUE)
return 1;
+
if (_wID == ANID_BIRTHDAY) {
_bRemind = db_get_b(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, BST_INDETERMINATE);
_wDaysEarlier = db_get_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1);
@@ -289,8 +290,9 @@ int MAnnivDate::DBGetReminderOpts(HCONTACT hContact) **/
int MAnnivDate::DBWriteReminderOpts(HCONTACT hContact)
{
- if (!hContact || hContact == INVALID_HANDLE_VALUE)
+ if (!hContact || hContact == (HCONTACT)INVALID_HANDLE_VALUE)
return 1;
+
if (_wID == ANID_BIRTHDAY) {
if (_bRemind == BST_INDETERMINATE)
db_unset(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED);
@@ -438,7 +440,7 @@ int MAnnivDate::DBGetDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSe **/
int MAnnivDate::DBWriteDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- if (hContact == INVALID_HANDLE_VALUE || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0)
+ if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0)
return 1;
DWORD dwStamp = DateStamp();
diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index 5035d8eac9..190488b10a 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -423,20 +423,14 @@ void MTime::GetLocalTime(HCONTACT hContact) * read and write time to miranda's database
*********************************************/
-int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
+int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- DWORD dwTimeStamp;
-
- if (hContact == INVALID_HANDLE_VALUE ||
- pszModule == NULL || pszModule[0] == 0 ||
- pszSetting == NULL || pszSetting[0] == 0)
- {
+ if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) {
ZeroDate();
return 1;
}
- dwTimeStamp = db_get_dw(hContact, pszModule, pszSetting, 0);
-
+ DWORD dwTimeStamp = db_get_dw(hContact, pszModule, pszSetting, 0);
if (dwTimeStamp == 0) {
ZeroDate();
return 1;
@@ -448,11 +442,8 @@ int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) int MTime::DBWriteStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting)
{
- if (hContact == INVALID_HANDLE_VALUE ||
- pszModule == NULL || pszModule[0] == 0 ||
- pszSetting == NULL || pszSetting[0] == 0)
- {
+ if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0)
return 1;
- }
+
return db_set_dw(hContact, pszModule, pszSetting, TimeStamp());
}
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 653f9c77b2..1efc6eb034 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -986,15 +986,15 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar : pPs->pTree->CurrentItem();
// prefer to return the contact accociated with the current page
- if (pti && pti->hContact() != INVALID_HANDLE_VALUE) {
- *(HANDLE*)lParam = pti->hContact();
+ if (pti && pti->hContact() != (HCONTACT)INVALID_HANDLE_VALUE) {
+ *(HCONTACT*)lParam = pti->hContact();
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->hContact());
return TRUE;
}
// return contact who owns the details dialog
- if (pPs->hContact != INVALID_HANDLE_VALUE) {
- *(HANDLE*)lParam = pPs->hContact;
+ if (pPs->hContact != (HCONTACT)INVALID_HANDLE_VALUE) {
+ *(HCONTACT*)lParam = pPs->hContact;
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hContact);
return TRUE;
}
@@ -1362,7 +1362,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (hContact != pPs->hContact) {
if (!myGlobals.szMetaProto)
break;
- if (pPs->hContact != (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, NULL))
+ if (pPs->hContact != (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, NULL))
break;
if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE))
break;
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.h b/plugins/UserInfoEx/src/dlg_propsheet.h index dce0416454..88e9f4a643 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.h +++ b/plugins/UserInfoEx/src/dlg_propsheet.h @@ -247,25 +247,25 @@ struct TPropSheet {
// dialogs owner
HCONTACT hContact;
- CHAR pszProto[MAXMODULELABELLENGTH];
-
- HANDLE hProtoAckEvent; // eventhook for protocol acks
- HANDLE hSettingChanged; // eventhook searching for changed contact information
- HANDLE hIconsChanged; // eventhook for changed icons in icolib
- HFONT hCaptionFont;
- HFONT hBoldFont;
- RECT rcDisplay;
- BYTE updateAnimFrame;
- CHAR szUpdating[64];
- DWORD dwFlags;
+ CHAR pszProto[MAXMODULELABELLENGTH];
+
+ HANDLE hProtoAckEvent; // eventhook for protocol acks
+ HANDLE hSettingChanged; // eventhook searching for changed contact information
+ HANDLE hIconsChanged; // eventhook for changed icons in icolib
+ HFONT hCaptionFont;
+ HFONT hBoldFont;
+ RECT rcDisplay;
+ BYTE updateAnimFrame;
+ CHAR szUpdating[64];
+ DWORD dwFlags;
TAckInfo *infosUpdated;
- int nSubContacts;
+ int nSubContacts;
// controls
- HWND hDlg;
- CPsTree *pTree;
- CPsUpload *pUpload;
+ HWND hDlg;
+ CPsTree *pTree;
+ CPsUpload *pUpload;
};
void DlgContactInfoInitTreeIcons();
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index efb32e0efc..023f551096 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -227,7 +227,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) HCONTACT CExImContactBase::toDB()
{
// create new contact if none exists
- if (_hContact == INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) {
+ if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) {
PROTOACCOUNT* pszAccount = 0;
if (NULL == (pszAccount = ProtoGetAccount( _pszProto ))) {
//account does not exist
@@ -521,7 +521,7 @@ BYTE CExImContactBase::isHandle(HCONTACT hContact) * param: none
* return: handle if successful, INVALID_HANDLE_VALUE otherwise
**/
-HANDLE CExImContactBase::findHandle()
+HCONTACT CExImContactBase::findHandle()
{
for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
if (isHandle(hContact)) {
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h index c9bb3fee24..e248c1d2a7 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h @@ -23,34 +23,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE CListFindGroup(LPCSTR pszGroup);
-class CExImContactBase {
- BYTE compareUID(DBVARIANT *dbv);
+class CExImContactBase
+{
+ BYTE compareUID(DBVARIANT *dbv);
protected:
- LPSTR _pszNick; // utf8 encoded
- LPSTR _pszDisp; // utf8 encoded
- LPSTR _pszGroup; // utf8 encoded
- LPSTR _pszAMPro;
- LPSTR _pszProto;
- LPSTR _pszProtoOld;
- LPSTR _pszUIDKey;
- DWORD _dbvUIDHash;
- DBVARIANT _dbvUID;
- HCONTACT _hContact;
- BYTE _isNewContact; // is this contact a new one?
-
- HANDLE findHandle();
+ LPSTR _pszNick; // utf8 encoded
+ LPSTR _pszDisp; // utf8 encoded
+ LPSTR _pszGroup; // utf8 encoded
+ LPSTR _pszAMPro;
+ LPSTR _pszProto;
+ LPSTR _pszProtoOld;
+ LPSTR _pszUIDKey;
+ DWORD _dbvUIDHash;
+ DBVARIANT _dbvUID;
+ HCONTACT _hContact;
+ BYTE _isNewContact; // is this contact a new one?
+
+ HCONTACT findHandle();
public:
CExImContactBase();
~CExImContactBase();
-// __inline LPCSTR disp() const { return mir_strcmp(_pszDisp,"")? _pszDisp : NULL; }
-// __inline LPCSTR group() const { return mir_strcmp(_pszGroup,"")? _pszGroup : NULL; }
-// __inline LPCSTR nick() const { return mir_strcmp(_pszNick,"")? _pszNick : NULL; }
-// __inline LPCSTR proto() const { return mir_strcmp(_pszProto,"")? _pszProto : NULL; }
-// __inline LPCSTR ampro() const { return mir_strcmp(_pszAMPro,"")? _pszAMPro : NULL; }
-// __inline LPCSTR uidk() const { return mir_strcmp(_pszUIDKey,"")? _pszUIDKey : NULL; }
__inline DBVARIANT& uid() { return _dbvUID; }
__inline HCONTACT handle() const { return _hContact; }
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 8aa92d5285..1bef0889b8 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -207,7 +207,7 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) if (!xmlfile)
return ERROR_INVALID_PARAMS;
- if (_hContact == INVALID_HANDLE_VALUE)
+ if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE)
return ERROR_INVALID_CONTACT;
if (!CreateXmlElement())
@@ -510,7 +510,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) CExImContactXML vSub(_pXmlFile);
if (vSub = xSub) {
// identify metacontact by the first valid subcontact in xmlfile
- if (_hContact == INVALID_HANDLE_VALUE && vSub.handle() != INVALID_HANDLE_VALUE) {
+ if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE && vSub.handle() != (HCONTACT)INVALID_HANDLE_VALUE) {
HCONTACT hMeta = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)vSub.handle(), NULL);
if (hMeta != NULL) {
_hContact = hMeta;
@@ -520,7 +520,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) }
}
// if no handle was found, this is a new meta contact
- _isNewContact = _hContact == INVALID_HANDLE_VALUE;
+ _isNewContact = _hContact == (HCONTACT)INVALID_HANDLE_VALUE;
}
// entry is a default contact
else {
@@ -588,7 +588,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) int CExImContactXML::ImportContact()
{
// create the contact if not yet exists
- if (toDB() != INVALID_HANDLE_VALUE) {
+ if (toDB() != (HCONTACT)INVALID_HANDLE_VALUE) {
_hEvent = NULL;
// count settings and events and init progress dialog
@@ -736,7 +736,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) return err;
// check if contact is subcontact of the desired meta contact
- if ((HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL) != pMetaContact->handle()) {
+ if ((HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL) != pMetaContact->handle()) {
// add contact to the metacontact (this service returns TRUE if successful)
err = CallService(MS_MC_ADDTOMETA, (WPARAM)_hContact, (LPARAM)pMetaContact->handle());
if (err == FALSE) {
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index 3ddfbe0f93..acd8410463 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -303,7 +303,7 @@ static HCONTACT ImportFindContact(HCONTACT hContact, LPSTR &strBuf, BYTE bCanCre CExImContactBase vcc;
vcc.fromIni(strBuf);
- if (vcc.handle() != INVALID_HANDLE_VALUE) {
+ if (vcc.handle() != (HCONTACT)INVALID_HANDLE_VALUE) {
//if (vcc.isHandle(hContact))
// return hContact;
return vcc.handle();
@@ -452,11 +452,11 @@ int SvcExImINI_Import(HCONTACT hContact, LPCSTR pszFileName) numLines++;
// contact was found and imported
- if (hContact != INVALID_HANDLE_VALUE && hNewContact != INVALID_HANDLE_VALUE)
+ if (hContact != (HCONTACT)INVALID_HANDLE_VALUE && hNewContact != (HCONTACT)INVALID_HANDLE_VALUE)
break;
// importing settings is only valid vor the main menu item
- if (hContact == INVALID_HANDLE_VALUE) {
+ if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) {
if (!strncmp(strBuf, "SETTINGS:", 9)) {
*szModule = 0;
hNewContact = NULL;
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 824c4c0fd1..0cea3cff25 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -854,7 +854,7 @@ BYTE CVCardFileVCF::Open(HCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode) {
if (!(_pFile = fopen(pszFileName, pszMode)))
return FALSE;
- if ((_hContact = hContact) == INVALID_HANDLE_VALUE)
+ if ((_hContact = hContact) == (HCONTACT)INVALID_HANDLE_VALUE)
return FALSE;
if (!(_pszBaseProto = DB::Contact::Proto(_hContact)))
return FALSE;
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index c4664b0975..245c28e016 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -139,7 +139,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) }
else {
// other export mode
- _hContactToWorkOn = INVALID_HANDLE_VALUE;
+ _hContactToWorkOn = (HCONTACT)INVALID_HANDLE_VALUE;
#ifdef _DEBUG
LARGE_INTEGER freq, t1, t2;
@@ -265,8 +265,8 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) switch (result) {
case ERROR_OK:
// init contact class and import if matches the user desires
- if (_hContactToWorkOn == INVALID_HANDLE_VALUE || vContact.handle() == _hContactToWorkOn) {
- result = vContact.Import(_hContactToWorkOn != INVALID_HANDLE_VALUE);
+ if (_hContactToWorkOn == (HCONTACT)INVALID_HANDLE_VALUE || vContact.handle() == _hContactToWorkOn) {
+ result = vContact.Import(_hContactToWorkOn != (HCONTACT)INVALID_HANDLE_VALUE);
switch (result) {
case ERROR_OK:
_numContactsDone++;
@@ -295,7 +295,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) if (pszNick) mir_free(pszNick);
}
// import owner contact
- else if (_hContactToWorkOn == INVALID_HANDLE_VALUE && !mir_stricmp(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) {
+ else if (_hContactToWorkOn == (HCONTACT)INVALID_HANDLE_VALUE && !mir_stricmp(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) {
result = vContact.Import();
switch (result) {
case ERROR_OK:
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h index 382fdb6dde..cbc64d761d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h @@ -29,24 +29,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CFileXml {
friend class CExImContactXML;
- DWORD _numContactsTodo;
- DWORD _numContactsDone;
- DWORD _numSettingsTodo;
- DWORD _numSettingsDone;
- DWORD _numEventsTodo;
- DWORD _numEventsDone;
- DWORD _numEventsDuplicated;
+ DWORD _numContactsTodo;
+ DWORD _numContactsDone;
+ DWORD _numSettingsTodo;
+ DWORD _numSettingsDone;
+ DWORD _numEventsTodo;
+ DWORD _numEventsDone;
+ DWORD _numEventsDuplicated;
- HANDLE _hContactToWorkOn; // contact to ex/import (NULL=owner|INVALID_HANDLE_VALUE=all|HADNLE=one user)
+ HCONTACT _hContactToWorkOn; // contact to ex/import (NULL=owner|INVALID_HANDLE_VALUE=all|HADNLE=one user)
- WORD _wExport;
+ WORD _wExport;
- CProgress _progress;
+ CProgress _progress;
- int ImportOwner(TiXmlElement* xmlContact);
- int ImportContacts(TiXmlElement* xmlParent);
+ int ImportOwner(TiXmlElement* xmlContact);
+ int ImportContacts(TiXmlElement* xmlParent);
- DWORD CountContacts(TiXmlElement* xmlParent);
+ DWORD CountContacts(TiXmlElement* xmlParent);
/*
int ExportOwner(FILE *xmlfile, BYTE bExportEvents);
@@ -56,8 +56,8 @@ class CFileXml { public:
CFileXml();
- int Import(HCONTACT hContact, LPCSTR pszFileName);
- int Export(lpExImParam ExImContact, LPCSTR pszFileName);
+ int Import(HCONTACT hContact, LPCSTR pszFileName);
+ int Export(lpExImParam ExImContact, LPCSTR pszFileName);
};
#endif /* _SVC_FILEXML_INCLUDED_ */
\ No newline at end of file |