From 40d145149e5d95415fde7c3927706f9dd447902c Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 30 Sep 2012 11:14:14 +0000 Subject: Fixed smiley cache folder (fixes #76) git-svn-id: http://svn.miranda-ng.org/main/trunk@1725 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SmileyAdd/src/download.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'plugins/SmileyAdd') diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 6da10b9525..ca228d8ee2 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -49,13 +49,10 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl) // initialize the netlib request nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_GET; - nlhr.flags = NLHRF_NODUMP; + nlhr.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT; nlhr.szUrl = (char*)szUrl; nlhr.nlc = hHttpDwnl; - if (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(0,9,0,5)) - nlhr.flags |= NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT; - // change the header so the plugin is pretended to be IE 6 + WinXP nlhr.headersCount = 2; nlhr.headers=(NETLIBHTTPHEADER*)alloca(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount); @@ -230,29 +227,27 @@ int FolderChanged(WPARAM, LPARAM) void GetSmileyCacheFolder(void) { - TCHAR defaultPath[MAX_PATH]; if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) { hFolder = FoldersRegisterCustomPathT("SmileyAdd", "Smiley Cache", MIRANDA_USERDATAT _T("\\SmileyCache")); - FoldersGetCustomPathT(hFolder, defaultPath, MAX_PATH, _T("")); + FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, _T("")); + hFolderHook = HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged); } else { TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\SmileyCache")); - lstrcpyn(defaultPath, tszFolder, SIZEOF(defaultPath)); + lstrcpyn(cachepath, tszFolder, MAX_PATH); mir_free(tszFolder); } - - hFolderHook = HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged); } void DownloadInit(void) { NETLIBUSER nlu = {0}; nlu.cbSize = sizeof(nlu); - nlu.flags = NUF_OUTGOING|NUF_HTTPCONNS|NUF_NOHTTPSOPTION; + nlu.flags = NUF_OUTGOING|NUF_HTTPCONNS|NUF_NOHTTPSOPTION|NUF_TCHAR; nlu.szSettingsModule = "SmileyAdd"; - nlu.szDescriptiveName = Translate("SmileyAdd HTTP connections"); + nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections"); hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); GetSmileyCacheFolder(); -- cgit v1.2.3