CString CLogin::GetHome() { int len; const char* domain = GetZone(); const char* name = GetMyName(); m_szHome = "/" + GetZone() + "/home/" + GetMyName(); return m_szHome; }
void EventList::InitNames() { TCHAR str[200]; if (hContact) { _tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR )); mir_sntprintf(str, SIZEOF(str), TranslateT("History for %s"),contactName); } else { _tcscpy_s(contactName, 256, TranslateT("System")); mir_sntprintf(str, SIZEOF(str), TranslateT("History")); } if (isWnd) SetWindowText(hWnd,str); _tcscpy_s(myName, GetMyName().c_str()); }
bool ExportManager::Export(IExport::ExportType type) { exp = NULL; UINT cp; std::wstring encoding; bool isBin = false; switch(type) { case IExport::Txt: exp = new TxtExport(); cp = Options::instance->codepageTxt; encoding = Options::instance->encodingTxt; isFlat = true; break; case IExport::PlainHtml: exp = new PlainHtmlExport(); cp = Options::instance->codepageHtml1; encoding = Options::instance->encodingHtml1; break; case IExport::RichHtml: exp = new RichHtmlExport(); cp = Options::instance->codepageHtml2; encoding = Options::instance->encodingHtml2; break; case IExport::Binary: exp = new BinaryExport(); cp = CP_UTF8; encoding = L"UTF8"; isFlat = true; oldOnTop = true; isBin = true; break; case IExport::Dat: exp = new DatExport(); cp = CP_UTF8; encoding = L"UTF8"; isFlat = true; oldOnTop = true; isBin = true; break; default: return false; } std::wstring fileName; if (file.empty()) fileName = GetFile(exp->GetExt(), hwnd, false); else fileName = ReplaceExt(file, exp->GetExt()); if (fileName.empty()) return false; std::wofstream* stream; if (!isBin) { stream = new std::wofstream (fileName.c_str()); if (!stream->is_open()) return false; std::locale filelocale(std::locale(), new codecvt_CodePage<wchar_t>(cp)); stream->imbue(filelocale); exp->SetStream(stream); } else { std::ofstream* cstream = new std::ofstream (fileName.c_str(), std::ios_base::binary); if (!cstream->is_open()) return false; stream = (std::wofstream*)cstream; exp->SetStream(stream); } exp->WriteHeader(fileName, GetFilterName(), GetMyName(), GetMyId(), GetContactName(), GetProtocolName(), GetContactId(), GetBaseProtocol(), encoding); RefreshEventList(); exp->WriteFooter(); if (!isBin) { stream->close(); delete stream; } else { std::ofstream* cstream = (std::ofstream*)stream; cstream->close(); delete cstream; } delete exp; return true; }