diff options
| author | wishmaster51@gmail.com <wishmaster51@gmail.com@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2012-03-21 11:19:07 +0000 | 
|---|---|---|
| committer | wishmaster51@gmail.com <wishmaster51@gmail.com@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2012-03-21 11:19:07 +0000 | 
| commit | b8f2c313e8a97116e3ef1b17ddb09ac543fa016f (patch) | |
| tree | ca98e898faa16ad5f097c5cd7b29975c96a24ffe /Plugins | |
| parent | 0dabb49b6f96aadde130a0c86207ede6c2a757c1 (diff) | |
. 0.0.3.0
THIS REQUIRES MIRANDA IM 0.10 ALPHA #3 OR ABOVE!!
  + added x64 version
  + improved unicode support
  + added sounds
  + added more debug information
  * save position of avatar history dialog
  ! fixed crash with empty avatar history
  * BMP files are not converted to PNG any more
  * fixed Updater support
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@234 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins')
| -rw-r--r-- | Plugins/avatarhistory/AvatarDlg.cpp | 42 | ||||
| -rw-r--r-- | Plugins/avatarhistory/AvatarHistory.cpp | 266 | ||||
| -rw-r--r-- | Plugins/avatarhistory/AvatarHistory.h | 25 | ||||
| -rw-r--r-- | Plugins/avatarhistory/AvatarHistory.rc | 266 | ||||
| -rw-r--r-- | Plugins/avatarhistory/Docs/avatarhist_changelog.txt | 12 | ||||
| -rw-r--r-- | Plugins/avatarhistory/m_avatarhist.h | 2 | ||||
| -rw-r--r-- | Plugins/avatarhistory/options.cpp | 4 | ||||
| -rw-r--r-- | Plugins/avatarhistory/popup.cpp | 2 | ||||
| -rw-r--r-- | Plugins/utils/mir_buffer.h | 6 | ||||
| -rw-r--r-- | Plugins/utils/mir_options.cpp | 41 | ||||
| -rw-r--r-- | Plugins/utils/mir_options.h | 4 | 
11 files changed, 298 insertions, 372 deletions
| diff --git a/Plugins/avatarhistory/AvatarDlg.cpp b/Plugins/avatarhistory/AvatarDlg.cpp index ca56076..53772fd 100644 --- a/Plugins/avatarhistory/AvatarDlg.cpp +++ b/Plugins/avatarhistory/AvatarDlg.cpp @@ -25,7 +25,6 @@ Avatar History Plugin  extern HINSTANCE hInst;
  HANDLE hMenu = NULL; 
 -int OpenAvatarDialog(HANDLE hContact, char* fn);
  DWORD WINAPI AvatarDialogThread(LPVOID param);
  static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
  int ShowSaveDialog(HWND hwnd, TCHAR* fn);
 @@ -75,7 +74,7 @@ public:  int OpenAvatarDialog(HANDLE hContact, char* fn)
  {
  	DWORD dwId;
 -	struct AvatarDialogData* avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData));
 +	struct AvatarDialogData *avdlg = (struct AvatarDialogData*)malloc(sizeof(struct AvatarDialogData));
  	ZeroMemory(avdlg, sizeof(struct AvatarDialogData));
  	avdlg->hContact = hContact;
  	if (fn == NULL)
 @@ -140,10 +139,11 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l  			SetWindowLongPtr(hwnd, GWLP_USERDATA, (ULONG_PTR)data->hContact);
  			UpdateAvatarPic(hwnd);
 -			CheckDlgButton(hwnd, IDC_LOGUSER, (UINT)db_byte_get(data->hContact, "AvatarHistory", "LogToDisk", BST_INDETERMINATE));
 -			CheckDlgButton(hwnd, IDC_POPUPUSER, (UINT)db_byte_get(data->hContact, "AvatarHistory", "AvatarPopups", BST_INDETERMINATE));
 -			CheckDlgButton(hwnd, IDC_HISTORYUSER, (UINT)db_byte_get(data->hContact, "AvatarHistory", "LogToHistory", BST_INDETERMINATE));
 +			CheckDlgButton(hwnd, IDC_LOGUSER, (UINT)db_byte_get(data->hContact, MODULE_NAME, "LogToDisk", BST_INDETERMINATE));
 +			CheckDlgButton(hwnd, IDC_POPUPUSER, (UINT)db_byte_get(data->hContact, MODULE_NAME, "AvatarPopups", BST_INDETERMINATE));
 +			CheckDlgButton(hwnd, IDC_HISTORYUSER, (UINT)db_byte_get(data->hContact, MODULE_NAME, "LogToHistory", BST_INDETERMINATE));
  			ShowWindow(GetDlgItem(hwnd, IDC_OPENFOLDER), opts.log_per_contact_folders ? SW_SHOW : SW_HIDE);
 +			Utils_RestoreWindowPosition(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
  			TranslateDialogDefault(hwnd);
  			EnableDisableControls(hwnd);
  			free(data);
 @@ -158,6 +158,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l  		}
  		case WM_DESTROY:
  		{
 +			Utils_SaveWindowPosition(hwnd,NULL,MODULE_NAME,"AvatarHistoryDialog");
  			DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_BIG, 0));
  			DestroyIcon((HICON)SendMessage(hwnd, WM_SETICON, ICON_SMALL, 0));
  			HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
 @@ -203,7 +204,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l  			HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
  			HMENU submenu = GetSubMenu(menu, 0);
 -			CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0);
 +			TranslateMenu(submenu);
  			if (!UpdateAvatarPic(hwnd))
  			{
 @@ -319,29 +320,29 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l  					if(IsDlgButtonChecked(hwnd, IDC_POPUPUSER) != BST_INDETERMINATE)
  					{
 -						db_byte_set(hContact, "AvatarHistory", "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
 +						db_byte_set(hContact, MODULE_NAME, "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
  					}
  					else
  					{
 -						DBDeleteContactSetting(hContact, "AvatarHistory", "AvatarPopups");
 +						DBDeleteContactSetting(hContact, MODULE_NAME, "AvatarPopups");
  					}
  					if(IsDlgButtonChecked(hwnd, IDC_LOGUSER) != BST_INDETERMINATE)
  					{
 -						db_byte_set(hContact, "AvatarHistory", "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER));
 +						db_byte_set(hContact, MODULE_NAME, "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER));
  					}
  					else
  					{
 -						DBDeleteContactSetting(hContact, "AvatarHistory", "LogToDisk");
 +						DBDeleteContactSetting(hContact, MODULE_NAME, "LogToDisk");
  					}
  					if(IsDlgButtonChecked(hwnd, IDC_HISTORYUSER) != BST_INDETERMINATE)
  					{
 -						db_byte_set(hContact, "AvatarHistory", "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
 +						db_byte_set(hContact, MODULE_NAME, "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
  					}
  					else
  					{
 -						DBDeleteContactSetting(hContact, "AvatarHistory", "LogToHistory");
 +						DBDeleteContactSetting(hContact, MODULE_NAME, "LogToHistory");
  					}
  					CleanupAvatarPic(hwnd);
 @@ -366,7 +367,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l  						HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
  						HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  						GetContactFolder(avfolder, hContact);
 -						ShellExecute(NULL, db_byte_get(NULL, "AvatarHistory", "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL);
 +						ShellExecute(NULL, db_byte_get(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL);
  						return TRUE;
  					}
  				}
 @@ -477,7 +478,7 @@ int FillAvatarListFromDB(HWND list, HANDLE hContact)  				// Get file in disk
  				char path[MAX_PATH] = "";
 -				PathToAbsolute((char *) &dbei.pBlob[i+1], path);
 +				CallService(MS_UTILS_PATHTOABSOLUTE,(WPARAM) (char *) &dbei.pBlob[i+1],(LPARAM)path);
  				TCHAR *filename = mir_a2t(path);
  				// Add to list
 @@ -505,6 +506,7 @@ BOOL UpdateAvatarPic(HWND hwnd)  	HWND list = GetDlgItem(hwnd, IDC_AVATARLIST);
  	TCHAR *filename = GetCurrentSelFile(list);
 +	if(!filename) return 0;
  	HBITMAP avpic = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) filename, IMGL_TCHAR);
 @@ -593,7 +595,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn)  	ofn.lpstrFilter = filter;
  	ofn.nFilterIndex = 1;
 -	lstrcpy(file, _tcsrchr(fn, '\\')+1);
 +	lstrcpyn(file, _tcsrchr(fn, '\\')+1, sizeof(file));
  	ofn.lpstrFile = file;
  	ofn.nMaxFile = MAX_PATH;
 @@ -612,14 +614,10 @@ TCHAR* MyDBGetStringT(HANDLE hContact, char* module, char* setting, TCHAR* out,  	dbgcs.szModule = module;
  	dbgcs.szSetting = setting;
  	dbgcs.pValue = &dbv;
 +	dbv.type = DBVT_TCHAR;
 -#ifdef UNICODE
 -	dbv.type = DBVT_WCHAR;
 -#else
 -	dbv.type = DBVT_ASCIIZ;
 -#endif
  	dbv.ptszVal = out;
 -	dbv.cchVal = len;
 +	dbv.cchVal = (int) len;
  	if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&dbgcs) != 0)
  		return NULL;
  	else
 @@ -635,7 +633,7 @@ char * MyDBGetString(HANDLE hContact, char* module, char* setting, char * out, s  	dbgcs.pValue = &dbv;
  	dbv.type = DBVT_ASCIIZ;
  	dbv.pszVal = out;
 -	dbv.cchVal = len;
 +	dbv.cchVal = (int) len;
  	if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&dbgcs) != 0)
  	{
  		out[len-1] = '\0';
 diff --git a/Plugins/avatarhistory/AvatarHistory.cpp b/Plugins/avatarhistory/AvatarHistory.cpp index d16cf9f..ddddd63 100644 --- a/Plugins/avatarhistory/AvatarHistory.cpp +++ b/Plugins/avatarhistory/AvatarHistory.cpp @@ -36,7 +36,7 @@ HANDLE hFolder = NULL;  char *metacontacts_proto = NULL;
 -char profilePath[MAX_PATH];		// database profile path (read at startup only)
 +TCHAR profilePath[MAX_PATH];		// database profile path (read at startup only)
  TCHAR basedir[MAX_PATH];
  MM_INTERFACE mmi;
  int hLangpack = 0;
 @@ -48,10 +48,8 @@ int OptInit(WPARAM wParam,LPARAM lParam);  TCHAR * GetHistoryFolder(TCHAR *fn);
  TCHAR * GetProtocolFolder(TCHAR *fn, char *proto);
 -TCHAR * GetContactFolder(TCHAR *fn, HANDLE hContact);
  TCHAR * GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact);
 -void InitFolders();
  void InitMenuItem();
  void * GetHistoryEventText(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, int format);
 @@ -59,7 +57,7 @@ void * GetHistoryEventText(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, i  // Services
  static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam);
  static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam);
 -TCHAR * GetCachedAvatar(char *proto, char *hash);
 +TCHAR * GetCachedAvatar(char *proto, TCHAR *hash);
  BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut);
  #ifdef DBGPOPUPS
 @@ -78,12 +76,12 @@ PLUGININFOEX pluginInfo={  #else
  	"Avatar History (Ansi)",
  #endif
 -	PLUGIN_MAKE_VERSION(0,0,2,10),
 +	PLUGIN_MAKE_VERSION(0,0,3,0),
  	"This plugin keeps backups of all your contacts' avatar changes and/or shows popups",
  	"Matthew Wild (MattJ), Ricardo Pescuma Domenecci",
  	"mwild1@gmail.com",
 -	"© 2006-2007 Matthew Wild, Ricardo Pescuma Domenecci",
 -	"http://pescuma.mirandaim.ru/miranda/avatarhist",
 +	"© 2006-2012 Matthew Wild, Ricardo Pescuma Domenecci",
 +	"http://pescuma.org/miranda/avatarhist",
  	UNICODE_AWARE,
  	0,		//doesn't replace anything built-in
  #ifdef WIN64
 @@ -103,6 +101,11 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRese  extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
  {
 +	if(mirandaVersion < PLUGIN_MAKE_VERSION(0,10,0,3))
 +	{
 +		MessageBox(NULL,_T("AvatarHistory requires Miranda IM 0.10 Alpha #3 or later."),_T("Avatar History"),MB_OK);
 +		return NULL;
 +	}
  	mirVer = mirandaVersion;
  	return &pluginInfo;
  }
 @@ -211,22 +214,20 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)  	hServices[0] = CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
  	hServices[1] = CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
 -	if(CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)profilePath) != 0)
 -		strcpy(profilePath, "."); // Failed, use current dir
 -	_strlwr(profilePath);
 +	if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
 +		_tcscpy(profilePath, _T(".")); // Failed, use current dir
 +
 +	SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
 +	SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));
  	return 0;
  }
  static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
  {
 -#ifdef UNICODE
 -	mir_sntprintf(basedir, MAX_REGS(basedir), _T("%S\\Avatars History"), profilePath);
 -#else
  	mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);
 -#endif
 -	hFolder = (HANDLE)FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Avatar History"), 
 +	hFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Avatar History"), 
  		PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
  	hHooks[2] = HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
 @@ -249,18 +250,20 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam)  		upd.szUpdateURL = UPDATER_AUTOREGISTER;
 -		upd.szBetaVersionURL = "http://pescuma.mirandaim.ru/miranda/avatarhist_version.txt";
 -		upd.szBetaChangelogURL = "http://pescuma.mirandaim.ru/miranda/avatarhist#Changelog";
 +		upd.szBetaVersionURL = "http://pescuma.org/miranda/avatarhist_version.txt";
 +		upd.szBetaChangelogURL = "http://pescuma.org/miranda/avatarhist#Changelog";
  		upd.pbBetaVersionPrefix = (BYTE *)"Avatar History ";
 -		upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix);
 -#ifdef UNICODE
 -		upd.szBetaUpdateURL = "http://pescuma.mirandaim.ru/miranda/avatarhistW.zip";
 +		upd.cpbBetaVersionPrefix = (int) strlen((char *)upd.pbBetaVersionPrefix);
 +#ifdef WIN64
 +		upd.szBetaUpdateURL = "http://pescuma.org/miranda/avatarhist64.zip";
 +#elif UNICODE
 +		upd.szBetaUpdateURL = "http://pescuma.org/miranda/avatarhistW.zip";
  #else
 -		upd.szBetaUpdateURL = "http://pescuma.mirandaim.ru/miranda/avatarhist.zip";
 +		upd.szBetaUpdateURL = "http://pescuma.org/miranda/avatarhist.zip";
  #endif
  		upd.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfo, szCurrentVersion);
 -		upd.cpbVersion = strlen((char *)upd.pbVersion);
 +		upd.cpbVersion = (int) strlen((char *)upd.pbVersion);
          CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
  	}
 @@ -334,56 +337,7 @@ BOOL IsUnicodeAscii(const WCHAR * pBuffer, int nSize)  	return bResult;
  }
 -
 -int PathIsAbsolute(const char *path)
 -{
 -    if (!path || !(strlen(path) > 2)) 
 -        return 0;
 -    if ((path[1]==':'&&path[2]=='\\')||(path[0]=='\\'&&path[1]=='\\')) return 1;
 -    return 0;
 -}
 -
 -int PathToRelative(const char *pSrc, char *pOut)
 -{
 -    if (!pSrc||!strlen(pSrc)||strlen(pSrc)>MAX_PATH) return 0;
 -    if (!PathIsAbsolute(pSrc)) {
 -        mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
 -        return strlen(pOut);
 -    }
 -    else {
 -        char szTmp[MAX_PATH];
 -        mir_snprintf(szTmp, MAX_REGS(szTmp), "%s", pSrc);
 -        _strlwr(szTmp);
 -        if (strstr(szTmp, profilePath)) {
 -            mir_snprintf(pOut, MAX_PATH, "%s", pSrc + strlen(profilePath) + 1);
 -            return strlen(pOut);
 -        }
 -        else {
 -            mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
 -            return strlen(pOut);
 -        }
 -    }
 -
 -	return 0;
 -}
 -
 -int PathToAbsolute(char *pSrc, char *pOut) 
 -{
 -    if (!pSrc||!strlen(pSrc)||strlen(pSrc)>MAX_PATH) 
 -		return 0;
 -    if (PathIsAbsolute(pSrc)||!isalnum(pSrc[0])) 
 -	{
 -        mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
 -        return 1;
 -    }
 -    else 
 -	{
 -        mir_snprintf(pOut, MAX_PATH, "%s\\%s", profilePath, pSrc);
 -        return 1;
 -    }
 -}
 -
 -void ConvertToFilename(char *str, size_t size) {
 +void ConvertToFilename(TCHAR *str, size_t size) {
  	for(size_t i = 0; i < size && str[i] != '\0'; i++) {
  		switch(str[i]) {
  			case '/':
 @@ -395,12 +349,43 @@ void ConvertToFilename(char *str, size_t size) {  			case '<':
  			case '>':
  			case '|':
 -			case '.':
 +			//case '.':
  				str[i] = '_';
  		}
  	}
  }
 +void ErrorExit(HANDLE hContact,LPTSTR lpszFunction) 
 +{ 
 +    // Retrieve the system error message for the last-error code
 +
 +    LPVOID lpMsgBuf;
 +    LPVOID lpDisplayBuf;
 +    DWORD dw = GetLastError(); 
 +
 +    FormatMessage(
 +        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
 +        FORMAT_MESSAGE_FROM_SYSTEM |
 +        FORMAT_MESSAGE_IGNORE_INSERTS,
 +        NULL,
 +        dw,
 +        MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN),
 +        (LPTSTR) &lpMsgBuf,
 +        0, NULL );
 +
 +    // Display the error message and exit the process
 +
 +    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, 
 +        (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) * sizeof(TCHAR)); 
 +    StringCchPrintf((LPTSTR)lpDisplayBuf, 
 +        LocalSize(lpDisplayBuf) / sizeof(TCHAR),
 +        TEXT("%s failed with error %d: %s"), 
 +        lpszFunction, dw, lpMsgBuf); 
 +    ShowDebugPopup(hContact,TEXT("Error"),  (LPCTSTR)lpDisplayBuf); 
 +
 +    LocalFree(lpMsgBuf);
 +    LocalFree(lpDisplayBuf);
 +}
  #ifdef UNICODE
 @@ -415,6 +400,7 @@ void ConvertToFilename(char *str, size_t size) {  TCHAR * GetExtension(TCHAR *file)
  {
 +	if(file == NULL) return _T("");
  	TCHAR *ext = _tcsrchr(file, _T('.'));
  	if (ext != NULL)
  		ext++;
 @@ -436,43 +422,24 @@ void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename)  	if (!CreateShortcut(history_filename, shortcut))
  	{
 -		ShowPopup(hContact, _T("Avatar History"), _T("Unable to create shortcut"));
 +		ShowPopup(hContact, _T("Avatar History: Unable to create shortcut"), shortcut);
  	}
  	else
  	{
 -		ShowDebugPopup(hContact, _T("AVH Debug"), _T("Shortcut created successfully"));
 +		ShowDebugPopup(hContact, _T("AVH Debug: Shortcut created successfully"), shortcut);
  	}
  }
 -int CopyImageFile(TCHAR *old_file, TCHAR *new_file)
 +BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file)
  {
  	TCHAR *ext = GetExtension(old_file);
 +	mir_sntprintf(new_file, MAX_PATH, _T("%s.%s"), new_file, ext);
 -	if (lstrcmpi(ext, _T("bmp")) == 0 
 -		&& ServiceExists(MS_IMG_SAVE))
 -	{
 -		// Store as PNG
 -		mir_sntprintf(new_file, MAX_PATH, _T("%s.png"), new_file);
 -
 -		IMGSRVC_INFO ii = {0};
 -		ii.cbSize = sizeof(ii);
 -#ifdef UNICODE
 -		ii.wszName = new_file;
 -#else
 -		ii.szName = new_file;
 -#endif
 -		ii.hbm = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) old_file, IMGL_TCHAR);
 -		ii.dwMask = IMGI_HBITMAP;
 -		ii.fif = FIF_UNKNOWN;
 -		return CallService(MS_IMG_SAVE, (WPARAM) &ii, IMGL_TCHAR) != 1;
 -	}
 -	else
 -	{
 -		mir_sntprintf(new_file, MAX_PATH, _T("%s.%s"), new_file, ext);
 -
 -		return !CopyFile(old_file, new_file, TRUE);
 -	}
 +	BOOL ret = CopyFile(old_file, new_file, TRUE);
 +	if(!ret)
 +		ErrorExit(NULL,_T("CopyImageFile"));
 +	return !ret;
  }
  // fired when the contacts avatar changes
 @@ -495,37 +462,38 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  		return 0;
  	}
 -	char *proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
 +	char *proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
  	if (proto == NULL)
  	{
 -		ShowDebugPopup(NULL, _T("AVH Debug"), _T("Invalid protocol... skipping"));
 +		ShowDebugPopup(hContact, _T("AVH Debug"), _T("Invalid protocol... skipping"));
  		return 0;
  	}
  	else if (metacontacts_proto != NULL && strcmp(metacontacts_proto, proto) == 0)
  	{
 -		ShowDebugPopup(NULL, _T("AVH Debug"), _T("Ignoring metacontacts notification"));
 +		ShowDebugPopup(hContact, _T("AVH Debug"), _T("Ignoring metacontacts notification"));
  		return 0;
  	}
  	BOOL removed = (avatar == NULL && DBGetContactSettingWord(hContact, "ContactPhoto", "Format", 0) == 0);
 -	char oldhash[1024] = "";
 -	char * ret = MyDBGetString(hContact, "AvatarHistory", "AvatarHash", oldhash, sizeof(oldhash));
 +	TCHAR oldhash[1024] = _T("");
 +	TCHAR * ret = MyDBGetStringT(hContact, MODULE_NAME, "AvatarHash", oldhash, sizeof(oldhash));
  	BOOL first_time = (ret == NULL);
  	if(
 -		(avatar != NULL && !strcmp(oldhash, avatar->hash)) // Changed it
 +		(avatar != NULL && !_tcscmp(oldhash, avatar->hash)) // Changed it
  		|| (avatar == NULL && oldhash[0] == '\0') // Removed it
  		)
  	{
 -		ShowDebugPopup(NULL, "AVH Debug", "Hashes are the same... skipping");
 +		ShowDebugPopup(hContact, _T("AVH Debug"), _T("Hashes are the same... skipping"));
  		return 0;
  	}
  	if (removed)
  	{
 -		db_string_set(hContact, "AvatarHistory", "AvatarHash", "");
 +		SkinPlaySound("avatar_removed");
 +		DBWriteContactSettingTString(hContact, MODULE_NAME, "AvatarHash", _T(""));
  		if (!first_time && ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed)
  			ShowPopup(hContact, NULL, opts.popup_removed);
 @@ -535,14 +503,14 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  	}
  	else if (avatar == NULL)
  	{
 -		if (!strcmp(oldhash, "-"))
 +		if (!_tcscmp(oldhash, _T("-")))
  		{
 -			ShowDebugPopup(NULL, "AVH Debug", "Changed from a flash avatar to a flash avatar... skipping");
 +			ShowDebugPopup(hContact, _T("AVH Debug"), _T("Changed from a flash avatar to a flash avatar... skipping"));
  			return 0;
  		}
  		// Is a flash avatar or avs could not load it
 -		db_string_set(hContact, "AvatarHistory", "AvatarHash", "-");
 +		DBWriteContactSettingTString(hContact, MODULE_NAME, "AvatarHash", _T("-"));
  		if (!first_time && ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_changed)
  			ShowPopup(hContact, NULL, opts.popup_changed);
 @@ -552,7 +520,8 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  	}
  	else
  	{
 -		db_string_set(hContact, "AvatarHistory", "AvatarHash", avatar->hash);
 +		SkinPlaySound("avatar_changed");
 +		DBWriteContactSettingTString(hContact, "AvatarHistory", "AvatarHash", avatar->hash);
  		TCHAR history_filename[MAX_PATH] = _T("");
 @@ -562,27 +531,25 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  			{
  				if (opts.log_per_contact_folders)
  				{
 -					INPLACE_CHAR_TO_TCHAR(file, 1024, avatar->filename);
 -
  					GetOldStyleAvatarName(history_filename, hContact);
 -					if (CopyImageFile(file, history_filename))
 -						ShowPopup(hContact, _T("Avatar History"), _T("Unable to save avatar"));
 +					if (CopyImageFile(avatar->filename, history_filename))
 +						ShowPopup(hContact, _T("Avatar History: Unable to save avatar"), history_filename);
  					else
 -						ShowDebugPopup(hContact, _T("AVH Debug"), _T("File copied successfully"));
 +						ShowDebugPopup(hContact, _T("AVH Debug: File copied successfully"), history_filename);
  					if (ServiceExists(MS_MC_GETMETACONTACT)) 
  					{
 -						HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
 +						HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0);
  						if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
  						{
  							TCHAR filename[MAX_PATH] = _T("");
  							GetOldStyleAvatarName(filename, hMetaContact);
 -							if (CopyImageFile(file, filename))
 -								ShowPopup(hContact, _T("Avatar History"), _T("Unable to save avatar"));
 +							if (CopyImageFile(avatar->filename, filename))
 +								ShowPopup(hContact, _T("Avatar History: Unable to save avatar"), filename);
  							else
 -								ShowDebugPopup(hContact, _T("AVH Debug"), _T("File copied successfully"));
 +								ShowDebugPopup(hContact, _T("AVH Debug: File copied successfully"), filename);
  						}
  					}
  				}
 @@ -590,8 +557,8 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  			else
  			{
  				// See if we already have the avatar
 -				char hash[128];
 -				lstrcpynA(hash, avatar->hash, sizeof(hash));
 +				TCHAR hash[128];
 +				lstrcpyn(hash, avatar->hash, sizeof(hash));
  				ConvertToFilename(hash, sizeof(hash));
  				TCHAR *file = GetCachedAvatar(proto, hash);
 @@ -603,22 +570,18 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  				}
  				else
  				{
 -					// Needed because path in event is char*
 -					INPLACE_CHAR_TO_TCHAR(file, MAX_PATH, avatar->filename);
 -					TCHAR *ext = GetExtension(file);
 -
  					if (opts.log_keep_same_folder)
  						GetHistoryFolder(history_filename);
  					else
  						GetProtocolFolder(history_filename, proto);
  					mir_sntprintf(history_filename, MAX_REGS(history_filename), 
 -							_T("%s\\") _T(CS), history_filename, hash);
 +							_T("%s\\%s"), history_filename, hash);
 -					if (CopyImageFile(file, history_filename))
 -						ShowPopup(hContact, _T("Avatar History"), _T("Unable to save avatar"));
 +					if (CopyImageFile(avatar->filename, history_filename))
 +						ShowPopup(hContact, _T("Avatar History: Unable to save avatar"), history_filename);
  					else
 -						ShowDebugPopup(hContact, _T("AVH Debug"), _T("File copied successfully"));
 +						ShowDebugPopup(hContact, _T("AVH Debug: File copied successfully"), history_filename);
  				}
  				if (opts.log_per_contact_folders)
 @@ -627,7 +590,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  					if (ServiceExists(MS_MC_GETMETACONTACT)) 
  					{
 -						HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
 +						HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0);
  						if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
  							CreateOldStyleShortcut(hMetaContact, history_filename);
 @@ -644,8 +607,8 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam)  		{
  			char rel_path[MAX_PATH] = "";
  			INPLACE_TCHAR_TO_CHAR(tmp, MAX_PATH, history_filename);
 -			PathToRelative(tmp, rel_path);
 -			HistoryEvents_AddToHistoryEx(hContact, EVENTTYPE_AVATAR_CHANGE, 0, NULL, 0, (PBYTE) rel_path, strlen(rel_path) + 1, DBEF_READ);
 +			CallService(MS_UTILS_PATHTORELATIVE,(WPARAM)tmp,(LPARAM)rel_path);
 +			HistoryEvents_AddToHistoryEx(hContact, EVENTTYPE_AVATAR_CHANGE, 0, NULL, 0, (PBYTE) rel_path, (int) strlen(rel_path) + 1, DBEF_READ);
  		}
  	}
 @@ -671,19 +634,19 @@ static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam)  Get cached avatar
  wParam: (char *) protocol name
 -lParam: (char *) hash 
 +lParam: (TCHAR *) hash 
  return: (TCHAR *) NULL if none is found or the path to the avatar. You need to free this string 
          with mir_free.
  */
  static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
  {
 -	char hash[128];
 -	lstrcpynA(hash, (char *) lParam, sizeof(hash));
 +	TCHAR hash[128];
 +	lstrcpyn(hash, (TCHAR *) lParam, sizeof(hash));
  	ConvertToFilename(hash, sizeof(hash));
 -	return (int) GetCachedAvatar((char *) wParam, hash);
 +	return (INT_PTR) GetCachedAvatar((char *) wParam, hash);
  }
 -TCHAR * GetCachedAvatar(char *proto, char *hash)
 +TCHAR * GetCachedAvatar(char *proto, TCHAR *hash)
  {
  	TCHAR *ret = NULL;
  	TCHAR file[1024] = _T("");
 @@ -693,7 +656,7 @@ TCHAR * GetCachedAvatar(char *proto, char *hash)  	else
  		GetProtocolFolder(file, proto);
 -	mir_sntprintf(search, MAX_REGS(search), _T("%s\\") _T(CS) _T(".*"), file, hash);
 +	mir_sntprintf(search, MAX_REGS(search), _T("%s\\%s.*"), file, hash);
  	WIN32_FIND_DATA finddata;
  	HANDLE hFind = FindFirstFile(search, &finddata);
 @@ -763,7 +726,8 @@ int GetUIDFromHContact(HANDLE contact, TCHAR* uinout, size_t uinout_len)  TCHAR * GetHistoryFolder(TCHAR *fn)
  {
  	FoldersGetCustomPathT(hFolder, fn, MAX_PATH, basedir);
 -	CreateDirectory(fn, NULL);
 +	if(!CreateDirectory(fn, NULL))
 +		ErrorExit(NULL,_T("GetHistoryFolder"));
  	return fn;
  }
 @@ -777,7 +741,8 @@ TCHAR * GetProtocolFolder(TCHAR *fn, char *proto)  		proto = Translate("Unknown Protocol");
  	mir_sntprintf(fn, MAX_PATH, _T("%s\\") _T(CS), fn, proto);
 -	CreateDirectory(fn, NULL);
 +	if(!CreateDirectory(fn, NULL))
 +		ErrorExit(NULL,_T("CreateDirectory"));
  	return fn;
  }
 @@ -792,12 +757,14 @@ TCHAR * GetContactFolder(TCHAR *fn, HANDLE hContact)  	GetUIDFromHContact(hContact, uin, MAX_REGS(uin));
  	mir_sntprintf(fn, MAX_PATH, _T("%s\\%s"), fn, uin);
 -	CreateDirectory(fn, NULL);
 +	if(!CreateDirectory(fn, NULL))
 +		ErrorExit(hContact,_T("CreateDirectory"));
 +	ConvertToFilename(uin, sizeof(uin)); //added so that weather id's like "yw/CI0000" work
  #ifdef DBGPOPUPS
 -	char log[1024];
 -	mir_snprintf(log, MAX_REGS(log), "Path: " CS "\nProto: %s\nUIN: " CS, fn, proto, uin);
 -	ShowPopup(NULL, "AVH Debug: GetContactFolder", log);
 +	TCHAR log[1024];
 +	mir_sntprintf(log, MAX_REGS(log), _T("Path: %s\nProto: ") _T(CS) _T("\nUIN: %s"), fn, proto, uin);
 +	ShowPopup(hContact, _T("AVH Debug: GetContactFolder"), log);
  #endif
  	return fn;
 @@ -813,6 +780,7 @@ TCHAR * GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact)  		_T("%s\\%04d-%02d-%02d %02dh%02dm%02ds"), fn, 
  		curtime.wYear, curtime.wMonth, curtime.wDay, 
  		curtime.wHour, curtime.wMinute, curtime.wSecond);
 +	ShowDebugPopup(hContact,_T("AVH Debug: GetOldStyleAvatarName"),fn);
  	return fn;
  }
 @@ -850,6 +818,8 @@ BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut)          psl->Release(); 
      } 
 +	if(FAILED(hr))
 +		ErrorExit(NULL,_T("CreateShortcut"));
  	return SUCCEEDED(hr);
  }
 @@ -893,6 +863,8 @@ BOOL ResolveShortcut(TCHAR *shortcut, TCHAR *file)          psl->Release(); 
      }
 +	if(FAILED(hr))
 +		ErrorExit(NULL,_T("CreateShortcut"));
  	return SUCCEEDED(hr);
  }
 @@ -1000,7 +972,7 @@ void * GetHistoryEventText(HANDLE hContact, HANDLE hDbEvent, DBEVENTINFO *dbe, i  		if (dbe->pBlob[i] != 0)
  		{
  			char absFile[MAX_PATH] = "";
 -			PathToAbsolute((char *) & dbe->pBlob[i], absFile);
 +			CallService(MS_UTILS_PATHTOABSOLUTE,(WPARAM)(char *) & dbe->pBlob[i], (LPARAM)absFile);
  			HBITMAP hBmp = (HBITMAP) CallService(MS_IMG_LOAD, (WPARAM) absFile, 0);
  			if (hBmp != NULL)
 diff --git a/Plugins/avatarhistory/AvatarHistory.h b/Plugins/avatarhistory/AvatarHistory.h index 224a8a4..efc1d25 100644 --- a/Plugins/avatarhistory/AvatarHistory.h +++ b/Plugins/avatarhistory/AvatarHistory.h @@ -2,16 +2,16 @@  #include <windows.h>
  #include <stdio.h>
  #include <time.h>
 +#include <strsafe.h>
 -#define MIRANDA_CUSTOM_LP
 +#define MIRANDA_VER 0x0A00
  #include <newpluginapi.h>
  #include <m_clist.h>
  #include <m_skin.h>
  #include <m_avatars.h>
  #include <m_database.h>
  #include <m_system.h>
 -#include <m_protocols.h>
  #include <m_protosvc.h>
  #include <m_contacts.h>
  #include <m_popup.h>
 @@ -27,14 +27,12 @@  // Globals
  extern HINSTANCE hInst;
 -extern PLUGINLINK *pluginLink;
  extern HANDLE hMenu;
  extern DWORD mirVer;
  #include "resource.h"
  #include "m_avatarhist.h"
 -#include "../utils/mir_memory.h"
  #include "../utils/mir_buffer.h"
  #include "../historyevents/m_historyevents.h"
 @@ -51,11 +49,10 @@ extern DWORD mirVer;  #define AVH_DEF_DEFPOPUPS 0
  #define AVH_DEF_SHOWMENU 1
 -#define DEFAULT_TEMPLATE_REMOVED "removed his/her avatar"
 -#define DEFAULT_TEMPLATE_CHANGED "changed his/her avatar"
 +#define DEFAULT_TEMPLATE_REMOVED LPGENT("removed his/her avatar")
 +#define DEFAULT_TEMPLATE_CHANGED LPGENT("changed his/her avatar")
  TCHAR * MyDBGetStringT(HANDLE hContact, char* module, char* setting, TCHAR* out, size_t len);
 -char * MyDBGetString(HANDLE hContact, char* module, char* setting, char * out, size_t len);
  void LoadOptions();
   // from icolib.cpp
 @@ -104,18 +101,4 @@ extern Options opts;  #include "popup.h"
 -#ifdef UNICODE
 -
 -#define TCHAR_TO_CHAR(dest, orig)	mir_snprintf(dest, MAX_REGS(dest), "%S", orig)
 -#define CHAR_TO_TCHAR(dest, orig)	mir_sntprintf(dest, MAX_REGS(dest), "%S", orig)
 -
 -#else
 -
 -#define TCHAR_TO_CHAR(dest, orig)	lstrcpynA(dest, orig, MAX_REGS(dest))
 -#define CHAR_TO_TCHAR(dest, orig)	lstrcpynA(dest, orig, MAX_REGS(dest))
 -
 -#endif
 -
 -
 -int PathToAbsolute(char *pSrc, char *pOut);
  BOOL ContactEnabled(HANDLE hContact, char *setting, int def);
 diff --git a/Plugins/avatarhistory/AvatarHistory.rc b/Plugins/avatarhistory/AvatarHistory.rc index 817d173..9fbde35 100644 --- a/Plugins/avatarhistory/AvatarHistory.rc +++ b/Plugins/avatarhistory/AvatarHistory.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script.
 +// Microsoft Visual C++ generated resource script.
  //
  #include "resource.h"
 @@ -13,172 +13,122 @@  #undef APSTUDIO_READONLY_SYMBOLS
  /////////////////////////////////////////////////////////////////////////////
 -// Portuguese (Brazil) resources
 +// Neutral resources
 -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PTB)
 -#ifdef _WIN32
 -LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
  #pragma code_page(1252)
 -#endif //_WIN32
  /////////////////////////////////////////////////////////////////////////////
  //
  // Menu
  //
 -IDR_MENU1 MENU DISCARDABLE 
 +IDR_MENU1 MENU
  BEGIN
      POPUP "Avatar List Popup"
      BEGIN
          MENUITEM "Save As...",                  ID_AVATARLISTPOPUP_SAVEAS
          MENUITEM "Delete this entry",           ID_AVATARLISTPOPUP_DELETE
 -        MENUITEM "Delete this entry and the bitmap file", 
 -                                                ID_AVATARLISTPOPUP_DELETE_BOTH
 -
 +        MENUITEM "Delete this entry and the bitmap file", ID_AVATARLISTPOPUP_DELETE_BOTH
      END
  END
 -#endif    // Portuguese (Brazil) resources
 -/////////////////////////////////////////////////////////////////////////////
 -
 -
 -/////////////////////////////////////////////////////////////////////////////
 -// English (U.K.) resources
 -
 -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
 -#ifdef _WIN32
 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 -#pragma code_page(1252)
 -#endif //_WIN32
  /////////////////////////////////////////////////////////////////////////////
  //
  // Dialog
  //
 -IDD_AVATARDLG DIALOG DISCARDABLE  0, 0, 216, 142
 -STYLE DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | 
 -    WS_CAPTION | WS_SYSMENU
 +IDD_AVATARDLG DIALOGEX 0, 0, 216, 166
 +STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  CAPTION "Avatar History"
 -FONT 8, "MS Shell Dlg"
 +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  BEGIN
 -    LISTBOX         IDC_AVATARLIST,7,7,120,74,LBS_NOINTEGRALHEIGHT | 
 -                    WS_VSCROLL | WS_TABSTOP
 -    CONTROL         "",IDC_AVATAR,"Static",SS_BITMAP | SS_NOTIFY | 
 -                    SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_SUNKEN,131,7,78,
 -                    74
 +    LISTBOX         IDC_AVATARLIST,7,7,110,74,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
 +    CONTROL         "",IDC_AVATAR,"Static",SS_BITMAP | SS_NOTIFY | SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_SUNKEN,125,7,84,74
      PUSHBUTTON      "Open Folder",IDC_OPENFOLDER,6,81,49,14
      PUSHBUTTON      "<",IDC_BACK,138,82,31,10,BS_CENTER | BS_VCENTER
      PUSHBUTTON      ">",IDC_NEXT,172,82,31,10,BS_CENTER | BS_VCENTER
      CONTROL         "Store this user's old avatars in disk",IDC_LOGUSER,
 -                    "Button",BS_AUTO3STATE | WS_TABSTOP,7,100,147,10
 -    CONTROL         "Log this user's avatars changes to history",
 -                    IDC_HISTORYUSER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,
 -                    112,147,10
 -    CONTROL         "Show popups for this user",IDC_POPUPUSER,"Button",
 -                    BS_AUTO3STATE | WS_TABSTOP,7,124,147,10
 -    DEFPUSHBUTTON   "OK",IDOK,159,121,50,14
 +                    "Button",BS_AUTO3STATE | WS_TABSTOP,7,100,202,10
 +    CONTROL         "Log this user's avatars changes to history",IDC_HISTORYUSER,
 +                    "Button",BS_AUTO3STATE | WS_TABSTOP,7,112,202,10
 +    CONTROL         "Show popups for this user",IDC_POPUPUSER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,124,202,10
 +    DEFPUSHBUTTON   "OK",IDOK,73,138,50,14
  END
 -IDD_OPTIONS DIALOGEX 0, 0, 314, 109
 -STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
 +IDD_OPTIONS DIALOGEX 0, 0, 314, 173
 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
  EXSTYLE WS_EX_CONTROLPARENT
 -FONT 8, "MS Shell Dlg"
 +FONT 8, "MS Shell Dlg", 0, 0, 0x1
  BEGIN
 -    GROUPBOX        " Protocols ",IDC_PROTOCOLS_G,3,3,308,103
 -    LTEXT           "Enable tracking for these protocols:",IDC_PROTOCOLS_L,
 -                    13,17,157,11
 -    CONTROL         "List1",IDC_PROTOCOLS,"SysListView32",LVS_REPORT | 
 -                    LVS_SINGLESEL | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | 
 -                    LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,12,29,158,70
 -    LTEXT           "MetaContacts have special handling: the info is always copied from subcontacts (notifications from a meta are ignored)",
 -                    IDC_STATIC,181,29,124,70
 +    GROUPBOX        "Protocols",IDC_PROTOCOLS_G,3,3,308,157
 +    LTEXT           "Enable tracking for these protocols:",IDC_PROTOCOLS_L,13,17,157,11
 +    CONTROL         "List1",IDC_PROTOCOLS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,12,31,158,119
 +    LTEXT           "MetaContacts have special handling: the info is always copied from subcontacts (notifications from a meta are ignored)",IDC_STATIC,181,31,124,119
  END
 -IDD_POPUPS DIALOGEX 0, 0, 314, 240
 -STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
 +IDD_POPUPS DIALOGEX 0, 0, 314, 235
 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
  EXSTYLE WS_EX_CONTROLPARENT
 -FONT 8, "MS Shell Dlg"
 +FONT 8, "MS Shell Dlg", 0, 0, 0x1
  BEGIN
      CONTROL         "Show popup when a contact change his avatar",IDC_POPUPS,
                      "Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,3,308,12
 -    GROUPBOX        " Colours ",IDC_COLOURS_G,3,25,158,75
 -    CONTROL         "",IDC_BGCOLOR,"ColourPicker",WS_TABSTOP,11,37,35,14
 -    LTEXT           "Background colour",IDC_BGCOLOR_L,55,41,66,8
 -    CONTROL         "",IDC_TEXTCOLOR,"ColourPicker",WS_TABSTOP,11,55,35,14
 -    LTEXT           "Text colour",IDC_TEXTCOLOR_L,55,59,66,8
 -    CONTROL         "Use Windows colours",IDC_WINCOLORS,"Button",
 -                    BS_AUTOCHECKBOX | WS_TABSTOP,11,74,108,10
 -    CONTROL         "Use default colours",IDC_DEFAULTCOLORS,"Button",
 -                    BS_AUTOCHECKBOX | WS_TABSTOP,11,84,107,10
 -    GROUPBOX        " Delay ",IDC_DELAY_G,166,25,145,75
 -    CONTROL         "From popup plugin",IDC_DELAYFROMPU,"Button",
 -                    BS_AUTORADIOBUTTON | WS_GROUP,175,38,122,10
 -    CONTROL         "Custom",IDC_DELAYCUSTOM,"Button",BS_AUTORADIOBUTTON,175,
 -                    52,54,10
 -    CONTROL         "Permanent",IDC_DELAYPERMANENT,"Button",
 -                    BS_AUTORADIOBUTTON,175,66,122,10
 -    EDITTEXT        IDC_DELAY,233,50,31,14,ES_AUTOHSCROLL | ES_NUMBER
 -    CONTROL         "Spin1",IDC_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT | 
 -                    UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | 
 -                    UDS_HOTTRACK,268,51,11,11
 -    GROUPBOX        " Actions ",IDC_ACTIONS_G,3,103,308,47
 -    RTEXT           "On right click:",IDC_RIGHT_ACTION_L,13,118,62,9
 -    COMBOBOX        IDC_RIGHT_ACTION,83,116,156,60,CBS_DROPDOWNLIST | 
 -                    WS_VSCROLL | WS_TABSTOP
 -    RTEXT           "On left click:",IDC_LEFT_ACTION_L,13,132,62,9
 -    COMBOBOX        IDC_LEFT_ACTION,83,132,156,60,CBS_DROPDOWNLIST | 
 -                    WS_VSCROLL | WS_TABSTOP
 -    GROUPBOX        " Track ",IDC_TRACK_G,3,153,308,47
 -    CONTROL         "Avatar change:",IDC_CHANGED_L,"Button",BS_AUTOCHECKBOX | 
 -                    WS_TABSTOP,11,166,89,10
 -    EDITTEXT        IDC_CHANGED,105,166,201,13,ES_AUTOHSCROLL
 -    CONTROL         "Avatar removal:",IDC_REMOVED_L,"Button",BS_AUTOCHECKBOX | 
 -                    WS_TABSTOP,11,183,89,10
 -    EDITTEXT        IDC_REMOVED,105,183,201,13,ES_AUTOHSCROLL
 -    PUSHBUTTON      "Preview",IDC_PREV,131,213,50,14
 +    GROUPBOX        "Colours",IDC_COLOURS_G,3,25,158,75
 +    CONTROL         "",IDC_BGCOLOR,"ColourPicker",WS_TABSTOP,12,37,34,14
 +    LTEXT           "Background colour",IDC_BGCOLOR_L,55,41,89,8
 +    CONTROL         "",IDC_TEXTCOLOR,"ColourPicker",WS_TABSTOP,12,55,34,14
 +    LTEXT           "Text colour",IDC_TEXTCOLOR_L,55,59,89,8
 +    CONTROL         "Use Windows colours",IDC_WINCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,132,10
 +    CONTROL         "Use default colours",IDC_DEFAULTCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,84,132,10
 +    GROUPBOX        "Delay",IDC_DELAY_G,166,25,145,75
 +    CONTROL         "From popup plugin",IDC_DELAYFROMPU,"Button",BS_AUTORADIOBUTTON | WS_GROUP,174,38,131,10
 +    CONTROL         "Custom",IDC_DELAYCUSTOM,"Button",BS_AUTORADIOBUTTON,174,52,131,10
 +    CONTROL         "Permanent",IDC_DELAYPERMANENT,"Button",BS_AUTORADIOBUTTON,174,82,131,10
 +    EDITTEXT        IDC_DELAY,208,65,31,14,ES_AUTOHSCROLL | ES_NUMBER
 +    CONTROL         "Spin1",IDC_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,239,67,11,11
 +    GROUPBOX        "Actions",IDC_ACTIONS_G,3,103,308,47
 +    RTEXT           "On right click:",IDC_RIGHT_ACTION_L,13,118,131,9
 +    COMBOBOX        IDC_RIGHT_ACTION,149,116,156,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
 +    RTEXT           "On left click:",IDC_LEFT_ACTION_L,13,132,131,9
 +    COMBOBOX        IDC_LEFT_ACTION,149,132,156,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
 +    GROUPBOX        "Track",IDC_TRACK_G,3,153,308,47
 +    CONTROL         "Avatar change:",IDC_CHANGED_L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,166,89,10
 +    EDITTEXT        IDC_CHANGED,105,166,200,13,ES_AUTOHSCROLL
 +    CONTROL         "Avatar removal:",IDC_REMOVED_L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,183,89,10
 +    EDITTEXT        IDC_REMOVED,105,183,200,13,ES_AUTOHSCROLL
 +    PUSHBUTTON      "Preview",IDC_PREV,132,206,50,14
  END
 -IDD_FIRST_RUN DIALOG DISCARDABLE  0, 0, 338, 251
 -STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_VISIBLE | 
 -    WS_CAPTION | WS_SYSMENU
 +IDD_FIRST_RUN DIALOGEX 0, 0, 451, 253
 +STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
  CAPTION "Avatar History: Select how to store history avatars"
 -FONT 8, "MS Shell Dlg"
 +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  BEGIN
 -    LTEXT           "Please select how the avatar history should be stored. This setting can NOT be changed in future, because it would cause all previous history to be lost.",
 -                    IDC_STATIC,7,7,324,25
 -    CONTROL         "Store history in miranda history and all history avatars in same folder",
 -                    IDC_MIR_SAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP,7,33,
 -                    324,11
 -    CONTROL         "Store history in miranda history and history avatars in per protocol folders",
 -                    IDC_MIR_PROTO,"Button",BS_AUTORADIOBUTTON,7,66,324,11
 -    CONTROL         "Store history in miranda history and history avatars in per contact folders using shortcuts",
 -                    IDC_MIR_SHORT,"Button",BS_AUTORADIOBUTTON,7,99,324,11
 -    CONTROL         "Store history avatars in per contact folders using shortcuts",
 -                    IDC_SHORT,"Button",BS_AUTORADIOBUTTON,7,140,324,11
 +    LTEXT           "Please select how the avatar history should be stored. This setting can NOT be changed in future, because it would cause all previous history to be lost.",IDC_STATIC,15,7,416,23
 +    CONTROL         "Store history in miranda history and all history avatars in same folder",IDC_MIR_SAME,
 +                    "Button",BS_AUTORADIOBUTTON | WS_GROUP,15,32,416,11
 +    CONTROL         "Store history in miranda history and history avatars in per protocol folders",IDC_MIR_PROTO,
 +                    "Button",BS_AUTORADIOBUTTON,15,66,416,11
 +    CONTROL         "Store history in miranda history and history avatars in per contact folders using shortcuts",IDC_MIR_SHORT,
 +                    "Button",BS_AUTORADIOBUTTON,15,99,416,11
 +    CONTROL         "Store history avatars in per contact folders using shortcuts",IDC_SHORT,
 +                    "Button",BS_AUTORADIOBUTTON,15,140,416,11
      CONTROL         "Store history avatars in per contact folders",IDC_DUP,
 -                    "Button",BS_AUTORADIOBUTTON,7,181,324,11
 -    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",
 -                    IDC_STATIC,20,44,311,10
 -    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Avatar Hash>",
 -                    IDC_STATIC,20,54,311,10
 -    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",
 -                    IDC_STATIC,20,77,311,10
 -    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash>",
 -                    IDC_STATIC,20,87,311,10
 -    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",
 -                    IDC_STATIC,20,110,311,10
 -    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash> and have a shortcut per history entry in <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp>",
 -                    IDC_STATIC,20,120,311,18
 -    LTEXT           "History is stored only in disk. It can be seen by Avatar History internal viewer.",
 -                    IDC_STATIC,20,151,311,10
 -    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash> and have a shortcut per history entry in <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp>",
 -                    IDC_STATIC,20,161,311,18
 -    LTEXT           "History is stored only in disk. It can be seen by Avatar History internal viewer.",
 -                    IDC_STATIC,20,192,311,10
 -    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp> (the same image can be stored lot of times)",
 -                    IDC_STATIC,20,202,311,18
 -    DEFPUSHBUTTON   "OK",IDOK,151,230,50,14
 +                    "Button",BS_AUTORADIOBUTTON,15,181,416,11
 +    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",IDC_STATIC,15,44,416,10
 +    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Avatar Hash>",IDC_STATIC,15,54,416,10
 +    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",IDC_STATIC,15,77,416,10
 +    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash>",IDC_STATIC,15,87,416,10
 +    LTEXT           "History is stored inside miranda db. It can be seen by History++ or Avatar History internal viewer.",IDC_STATIC,15,110,416,10
 +    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash> and have a shortcut per history entry in <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp>",IDC_STATIC,15,120,416,18
 +    LTEXT           "History is stored only in disk. It can be seen by Avatar History internal viewer.",IDC_STATIC,15,151,416,10
 +    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Avatar Hash> and have a shortcut per history entry in <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp>",IDC_STATIC,15,161,416,18
 +    LTEXT           "History is stored only in disk. It can be seen by Avatar History internal viewer.",IDC_STATIC,15,192,416,10
 +    LTEXT           "All avatars are stored as <Profile>\\Avatars History\\<Protocol>\\<Contact ID>\\<Timestamp> (the same image can be stored lot of times)",IDC_STATIC,15,203,416,18
 +    DEFPUSHBUTTON   "OK",IDOK,151,232,50,14
  END
 @@ -188,14 +138,15 @@ END  //
  #ifdef APSTUDIO_INVOKED
 -GUIDELINES DESIGNINFO DISCARDABLE 
 +GUIDELINES DESIGNINFO
  BEGIN
      IDD_AVATARDLG, DIALOG
      BEGIN
          LEFTMARGIN, 7
          RIGHTMARGIN, 209
 +        VERTGUIDE, 203
          TOPMARGIN, 7
 -        BOTTOMMARGIN, 135
 +        BOTTOMMARGIN, 159
      END
      IDD_OPTIONS, DIALOG
 @@ -203,27 +154,64 @@ BEGIN          LEFTMARGIN, 3
          RIGHTMARGIN, 311
          TOPMARGIN, 3
 -        BOTTOMMARGIN, 107
 +        BOTTOMMARGIN, 171
 +        HORZGUIDE, 150
      END
      IDD_POPUPS, DIALOG
      BEGIN
          LEFTMARGIN, 3
          RIGHTMARGIN, 311
 +        VERTGUIDE, 12
 +        VERTGUIDE, 144
 +        VERTGUIDE, 174
 +        VERTGUIDE, 305
          TOPMARGIN, 3
 -        BOTTOMMARGIN, 237
 +        BOTTOMMARGIN, 225
      END
      IDD_FIRST_RUN, DIALOG
      BEGIN
          LEFTMARGIN, 7
 -        RIGHTMARGIN, 331
 +        RIGHTMARGIN, 443
 +        VERTGUIDE, 15
 +        VERTGUIDE, 431
          TOPMARGIN, 7
 -        BOTTOMMARGIN, 244
 +        BOTTOMMARGIN, 246
      END
  END
  #endif    // APSTUDIO_INVOKED
 +#endif    // Neutral resources
 +/////////////////////////////////////////////////////////////////////////////
 +
 +
 +/////////////////////////////////////////////////////////////////////////////
 +// German (Germany) resources
 +
 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
 +#pragma code_page(1252)
 +
 +/////////////////////////////////////////////////////////////////////////////
 +//
 +// Icon
 +//
 +
 +// Icon with lowest ID value placed first to ensure application icon
 +// remains consistent on all systems.
 +IDI_NEWAVATAR           ICON                    "NewAvatar.ico"
 +IDI_AVATARHISTORY       ICON                    "AvatarHistory.ico"
 +#endif    // German (Germany) resources
 +/////////////////////////////////////////////////////////////////////////////
 +
 +
 +/////////////////////////////////////////////////////////////////////////////
 +// English (United Kingdom) resources
 +
 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
 +#pragma code_page(1252)
  #ifdef APSTUDIO_INVOKED
  /////////////////////////////////////////////////////////////////////////////
 @@ -231,18 +219,18 @@ END  // TEXTINCLUDE
  //
 -1 TEXTINCLUDE DISCARDABLE 
 +1 TEXTINCLUDE 
  BEGIN
      "resource.h\0"
  END
 -2 TEXTINCLUDE DISCARDABLE 
 +2 TEXTINCLUDE 
  BEGIN
      "#include ""afxres.h""\r\n"
      "\0"
  END
 -3 TEXTINCLUDE DISCARDABLE 
 +3 TEXTINCLUDE 
  BEGIN
      "\r\n"
      "\0"
 @@ -250,17 +238,7 @@ END  #endif    // APSTUDIO_INVOKED
 -
 -/////////////////////////////////////////////////////////////////////////////
 -//
 -// Icon
 -//
 -
 -// Icon with lowest ID value placed first to ensure application icon
 -// remains consistent on all systems.
 -IDI_AVATARHIST          ICON    DISCARDABLE     "history.ico"
 -IDI_AVATAROVERLAY       ICON    DISCARDABLE     "AvatarOverlay.ico"
 -#endif    // English (U.K.) resources
 +#endif    // English (United Kingdom) resources
  /////////////////////////////////////////////////////////////////////////////
 diff --git a/Plugins/avatarhistory/Docs/avatarhist_changelog.txt b/Plugins/avatarhistory/Docs/avatarhist_changelog.txt index a3c2e3b..9f2cf13 100644 --- a/Plugins/avatarhistory/Docs/avatarhist_changelog.txt +++ b/Plugins/avatarhistory/Docs/avatarhist_changelog.txt @@ -2,6 +2,18 @@ Avatar History  Changelog:
 +. 0.0.3.0
 +THIS REQUIRES MIRANDA IM 0.10 ALPHA #3 OR ABOVE!!
 +  + added x64 version
 +  + improved unicode support
 +  + added sounds
 +  + added more debug information
 +  * save position of avatar history dialog
 +  ! fixed crash with empty avatar history
 +  * BMP files are not converted to PNG any more
 +  * fixed Updater support
 +
 +
  . 0.0.2.10
    * Fix for get event text
 diff --git a/Plugins/avatarhistory/m_avatarhist.h b/Plugins/avatarhistory/m_avatarhist.h index 3431b5e..8dc352b 100644 --- a/Plugins/avatarhistory/m_avatarhist.h +++ b/Plugins/avatarhistory/m_avatarhist.h @@ -42,7 +42,7 @@ lParam: ignored  Get cached avatar
  wParam: (char *) protocol name
 -lParam: (char *) hash 
 +lParam: (TCHAR *) hash 
  return: (TCHAR *) NULL if none is found or the path to the avatar. You need to free this string 
          with mir_free.
  */
 diff --git a/Plugins/avatarhistory/options.cpp b/Plugins/avatarhistory/options.cpp index acb40cd..f05e2e1 100644 --- a/Plugins/avatarhistory/options.cpp +++ b/Plugins/avatarhistory/options.cpp @@ -52,9 +52,9 @@ static OptPageControl popupsControls[] = {  	{ &opts.popup_right_click_action,		CONTROL_COMBO,		IDC_RIGHT_ACTION,	"PopupsRightClick", POPUP_ACTION_CLOSEPOPUP },
  	{ &opts.popup_left_click_action,		CONTROL_COMBO,		IDC_LEFT_ACTION,	"PopupsLeftClick", POPUP_ACTION_OPENAVATARHISTORY },
  	{ &opts.popup_show_changed,				CONTROL_CHECKBOX,	IDC_CHANGED_L,		"PopupsShowChanged", TRUE },
 -	{ &opts.popup_changed,					CONTROL_TEXT,		IDC_CHANGED,		"PopupsTextChanged", (DWORD) _T(DEFAULT_TEMPLATE_CHANGED) },
 +	{ &opts.popup_changed,					CONTROL_TEXT,		IDC_CHANGED,		"PopupsTextChanged", (ULONG_PTR) DEFAULT_TEMPLATE_CHANGED },
  	{ &opts.popup_show_removed,				CONTROL_CHECKBOX,	IDC_REMOVED_L,		"PopupsShowRemoved", TRUE },
 -	{ &opts.popup_removed,					CONTROL_TEXT,		IDC_REMOVED,		"PopupsTextRemoved", (DWORD) _T(DEFAULT_TEMPLATE_REMOVED) }
 +	{ &opts.popup_removed,					CONTROL_TEXT,		IDC_REMOVED,		"PopupsTextRemoved", (ULONG_PTR) DEFAULT_TEMPLATE_REMOVED }
  };
  static UINT popupsExpertControls[] = { 
 diff --git a/Plugins/avatarhistory/popup.cpp b/Plugins/avatarhistory/popup.cpp index d614a23..116833f 100644 --- a/Plugins/avatarhistory/popup.cpp +++ b/Plugins/avatarhistory/popup.cpp @@ -47,7 +47,7 @@ void InitPopups()  	hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T(MODULE_NAME) _T("_PopupWindow"), 
  		0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
  		NULL, hInst, NULL);
 -	SetWindowLong(hPopupWindow, GWLP_WNDPROC, (LONG)(WNDPROC)PopupWndProc);
 +	SetWindowLong(hPopupWindow, GWLP_WNDPROC, (LONG)PopupWndProc);
  }
 diff --git a/Plugins/utils/mir_buffer.h b/Plugins/utils/mir_buffer.h index 3268f45..c64538b 100644 --- a/Plugins/utils/mir_buffer.h +++ b/Plugins/utils/mir_buffer.h @@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA.  #include <windows.h>
  #include "mir_memory.h"
 -#include <m_variables.h>
 +#include "m_variables.h"
  template<class T>
 @@ -102,13 +102,13 @@ static void __bcopy(WCHAR *dest, const WCHAR *orig, size_t len)  template<>
  static void __bcopy(WCHAR *dest, const char *orig, size_t len)
  {
 -	MultiByteToWideChar(CallService("LangPack/GetCodePage", 0, 0), 0, orig, len, dest, len);
 +	MultiByteToWideChar(CallService("LangPack/GetCodePage", 0, 0), 0, orig, (int)len, dest, (int)len);
  }
  template<>
  static void __bcopy(char *dest, const WCHAR *orig, size_t len)
  {
 -	WideCharToMultiByte(CallService("LangPack/GetCodePage", 0, 0), 0, orig, len, dest, len, NULL, NULL);
 +	WideCharToMultiByte(CallService("LangPack/GetCodePage", 0, 0), 0, orig, (int)len, dest, (int)len, NULL, NULL);
  }
 diff --git a/Plugins/utils/mir_options.cpp b/Plugins/utils/mir_options.cpp index 11af0c6..154bf7a 100644 --- a/Plugins/utils/mir_options.cpp +++ b/Plugins/utils/mir_options.cpp @@ -50,15 +50,15 @@ static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char*  #ifdef UNICODE
  		if (dbv.type == DBVT_ASCIIZ)
  		{
 -			MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, out, len);
 +			MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, out, (int)len);
  		}
  		else if (dbv.type == DBVT_UTF8)
  		{
 -			MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, len);
 +			MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len);
  		}
  		else if (dbv.type == DBVT_WCHAR)
  		{
 -			lstrcpyn(out, dbv.pwszVal, len);
 +			lstrcpyn(out, dbv.pwszVal, (int)len);
  		}
  #else
  		if (dbv.type == DBVT_ASCIIZ)
 @@ -69,7 +69,7 @@ static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char*  		else
  		{
  			if (def != NULL)
 -				lstrcpyn(out, def, len);
 +				lstrcpyn(out, def, (int)len);
  		}
  		DBFreeVariant(&dbv);
 @@ -77,7 +77,7 @@ static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char*  	else
  	{
  		if (def != NULL)
 -			lstrcpyn(out, def, len);
 +			lstrcpyn(out, def, (int)len);
  	}
  	return out;
 @@ -100,7 +100,7 @@ static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)  {
      if (!PathIsAbsolute(pSrc)) 
  	{
 -		lstrcpyn(pOut, pSrc, outSize);
 +		lstrcpyn(pOut, pSrc, (int)outSize);
      }
      else 
  	{
 @@ -118,7 +118,7 @@ static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)          }
          else 
  		{
 -            lstrcpyn(pOut, pSrc, outSize);
 +            lstrcpyn(pOut, pSrc, (int)outSize);
          }
      }
  }
 @@ -127,7 +127,7 @@ static void PathToAbsolute(TCHAR *pOut, size_t outSize, const TCHAR *pSrc)  {
      if (PathIsAbsolute(pSrc) || !isalnum(pSrc[0])) 
  	{
 -        lstrcpyn(pOut, pSrc, outSize);
 +        lstrcpyn(pOut, pSrc, (int)outSize);
      }
      else 
  	{
 @@ -237,7 +237,7 @@ void LoadOpts(OptPageControl *controls, int controlsSize, char *module) -BOOL CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *module, HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 +INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *module, HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  {
  	switch (msg)
  	{
 @@ -301,14 +301,8 @@ BOOL CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *  						lvi.iItem = 1000;
  						PROTOACCOUNT **protos;
 -						int count;
 -
 -						BOOL hasAccounts = ServiceExists(MS_PROTO_ENUMACCOUNTS);
 -
 -						if (hasAccounts)
 -							CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&protos);
 -						else
 -							CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&count, (LPARAM)&protos);
 +						int count = 0;
 +						ProtoEnumAccounts(&count,&protos);
  						for (int i = 0; i < count; i++)
  						{
 @@ -321,18 +315,7 @@ BOOL CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *  							if (ctrl->allowProtocol != NULL && !ctrl->allowProtocol(protos[i]->szModuleName))
  								continue;
 -							TCHAR *name;
 -							if (hasAccounts)
 -							{
 -								name = mir_tstrdup(protos[i]->tszAccountName);
 -							}
 -							else
 -							{
 -								char szName[128];
 -								CallProtoService(protos[i]->szModuleName, PS_GETNAME, sizeof(szName), (LPARAM)szName);
 -								name = mir_a2t(szName);
 -							}
 -							
 +							TCHAR *name = mir_tstrdup(protos[i]->tszAccountName);
  							char *setting = (char *) mir_alloc(128 * sizeof(char));
  							mir_snprintf(setting, 128, ctrl->setting, protos[i]->szModuleName);
 diff --git a/Plugins/utils/mir_options.h b/Plugins/utils/mir_options.h index 34b9c4c..8bfcd4d 100644 --- a/Plugins/utils/mir_options.h +++ b/Plugins/utils/mir_options.h @@ -46,7 +46,7 @@ typedef struct {  	unsigned int nID;
  	char *setting;
  	union {
 -		DWORD dwDefValue;
 +		ULONG_PTR dwDefValue;
  		TCHAR *tszDefValue;
  		char *szDefValue;
  	};
 @@ -60,7 +60,7 @@ typedef struct {  	WORD max;
  } OptPageControl;
 -BOOL CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *module, HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 +INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, char *module, HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  void LoadOpts(OptPageControl *controls, int controlsSize, char *module);
 | 
