diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-11 10:41:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-11 10:41:37 +0000 |
commit | 94dcc72f13094157f344f284aec4edf0c0f5faa1 (patch) | |
tree | 74c078daadd4abe5aea9e9e0a73b4dd7c4a7fde1 /plugins/NewsAggregator | |
parent | 42ff2169dbddd25d06404623dba2fff222d17c73 (diff) |
ProtoGetAvatarFormat, ProtoGetAvatarFileFormat, ProtoGetBufferFormat, ProtoGetAvatarExtension - standard helpers for protocol avatars' processing instead of the zoo that existed previously
git-svn-id: http://svn.miranda-ng.org/main/trunk@5645 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator')
-rw-r--r-- | plugins/NewsAggregator/Src/CheckFeed.cpp | 8 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Common.h | 1 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Utils.cpp | 26 |
3 files changed, 4 insertions, 31 deletions
diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index 36ef8165a1..b0286357ce 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -177,7 +177,7 @@ VOID CheckCurrentFeed(HANDLE hContact) if (!db_get_ts(hContact, MODULE, "Nick", &dbVar)) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = GetImageFormat(ext);
+ pai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = dbVar.ptszVal;
mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
@@ -412,7 +412,7 @@ VOID CheckCurrentFeed(HANDLE hContact) if (!db_get_ts(hContact, MODULE, "Nick", &dbVar)) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = GetImageFormat(ext);
+ pai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = dbVar.ptszVal;
mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
@@ -639,7 +639,7 @@ VOID CheckCurrentFeedAvatar(HANDLE hContact) if (!db_get_ts(hContact, MODULE, "Nick", &dbVar)) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = GetImageFormat(ext);
+ pai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = dbVar.ptszVal;
mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
@@ -673,7 +673,7 @@ VOID CheckCurrentFeedAvatar(HANDLE hContact) if (!db_get_ts(hContact, MODULE, "Nick", &dbVar)) {
TCHAR *ext = _tcsrchr((TCHAR *)url, _T('.')) + 1;
- pai.format = GetImageFormat(ext);
+ pai.format = ProtoGetAvatarFormat(ext);
TCHAR *filename = dbVar.ptszVal;
mir_sntprintf(pai.filename, SIZEOF(pai.filename), _T("%s\\%s.%s"), tszRoot, filename, ext);
diff --git a/plugins/NewsAggregator/Src/Common.h b/plugins/NewsAggregator/Src/Common.h index fa9117462d..ed19e6b132 100644 --- a/plugins/NewsAggregator/Src/Common.h +++ b/plugins/NewsAggregator/Src/Common.h @@ -131,7 +131,6 @@ TCHAR* CheckFeed(TCHAR* tszURL, HWND hwndDlg); void UpdateMenu(BOOL State);
int ImportFeedsDialog();
VOID ClearText(TCHAR *&message);
-int GetImageFormat(const TCHAR *ext);
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal);
int StrReplace(TCHAR *lpszOld, TCHAR *lpszNew, TCHAR *&lpszStr);
void CreateAuthString(char *auth, HANDLE hContact, HWND hwndDlg);
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 336d67993d..a47e6d261f 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -58,32 +58,6 @@ static void arrayToHex(BYTE *data, size_t datasz, char *res) *resptr = '\0';
}
-int GetImageFormat(const TCHAR *ext)
-{
- if (!lstrcmp(ext, _T(".jpg")) || !lstrcmp(ext, _T(".jpeg")))
- return PA_FORMAT_JPEG;
-
- if (!lstrcmp(ext, _T(".png")))
- return PA_FORMAT_PNG;
-
- if (!lstrcmp(ext, _T(".gif")))
- return PA_FORMAT_GIF;
-
- if (!lstrcmp(ext, _T(".ico")))
- return PA_FORMAT_ICON;
-
- if (!lstrcmp(ext, _T(".bmp")))
- return PA_FORMAT_BMP;
-
- if (!lstrcmp(ext, _T(".swf")))
- return PA_FORMAT_SWF;
-
- if (!lstrcmp(ext, _T(".xml")))
- return PA_FORMAT_XML;
-
- return PA_FORMAT_UNKNOWN;
-}
-
VOID GetNewsData(TCHAR *tszUrl, char **szData, HANDLE hContact, HWND hwndDlg)
{
NETLIBHTTPREQUEST nlhr = {0};
|