From 2bb514f4195c99b52e0ec748c975c0fd30dbbd25 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Jun 2015 18:10:32 +0000 Subject: another bunch of dead crutches: non-unicode avatar services git-svn-id: http://svn.miranda-ng.org/main/trunk@13961 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Xfire/src/main.cpp | 16 ++++++---------- protocols/Xfire/src/processbuddyinfo.cpp | 3 +-- protocols/Xfire/src/services.cpp | 19 ++++++++----------- 3 files changed, 15 insertions(+), 23 deletions(-) (limited to 'protocols/Xfire') diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 189439fa4a..ef2bd0e77f 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1784,8 +1784,7 @@ void SetAvatar(void *arg) if (GetAvatar(xsa->username, &av)) { - PROTO_AVATAR_INFORMATIONT AI; - AI.cbSize = sizeof(AI); + PROTO_AVATAR_INFORMATION AI; AI.format = av.type; AI.hContact = xsa->hContact; mir_tstrcpy(AI.filename, _A2T(av.file)); @@ -3382,7 +3381,8 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { } -INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) { +INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) +{ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam; if (db_get_b(NULL, protocolname, "noavatars", -1) != 0) @@ -3392,14 +3392,10 @@ INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) { if (pai->format == 0) return GAIR_NOAVATAR; - DBVARIANT dbv; - if (!db_get(pai->hContact, "ContactPhoto", "File", &dbv)) - { - strncpy(pai->filename, dbv.pszVal, sizeof(pai->filename)-1); - db_free(&dbv); - } - else + ptrW pwszPath(db_get_wsa(pai->hContact, "ContactPhoto", "File")); + if (pwszPath == NULL) return GAIR_NOAVATAR; + wcsncpy_s(pai->filename, pwszPath, _TRUNCATE); return GAIR_SUCCESS; } diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index a788f2e7ca..7d03146da4 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -90,8 +90,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c { db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid); db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode); - PROTO_AVATAR_INFORMATIONT AI; - AI.cbSize = sizeof(AI); + PROTO_AVATAR_INFORMATION AI; AI.format = type; AI.hContact = hcontact; mir_tstrcpy(AI.filename, _A2T(filename)); diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp index 380308cc14..fdb15d7e80 100644 --- a/protocols/Xfire/src/services.cpp +++ b/protocols/Xfire/src/services.cpp @@ -52,18 +52,15 @@ BOOL IsContactMySelf(std::string buddyusername) { return FALSE; } -//liefert vollendateipfad vom eigenen avatar zurück, wenn definiert -INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam) { - DBVARIANT dbv; +// liefert vollendateipfad vom eigenen avatar zurück, wenn definiert +INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam) +{ + ptrW wszFileName(db_get_wsa(NULL, protocolname, "MyAvatarFile")); + if (wszFileName == NULL) + return -1; - if (!db_get(NULL, protocolname, "MyAvatarFile", &dbv)) - { - strncpy((char*)wparam, dbv.pszVal, (int)lparam); - db_free(&dbv); - return 0; - } - - return -1; + wcsncpy_s((wchar_t*)wparam, (size_t)lparam, wszFileName, _TRUNCATE); + return 0; } //liefert vollendateipfad vom eigenen avatar zurück, wenn definiert -- cgit v1.2.3