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/Gadu-Gadu | |
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/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 32 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 9 |
2 files changed, 20 insertions, 21 deletions
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);
|