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/NewsAggregator | |
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/NewsAggregator')
-rw-r--r-- | plugins/NewsAggregator/Src/CheckFeed.cpp | 70 |
1 files changed, 34 insertions, 36 deletions
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;
}
}
|