#include "stdafx.h"
static void __cdecl Login_ThreadFunc(Account *curAcc)
{
	if (curAcc == nullptr)
		return;
	HANDLE hTempFile;
	DWORD dwBytesWritten, dwBufSize = 1024;
	char szTempName[MAX_PATH];
	char buffer[1024];
	char *str_temp;
	char lpPathBuffer[1024];
	if (GetBrowser(lpPathBuffer)) {
		if (!g_plugin.AutoLogin == 0) {
			if (curAcc->hosted[0]) {
				mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
				mir_strcat(lpPathBuffer, curAcc->hosted);
				mir_strcat(lpPathBuffer, "/?logout");
			}
			else {
				mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
			}
		}
		else {
			if (curAcc->hosted[0]) {
				GetTempPathA(dwBufSize, buffer);
				GetTempFileNameA(buffer, "gmail", 0, szTempName);
				hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
				mir_strcpy(buffer, FORMDATA1);
				mir_strcat(buffer, curAcc->hosted);
				mir_strcat(buffer, FORMDATA2);
				mir_strcat(buffer, curAcc->hosted);
				mir_strcat(buffer, FORMDATA3);
				mir_strcat(buffer, "