diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-01 20:40:05 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-01 20:40:05 +0000 |
commit | acd4daf132c8ff3b05df7615e95f60be2fb82ddb (patch) | |
tree | ff5836cfc26ab245a356d15c90d36ece29f07189 /protocols | |
parent | 9de7eaca48475e8e5c7f04b72451983ace0ccee5 (diff) |
various quirks with PROTO_AVATAR_INFORMATION declarations
git-svn-id: http://svn.miranda-ng.org/main/trunk@13965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
27 files changed, 255 insertions, 263 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 2a961d7cd6..2de60d0ed4 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -98,15 +98,15 @@ void CAimProto::avatar_request_handler(MCONTACT hContact, char* hash, unsigned c void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, const char* data, int data_len)
{
bool res = false;
- PROTO_AVATAR_INFORMATION AI = {0};
- AI.hContact = contact_from_sn(sn);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = contact_from_sn(sn);
if (data_len > 0) {
const TCHAR *type;
- AI.format = ProtoGetBufferFormat(data, &type);
- get_avatar_filename(AI.hContact, AI.filename, SIZEOF(AI.filename), type);
+ ai.format = ProtoGetBufferFormat(data, &type);
+ get_avatar_filename(ai.hContact, ai.filename, SIZEOF(ai.filename), type);
- int fileId = _topen(AI.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
_write(fileId, data, data_len);
_close(fileId);
@@ -120,7 +120,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c }
else debugLogA("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
- ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &ai, 0);
}
int CAimProto::get_avatar_filename(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 6e35b76a1f..9d5b86d317 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -339,21 +339,21 @@ INT_PTR CAimProto::ManageAccount(WPARAM, LPARAM) INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- AI->filename[0] = 0;
- AI->format = PA_FORMAT_UNKNOWN;
+ pai->filename[0] = 0;
+ pai->format = PA_FORMAT_UNKNOWN;
if (getByte(AIM_KEY_DA, 0)) return GAIR_NOAVATAR;
- switch (get_avatar_filename(AI->hContact, AI->filename, SIZEOF(AI->filename), NULL))
+ switch (get_avatar_filename(pai->hContact, pai->filename, SIZEOF(pai->filename), NULL))
{
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || state != 1 )
return GAIR_SUCCESS;
case GAIR_WAITFOR:
- AI->format = ProtoGetAvatarFormat(AI->filename);
+ pai->format = ProtoGetAvatarFormat(pai->filename);
break;
default:
@@ -362,7 +362,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (state == 1)
{
- ForkThread(&CAimProto::avatar_request_thread, (void*)AI->hContact);
+ ForkThread(&CAimProto::avatar_request_thread, (void*)pai->hContact);
return GAIR_WAITFOR;
}
@@ -405,16 +405,13 @@ INT_PTR CAimProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam)
{
TCHAR* buf = (TCHAR*)wParam;
- int size = (int)lParam;
-
+ size_t size = (size_t)lParam;
if (buf == NULL || size <= 0)
return -1;
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
- if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS)
- {
- _tcsncpy(buf, ai.filename, size);
- buf[size-1] = 0;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS) {
+ _tcsncpy_s(buf, size, ai.filename, _TRUNCATE);
return 0;
}
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index d758e005ce..9beaa10869 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -22,9 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url)
+bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai, std::string *url)
{
- ptrA id(getStringA(ai.hContact, FACEBOOK_KEY_ID));
+ ptrA id(getStringA(pai.hContact, FACEBOOK_KEY_ID));
if (id == NULL)
return false;
@@ -35,9 +35,8 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *u std::tstring filename = GetAvatarFolder() + _T('\\') + std::tstring(_A2T(id)) + _T(".jpg");
- _tcsncpy_s(ai.filename, filename.c_str(), _TRUNCATE);
- ai.format = ProtoGetAvatarFormat(ai.filename);
-
+ _tcsncpy_s(pai.filename, filename.c_str(), _TRUNCATE);
+ pai.format = ProtoGetAvatarFormat(pai.filename);
return true;
}
@@ -75,7 +74,7 @@ void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &imag setString(hContact, FACEBOOK_KEY_AVATAR, image_name.c_str());
if (!hContact) {
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
if (GetAvatarInfo(update_required ? GAIF_FORCE : 0, (LPARAM)&ai) != GAIR_WAITFOR)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
}
@@ -96,7 +95,7 @@ void FacebookProto::UpdateAvatarWorker(void *) for (;;)
{
std::string url;
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = avatar_queue[0];
if (Miranda_Terminated())
@@ -178,26 +177,26 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!lParam)
return GAIR_NOAVATAR;
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
- if (GetDbAvatarInfo(*AI, NULL))
+ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
+ if (GetDbAvatarInfo(*pai, NULL))
{
- bool fileExist = _taccess(AI->filename, 0) == 0;
+ bool fileExist = _taccess(pai->filename, 0) == 0;
bool needLoad;
- if (AI->hContact)
- needLoad = (wParam & GAIF_FORCE) && (!fileExist || db_get_b(AI->hContact, "ContactPhoto", "NeedUpdate", 0));
+ if (pai->hContact)
+ needLoad = (wParam & GAIF_FORCE) && (!fileExist || db_get_b(pai->hContact, "ContactPhoto", "NeedUpdate", 0));
else
needLoad = (wParam & GAIF_FORCE) || !fileExist;
if (needLoad)
{
- debugLogA("*** Starting avatar request thread for %s", _T2A(AI->filename));
+ debugLogA("*** Starting avatar request thread for %s", _T2A(pai->filename));
ScopedLock s(avatar_lock_);
- if (std::find(avatar_queue.begin(), avatar_queue.end(), AI->hContact) == avatar_queue.end())
+ if (std::find(avatar_queue.begin(), avatar_queue.end(), pai->hContact) == avatar_queue.end())
{
bool is_empty = avatar_queue.empty();
- avatar_queue.push_back(AI->hContact);
+ avatar_queue.push_back(pai->hContact);
if (is_empty)
ForkThread(&FacebookProto::UpdateAvatarWorker, NULL);
}
@@ -220,7 +219,7 @@ INT_PTR FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) TCHAR* buf = (TCHAR*)wParam;
int size = (int)lParam;
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
switch (GetAvatarInfo(0, (LPARAM)&ai)) {
case GAIR_SUCCESS:
_tcsncpy(buf, ai.filename, size);
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 7fcb0eee18..5e6b7b199a 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -217,13 +217,13 @@ void __cdecl GGPROTO::avatarrequestthread(void*) mir_free(AvatarURL); mir_free(AvatarTs);
if (iWaitFor) {
- PROTO_AVATAR_INFORMATION pai = {0};
- pai.hContact = hContact;
- INT_PTR res = getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&pai);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ INT_PTR res = getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&ai);
if (res == GAIR_NOAVATAR)
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
else if (res == GAIR_SUCCESS)
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, 0, 0);
delSetting(hContact, GG_KEY_AVATARREQUESTED);
@@ -241,9 +241,9 @@ void __cdecl GGPROTO::avatarrequestthread(void*) int result = 0;
- PROTO_AVATAR_INFORMATION pai = { sizeof(pai) };
- pai.hContact = data->hContact;
- pai.format = getByte(pai.hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = data->hContact;
+ ai.format = getByte(ai.hContact, GG_KEY_AVATARTYPE, GG_KEYDEF_AVATARTYPE);
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
@@ -261,17 +261,17 @@ void __cdecl GGPROTO::avatarrequestthread(void*) if (strncmp(resp->pData,"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A",8) == 0) avatarType = PA_FORMAT_PNG;
setByte(data->hContact, GG_KEY_AVATARTYPE, (BYTE)avatarType);
- getAvatarFilename(pai.hContact, pai.filename, sizeof(pai.filename));
- file_fd = _topen(pai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
+ getAvatarFilename(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ file_fd = _topen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
if (file_fd != -1) {
_write(file_fd, resp->pData, resp->dataLength);
_close(file_fd);
result = 1;
- debugLog(_T("avatarrequestthread() new avatar_transfers item. Saved data from url=%s to file=%s."), data->szAvatarURL, pai.filename);
+ debugLog(_T("avatarrequestthread() new avatar_transfers item. Saved data from url=%s to file=%s."), data->szAvatarURL, ai.filename);
} else {
- debugLog(_T("avatarrequestthread(): _topen file %s error. errno=%d: %s"), pai.filename, errno, strerror(errno));
+ debugLog(_T("avatarrequestthread(): _topen file %s error. errno=%d: %s"), ai.filename, errno, strerror(errno));
TCHAR error[512];
- mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai.filename);
+ mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
@@ -280,9 +280,9 @@ void __cdecl GGPROTO::avatarrequestthread(void*) }
else debugLogA("avatarrequestthread(): No response from HTTP request");
- ProtoBroadcastAck(pai.hContact, ACKTYPE_AVATAR, result ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, (HANDLE)&pai, 0);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, result ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, (HANDLE)&ai, 0);
- if (!pai.hContact)
+ if (!ai.hContact)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
mir_free(data);
@@ -334,8 +334,8 @@ void __cdecl GGPROTO::getOwnAvatarThread(void*) }
setByte(GG_KEY_AVATARREQUESTED, 1);
- PROTO_AVATAR_INFORMATION pai = { 0 };
- getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&pai);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&ai);
}
#ifdef DEBUGMODE
debugLogA("getOwnAvatarThread(): end");
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f09e727a20..70f393d3e9 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1586,15 +1586,14 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) gg_add_notify_ex(sess, uin, (char)(inlist ? GG_USER_NORMAL : GG_USER_OFFLINE));
gg_LeaveCriticalSection(&sess_mutex, "getcontact", 32, 1, "sess_mutex", 1);
- PROTO_AVATAR_INFORMATION pai = { 0 };
- pai.hContact = hContact;
- getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&pai);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&ai);
// Change status of the contact with our own UIN (if got yourself added to the contact list)
if (getDword(GG_KEY_UIN, 0) == uin) {
- TCHAR *szMsg;
gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
- szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
+ TCHAR *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index e229de63dc..9e3e9ca250 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -1155,7 +1155,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen }
}
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
mir_tstrncpy(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 72eb87d11a..eaa7edc593 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -1401,9 +1401,9 @@ LBL_ErrFormat: else if ((pictureType = ProtoGetBufferFormat(body, 0)) == PA_FORMAT_UNKNOWN)
goto LBL_ErrFormat;
- PROTO_AVATAR_INFORMATION AI;
- AI.format = pictureType;
- AI.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai;
+ ai.format = pictureType;
+ ai.hContact = hContact;
TCHAR tszFileName[MAX_PATH];
if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
@@ -1420,7 +1420,7 @@ LBL_ErrFormat: mir_sha1_finish(&sha, digest);
GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy_s(AI.filename, tszFileName, _TRUNCATE);
+ _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE *out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
@@ -1429,10 +1429,10 @@ LBL_ErrFormat: char buffer[41];
setString(hContact, "AvatarSaved", bin2hex(digest, sizeof(digest), buffer));
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, HANDLE(&AI), NULL);
- debugLog(_T("Broadcast new avatar: %s"),AI.filename);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, HANDLE(&ai), NULL);
+ debugLog(_T("Broadcast new avatar: %s"),ai.filename);
}
- else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, HANDLE(&AI), NULL);
+ else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, HANDLE(&ai), NULL);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 45413a7e89..916a3ce87c 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -121,34 +121,34 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (!m_options.EnableAvatars)
return GAIR_NOAVATAR;
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- ptrA szHashValue( getStringA(AI->hContact, "AvatarHash"));
+ ptrA szHashValue( getStringA(pai->hContact, "AvatarHash"));
if (szHashValue == NULL) {
debugLogA("No avatar");
return GAIR_NOAVATAR;
}
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy_s(AI->filename, tszFileName, _TRUNCATE);
+ GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ _tcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
- AI->format = (AI->hContact == NULL) ? PA_FORMAT_PNG : getByte(AI->hContact, "AvatarType", 0);
+ pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0);
- if (::_taccess(AI->filename, 0) == 0) {
- ptrA szSavedHash( getStringA(AI->hContact, "AvatarSaved"));
+ if (::_taccess(pai->filename, 0) == 0) {
+ ptrA szSavedHash( getStringA(pai->hContact, "AvatarSaved"));
if (szSavedHash != NULL && !mir_strcmp(szSavedHash, szHashValue)) {
debugLogA("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
return GAIR_SUCCESS;
}
}
- if ((wParam & GAIF_FORCE) != 0 && AI->hContact != NULL && m_bJabberOnline) {
- ptrT tszJid( getTStringA(AI->hContact, "jid"));
+ if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL && m_bJabberOnline) {
+ ptrT tszJid( getTStringA(pai->hContact, "jid"));
if (tszJid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, tszJid);
if (item != NULL) {
- BOOL isXVcard = getByte(AI->hContact, "AvatarXVcard", 0);
+ BOOL isXVcard = getByte(pai->hContact, "AvatarXVcard", 0);
TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index a83d136e8e..b6a142b90f 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -935,17 +935,17 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) if (res->resultCode == 200 && res->dataLength) {
int pictureType = ProtoGetBufferFormat(res->pData);
if (pictureType != PA_FORMAT_UNKNOWN) {
- PROTO_AVATAR_INFORMATION AI;
- AI.format = pictureType;
- AI.hContact = avs[i].hContact;
+ PROTO_AVATAR_INFORMATION ai;
+ ai.format = pictureType;
+ ai.hContact = avs[i].hContact;
- if (getByte(AI.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
+ if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
DeleteFile(tszFileName);
}
- setByte(AI.hContact, "AvatarType", pictureType);
+ setByte(ai.hContact, "AvatarType", pictureType);
char buffer[2 * MIR_SHA1_HASH_SIZE + 1];
BYTE digest[MIR_SHA1_HASH_SIZE];
@@ -955,20 +955,20 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) mir_sha1_finish(&sha, digest);
bin2hex(digest, sizeof(digest), buffer);
- ptrA cmpsha(getStringA(AI.hContact, "AvatarSaved"));
+ ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy_s(AI.filename, tszFileName, _TRUNCATE);
+ GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE* out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
fwrite(res->pData, res->dataLength, 1, out);
fclose(out);
- setString(AI.hContact, "AvatarSaved", buffer);
- ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
- debugLog(_T("Broadcast new avatar: %s"), AI.filename);
+ setString(ai.hContact, "AvatarSaved", buffer);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
+ debugLog(_T("Broadcast new avatar: %s"), ai.filename);
}
- else ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
+ else ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
}
}
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 4236da9d89..28f74a6c45 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -87,12 +87,12 @@ void CMraProto::MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle) MRA_AVATARS_QUEUE *pmraaqAvatarsQueue = (MRA_AVATARS_QUEUE*)hAvatarsQueueHandle;
MRA_AVATARS_QUEUE_ITEM *pmraaqiAvatarsQueueItem;
- PROTO_AVATAR_INFORMATION pai = { 0 };
- pai.format = PA_FORMAT_UNKNOWN;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.format = PA_FORMAT_UNKNOWN;
while (FifoMTItemPop(pmraaqAvatarsQueue, NULL, (LPVOID*)&pmraaqiAvatarsQueueItem) == NO_ERROR) {
- pai.hContact = pmraaqiAvatarsQueueItem->hContact;
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, 0);
+ ai.hContact = pmraaqiAvatarsQueueItem->hContact;
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0);
mir_free(pmraaqiAvatarsQueueItem);
}
}
@@ -302,21 +302,21 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
}
- PROTO_AVATAR_INFORMATION pai;
+ PROTO_AVATAR_INFORMATION ai;
if (bFailed) {
DeleteFile(wszFileName);
- pai.hContact = pmraaqiAvatarsQueueItem->hContact;
- pai.format = PA_FORMAT_UNKNOWN;
- pai.filename[0] = 0;
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, 0);
+ ai.hContact = pmraaqiAvatarsQueueItem->hContact;
+ ai.format = PA_FORMAT_UNKNOWN;
+ ai.filename[0] = 0;
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0);
}
else {
- pai.hContact = pmraaqiAvatarsQueueItem->hContact;
- pai.format = dwAvatarFormat;
+ ai.hContact = pmraaqiAvatarsQueueItem->hContact;
+ ai.format = dwAvatarFormat;
if (db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH))
- mir_tstrncpy(pai.filename, wszFileName, SIZEOF(pai.filename));
+ _tcsncpy_s(ai.filename, wszFileName, _TRUNCATE);
else
- PathToRelativeT(wszFileName, pai.filename);
+ PathToRelativeT(wszFileName, ai.filename);
SetContactAvatarFormat(pmraaqiAvatarsQueueItem->hContact, dwAvatarFormat);
MraAvatarsSetContactTime(pmraaqiAvatarsQueueItem->hContact, "AvatarLastModifiedTime", &itAvatarLastModifiedTimeServer.stTime);
@@ -324,7 +324,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) if (pmraaqiAvatarsQueueItem->hContact == NULL) // proto avatar
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
- ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
+ ProtoBroadcastAck(pmraaqiAvatarsQueueItem->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
mir_free(pmraaqiAvatarsQueueItem);
}
@@ -551,16 +551,16 @@ DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWOR if ( !hAvatarsQueueHandle)
return GAIR_NOAVATAR;
- PROTO_AVATAR_INFORMATION pai = { 0 };
- pai.hContact = hContact;
- DWORD dwRetCode = MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, dwFlags, hContact, NULL, (DWORD*)&pai.format, pai.filename);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ DWORD dwRetCode = MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, dwFlags, hContact, NULL, (DWORD*)&ai.format, ai.filename);
if (dwRetCode != GAIR_SUCCESS)
return dwRetCode;
// write owner avatar file name to DB
if (hContact == NULL)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
return GAIR_SUCCESS;
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index abf84e465a..e97bfdf5ac 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -614,8 +614,8 @@ INT_PTR CMraProto::MraGetAvatarCaps(WPARAM wParam, LPARAM) INT_PTR CMraProto::MraGetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
if (lParam) {
- PROTO_AVATAR_INFORMATION *ppai = (PROTO_AVATAR_INFORMATION*)lParam;
- return (INT_PTR)MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, (DWORD)wParam, ppai->hContact, NULL, (DWORD*)&ppai->format, ppai->filename);
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
+ return (INT_PTR)MraAvatarsQueueGetAvatar(hAvatarsQueueHandle, (DWORD)wParam, pai->hContact, NULL, (DWORD*)&pai->format, pai->filename);
}
return GAIR_NOAVATAR;
}
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 199de8d362..9ca0fbadc3 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -76,20 +76,20 @@ LBL_Error: if (fmt == PA_FORMAT_UNKNOWN)
goto LBL_Error;
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.format = fmt;
- AI.hContact = p->hContact;
- MSN_GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename), szExt);
- _tremove(AI.filename);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.format = fmt;
+ ai.hContact = p->hContact;
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), szExt);
+ _tremove(ai.filename);
- int fileId = _topen(AI.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
+ int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId == -1)
goto LBL_Error;
_write(fileId, nlhrReply->pData, (unsigned)nlhrReply->dataLength);
_close(fileId);
- ProtoBroadcastAck(p->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
+ ProtoBroadcastAck(p->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
return true;
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 0d66012e0c..938c3b6ea7 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -1746,7 +1746,8 @@ void CMsnProto::MSN_InitSB(ThreadData* info, const char* szEmail) TranslateT("Chat session established by my request") :
TranslateT("Chat session established by contact request"), 0);
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai), cont->hContact };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = cont->hContact;
GetAvatarInfo(GAIF_FORCE, (LPARAM)&ai);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 67cb4b9f1a..ef844191b4 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -194,11 +194,10 @@ void CMsnProto::p2p_pictureTransferFailed(filetransfer* ft) case MSN_APPID_AVATAR:
case MSN_APPID_AVATAR2:
{
- PROTO_AVATAR_INFORMATION AI = { 0 };
- AI.cbSize = sizeof(AI);
- AI.hContact = ft->std.hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = ft->std.hContact;
delSetting(ft->std.hContact, "AvatarHash");
- ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
}
break;
}
@@ -233,13 +232,12 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) case MSN_APPID_AVATAR:
case MSN_APPID_AVATAR2:
{
- PROTO_AVATAR_INFORMATION AI = { 0 };
- AI.cbSize = sizeof(AI);
- AI.format = format;
- AI.hContact = ft->std.hContact;
- MSN_GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename), ext);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.format = format;
+ ai.hContact = ft->std.hContact;
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), ext);
- _trename(ft->std.tszCurrentFile, AI.filename);
+ _trename(ft->std.tszCurrentFile, ai.filename);
// Store also avatar hash
char *szAvatarHash = MSN_GetAvatarHash(ft->p2p_object);
@@ -247,9 +245,9 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) mir_free(szAvatarHash);
setString(ft->std.hContact, "PictSavedContext", ft->p2p_object);
- ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
+ ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
- debugLogA("Avatar for contact %08x saved to file '%s'", AI.hContact, T2Utf(AI.filename));
+ debugLogA("Avatar for contact %08x saved to file '%s'", ai.hContact, T2Utf(ai.filename));
}
break;
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 88ee42dba8..22fa3d1b6b 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -63,12 +63,12 @@ void CMsnProto::sttFakeAvatarAck(void* arg) INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION *AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
TCHAR filename[MAX_PATH];
MsnContact *cont = NULL;
- if (AI->hContact) {
- cont = Lists_Get(AI->hContact);
+ if (pai->hContact) {
+ cont = Lists_Get(pai->hContact);
if (cont == NULL) return GAIR_NOAVATAR;
/*
@@ -77,69 +77,69 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) */
}
- if (AI->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
+ if (pai->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
MSN_GetAvatarFileName(NULL, filename, SIZEOF(filename), NULL);
- AI->format = ProtoGetAvatarFormat(filename);
- if (AI->format != PA_FORMAT_UNKNOWN)
- mir_tstrcpy(AI->filename, filename);
- return AI->format == PA_FORMAT_UNKNOWN ? GAIR_NOAVATAR : GAIR_SUCCESS;
+ pai->format = ProtoGetAvatarFormat(filename);
+ if (pai->format != PA_FORMAT_UNKNOWN)
+ mir_tstrcpy(pai->filename, filename);
+ return pai->format == PA_FORMAT_UNKNOWN ? GAIR_NOAVATAR : GAIR_SUCCESS;
}
char *szContext;
DBVARIANT dbv;
- if (getString(AI->hContact, AI->hContact ? "PictContext" : "PictObject", &dbv) == 0) {
+ if (getString(pai->hContact, pai->hContact ? "PictContext" : "PictObject", &dbv) == 0) {
szContext = (char*)NEWSTR_ALLOCA(dbv.pszVal);
db_free(&dbv);
}
else return GAIR_NOAVATAR;
- MSN_GetAvatarFileName(AI->hContact, filename, SIZEOF(filename), NULL);
- AI->format = ProtoGetAvatarFormat(filename);
+ MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), NULL);
+ pai->format = ProtoGetAvatarFormat(filename);
- if (AI->format != PA_FORMAT_UNKNOWN) {
+ if (pai->format != PA_FORMAT_UNKNOWN) {
bool needupdate = true;
- if (getString(AI->hContact, "PictSavedContext", &dbv) == 0) {
+ if (getString(pai->hContact, "PictSavedContext", &dbv) == 0) {
needupdate = mir_strcmp(dbv.pszVal, szContext) != 0;
db_free(&dbv);
}
if (needupdate) {
- setString(AI->hContact, "PictSavedContext", szContext);
+ setString(pai->hContact, "PictSavedContext", szContext);
// Store also avatar hash
char* szAvatarHash = MSN_GetAvatarHash(szContext);
if (szAvatarHash != NULL) {
- setString(AI->hContact, "AvatarSavedHash", szAvatarHash);
+ setString(pai->hContact, "AvatarSavedHash", szAvatarHash);
mir_free(szAvatarHash);
}
}
- mir_tstrcpy(AI->filename, filename);
+ mir_tstrcpy(pai->filename, filename);
return GAIR_SUCCESS;
}
- if ((wParam & GAIF_FORCE) != 0 && AI->hContact != NULL) {
+ if ((wParam & GAIF_FORCE) != 0 && pai->hContact != NULL) {
if (avsPresent < 0) avsPresent = ServiceExists(MS_AV_SETMYAVATAR) != 0;
if (!avsPresent)
return GAIR_NOAVATAR;
- WORD wStatus = getWord(AI->hContact, "Status", ID_STATUS_OFFLINE);
+ WORD wStatus = getWord(pai->hContact, "Status", ID_STATUS_OFFLINE);
if (wStatus == ID_STATUS_OFFLINE) {
- delSetting(AI->hContact, "AvatarHash");
- PROTO_AVATAR_INFORMATION* fakeAI = new PROTO_AVATAR_INFORMATION;
- *fakeAI = *AI;
+ delSetting(pai->hContact, "AvatarHash");
+ PROTO_AVATAR_INFORMATION *fakeAI = new PROTO_AVATAR_INFORMATION;
+ *fakeAI = *pai;
ForkThread(&CMsnProto::sttFakeAvatarAck, fakeAI);
}
- else if (!getString(AI->hContact, "AvatarUrl", &dbv)) {
- pushAvatarRequest(AI->hContact, dbv.pszVal);
+ else if (!getString(pai->hContact, "AvatarUrl", &dbv)) {
+ pushAvatarRequest(pai->hContact, dbv.pszVal);
db_free(&dbv);
}
#ifdef OBSOLETE
- else if (p2p_getAvatarSession(AI->hContact) == NULL) {
+ else if (p2p_getAvatarSession(pai->hContact) == NULL) {
filetransfer* ft = new filetransfer(this);
- ft->std.hContact = AI->hContact;
+ ft->std.hContact = pai->hContact;
ft->p2p_object = mir_strdup(szContext);
- MSN_GetAvatarFileName(AI->hContact, filename, SIZEOF(filename), _T("unk"));
+ MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), _T("unk"));
ft->std.tszCurrentFile = mir_tstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index d94e1cf2c1..a058b65115 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -47,9 +47,9 @@ void CSkypeProto::ReloadAvatarInfo(MCONTACT hContact) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
return;
}
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.hContact = hContact;
- SvcGetAvatarInfo(0, (LPARAM)&AI);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ SvcGetAvatarInfo(0, (LPARAM)&ai);
}
void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg)
@@ -60,21 +60,21 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) if (response->resultCode != 200)
return;
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.format = ProtoGetBufferFormat(response->pData);
- setByte(hContact, "AvatarType", AI.format);
- GetAvatarFileName(hContact, AI.filename, SIZEOF(AI.filename));
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.format = ProtoGetBufferFormat(response->pData);
+ setByte(hContact, "AvatarType", ai.format);
+ GetAvatarFileName(hContact, ai.filename, SIZEOF(ai.filename));
- FILE *out = _tfopen(AI.filename, _T("wb"));
+ FILE *out = _tfopen(ai.filename, _T("wb"));
if (out == NULL) {
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
return;
}
fwrite(response->pData, 1, response->dataLength, out);
fclose(out);
setByte(hContact, "NeedNewAvatar", 0);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
}
void CSkypeProto::OnSentAvatar(const NETLIBHTTPREQUEST *response)
@@ -89,23 +89,23 @@ void CSkypeProto::OnSentAvatar(const NETLIBHTTPREQUEST *response) INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- ptrA szUrl(getStringA(AI->hContact, "AvatarUrl"));
+ ptrA szUrl(getStringA(pai->hContact, "AvatarUrl"));
if (szUrl == NULL)
return GAIR_NOAVATAR;
- AI->format = getByte(AI->hContact, "AvatarType", PA_FORMAT_JPEG);
+ pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG);
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
- if (::_taccess(AI->filename, 0) == 0 && !getBool(AI->hContact, "NeedNewAvatar", 0))
+ if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
return GAIR_SUCCESS;
if (IsOnline()) {
- PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, (void*)AI->hContact);
+ PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, (void*)pai->hContact);
debugLogA("Requested to read an avatar from '%s'", szUrl);
return GAIR_WAITFOR;
}
@@ -152,11 +152,11 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) else {
setTString(hContact, "AvatarUrl", tszUrl.GetBuffer());
setByte(hContact, "NeedNewAvatar", 1);
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.hContact = hContact;
- GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename));
- AI.format = ProtoGetAvatarFormat(AI.filename);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ ai.format = ProtoGetAvatarFormat(ai.filename);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
}
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 7b84a5fe0b..a8f40e5dde 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -44,8 +44,8 @@ void CSteamProto::CheckAvatarChange(MCONTACT hContact, std::string avatarUrl) if (!hContact)
{
- PROTO_AVATAR_INFORMATION pai = { sizeof(pai) };
- if (GetAvatarInfo(update_required ? GAIF_FORCE : 0, (LPARAM)&pai) != GAIR_WAITFOR)
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ if (GetAvatarInfo(update_required ? GAIF_FORCE : 0, (LPARAM)&ai) != GAIR_WAITFOR)
CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
}
else if (update_required)
@@ -144,7 +144,7 @@ INT_PTR CSteamProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) TCHAR* buf = (TCHAR*)wParam;
int size = (int)lParam;
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
switch (GetAvatarInfo(0, (LPARAM)&ai)) {
case GAIR_SUCCESS:
_tcsncpy(buf, ai.filename, size);
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index fd43933e72..fa6f2c0965 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -520,28 +520,28 @@ void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response) void CSteamProto::OnGotAvatar(const NETLIBHTTPREQUEST *response, void *arg) { - PROTO_AVATAR_INFORMATION pai = { sizeof(pai) }; - pai.hContact = (MCONTACT)arg; - GetDbAvatarInfo(pai); + PROTO_AVATAR_INFORMATION ai = { 0 }; + ai.hContact = (MCONTACT)arg; + GetDbAvatarInfo(ai); if (response == NULL || response->resultCode != HTTP_STATUS_OK) { - ptrA steamId(getStringA(pai.hContact, "SteamID")); + ptrA steamId(getStringA(ai.hContact, "SteamID")); debugLogA("CSteamProto::OnGotAvatar: failed to get avatar %s", steamId); - if (pai.hContact) - ProtoBroadcastAck(pai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, 0); + if (ai.hContact) + ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0); return; } - FILE *fp = _tfopen(pai.filename, _T("wb")); + FILE *fp = _tfopen(ai.filename, _T("wb")); if (fp) { fwrite(response->pData, sizeof(char), response->dataLength, fp); fclose(fp); - if (pai.hContact) - ProtoBroadcastAck(pai.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); + if (ai.hContact) + ProtoBroadcastAck(ai.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0); else CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0); } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index c078194007..a6adc2dc97 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -665,10 +665,10 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) char *avatarHash = NULL;
TLEN_LIST_ITEM *item = NULL;
DBVARIANT dbv;
- PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- if (AI->hContact != NULL) {
- if (!db_get(AI->hContact, m_szModuleName, "jid", &dbv)) {
+ if (pai->hContact != NULL) {
+ if (!db_get(pai->hContact, m_szModuleName, "jid", &dbv)) {
item = TlenListGetItemPtr(this, LIST_ROSTER, dbv.pszVal);
db_free(&dbv);
if (item != NULL) {
@@ -684,13 +684,13 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR;
if (avatarHash != NULL && !downloadingAvatar) {
- TlenGetAvatarFileName(this, item, AI->filename, SIZEOF(AI->filename)-1);
- AI->format = ( AI->hContact == NULL ) ? threadData->avatarFormat : item->avatarFormat;
+ TlenGetAvatarFileName(this, item, pai->filename, SIZEOF(pai->filename)-1);
+ pai->format = ( pai->hContact == NULL ) ? threadData->avatarFormat : item->avatarFormat;
return GAIR_SUCCESS;
}
/* get avatar */
- if (( wParam & GAIF_FORCE ) != 0 && AI->hContact != NULL && isOnline)
+ if (( wParam & GAIF_FORCE ) != 0 && pai->hContact != NULL && isOnline)
return GAIR_WAITFOR;
return GAIR_NOAVATAR;
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 80aabc8ea3..5683415486 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -232,14 +232,14 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) {
db_set_blob(transfer->pfts.hContact, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, transfer->hash, TOX_HASH_LENGTH);
- PROTO_AVATAR_INFORMATION pai = { sizeof(pai) };
- pai.format = PA_FORMAT_PNG;
- pai.hContact = transfer->pfts.hContact;
- mir_tstrcpy(pai.filename, transfer->pfts.tszCurrentFile);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.format = PA_FORMAT_PNG;
+ ai.hContact = transfer->pfts.hContact;
+ mir_tstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
transfer->hFile = NULL;
- ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
+ ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
transfers.Remove(transfer);
}
\ No newline at end of file diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 202daf9fbb..5bb7e52b51 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -403,7 +403,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str()); // local filename and path
db_free(&dbv);
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = data->hContact;
ai.format = ProtoGetAvatarFormat(filename.c_str());
@@ -442,7 +442,8 @@ void TwitterProto::UpdateAvatar(MCONTACT hContact, const std::string &url, bool else {
// TODO: more defaults (configurable?)
if (url == "http://static.twitter.com/images/default_profile_normal.png") {
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai), hContact };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
db_set_s(hContact, m_szModuleName, TWITTER_KEY_AV_URL, url.c_str());
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 60cf0b8df1..ef54de209f 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -22,20 +22,20 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq) if (reply->resultCode != 200)
return;
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- GetAvatarFileName((MCONTACT)pReq->pUserInfo, AI.filename, SIZEOF(AI.filename));
- AI.format = ProtoGetBufferFormat(reply->pData);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, SIZEOF(ai.filename));
+ ai.format = ProtoGetBufferFormat(reply->pData);
- FILE *out = _tfopen(AI.filename, _T("wb"));
+ FILE *out = _tfopen(ai.filename, _T("wb"));
if (out == NULL) {
- ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
+ ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
return;
}
fwrite(reply->pData, 1, reply->dataLength, out);
fclose(out);
setByte((MCONTACT)pReq->pUserInfo, "NeedNewAvatar", 0);
- ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
+ ProtoBroadcastAck((MCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
}
INT_PTR CVkProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam)
@@ -66,33 +66,33 @@ void CVkProto::ReloadAvatarInfo(MCONTACT hContact) CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
return;
}
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.hContact = hContact;
- SvcGetAvatarInfo(0, (LPARAM)&AI);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ SvcGetAvatarInfo(0, (LPARAM)&ai);
}
INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- ptrA szUrl(getStringA(AI->hContact, "AvatarUrl"));
+ ptrA szUrl(getStringA(pai->hContact, "AvatarUrl"));
if (szUrl == NULL)
return GAIR_NOAVATAR;
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
- AI->format = ProtoGetAvatarFormat(AI->filename);
+ pai->format = ProtoGetAvatarFormat(pai->filename);
- if (::_taccess(AI->filename, 0) == 0 && !getBool(AI->hContact, "NeedNewAvatar", 0))
+ if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
return GAIR_SUCCESS;
if (IsOnline()) {
AsyncHttpRequest *pReq = new AsyncHttpRequest();
pReq->flags = NLHRF_NODUMP | NLHRF_REDIRECT;
pReq->m_szUrl = szUrl;
- pReq->pUserInfo = (char*)AI->hContact;
+ pReq->pUserInfo = (char*)pai->hContact;
pReq->m_pFunc = &CVkProto::OnReceiveAvatar;
pReq->requestType = REQUEST_GET;
pReq->m_bApiReq = false;
@@ -109,15 +109,14 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
{
debugLogA("CVkProto::SvcGetMyAvatar");
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.hContact = NULL;
- if (SvcGetAvatarInfo(0, (LPARAM)&AI) != GAIR_SUCCESS)
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ if (SvcGetAvatarInfo(0, (LPARAM)&ai) != GAIR_SUCCESS)
return 1;
TCHAR* buf = (TCHAR*)wParam;
int size = (int)lParam;
- _tcsncpy(buf, AI.filename, size);
+ _tcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
return 0;
@@ -159,10 +158,10 @@ void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) else {
setTString(hContact, "AvatarUrl", tszUrl);
setByte(hContact,"NeedNewAvatar", 1);
- PROTO_AVATAR_INFORMATION AI = { sizeof(AI) };
- AI.hContact = hContact;
- GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename));
- AI.format = ProtoGetAvatarFormat(AI.filename);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ ai.format = ProtoGetAvatarFormat(ai.filename);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
}
\ No newline at end of file diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 3c5f10d102..35feb6d1ad 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -2,19 +2,19 @@ INT_PTR WhatsAppProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = (PROTO_AVATAR_INFORMATION*)lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- ptrA id(getStringA(AI->hContact, isChatRoom(AI->hContact) ? "ChatRoomID" : WHATSAPP_KEY_ID));
+ ptrA id(getStringA(pai->hContact, isChatRoom(pai->hContact) ? "ChatRoomID" : WHATSAPP_KEY_ID));
if (id == NULL)
return GAIR_NOAVATAR;
- std::tstring tszFileName = GetAvatarFileName(AI->hContact);
- _tcsncpy_s(AI->filename, tszFileName.c_str(), _TRUNCATE);
- AI->format = PA_FORMAT_JPEG;
+ std::tstring tszFileName = GetAvatarFileName(pai->hContact);
+ _tcsncpy_s(pai->filename, tszFileName.c_str(), _TRUNCATE);
+ pai->format = PA_FORMAT_JPEG;
- ptrA szAvatarId(getStringA(AI->hContact, WHATSAPP_KEY_AVATAR_ID));
+ ptrA szAvatarId(getStringA(pai->hContact, WHATSAPP_KEY_AVATAR_ID));
if (szAvatarId == NULL || (wParam & GAIF_FORCE) != 0)
- if (AI->hContact != NULL && m_pConnection != NULL) {
+ if (pai->hContact != NULL && m_pConnection != NULL) {
m_pConnection->sendGetPicture(id, "image");
return GAIR_WAITFOR;
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index caa0771f5b..3756fded33 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -165,7 +165,7 @@ void WhatsAppProto::onSendGetPicture(const std::string &jid, const std::vector<u size_t r = fwrite(std::string(data.begin(), data.end()).c_str(), 1, data.size(), f);
fclose(f);
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai) };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
ai.format = PA_FORMAT_JPEG;
_tcsncpy_s(ai.filename, filename.c_str(), _TRUNCATE);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index ef2bd0e77f..15907ac515 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1782,17 +1782,15 @@ void SetAvatar(void *arg) if (xsa->hContact == NULL)
return;
- if (GetAvatar(xsa->username, &av))
- {
- PROTO_AVATAR_INFORMATION AI;
- AI.format = av.type;
- AI.hContact = xsa->hContact;
- mir_tstrcpy(AI.filename, _A2T(av.file));
- ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ if (GetAvatar(xsa->username, &av)) {
+ PROTO_AVATAR_INFORMATION ai;
+ ai.format = av.type;
+ ai.hContact = xsa->hContact;
+ _tcsncpy_s(ai.filename, _A2T(av.file), _TRUNCATE);
+ ProtoBroadcastAck(protocolname, xsa->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
delete(xsa);
- //ReleaseMutex(hMutex);
lasttime -= sleep;
}
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 7d03146da4..26b9697d71 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -90,11 +90,11 @@ 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_INFORMATION AI;
- AI.format = type;
- AI.hContact = hcontact;
- mir_tstrcpy(AI.filename, _A2T(filename));
- ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ PROTO_AVATAR_INFORMATION ai;
+ ai.format = type;
+ ai.hContact = hcontact;
+ _tcsncpy_s(ai.filename, _A2T(filename), _TRUNCATE);
+ ProtoBroadcastAck(protocolname, hcontact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
else //eigenen avatar setzen
{
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 3290fefc69..436b133066 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -242,15 +242,15 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) free(avt->pic_url);
free(avt);
- PROTO_AVATAR_INFORMATION AI;
- AI.format = PA_FORMAT_PNG;
- AI.hContact = hContact;
- _tcsncpy(AI.filename, buf, SIZEOF(AI.filename)-1);
+ PROTO_AVATAR_INFORMATION ai;
+ ai.format = PA_FORMAT_PNG;
+ ai.hContact = hContact;
+ _tcsncpy_s(ai.filename, buf, _TRUNCATE);
if (error)
setDword(hContact, "PictCK", 0);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED,(HANDLE) &AI, 0);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED,(HANDLE) &ai, 0);
}
void CYahooProto::ext_got_picture(const char *me, const char *who, const char *pic_url, int cksum, int type)
@@ -617,11 +617,11 @@ void CYahooProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, int cbLen INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
{
- PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
+ PROTO_AVATAR_INFORMATION* pai = ( PROTO_AVATAR_INFORMATION* )lParam;
DBVARIANT dbv;
int avtType;
- if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) {
+ if (!getString(pai->hContact, YAHOO_LOGINID, &dbv)) {
debugLogA("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
db_free(&dbv);
}else {
@@ -634,7 +634,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) return GAIR_NOAVATAR;
}
- avtType = getByte(AI->hContact, "AvatarType", 0);
+ avtType = getByte(pai->hContact, "AvatarType", 0);
debugLogA("[YAHOO_GETAVATARINFO] Avatar Type: %d", avtType);
if ( avtType != 2) {
@@ -644,26 +644,26 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) return GAIR_NOAVATAR;
}
- if (getDword(AI->hContact, "PictCK", 0) == 0)
+ if (getDword(pai->hContact, "PictCK", 0) == 0)
return GAIR_NOAVATAR;
- GetAvatarFileName(AI->hContact, AI->filename, SIZEOF(AI->filename), getByte(AI->hContact, "AvatarType", 0));
- AI->format = PA_FORMAT_PNG;
- debugLogA("[YAHOO_GETAVATARINFO] filename: %s", AI->filename);
+ GetAvatarFileName(pai->hContact, pai->filename, SIZEOF(pai->filename), getByte(pai->hContact, "AvatarType", 0));
+ pai->format = PA_FORMAT_PNG;
+ debugLogA("[YAHOO_GETAVATARINFO] filename: %s", pai->filename);
- if (_taccess( AI->filename, 0) == 0)
+ if (_taccess( pai->filename, 0) == 0)
return GAIR_SUCCESS;
- if (( wParam & GAIF_FORCE ) != 0 && AI->hContact != NULL) {
+ if (( wParam & GAIF_FORCE ) != 0 && pai->hContact != NULL) {
/* need to request it again? */
- if (getDword(AI->hContact, "PictLoading", 0) != 0 &&
- (time(NULL) - getDword(AI->hContact, "PictLastCheck", 0) < 500)) {
+ if (getDword(pai->hContact, "PictLoading", 0) != 0 &&
+ (time(NULL) - getDword(pai->hContact, "PictLastCheck", 0) < 500)) {
debugLogA("[YAHOO_GETAVATARINFO] Waiting for avatar to load!");
return GAIR_WAITFOR;
} else if ( m_bLoggedIn ) {
DBVARIANT dbv;
- if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) {
+ if (!getString(pai->hContact, YAHOO_LOGINID, &dbv)) {
debugLogA("[YAHOO_GETAVATARINFO] Requesting avatar!");
request_avatar(dbv.pszVal);
|