// MBUserPro.cpp : implementation file // #include "stdafx.h" #include "MBUserPro.h" // CMBUserPro CMBUserPro::CMBUserPro() { m_hWnd = NULL; m_strLoginName = _T(""); m_strServerID = _T(""); m_bHideLogin = FALSE; m_bCloseQuickKey = FALSE; m_bRegHotKey = FALSE; //m_bIsAutoAwy = FALSE; //m_bIsProtectAwy = FALSE; //m_nHookAwyTime = 10;// * 60; m_bCaptureHCW = TRUE; m_bCaptureing = FALSE; m_bOnLineSortByOrg = FALSE; m_bShowUserInfo = FALSE; m_nTreeShowStyle = 0; m_nCrowdSortStyle = 0; m_bViewSubLevel = FALSE; m_nFolderCompressLevel = -1; m_bCloseHeadFlashes = FALSE; } CMBUserPro::~CMBUserPro() { CleanData( ); } // CMBUserPro member functions //========================================================= // Çå¿ÕÊý¾Ý //========================================================= void CMBUserPro::CleanData( ) { m_arAttitudeIDI.RemoveAll( ); m_arCommIDI.RemoveAll( ); m_arCrowdIDI.RemoveAll( ); m_arShortcutReply.RemoveAll( ); m_arHotKey.RemoveAll( ); m_strLoginName = _T(""); m_strServerID = _T(""); m_bHideLogin = FALSE; m_bCloseQuickKey = FALSE; m_bRegHotKey = FALSE; //m_bIsAutoAwy = FALSE; //m_bIsProtectAwy = FALSE; //m_nHookAwyTime = 10;// * 60; m_bCaptureHCW = TRUE; m_bCaptureing = FALSE; m_bOnLineSortByOrg = FALSE; m_bShowUserInfo = FALSE; m_nTreeShowStyle = 0; m_nCrowdSortStyle = 0; m_bViewSubLevel = FALSE; m_nFolderCompressLevel = -1; m_bCloseHeadFlashes = FALSE; } void CMBUserPro::SetWndHandle(HWND hWnd ) { m_hWnd = hWnd; } void CMBUserPro::Logined( CString strLoginName,CString strServerID ) { m_strLoginName = strLoginName; m_strServerID = strServerID;; LoadLoginedData( strLoginName, strServerID); } void CMBUserPro::SetCompany( CString strCompany) { m_strCompany = strCompany; } //========================================================= // ×°ÔØÖØÐµÇ¼»òµÇ¼³É¹¦ºóµÄÊý¾Ý //========================================================= void CMBUserPro::LoadLoginedData( CString strLoginName, CString strServerID) { BOOL bHideLogin; BOOL bCloseQuickKey; BOOL bDefMakeCopy; CString strTemp; BOOL bIsProtectAwy(FALSE), bIsAutoAwy(FALSE); int nDefTitleNameType = 0; int nHookAwyTime( 10 ); CString strIniFile, strUserIniFile; strIniFile = CMBUserProFun::GetMBDefIniFile(); strUserIniFile = CMBUserProFun::GetMyIniFile(strLoginName,strServerID); CopyFile(strIniFile, strUserIniFile,TRUE ); strIniFile.Format( _T("%s\\data\\%s"), CBaseCommFun::GetModulePath(), INI_IDIFILE ); strUserIniFile.Format( _T("%s\\%s"), CMBUserProFun::GetMyDataDir(strLoginName,strServerID), INI_IDIFILE ); CopyFile(strIniFile, strUserIniFile,TRUE ); CMBUserProFun::LoadQuickKey( bCloseQuickKey, strLoginName,strServerID ); m_bCloseQuickKey = ( bCloseQuickKey != 0 ); CMBUserProFun::LoadProtectAwy( bIsProtectAwy, bIsAutoAwy, strLoginName,strServerID ); //m_bIsProtectAwy = ( bIsProtectAwy != 0 ); //m_bIsAutoAwy = ( bIsAutoAwy != 0 ); //if ( bIsAutoAwy ) //{ // CMBUserProFun::LoadProtectAwyTime( nHookAwyTime, strLoginName,strServerID ); // m_nHookAwyTime = nHookAwyTime; //} LoadHotKeyInfo( ); CMBUserProFun::LoadCaptureHideCurWnd( m_bCaptureHCW, strLoginName,strServerID ); CMBUserProFun::LoadCompressLevel( m_nFolderCompressLevel, strLoginName,strServerID ); CMBUserProFun::LoadCanHideLogin( bHideLogin , strLoginName,strServerID); CMBUserProFun::LoadQuickKey( bCloseQuickKey , strLoginName,strServerID); CMBUserProFun::LoadDefMakeCopy( bDefMakeCopy , strLoginName,strServerID); m_bHideLogin = bHideLogin; m_arShortcutReply.RemoveAll(); m_arCommIDI.RemoveAll(); m_arCrowdIDI.RemoveAll(); m_arAttitudeIDI.RemoveAll(); CMBUserProFun::LoadIDIData( IDISET_AMSHORTCUTREPLY_SECTION , m_arShortcutReply, strLoginName ,strServerID); CMBUserProFun::LoadIDIData( IDISET_AMCOMM_SECTION , m_arCommIDI, strLoginName,strServerID ); CMBUserProFun::LoadIDIData( IDISET_AMCROWD_SECTION , m_arCrowdIDI, strLoginName ,strServerID); CMBUserProFun::LoadAttitudeIDIData( IDISET_AMATTITUDEIDE_SECTION , m_arAttitudeIDI, strLoginName,strServerID ); CMBUserProFun::LoadShowUserInfo( m_bShowUserInfo, strLoginName,strServerID ); m_nTreeShowStyle = CMBUserProFun::GetTreeShowStyle( strLoginName ,strServerID ); m_nCrowdSortStyle = CMBUserProFun::GetCrowdSortStyle( strLoginName ,strServerID ); CMBUserProFun::IsCloseHeadFlashes(m_bCloseHeadFlashes,strLoginName,strServerID); } void CMBUserPro::ReloadChatShortcutTerm( CString strChatTermTypeName) { if(IDISET_AMSHORTCUTREPLY_SECTION == strChatTermTypeName) { m_arShortcutReply.RemoveAll(); CMBUserProFun::LoadIDIData( strChatTermTypeName , m_arShortcutReply, m_strLoginName ,m_strServerID); } else if(IDISET_AMCOMM_SECTION == strChatTermTypeName) { m_arCommIDI.RemoveAll(); CMBUserProFun::LoadIDIData( strChatTermTypeName , m_arCommIDI, m_strLoginName ,m_strServerID); } else if(IDISET_AMCROWD_SECTION == strChatTermTypeName) { m_arCrowdIDI.RemoveAll(); CMBUserProFun::LoadIDIData( strChatTermTypeName , m_arCrowdIDI, m_strLoginName ,m_strServerID); } else if(IDISET_AMATTITUDEIDE_SECTION == strChatTermTypeName) { m_arAttitudeIDI.RemoveAll(); CMBUserProFun::LoadAttitudeIDIData( strChatTermTypeName , m_arAttitudeIDI, m_strLoginName ,m_strServerID); } } void CMBUserPro::LoadHotKeyInfo( ) { // ×°ÔØÈȼüÐÅÏ¢ int nSize = 0; CMBUserProFun::LoadHotKeyInfo( m_arHotKey, m_strLoginName,m_strServerID ); nSize = m_arHotKey.GetSize( ); if ( nSize == 0 ) { // ²ÉÓÃĬÈ쵀 HOTKEYITEM item; item.strName = _T("´ò¿ªÏûÏ¢·¢ËÍ´°¿Ú"); item.bDefault = TRUE; item.wDefVirtualKeyCode = 83; item.wDefModifiers = 6; item.wVirtualKeyCode = 0; item.wModifiers = 0; m_arHotKey.Add( item ); // Ctrl + Alt + S item.strName = _T("´ò¿ª¶ÁÈ¡ÏûÏ¢´°¿Ú"); item.bDefault = TRUE; item.wDefVirtualKeyCode = 82; item.wDefModifiers = 6; item.wVirtualKeyCode = 0; item.wModifiers = 0; m_arHotKey.Add( item ); // Ctrl + Alt + R item.strName = _T("Æô¶¯ÆÁÄ»²¶×½¹¦ÄÜ"); item.bDefault = TRUE; item.wDefVirtualKeyCode = 65; item.wDefModifiers = 3; item.wVirtualKeyCode = 0; item.wModifiers = 0; m_arHotKey.Add( item ); // Ctrl + Shift = A } nSize = m_arHotKey.GetSize( ); if ( nSize > ID_HOTKEY_END - ID_HOTKEY_BEGIN + 1 ) {// ɾ³ýһЩÈȼü m_arHotKey.RemoveAt( ID_HOTKEY_END - ID_HOTKEY_BEGIN, nSize - ID_HOTKEY_END + ID_HOTKEY_BEGIN - 1); } } void CMBUserPro::DoRegisterHotKey( ) { BOOL bResult = TRUE; if ( !m_bCloseQuickKey && !m_bRegHotKey ) { m_bRegHotKey = TRUE; RegisterMBCHotKey( ); } } void CMBUserPro::DoUnRegisterHotKey( ) { if ( m_bRegHotKey ) { UnRegisterMBCHotKey( ); m_bRegHotKey = FALSE; } } BOOL CMBUserPro::GetHotKeyItem( int nIndex, HOTKEYITEM &item ) { INT_PTR nCount; nCount = m_arHotKey.GetCount( ); if ( nIndex < 0 || nIndex >= nCount ) return FALSE; item = m_arHotKey.GetAt( nIndex ); return TRUE; } void CMBUserPro::RegisterMBCHotKey( ) { INT_PTR nIndex, nCount; HOTKEYITEM item; BOOL bResult = TRUE; UINT nID = ID_HOTKEY_BEGIN; WORD dwVirtualKeyCode, dwModifiers; nCount = m_arHotKey.GetSize( ); for ( nIndex = 0; nIndex < nCount; nIndex++ ) { item = m_arHotKey.GetAt( nIndex ); if ( item.bDefault ) { dwVirtualKeyCode = item.wDefVirtualKeyCode; dwModifiers = item.wDefModifiers; } else { dwVirtualKeyCode = item.wVirtualKeyCode; dwModifiers = item.wModifiers; } if ( dwModifiers != 0 && dwVirtualKeyCode != 0 ) bResult &= RegisterHotKey( m_hWnd, nID, dwModifiers, dwVirtualKeyCode ); nID++; } } void CMBUserPro::UnRegisterMBCHotKey( ) { INT_PTR nIndex, nCount; HOTKEYITEM item; UINT nID = ID_HOTKEY_BEGIN; nCount = m_arHotKey.GetSize( ); for ( nIndex = 0; nIndex < nCount; nIndex++ ) { item = m_arHotKey.GetAt( nIndex ); UnregisterHotKey( m_hWnd, nID ); nID++; } } void CMBUserPro::AddFlashTime( CString strLoginName, CHighTime dtTime ) { if ( strLoginName.IsEmpty() ) return; m_mapFlashLastTime[strLoginName] = dtTime; } BOOL CMBUserPro::GetFlashTime( CString strLoginName, CHighTime &dtTime ) { BOOL bReturn = TRUE; if ( strLoginName.IsEmpty() ) return FALSE; bReturn = m_mapFlashLastTime.Lookup( strLoginName, dtTime ); return bReturn; } BOOL CMBUserPro::ValidateFlash( CString strLoginName ) { CHighTime dtTime; CHighTime dtCur; CHighTimeSpan dtSpan; if ( !GetFlashTime( strLoginName, dtTime ) ) return TRUE; dtCur = CHighTime::GetPresentTime( TRUE ); dtSpan = dtCur - dtTime; if ( dtSpan.GetTotalSeconds() >= FLASH_SPACETIME ) return TRUE; return FALSE; }