static void __cdecl loadFlash_Thread(void *p) { debug("Avatar thread executed...\n"); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); flash_avatar_item* fai = (flash_avatar_item*)p; IShockwaveFlash* flash = fai->pFlash; if ( _tcschr(fai->hFA.cUrl, '?') == NULL) { // make hash of url debug("Making TTH hash from URL...\n"); TigerHash th; th.update(fai->hFA.cUrl, _tcslen(fai->hFA.cUrl)); th.finalize(); // create local path name TCHAR name[MAX_PATH], path[MAX_PATH]; TCHAR tth[((TigerHash::HASH_SIZE * 8) / 5) + 2]; FOLDERSGETDATA fgd = {0}; fgd.cbSize = sizeof(FOLDERSGETDATA); fgd.nMaxPathSize = MAX_PATH; fgd.szPathT = path; fgd.flags = FF_TCHAR; if (!hAvatarsFolder || CallService(MS_FOLDERS_GET_PATH, (WPARAM)hAvatarsFolder, (LPARAM)&fgd)) { if(ServiceExists(MS_UTILS_REPLACEVARS)) mir_sntprintf(path, MAX_PATH, _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), _T("Flash")); else PathToAbsoluteT( _T("Flash"), path); } else { if(_tcslen(path) && path[_tcslen(path)-1]=='\\') path[_tcslen(path)-1] = 0; } CreateDirectory(path, NULL); // create directory if it doesn't exist mir_sntprintf(name, MAX_PATH, _T("%s\\%s.swf"), path, th.toBase32(tth)); // download remote file if it doesn't exist if (GetFileAttributes(name) == 0xFFFFFFFF) { debug("Downloading flash file...\n"); DownloadFlashFile( _T2A(fai->hFA.cUrl), name, 0); } // load and play local flash movie debug("Loading flash movie...\n"); flash->LoadMovie(0, _bstr_t(name).copy()); } Sleep(100); flash->Play(); // change flash frame according user's status int status; if (fai->hFA.hContact) status = db_get_w(fai->hFA.hContact, fai->getProto(), "Status", ID_STATUS_OFFLINE); else status = CallProtoService(fai->getProto(), PS_GETSTATUS, 0, 0); getFace(); flash->SetVariable(L"face.emotion", _bstr_t(face).copy()); flash->Release(); }