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/MSN | |
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/MSN')
-rw-r--r-- | protocols/MSN/src/msn_avatar.cpp | 14 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 3 | ||||
-rw-r--r-- | protocols/MSN/src/msn_p2p.cpp | 22 | ||||
-rw-r--r-- | protocols/MSN/src/msn_svcs.cpp | 52 |
4 files changed, 45 insertions, 46 deletions
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);
|