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 /plugins | |
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 'plugins')
-rw-r--r-- | plugins/AVS/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/AVS/src/poll.cpp | 8 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/CheckFeed.cpp | 70 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 3 | ||||
-rw-r--r-- | plugins/Weather/src/weather_svcs.cpp | 28 |
5 files changed, 56 insertions, 57 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index a7e7e97d06..93a2d008e8 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -87,10 +87,10 @@ static int ProtocolAck(WPARAM, LPARAM lParam) if (ack->hProcess == NULL)
ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, NULL, ack->szModule);
else
- ProcessAvatarInfo(ack->hContact, GAIR_SUCCESS, (PROTO_AVATAR_INFORMATION *)ack->hProcess, ack->szModule);
+ ProcessAvatarInfo(ack->hContact, GAIR_SUCCESS, (PROTO_AVATAR_INFORMATION*)ack->hProcess, ack->szModule);
}
else if (ack->result == ACKRESULT_FAILED) {
- ProcessAvatarInfo(ack->hContact, GAIR_FAILED, (PROTO_AVATAR_INFORMATION *)ack->hProcess, ack->szModule);
+ ProcessAvatarInfo(ack->hContact, GAIR_FAILED, (PROTO_AVATAR_INFORMATION*)ack->hProcess, ack->szModule);
}
else if (ack->result == ACKRESULT_STATUS) {
char *szProto = GetContactProto(ack->hContact);
diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index a0d92ebc98..f0e237bfef 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -204,12 +204,12 @@ int FetchAvatarFor(MCONTACT hContact, char *szProto) if ((g_AvatarHistoryAvail && CallService(MS_AVATARHISTORY_ENABLED, hContact, 0)) || (PollCheckProtocol(szProto) && PollCheckContact(hContact)))
{
// Request it
- PROTO_AVATAR_INFORMATION pai_s = { 0 };
- pai_s.hContact = hContact;
- INT_PTR res = CallProtoService(szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&pai_s);
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
+ INT_PTR res = CallProtoService(szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai);
if (res != CALLSERVICE_NOTFOUND)
result = res;
- ProcessAvatarInfo(pai_s.hContact, result, &pai_s, szProto);
+ ProcessAvatarInfo(ai.hContact, result, &ai, szProto);
}
}
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 69d0050da0..68736cebdb 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -257,23 +257,23 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR url = xi.getText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- PROTO_AVATAR_INFORMATION pai = { NULL };
- pai.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick");
if (szNick) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = ProtoGetAvatarFormat(url);
+ ai.format = ProtoGetAvatarFormat(url);
CMString filename = szNick;
filename.Replace(_T("/"), _T("_"));
- mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext);
+ mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename.c_str(), ext);
CreateDirectoryTreeT(tszRoot);
- if (DownloadFile(url, pai.filename)) {
- db_set_ts(hContact, MODULE, "ImagePath", pai.filename);
- ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, NULL);
+ if (DownloadFile(url, ai.filename)) {
+ db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
+ ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
}
- else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, NULL);
+ else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, NULL);
mir_free(szNick);
break;
}
@@ -385,21 +385,20 @@ void CheckCurrentFeed(MCONTACT hContact) LPCTSTR url = xi.getText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick");
+ ptrT szNick(db_get_tsa(hContact, MODULE, "Nick"));
if (szNick) {
- PROTO_AVATAR_INFORMATION pai = { NULL };
- pai.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = ProtoGetAvatarFormat(ext);
+ ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
- if (DownloadFile(url, pai.filename)) {
- db_set_ts(hContact, MODULE, "ImagePath", pai.filename);
- ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, NULL);
+ mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ if (DownloadFile(url, ai.filename)) {
+ db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
+ ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
}
- else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, NULL);
- mir_free(szNick);
+ else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, NULL);
break;
}
}
@@ -530,21 +529,21 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) LPCTSTR url = xi.getText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- PROTO_AVATAR_INFORMATION pai = { NULL };
- pai.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick");
if (szNick) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = ProtoGetAvatarFormat(ext);
+ ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
- if (DownloadFile(url, pai.filename)) {
- db_set_ts(hContact, MODULE, "ImagePath", pai.filename);
- ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, NULL);
+ mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ if (DownloadFile(url, ai.filename)) {
+ db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
+ ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
}
- else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, NULL);
+ else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, NULL);
mir_free(szNick);
break;
}
@@ -563,22 +562,21 @@ void CheckCurrentFeedAvatar(MCONTACT hContact) LPCTSTR url = xi.getText(imageval);
db_set_ts(hContact, MODULE, "ImageURL", url);
- TCHAR *szNick = db_get_tsa(hContact, MODULE, "Nick");
+ ptrT szNick(db_get_tsa(hContact, MODULE, "Nick"));
if (szNick) {
- PROTO_AVATAR_INFORMATION pai = { NULL };
- pai.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = ProtoGetAvatarFormat(ext);
+ ai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = szNick;
- mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
- if (DownloadFile(url, pai.filename)) {
- db_set_ts(hContact, MODULE, "ImagePath", pai.filename);
- ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, NULL);
+ mir_sntprintf(ai.filename, SIZEOF(ai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
+ if (DownloadFile(url, ai.filename)) {
+ db_set_ts(hContact, MODULE, "ImagePath", ai.filename);
+ ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, NULL);
}
- else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&pai, NULL);
- mir_free(szNick);
+ else ProtoBroadcastAck(MODULE, hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, NULL);
break;
}
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 9571765c16..4bc091ccdc 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -979,7 +979,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_GETAVATAR:
{
- PROTO_AVATAR_INFORMATION ai = { sizeof(ai), dat->hContact };
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = dat->hContact;
CallProtoService(dat->szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai);
ShowAvatar(hwndDlg, dat);
}
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index c72ebf15bd..c5ce992c7e 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -131,7 +131,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam) TCHAR szSearchPath[MAX_PATH], *chop;
WORD status;
unsigned i;
- PROTO_AVATAR_INFORMATION* ai = ( PROTO_AVATAR_INFORMATION* )lParam;
+ PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
GetModuleFileName(GetModuleHandle(NULL), szSearchPath, SIZEOF(szSearchPath));
chop = _tcsrchr(szSearchPath, '\\');
@@ -139,7 +139,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (chop) *chop = '\0';
else szSearchPath[0] = 0;
- status = (WORD)db_get_w(ai->hContact, WEATHERPROTONAME, "StatusIcon",0);
+ status = (WORD)db_get_w(pai->hContact, WEATHERPROTONAME, "StatusIcon",0);
for (i=0; i<10; i++)
if (statusValue[i] == status)
break;
@@ -147,29 +147,29 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (i >= 10)
return GAIR_NOAVATAR;
- ai->format = PA_FORMAT_PNG;
- mir_sntprintf(ai->filename, SIZEOF(ai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
- if ( _taccess(ai->filename, 4) == 0)
+ pai->format = PA_FORMAT_PNG;
+ mir_sntprintf(pai->filename, SIZEOF(pai->filename), _T("%s\\Plugins\\Weather\\%s.png"), szSearchPath, statusStr[i]);
+ if ( _taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
- ai->format = PA_FORMAT_GIF;
- mir_sntprintf(ai->filename, SIZEOF(ai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
- if ( _taccess(ai->filename, 4) == 0)
+ pai->format = PA_FORMAT_GIF;
+ mir_sntprintf(pai->filename, SIZEOF(pai->filename), _T("%s\\Plugins\\Weather\\%s.gif"), szSearchPath, statusStr[i]);
+ if ( _taccess(pai->filename, 4) == 0)
return GAIR_SUCCESS;
- ai->format = PA_FORMAT_UNKNOWN;
- ai->filename[0] = 0;
+ pai->format = PA_FORMAT_UNKNOWN;
+ pai->filename[0] = 0;
return GAIR_NOAVATAR;
}
void AvatarDownloaded(MCONTACT hContact)
{
- PROTO_AVATAR_INFORMATION AI = {0};
- AI.hContact = hContact;
+ PROTO_AVATAR_INFORMATION ai = { 0 };
+ ai.hContact = hContact;
- if (WeatherGetAvatarInfo(GAIF_FORCE, (LPARAM)&AI) == GAIR_SUCCESS)
- ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
+ if (WeatherGetAvatarInfo(GAIF_FORCE, (LPARAM)&ai) == GAIR_SUCCESS)
+ ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
else
ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
|