diff options
Diffstat (limited to 'plugins/UserInfoEx')
19 files changed, 1032 insertions, 991 deletions
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 19dc88f493..f7a760cdff 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * param: none * return: nothing **/ + CExImContactBase::CExImContactBase() { _pszNick = nullptr; @@ -50,6 +51,7 @@ CExImContactBase::CExImContactBase() * param: none * return: nothing **/ + CExImContactBase::~CExImContactBase() { MIR_FREE(_pszNick); @@ -70,6 +72,7 @@ CExImContactBase::~CExImContactBase() * param: hContact - handle to contact whose information to read * return: TRUE if successful or FALSE otherwise **/ + BYTE CExImContactBase::fromDB(MCONTACT hContact) { BYTE ret = FALSE; @@ -77,7 +80,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) LPSTR pszProto; LPCSTR uidSetting; DBVARIANT dbv; - + _hContact = hContact; _dbvUIDHash = 0; MIR_FREE(_pszProtoOld); @@ -92,13 +95,13 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) // OWNER if (!_hContact) return TRUE; - + // Proto if (!(pszProto = Proto_GetBaseAccountName(_hContact))) return FALSE; _pszProto = mir_strdup(pszProto); // AM_BaseProto - if (!DB::Setting::GetUString(NULL, pszProto, "AM_BaseProto", &dbv )) { + if (!DB::Setting::GetUString(NULL, pszProto, "AM_BaseProto", &dbv)) { _pszAMPro = mir_strdup(dbv.pszVal); db_free(&dbv); } @@ -127,7 +130,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) ret = TRUE; } } - + // nickname if (!DB::Setting::GetUString(_hContact, pszProto, SET_CONTACT_NICK, &dbv)) { _pszNick = mir_strdup(dbv.pszVal); @@ -135,12 +138,12 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) } if (_hContact && ret) { - // Clist Group + // Clist Group if (!DB::Setting::GetUString(_hContact, MOD_CLIST, "Group", &dbv)) { _pszGroup = mir_strdup(dbv.pszVal); db_free(&dbv); } - // Clist DisplayName + // Clist DisplayName if (!DB::Setting::GetUString(_hContact, MOD_CLIST, SET_CONTACT_MYHANDLE, &dbv)) { _pszDisp = mir_strdup(dbv.pszVal); db_free(&dbv); @@ -156,7 +159,8 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) * param: row - the rows data * return: TRUE if successful or FALSE otherwise **/ -BYTE CExImContactBase::fromIni(LPSTR& row) + +BYTE CExImContactBase::fromIni(LPSTR &row) { LPSTR p1, p2 = nullptr; LPSTR pszUIDValue, pszUIDSetting, pszProto = nullptr; @@ -195,7 +199,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) _dbvUID.type = DBVT_DWORD; } else { - // DBVT_UTF8 + // DBVT_UTF8 _dbvUID.pszVal = mir_strdup(pszUIDValue); _dbvUID.type = DBVT_UTF8; } @@ -207,7 +211,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) // create valid nickname _pszNick = mir_strdup(pszBuf); - size_t i = mir_strlen(_pszNick)-1; + size_t i = mir_strlen(_pszNick) - 1; while (i > 0 && (_pszNick[i] == ' ' || _pszNick[i] == '\t')) { _pszNick[i] = 0; i--; @@ -225,6 +229,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) * param: hMetaContact - a meta contact to add this contact to * return: handle of the contact if successful **/ + MCONTACT CExImContactBase::toDB() { // create new contact if none exists @@ -272,19 +277,20 @@ MCONTACT CExImContactBase::toDB() * param: file - pointer to the opened file * return: nothing **/ -void CExImContactBase::toIni(FILE* file, int modCount) + +void CExImContactBase::toIni(FILE *file, int modCount) { // getting dbeditor++ NickFromHContact(hContact) static char name[512] = ""; - if (_hContact){ + if (_hContact) { int loaded = _pszUIDKey ? 1 : 0; if (_pszProto == nullptr || !loaded) { - if (_pszProto){ + if (_pszProto) { if (_pszNick) - mir_snprintf(name,"%s (%s)", _pszNick, _pszProto); + mir_snprintf(name, "%s (%s)", _pszNick, _pszProto); else - mir_snprintf(name,"(UNKNOWN) (%s)", _pszProto); + mir_snprintf(name, "(UNKNOWN) (%s)", _pszProto); } else strncpy_s(name, "(UNKNOWN)", _TRUNCATE); @@ -295,7 +301,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) ptrA pszUID(uid2String(FALSE)); if (_pszUIDKey && pszUID) mir_snprintf(name, "%S *(%s)*<%s>*{%s}*", pszCI.get(), _pszProto, _pszUIDKey, pszUID.get()); - else + else mir_snprintf(name, "%S (%s)", pszCI.get(), _pszProto); } @@ -315,46 +321,44 @@ BYTE CExImContactBase::compareUID(DBVARIANT *dbv) { DWORD hash = 0; switch (dbv->type) { - case DBVT_BYTE: - if (dbv->bVal == _dbvUID.bVal) { - _dbvUID.type = dbv->type; - return TRUE; - } - break; - case DBVT_WORD: - if (dbv->wVal == _dbvUID.wVal) { - _dbvUID.type = dbv->type; - return TRUE; - } - break; - case DBVT_DWORD: - if (dbv->dVal == _dbvUID.dVal) { - _dbvUID.type = dbv->type; - return TRUE; - } - break; - case DBVT_ASCIIZ: - hash = mir_hashstr(dbv->pszVal); - case DBVT_WCHAR: - if (!hash) hash = mir_hashstrW(dbv->pwszVal); - case DBVT_UTF8: - if (!hash) { - LPWSTR tmp = mir_utf8decodeW(dbv->pszVal); - hash = mir_hashstrW(tmp); - mir_free(tmp); - } - if (hash == _dbvUIDHash) - return TRUE; - break; - case DBVT_BLOB: //'n' cpbVal and pbVal are valid - if (_dbvUID.type == dbv->type && - _dbvUID.cpbVal == dbv->cpbVal && - memcmp(_dbvUID.pbVal, dbv->pbVal, dbv->cpbVal) == 0) { - return TRUE; - } - break; - default: - return FALSE; + case DBVT_BYTE: + if (dbv->bVal == _dbvUID.bVal) { + _dbvUID.type = dbv->type; + return TRUE; + } + break; + case DBVT_WORD: + if (dbv->wVal == _dbvUID.wVal) { + _dbvUID.type = dbv->type; + return TRUE; + } + break; + case DBVT_DWORD: + if (dbv->dVal == _dbvUID.dVal) { + _dbvUID.type = dbv->type; + return TRUE; + } + break; + case DBVT_ASCIIZ: + hash = mir_hashstr(dbv->pszVal); + case DBVT_WCHAR: + if (!hash) hash = mir_hashstrW(dbv->pwszVal); + case DBVT_UTF8: + if (!hash) { + LPWSTR tmp = mir_utf8decodeW(dbv->pszVal); + hash = mir_hashstrW(tmp); + mir_free(tmp); + } + if (hash == _dbvUIDHash) + return TRUE; + break; + case DBVT_BLOB: //'n' cpbVal and pbVal are valid + if (_dbvUID.type == dbv->type && + _dbvUID.cpbVal == dbv->cpbVal && + memcmp(_dbvUID.pbVal, dbv->pbVal, dbv->cpbVal) == 0) { + return TRUE; + } + break; } return FALSE; } @@ -367,79 +371,79 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) SIZE_T baselen; switch (_dbvUID.type) { - case DBVT_BYTE: //'b' bVal and cVal are valid - if (bPrependType) - *ptr++ = 'b'; - _itoa(_dbvUID.bVal, ptr, 10); - break; - case DBVT_WORD: //'w' wVal and sVal are valid - if (bPrependType) - *ptr++ = 'w'; - _itoa(_dbvUID.wVal, ptr, 10); - break; - case DBVT_DWORD: //'d' dVal and lVal are valid - if (bPrependType) - *ptr++ = 'd'; - _itoa(_dbvUID.dVal, ptr, 10); - break; - case DBVT_WCHAR: //'u' pwszVal is valid - r = mir_utf8encodeW(_dbvUID.pwszVal); - if (r == nullptr) - return nullptr; - if (bPrependType == FALSE) - return r; + case DBVT_BYTE: //'b' bVal and cVal are valid + if (bPrependType) + *ptr++ = 'b'; + _itoa(_dbvUID.bVal, ptr, 10); + break; + case DBVT_WORD: //'w' wVal and sVal are valid + if (bPrependType) + *ptr++ = 'w'; + _itoa(_dbvUID.wVal, ptr, 10); + break; + case DBVT_DWORD: //'d' dVal and lVal are valid + if (bPrependType) + *ptr++ = 'd'; + _itoa(_dbvUID.dVal, ptr, 10); + break; + case DBVT_WCHAR: //'u' pwszVal is valid + r = mir_utf8encodeW(_dbvUID.pwszVal); + if (r == nullptr) + return nullptr; + if (bPrependType == FALSE) + return r; + *ptr++ = 'u'; + mir_strncpy(ptr, r, sizeof(szUID) - 1); + mir_free(r); + break; + case DBVT_UTF8: //'u' pszVal is valid + if (bPrependType) *ptr++ = 'u'; - mir_strncpy(ptr, r, sizeof(szUID) - 1); - mir_free(r); - break; - case DBVT_UTF8: //'u' pszVal is valid - if (bPrependType) - *ptr++ = 'u'; - mir_strncpy(ptr, _dbvUID.pszVal, sizeof(szUID) - 1); - break; - case DBVT_ASCIIZ: - r = mir_utf8encode(_dbvUID.pszVal); + mir_strncpy(ptr, _dbvUID.pszVal, sizeof(szUID) - 1); + break; + case DBVT_ASCIIZ: + r = mir_utf8encode(_dbvUID.pszVal); + if (r == nullptr) + return nullptr; + if (bPrependType == FALSE) + return r; + *ptr++ = 's'; + mir_strncpy(ptr, r, sizeof(szUID) - 1); + mir_free(r); + break; + case DBVT_BLOB: //'n' cpbVal and pbVal are valid + if (bPrependType) { //True = XML + baselen = mir_base64_encode_bufsize(_dbvUID.cpbVal); + r = (LPSTR)mir_alloc((baselen + 8)); if (r == nullptr) return nullptr; - if (bPrependType == FALSE) - return r; - *ptr++ = 's'; - mir_strncpy(ptr, r, sizeof(szUID) - 1); - mir_free(r); - break; - case DBVT_BLOB: //'n' cpbVal and pbVal are valid - if (bPrependType) { //True = XML - baselen = mir_base64_encode_bufsize(_dbvUID.cpbVal); - r = (LPSTR)mir_alloc((baselen + 8)); - if (r == nullptr) - return nullptr; - memset((r + baselen), 0, 8); - ptr = r; - if (bPrependType) { // Allways true. - ptr[0] = 'n'; - ptr ++; - } - if (!mir_base64_encodebuf(_dbvUID.pbVal, _dbvUID.cpbVal, ptr, baselen)) { - mir_free(r); - return nullptr; - } - return r; + memset((r + baselen), 0, 8); + ptr = r; + if (bPrependType) { // Allways true. + ptr[0] = 'n'; + ptr++; } - else { //FALSE = INI - baselen = ((_dbvUID.cpbVal * 3) + 8); - r = (LPSTR)mir_alloc(baselen); - if (r == nullptr) - return nullptr; - memset(r, 0, baselen); - ptr = r; - for (SIZE_T j = 0; j < _dbvUID.cpbVal; j ++, ptr += 3) { - mir_snprintf(ptr, ((r + baselen) - ptr), "%02X ", (BYTE)_dbvUID.pbVal[j]); - } - return r; + if (!mir_base64_encodebuf(_dbvUID.pbVal, _dbvUID.cpbVal, ptr, baselen)) { + mir_free(r); + return nullptr; } - break; - default: - return nullptr; + return r; + } + else { //FALSE = INI + baselen = ((_dbvUID.cpbVal * 3) + 8); + r = (LPSTR)mir_alloc(baselen); + if (r == nullptr) + return nullptr; + memset(r, 0, baselen); + ptr = r; + for (SIZE_T j = 0; j < _dbvUID.cpbVal; j++, ptr += 3) { + mir_snprintf(ptr, ((r + baselen) - ptr), "%02X ", (BYTE)_dbvUID.pbVal[j]); + } + return r; + } + break; + default: + return nullptr; } return mir_strdup(szUID); } @@ -466,18 +470,18 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) // compare uids if (_pszUIDKey) { // get uid - if (DB::Setting::GetAsIs(hContact, pszProto,_pszUIDKey, &dbv)) + if (DB::Setting::GetAsIs(hContact, pszProto, _pszUIDKey, &dbv)) return FALSE; - isEqual = compareUID (&dbv); + isEqual = compareUID(&dbv); db_free(&dbv); } // compare nicknames if no UID else if (!DB::Setting::GetUString(hContact, _pszProto, SET_CONTACT_NICK, &dbv)) { - if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal,_pszNick)) { + if (dbv.type == DBVT_UTF8 && dbv.pszVal && !mir_strcmpi(dbv.pszVal, _pszNick)) { LPTSTR ptszNick = mir_utf8decodeW(_pszNick); LPTSTR ptszProto = mir_a2u(_pszProto); - int ans = MsgBox(nullptr, MB_ICONQUESTION|MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), + int ans = MsgBox(nullptr, MB_ICONQUESTION | MB_YESNO, LPGENW("Question"), LPGENW("contact identification"), LPGENW("The contact %s(%s) has no unique ID in the vCard,\nbut there is a contact in your contact list with the same nick and protocol.\nDo you wish to use this contact?"), ptszNick, ptszProto); MIR_FREE(ptszNick); @@ -497,6 +501,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) * param: none * return: handle if successful, INVALID_HANDLE_VALUE otherwise **/ + MCONTACT CExImContactBase::findHandle() { for (auto &hContact : Contacts()) { diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h index 122b35c6ef..b99e28d3b5 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h @@ -44,29 +44,29 @@ public: CExImContactBase();
~CExImContactBase();
- __inline DBVARIANT& uid() { return _dbvUID; }
+ __inline DBVARIANT &uid() { return _dbvUID; }
__inline MCONTACT handle() const { return _hContact; }
-
- __inline void disp(LPCSTR val) { _pszDisp = val ? mir_strdup(val): nullptr; }
- __inline void group(LPCSTR val) { _pszGroup = val ? mir_strdup(val): nullptr; }
- __inline void nick(LPCSTR val) { _pszNick = val ? mir_strdup(val): nullptr; }
- __inline void proto(LPCSTR val) { _pszProto = val ? mir_strdup(val): nullptr; }
- __inline void ampro(LPCSTR val) { _pszAMPro = val ? mir_strdup(val): nullptr; }
- __inline void uidk(LPCSTR val) { _pszUIDKey = val ? mir_strdup(val): nullptr; }
- __inline void uid(BYTE val) { _dbvUID.type = DBVT_BYTE; _dbvUID.bVal = val; }
- __inline void uid(WORD val) { _dbvUID.type = DBVT_WORD; _dbvUID.wVal = val; }
- __inline void uid(DWORD val) { _dbvUID.type = DBVT_DWORD; _dbvUID.dVal = val; }
- __inline void uidn(PBYTE val, DWORD len) { _dbvUID.type = DBVT_BLOB; _dbvUID.pbVal= val; _dbvUID.cpbVal = (WORD)len; }
+
+ __inline void disp(LPCSTR val) { _pszDisp = val ? mir_strdup(val) : nullptr; }
+ __inline void group(LPCSTR val) { _pszGroup = val ? mir_strdup(val) : nullptr; }
+ __inline void nick(LPCSTR val) { _pszNick = val ? mir_strdup(val) : nullptr; }
+ __inline void proto(LPCSTR val) { _pszProto = val ? mir_strdup(val) : nullptr; }
+ __inline void ampro(LPCSTR val) { _pszAMPro = val ? mir_strdup(val) : nullptr; }
+ __inline void uidk(LPCSTR val) { _pszUIDKey = val ? mir_strdup(val) : nullptr; }
+ __inline void uid(BYTE val) { _dbvUID.type = DBVT_BYTE; _dbvUID.bVal = val; }
+ __inline void uid(WORD val) { _dbvUID.type = DBVT_WORD; _dbvUID.wVal = val; }
+ __inline void uid(DWORD val) { _dbvUID.type = DBVT_DWORD; _dbvUID.dVal = val; }
+ __inline void uidn(PBYTE val, DWORD len) { _dbvUID.type = DBVT_BLOB; _dbvUID.pbVal = val; _dbvUID.cpbVal = (WORD)len; }
__inline void uida(LPCSTR val)
{
- _dbvUID.type = (_dbvUID.pszVal = mir_utf8decodeA(val))? DBVT_ASCIIZ : DBVT_DELETED;
- _dbvUIDHash = mir_hashstr(_dbvUID.pszVal);
+ _dbvUID.type = (_dbvUID.pszVal = mir_utf8decodeA(val)) ? DBVT_ASCIIZ : DBVT_DELETED;
+ _dbvUIDHash = mir_hashstr(_dbvUID.pszVal);
}
__inline void uidu(LPCSTR val)
{
- _dbvUID.type = (_dbvUID.pszVal = mir_strdup(val))? DBVT_UTF8 : DBVT_DELETED;
- LPWSTR temp = mir_utf8decodeW(val);
- _dbvUIDHash = mir_hashstrW(temp);
+ _dbvUID.type = (_dbvUID.pszVal = mir_strdup(val)) ? DBVT_UTF8 : DBVT_DELETED;
+ LPWSTR temp = mir_utf8decodeW(val);
+ _dbvUIDHash = mir_hashstrW(temp);
mir_free(temp);
}
@@ -76,10 +76,10 @@ public: LPSTR uid2String(BYTE bPrependType);
BYTE fromDB(MCONTACT hContact);
- BYTE fromIni(LPSTR& row);
+ BYTE fromIni(LPSTR &row);
MCONTACT toDB();
- void toIni(FILE* file, int modCount);
+ void toIni(FILE *file, int modCount);
- BYTE operator=(MCONTACT hContact) { return fromDB(hContact); }
+ BYTE operator=(MCONTACT hContact) { return fromDB(hContact); }
};
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 499878340a..735e2b71d3 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -84,7 +84,7 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey) char buf[MAXSETTING];
// convert to hash and make bsearch as it is much faster then working with strings
const DWORD dwHash = mir_hashstr(_strlwr(mir_strncpy(buf, pszKey, _countof(buf))));
- return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int(*)(const void*, const void*))SortProc) != nullptr;
+ return bsearch(&dwHash, dwCiHash, _countof(dwCiHash), sizeof(dwCiHash[0]), (int(*)(const void *, const void *))SortProc) != nullptr;
}
return FALSE;
}
@@ -102,7 +102,7 @@ BYTE CExImContactXML::IsContactInfo(LPCSTR pszKey) * return: pointer to the newly created TiXmlElement
**/
-TiXmlElement* CExImContactXML::CreateXmlElement()
+TiXmlElement *CExImContactXML::CreateXmlElement()
{
if (_hContact) {
if (_pszProto) {
@@ -143,7 +143,7 @@ TiXmlElement* CExImContactXML::CreateXmlElement() * return: ERROR_OK on success or any other on failure
**/
-int CExImContactXML::ExportContact(DB::CEnumList* pModules)
+int CExImContactXML::ExportContact(DB::CEnumList *pModules)
{
if (_pXmlFile->_wExport & EXPORT_DATA) {
if (pModules) {
@@ -171,7 +171,7 @@ int CExImContactXML::ExportContact(DB::CEnumList* pModules) * return: ERROR_OK on success or any other on failure
**/
-int CExImContactXML::ExportSubContact(CExImContactXML *vMetaContact, DB::CEnumList* pModules)
+int CExImContactXML::ExportSubContact(CExImContactXML *vMetaContact, DB::CEnumList *pModules)
{
// create xmlNode
if (!CreateXmlElement())
@@ -193,7 +193,7 @@ int CExImContactXML::ExportSubContact(CExImContactXML *vMetaContact, DB::CEnumLi * return: ERROR_OK on success or any other on failure
**/
-int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules)
+int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList *pModules)
{
if (!xmlfile)
return ERROR_INVALID_PARAMS;
@@ -286,7 +286,7 @@ int CExImContactXML::ExportModule(LPCSTR pszModule) int CExImContactXML::ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LPCSTR pszSetting)
{
TiXmlElement *xmlEntry = nullptr;
- TiXmlText *xmlValue = nullptr;
+ TiXmlText *xmlValue = nullptr;
CHAR buf[32];
LPSTR str = nullptr;
@@ -411,7 +411,7 @@ BYTE CExImContactXML::ExportEvents() TiXmlElement *xmlModule = nullptr;
for (auto *it : TiXmlEnum(xmlModule))
if (!mir_strcmpi(it->Attribute("key"), dbei.szModule)) {
- xmlModule = (TiXmlElement*)it;
+ xmlModule = (TiXmlElement *)it;
break;
}
@@ -436,12 +436,12 @@ BYTE CExImContactXML::ExportEvents() * importing stuff
***********************************************************************************************************/
-/**
-* name: CountKeys
-* desc: Counts the number of events and settings stored for a contact
-* params: xmlContact - the contact, who is the owner of the keys to count
-* return: nothing
-**/
+ /**
+ * name: CountKeys
+ * desc: Counts the number of events and settings stored for a contact
+ * params: xmlContact - the contact, who is the owner of the keys to count
+ * return: nothing
+ **/
void CExImContactXML::CountKeys(DWORD &numSettings, DWORD &numEvents)
{
@@ -684,8 +684,7 @@ int CExImContactXML::Import(BYTE keepMetaSubContact) return ERROR_ABORTED;
_pXmlFile->_numContactsDone++;
}
- }
- while (xContact = xContact->NextSiblingElement("CONTACT"));
+ } while (xContact = xContact->NextSiblingElement("CONTACT"));
}
// load metacontact information (after subcontact for faster import)
return ImportContact();
@@ -712,7 +711,7 @@ int CExImContactXML::Import(BYTE keepMetaSubContact) * return:
**/
-int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact)
+int CExImContactXML::ImportMetaSubContact(CExImContactXML *pMetaContact)
{
// abort here if contact was not imported correctly
int err = ImportContact();
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.h b/plugins/UserInfoEx/src/ex_import/classExImContactXML.h index 72a98ad869..7ac1c98946 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.h @@ -28,28 +28,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define XKEY_CONTACT "CONTACT"
#define XKEY_OWNER "OWNER"
-enum EError {
- ERROR_OK = 0,
- ERROR_NOT_ADDED = 1,
- ERROR_INVALID_PARAMS = 2,
- ERROR_INVALID_VALUE = 3,
- ERROR_INVALID_TIMESTAMP = 4,
- ERROR_INVALID_TYPE = 5,
- ERROR_DUPLICATED = 6,
- ERROR_MEMORY_ALLOC = 7,
- ERROR_INVALID_CONTACT = 8,
- ERROR_INVALID_SIGNATURE = 9,
- ERROR_ABORTED = 10,
- ERROR_CONVERT_METACONTACT = 11,
- ERROR_ADDTO_METACONTACT = 12,
- ERROR_EMPTY_MODULE = 13
+enum EError
+{
+ ERROR_OK = 0,
+ ERROR_NOT_ADDED = 1,
+ ERROR_INVALID_PARAMS = 2,
+ ERROR_INVALID_VALUE = 3,
+ ERROR_INVALID_TIMESTAMP = 4,
+ ERROR_INVALID_TYPE = 5,
+ ERROR_DUPLICATED = 6,
+ ERROR_MEMORY_ALLOC = 7,
+ ERROR_INVALID_CONTACT = 8,
+ ERROR_INVALID_SIGNATURE = 9,
+ ERROR_ABORTED = 10,
+ ERROR_CONVERT_METACONTACT = 11,
+ ERROR_ADDTO_METACONTACT = 12,
+ ERROR_EMPTY_MODULE = 13
};
class CExImContactXML : public CExImContactBase
{
CFileXml *_pXmlFile; // the xmlfile
TiXmlDocument _xmlDoc; // whole document in memory
- union {
+ union
+ {
TiXmlElement *_xmlWriter; // xml node being prepared for export
const TiXmlElement *_xmlReader; // xml node being used for import
};
@@ -64,7 +66,7 @@ class CExImContactXML : public CExImContactBase int ImportEvent(LPCSTR pszModule, const TiXmlElement *xmlEvent);
int ImportContact();
int ImportNormalContact();
- int ImportMetaSubContact(CExImContactXML * pMetaContact);
+ int ImportMetaSubContact(CExImContactXML *pMetaContact);
void CountKeys(DWORD &numSettings, DWORD &numEvents);
// private exporting methods
@@ -72,15 +74,15 @@ class CExImContactXML : public CExImContactBase int ExportSetting(TiXmlElement *xmlModule, LPCSTR pszModule, LPCSTR pszSetting);
BYTE ExportEvents();
- int ExportContact(DB::CEnumList* pModules);
- int ExportSubContact(CExImContactXML *vMetaContact, DB::CEnumList* pModules);
+ int ExportContact(DB::CEnumList *pModules);
+ int ExportSubContact(CExImContactXML *vMetaContact, DB::CEnumList *pModules);
public:
- CExImContactXML(CFileXml * pXmlFile);
+ CExImContactXML(CFileXml *pXmlFile);
// exporting stuff
- TiXmlElement* CreateXmlElement();
- int Export(FILE *xmlfile, DB::CEnumList* pModules);
+ TiXmlElement *CreateXmlElement();
+ int Export(FILE *xmlfile, DB::CEnumList *pModules);
// importing stuff
int LoadXmlElement(const TiXmlElement *xContact);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 99e53ade98..945d404c2b 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct
{
lpExImParam ExImContact;
- DB::CEnumList* pModules;
+ DB::CEnumList *pModules;
} EXPORTDATA, *LPEXPORTDATA;
/***********************************************************************************************************
@@ -43,7 +43,8 @@ typedef struct * pModules - module list to fill
* return: nothing
**/
-void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* pModules)
+
+void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList *pModules)
{
TVITEMA tvi;
@@ -58,17 +59,12 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p tvi.cchTextMax = _countof(szModule);
do {
- if (
- SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi) &&
- (
- tvi.state == INDEXTOSTATEIMAGEMASK(0) ||
- tvi.state == INDEXTOSTATEIMAGEMASK(2)
- )
- ) {
+ if (SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi) &&
+ (tvi.state == INDEXTOSTATEIMAGEMASK(0) || tvi.state == INDEXTOSTATEIMAGEMASK(2))) {
pModules->Insert(tvi.pszText);
}
}
- while (tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem));
+ while (tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem));
}
}
@@ -80,6 +76,7 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p * pszText - text to match the label against
* return: a handle to the found treeitem or NULL
**/
+
HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText)
{
TVITEMA tvi;
@@ -110,6 +107,7 @@ HTREEITEM ExportTree_FindItem(HWND hTree, HTREEITEM hParent, LPSTR pszText) * bState - 0-hide checkbox/1-unchecked/2-checked
* return: return handle to added treeitem
**/
+
HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE bUseImages, BYTE bState)
{
TVINSERTSTRUCTA tvii;
@@ -137,6 +135,7 @@ HTREEITEM ExportTree_AddItem(HWND hTree, HTREEITEM hParent, LPSTR pszDesc, BYTE * lParam - message specific parameter
* return: message specific
**/
+
INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LPEXPORTDATA pDat = (LPEXPORTDATA)GetUserData(hDlg);
@@ -207,7 +206,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar name = (LPCTSTR)pDat->ExImContact->ptszName;
break;
case EXIM_ACCOUNT:
- PROTOACCOUNT* acc = Proto_GetAccount(pDat->ExImContact->pszName);
+ PROTOACCOUNT *acc = Proto_GetAccount(pDat->ExImContact->pszName);
name = (LPCTSTR)acc->tszAccountName;
break;
}
@@ -408,10 +407,10 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar * hParent - handle to a window which should act as the parent of the created dialog
* return: 0 if user pressed ok, 1 on cancel
**/
-int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList* pModules, HWND hParent)
+
+int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList *pModules, HWND hParent)
{
EXPORTDATA dat;
-
dat.ExImContact = ExImContact;
dat.pModules = pModules;
return (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXPORT), hParent, SelectModulesToExport_DlgProc, (LPARAM)&dat));
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.h b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.h index 1127e4a87a..00192a669f 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.h +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.h @@ -22,6 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _DLG_EXIMMODULES_H_
#define _DLG_EXIMMODULES_H_
-int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList* pModules, HWND hParent);
+int DlgExImModules_SelectModulesToExport(lpExImParam ExImContact, DB::CEnumList *pModules, HWND hParent);
#endif /* _DLG_EXIMMODULES_H_ */
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index b38f2a54d7..11e97c3862 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * @param nothing
* @return nothing
**/
+
static void InitAlteredPlacesBar()
{
HKEY hkMiranda;
@@ -39,8 +40,7 @@ static void InitAlteredPlacesBar() // create or open temporary hive for miranda specific places
result = RegCreateKey(HKEY_CURRENT_USER, HKEY_MIRANDA_PLACESBAR, &hkMiranda);
- if (SUCCEEDED(result))
- {
+ if (SUCCEEDED(result)) {
HKEY hkPlacesBar;
// map the current users registry
@@ -48,8 +48,7 @@ static void InitAlteredPlacesBar() // open the policy key
result = RegCreateKey(HKEY_CURRENT_USER, HKEY_WINPOL_PLACESBAR, &hkPlacesBar);
// install the places bar
- if (SUCCEEDED(result))
- {
+ if (SUCCEEDED(result)) {
DWORD dwFolderID;
LPSTR p;
CHAR szMirandaPath[MAX_PATH];
@@ -63,14 +62,11 @@ static void InitAlteredPlacesBar() // Miranda's installation path
GetModuleFileNameA(GetModuleHandleA("mir_app.mir"), szMirandaPath, _countof(szMirandaPath));
p = mir_strrchr(szMirandaPath, '\\');
- if (p)
- {
+ if (p)
RegSetValueExA(hkPlacesBar, "Place3", 0, REG_SZ, (PBYTE)szMirandaPath, (p - szMirandaPath) + 1);
- }
// Miranda's profile path
- if (!Profile_GetPathA(_countof(szProfilePath), szProfilePath))
- {
+ if (!Profile_GetPathA(_countof(szProfilePath), szProfilePath)) {
// only add if different from profile path
RegSetValueExA(hkPlacesBar, "Place4", 0, REG_SZ, (PBYTE)szProfilePath, (DWORD)mir_strlen(szProfilePath) + 1);
}
@@ -88,6 +84,7 @@ static void InitAlteredPlacesBar() * params: nothing
* return: nothing
**/
+
static void ResetAlteredPlaceBars()
{
RegOverridePredefKey(HKEY_CURRENT_USER, nullptr);
@@ -102,6 +99,7 @@ static void ResetAlteredPlaceBars() * lParam - message dependend parameter
* return: depends on message
**/
+
static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == TB_ADDBUTTONS) {
@@ -133,7 +131,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara // profile button
case 41064:
// set button text
- iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM) TranslateT("Profile"));
+ iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)TranslateT("Profile"));
if (iString != -1) tbb->iString = iString;
// set tooltip
@@ -154,7 +152,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara }
}
}
- return mir_callNextSubclass(hWnd, PlacesBarSubclassProc, uMsg, wParam,lParam);
+ return mir_callNextSubclass(hWnd, PlacesBarSubclassProc, uMsg, wParam, lParam);
}
/**
@@ -166,6 +164,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara * lParam - message dependend parameter
* return: depends on message
**/
+
static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
{
switch (uMsg) {
@@ -190,23 +189,22 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM, LP return FALSE;
}
-
-
/**
* name: GetInitialDir
* desc: read the last vCard directory from database
* pszInitialDir - buffer to store the initial dir to (size must be MAX_PATH)
* return: nothing
**/
-static void GetInitialDir(LPSTR pszInitialDir)
+
+static void GetInitialDir(wchar_t *pszInitialDir)
{
- char szRelative[MAX_PATH];
+ wchar_t szRelative[MAX_PATH]; szRelative[0] = 0;
- szRelative[0] = 0;
// is some standard path defined
- if (!db_get_static(0, MODULENAME, "vCardPath", szRelative, _countof(szRelative))) {
- if (!PathToAbsolute(szRelative, pszInitialDir))
- mir_strcpy(pszInitialDir, szRelative);
+ CMStringW wszPath(g_plugin.getMStringW("vCardPath"));
+ if (!wszPath.IsEmpty()) {
+ if (!PathToAbsoluteW(szRelative, pszInitialDir))
+ mir_wstrcpy(pszInitialDir, szRelative);
}
else *pszInitialDir = 0;
}
@@ -217,19 +215,19 @@ static void GetInitialDir(LPSTR pszInitialDir) * pszInitialDir - buffer to store the initial dir to (size must be MAX_PATH)
* return: nothing
**/
-static void SaveInitialDir(LPSTR pszInitialDir)
-{
- CHAR szRelative[MAX_PATH];
- LPSTR p;
- if (p = mir_strrchr(pszInitialDir, '\\')) {
+static void SaveInitialDir(wchar_t *pszInitialDir)
+{
+ if (wchar_t *p = wcsrchr(pszInitialDir, '\\')) {
*p = 0;
- if ( PathToRelative(pszInitialDir, szRelative))
- g_plugin.setString("vCardPath", szRelative);
+
+ wchar_t szRelative[MAX_PATH];
+ if (PathToRelativeW(pszInitialDir, szRelative))
+ g_plugin.setWString("vCardPath", szRelative);
else
- g_plugin.setString("vCardPath", pszInitialDir);
+ g_plugin.setWString("vCardPath", pszInitialDir);
*p = '\\';
- }
+ }
}
/**
@@ -243,25 +241,25 @@ static void SaveInitialDir(LPSTR pszInitialDir) * pszFile - this is the buffer to store the file to (size must be MAX_PATH)
* return: nothing
**/
-static void InitOpenFileNameStruct(OPENFILENAMEA *pofn, HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszInitialDir, LPSTR pszFile)
+
+static void InitOpenFileNameStruct(OPENFILENAME *pofn, HWND hWndParent, const wchar_t *pszTitle, const wchar_t *pszFilter, wchar_t *pszInitialDir, wchar_t *pszFile)
{
memset(pofn, 0, sizeof(OPENFILENAME));
- pofn->hwndOwner = hWndParent;
- pofn->lpstrTitle = pszTitle;
- pofn->lpstrFilter = pszFilter;
- pofn->lpstrFile = pszFile;
- pofn->nMaxFile = MAX_PATH;
- pofn->lpstrDefExt = "xml";
+ pofn->hwndOwner = hWndParent;
+ pofn->lpstrTitle = pszTitle;
+ pofn->lpstrFilter = pszFilter;
+ pofn->lpstrFile = pszFile;
+ pofn->nMaxFile = MAX_PATH;
+ pofn->lpstrDefExt = L"xml";
GetInitialDir(pszInitialDir);
pofn->lpstrInitialDir = pszInitialDir;
- pofn->lStructSize = sizeof (OPENFILENAME);
- pofn->Flags = OFN_NONETWORKBUTTON|OFN_ENABLESIZING|OFN_ENABLEHOOK|OFN_EXPLORER;
+ pofn->lStructSize = sizeof(OPENFILENAME);
+ pofn->Flags = OFN_NONETWORKBUTTON | OFN_ENABLESIZING | OFN_ENABLEHOOK | OFN_EXPLORER;
pofn->lpfnHook = OpenSaveFileDialogHook;
}
-
/**
* name: DlgExIm_OpenFileName
* desc: displayes a slightly modified OpenFileName DialogBox
@@ -271,14 +269,15 @@ static void InitOpenFileNameStruct(OPENFILENAMEA *pofn, HWND hWndParent, LPCSTR * pszFile - this is the buffer to store the file to (size must be MAX_PATH)
* return: -1 on error/abort or filter index otherwise
**/
-int DlgExIm_OpenFileName(HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszFile)
+
+int DlgExIm_OpenFileName(HWND hWndParent, const wchar_t *pszTitle, const wchar_t *pszFilter, wchar_t *pszFile)
{
- OPENFILENAMEA ofn;
- CHAR szInitialDir[MAX_PATH];
+ OPENFILENAMEW ofn;
+ wchar_t szInitialDir[MAX_PATH];
InitOpenFileNameStruct(&ofn, hWndParent, pszTitle, pszFilter, szInitialDir, pszFile);
ofn.Flags |= OFN_PATHMUSTEXIST;
- if (!GetOpenFileNameA(&ofn)) {
+ if (!GetOpenFileNameW(&ofn)) {
DWORD dwError = CommDlgExtendedError();
if (dwError) MsgErr(ofn.hwndOwner, LPGENW("The OpenFileDialog returned an error: %d!"), dwError);
return -1;
@@ -296,18 +295,18 @@ int DlgExIm_OpenFileName(HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPS * pszFile - this is the buffer to store the file to (size must be MAX_PATH)
* return: -1 on error/abort or filter index otherwise
**/
-int DlgExIm_SaveFileName(HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszFile)
-{
- OPENFILENAMEA ofn;
- CHAR szInitialDir[MAX_PATH];
+int DlgExIm_SaveFileName(HWND hWndParent, const wchar_t *pszTitle, const wchar_t *pszFilter, wchar_t *pszFile)
+{
+ OPENFILENAMEW ofn;
+ wchar_t szInitialDir[MAX_PATH];
InitOpenFileNameStruct(&ofn, hWndParent, pszTitle, pszFilter, szInitialDir, pszFile);
ofn.Flags |= OFN_OVERWRITEPROMPT;
- if (!GetSaveFileNameA(&ofn)) {
+ if (!GetSaveFileNameW(&ofn)) {
DWORD dwError = CommDlgExtendedError();
-
- if (dwError) MsgErr(ofn.hwndOwner, LPGENW("The SaveFileDialog returned an error: %d!"), dwError);
+ if (dwError)
+ MsgErr(ofn.hwndOwner, LPGENW("The SaveFileDialog returned an error: %d!"), dwError);
return -1;
}
SaveInitialDir(pszFile);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.h b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.h index f2d7d0a34e..63b7843c05 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.h +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once
-int DlgExIm_OpenFileName(HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszFile);
-int DlgExIm_SaveFileName(HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszFile);
+int DlgExIm_OpenFileName(HWND hWndParent, const wchar_t *pszTitle, const wchar_t *pszFilter, wchar_t *pszFile);
+int DlgExIm_SaveFileName(HWND hWndParent, const wchar_t *pszTitle, const wchar_t *pszFilter, wchar_t *pszFile);
#endif /* _DLG_EXIMOPENSAVEFFILE_H_ */
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp index 3535f8d261..6b25adda9a 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.cpp @@ -31,50 +31,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * params: none
* return: nothing
**/
+
+static const ICONCTRL idIcon[] = {
+ { IDI_IMPORT, WM_SETICON, NULL },
+ { IDI_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
+ { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL }
+};
+
INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- const ICONCTRL idIcon[] = {
- { IDI_IMPORT, WM_SETICON, NULL },
- { IDI_IMPORT, STM_SETIMAGE, ICO_DLGLOGO },
- { IDI_BTN_CLOSE, BM_SETIMAGE, IDCANCEL }
- };
- const int numIconsToSet = g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2;
- IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
-
- TranslateDialogDefault(hDlg);
- SendDlgItemMessage(hDlg, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
- SendDlgItemMessage(hDlg, IDC_PROGRESS, PBM_SETPOS, 0, 0);
- SendDlgItemMessage(hDlg, IDC_PROGRESS2, PBM_SETPOS, 0, 0);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
- UpdateWindow(hDlg);
- break;
+ switch (msg) {
+ case WM_INITDIALOG:
+ IcoLib_SetCtrlIcons(hDlg, idIcon, g_plugin.getByte(SET_ICONS_BUTTONS, 1) ? _countof(idIcon) : 2);
+
+ TranslateDialogDefault(hDlg);
+ SendDlgItemMessage(hDlg, IDCANCEL, BUTTONTRANSLATE, NULL, NULL);
+ SendDlgItemMessage(hDlg, IDC_PROGRESS, PBM_SETPOS, 0, 0);
+ SendDlgItemMessage(hDlg, IDC_PROGRESS2, PBM_SETPOS, 0, 0);
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ UpdateWindow(hDlg);
+ break;
+
+ case WM_CTLCOLORSTATIC:
+ switch (GetWindowLongPtr((HWND)lParam, GWLP_ID)) {
+ case STATIC_WHITERECT:
+ case TXT_SETTING:
+ case IDC_PROGRESS:
+ case TXT_CONTACT:
+ case IDC_PROGRESS2:
+ SetBkColor((HDC)wParam, RGB(255, 255, 255));
+ return (INT_PTR)GetStockObject(WHITE_BRUSH);
}
- case WM_CTLCOLORSTATIC:
- switch (GetWindowLongPtr((HWND)lParam, GWLP_ID)) {
- case STATIC_WHITERECT:
- case TXT_SETTING:
- case IDC_PROGRESS:
- case TXT_CONTACT:
- case IDC_PROGRESS2:
- SetBkColor((HDC)wParam, RGB(255, 255, 255));
- return (INT_PTR)GetStockObject(WHITE_BRUSH);
+ return FALSE;
+
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ // in the progress dialog, use the user data to indicate that the user has pressed cancel
+ ShowWindow(hDlg, SW_HIDE);
+ SetWindowLongPtr(hDlg, GWLP_USERDATA, 1);
+ return TRUE;
}
- return FALSE;
- case WM_COMMAND:
- if (HIWORD(wParam) == BN_CLICKED) {
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- // in the progress dialog, use the user data to indicate that the user has pressed cancel
- ShowWindow(hDlg, SW_HIDE);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 1);
- return TRUE;
- }
- }
- break;
+ }
+ break;
}
return FALSE;
}
@@ -86,6 +86,7 @@ INT_PTR CALLBACK DlgProcProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar * params: none
* return: nothing
**/
+
CProgress::CProgress()
{
_dwStartTime = GetTickCount();
@@ -99,6 +100,7 @@ CProgress::CProgress() * params: none
* return: nothing
**/
+
CProgress::~CProgress()
{
if (IsWindow(_hDlg)) DestroyWindow(_hDlg);
@@ -111,12 +113,13 @@ CProgress::~CProgress() * params: numContacts - the number of contacts
* return: nothing
**/
+
void CProgress::SetContactCount(DWORD numContacts)
{
if (_hDlg) {
HWND hProgress = GetDlgItem(_hDlg, IDC_PROGRESS2);
- SendMessage(hProgress, PBM_SETRANGE32, 0, numContacts);
- SendMessage(hProgress, PBM_SETPOS, 0, 0);
+ SendMessage(hProgress, PBM_SETRANGE32, 0, numContacts);
+ SendMessage(hProgress, PBM_SETPOS, 0, 0);
}
}
@@ -127,12 +130,13 @@ void CProgress::SetContactCount(DWORD numContacts) * params: numSettings - the number of settings & events
* return: nothing
**/
+
void CProgress::SetSettingsCount(DWORD numSettings)
{
if (_hDlg) {
HWND hProgress = GetDlgItem(_hDlg, IDC_PROGRESS);
- SendMessage(hProgress, PBM_SETRANGE32, 0, numSettings);
- SendMessage(hProgress, PBM_SETPOS, 0, 0);
+ SendMessage(hProgress, PBM_SETRANGE32, 0, numSettings);
+ SendMessage(hProgress, PBM_SETPOS, 0, 0);
}
}
@@ -143,6 +147,7 @@ void CProgress::SetSettingsCount(DWORD numSettings) * params: none
* return: nothing
**/
+
void CProgress::Hide()
{
ShowWindow(_hDlg, SW_HIDE);
@@ -155,10 +160,11 @@ void CProgress::Hide() * params: nothing
* return: FALSE if user pressed cancel, TRUE otherwise
**/
+
BYTE CProgress::Update()
{
MSG msg;
-
+
// show dialog after one second
if (GetTickCount() > _dwStartTime + 1000) {
ShowWindow(_hDlg, SW_SHOW);
@@ -167,10 +173,10 @@ BYTE CProgress::Update() UpdateWindow(_hDlg);
while (PeekMessage(&msg, _hDlg, 0, 0, PM_REMOVE) != 0) {
- if (_hDlg == nullptr || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */
+ if (_hDlg == nullptr || !IsDialogMessage(_hDlg, &msg)) { /* Wine fix. */
TranslateMessage(&msg);
DispatchMessage(&msg);
- }
+ }
}
return GetWindowLongPtr(_hDlg, GWLP_USERDATA) == 0;
}
@@ -182,6 +188,7 @@ BYTE CProgress::Update() * params: pszFormat - the text to display for the contact
* return: FALSE if user pressed cancel, TRUE otherwise
**/
+
BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...)
{
if (_hDlg != nullptr) {
@@ -193,9 +200,9 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) va_start(vl, pszFormat);
mir_vsnwprintf(buf, _countof(buf), TranslateW(pszFormat), vl);
va_end(vl);
- SetDlgItemText(_hDlg, TXT_CONTACT, buf);
+ SetDlgItemText(_hDlg, TXT_CONTACT, buf);
}
- SendMessage(hProg, PBM_SETPOS, (int)SendMessage(hProg, PBM_GETPOS, 0, 0) + 1, 0);
+ SendMessage(hProg, PBM_SETPOS, (int)SendMessage(hProg, PBM_GETPOS, 0, 0) + 1, 0);
return Update();
}
return TRUE;
@@ -208,6 +215,7 @@ BYTE CProgress::UpdateContact(LPCTSTR pszFormat, ...) * params: pszFormat - the text to display for the setting
* return: FALSE if user pressed cancel, TRUE otherwise
**/
+
BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...)
{
if (_hDlg != nullptr) {
@@ -221,7 +229,7 @@ BYTE CProgress::UpdateSetting(LPCTSTR pszFormat, ...) mir_vsnwprintf(buf, _countof(buf), TranslateW(pszFormat), vl);
va_end(vl);
GetDlgItemText(_hDlg, TXT_SETTING, tmp, _countof(tmp));
- if (mir_wstrcmpi(tmp,buf))
+ if (mir_wstrcmpi(tmp, buf))
SetDlgItemText(_hDlg, TXT_SETTING, buf);
}
SendMessage(hProg, PBM_SETPOS, (int)SendMessage(hProg, PBM_GETPOS, 0, 0) + 1, 0);
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.h b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.h index d542d23754..fe4bc542b2 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.h +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImProgress.h @@ -39,7 +39,7 @@ public: void SetContactCount(DWORD numContacts);
void SetSettingsCount(DWORD numSettings);
-
+
BYTE UpdateContact(LPCTSTR pszFormat, ...);
BYTE UpdateSetting(LPCTSTR pszFormat, ...);
};
diff --git a/plugins/UserInfoEx/src/ex_import/mir_rfcCodecs.h b/plugins/UserInfoEx/src/ex_import/mir_rfcCodecs.h index fec2911bec..644cb55e0f 100644 --- a/plugins/UserInfoEx/src/ex_import/mir_rfcCodecs.h +++ b/plugins/UserInfoEx/src/ex_import/mir_rfcCodecs.h @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //NOTE: For BASE64 and UUENCODE, this actually
//represents the amount of unencoded characters
//per line
+
#define TSSMTPMAX_QP_LINE_LENGTH 76
#define TSSMTPMAX_BASE64_LINE_LENGTH 57
#define TSSMTPMAX_UUENCODE_LINE_LENGTH 45
@@ -48,19 +49,18 @@ inline INT_PTR QPDecodeGetRequiredLength(INT_PTR nSrcLen) return nSrcLen;
}
-inline BOOL QPEncode(BYTE* pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR* pnDestLen, BYTE *bEncoded, DWORD dwFlags = 0)
+inline BOOL QPEncode(BYTE *pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR *pnDestLen, BYTE *bEncoded, DWORD dwFlags = 0)
{
//The hexadecimal character set
- static const CHAR s_chHexChars[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- 'A', 'B', 'C', 'D', 'E', 'F'};
+ static const CHAR s_chHexChars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F' };
INT_PTR nRead = 0, nWritten = 0, nLineLen = 0;
CHAR ch;
BYTE bChanged = FALSE;
- if (!pbSrcData || !szDest || !pnDestLen) {
+ if (!pbSrcData || !szDest || !pnDestLen)
return FALSE;
- }
while (nRead < nSrcLen) {
ch = *pbSrcData++;
@@ -77,19 +77,19 @@ inline BOOL QPEncode(BYTE* pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR* pn nLineLen++;
}
else
- if ((ch == ' ' || ch == '\t') && (nLineLen < (TSSMTPMAX_QP_LINE_LENGTH - 12))) {
- *szDest++ = ch;
- nWritten++;
- nLineLen++;
- }
- else {
- *szDest++ = '=';
- *szDest++ = s_chHexChars[(ch >> 4) & 0x0F];
- *szDest++ = s_chHexChars[ch & 0x0F];
- nWritten += 3;
- nLineLen += 3;
- bChanged = TRUE;
- }
+ if ((ch == ' ' || ch == '\t') && (nLineLen < (TSSMTPMAX_QP_LINE_LENGTH - 12))) {
+ *szDest++ = ch;
+ nWritten++;
+ nLineLen++;
+ }
+ else {
+ *szDest++ = '=';
+ *szDest++ = s_chHexChars[(ch >> 4) & 0x0F];
+ *szDest++ = s_chHexChars[ch & 0x0F];
+ nWritten += 3;
+ nLineLen += 3;
+ bChanged = TRUE;
+ }
if (nLineLen >= (TSSMTPMAX_QP_LINE_LENGTH - 11)) {
*szDest++ = '=';
*szDest++ = '\r';
@@ -111,39 +111,34 @@ inline BOOL QPEncode(BYTE* pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR* pn return TRUE;
}
-
-inline BOOL QPDecode(BYTE* pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR* pnDestLen, DWORD dwFlags = 0)
+inline BOOL QPDecode(BYTE *pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR *pnDestLen, DWORD dwFlags = 0)
{
- if (!pbSrcData || !szDest || !pnDestLen)
- {
+ if (!pbSrcData || !szDest || !pnDestLen) {
return FALSE;
}
INT_PTR nRead = 0, nWritten = 0, nLineLen = -1;
char ch;
- while (nRead <= nSrcLen)
- {
+ while (nRead <= nSrcLen) {
ch = *pbSrcData++;
nRead++;
nLineLen++;
- if (ch == '=')
- {
- //if the next character is a digit or a character, convert
- if (nRead < nSrcLen && (isdigit(*pbSrcData) || isalpha(*pbSrcData)))
- {
+ if (ch == '=') {
+ // if the next character is a digit or a character, convert
+ if (nRead < nSrcLen && (isdigit(*pbSrcData) || isalpha(*pbSrcData))) {
char szBuf[5];
szBuf[0] = *pbSrcData++;
szBuf[1] = *pbSrcData++;
szBuf[2] = '\0';
- char* tmp = '\0';
+ char *tmp = '\0';
*szDest++ = (BYTE)strtoul(szBuf, &tmp, 16);
nWritten++;
nRead += 2;
continue;
}
- //if the next character is a carriage return or line break, eat it
- if (nRead < nSrcLen && *pbSrcData == '\r' && (nRead+1 < nSrcLen) && *(pbSrcData+1)=='\n')
- {
+
+ // if the next character is a carriage return or line break, eat it
+ if (nRead < nSrcLen && *pbSrcData == '\r' && (nRead + 1 < nSrcLen) && *(pbSrcData + 1) == '\n') {
pbSrcData++;
nRead++;
nLineLen = -1;
@@ -151,19 +146,17 @@ inline BOOL QPDecode(BYTE* pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR* pn }
return FALSE;
}
- if (ch == '\r' || ch == '\n')
- {
+ if (ch == '\r' || ch == '\n') {
nLineLen = -1;
continue;
}
- if ((dwFlags & TSSMTPQPENCODE_DOT) && ch == '.' && nLineLen == 0)
- {
+ if ((dwFlags & TSSMTPQPENCODE_DOT) && ch == '.' && nLineLen == 0) {
continue;
}
*szDest++ = ch;
nWritten++;
}
- *pnDestLen = nWritten-1;
+ *pnDestLen = nWritten - 1;
return TRUE;
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index 8be503a6db..dc826a7139 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -37,7 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * file - file to write the settings to * return nothing **/ -static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE* file) + +static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE *file) { DB::CEnumList Settings; @@ -75,7 +76,7 @@ static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE* file) *here = 3; } } - + if (dbv.type == DBVT_UTF8) fprintf(file, "%s=u%s\n", it, dbv.pszVal); else @@ -102,13 +103,14 @@ static void ExportModule(MCONTACT hContact, LPCSTR pszModule, FILE* file) * pModules - module to export, NULL to export all modules of a contact * file - ini file to write the contact to **/ -static BYTE ExportContact(MCONTACT hContact, DB::CEnumList* pModules, FILE* file) + +static BYTE ExportContact(MCONTACT hContact, DB::CEnumList *pModules, FILE *file) { CExImContactBase vcc; if (pModules) { if ((vcc = hContact) >= NULL) { - vcc.toIni(file, pModules->getCount()-1); + vcc.toIni(file, pModules->getCount() - 1); for (auto &it : *pModules) ExportModule(hContact, it, file); @@ -125,51 +127,43 @@ static BYTE ExportContact(MCONTACT hContact, DB::CEnumList* pModules, FILE* file * param: hContact - contact to export or -1 to export all contacts * pszFileName - ini-filename to write the contact to **/ -int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) + +int SvcExImINI_Export(lpExImParam ExImContact, const wchar_t *pszFileName) { DB::CEnumList Modules; - if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) - { + if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) { FILE *file; - errno_t err = fopen_s(&file, pszFileName, "wt"); - if (err != NULL) - { - MsgErr(nullptr, + errno_t err = _wfopen_s(&file, pszFileName, L"wt"); + if (err != NULL) { + MsgErr(nullptr, LPGENW("The ini-file \"%s\"\nfor saving contact information could not be opened."), pszFileName); return 1; } - + SetCursor(LoadCursor(nullptr, IDC_WAIT)); // write header SYSTEMTIME now; GetLocalTime(&now); - fprintf(file, ";DATE = %04d-%02d-%02d %02d:%02d:%02d\n\n", - now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond); + fprintf(file, ";DATE = %04d-%02d-%02d %02d:%02d:%02d\n\n", now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond); if (Modules.getCount() == 0) - { Modules.EnumModules(); - } - + // hContact == -1 export entire db. - if (ExImContact->Typ != EXIM_CONTACT) - { + if (ExImContact->Typ != EXIM_CONTACT) { // Owner ExportContact(NULL, &Modules, file); fprintf(file, "\n\n"); // Contacts - for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) - { + for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { ExportContact(hContact, &Modules, file); fprintf(file, "\n\n"); } } - // export only one contact - else - ExportContact(ExImContact->hContact, &Modules, file); + else ExportContact(ExImContact->hContact, &Modules, file); // export only one contact fclose(file); SetCursor(LoadCursor(nullptr, IDC_ARROW)); @@ -184,12 +178,12 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) LPSTR strnrchr(LPSTR string, int ch, DWORD len) { LPSTR start = (LPSTR)string; - - string += len; /* find end of string */ + string += len; /* find end of string */ /* search towards front */ - while (--string != start && *string != (CHAR)ch); - if (*string == (CHAR)ch) /* char found ? */ - return ((LPSTR)string); + while (--string != start && *string != (CHAR)ch) + ; + if (*string == (CHAR)ch) /* char found ? */ + return ((LPSTR)string); return(nullptr); } @@ -200,7 +194,8 @@ LPSTR strnrchr(LPSTR string, int ch, DWORD len) * string - the string to write the read line to * return: pointer to the buffer on success or NULL on error **/ -static DWORD ImportreadLine(FILE* file, LPSTR &str) + +static DWORD ImportreadLine(FILE *file, LPSTR &str) { DWORD l = 0; bool bComment = false; @@ -209,41 +204,41 @@ static DWORD ImportreadLine(FILE* file, LPSTR &str) while (!feof(file)) { int c = fgetc(file); switch (c) { - case EOF: - // reading error - if (ferror(file)) { - MIR_FREE(str); - return 0; - } - // end of line & file - return l; - - case '\r': - case '\n': - // ignore empty lines - if (l == 0) { - bComment = false; - continue; - } - return l; - - case ';': - // found a comment line - bComment |= (l == 0); - __fallthrough; - - case '\t': - case ' ': - // ignore space and tab at the beginning of the line - if (l == 0) - break; - __fallthrough; + case EOF: + // reading error + if (ferror(file)) { + MIR_FREE(str); + return 0; + } + // end of line & file + return l; + + case '\r': + case '\n': + // ignore empty lines + if (l == 0) { + bComment = false; + continue; + } + return l; - default: - if (!bComment) { - str = mir_strncat_c(str, c); - l++; - } + case ';': + // found a comment line + bComment |= (l == 0); + __fallthrough; + + case '\t': + case ' ': + // ignore space and tab at the beginning of the line + if (l == 0) + break; + __fallthrough; + + default: + if (!bComment) { + str = mir_strncat_c(str, c); + l++; + } } } return 0; @@ -259,6 +254,7 @@ static DWORD ImportreadLine(FILE* file, LPSTR &str) * cchBuf - character count of the buffer * return: handle to the contact that matches the information or NULL if no match **/ + static MCONTACT ImportFindContact(MCONTACT, LPSTR &strBuf, BYTE bCanCreate) { CExImContactBase vcc; @@ -283,16 +279,14 @@ static MCONTACT ImportFindContact(MCONTACT, LPSTR &strBuf, BYTE bCanCreate) * strLine - string with the setting and its value to write to db * return: 0 if writing was ok, 1 otherwise **/ + int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) { - DBVARIANT dbv; - LPSTR end, value; - size_t brk; - LPSTR pszLine = strLine; - // check Module and filter "Protocol" if (!pszModule || !*pszModule || mir_strncmp(pszModule, "Protocol", 8) == 0) return 1; + + LPSTR end, value, pszLine = strLine; if ((end = value = mir_strchr(pszLine, '=')) == nullptr) return 1; @@ -301,8 +295,7 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) if (end == pszLine) return 1; *(end--) = 0; - } - while (*end == '\t' || *end == ' ' || *end < 27); + } while (*end == '\t' || *end == ' ' || *end < 27); // skip spaces from the beginning of the value do { @@ -313,74 +306,79 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) } while (*value == '\t' || *value == ' '); // decode database type and value + DBVARIANT dbv; switch (*(value++)) { - case 'b': - case 'B': - if (brk = strspn(value, "0123456789-")) - *(value + brk) = 0; - dbv.type = DBVT_BYTE; - dbv.bVal = (BYTE)atoi(value); - break; - case 'w': - case 'W': - if (brk = strspn(value, "0123456789-")) - *(value + brk) = 0; - dbv.type = DBVT_WORD; - dbv.wVal = (WORD)atoi(value); - break; - case 'd': - case 'D': - if (brk = strspn(value, "0123456789-")) - *(value + brk) = 0; - dbv.type = DBVT_DWORD; - dbv.dVal = (DWORD)_atoi64(value); - break; + case 'b': + case 'B': + if (size_t brk = strspn(value, "0123456789-")) + *(value + brk) = 0; + dbv.type = DBVT_BYTE; + dbv.bVal = (BYTE)atoi(value); + break; + + case 'w': + case 'W': + if (size_t brk = strspn(value, "0123456789-")) + *(value + brk) = 0; + dbv.type = DBVT_WORD; + dbv.wVal = (WORD)atoi(value); + break; + + case 'd': + case 'D': + if (size_t brk = strspn(value, "0123456789-")) + *(value + brk) = 0; + dbv.type = DBVT_DWORD; + dbv.dVal = (DWORD)_atoi64(value); + break; + + case 's': + case 'S': + case 'u': + case 'U': + for (end = value; end && *end; end++) { + switch (*end) { + // convert STX back to \r + case 2: + *end = '\r'; + break; + // convert ETX back to \n + case 3: + *end = '\n'; + break; + } + } + + switch (*(value - 1)) { case 's': case 'S': + dbv.type = DBVT_ASCIIZ; + dbv.pszVal = value; + break; case 'u': case 'U': - for (end = value; end && *end; end++) { - switch (*end) { - // convert STX back to \r - case 2: - *end = '\r'; - break; - // convert ETX back to \n - case 3: - *end = '\n'; - break; - } - } - switch (*(value - 1)) { - case 's': - case 'S': - dbv.type = DBVT_ASCIIZ; - dbv.pszVal = value; - break; - case 'u': - case 'U': - dbv.type = DBVT_UTF8; - dbv.pszVal = value; - break; - } - break; - case 'n': - case 'N': - { - PBYTE dest; - dbv.type = DBVT_BLOB; - dbv.cpbVal = (WORD)mir_strlen(value) / 3; - dbv.pbVal = (PBYTE)value; - for ( dest = dbv.pbVal, value = strtok(value, " "); - value && *value; - value = strtok(nullptr, " ")) - *(dest++) = (BYTE)strtol(value, nullptr, 16); - *dest = 0; + dbv.type = DBVT_UTF8; + dbv.pszVal = value; break; } - default: - dbv.type = DBVT_DELETED; - //return 1; + break; + + case 'n': + case 'N': + PBYTE dest; + dbv.type = DBVT_BLOB; + dbv.cpbVal = (WORD)mir_strlen(value) / 3; + dbv.pbVal = (PBYTE)value; + for (dest = dbv.pbVal, value = strtok(value, " "); + value && *value; + value = strtok(nullptr, " ")) + *(dest++) = (BYTE)strtol(value, nullptr, 16); + *dest = 0; + break; + + default: + dbv.type = DBVT_DELETED; + //return 1; } return db_set(hContact, pszModule, pszLine, &dbv); } @@ -393,92 +391,93 @@ int ImportSetting(MCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) * strLine - string with the setting and its value to write to db * return: 0 if writing was ok, 1 otherwise **/ -int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName) -{ - FILE *file = fopen(pszFileName, "rt"); - if (file) { - MCONTACT hNewContact = INVALID_CONTACT_ID; - DWORD end, - numLines = 0; - CHAR szModule[MAXSETTING] = {0}; - WORD numContactsInFile = 0, // number of contacts in the inifile - numContactsAdded = 0; // number of contacts, that were added to the database - CHAR *strBuf = (CHAR *) mir_alloc(1); - *strBuf = 0; - SetCursor(LoadCursor(nullptr, IDC_WAIT)); - - while (ImportreadLine(file, strBuf)) { - numLines++; - - // contact was found and imported - if (hContact != INVALID_CONTACT_ID && hNewContact != INVALID_CONTACT_ID) - break; - // importing settings is only valid vor the main menu item - if (hContact == INVALID_CONTACT_ID) { - if (!strncmp(strBuf, "SETTINGS:", 9)) { - *szModule = 0; - hNewContact = NULL; - continue; - } - } +int SvcExImINI_Import(MCONTACT hContact, const wchar_t *pszFileName) +{ + FILE *file = _wfopen(pszFileName, L"rt"); + if (file == nullptr) { + MsgErr(nullptr, + LPGENW("The ini-file \"%s\"\nfor reading contact information could not be opened."), + pszFileName); + return 1; + } - // there are some modules of a contact (import only if contact exist) - if (!strncmp(strBuf, "FROM CONTACT:", 13)) { - strBuf = mir_strnerase(strBuf, 0, 13); - while (strBuf[0] == ' ' || strBuf[0] == '\t') - strBuf = mir_strnerase(strBuf, 0, 1); + MCONTACT hNewContact = INVALID_CONTACT_ID; + DWORD end, numLines = 0; + CHAR szModule[MAXSETTING] = { 0 }; + int numContactsInFile = 0; // number of contacts in the inifile + int numContactsAdded = 0; // number of contacts, that were added to the database + CHAR *strBuf = (CHAR *)mir_alloc(1); + *strBuf = 0; + SetCursor(LoadCursor(nullptr, IDC_WAIT)); - numContactsInFile++; - if ((hNewContact = ImportFindContact(hContact, strBuf, FALSE)) != INVALID_CONTACT_ID) - numContactsAdded++; - continue; - } + while (ImportreadLine(file, strBuf)) { + numLines++; - // there is a contact to import / add - if (!strncmp(strBuf, "CONTACT:", 8)) { - strBuf = mir_strnerase(strBuf, 0, 8); - while (strBuf[0] == ' ' || strBuf[0] == '\t') - strBuf = mir_strnerase(strBuf, 0, 1); + // contact was found and imported + if (hContact != INVALID_CONTACT_ID && hNewContact != INVALID_CONTACT_ID) + break; + // importing settings is only valid vor the main menu item + if (hContact == INVALID_CONTACT_ID) { + if (!strncmp(strBuf, "SETTINGS:", 9)) { *szModule = 0; - numContactsInFile++; - if ((hNewContact = ImportFindContact(hContact, strBuf, TRUE)) != INVALID_CONTACT_ID) - numContactsAdded++; + hNewContact = NULL; continue; } + } - // read modules and settings only for valid contacts - if (hNewContact != INVALID_CONTACT_ID) { - // found a module line - if (strBuf[0] == '[' && (end = (strchr(strBuf, ']') - strBuf)) > 0) { - mir_strncpy(szModule, &strBuf[1], end); - continue; - } - // try to import a setting - ImportSetting(hNewContact, szModule, strBuf); - } - } //end while - fclose(file); - mir_free(strBuf); - SetCursor(LoadCursor(nullptr, IDC_ARROW)); + // there are some modules of a contact (import only if contact exist) + if (!strncmp(strBuf, "FROM CONTACT:", 13)) { + strBuf = mir_strnerase(strBuf, 0, 13); + while (strBuf[0] == ' ' || strBuf[0] == '\t') + strBuf = mir_strnerase(strBuf, 0, 1); - // the contact was not found in the file - if (numContactsInFile > 0 && !numContactsAdded) { - MsgErr(nullptr, - LPGENW("None of the %d contacts, stored in the ini-file, match the selected contact!\nNothing will be imported"), - numContactsInFile); + numContactsInFile++; + if ((hNewContact = ImportFindContact(hContact, strBuf, FALSE)) != INVALID_CONTACT_ID) + numContactsAdded++; + continue; + } + + // there is a contact to import / add + if (!strncmp(strBuf, "CONTACT:", 8)) { + strBuf = mir_strnerase(strBuf, 0, 8); + while (strBuf[0] == ' ' || strBuf[0] == '\t') + strBuf = mir_strnerase(strBuf, 0, 1); + + *szModule = 0; + numContactsInFile++; + if ((hNewContact = ImportFindContact(hContact, strBuf, TRUE)) != INVALID_CONTACT_ID) + numContactsAdded++; + continue; } - // Import complete - else{ - MsgBox(nullptr, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), - LPGENW("Added %d of %d contacts stored in the ini-file."), - numContactsAdded, numContactsInFile); + + // read modules and settings only for valid contacts + if (hNewContact != INVALID_CONTACT_ID) { + // found a module line + if (strBuf[0] == '[' && (end = (strchr(strBuf, ']') - strBuf)) > 0) { + mir_strncpy(szModule, &strBuf[1], end); + continue; + } + // try to import a setting + ImportSetting(hNewContact, szModule, strBuf); } - return 0; + } //end while + fclose(file); + mir_free(strBuf); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); + + // the contact was not found in the file + if (numContactsInFile > 0 && !numContactsAdded) { + MsgErr(nullptr, + LPGENW("None of the %d contacts, stored in the ini-file, match the selected contact!\nNothing will be imported"), + numContactsInFile); } - MsgErr(nullptr, - LPGENW("The ini-file \"%s\"\nfor reading contact information could not be opened."), - pszFileName); - return 1; + // Import complete + else { + MsgBox(nullptr, MB_ICON_INFO, LPGENW("Import complete"), LPGENW("Some basic statistics"), + LPGENW("Added %d of %d contacts stored in the ini-file."), + numContactsAdded, numContactsInFile); + } + return 0; } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h index b6a9c8873c..c80c46044b 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once
- int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName);
- int SvcExImINI_Import(MCONTACT hContact, LPCSTR pszFileName);
+ int SvcExImINI_Export(lpExImParam ExImContact, const wchar_t *pszFileName);
+ int SvcExImINI_Import(MCONTACT hContact, const wchar_t *pszFileName);
#endif /* _SVC_EXIMINI_H_ */
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index eda76bb29d..6733e4940d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -36,20 +36,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* return TRUE or FALSE
**/
-BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer)
+
+BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer)
{
- BYTE c;
- PBYTE s = (PBYTE)pBuffer;
- BYTE bIsUTF = 0;
-
- if (s == nullptr) return 1;
- while ((c = *s++) != 0) {
- if (c < 0x80) continue;
- if (!pcbBuffer) return 0;
- bIsUTF = 1;
- }
- if (pcbBuffer) *pcbBuffer = s - (PBYTE)pBuffer;
- return !bIsUTF;
+ BYTE c;
+ PBYTE s = (PBYTE)pBuffer;
+ BYTE bIsUTF = 0;
+
+ if (s == nullptr) return 1;
+ while ((c = *s++) != 0) {
+ if (c < 0x80) continue;
+ if (!pcbBuffer) return 0;
+ bIsUTF = 1;
+ }
+ if (pcbBuffer) *pcbBuffer = s - (PBYTE)pBuffer;
+ return !bIsUTF;
}
/*
@@ -66,12 +67,13 @@ BYTE IsUSASCII(LPCSTR pBuffer, LPDWORD pcbBuffer) *
* return: nothing
**/
+
CLineBuffer::CLineBuffer()
{
- _pVal = nullptr;
- _pTok = nullptr;
- _cbVal = 0;
- _cbUsed = 0;
+ _pVal = nullptr;
+ _pTok = nullptr;
+ _cbVal = 0;
+ _cbUsed = 0;
}
/**
@@ -81,6 +83,7 @@ CLineBuffer::CLineBuffer() *
* return: nothing
**/
+
CLineBuffer::~CLineBuffer()
{
if (_pVal) mir_free(_pVal);
@@ -93,6 +96,7 @@ CLineBuffer::~CLineBuffer() *
* return: TRUE if reallocation successful or memoryblock is large enough, FALSE otherwise
**/
+
BYTE CLineBuffer::_resizeBuf(const size_t cbReq)
{
if (cbReq > _cbVal - _cbUsed) {
@@ -113,6 +117,7 @@ BYTE CLineBuffer::_resizeBuf(const size_t cbReq) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator=(const CHAR *szVal)
{
if (szVal) {
@@ -135,6 +140,7 @@ size_t CLineBuffer::operator=(const CHAR *szVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const CHAR *szVal)
{
if (szVal) {
@@ -156,10 +162,11 @@ size_t CLineBuffer::operator + (const CHAR *szVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const WCHAR *wszVal)
{
if (wszVal) {
- CHAR* szVal = mir_u2a(wszVal);
+ CHAR *szVal = mir_u2a(wszVal);
if (szVal) {
size_t cbLength = mir_strlen(szVal);
@@ -180,6 +187,7 @@ size_t CLineBuffer::operator + (const WCHAR *wszVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const CHAR cVal)
{
if (_resizeBuf(1)) {
@@ -196,10 +204,11 @@ size_t CLineBuffer::operator + (const CHAR cVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const BYTE bVal)
{
size_t cbLength = 3;
-
+
if (_resizeBuf(cbLength)) {
cbLength = mir_strlen(_itoa(bVal, (LPSTR)(_pVal + _cbUsed), 10));
_cbUsed += cbLength;
@@ -215,10 +224,11 @@ size_t CLineBuffer::operator + (const BYTE bVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const SHORT sVal)
{
size_t cbLength = 6;
-
+
if (_resizeBuf(cbLength)) {
cbLength = mir_strlen(_itoa(sVal, (LPSTR)(_pVal + _cbUsed), 10));
_cbUsed += cbLength;
@@ -234,10 +244,11 @@ size_t CLineBuffer::operator + (const SHORT sVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const WORD wVal)
{
size_t cbLength = 5;
-
+
if (_resizeBuf(cbLength)) {
cbLength = mir_strlen(_itoa(wVal, (LPSTR)(_pVal + _cbUsed), 10));
_cbUsed += cbLength;
@@ -253,10 +264,11 @@ size_t CLineBuffer::operator + (const WORD wVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const LONG lVal)
{
size_t cbLength = 11;
-
+
if (_resizeBuf(cbLength)) {
cbLength = mir_strlen(_ltoa(lVal, (LPSTR)(_pVal + _cbUsed), 10));
_cbUsed += cbLength;
@@ -272,10 +284,11 @@ size_t CLineBuffer::operator + (const LONG lVal) *
* return: length of the string, added
**/
+
size_t CLineBuffer::operator + (const DWORD dVal)
{
size_t cbLength = 10;
-
+
if (_resizeBuf(cbLength)) {
cbLength = mir_strlen(_ltoa(dVal, (LPSTR)(_pVal + _cbUsed), 10));
_cbUsed += cbLength;
@@ -291,6 +304,7 @@ size_t CLineBuffer::operator + (const DWORD dVal) *
* return: length of the string
**/
+
size_t CLineBuffer::GetLength()
{
return _cbUsed;
@@ -304,7 +318,8 @@ size_t CLineBuffer::GetLength() *
* return: pointer to _pVal
**/
-LPCSTR CLineBuffer::GetBuffer()
+
+LPCSTR CLineBuffer::GetBuffer()
{
return (LPCSTR)_pVal;
}
@@ -316,6 +331,7 @@ LPCSTR CLineBuffer::GetBuffer() *
* return: nothing
**/
+
void CLineBuffer::TruncToLength(size_t cbLength)
{
if (cbLength < _cbUsed) {
@@ -331,6 +347,7 @@ void CLineBuffer::TruncToLength(size_t cbLength) *
* return: nothing
**/
+
void CLineBuffer::Truncate(size_t count)
{
if (_cbUsed <= count) {
@@ -350,6 +367,7 @@ void CLineBuffer::Truncate(size_t count) *
* return: nothing
**/
+
void CLineBuffer::TruncateSMS()
{
if (!strncmp((LPSTR)(_pVal + _cbUsed - 4), " SMS", 4)) {
@@ -365,6 +383,7 @@ void CLineBuffer::TruncateSMS() *
* return: nothing
**/
+
void CLineBuffer::fput(FILE *outfile)
{
if (_pVal) {
@@ -382,6 +401,7 @@ void CLineBuffer::fput(FILE *outfile) *
* return: nothing
**/
+
void CLineBuffer::fputEncoded(FILE *outFile)
{
PBYTE pVal = _pVal;
@@ -391,35 +411,35 @@ void CLineBuffer::fputEncoded(FILE *outFile) while (_cbUsed > 0 && *pVal) {
switch (*pVal) {
// translate special characters
- case ':':
- case ';':
- case '\r':
- case '\n':
- case '\t':
- fprintf(outFile, "=%02X", *pVal);
- break;
+ case ':':
+ case ';':
+ case '\r':
+ case '\n':
+ case '\t':
+ fprintf(outFile, "=%02X", *pVal);
+ break;
// Some database texts may contain encoded escapes, that have to be translated too.
- case '\\':
- if (*(pVal+1) == 'r') {
- fprintf(outFile, "=%02X", '\r');
- pVal++;
- break;
- }
- if (*(pVal+1) == 't') {
- fprintf(outFile, "=%02X", '\t');
- pVal++;
- break;
- }
- if (*(pVal+1) == 'n') {
- fprintf(outFile, "=%02X", '\n');
- pVal++;
- break;
- }
- // translate all characters which are not contained in the USASCII code
- default:
- if (*pVal > 127) fprintf(outFile, "=%02X", *pVal);
- else fputc(*pVal, outFile);
+ case '\\':
+ if (*(pVal + 1) == 'r') {
+ fprintf(outFile, "=%02X", '\r');
+ pVal++;
break;
+ }
+ if (*(pVal + 1) == 't') {
+ fprintf(outFile, "=%02X", '\t');
+ pVal++;
+ break;
+ }
+ if (*(pVal + 1) == 'n') {
+ fprintf(outFile, "=%02X", '\n');
+ pVal++;
+ break;
+ }
+ // translate all characters which are not contained in the USASCII code
+ default:
+ if (*pVal > 127) fprintf(outFile, "=%02X", *pVal);
+ else fputc(*pVal, outFile);
+ break;
}
pVal++;
(_cbUsed)--;
@@ -435,6 +455,7 @@ void CLineBuffer::fputEncoded(FILE *outFile) *
* return: nothing
**/
+
int CLineBuffer::fgetEncoded(FILE *inFile)
{
int c;
@@ -447,27 +468,27 @@ int CLineBuffer::fgetEncoded(FILE *inFile) while (EOF != (c = fgetc(inFile))) {
switch (c) {
- case '\n':
- if (_cbUsed > 0 && _pVal[_cbUsed - 1] == '\r') {
- _pVal[--_cbUsed] = 0;
- wAdd--;
- }
- else
- _pVal[_cbUsed] = 0;
- return wAdd;
- case '=':
- if (_resizeBuf(1)) {
- fread(hex, 2, 1, inFile);
- *(_pVal + _cbUsed++) = (BYTE)strtol(hex, nullptr, 16);
- wAdd++;
- }
- break;
- default:
- if (_resizeBuf(1)) {
- *(_pVal + _cbUsed++) = c;
- wAdd++;
- }
- break;
+ case '\n':
+ if (_cbUsed > 0 && _pVal[_cbUsed - 1] == '\r') {
+ _pVal[--_cbUsed] = 0;
+ wAdd--;
+ }
+ else
+ _pVal[_cbUsed] = 0;
+ return wAdd;
+ case '=':
+ if (_resizeBuf(1)) {
+ fread(hex, 2, 1, inFile);
+ *(_pVal + _cbUsed++) = (BYTE)strtol(hex, nullptr, 16);
+ wAdd++;
+ }
+ break;
+ default:
+ if (_resizeBuf(1)) {
+ *(_pVal + _cbUsed++) = c;
+ wAdd++;
+ }
+ break;
}
}
_pVal[_cbUsed] = 0;
@@ -483,7 +504,8 @@ int CLineBuffer::fgetEncoded(FILE *inFile) *
* return: length of the found string value
**/
-size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf)
+
+size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer *pBuf)
{
PBYTE here;
size_t wLength;
@@ -502,7 +524,7 @@ size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf) *pBuf = (LPCSTR)_pTok;
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -518,7 +540,8 @@ size_t CLineBuffer::GetTokenFirst(const CHAR delim, CLineBuffer * pBuf) *
* return: length of the found string value
**/
-size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf)
+
+size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer *pBuf)
{
PBYTE here;
size_t wLength;
@@ -532,12 +555,12 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) if (pBuf) {
CHAR c = *here;
-
+
*here = 0;
*pBuf = (LPCSTR)_pTok;
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -555,7 +578,8 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) *
* return: 0 if successful, 1 otherwise
**/
-int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim)
+
+int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting, const CHAR delim)
{
PBYTE here;
int iRet = 1;
@@ -564,15 +588,15 @@ int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, con if (_pTok && *_pTok) {
for (here = _pTok;; here++) {
if (*here == 0 || *here == '\n' || *here == delim) {
-
+
if (here - _pTok > 0) {
CHAR c = *here;
-
+
*here = 0;
iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -592,7 +616,8 @@ int CLineBuffer::DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, con *
* return: 0 if successful, 1 otherwise
**/
-int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim)
+
+int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting, const CHAR delim)
{
PBYTE here;
int iRet = 1;
@@ -600,15 +625,15 @@ int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, cons if (_pTok && *_pTok) {
for (here = _pTok;; here++) {
if (*here == 0 || *here == '\n' || *here == delim) {
-
+
if (here - _pTok > 0) {
CHAR c = *here;
-
+
*here = 0;
iRet = db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pTok);
*here = c;
}
- _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
+ _pTok = (*here == 0 || *here == '\n') ? nullptr : ++here;
break;
}
}
@@ -626,7 +651,8 @@ int CLineBuffer::DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, cons *
* return: 0 if successful, 1 otherwise
**/
-int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting)
+
+int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting)
{
if (_pVal && _cbUsed > 0)
return db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pVal);
@@ -645,6 +671,7 @@ int CLineBuffer::DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, * param: none
* return none
**/
+
CVCardFileVCF::CVCardFileVCF()
{
_pFile = nullptr;
@@ -657,7 +684,7 @@ CVCardFileVCF::CVCardFileVCF() /**
* name: CVCardFileVCF::CVCardFileVCF
- * desc: searches a static stringlist for the occureance of iID and adds
+ * desc: searches a static stringlist for the occureance of iID and adds
* the translated string value to the line buffer
* param: pList - pointer to the list to search in
* nList - number of items in the list
@@ -666,6 +693,7 @@ CVCardFileVCF::CVCardFileVCF() *
* return number of the added bytes
**/
+
size_t CVCardFileVCF::packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *cbRew)
{
for (UINT i = 0; i < nList; i++) {
@@ -687,6 +715,7 @@ size_t CVCardFileVCF::packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *c *
* return value type
**/
+
BYTE CVCardFileVCF::GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv)
{
int type = _useUtf8 ? DBVT_UTF8 : DBVT_ASCIIZ;
@@ -708,31 +737,32 @@ BYTE CVCardFileVCF::GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DB *
* return number of bytes, added to the linebuffer
**/
+
size_t CVCardFileVCF::packDB(const CHAR *pszModule, const CHAR *pszSetting, size_t *cbRew)
{
DBVARIANT dbv;
switch (GetSetting(pszModule, pszSetting, &dbv)) {
- case DBVT_DELETED:
- if (cbRew) (*cbRew)++;
- break;
- case DBVT_BYTE:
- return _clVal + dbv.bVal;
- case DBVT_WORD:
- return _clVal + dbv.wVal;
- case DBVT_DWORD:
- return _clVal + dbv.dVal;
- case DBVT_UTF8:
- case DBVT_ASCIIZ:
+ case DBVT_DELETED:
+ if (cbRew) (*cbRew)++;
+ break;
+ case DBVT_BYTE:
+ return _clVal + dbv.bVal;
+ case DBVT_WORD:
+ return _clVal + dbv.wVal;
+ case DBVT_DWORD:
+ return _clVal + dbv.dVal;
+ case DBVT_UTF8:
+ case DBVT_ASCIIZ:
{
size_t wAdd = _clVal + dbv.pszVal;
db_free(&dbv);
return wAdd;
}
- default:
- if (cbRew) (*cbRew)++;
- db_free(&dbv);
- break;
+ default:
+ if (cbRew) (*cbRew)++;
+ db_free(&dbv);
+ break;
}
return 0;
}
@@ -748,6 +778,7 @@ size_t CVCardFileVCF::packDB(const CHAR *pszModule, const CHAR *pszSetting, size *
* return number of bytes, added to the linebuffer
**/
+
size_t CVCardFileVCF::packDBList(const CHAR *pszModule, const CHAR *pszSetting, MIRANDASERVICE GetList, BYTE bSigned, size_t *cbRew)
{
DBVARIANT dbv;
@@ -757,27 +788,27 @@ size_t CVCardFileVCF::packDBList(const CHAR *pszModule, const CHAR *pszSetting, GetList((WPARAM)&nList, (LPARAM)&pList);
switch (GetSetting(pszModule, pszSetting, &dbv)) {
- case DBVT_BYTE:
- wAdd = packList(pList, nList, (int)(bSigned ? dbv.cVal : dbv.bVal), cbRew);
- break;
- case DBVT_WORD:
- wAdd = packList(pList, nList, (int)(bSigned ? dbv.sVal : dbv.wVal), cbRew);
- break;
- case DBVT_DWORD:
- wAdd = packList(pList, nList, (int)(bSigned ? dbv.lVal : dbv.dVal), cbRew);
- break;
- case DBVT_UTF8:
- case DBVT_ASCIIZ:
- wAdd = _clVal + Translate(dbv.pszVal);
- db_free(&dbv);
- break;
- case DBVT_DELETED:
- wAdd = 0;
- break;
- default:
- wAdd = 0;
- db_free(&dbv);
- break;
+ case DBVT_BYTE:
+ wAdd = packList(pList, nList, (int)(bSigned ? dbv.cVal : dbv.bVal), cbRew);
+ break;
+ case DBVT_WORD:
+ wAdd = packList(pList, nList, (int)(bSigned ? dbv.sVal : dbv.wVal), cbRew);
+ break;
+ case DBVT_DWORD:
+ wAdd = packList(pList, nList, (int)(bSigned ? dbv.lVal : dbv.dVal), cbRew);
+ break;
+ case DBVT_UTF8:
+ case DBVT_ASCIIZ:
+ wAdd = _clVal + Translate(dbv.pszVal);
+ db_free(&dbv);
+ break;
+ case DBVT_DELETED:
+ wAdd = 0;
+ break;
+ default:
+ wAdd = 0;
+ db_free(&dbv);
+ break;
}
if (cbRew) *cbRew = wAdd ? 0 : *cbRew + 1;
return wAdd;
@@ -791,6 +822,7 @@ size_t CVCardFileVCF::packDBList(const CHAR *pszModule, const CHAR *pszSetting, *
* return number of bytes, added to the linebuffer
**/
+
void CVCardFileVCF::writeLine(const CHAR *szSet, size_t *cbRew)
{
if (cbRew) {
@@ -820,6 +852,7 @@ void CVCardFileVCF::writeLine(const CHAR *szSet, size_t *cbRew) *
* return number of bytes, added to the linebuffer
**/
+
void CVCardFileVCF::writeLineEncoded(const CHAR *szSet, size_t *cbRew)
{
if (cbRew) {
@@ -846,9 +879,10 @@ void CVCardFileVCF::writeLineEncoded(const CHAR *szSet, size_t *cbRew) * pszMode - the mode the file should be opened with
* return TRUE or FALSE
**/
-BYTE CVCardFileVCF::Open(MCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode)
+
+BYTE CVCardFileVCF::Open(MCONTACT hContact, const wchar_t *pszFileName, const wchar_t *pszMode)
{
- if (!(_pFile = fopen(pszFileName, pszMode)))
+ if (!(_pFile = _wfopen(pszFileName, pszMode)))
return FALSE;
if ((_hContact = hContact) == INVALID_CONTACT_ID)
return FALSE;
@@ -865,9 +899,10 @@ BYTE CVCardFileVCF::Open(MCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode) * pszMode - the mode the file should be opened with
* return TRUE or FALSE
**/
+
void CVCardFileVCF::Close(void)
{
- if (_pFile)
+ if (_pFile)
fclose(_pFile);
_pFile = nullptr;
_hContact = INVALID_CONTACT_ID;
@@ -880,6 +915,7 @@ void CVCardFileVCF::Close(void) * param: none
* return TRUE or FALSE
**/
+
BYTE CVCardFileVCF::Export(BYTE bExportUtf)
{
size_t cbRew = 0;
@@ -969,7 +1005,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) //
// private address
//
- _clVal + ";;";
+ _clVal + ";;";
cbRew = 1;
packDB(USERINFO, SET_CONTACT_STREET, &cbRew);
_clVal + DELIM;
@@ -1040,12 +1076,12 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) BYTE gender = db_get_b(_hContact, USERINFO, SET_CONTACT_GENDER, 0);
if (!gender) gender = db_get_b(_hContact, _pszBaseProto, SET_CONTACT_GENDER, 0);
switch (gender) {
- case 'F':
- fputs("X-WAB-GENDER:1\n", _pFile);
- break;
- case 'M':
- fputs("X-WAB-GENDER:2\n", _pFile);
- break;
+ case 'F':
+ fputs("X-WAB-GENDER:1\n", _pFile);
+ break;
+ case 'M':
+ fputs("X-WAB-GENDER:2\n", _pFile);
+ break;
}
}
@@ -1058,7 +1094,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) if (!mdb.DBGetBirthDate(_hContact, nullptr))
fprintf(_pFile, "BDAY:%d%02d%02d\n", mdb.Year(), mdb.Month(), mdb.Day());
}
-
+
//
// notes
//
@@ -1101,6 +1137,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) *
* return: number of characters read from the file or EOF
**/
+
int CVCardFileVCF::readLine(LPSTR szVCFSetting, WORD cchSetting)
{
LPSTR here;
@@ -1121,7 +1158,7 @@ int CVCardFileVCF::readLine(LPSTR szVCFSetting, WORD cchSetting) // ignore line if setting was not read correctly
if (here - szVCFSetting == cchSetting)
return 0;
-
+
// read the value to the linebuffer, because its length may be very large
return _clVal.fgetEncoded(_pFile);
}
@@ -1133,6 +1170,7 @@ int CVCardFileVCF::readLine(LPSTR szVCFSetting, WORD cchSetting) *
* return: number of characters read from the file or EOF
**/
+
BYTE CVCardFileVCF::Import()
{
CHAR szEnt[MAX_PATH];
@@ -1150,181 +1188,171 @@ BYTE CVCardFileVCF::Import() *(pszParam++) = 0;
}
switch (*szEnt) {
- case 'A':
- if (!mir_strcmp(szEnt, "ABOUT")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_ABOUT);
+ case 'A':
+ if (!mir_strcmp(szEnt, "ABOUT")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_ABOUT);
+ continue;
+ }
+ if (!mir_strcmp(szEnt, "ADR")) {
+ if (!pszParam) continue;
+ if (!mir_strcmp(pszParam, "HOME")) {
+ _clVal.GetTokenFirst(';', nullptr);
+ _clVal.GetTokenNext(';', nullptr);
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STREET, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_CITY, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STATE, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ZIP, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COUNTRY, ';');
continue;
}
- if (!mir_strcmp(szEnt, "ADR")) {
- if (!pszParam) continue;
- if (!mir_strcmp(pszParam, "HOME")) {
- _clVal.GetTokenFirst(';', nullptr);
- _clVal.GetTokenNext(';', nullptr);
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STREET, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_CITY, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_STATE, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ZIP, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COUNTRY, ';');
- continue;
- }
- if (!mir_strcmp(pszParam, "WORK")) {
- _clVal.GetTokenFirst(';', nullptr);
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_OFFICE, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STREET, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_CITY, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STATE, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_ZIP, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_COUNTRY, ';');
- continue;
- }
- if (!mir_strcmp(pszParam, "POSTAL")) {
- _clVal.GetTokenFirst(';', nullptr);
- _clVal.GetTokenNext(';', nullptr);
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STREET, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_CITY, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STATE, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_ZIP, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, ';');
- }
+ if (!mir_strcmp(pszParam, "WORK")) {
+ _clVal.GetTokenFirst(';', nullptr);
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_OFFICE, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STREET, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_CITY, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_STATE, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_ZIP, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_COUNTRY, ';');
+ continue;
}
- continue;
-
- case 'B':
- if (!mir_strcmp(szEnt, "BDAY")) {
- if (_clVal.GetLength() == 8) {
- CHAR buf[5];
-
- memcpy(buf, _clVal.GetBuffer(), 4);
- buf[4] = 0;
- db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, nullptr, 10));
- memcpy(buf, _clVal.GetBuffer() + 4, 2);
- buf[2] = 0;
- db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, nullptr, 10));
- memcpy(buf, _clVal.GetBuffer() + 6, 2);
- buf[2] = 0;
- db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, nullptr, 10));
- }
+ if (!mir_strcmp(pszParam, "POSTAL")) {
+ _clVal.GetTokenFirst(';', nullptr);
+ _clVal.GetTokenNext(';', nullptr);
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STREET, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_CITY, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_STATE, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_ZIP, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, ';');
}
- continue;
-
- case 'E':
- if (!mir_strcmp(szEnt, "EMAIL")) {
- if (!pszParam || !strstr(pszParam, "intERNET"))
- continue;
- if (strstr(pszParam, "PREF")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL);
- continue;
- }
- switch (numEmails++) {
- case 0:
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL0);
- break;
- case 1:
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL1);
- break;
- }
+ }
+ continue;
+
+ case 'B':
+ if (!mir_strcmp(szEnt, "BDAY")) {
+ if (_clVal.GetLength() == 8) {
+ CHAR buf[5];
+
+ memcpy(buf, _clVal.GetBuffer(), 4);
+ buf[4] = 0;
+ db_set_w(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHYEAR, (WORD)strtol(buf, nullptr, 10));
+ memcpy(buf, _clVal.GetBuffer() + 4, 2);
+ buf[2] = 0;
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHMONTH, (BYTE)strtol(buf, nullptr, 10));
+ memcpy(buf, _clVal.GetBuffer() + 6, 2);
+ buf[2] = 0;
+ db_set_b(_hContact, MOD_MBIRTHDAY, SET_CONTACT_BIRTHDAY, (BYTE)strtol(buf, nullptr, 10));
}
- continue;
- /*
- case 'I':
- if (!mir_strcmp(szEnt, "IM")) {
- LPSTR pszModule, pszSetting;
+ }
+ continue;
- if (pszParam && (pszModule = strtok(pszParam, DELIM)) && (pszSetting = strtok(NULL, DELIM)))
- _clVal.DBWriteSettingString(_hContact, pszModule, pszSetting);
- }
- continue;
- */
- case 'N':
- if (!mir_strcmp(szEnt, "N")) {
- _clVal.DBWriteTokenFirst(_hContact, USERINFO, SET_CONTACT_LASTNAME, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_FIRSTNAME, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_SECONDNAME, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_TITLE, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_PREFIX, ';');
+ case 'E':
+ if (!mir_strcmp(szEnt, "EMAIL")) {
+ if (!pszParam || !strstr(pszParam, "intERNET"))
continue;
- }
- if (!mir_strcmp(szEnt, "NICKNAME")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_NICK);
+ if (strstr(pszParam, "PREF")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL);
continue;
}
- if (!mir_strcmp(szEnt, "NOTE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_MYNOTES);
+ switch (numEmails++) {
+ case 0:
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL0);
+ break;
+ case 1:
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_EMAIL1);
+ break;
}
+ }
+ continue;
+
+ case 'N':
+ if (!mir_strcmp(szEnt, "N")) {
+ _clVal.DBWriteTokenFirst(_hContact, USERINFO, SET_CONTACT_LASTNAME, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_FIRSTNAME, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_SECONDNAME, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_TITLE, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_PREFIX, ';');
continue;
-
- case 'O':
- if (!mir_strcmp(szEnt, "ORG")) {
- _clVal.DBWriteTokenFirst(_hContact, USERINFO, SET_CONTACT_COMPANY, ';');
- _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_DEPARTMENT, ';');
- }
+ }
+ if (!mir_strcmp(szEnt, "NICKNAME")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_NICK);
continue;
+ }
+ if (!mir_strcmp(szEnt, "NOTE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_MYNOTES);
+ }
+ continue;
- case 'R':
- if (!mir_strcmp(szEnt, "ROLE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_OCCUPATION);
- }
+ case 'O':
+ if (!mir_strcmp(szEnt, "ORG")) {
+ _clVal.DBWriteTokenFirst(_hContact, USERINFO, SET_CONTACT_COMPANY, ';');
+ _clVal.DBWriteTokenNext(_hContact, USERINFO, SET_CONTACT_COMPANY_DEPARTMENT, ';');
+ }
+ continue;
+
+ case 'R':
+ if (!mir_strcmp(szEnt, "ROLE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_OCCUPATION);
+ }
+ continue;
+
+ case 'T':
+ if (!mir_strcmp(szEnt, "TITLE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_POSITION);
continue;
+ }
+
+ if (!mir_strcmp(szEnt, "TEL")) {
+ if (!pszParam) continue;
- case 'T':
- if (!mir_strcmp(szEnt, "TITLE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_POSITION);
+ if (!mir_strcmp(pszParam, "HOME;VOICE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_PHONE);
continue;
}
- if (!mir_strcmp(szEnt, "TEL")) {
-
- if (!pszParam) continue;
-
- if (!mir_strcmp(pszParam, "HOME;VOICE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_PHONE);
- continue;
- }
- if (!mir_strcmp(pszParam, "HOME;FAX")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_FAX);
- continue;
- }
- if (!mir_strcmp(pszParam, "CELL;VOICE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_CELLULAR);
- continue;
- }
- if (!mir_strcmp(pszParam, "WORK;VOICE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_PHONE);
- continue;
- }
- if (!mir_strcmp(pszParam, "WORK;FAX")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_FAX);
- continue;
- }
- if (!mir_strcmp(pszParam, "PAGER;VOICE")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_CELLULAR);
- continue;
- }
+ if (!mir_strcmp(pszParam, "HOME;FAX")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_FAX);
+ continue;
}
- continue;
-
- case 'U':
- if (!mir_strcmp(szEnt, "URL")) {
-
- if (!pszParam) continue;
-
- if (!mir_strcmp(pszParam, "HOME")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_HOMEPAGE);
- continue;
- }
- if (!mir_strcmp(pszParam, "WORK")) {
- _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_HOMEPAGE);
- }
+ if (!mir_strcmp(pszParam, "CELL;VOICE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_CELLULAR);
+ continue;
}
- continue;
+ if (!mir_strcmp(pszParam, "WORK;VOICE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_PHONE);
+ continue;
+ }
+ if (!mir_strcmp(pszParam, "WORK;FAX")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_FAX);
+ continue;
+ }
+ if (!mir_strcmp(pszParam, "PAGER;VOICE")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_CELLULAR);
+ continue;
+ }
+ }
+ continue;
- case 'X':
- if (!mir_strcmp(szEnt, "X-WAB-GENDER")) {
- if (!mir_strcmp(_clVal.GetBuffer(), "1"))
- db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'F');
- else if (!mir_strcmp(_clVal.GetBuffer(), "2"))
- db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'M');
+ case 'U':
+ if (!mir_strcmp(szEnt, "URL")) {
+ if (!pszParam) continue;
+
+ if (!mir_strcmp(pszParam, "HOME")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_HOMEPAGE);
+ continue;
}
- continue;
+ if (!mir_strcmp(pszParam, "WORK")) {
+ _clVal.DBWriteSettingString(_hContact, USERINFO, SET_CONTACT_COMPANY_HOMEPAGE);
+ }
+ }
+ continue;
+
+ case 'X':
+ if (!mir_strcmp(szEnt, "X-WAB-GENDER")) {
+ if (!mir_strcmp(_clVal.GetBuffer(), "1"))
+ db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'F');
+ else if (!mir_strcmp(_clVal.GetBuffer(), "2"))
+ db_set_b(_hContact, USERINFO, SET_CONTACT_GENDER, 'M');
+ }
+ continue;
}
}
return TRUE;
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h index 7ea59290ce..13822c3507 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h @@ -34,7 +34,7 @@ private: public:
CLineBuffer();
~CLineBuffer();
-
+
size_t operator=(const CHAR *szVal);
size_t operator + (const CHAR *szVal);
@@ -49,46 +49,46 @@ public: size_t GetLength();
LPCSTR GetBuffer();
- void TruncToLength(size_t cbLength);
- void Truncate(size_t count);
- void TruncateSMS();
-
- void fput(FILE *outfile);
- void fputEncoded(FILE *outFile);
- int fgetEncoded(FILE *inFile);
-
- size_t GetTokenFirst(const CHAR delim, CLineBuffer * pBuf);
- size_t GetTokenNext(const CHAR delim, CLineBuffer * pBuf);
- int DBWriteTokenFirst(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim);
- int DBWriteTokenNext(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim);
- int DBWriteSettingString(MCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting);
+ void TruncToLength(size_t cbLength);
+ void Truncate(size_t count);
+ void TruncateSMS();
+
+ void fput(FILE *outfile);
+ void fputEncoded(FILE *outFile);
+ int fgetEncoded(FILE *inFile);
+
+ size_t GetTokenFirst(const CHAR delim, CLineBuffer *pBuf);
+ size_t GetTokenNext(const CHAR delim, CLineBuffer *pBuf);
+ int DBWriteTokenFirst(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting, const CHAR delim);
+ int DBWriteTokenNext(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting, const CHAR delim);
+ int DBWriteSettingString(MCONTACT hContact, const CHAR *pszModule, const CHAR *pszSetting);
};
class CVCardFileVCF
{
private:
- CLineBuffer _clVal;
- FILE *_pFile;
- MCONTACT _hContact;
- const CHAR *_pszBaseProto;
- WORD _cbRew;
- BYTE _useUtf8;
- WORD _hasUtf8;
-
- size_t packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *cbRew = nullptr);
- BYTE GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv);
- size_t packDB(const CHAR *pszModule, const CHAR *pszSetting, size_t *cbRew = nullptr);
- size_t packDBList(const CHAR *pszModule, const CHAR *pszSetting, MIRANDASERVICE GetList, BYTE bSigned = FALSE, size_t *cbRew = nullptr);
-
- void writeLine(const CHAR *szSet, size_t *cbRew = nullptr);
- void writeLineEncoded(const CHAR *szSet, size_t *cbRew = nullptr);
- int readLine(LPSTR szVCFSetting, WORD cchSetting);
+ CLineBuffer _clVal;
+ FILE* _pFile;
+ MCONTACT _hContact;
+ const CHAR* _pszBaseProto;
+ WORD _cbRew;
+ BYTE _useUtf8;
+ WORD _hasUtf8;
+
+ size_t packList(LPIDSTRLIST pList, UINT nList, int iID, size_t *cbRew = nullptr);
+ BYTE GetSetting(const CHAR *pszModule, const CHAR *pszSetting, DBVARIANT *dbv);
+ size_t packDB(const CHAR *pszModule, const CHAR *pszSetting, size_t *cbRew = nullptr);
+ size_t packDBList(const CHAR *pszModule, const CHAR *pszSetting, MIRANDASERVICE GetList, BYTE bSigned = FALSE, size_t *cbRew = nullptr);
+
+ void writeLine(const CHAR *szSet, size_t *cbRew = nullptr);
+ void writeLineEncoded(const CHAR *szSet, size_t *cbRew = nullptr);
+ int readLine(LPSTR szVCFSetting, WORD cchSetting);
public:
CVCardFileVCF();
- BYTE Open(MCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode);
- void Close(void);
+ BYTE Open(MCONTACT hContact, const wchar_t *pszFileName, const wchar_t *pszMode);
+ void Close(void);
BYTE Export(BYTE bExportUtf);
BYTE Import();
};
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 8dd883c6c8..3022575e8e 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -86,7 +86,8 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM * pszFileName - full qualified path to the xml file which is destination for the export process
* return: 0 on success, 1 otherwise
**/
-int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
+
+int CFileXml::Export(lpExImParam ExImContact, const wchar_t *pszFileName)
{
DB::CEnumList Modules;
@@ -100,7 +101,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) if (!(_wExport & EXPORT_DATA) ||
!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, nullptr)) {
- FILE *xmlfile = fopen(pszFileName, "wt");
+ FILE *xmlfile = _wfopen(pszFileName, L"wt");
if (!xmlfile) {
MsgErr(nullptr, LPGENW("Can't create xml file!\n%S"), pszFileName);
return 1;
@@ -173,7 +174,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) // nothing exported?
if (cbHeader == ftell(xmlfile)) {
fclose(xmlfile);
- DeleteFileA(pszFileName);
+ DeleteFileW(pszFileName);
return 1;
}
fputs("</XMLCard>\n", xmlfile);
@@ -208,7 +209,7 @@ CFileXml::CFileXml() * return: ERROR_OK on success or one other element of ImportError to tell the type of failure
**/
-int CFileXml::ImportOwner(const TiXmlElement* xContact)
+int CFileXml::ImportOwner(const TiXmlElement *xContact)
{
CExImContactXML vContact(this);
if (vContact.LoadXmlElement(xContact) == ERROR_OK) {
@@ -282,6 +283,7 @@ int CFileXml::ImportContacts(const TiXmlElement *xmlParent) * params: xContact - the contact, who is the owner of the keys to count
* return: nothing
**/
+
DWORD CFileXml::CountContacts(const TiXmlElement *xmlParent)
{
DWORD dwCount = 0;
@@ -301,14 +303,25 @@ DWORD CFileXml::CountContacts(const TiXmlElement *xmlParent) * pszFileName - full qualified path to the xml file which is to import
* return: ERROR_OK on success or one other element of ImportError to tell the type of failure
**/
-int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName)
+
+int CFileXml::Import(MCONTACT hContact, const wchar_t *pszFileName)
{
_hContactToWorkOn = hContact;
+
+ FILE *in = _wfopen(pszFileName, L"rb");
+ if (in == nullptr) {
+ MsgErr(nullptr, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"),
+ pszFileName, 2, TranslateT("File not found"));
+ return 1;
+ }
+
// load xml file
TiXmlDocument doc;
- if (!doc.LoadFile(pszFileName)) {
+ int errorCode = doc.LoadFile(in);
+ fclose(in);
+ if (errorCode) {
MsgErr(nullptr, LPGENW("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"),
- pszFileName, doc.ErrorID(), doc.Error());
+ pszFileName, errorCode, doc.Error());
return 1;
}
// is xmlfile a XMLCard ?
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h index 47f9392caa..390029db60 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h @@ -56,8 +56,8 @@ class CFileXml { public:
CFileXml();
- int Import(MCONTACT hContact, LPCSTR pszFileName);
- int Export(lpExImParam ExImContact, LPCSTR pszFileName);
+ int Import(MCONTACT hContact, const wchar_t *pszFileName);
+ int Export(lpExImParam ExImContact, const wchar_t *pszFileName);
};
#endif /* _SVC_FILEXML_INCLUDED_ */
\ No newline at end of file diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index 8c769c20d8..2782b988f0 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -33,51 +33,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * cchFileName - number of maximum characters the filename can be
* return: nothing
**/
-static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WORD cchFileName)
+
+static void DisplayNameToFileName(lpExImParam ExImContact, wchar_t *pszFileName, size_t cchFileName)
{
- LPCSTR disp = nullptr;
+ LPCSTR disp = nullptr;
LPSTR temp = nullptr;
cchFileName--;
pszFileName[0] = 0;
switch (ExImContact->Typ) {
- case EXIM_ALL:
- case EXIM_GROUP:
- mir_strncpy(pszFileName, Translate("all Contacts"), cchFileName);
+ case EXIM_ALL:
+ case EXIM_GROUP:
+ mir_wstrncpy(pszFileName, TranslateT("all Contacts"), cchFileName);
+ return;
+
+ case EXIM_CONTACT:
+ if (ExImContact->hContact == NULL) {
+ mir_wstrncpy(pszFileName, TranslateT("Owner"), cchFileName);
return;
+ }
- case EXIM_CONTACT:
- if (ExImContact->hContact == NULL) {
- mir_strncpy(pszFileName, Translate("Owner"), cchFileName);
- return;
- }
-
- disp = temp = mir_u2a(Clist_GetContactDisplayName(ExImContact->hContact));
- break;
+ disp = temp = mir_u2a(Clist_GetContactDisplayName(ExImContact->hContact));
+ break;
- case EXIM_SUBGROUP:
- temp = mir_u2a(ExImContact->ptszName);
- disp = temp;
- break;
+ case EXIM_SUBGROUP:
+ temp = mir_u2a(ExImContact->ptszName);
+ disp = temp;
+ break;
- case EXIM_ACCOUNT:
- PROTOACCOUNT* acc = Proto_GetAccount(ExImContact->pszName);
- disp = temp = mir_u2a(acc->tszAccountName);
- break;
+ case EXIM_ACCOUNT:
+ PROTOACCOUNT *acc = Proto_GetAccount(ExImContact->pszName);
+ disp = temp = mir_u2a(acc->tszAccountName);
+ break;
}
// replace unwanted characters
while (*disp != 0 && cchFileName > 1) {
switch (*disp) {
- case '?': case '*': case ':':
- case '\\': case '|': case '/':
- case '<': case '>': case '"':
- *(pszFileName++) = '_';
- break;
- default:
- *(pszFileName++) = *disp;
- break;
+ case '?': case '*': case ':':
+ case '\\': case '|': case '/':
+ case '<': case '>': case '"':
+ *(pszFileName++) = '_';
+ break;
+ default:
+ *(pszFileName++) = *disp;
+ break;
}
disp++;
cchFileName--;
@@ -86,23 +87,21 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO pszFileName[0] = 0;
}
-LPCSTR FilterString(lpExImParam ExImContact)
+const wchar_t *FilterString(lpExImParam ExImContact)
{
- LPCSTR pszFilter = nullptr;
switch (ExImContact->Typ) {
- case EXIM_SUBGROUP:
- case EXIM_ACCOUNT:
- pszFilter = ("XMLCard 1.0 (*.xml)\0*.xml\0");
- break;
- case EXIM_ALL:
- case EXIM_GROUP:
- pszFilter = ("XMLCard 1.0 (*.xml)\0*.xml\0DBEditor++ File (*.ini)\0*.ini\0");
- break;
- case EXIM_CONTACT:
- pszFilter = ("XMLCard 1.0 (*.xml)\0*.xml\0DBEditor++ File (*.ini)\0*.ini\0Standard vCard 2.1 (*.vcf)\0*.vcf\0");
- break;
+ case EXIM_SUBGROUP:
+ case EXIM_ACCOUNT:
+ return L"XMLCard 1.0 (*.xml)\0*.xml\0";
+
+ case EXIM_ALL:
+ case EXIM_GROUP:
+ return L"XMLCard 1.0 (*.xml)\0*.xml\0DBEditor++ File (*.ini)\0*.ini\0";
+
+ case EXIM_CONTACT:
+ return L"XMLCard 1.0 (*.xml)\0*.xml\0DBEditor++ File (*.ini)\0*.ini\0Standard vCard 2.1 (*.vcf)\0*.vcf\0";
}
- return pszFilter;
+ return nullptr;
}
/**
@@ -112,37 +111,33 @@ LPCSTR FilterString(lpExImParam ExImContact) * lParam - parent window
* return: 0 always
**/
+
INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent)
{
- CHAR szFileName[MAX_PATH] = { 0 };
+ wchar_t szFileName[MAX_PATH]; szFileName[0] = 0;
+
// create the filename to suggest the user for the to export contact
DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
- int nIndex = DlgExIm_SaveFileName(hwndParent,
- Translate("Select a destination file..."),
- FilterString(ExImContact),
- szFileName);
+ int nIndex = DlgExIm_SaveFileName(hwndParent, TranslateT("Select a destination file..."), FilterString(ExImContact), szFileName);
switch (nIndex) {
- case 1: // .xml
+ case 1: // .xml
{
CFileXml xmlFile;
return xmlFile.Export(ExImContact, szFileName);
}
- case 2: // .ini
- {
- return SvcExImINI_Export(ExImContact, szFileName);
- }
- case 3: // .vcf
- {
- CVCardFileVCF vcfFile;
- SetCursor(LoadCursor(nullptr, IDC_WAIT));
- if (vcfFile.Open(ExImContact->hContact, szFileName, "wt")) {
- vcfFile.Export(FALSE);
- vcfFile.Close();
- }
- SetCursor(LoadCursor(nullptr, IDC_ARROW));
- return 0;
+ case 2: // .ini
+ return SvcExImINI_Export(ExImContact, szFileName);
+
+ case 3: // .vcf
+ CVCardFileVCF vcfFile;
+ SetCursor(LoadCursor(nullptr, IDC_WAIT));
+ if (vcfFile.Open(ExImContact->hContact, szFileName, L"wt")) {
+ vcfFile.Export(FALSE);
+ vcfFile.Close();
}
+ SetCursor(LoadCursor(nullptr, IDC_ARROW));
+ return 0;
}
return 1;
}
@@ -154,17 +149,15 @@ INT_PTR SvcExImport_Export(lpExImParam ExImContact, HWND hwndParent) * lParam - parent window
* return: 0 always
**/
+
INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent)
{
- CHAR szFileName[MAX_PATH] = { 0 };
+ wchar_t szFileName[MAX_PATH]; szFileName[0] = 0;
// create the filename to suggest the user for the to export contact
DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName));
- int nIndex = DlgExIm_OpenFileName(hwndParent,
- Translate("Import User Details from VCard"),
- FilterString(ExImContact),
- szFileName);
+ int nIndex = DlgExIm_OpenFileName(hwndParent, TranslateT("Import User Details from VCard"), FilterString(ExImContact), szFileName);
// Stop during develop
if (ExImContact->Typ == EXIM_ACCOUNT ||
@@ -183,7 +176,7 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) // .vcf
case 3:
CVCardFileVCF vcfFile;
- if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) {
+ if (vcfFile.Open(ExImContact->hContact, szFileName, L"rt")) {
SetCursor(LoadCursor(nullptr, IDC_WAIT));
vcfFile.Import();
vcfFile.Close();
@@ -198,9 +191,10 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) * service functions
***********************************************************************************************************/
-/*********************************
- * Ex/import All (MainMenu)
- *********************************/
+ /*********************************
+ * Ex/import All (MainMenu)
+ *********************************/
+
INT_PTR svcExIm_MainExport_Service(WPARAM, LPARAM lParam)
{
ExImParam ExIm;
@@ -219,10 +213,10 @@ INT_PTR svcExIm_MainImport_Service(WPARAM, LPARAM lParam) return SvcExImport_Import(&ExIm, (HWND)lParam);
}
-
/*********************************
* Ex/import Contact (ContactMenu)
*********************************/
+
INT_PTR svcExIm_ContactExport_Service(WPARAM hContact, LPARAM lParam)
{
ExImParam ExIm;
@@ -241,20 +235,20 @@ INT_PTR svcExIm_ContactImport_Service(WPARAM hContact, LPARAM lParam) return SvcExImport_Import(&ExIm, (HWND)lParam);
}
-
/*********************************
*Ex/import (Sub)Group (GroupMenu)
*********************************/
-/**
- * This service is call by (Sub)Group MenuItem Export and MenuItem Import
- *
- * @param wParam - gmp.wParam = 0 ->Import
- * @param wParam - gmp.wParam != 0 ->Export
- * @param lParam - gmp.lParam not used
+ /**
+ * This service is call by (Sub)Group MenuItem Export and MenuItem Import
*
- * @return always 0
- **/
+ * @param wParam - gmp.wParam = 0 ->Import
+ * @param wParam - gmp.wParam != 0 ->Export
+ * @param lParam - gmp.lParam not used
+ *
+ * @return always 0
+ **/
+
INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM)
{
ExImParam ExIm;
@@ -268,16 +262,16 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM) HWND hClist = g_clistApi.hwndContactTree;
// get clist selection
- hItem = SendMessage(hClist,CLM_GETSELECTION,0,0);
- hRoot = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_ROOT, (LPARAM)hItem);
+ hItem = SendMessage(hClist, CLM_GETSELECTION, 0, 0);
+ hRoot = SendMessage(hClist, CLM_GETNEXTITEM, (WPARAM)CLGN_ROOT, (LPARAM)hItem);
while (hItem) {
- if (SendMessage(hClist,CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) {
- SendMessage(hClist,CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem);
+ if (SendMessage(hClist, CLM_GETITEMTYPE, (WPARAM)hItem, 0) == CLCIT_GROUP) {
+ SendMessage(hClist, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)ptszItem);
LPTSTR temp = mir_wstrdup(ptszGroup);
- mir_snwprintf(tszGroup, L"%s%s%s", ptszItem, mir_wstrlen(temp)? L"\\":L"", temp);
- mir_free (temp);
+ mir_snwprintf(tszGroup, L"%s%s%s", ptszItem, mir_wstrlen(temp) ? L"\\" : L"", temp);
+ mir_free(temp);
}
- hParent = SendMessage(hClist,CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem);
+ hParent = SendMessage(hClist, CLM_GETNEXTITEM, (WPARAM)CLGN_PARENT, (LPARAM)hItem);
hItem = (hParent != hRoot) ? hParent : 0;
}
ExIm.ptszName = ptszGroup;
@@ -295,13 +289,14 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM) return 0;
};
-
/*********************************
*Ex/Import Account (AccountMenu)
*********************************/
-typedef struct
-// neeed for MO_MENUITEMGETOWNERDATA
-// taken from core clistmenus.ccp
+
+ // neeed for MO_MENUITEMGETOWNERDATA
+ // taken from core clistmenus.ccp
+
+struct StatusMenuExecParam
{
char *proto; //This is unique protoname
int protoindex;
@@ -310,7 +305,7 @@ typedef struct BOOL custom;
char *svc;
HANDLE hMenuItem;
-} StatusMenuExecParam,*lpStatusMenuExecParam;
+};
/**
* This service is call by Account MenuItem Export and MenuItem Import
@@ -326,11 +321,11 @@ INT_PTR svcExIm_Account_Service(WPARAM, LPARAM lParam) ExImParam ExIm;
memset(&ExIm, 0, sizeof(ExIm));
HWND hClist = g_clistApi.hwndContactTree;
- lpStatusMenuExecParam smep = (lpStatusMenuExecParam)Menu_GetItemData((HGENMENU)lParam);
+ StatusMenuExecParam *smep = (StatusMenuExecParam*)Menu_GetItemData((HGENMENU)lParam);
ExIm.pszName = mir_strdup(smep->proto);
ExIm.Typ = EXIM_ACCOUNT;
- if (strstr( smep->svc, "/ExportAccount" )) {
+ if (strstr(smep->svc, "/ExportAccount")) {
//Export "/ExportAccount"
SvcExImport_Export(&ExIm, hClist);
}
@@ -348,11 +343,11 @@ INT_PTR svcExIm_Account_Service(WPARAM, LPARAM lParam) *
* return: 0 or 1
**/
+
void SvcExImport_LoadModule()
{
- CreateServiceFunction(MS_USERINFO_VCARD_EXPORTALL, svcExIm_MainExport_Service);
- CreateServiceFunction(MS_USERINFO_VCARD_IMPORTALL, svcExIm_MainImport_Service);
- CreateServiceFunction(MS_USERINFO_VCARD_EXPORT, svcExIm_ContactExport_Service);
- CreateServiceFunction(MS_USERINFO_VCARD_IMPORT, svcExIm_ContactImport_Service);
- return;
+ CreateServiceFunction(MS_USERINFO_VCARD_EXPORTALL, svcExIm_MainExport_Service);
+ CreateServiceFunction(MS_USERINFO_VCARD_IMPORTALL, svcExIm_MainImport_Service);
+ CreateServiceFunction(MS_USERINFO_VCARD_EXPORT, svcExIm_ContactExport_Service);
+ CreateServiceFunction(MS_USERINFO_VCARD_IMPORT, svcExIm_ContactImport_Service);
}
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.h b/plugins/UserInfoEx/src/ex_import/svc_ExImport.h index 1a3be18c01..0cf893fa03 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.h @@ -26,27 +26,28 @@ typedef struct {
BYTE Typ;
union {
- MCONTACT hContact;
- LPSTR pszName;
+ MCONTACT hContact;
+ LPSTR pszName;
LPTSTR ptszName;
};
}
- ExImParam,*lpExImParam;
-
-enum ExImType {
- EXIM_ALL = 1,
- EXIM_CONTACT = 2,
- EXIM_GROUP = 4,
- EXIM_SUBGROUP = 8,
- EXIM_ACCOUNT = 16
+ExImParam, *lpExImParam;
+
+enum ExImType
+{
+ EXIM_ALL = 1,
+ EXIM_CONTACT = 2,
+ EXIM_GROUP = 4,
+ EXIM_SUBGROUP = 8,
+ EXIM_ACCOUNT = 16
};
INT_PTR svcExIm_MainExport_Service(WPARAM wParam, LPARAM lParam);
INT_PTR svcExIm_MainImport_Service(WPARAM wParam, LPARAM lParam);
INT_PTR svcExIm_ContactExport_Service(WPARAM wParam, LPARAM lParam);
INT_PTR svcExIm_ContactImport_Service(WPARAM wParam, LPARAM lParam);
-INT_PTR svcExIm_Group_Service(WPARAM wParam,LPARAM lParam);
-INT_PTR svcExIm_Account_Service(WPARAM wParam,LPARAM lParam);
+INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam);
+INT_PTR svcExIm_Account_Service(WPARAM wParam, LPARAM lParam);
void SvcExImport_LoadModule();
|