コード例 #1
0
ファイル: popup.cpp プロジェクト: kxepal/miranda-ng
static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
{
	TCHAR *comment1 = NULL;
	TCHAR *comment2 = NULL;
	char  *commentFix = NULL;

	//now get text
	switch (dbei->eventType) {
	case EVENTTYPE_MESSAGE:
		if (dbei->pBlob) {
			if (dbei->flags & DBEF_UTF) {
				// utf-8 in blob
				comment1 = mir_utf8decodeT((char*)dbei->pBlob);
			}
			else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) {
				// wchar in blob (the old hack)
				comment1 = mir_tstrdup((TCHAR*)dbei->pBlob);
			}
			else comment1 = mir_a2t((char *)dbei->pBlob);
		}
		commentFix = POPUP_COMMENT_MESSAGE;
		break;

	case EVENTTYPE_URL:
		// url
		if (dbei->pBlob) comment2 = mir_a2t((char *)dbei->pBlob);
		// comment
		if (dbei->pBlob) comment1 = mir_a2t((char *)dbei->pBlob + mir_strlen((char *)dbei->pBlob) + 1);
		commentFix = POPUP_COMMENT_URL;
		break;

	case EVENTTYPE_FILE:
		if (dbei->pBlob) {
			char *p = (char*)dbei->pBlob + sizeof(DWORD);
			// filenames
			comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
			p += mir_strlen(p) + 1;
			// description
			comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
		}
		commentFix = POPUP_COMMENT_FILE;
		break;

	//blob format is:
	//ASCIIZ    nick
	//ASCIIZ    UID
	case EVENTTYPE_CONTACTS:
		if (dbei->pBlob) {
			// count contacts in event
			char* pcBlob = (char *)dbei->pBlob;
			char* pcEnd = (char *)(dbei->pBlob + dbei->cbBlob);
			int nContacts;
			TCHAR szBuf[512];

			for (nContacts = 1; ; nContacts++) {
				// Nick
				pcBlob += mir_strlen(pcBlob) + 1;
				// UIN
				pcBlob += mir_strlen(pcBlob) + 1;
				// check for end of contacts
				if (pcBlob >= pcEnd)
					break;
			}
			mir_sntprintf(szBuf, TranslateT("Received %d contacts."), nContacts);
			comment1 = mir_tstrdup(szBuf);
		}
		commentFix = POPUP_COMMENT_CONTACTS;
		break;

	//blob format is:
	//DWORD     numeric uin (ICQ only afaik)
	//DWORD     HANDLE to contact
	//ASCIIZ    nick (or text UID)
	//ASCIIZ    first name
	//ASCIIZ    last name
	//ASCIIZ    email (or YID)
	case EVENTTYPE_ADDED:
		if (dbei->pBlob) {
			char szUin[16];
			TCHAR szBuf[2048];
			TCHAR* szNick = NULL;
			char *pszNick = (char *)dbei->pBlob + 8;
			char *pszFirst = pszNick + mir_strlen(pszNick) + 1;
			char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
			char *pszEmail = pszLast + mir_strlen(pszLast) + 1;

			mir_snprintf(szUin, "%d", *((DWORD*)dbei->pBlob));
			if (mir_strlen(pszNick) > 0) {
				if (dbei->flags & DBEF_UTF)
					szNick = mir_utf8decodeT(pszNick);
				else
					szNick = mir_a2t(pszNick);
			}
			else if (mir_strlen(pszEmail) > 0) {
				if (dbei->flags & DBEF_UTF)
					szNick = mir_utf8decodeT(pszEmail);
				else
					szNick = mir_a2t(pszEmail);
			}
			else if (*((DWORD*)dbei->pBlob) > 0)
				szNick = mir_a2t(szUin);

			if (szNick) {
				mir_tstrcpy(szBuf, szNick);
				mir_tstrcat(szBuf, TranslateT(" added you to the contact list"));
				mir_free(szNick);
				comment1 = mir_tstrdup(szBuf);
			}
		}
		commentFix = POPUP_COMMENT_ADDED;
		break;

	case EVENTTYPE_AUTHREQUEST:
		if (dbei->pBlob) {
			char szUin[16];
			TCHAR szBuf[2048];
			TCHAR* szNick = NULL;
			char *pszNick = (char *)dbei->pBlob + 8;
			char *pszFirst = pszNick + mir_strlen(pszNick) + 1;
			char *pszLast  = pszFirst + mir_strlen(pszFirst) + 1;
			char *pszEmail = pszLast + mir_strlen(pszLast) + 1;

			mir_snprintf(szUin, "%d", *((DWORD*)dbei->pBlob));
			if (mir_strlen(pszNick) > 0) {
				if (dbei->flags & DBEF_UTF)
					szNick = mir_utf8decodeT(pszNick);
				else
					szNick = mir_a2t(pszNick);
			}
			else if (mir_strlen(pszEmail) > 0) {
				if (dbei->flags & DBEF_UTF)
					szNick = mir_utf8decodeT(pszEmail);
				else
					szNick = mir_a2t(pszEmail);
			}
			else if (*((DWORD*)dbei->pBlob) > 0)
				szNick = mir_a2t(szUin);

			if (szNick) {
				mir_tstrcpy(szBuf, szNick);
				mir_tstrcat(szBuf, TranslateT(" requested authorization"));
				mir_free(szNick);
				comment1 = mir_tstrdup(szBuf);
			}
		}
		commentFix = POPUP_COMMENT_AUTH;
		break;

	//blob format is:
	//ASCIIZ    text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
	//ASCIIZ    from name
	//ASCIIZ    from e-mail
	case ICQEVENTTYPE_WEBPAGER:
		if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
		commentFix = POPUP_COMMENT_WEBPAGER;
		break;

	//blob format is:
	//ASCIIZ    text, usually of the form "Subject: %s\r\n%s"
	//ASCIIZ    from name
	//ASCIIZ    from e-mail
	case ICQEVENTTYPE_EMAILEXPRESS:
		if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
		commentFix = POPUP_COMMENT_EMAILEXP;
		break;

	//blob format is:
	//ASCIIZ    text, usually of the form "SMS From: +XXXXXXXX\r\nTEXT"
	case ICQEVENTTYPE_SMS:
		if (dbei->pBlob) {
			if (dbei->flags & DBEF_UTF) {
				// utf-8 in blob
				comment1 = mir_utf8decodeT((char*)dbei->pBlob);
			}
			else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) {
				// wchar in blob (the old hack)
				comment1 = mir_tstrdup((TCHAR*)dbei->pBlob);
			}
			else comment1 = mir_a2t((char *)dbei->pBlob);
		}
		commentFix = POPUP_COMMENT_SMS;
		break;

	//blob format is:
	//ASCIIZ    text, usually of the form "SMS Confirmation From: +XXXXXXXXXXXX\r\nSMS was sent succesfully"
	case ICQEVENTTYPE_SMSCONFIRMATION:
		if (dbei->pBlob) {
			if (dbei->flags & DBEF_UTF) {
				// utf-8 in blob
				comment1 = mir_utf8decodeT((char*)dbei->pBlob);
			}
			else if (dbei->cbBlob == (mir_tstrlen((TCHAR *)dbei->pBlob)+1)*(sizeof(TCHAR)+1)) {
				// wchar in blob (the old hack)
				comment1 = mir_tstrdup((TCHAR*)dbei->pBlob);
			}
			else comment1 = mir_a2t((char *)dbei->pBlob);
		}
		commentFix = POPUP_COMMENT_SMSCONFIRMATION;
		break;

	default:
		if (ServiceExists(MS_DB_EVENT_GETTYPE)) {
			DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
			// support for custom database event types
			if (pei && dbei->pBlob) {
				DBEVENTGETTEXT svc = {dbei, DBVT_TCHAR, CP_ACP};
				TCHAR *pet = (TCHAR*)CallService(MS_DB_EVENT_GETTEXT, 0, (LPARAM)&svc);
				if (pet) {
					// we've got event text, move to our memory space
					comment1 = mir_tstrdup(pet);
					mir_free(pet);
				}
				commentFix = pei->descr;
			}
			else commentFix = POPUP_COMMENT_OTHER;
		}
		else commentFix = POPUP_COMMENT_OTHER;
	}

	if ( mir_tstrlen(comment1) > 0) {
		mir_free(comment2);
		return comment1;
	}
	if ( mir_tstrlen(comment2) > 0) {
		mir_free(comment1);
		return comment2;
	}
	mir_free(comment1);
	mir_free(comment2);
	return TranslateTS( mir_a2t(commentFix));
}
コード例 #2
0
ファイル: backup.cpp プロジェクト: truefriend-cz/miranda-ng
int Backup(TCHAR *backup_filename)
{
    bool bZip = false;
    TCHAR dbname[MAX_PATH], source_file[MAX_PATH] = { 0 }, dest_file[MAX_PATH];
    HWND progress_dialog = NULL;
    SYSTEMTIME st;

    CallService(MS_DB_GETPROFILENAMET, _countof(dbname), (LPARAM)dbname);

    if (backup_filename == NULL) {
        int err;
        TCHAR *backupfolder, buffer[MAX_COMPUTERNAME_LENGTH + 1];
        DWORD size = _countof(buffer);

        bZip = options.use_zip != 0;
        backupfolder = Utils_ReplaceVarsT(options.folder);
        // ensure the backup folder exists (either create it or return non-zero signifying error)
        err = CreateDirectoryTreeT(backupfolder);
        if (err != ERROR_ALREADY_EXISTS && err != 0) {
            mir_free(backupfolder);
            return 1;
        }
        RotateBackups(backupfolder, dbname);

        GetLocalTime(&st);
        GetComputerName(buffer, &size);
        mir_sntprintf(dest_file, _T("%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s"), backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? _T("zip") : _T("dat"));
        mir_free(backupfolder);
    }
    else {
        _tcsncpy_s(dest_file, backup_filename, _TRUNCATE);
        if (!mir_tstrcmp(_tcsrchr(backup_filename, _T('.')), _T(".zip")))
            bZip = true;
    }
    if (!options.disable_popups)
        ShowPopup(dbname, TranslateT("Backup in progress"), NULL);

    if (!options.disable_progress)
        progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress);

    SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));

    mir_sntprintf(source_file, _T("%s\\%s"), profilePath, dbname);
    TCHAR *pathtmp = Utils_ReplaceVarsT(source_file);
    BOOL res = 0;
    if (bZip)
        res = MakeZip(pathtmp, dest_file, dbname, progress_dialog);
    else
        res = CopyFile(pathtmp, dest_file, 0);
    if (res) {
        if (!bZip) { // Set the backup file to the current time for rotator's correct  work
            FILETIME ft;
            HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
            GetSystemTime(&st);
            SystemTimeToFileTime(&st, &ft);
            SetFileTime(hFile, NULL, NULL, &ft);
            CloseHandle(hFile);
        }
        SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
        UpdateWindow(progress_dialog);
        db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
        if (!options.disable_popups) {
            size_t dest_file_len = mir_tstrlen(dest_file);
            TCHAR *puText;
            if (dest_file_len > 50) {
                size_t i;
                puText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (dest_file_len + 2));
                for (i = (dest_file_len - 1); dest_file[i] != _T('\\'); i--)
                    ;
                //_tcsncpy_s(dest_file, backup_filename, _TRUNCATE);
                mir_tstrncpy(puText, dest_file, (i + 2));
                mir_tstrcat(puText, _T("\n"));
                mir_tstrcat(puText, (dest_file + i + 1));
            }
            else
                puText = mir_tstrdup(dest_file);

            // Now we need to know, which folder we made a backup. Let's break unnecessary variables :)
            while (dest_file[--dest_file_len] != L'\\')
                ;
            dest_file[dest_file_len] = 0;
            ShowPopup(puText, TranslateT("Database backed up"), dest_file);
            mir_free(puText);
        }
    }
    else
        DeleteFile(dest_file);
    mir_free(pathtmp);

    DestroyWindow(progress_dialog);
    return 0;
}
コード例 #3
0
void Transliterate(TCHAR *&str)
{
	TCHAR *newStr = (TCHAR*)mir_alloc(sizeof(TCHAR) * mir_tstrlen(str) * 3 + 1);
	newStr[0] = 0;
	for (; *str != 0; str++) {
		switch (str[0]) {
		case _T('à'): mir_tstrcat(newStr, _T("a")); break;
		case _T('á'): mir_tstrcat(newStr, _T("b")); break;
		case _T('â'): mir_tstrcat(newStr, _T("v")); break;
		case _T('ã'): mir_tstrcat(newStr, _T("g")); break;
		case _T('ä'): mir_tstrcat(newStr, _T("d")); break;
		case _T('å'): mir_tstrcat(newStr, _T("e")); break;
		case _T('¸'): mir_tstrcat(newStr, _T("ye")); break;
		case _T('æ'): mir_tstrcat(newStr, _T("zh")); break;
		case _T('ç'): mir_tstrcat(newStr, _T("z")); break;
		case _T('è'): mir_tstrcat(newStr, _T("i")); break;
		case _T('é'): mir_tstrcat(newStr, _T("y")); break;
		case _T('ê'): mir_tstrcat(newStr, _T("k")); break;
		case _T('ë'): mir_tstrcat(newStr, _T("l")); break;
		case _T('ì'): mir_tstrcat(newStr, _T("m")); break;
		case _T('í'): mir_tstrcat(newStr, _T("n")); break;
		case _T('î'): mir_tstrcat(newStr, _T("o")); break;
		case _T('ï'): mir_tstrcat(newStr, _T("p")); break;
		case _T('ð'): mir_tstrcat(newStr, _T("r")); break;
		case _T('ñ'): mir_tstrcat(newStr, _T("s")); break;
		case _T('ò'): mir_tstrcat(newStr, _T("t")); break;
		case _T('ó'): mir_tstrcat(newStr, _T("u")); break;
		case _T('ô'): mir_tstrcat(newStr, _T("f")); break;
		case _T('õ'): mir_tstrcat(newStr, _T("kh")); break;
		case _T('ö'): mir_tstrcat(newStr, _T("ts")); break;
		case _T('÷'): mir_tstrcat(newStr, _T("ch")); break;
		case _T('ø'): mir_tstrcat(newStr, _T("sh")); break;
		case _T('ù'): mir_tstrcat(newStr, _T("sch")); break;
		case _T('ú'): mir_tstrcat(newStr, _T("'")); break;
		case _T('û'): mir_tstrcat(newStr, _T("yi")); break;
		case _T('ü'): mir_tstrcat(newStr, _T("")); break;
		case _T('ý'): mir_tstrcat(newStr, _T("e")); break;
		case _T('þ'): mir_tstrcat(newStr, _T("yu")); break;
		case _T('ÿ'): mir_tstrcat(newStr, _T("ya")); break;
		case _T('À'): mir_tstrcat(newStr, _T("A")); break;
		case _T('Á'): mir_tstrcat(newStr, _T("B")); break;
		case _T('Â'): mir_tstrcat(newStr, _T("V")); break;
		case _T('Ã'): mir_tstrcat(newStr, _T("G")); break;
		case _T('Ä'): mir_tstrcat(newStr, _T("D")); break;
		case _T('Å'): mir_tstrcat(newStr, _T("E")); break;
		case _T('¨'): mir_tstrcat(newStr, _T("Ye")); break;
		case _T('Æ'): mir_tstrcat(newStr, _T("Zh")); break;
		case _T('Ç'): mir_tstrcat(newStr, _T("Z")); break;
		case _T('È'): mir_tstrcat(newStr, _T("I")); break;
		case _T('É'): mir_tstrcat(newStr, _T("Y")); break;
		case _T('Ê'): mir_tstrcat(newStr, _T("K")); break;
		case _T('Ë'): mir_tstrcat(newStr, _T("L")); break;
		case _T('Ì'): mir_tstrcat(newStr, _T("M")); break;
		case _T('Í'): mir_tstrcat(newStr, _T("N")); break;
		case _T('Î'): mir_tstrcat(newStr, _T("O")); break;
		case _T('Ï'): mir_tstrcat(newStr, _T("P")); break;
		case _T('Ð'): mir_tstrcat(newStr, _T("R")); break;
		case _T('Ñ'): mir_tstrcat(newStr, _T("S")); break;
		case _T('Ò'): mir_tstrcat(newStr, _T("T")); break;
		case _T('Ó'): mir_tstrcat(newStr, _T("U")); break;
		case _T('Ô'): mir_tstrcat(newStr, _T("F")); break;
		case _T('Õ'): mir_tstrcat(newStr, _T("Kh")); break;
		case _T('Ö'): mir_tstrcat(newStr, _T("Ts")); break;
		case _T('×'): mir_tstrcat(newStr, _T("Ch")); break;
		case _T('Ø'): mir_tstrcat(newStr, _T("Sh")); break;
		case _T('Ù'): mir_tstrcat(newStr, _T("Sch")); break;
		case _T('Ú'): mir_tstrcat(newStr, _T("'")); break;
		case _T('Û'): mir_tstrcat(newStr, _T("Yi")); break;
		case _T('Ü'): mir_tstrcat(newStr, _T("")); break;
		case _T('Ý'): mir_tstrcat(newStr, _T("E")); break;
		case _T('Þ'): mir_tstrcat(newStr, _T("Yu")); break;
		case _T('ß'): mir_tstrcat(newStr, _T("Ya")); break;

		case _T('a'): mir_tstrcat(newStr, _T("à")); break;
		case _T('b'): mir_tstrcat(newStr, _T("á")); break;
		case _T('v'): mir_tstrcat(newStr, _T("â")); break;
		case _T('g'): mir_tstrcat(newStr, _T("ã")); break;
		case _T('d'): mir_tstrcat(newStr, _T("ä")); break;
		case _T('e'): mir_tstrcat(newStr, _T("å")); break;
		case _T('z'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("æ"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("ç"));
				break;
			}
		}
		case _T('i'): mir_tstrcat(newStr, _T("è")); break;
		case _T('y'):
		{
			if (str[1] == _T('a')) {
				mir_tstrcat(newStr, _T("ÿ"));
				str++;
				break;
			}
			else if (str[1] == _T('e')) {
				mir_tstrcat(newStr, _T("¸"));
				str++;
				break;
			}
			else if (str[1] == _T('u')) {
				mir_tstrcat(newStr, _T("þ"));
				str++;
				break;
			}
			else if (str[1] == _T('i')) {
				mir_tstrcat(newStr, _T("û"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("é"));
				break;
			}
		}
		case _T('k'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("õ"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("ê"));
				break;
			}
		}
		case _T('l'): mir_tstrcat(newStr, _T("ë")); break;
		case _T('m'): mir_tstrcat(newStr, _T("ì")); break;
		case _T('n'): mir_tstrcat(newStr, _T("í")); break;
		case _T('o'): mir_tstrcat(newStr, _T("î")); break;
		case _T('p'): mir_tstrcat(newStr, _T("ï")); break;
		case _T('r'): mir_tstrcat(newStr, _T("ð")); break;
		case _T('s'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("ø"));
				str++;
				break;
			}
			else if (str[1] == _T('c') && str[2] == _T('h')) {
				mir_tstrcat(newStr, _T("ù"));
				str += 2;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("ñ"));
				break;
			}
		}
		case _T('t'):
		{
			if (str[1] == _T('s')) {
				mir_tstrcat(newStr, _T("ö"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("ò"));
				break;
			}
		}
		case _T('u'): mir_tstrcat(newStr, _T("ó")); break;
		case _T('f'): mir_tstrcat(newStr, _T("ô")); break;
		case _T('c'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("÷"));
				str++;
				break;
			}
		}
		case _T('A'): mir_tstrcat(newStr, _T("À")); break;
		case _T('B'): mir_tstrcat(newStr, _T("Á")); break;
		case _T('V'): mir_tstrcat(newStr, _T("Â")); break;
		case _T('G'): mir_tstrcat(newStr, _T("Ã")); break;
		case _T('D'): mir_tstrcat(newStr, _T("Ä")); break;
		case _T('E'): mir_tstrcat(newStr, _T("Å")); break;
		case _T('Y'):
		{
			if (str[1] == _T('a')) {
				mir_tstrcat(newStr, _T("ß"));
				str++;
				break;
			}
			else if (str[1] == _T('e')) {
				mir_tstrcat(newStr, _T("¨"));
				str++;
				break;
			}
			else if (str[1] == _T('u')) {
				mir_tstrcat(newStr, _T("Þ"));
				str++;
				break;
			}
			else if (str[1] == _T('i')) {
				mir_tstrcat(newStr, _T("Û"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("É"));
				break;
			}
		}
		case _T('Z'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("Æ"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("Ç"));
				break;
			}
		}
		case _T('I'): mir_tstrcat(newStr, _T("È")); break;
		case _T('K'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("Õ"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("Ê"));
				break;
			}
		}
		case _T('L'): mir_tstrcat(newStr, _T("Ë")); break;
		case _T('M'): mir_tstrcat(newStr, _T("Ì")); break;
		case _T('N'): mir_tstrcat(newStr, _T("Í")); break;
		case _T('O'): mir_tstrcat(newStr, _T("Î")); break;
		case _T('P'): mir_tstrcat(newStr, _T("Ï")); break;
		case _T('R'): mir_tstrcat(newStr, _T("Ð")); break;
		case _T('S'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("Ø"));
				str++;
				break;
			}
			else if (str[1] == _T('c') && str[2] == _T('h')) {
				mir_tstrcat(newStr, _T("Ù"));
				str += 2;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("Ñ"));
				break;
			}
		}
		case _T('T'):
		{
			if (str[1] == _T('s')) {
				mir_tstrcat(newStr, _T("Ö"));
				str++;
				break;
			}
			else {
				mir_tstrcat(newStr, _T("Ò"));
				break;
			}
		}
		case _T('U'): mir_tstrcat(newStr, _T("Ó")); break;
		case _T('F'): mir_tstrcat(newStr, _T("Ô")); break;
		case _T('C'):
		{
			if (str[1] == _T('h')) {
				mir_tstrcat(newStr, _T("×"));
				str++;
				break;
			}
		}
		case _T('\''): mir_tstrcat(newStr, _T("ú")); break;

		default: { TCHAR Temp[2] = { str[0], 0 }; mir_tstrcat(newStr, &Temp[0]); }
		}
	}
	size_t len = mir_tstrlen(newStr);
	str = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
	str[0] = 0;
	mir_tstrcpy(str, newStr);
	mir_free(newStr);
}
コード例 #4
0
void InvertCase(bool lastword)
{
	HWND hwnd = GetForegroundWindow();
	if (hwnd == NULL)
		return;

	HWND hwnd2 = GetFocus();
	if (hwnd2 == NULL)
		return;

	TCHAR szClassName[16];

	GetClassName(hwnd2, szClassName, _countof(szClassName));
	if (mir_tstrcmpi(szClassName, _T("RichEdit50W")) != 0)
		return;

	DWORD dwStart, dwEnd, dwFlags = SF_TEXT | SF_UNICODE;
	SendMessage(hwnd2, EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
	bool somethingIsSelected = (dwStart != dwEnd);
	if (somethingIsSelected)
		dwFlags += SFF_SELECTION;

	TCHAR *boo, *sel = Message_GetFromStream(hwnd2, dwFlags);
	size_t slen = mir_tstrlen(sel), start = 0, end = 0;
	if (slen != 0) {
		end = slen;
		if (lastword && !somethingIsSelected) {
			end = (size_t)dwStart;
			while (end < slen) {
				if (_istspace(sel[end]) || isItSmiley((int)end))
					break;
				end++;
			}
			start = (size_t)dwStart - 1;
			while (start > 0 && start < (size_t)dwStart) {
				if ((_istspace(sel[start]) && (end - start > 2)) || isItSmiley((int)start))
					break;
				start--;
			}
			boo = (TCHAR*)mir_alloc((end - start + 1) * sizeof(TCHAR));
			mir_tstrncpy(boo, sel + start, end - start);
			boo[end - start] = 0;
		}
		else {
			boo = (TCHAR*)mir_alloc((slen + 1) * sizeof(TCHAR));
			mir_tstrcpy(boo, sel);
		}

		Invert(boo);

		if (somethingIsSelected)
			SendMessage(hwnd2, EM_REPLACESEL, false, (LPARAM)boo);
		else {
			TCHAR *NewText = (TCHAR*)mir_alloc((start + mir_tstrlen(boo) + (slen - start) + 1) * sizeof(TCHAR));
			NewText[0] = 0;
			mir_tstrncat(NewText, sel, start);
			mir_tstrcat(NewText, boo);
			mir_tstrncat(NewText, sel + end, slen - end);
			SetWindowText(hwnd2, NewText);
			mir_free(NewText);
		}

		SendMessage(hwnd2, EM_SETSEL, (WPARAM)dwStart, (LPARAM)dwEnd);
		mir_free(boo);
	}
	mir_free(sel);
}
コード例 #5
0
ファイル: opt_gen.cpp プロジェクト: kmdtukl/miranda-ng
int AddStatusMode(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag)
{
	if (!flag) return pos;
	options[pos].dwFlag = flag;
	options[pos].groupId = OPTTREE_CHECK;
	options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR) * mir_tstrlen(prefix) + 32);
	options[pos].pszSettingName = mir_tstrdup(prefix);
	options[pos].iconIndex = 0;

	mir_tstrcpy(options[pos].pszOptionName, prefix);
	mir_tstrcat(options[pos].pszOptionName, _T("/"));
	switch (flag)
	{
	case PF2_IDLE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Offline")); break;
	case PF2_ONLINE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Online")); break;
	case PF2_INVISIBLE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Invisible")); break;
	case PF2_SHORTAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENT("Away")); break;
	case PF2_LONGAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENT("NA")); break;
	case PF2_LIGHTDND: mir_tstrcat(options[pos].pszOptionName, LPGENT("Occupied")); break;
	case PF2_HEAVYDND: mir_tstrcat(options[pos].pszOptionName, LPGENT("DND")); break;
	case PF2_FREECHAT: mir_tstrcat(options[pos].pszOptionName, LPGENT("Free for chat")); break;
	case PF2_OUTTOLUNCH: mir_tstrcat(options[pos].pszOptionName, LPGENT("Out to lunch")); break;
	case PF2_ONTHEPHONE: mir_tstrcat(options[pos].pszOptionName, LPGENT("On the phone")); break;
	}
	return pos + 1;
}
コード例 #6
0
static void DoAutoExec(void)
{
	TCHAR szUse[7], szIniPath[MAX_PATH], szFindPath[MAX_PATH];
	TCHAR buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];

	GetPrivateProfileString(_T("AutoExec"), _T("Use"), _T("prompt"), szUse, _countof(szUse), mirandabootini);
	if (!mir_tstrcmpi(szUse, _T("no"))) return;
	GetPrivateProfileString(_T("AutoExec"), _T("Safe"), _T("CLC Icons CLUI CList SkinSounds"), buf, _countof(buf), mirandabootini);
	ptrA szSafeSections(mir_t2a(buf));
	GetPrivateProfileString(_T("AutoExec"), _T("Unsafe"), _T("AIM Facebook GG ICQ IRC JABBER MRA MSN SKYPE Tlen TWITTER VKontakte XFire"), buf, _countof(buf), mirandabootini);
	ptrA szUnsafeSections(mir_t2a(buf));
	GetPrivateProfileString(_T("AutoExec"), _T("Warn"), _T("notsafe"), szSecurity, _countof(szSecurity), mirandabootini);

	int secur = 0;
	if (!mir_tstrcmpi(szSecurity, _T("none"))) secur = 0;
	else if (!mir_tstrcmpi(szSecurity, _T("notsafe"))) secur = 1;
	else if (!mir_tstrcmpi(szSecurity, _T("onlyunsafe"))) secur = 2;

	GetPrivateProfileString(_T("AutoExec"), _T("OverrideSecurityFilename"), _T(""), szOverrideSecurityFilename, _countof(szOverrideSecurityFilename), mirandabootini);
	GetPrivateProfileString(_T("AutoExec"), _T("OnCreateFilename"), _T(""), szOnCreateFilename, _countof(szOnCreateFilename), mirandabootini);
	GetPrivateProfileString(_T("AutoExec"), _T("Glob"), _T("autoexec_*.ini"), szFindPath, _countof(szFindPath), mirandabootini);

	if (g_bDbCreated && szOnCreateFilename[0]) {
		PathToAbsoluteT(VARST(szOnCreateFilename), szIniPath);
		ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, 0, 1);
	}

	PathToAbsoluteT(VARST(szFindPath), szFindPath);

	WIN32_FIND_DATA fd;
	HANDLE hFind = FindFirstFile(szFindPath, &fd);
	if (hFind == INVALID_HANDLE_VALUE)
		return;

	TCHAR *str2 = _tcsrchr(szFindPath, '\\');
	if (str2 == NULL)
		szFindPath[0] = 0;
	else
		str2[1] = 0;

	do {
		bool secFN = mir_tstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;

		mir_sntprintf(szIniPath, _countof(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
		if (!mir_tstrcmpi(szUse, _T("prompt")) && !secFN) {
			int result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
			if (result == IDC_NOTOALL) break;
			if (result == IDCANCEL) continue;
		}

		ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, secur, secFN);

		if (secFN)
			DeleteFile(szIniPath);
		else {
			TCHAR szOnCompletion[8];
			GetPrivateProfileString(_T("AutoExec"), _T("OnCompletion"), _T("recycle"), szOnCompletion, _countof(szOnCompletion), mirandabootini);
			if (!mir_tstrcmpi(szOnCompletion, _T("delete")))
				DeleteFile(szIniPath);
			else if (!mir_tstrcmpi(szOnCompletion, _T("recycle"))) {
				SHFILEOPSTRUCT shfo = { 0 };
				shfo.wFunc = FO_DELETE;
				shfo.pFrom = szIniPath;
				szIniPath[mir_tstrlen(szIniPath) + 1] = 0;
				shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
				SHFileOperation(&shfo);
			}
			else if (!mir_tstrcmpi(szOnCompletion, _T("rename"))) {
				TCHAR szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
				GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, _countof(szRenamePrefix), mirandabootini);
				mir_tstrcpy(szNewPath, szFindPath);
				mir_tstrcat(szNewPath, szRenamePrefix);
				mir_tstrcat(szNewPath, fd.cFileName);
				MoveFile(szIniPath, szNewPath);
			}
			else if (!mir_tstrcmpi(szOnCompletion, _T("ask")))
				DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_INIIMPORTDONE), NULL, IniImportDoneDlgProc, (LPARAM)szIniPath);
		}
	}
		while (FindNextFile(hFind, &fd));

	FindClose(hFind);
}
コード例 #7
0
ファイル: options.cpp プロジェクト: gloria8023/miranda-ng
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
    case WM_INITDIALOG:
        TranslateDialogDefault(hwndDlg);
        {
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0));
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), 0));
            SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
            SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
            SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
            SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
            CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.bLoggingEnabled ? BST_CHECKED : BST_UNCHECKED);
            SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
            Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled);
            Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled);
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
            SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0));
            Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled);

            TCHAR tszTooltipText[2048];

            mir_sntprintf(tszTooltipText,
                          _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
                          _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n")
                          _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"),
                          // contact vars
                          _T("%nick%"), TranslateT("nick of current contact (if defined)"),
                          _T("%proto%"), TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiple accounts"),
                          _T("%accountname%"), TranslateT("user-defined account name of current contact (if defined)."),
                          _T("%userid%"), TranslateT("user ID of current contact (if defined). It is like UIN for ICQ, JID for Jabber, etc."),
                          // global vars
                          _T("%miranda_path%"), TranslateT("path to Miranda root folder"),
                          _T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"),
                          _T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"),
                          _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"),
                          _T("%miranda_logpath%"), TranslateT("will return parsed string %miranda_userdata%\\Logs"),
                          _T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
                          _T("%username%"), TranslateT("username for currently logged-on Windows user"),
                          _T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
                          _T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
                          _T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
                          // date/time vars
                          _T("%d%"), TranslateT("day of month, 1-31"),
                          _T("%dd%"), TranslateT("day of month, 01-31"),
                          _T("%m%"), TranslateT("month number, 1-12"),
                          _T("%mm%"), TranslateT("month number, 01-12"),
                          _T("%mon%"), TranslateT("abbreviated month name"),
                          _T("%month%"), TranslateT("full month name"),
                          _T("%yy%"), TranslateT("year without century, 01-99"),
                          _T("%yyyy%"), TranslateT("year with century, 1901-9999"),
                          _T("%wday%"), TranslateT("abbreviated weekday name"),
                          _T("%weekday%"), TranslateT("full weekday name"));
            hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
        }
        if (hPathTip)
            SetTimer(hwndDlg, 0, 3000, NULL);
        break;

    case WM_COMMAND:
        if ((LOWORD(wParam) == IDC_INSTAMP
                || LOWORD(wParam) == IDC_OUTSTAMP
                || LOWORD(wParam) == IDC_TIMESTAMP
                || LOWORD(wParam) == IDC_LOGLIMIT
                || LOWORD(wParam) == IDC_NICKROW2
                || LOWORD(wParam) == IDC_LOGDIRECTORY
                || LOWORD(wParam) == IDC_LIMIT
                || LOWORD(wParam) == IDC_LOGTIMESTAMP)
                && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))	return 0;

        // open the base directory for MUC logs, using a standard file selector
        // dialog. Simply allows the user to view what log files are there
        // and possibly delete archived logs.
        switch (LOWORD(wParam)) {
        case IDC_MUC_OPENLOGBASEDIR:
        {
            TCHAR	tszTemp[MAX_PATH + 20];
            _tcsncpy_s(tszTemp, g_Settings.pszLogDir, _TRUNCATE);

            TCHAR *p = tszTemp;
            while (*p && (*p == '\\' || *p == '.'))
                p++;

            if (*p)
                if (TCHAR *p1 = _tcschr(p, '\\'))
                    *p1 = 0;

            TCHAR tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
            mir_sntprintf(tszInitialDir, _T("%s%s"), M.getChatLogPath(), p);
            if (!PathFileExists(tszInitialDir))
                _tcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);

            TCHAR	tszReturnName[MAX_PATH];
            tszReturnName[0] = 0;
            mir_sntprintf(tszTemp, _T("%s%c*.*%c%c"), TranslateT("All files"), 0, 0, 0);

            OPENFILENAME ofn = { 0 };
            ofn.lpstrInitialDir = tszInitialDir;
            ofn.lpstrFilter = tszTemp;
            ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
            ofn.lpstrFile = tszReturnName;
            ofn.nMaxFile = MAX_PATH;
            ofn.nMaxFileTitle = MAX_PATH;
            ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
            ofn.lpstrDefExt = _T("log");
            GetOpenFileName(&ofn);
        }
        break;

        case IDC_FONTCHOOSE:
        {
            TCHAR tszDirectory[MAX_PATH];
            LPMALLOC psMalloc;

            if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
                BROWSEINFO bi = { 0 };
                bi.hwndOwner = hwndDlg;
                bi.pszDisplayName = tszDirectory;
                bi.lpszTitle = TranslateT("Select folder");
                bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
                bi.lpfn = BrowseCallbackProc;
                bi.lParam = (LPARAM)tszDirectory;

                LPITEMIDLIST idList = SHBrowseForFolder(&bi);
                if (idList) {
                    const TCHAR *szUserDir = M.getUserDir();
                    SHGetPathFromIDList(idList, tszDirectory);
                    mir_tstrcat(tszDirectory, _T("\\"));

                    TCHAR tszTemp[MAX_PATH];
                    PathToRelativeT(tszDirectory, tszTemp, szUserDir);
                    SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
                }
                psMalloc->Free(idList);
                psMalloc->Release();
            }
        }
        break;

        case IDC_LOGGING:
            Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
            Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
            Utils::enableDlgControl(hwndDlg, IDC_LIMIT, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
            break;
        }

        if (lParam != 0)
            SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
        break;

    case WM_NOTIFY:
        if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) {
            char *pszText = NULL;

            int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY));
            if (iLen > 0) {
                TCHAR *pszText1 = (TCHAR*)mir_alloc(iLen*sizeof(TCHAR) + 2);
                GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
                db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText1);
                mir_free(pszText1);
                g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
                db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled);
            }
            else {
                db_unset(NULL, CHAT_MODULE, "LogDirectory");
                db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0);
            }
            pci->SM_InvalidateLogDirectories();

            iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
            db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen);

            iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
            if (iLen > 0)
                db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
            else
                db_unset(NULL, CHAT_MODULE, "NicklistRowDist");

            iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
            if (iLen > 0) {
                pszText = (char *)mir_realloc(pszText, iLen + 1);
                GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
                db_set_s(NULL, CHAT_MODULE, "LogTimestamp", pszText);
            }
            else db_unset(NULL, CHAT_MODULE, "LogTimestamp");

            iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
            if (iLen > 0) {
                pszText = (char *)mir_realloc(pszText, iLen + 1);
                GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
                db_set_s(NULL, CHAT_MODULE, "HeaderTime", pszText);
            }
            else db_unset(NULL, CHAT_MODULE, "HeaderTime");

            iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
            if (iLen > 0) {
                pszText = (char *)mir_realloc(pszText, iLen + 1);
                GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
                db_set_s(NULL, CHAT_MODULE, "HeaderIncoming", pszText);
            }
            else db_unset(NULL, CHAT_MODULE, "HeaderIncoming");

            iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
            if (iLen > 0) {
                pszText = (char *)mir_realloc(pszText, iLen + 1);
                GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
                db_set_s(NULL, CHAT_MODULE, "HeaderOutgoing", pszText);
            }
            else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing");

            iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
            db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen);
            mir_free(pszText);

            if (pci->hListBkgBrush)
                DeleteObject(pci->hListBkgBrush);
            pci->hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));

            pci->ReloadSettings();
            pci->MM_FontsChanged();
            pci->MM_FixColors();
            pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);

            PluginConfig.reloadSettings();
            CacheMsgLogIcons();
            CacheLogFonts();
            return TRUE;
        }
        break;

    case WM_TIMER:
        if (IsWindow(hPathTip))
            KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
        break;

    case WM_DESTROY:
        if (hPathTip) {
            KillTimer(hwndDlg, 0);
            DestroyWindow(hPathTip);
            hPathTip = 0;
        }
        break;
    }
    return FALSE;
}