使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
// 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;
}