summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-04 18:00:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-04 18:00:27 +0000
commit18274fdde5d3a62640c472878fa05cfc228d7299 (patch)
tree27afe06901f950f5b0e11a1e98411654ce30acfe /protocols
parent4efc5e1f7d044d70954842fab1b9c754f04221e6 (diff)
IRC: custom reconnect code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@7048 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/IRCG/res/IRC.rc50
-rw-r--r--protocols/IRCG/src/irc.h7
-rw-r--r--protocols/IRCG/src/irc_dlg.h45
-rw-r--r--protocols/IRCG/src/ircproto.cpp1
-rw-r--r--protocols/IRCG/src/options.cpp1455
-rw-r--r--protocols/IRCG/src/resource.h4
-rw-r--r--protocols/IRCG/src/services.cpp53
-rw-r--r--protocols/IRCG/src/version.h12
-rw-r--r--protocols/IRCG/src/windows.cpp14
9 files changed, 789 insertions, 852 deletions
diff --git a/protocols/IRCG/res/IRC.rc b/protocols/IRCG/res/IRC.rc
index 64081b3469..8a8efad8eb 100644
--- a/protocols/IRCG/res/IRC.rc
+++ b/protocols/IRCG/res/IRC.rc
@@ -16,10 +16,8 @@
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
+#pragma code_page(1251)
/////////////////////////////////////////////////////////////////////////////
//
@@ -63,17 +61,14 @@ BEGIN
CONTROL "&Add",IDC_ADDSERVER,"MButtonClass",WS_DISABLED | WS_TABSTOP,16,116,27,14,WS_EX_NOACTIVATE | 0x10000000L
CONTROL "&Edit",IDC_EDITSERVER,"MButtonClass",WS_DISABLED | WS_TABSTOP,59,116,27,14,WS_EX_NOACTIVATE | 0x10000000L
CONTROL "&Del",IDC_DELETESERVER,"MButtonClass",WS_DISABLED | WS_TABSTOP,102,116,27,14,WS_EX_NOACTIVATE | 0x10000000L
- EDITTEXT IDC_NICK,158,16,63,13,ES_AUTOHSCROLL
- EDITTEXT IDC_NICK2,231,16,63,13,ES_AUTOHSCROLL
- EDITTEXT IDC_NAME,158,40,63,13,ES_AUTOHSCROLL
- EDITTEXT IDC_USERID,231,40,63,13,ES_AUTOHSCROLL
- CONTROL "Enable",IDC_IDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,73,46,15
- EDITTEXT IDC_IDENTSYSTEM,210,73,39,12,ES_AUTOHSCROLL
- EDITTEXT IDC_IDENTPORT,256,73,39,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "only while connecting",IDC_IDENT_TIMED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,87,124,11
- CONTROL "Enable",IDC_RETRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,118,42,10
- EDITTEXT IDC_RETRYWAIT,210,116,39,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
- EDITTEXT IDC_RETRYCOUNT,256,116,39,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
+ EDITTEXT IDC_NICK,237,13,63,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_NICK2,237,32,63,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_NAME,237,51,63,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_USERID,237,71,63,13,ES_AUTOHSCROLL
+ CONTROL "Enable",IDC_IDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,106,46,15
+ EDITTEXT IDC_IDENTSYSTEM,210,106,39,12,ES_AUTOHSCROLL
+ EDITTEXT IDC_IDENTPORT,256,106,39,12,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "only while connecting",IDC_IDENT_TIMED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,120,124,11
CONTROL "Force visible (-i)",IDC_FORCEVISIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,145,134,10
CONTROL "Rejoin channel if kicked",IDC_REJOINONKICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,156,134,10
CONTROL "Rejoin channels on reconnect",IDC_REJOINCHANNELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,167,134,10
@@ -95,22 +90,19 @@ BEGIN
CONTROL "Enable",IDC_STARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,11,73,10
CONTROL "Internet address",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,10,45,81,8,WS_EX_TRANSPARENT
LTEXT "Port range",IDC_STATIC,10,67,69,8,0,WS_EX_TRANSPARENT
- LTEXT "Nick",IDC_STATIC,158,8,68,8,0,WS_EX_TRANSPARENT
- LTEXT "User ID (Ident)",IDC_STATIC,231,31,68,9,0,WS_EX_TRANSPARENT
- LTEXT "Full name (e-mail)",IDC_STATIC,158,31,68,9,0,WS_EX_TRANSPARENT
+ LTEXT "Nick",IDC_STATIC,158,16,72,8,0,WS_EX_TRANSPARENT
+ LTEXT "User ID (Ident)",IDC_STATIC,158,73,72,8,0,WS_EX_TRANSPARENT
+ LTEXT "Full name (e-mail)",IDC_STATIC,158,53,72,8,0,WS_EX_TRANSPARENT
LTEXT "Password",IDC_STATIC,10,90,125,8,0,WS_EX_TRANSPARENT
LTEXT "Server name",IDC_STATIC,10,22,125,8,0,WS_EX_TRANSPARENT
LTEXT "->",IDC_STATIC,71,75,8,8
- LTEXT "Alternative nick",IDC_STATIC,231,8,68,8,0,WS_EX_TRANSPARENT
- GROUPBOX "Ident",IDC_STATIC,150,59,154,42
- LTEXT "System",IDC_STATIC,210,65,39,8,0,WS_EX_TRANSPARENT
- LTEXT "Port",IDC_STATIC,256,65,35,8,0,WS_EX_TRANSPARENT
+ LTEXT "Alternative nick",IDC_STATIC,158,34,72,8,0,WS_EX_TRANSPARENT
+ GROUPBOX "Ident",IDC_STATIC,150,92,154,42
+ LTEXT "System",IDC_STATIC,210,98,39,8,0,WS_EX_TRANSPARENT
+ LTEXT "Port",IDC_STATIC,256,98,35,8,0,WS_EX_TRANSPARENT
GROUPBOX "Default network",IDC_STATIC,2,0,142,134
- GROUPBOX "User info - Required",IDC_STATIC,150,0,154,59
+ GROUPBOX "User info - Required",IDC_STATIC,150,0,154,90
GROUPBOX "Other",IDC_STATIC,2,134,302,92
- GROUPBOX "Reconnect",IDC_STATIC,150,101,154,33
- LTEXT "Wait (s)",IDC_STATIC,210,108,45,8,0,WS_EX_TRANSPARENT
- LTEXT "Retry count",IDC_STATIC,256,108,43,8,0,WS_EX_TRANSPARENT
LTEXT "Check every (s):",IDC_STATIC,158,190,108,8
EDITTEXT IDC_SSL,107,53,28,12,ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER | NOT WS_TABSTOP,WS_EX_RIGHT
LTEXT "SSL",IDC_STATIC,107,45,28,8,0,WS_EX_TRANSPARENT
@@ -460,7 +452,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_PREFS_CONNECT, DIALOG
BEGIN
@@ -693,13 +685,11 @@ IDR_SERVERS TEXT "..\\docs\\IRC_servers.ini"
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -726,7 +716,7 @@ END
#endif // APSTUDIO_INVOKED
-#endif // English (U.S.) resources
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h
index 9c1aef10e6..f6028219ee 100644
--- a/protocols/IRCG/src/irc.h
+++ b/protocols/IRCG/src/irc.h
@@ -298,8 +298,6 @@ struct CIrcProto : public PROTO<CIrcProto>
char m_portEnd[10];
int m_iSSL;
TCHAR m_identPort[10];
- TCHAR m_retryWait[10];
- TCHAR m_retryCount[10];
TCHAR m_nick[30], m_pNick[30];
TCHAR m_alternativeNick[30];
TCHAR m_name[200];
@@ -326,7 +324,6 @@ struct CIrcProto : public PROTO<CIrcProto>
BYTE m_hideServerWindow;
BYTE m_ident;
BYTE m_identTimer;
- BYTE m_retry;
BYTE m_disableDefaultServer;
BYTE m_autoOnlineNotification;
BYTE m_sendKeepAlive;
@@ -366,7 +363,6 @@ struct CIrcProto : public PROTO<CIrcProto>
CIrcSessionInfo si;
- int m_iRetryCount;
int m_portCount;
DWORD m_bConnectRequested;
DWORD m_bConnectThreadRunning;
@@ -476,8 +472,6 @@ struct CIrcProto : public PROTO<CIrcProto>
void DisconnectFromServer(void);
void InitMainMenus(void);
- UINT_PTR RetryTimer;
-
void __cdecl ConnectServerThread( void* );
void __cdecl DisconnectServerThread( void* );
@@ -646,7 +640,6 @@ VOID CALLBACK KeepAliveTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD
VOID CALLBACK OnlineNotifTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
VOID CALLBACK OnlineNotifTimerProc3( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
VOID CALLBACK DCCTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK RetryTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
// options.cpp
diff --git a/protocols/IRCG/src/irc_dlg.h b/protocols/IRCG/src/irc_dlg.h
index 887e9f0d0c..c159bf08d8 100644
--- a/protocols/IRCG/src/irc_dlg.h
+++ b/protocols/IRCG/src/irc_dlg.h
@@ -127,7 +127,7 @@ struct CQuickDlg : public CCoolIrcDlg
virtual void OnDestroy();
CCtrlCombo m_serverCombo;
- void OnServerCombo( CCtrlData* );
+ void OnServerCombo(CCtrlData*);
CCtrlButton m_Ok;
void OnOk( CCtrlButton* );
@@ -151,10 +151,10 @@ struct CManagerDlg : public CCoolIrcDlg
virtual void OnClose();
virtual void OnDestroy();
- void OnCheck( CCtrlData* );
- void OnCheck5( CCtrlData* );
- void OnCheck6( CCtrlData* );
- void OnRadio( CCtrlData* );
+ void OnCheck(CCtrlData*);
+ void OnCheck5(CCtrlData*);
+ void OnCheck6(CCtrlData*);
+ void OnRadio(CCtrlData*);
void OnAdd( CCtrlButton* );
void OnEdit( CCtrlButton* );
@@ -162,8 +162,8 @@ struct CManagerDlg : public CCoolIrcDlg
void OnListDblClick( CCtrlListBox* );
void OnChangeList( CCtrlListBox* );
- void OnChangeModes( CCtrlData* );
- void OnChangeTopic( CCtrlData* );
+ void OnChangeModes(CCtrlData*);
+ void OnChangeTopic(CCtrlData*);
void OnApplyModes( CCtrlButton* );
void OnApplyTopic( CCtrlButton* );
@@ -206,9 +206,6 @@ struct CConnectPrefsDlg : public CProtoDlgBase<CIrcProto>
CCtrlCheck m_ident, m_identTimer;
CCtrlEdit m_identSystem, m_identPort;
- CCtrlCheck m_retry;
- CCtrlEdit m_retryCount, m_retryWait;
-
CCtrlCheck m_forceVisible, m_rejoinOnKick, m_rejoinChannels, m_disableError,
m_address, m_useServer, m_showServer, m_keepAlive, m_autoJoin,
m_oldStyle, m_onlineNotif, m_channelAway, m_enableServer;
@@ -221,16 +218,16 @@ struct CConnectPrefsDlg : public CProtoDlgBase<CIrcProto>
virtual void OnInitDialog();
virtual void OnApply();
- void OnServerCombo( CCtrlData* );
+ void OnServerCombo(CCtrlData*);
void OnAddServer( CCtrlButton* );
void OnDeleteServer( CCtrlButton* );
void OnEditServer( CCtrlButton* );
- void OnStartup( CCtrlData* );
- void OnIdent( CCtrlData* );
- void OnUseServer( CCtrlData* );
- void OnOnlineNotif( CCtrlData* );
- void OnChannelAway( CCtrlData* );
- void OnRetry( CCtrlData* );
+ void OnStartup(CCtrlData*);
+ void OnIdent(CCtrlData*);
+ void OnUseServer(CCtrlData*);
+ void OnOnlineNotif(CCtrlData*);
+ void OnChannelAway(CCtrlData*);
+ void OnRetry(CCtrlData*);
};
//---- the second property page: DCC/CTCP -----------------------------------------------
@@ -249,7 +246,7 @@ struct CCtcpPrefsDlg : public CProtoDlgBase<CIrcProto>
virtual void OnInitDialog();
virtual void OnApply();
- void OnClicked( CCtrlData* );
+ void OnClicked(CCtrlData*);
};
//---- the third property page: Other ---------------------------------------------------
@@ -273,10 +270,10 @@ struct COtherPrefsDlg : public CProtoDlgBase<CIrcProto>
virtual void OnDestroy();
void OnUrl( CCtrlButton* );
- void OnPerformCombo( CCtrlData* );
- void OnCodePage( CCtrlData* );
- void OnPerformEdit( CCtrlData* );
- void OnPerform( CCtrlData* );
+ void OnPerformCombo(CCtrlData*);
+ void OnCodePage(CCtrlData*);
+ void OnPerformEdit(CCtrlData*);
+ void OnPerform(CCtrlData*);
void OnAdd( CCtrlButton* );
void OnDelete( CCtrlButton* );
@@ -302,8 +299,8 @@ struct CIgnorePrefsDlg : public CProtoDlgBase<CIrcProto>
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
void List_OnColumnClick( CCtrlListView::TEventInfo* );
- void OnEnableIgnore( CCtrlData* );
- void OnIgnoreChat( CCtrlData* );
+ void OnEnableIgnore(CCtrlData*);
+ void OnIgnoreChat(CCtrlData*);
void OnAdd( CCtrlButton* );
void OnEdit( CCtrlButton* );
void OnDelete( CCtrlButton* );
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 4c7250951f..6d779a4b39 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -925,7 +925,6 @@ int CIrcProto::SetStatusInternal( int iNewStatus, bool bIsInternal )
DisconnectFromServer();
else if ( iNewStatus == ID_STATUS_OFFLINE && !IsConnected()) //offline to offline
{
- KillChatTimer( RetryTimer);
return 0;
}
else if ( iNewStatus == ID_STATUS_AWAY && IsConnected()) //go to away while connected
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 31a2a2be9a..07ebfe8cef 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -307,18 +307,18 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
CCtrlEdit m_server, m_address, m_port, m_port2;
CCtrlCombo m_groupCombo;
- CServerDlg( CIrcProto* _pro, CConnectPrefsDlg* _owner, int _action ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_ADDSERVER, _owner->GetHwnd()),
- m_owner( _owner ),
- m_action( _action ),
- m_OK( this, IDOK ),
- m_groupCombo( this, IDC_ADD_COMBO ),
- m_address( this, IDC_ADD_ADDRESS ),
- m_server( this, IDC_ADD_SERVER ),
- m_port( this, IDC_ADD_PORT ),
- m_port2( this, IDC_ADD_PORT2 )
+ CServerDlg(CIrcProto* _pro, CConnectPrefsDlg* _owner, int _action) :
+ CProtoDlgBase<CIrcProto>(_pro, IDD_ADDSERVER, _owner->GetHwnd()),
+ m_owner(_owner),
+ m_action(_action),
+ m_OK(this, IDOK),
+ m_groupCombo(this, IDC_ADD_COMBO),
+ m_address(this, IDC_ADD_ADDRESS),
+ m_server(this, IDC_ADD_SERVER),
+ m_port(this, IDC_ADD_PORT),
+ m_port2(this, IDC_ADD_PORT2)
{
- m_OK.OnClick = Callback( this, &CServerDlg::OnOk );
+ m_OK.OnClick = Callback(this, &CServerDlg::OnOk);
m_autoClose = CLOSE_ON_CANCEL;
}
@@ -331,7 +331,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
m_groupCombo.AddStringA( pData->m_group );
}
- if ( m_action == 2 ) {
+ if (m_action == 2) {
int j = m_owner->m_serverCombo.GetCurSel();
SERVER_INFO* pData = ( SERVER_INFO* )m_owner->m_serverCombo.GetItemData( j );
m_address.SetTextA( pData->m_address );
@@ -339,29 +339,29 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
m_port.SetInt( pData->m_portStart );
m_port2.SetInt( pData->m_portEnd );
- char* p = strstr( pData->m_name, ": ");
- if ( p )
+ char *p = strstr(pData->m_name, ": ");
+ if (p)
m_server.SetTextA( p+2 );
- if ( pData->m_iSSL == 0 )
- CheckDlgButton( m_hwnd, IDC_OFF, BST_CHECKED );
- if ( pData->m_iSSL == 1 )
- CheckDlgButton( m_hwnd, IDC_AUTO, BST_CHECKED );
- if ( pData->m_iSSL == 2 )
- CheckDlgButton( m_hwnd, IDC_ON, BST_CHECKED );
+ if (pData->m_iSSL == 0)
+ CheckDlgButton(m_hwnd, IDC_OFF, BST_CHECKED);
+ if (pData->m_iSSL == 1)
+ CheckDlgButton(m_hwnd, IDC_AUTO, BST_CHECKED);
+ if (pData->m_iSSL == 2)
+ CheckDlgButton(m_hwnd, IDC_ON, BST_CHECKED);
}
else {
- CheckDlgButton( m_hwnd, IDC_OFF, BST_CHECKED);
- m_port.SetInt( 6667 );
- m_port2.SetInt( 6667 );
+ CheckDlgButton(m_hwnd, IDC_OFF, BST_CHECKED);
+ m_port.SetInt(6667);
+ m_port2.SetInt(6667);
}
int bEnableSsl = TRUE;
- EnableWindow(GetDlgItem( m_hwnd, IDC_ON), bEnableSsl );
- EnableWindow(GetDlgItem( m_hwnd, IDC_OFF), bEnableSsl );
- EnableWindow(GetDlgItem( m_hwnd, IDC_AUTO), bEnableSsl );
+ EnableWindow(GetDlgItem(m_hwnd, IDC_ON), bEnableSsl);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_OFF), bEnableSsl);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_AUTO), bEnableSsl);
- SetFocus( m_groupCombo.GetHwnd());
+ SetFocus(m_groupCombo.GetHwnd());
}
virtual void OnClose()
@@ -372,20 +372,20 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
m_owner->m_del.Enable();
}
- void OnOk( CCtrlButton* )
+ void OnOk(CCtrlButton*)
{
- for ( int k = 0; k < SIZEOF(sttRequiredFields); k++ )
- if ( !GetWindowTextLength( GetDlgItem( m_hwnd, sttRequiredFields[k] ))) {
- MessageBox( m_hwnd, TranslateT("Please complete all fields"), TranslateT("IRC error"), MB_OK | MB_ICONERROR );
+ for (int k = 0; k < SIZEOF(sttRequiredFields); k++)
+ if (!GetWindowTextLength(GetDlgItem(m_hwnd, sttRequiredFields[k]))) {
+ MessageBox(m_hwnd, TranslateT("Please complete all fields"), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return;
}
- if ( m_action == 2 ) {
+ if (m_action == 2) {
int i = m_owner->m_serverCombo.GetCurSel();
- m_owner->m_serverCombo.DeleteString( i );
+ m_owner->m_serverCombo.DeleteString(i);
}
- SERVER_INFO* pData = new SERVER_INFO;
+ SERVER_INFO *pData = new SERVER_INFO;
pData->m_iSSL = 0;
if(IsDlgButtonChecked( m_hwnd, IDC_ON))
pData->m_iSSL = 2;
@@ -420,8 +420,6 @@ static TDbSetting ConnectSettings[] =
{ FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, SIZEOF(pZero->m_userID) },
{ FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, SIZEOF(pZero->m_identSystem) },
{ FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, SIZEOF(pZero->m_identPort) },
- { FIELD_OFFSET(CIrcProto, m_retryWait), "RetryWait", DBVT_TCHAR, SIZEOF(pZero->m_retryWait) },
- { FIELD_OFFSET(CIrcProto, m_retryCount), "RetryCount", DBVT_TCHAR, SIZEOF(pZero->m_retryCount) },
{ FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, SIZEOF(pZero->m_serverName) },
{ FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, SIZEOF(pZero->m_portStart) },
@@ -444,7 +442,6 @@ static TDbSetting ConnectSettings[] =
{ FIELD_OFFSET(CIrcProto, m_disableErrorPopups), "DisableErrorPopups", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_rejoinChannels), "RejoinChannels", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_rejoinIfKicked), "RejoinIfKicked", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_retry), "Retry", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_showAddresses), "ShowAddresses", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_oldStyleModes), "OldStyleModes", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_useServer), "UseServer", DBVT_BYTE, 0, 1 },
@@ -454,57 +451,53 @@ static TDbSetting ConnectSettings[] =
{ FIELD_OFFSET(CIrcProto, m_autoOnlineNotification), "AutoOnlineNotification", DBVT_BYTE },
};
-CConnectPrefsDlg::CConnectPrefsDlg( CIrcProto* _pro ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_PREFS_CONNECT, NULL ),
- m_serverCombo( this, IDC_SERVERCOMBO ),
- m_server( this, IDC_SERVER ),
- m_port( this, IDC_PORT ),
- m_port2( this, IDC_PORT2 ),
- m_pass( this, IDC_PASS ),
- m_add( this, IDC_ADDSERVER, LoadIconEx(IDI_ADD), LPGEN("Add a new network")),
- m_edit( this, IDC_EDITSERVER, LoadIconEx(IDI_EDIT), LPGEN("Edit this network")),
- m_del( this, IDC_DELETESERVER, LoadIconEx(IDI_DELETE), LPGEN("Delete this network")),
- m_nick( this, IDC_NICK ),
- m_nick2( this, IDC_NICK2 ),
- m_name( this, IDC_NAME ),
- m_userID( this, IDC_USERID ),
- m_ident( this, IDC_IDENT ),
- m_identSystem( this, IDC_IDENTSYSTEM ),
- m_identPort( this, IDC_IDENTPORT ),
- m_identTimer( this, IDC_IDENT_TIMED ),
- m_retry( this, IDC_RETRY ),
- m_retryWait( this, IDC_RETRYWAIT ),
- m_retryCount( this, IDC_RETRYCOUNT ),
- m_forceVisible( this, IDC_FORCEVISIBLE ),
- m_rejoinOnKick( this, IDC_REJOINONKICK ),
- m_rejoinChannels( this, IDC_REJOINCHANNELS ),
- m_disableError( this, IDC_DISABLEERROR ),
- m_address( this, IDC_ADDRESS ),
- m_useServer( this, IDC_USESERVER ),
- m_showServer( this, IDC_SHOWSERVER ),
- m_keepAlive( this, IDC_KEEPALIVE ),
- m_autoJoin( this, IDC_AUTOJOIN ),
- m_oldStyle( this, IDC_OLDSTYLE ),
- m_onlineNotif( this, IDC_ONLINENOTIF ),
- m_channelAway( this, IDC_CHANNELAWAY ),
- m_enableServer( this, IDC_STARTUP ),
- m_onlineTimer( this, IDC_ONLINETIMER ),
- m_limit( this, IDC_LIMIT ),
- m_spin1( this, IDC_SPIN1 ),
- m_spin2( this, IDC_SPIN2 ),
- m_ssl( this, IDC_SSL ),
- m_serverlistModified( false )
-{
- m_serverCombo.OnChange = Callback( this, &CConnectPrefsDlg::OnServerCombo );
- m_add.OnClick = Callback( this, &CConnectPrefsDlg::OnAddServer );
- m_del.OnClick = Callback( this, &CConnectPrefsDlg::OnDeleteServer );
- m_edit.OnClick = Callback( this, &CConnectPrefsDlg::OnEditServer );
- m_enableServer.OnChange = Callback( this, &CConnectPrefsDlg::OnStartup );
- m_ident.OnChange = Callback( this, &CConnectPrefsDlg::OnIdent );
- m_useServer.OnChange = Callback( this, &CConnectPrefsDlg::OnUseServer );
- m_onlineNotif.OnChange = Callback( this, &CConnectPrefsDlg::OnOnlineNotif );
- m_channelAway.OnChange = Callback( this, &CConnectPrefsDlg::OnChannelAway );
- m_retry.OnChange = Callback( this, &CConnectPrefsDlg::OnRetry );
+CConnectPrefsDlg::CConnectPrefsDlg(CIrcProto* _pro) :
+ CProtoDlgBase<CIrcProto>(_pro, IDD_PREFS_CONNECT, NULL),
+ m_serverCombo(this, IDC_SERVERCOMBO),
+ m_server(this, IDC_SERVER),
+ m_port(this, IDC_PORT),
+ m_port2(this, IDC_PORT2),
+ m_pass(this, IDC_PASS),
+ m_add(this, IDC_ADDSERVER, LoadIconEx(IDI_ADD), LPGEN("Add a new network")),
+ m_edit(this, IDC_EDITSERVER, LoadIconEx(IDI_EDIT), LPGEN("Edit this network")),
+ m_del(this, IDC_DELETESERVER, LoadIconEx(IDI_DELETE), LPGEN("Delete this network")),
+ m_nick(this, IDC_NICK),
+ m_nick2(this, IDC_NICK2),
+ m_name(this, IDC_NAME),
+ m_userID(this, IDC_USERID),
+ m_ident(this, IDC_IDENT),
+ m_identSystem(this, IDC_IDENTSYSTEM),
+ m_identPort(this, IDC_IDENTPORT),
+ m_identTimer(this, IDC_IDENT_TIMED),
+ m_forceVisible(this, IDC_FORCEVISIBLE),
+ m_rejoinOnKick(this, IDC_REJOINONKICK),
+ m_rejoinChannels(this, IDC_REJOINCHANNELS),
+ m_disableError(this, IDC_DISABLEERROR),
+ m_address(this, IDC_ADDRESS),
+ m_useServer(this, IDC_USESERVER),
+ m_showServer(this, IDC_SHOWSERVER),
+ m_keepAlive(this, IDC_KEEPALIVE),
+ m_autoJoin(this, IDC_AUTOJOIN),
+ m_oldStyle(this, IDC_OLDSTYLE),
+ m_onlineNotif(this, IDC_ONLINENOTIF),
+ m_channelAway(this, IDC_CHANNELAWAY),
+ m_enableServer(this, IDC_STARTUP),
+ m_onlineTimer(this, IDC_ONLINETIMER),
+ m_limit(this, IDC_LIMIT),
+ m_spin1(this, IDC_SPIN1),
+ m_spin2(this, IDC_SPIN2),
+ m_ssl(this, IDC_SSL),
+ m_serverlistModified(false)
+{
+ m_serverCombo.OnChange = Callback(this, &CConnectPrefsDlg::OnServerCombo);
+ m_add.OnClick = Callback(this, &CConnectPrefsDlg::OnAddServer);
+ m_del.OnClick = Callback(this, &CConnectPrefsDlg::OnDeleteServer);
+ m_edit.OnClick = Callback(this, &CConnectPrefsDlg::OnEditServer);
+ m_enableServer.OnChange = Callback(this, &CConnectPrefsDlg::OnStartup);
+ m_ident.OnChange = Callback(this, &CConnectPrefsDlg::OnIdent);
+ m_useServer.OnChange = Callback(this, &CConnectPrefsDlg::OnUseServer);
+ m_onlineNotif.OnChange = Callback(this, &CConnectPrefsDlg::OnOnlineNotif);
+ m_channelAway.OnChange = Callback(this, &CConnectPrefsDlg::OnChannelAway);
}
void CConnectPrefsDlg::OnInitDialog()
@@ -512,116 +505,113 @@ void CConnectPrefsDlg::OnInitDialog()
m_proto->m_hwndConnect = m_hwnd;
// Fill the servers combo box and create SERVER_INFO structures
- for ( int i=0; i < g_servers.getCount(); i++ ) {
- SERVER_INFO& si = g_servers[i];
+ for (int i = 0; i < g_servers.getCount(); i++) {
+ SERVER_INFO &si = g_servers[i];
m_serverCombo.AddStringA( si.m_name, LPARAM( &si ));
}
- m_serverCombo.SetCurSel( m_proto->m_serverComboSelection );
- m_server.SetTextA( m_proto->m_serverName );
- m_port.SetTextA( m_proto->m_portStart );
- m_port2.SetTextA( m_proto->m_portEnd );
+ m_serverCombo.SetCurSel(m_proto->m_serverComboSelection);
+ m_server.SetTextA(m_proto->m_serverName);
+ m_port.SetTextA(m_proto->m_portStart);
+ m_port2.SetTextA(m_proto->m_portEnd);
- if ( m_proto->m_iSSL == 0 )
- m_ssl.SetText( TranslateT( "Off" ));
- if ( m_proto->m_iSSL == 1 )
- m_ssl.SetText( TranslateT( "Auto" ));
- if ( m_proto->m_iSSL == 2 )
- m_ssl.SetText( TranslateT( "On" ));
+ if (m_proto->m_iSSL == 0)
+ m_ssl.SetText(TranslateT("Off"));
+ if (m_proto->m_iSSL == 1)
+ m_ssl.SetText(TranslateT("Auto"));
+ if (m_proto->m_iSSL == 2)
+ m_ssl.SetText(TranslateT("On"));
- if ( m_proto->m_serverComboSelection != -1 ) {
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( m_proto->m_serverComboSelection );
+ if (m_proto->m_serverComboSelection != -1) {
+ SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(m_proto->m_serverComboSelection);
if ((INT_PTR)pData != CB_ERR) {
- m_server.SetTextA( pData->m_address );
- m_port.SetInt( pData->m_portStart );
- m_port2.SetInt( pData->m_portEnd );
- } }
-
- m_spin1.SendMsg( UDM_SETRANGE,0,MAKELONG(999,20));
- m_spin1.SendMsg( UDM_SETPOS,0,MAKELONG(m_proto->m_onlineNotificationTime,0));
- m_spin2.SendMsg( UDM_SETRANGE,0,MAKELONG(200,0));
- m_spin2.SendMsg( UDM_SETPOS,0,MAKELONG(m_proto->m_onlineNotificationLimit,0));
- m_nick.SetText( m_proto->m_nick);
- m_nick2.SetText( m_proto->m_alternativeNick );
- m_userID.SetText( m_proto->m_userID);
- m_name.SetText( m_proto->m_name);
- m_pass.SetTextA( m_proto->m_password);
- m_identSystem.SetText( m_proto->m_identSystem );
- m_identPort.SetText( m_proto->m_identPort );
- m_retryWait.SetText( m_proto->m_retryWait);
- m_retryCount.SetText( m_proto->m_retryCount);
- m_address.SetState( m_proto->m_showAddresses );
- m_oldStyle.SetState( m_proto->m_oldStyleModes );
- m_channelAway.SetState( m_proto->m_channelAwayNotification );
- m_onlineNotif.SetState( m_proto->m_autoOnlineNotification );
- m_onlineTimer.Enable( m_proto->m_autoOnlineNotification);
- m_channelAway.Enable( m_proto->m_autoOnlineNotification);
- m_spin1.Enable( m_proto->m_autoOnlineNotification );
- m_spin2.Enable( m_proto->m_autoOnlineNotification && m_proto->m_channelAwayNotification );
- m_limit.Enable( m_proto->m_autoOnlineNotification && m_proto->m_channelAwayNotification );
- m_ident.SetState( m_proto->m_ident );
- m_identSystem.Enable( m_proto->m_ident );
- m_identPort.Enable( m_proto->m_ident );
- m_identTimer.Enable( m_proto->m_ident );
- m_identTimer.SetState( m_proto->m_identTimer );
- m_disableError.SetState( m_proto->m_disableErrorPopups );
- m_forceVisible.SetState( m_proto->m_forceVisible );
- m_rejoinChannels.SetState( m_proto->m_rejoinChannels );
- m_rejoinOnKick.SetState( m_proto->m_rejoinIfKicked );
- m_retry.SetState( m_proto->m_retry );
- m_retryWait.Enable( m_proto->m_retry );
- m_retryCount.Enable( m_proto->m_retry );
- m_enableServer.SetState( !m_proto->m_disableDefaultServer );
- m_keepAlive.SetState( m_proto->m_sendKeepAlive );
- m_useServer.SetState( m_proto->m_useServer );
- m_showServer.SetState( !m_proto->m_hideServerWindow );
- m_showServer.Enable( m_proto->m_useServer );
- m_autoJoin.SetState( m_proto->m_joinOnInvite );
-
- m_serverCombo.Enable( !m_proto->m_disableDefaultServer );
- m_add.Enable( !m_proto->m_disableDefaultServer );
- m_edit.Enable( !m_proto->m_disableDefaultServer );
- m_del.Enable( !m_proto->m_disableDefaultServer );
- m_server.Enable( !m_proto->m_disableDefaultServer );
- m_port.Enable( !m_proto->m_disableDefaultServer );
- m_port2.Enable( !m_proto->m_disableDefaultServer );
- m_pass.Enable( !m_proto->m_disableDefaultServer );
-}
-
-void CConnectPrefsDlg::OnServerCombo( CCtrlData* )
+ m_server.SetTextA(pData->m_address);
+ m_port.SetInt(pData->m_portStart);
+ m_port2.SetInt(pData->m_portEnd);
+ }
+ }
+
+ m_spin1.SendMsg(UDM_SETRANGE, 0, MAKELONG(999, 20));
+ m_spin1.SendMsg(UDM_SETPOS, 0, MAKELONG(m_proto->m_onlineNotificationTime, 0));
+ m_spin2.SendMsg(UDM_SETRANGE, 0, MAKELONG(200, 0));
+ m_spin2.SendMsg(UDM_SETPOS, 0, MAKELONG(m_proto->m_onlineNotificationLimit, 0));
+ m_nick.SetText(m_proto->m_nick);
+ m_nick2.SetText(m_proto->m_alternativeNick);
+ m_userID.SetText(m_proto->m_userID);
+ m_name.SetText(m_proto->m_name);
+ m_pass.SetTextA(m_proto->m_password);
+ m_identSystem.SetText(m_proto->m_identSystem);
+ m_identPort.SetText(m_proto->m_identPort);
+ m_address.SetState(m_proto->m_showAddresses);
+ m_oldStyle.SetState(m_proto->m_oldStyleModes);
+ m_channelAway.SetState(m_proto->m_channelAwayNotification);
+ m_onlineNotif.SetState(m_proto->m_autoOnlineNotification);
+ m_onlineTimer.Enable(m_proto->m_autoOnlineNotification);
+ m_channelAway.Enable(m_proto->m_autoOnlineNotification);
+ m_spin1.Enable(m_proto->m_autoOnlineNotification);
+ m_spin2.Enable(m_proto->m_autoOnlineNotification && m_proto->m_channelAwayNotification);
+ m_limit.Enable(m_proto->m_autoOnlineNotification && m_proto->m_channelAwayNotification);
+ m_ident.SetState(m_proto->m_ident);
+ m_identSystem.Enable(m_proto->m_ident);
+ m_identPort.Enable(m_proto->m_ident);
+ m_identTimer.Enable(m_proto->m_ident);
+ m_identTimer.SetState(m_proto->m_identTimer);
+ m_disableError.SetState(m_proto->m_disableErrorPopups);
+ m_forceVisible.SetState(m_proto->m_forceVisible);
+ m_rejoinChannels.SetState(m_proto->m_rejoinChannels);
+ m_rejoinOnKick.SetState(m_proto->m_rejoinIfKicked);
+ m_enableServer.SetState(!m_proto->m_disableDefaultServer);
+ m_keepAlive.SetState(m_proto->m_sendKeepAlive);
+ m_useServer.SetState(m_proto->m_useServer);
+ m_showServer.SetState(!m_proto->m_hideServerWindow);
+ m_showServer.Enable(m_proto->m_useServer);
+ m_autoJoin.SetState(m_proto->m_joinOnInvite);
+
+ m_serverCombo.Enable(!m_proto->m_disableDefaultServer);
+ m_add.Enable(!m_proto->m_disableDefaultServer);
+ m_edit.Enable(!m_proto->m_disableDefaultServer);
+ m_del.Enable(!m_proto->m_disableDefaultServer);
+ m_server.Enable(!m_proto->m_disableDefaultServer);
+ m_port.Enable(!m_proto->m_disableDefaultServer);
+ m_port2.Enable(!m_proto->m_disableDefaultServer);
+ m_pass.Enable(!m_proto->m_disableDefaultServer);
+}
+
+void CConnectPrefsDlg::OnServerCombo(CCtrlData*)
{
int i = m_serverCombo.GetCurSel();
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( i );
- if ( pData && (INT_PTR)pData != CB_ERR ) {
- m_server.SetTextA( pData->m_address );
- m_port.SetInt( pData->m_portStart );
- m_port2.SetInt( pData->m_portEnd );
- m_pass.SetTextA( "" );
-
- if ( pData->m_iSSL == 0 )
- m_ssl.SetText( TranslateT( "Off" ));
- if ( pData->m_iSSL == 1 )
- m_ssl.SetText( TranslateT( "Auto" ));
- if ( pData->m_iSSL == 2 )
- m_ssl.SetText( TranslateT( "On" ));
-
- SendMessage(GetParent( m_hwnd), PSM_CHANGED,0,0);
-} }
+ SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
+ if (pData && (INT_PTR)pData != CB_ERR) {
+ m_server.SetTextA(pData->m_address);
+ m_port.SetInt(pData->m_portStart);
+ m_port2.SetInt(pData->m_portEnd);
+ m_pass.SetTextA("");
+
+ if (pData->m_iSSL == 0)
+ m_ssl.SetText(TranslateT("Off"));
+ if (pData->m_iSSL == 1)
+ m_ssl.SetText(TranslateT("Auto"));
+ if (pData->m_iSSL == 2)
+ m_ssl.SetText(TranslateT("On"));
+
+ SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
+ }
+}
-void CConnectPrefsDlg::OnAddServer( CCtrlButton* )
+void CConnectPrefsDlg::OnAddServer(CCtrlButton*)
{
m_serverCombo.Disable();
m_add.Disable();
m_edit.Disable();
m_del.Disable();
- CServerDlg* dlg = new CServerDlg( m_proto, this, 1 );
+ CServerDlg* dlg = new CServerDlg(m_proto, this, 1);
dlg->Show();
}
void CConnectPrefsDlg::OnDeleteServer( CCtrlButton* )
{
int i = m_serverCombo.GetCurSel();
- if ( i == CB_ERR)
+ if (i == CB_ERR)
return;
m_serverCombo.Disable();
@@ -629,18 +619,18 @@ void CConnectPrefsDlg::OnDeleteServer( CCtrlButton* )
m_edit.Disable();
m_del.Disable();
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( i );
+ SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
TCHAR temp[200];
- mir_sntprintf( temp, SIZEOF(temp), TranslateT("Do you want to delete\r\n%s"), (TCHAR*)_A2T(pData->m_name));
- if ( MessageBox( m_hwnd, temp, TranslateT("Delete server"), MB_YESNO | MB_ICONQUESTION ) == IDYES ) {
- g_servers.remove( pData );
+ mir_sntprintf(temp, SIZEOF(temp), TranslateT("Do you want to delete\r\n%s"), (TCHAR*)_A2T(pData->m_name));
+ if (MessageBox(m_hwnd, temp, TranslateT("Delete server"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ g_servers.remove(pData);
- m_serverCombo.DeleteString( i );
- if ( i >= m_serverCombo.GetCount())
+ m_serverCombo.DeleteString(i);
+ if (i >= m_serverCombo.GetCount())
i--;
- m_serverCombo.SetCurSel( i );
- OnServerCombo( NULL );
- SendMessage(GetParent( m_hwnd), PSM_CHANGED,0,0);
+ m_serverCombo.SetCurSel(i);
+ OnServerCombo(NULL);
+ SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
m_serverlistModified = true;
}
@@ -650,94 +640,86 @@ void CConnectPrefsDlg::OnDeleteServer( CCtrlButton* )
m_del.Enable();
}
-void CConnectPrefsDlg::OnEditServer( CCtrlButton* )
+void CConnectPrefsDlg::OnEditServer(CCtrlButton*)
{
int i = m_serverCombo.GetCurSel();
- if ( i == CB_ERR )
+ if (i == CB_ERR)
return;
m_serverCombo.Disable();
m_add.Disable();
m_edit.Disable();
m_del.Disable();
- CServerDlg* dlg = new CServerDlg( m_proto, this, 2 );
+ CServerDlg *dlg = new CServerDlg(m_proto, this, 2);
dlg->Show();
- SetWindowText( dlg->GetHwnd(), TranslateT( "Edit server" ));
+ SetWindowText(dlg->GetHwnd(), TranslateT("Edit server"));
}
-void CConnectPrefsDlg::OnStartup( CCtrlData* )
-{
- m_serverCombo.Enable( m_enableServer.GetState());
- m_add.Enable( m_enableServer.GetState());
- m_edit.Enable( m_enableServer.GetState());
- m_del.Enable( m_enableServer.GetState());
- m_server.Enable( m_enableServer.GetState());
- m_port.Enable( m_enableServer.GetState());
- m_port2.Enable( m_enableServer.GetState());
- m_pass.Enable( m_enableServer.GetState());
- m_ssl.Enable( m_enableServer.GetState());
-}
-
-void CConnectPrefsDlg::OnIdent( CCtrlData* )
-{
- m_identSystem.Enable( m_ident.GetState());
- m_identPort.Enable( m_ident.GetState());
- m_identTimer.Enable( m_ident.GetState());
+void CConnectPrefsDlg::OnStartup(CCtrlData*)
+{
+ m_serverCombo.Enable(m_enableServer.GetState());
+ m_add.Enable(m_enableServer.GetState());
+ m_edit.Enable(m_enableServer.GetState());
+ m_del.Enable(m_enableServer.GetState());
+ m_server.Enable(m_enableServer.GetState());
+ m_port.Enable(m_enableServer.GetState());
+ m_port2.Enable(m_enableServer.GetState());
+ m_pass.Enable(m_enableServer.GetState());
+ m_ssl.Enable(m_enableServer.GetState());
}
-void CConnectPrefsDlg::OnUseServer( CCtrlData* )
+void CConnectPrefsDlg::OnIdent(CCtrlData*)
{
- EnableWindow(GetDlgItem( m_hwnd, IDC_SHOWSERVER), m_useServer.GetState());
+ m_identSystem.Enable(m_ident.GetState());
+ m_identPort.Enable(m_ident.GetState());
+ m_identTimer.Enable(m_ident.GetState());
}
-void CConnectPrefsDlg::OnOnlineNotif( CCtrlData* )
+void CConnectPrefsDlg::OnUseServer(CCtrlData*)
{
- m_channelAway.Enable( m_onlineNotif.GetState());
- m_onlineTimer.Enable( m_onlineNotif.GetState());
- m_spin1.Enable( m_onlineNotif.GetState());
- m_spin2.Enable( m_onlineNotif.GetState());
- m_limit.Enable( m_onlineNotif.GetState() && m_channelAway.GetState());
+ EnableWindow(GetDlgItem(m_hwnd, IDC_SHOWSERVER), m_useServer.GetState());
}
-void CConnectPrefsDlg::OnChannelAway( CCtrlData* )
+void CConnectPrefsDlg::OnOnlineNotif(CCtrlData*)
{
- m_spin2.Enable( m_onlineNotif.GetState() && m_channelAway.GetState());
- m_limit.Enable( m_onlineNotif.GetState() && m_channelAway.GetState());
+ m_channelAway.Enable(m_onlineNotif.GetState());
+ m_onlineTimer.Enable(m_onlineNotif.GetState());
+ m_spin1.Enable(m_onlineNotif.GetState());
+ m_spin2.Enable(m_onlineNotif.GetState());
+ m_limit.Enable(m_onlineNotif.GetState() && m_channelAway.GetState());
}
-void CConnectPrefsDlg::OnRetry( CCtrlData* )
+void CConnectPrefsDlg::OnChannelAway(CCtrlData*)
{
- m_retryWait.Enable( m_retry.GetState());
- m_retryCount.Enable( m_retry.GetState());
+ m_spin2.Enable(m_onlineNotif.GetState() && m_channelAway.GetState());
+ m_limit.Enable(m_onlineNotif.GetState() && m_channelAway.GetState());
}
void CConnectPrefsDlg::OnApply()
{
//Save the setting in the CONNECT dialog
- if(m_enableServer.GetState()) {
- m_server.GetTextA( m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA( m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA( m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA( m_proto->m_password, SIZEOF(m_proto->m_password));
+ if (m_enableServer.GetState()) {
+ m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
}
else m_proto->m_serverName[0] = m_proto->m_portStart[0] = m_proto->m_portEnd[0] = m_proto->m_password[0] = 0;
- m_proto->m_onlineNotificationTime = SendDlgItemMessage( m_hwnd,IDC_SPIN1,UDM_GETPOS,0,0);
- m_proto->m_onlineNotificationLimit = SendDlgItemMessage( m_hwnd,IDC_SPIN2,UDM_GETPOS,0,0);
+ m_proto->m_onlineNotificationTime = SendDlgItemMessage(m_hwnd, IDC_SPIN1, UDM_GETPOS, 0, 0);
+ m_proto->m_onlineNotificationLimit = SendDlgItemMessage(m_hwnd, IDC_SPIN2, UDM_GETPOS, 0, 0);
m_proto->m_channelAwayNotification = m_channelAway.GetState();
- m_nick.GetText( m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
mir_sntprintf(m_proto->m_pNick, SIZEOF(m_proto->m_pNick), _T("%s"), m_proto->m_nick);
- m_nick2.GetText( m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText( m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText( m_proto->m_name, SIZEOF(m_proto->m_name));
- m_identSystem.GetText( m_proto->m_identSystem, SIZEOF(m_proto->m_identSystem));
- m_identPort.GetText( m_proto->m_identPort, SIZEOF(m_proto->m_identPort));
- m_retryWait.GetText( m_proto->m_retryWait, SIZEOF(m_proto->m_retryWait));
- m_retryCount.GetText( m_proto->m_retryCount, SIZEOF(m_proto->m_retryCount));
+ m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
+ m_identSystem.GetText(m_proto->m_identSystem, SIZEOF(m_proto->m_identSystem));
+ m_identPort.GetText(m_proto->m_identPort, SIZEOF(m_proto->m_identPort));
m_proto->m_disableDefaultServer = !m_enableServer.GetState();
m_proto->m_ident = m_ident.GetState();
m_proto->m_identTimer = m_identTimer.GetState();
@@ -745,72 +727,73 @@ void CConnectPrefsDlg::OnApply()
m_proto->m_disableErrorPopups = m_disableError.GetState();
m_proto->m_rejoinChannels = m_rejoinChannels.GetState();
m_proto->m_rejoinIfKicked = m_rejoinOnKick.GetState();
- m_proto->m_retry = m_retry.GetState();
m_proto->m_showAddresses = m_address.GetState();
m_proto->m_oldStyleModes = m_oldStyle.GetState();
m_proto->m_useServer = m_useServer.GetState();
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS;
- if ( !m_proto->m_useServer )
+ if (!m_proto->m_useServer)
mi.flags |= CMIF_GRAYED;
Menu_ModifyItem(m_proto->hMenuServer, &mi);
m_proto->m_joinOnInvite = m_autoJoin.GetState();
m_proto->m_hideServerWindow = !m_showServer.GetState();
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel();
- if ( m_proto->m_sendKeepAlive = m_keepAlive.GetState())
- m_proto->SetChatTimer(m_proto->KeepAliveTimer, 60*1000, KeepAliveTimerProc);
+ if (m_proto->m_sendKeepAlive = m_keepAlive.GetState())
+ m_proto->SetChatTimer(m_proto->KeepAliveTimer, 60 * 1000, KeepAliveTimerProc);
else
m_proto->KillChatTimer(m_proto->KeepAliveTimer);
m_proto->m_autoOnlineNotification = m_onlineNotif.GetState();
- if ( m_proto->m_autoOnlineNotification ) {
- if ( !m_proto->bTempDisableCheck ) {
- m_proto->SetChatTimer(m_proto->OnlineNotifTimer, 500, OnlineNotifTimerProc );
- if ( m_proto->m_channelAwayNotification )
- m_proto->SetChatTimer( m_proto->OnlineNotifTimer3, 1500, OnlineNotifTimerProc3 );
+ if (m_proto->m_autoOnlineNotification) {
+ if (!m_proto->bTempDisableCheck) {
+ m_proto->SetChatTimer(m_proto->OnlineNotifTimer, 500, OnlineNotifTimerProc);
+ if (m_proto->m_channelAwayNotification)
+ m_proto->SetChatTimer(m_proto->OnlineNotifTimer3, 1500, OnlineNotifTimerProc3);
}
}
- else if ( !m_proto->bTempForceCheck ) {
- m_proto->KillChatTimer( m_proto->OnlineNotifTimer );
- m_proto->KillChatTimer( m_proto->OnlineNotifTimer3 );
+ else if (!m_proto->bTempForceCheck) {
+ m_proto->KillChatTimer(m_proto->OnlineNotifTimer);
+ m_proto->KillChatTimer(m_proto->OnlineNotifTimer3);
}
int i = m_serverCombo.GetCurSel();
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( i );
- if ( pData && (INT_PTR)pData != CB_ERR ) {
- if ( m_enableServer.GetState())
+ SERVER_INFO *pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
+ if (pData && (INT_PTR)pData != CB_ERR) {
+ if (m_enableServer.GetState())
lstrcpyA(m_proto->m_network, pData->m_group);
else
lstrcpyA(m_proto->m_network, "");
m_proto->m_iSSL = pData->m_iSSL;
}
- if ( m_serverlistModified ) {
+ if (m_serverlistModified) {
m_serverlistModified = false;
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)SERVERSMODULE);
int j = m_serverCombo.GetCount();
if (j != CB_ERR && j != 0) {
for (int index2 = 0; index2 < j; index2++) {
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( index2 );
- if ( pData == NULL || (INT_PTR)pData == CB_ERR )
+ SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(index2);
+ if (pData == NULL || (INT_PTR)pData == CB_ERR)
continue;
char TextLine[512];
- if ( pData->m_iSSL > 0 )
+ if (pData->m_iSSL > 0)
mir_snprintf(TextLine, sizeof(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
else
mir_snprintf(TextLine, sizeof(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
- db_set_s( NULL, SERVERSMODULE, pData->m_name, TextLine );
+ db_set_s(NULL, SERVERSMODULE, pData->m_name, TextLine);
// combobox might contain new items
- if ( g_servers.find( pData ) == NULL )
- g_servers.insert( pData );
- } } }
+ if (g_servers.find(pData) == NULL)
+ g_servers.insert(pData);
+ }
+ }
+ }
- m_proto->WriteSettings( ConnectSettings, SIZEOF( ConnectSettings ));
+ m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -831,103 +814,107 @@ static TDbSetting CtcpSettings[] =
};
CCtcpPrefsDlg::CCtcpPrefsDlg( CIrcProto* _pro ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_PREFS_CTCP, NULL ),
- m_enableIP( this, IDC_ENABLEIP ),
- m_fromServer( this, IDC_FROMSERVER ),
- m_combo( this, IDC_COMBO ),
- m_slow( this, IDC_SLOW ),
- m_fast( this, IDC_FAST ),
- m_disc( this, IDC_DISC ),
- m_passive( this, IDC_PASSIVE ),
- m_sendNotice( this, IDC_SENDNOTICE ),
- m_ip( this, IDC_IP ),
- m_userInfo( this, IDC_USERINFO),
- m_radio1( this, IDC_RADIO1 ),
- m_radio2( this, IDC_RADIO2 ),
- m_radio3( this, IDC_RADIO3 )
-{
- m_enableIP.OnChange = Callback( this, &CCtcpPrefsDlg::OnClicked );
- m_fromServer.OnChange = Callback( this, &CCtcpPrefsDlg::OnClicked );
+ CProtoDlgBase<CIrcProto>(_pro, IDD_PREFS_CTCP, NULL),
+ m_enableIP(this, IDC_ENABLEIP),
+ m_fromServer(this, IDC_FROMSERVER),
+ m_combo(this, IDC_COMBO),
+ m_slow(this, IDC_SLOW),
+ m_fast(this, IDC_FAST),
+ m_disc(this, IDC_DISC),
+ m_passive(this, IDC_PASSIVE),
+ m_sendNotice(this, IDC_SENDNOTICE),
+ m_ip(this, IDC_IP),
+ m_userInfo(this, IDC_USERINFO),
+ m_radio1(this, IDC_RADIO1),
+ m_radio2(this, IDC_RADIO2),
+ m_radio3(this, IDC_RADIO3)
+{
+ m_enableIP.OnChange = Callback(this, &CCtcpPrefsDlg::OnClicked);
+ m_fromServer.OnChange = Callback(this, &CCtcpPrefsDlg::OnClicked);
}
void CCtcpPrefsDlg::OnInitDialog()
{
m_userInfo.SetText(m_proto->m_userInfo);
- m_slow.SetState( m_proto->m_DCCMode == 0 );
- m_fast.SetState( m_proto->m_DCCMode == 1 );
- m_disc.SetState( m_proto->m_disconnectDCCChats );
- m_passive.SetState( m_proto->m_DCCPassive );
- m_sendNotice.SetState( m_proto->m_sendNotice );
+ m_slow.SetState(m_proto->m_DCCMode == 0);
+ m_fast.SetState(m_proto->m_DCCMode == 1);
+ m_disc.SetState(m_proto->m_disconnectDCCChats);
+ m_passive.SetState(m_proto->m_DCCPassive);
+ m_sendNotice.SetState(m_proto->m_sendNotice);
- m_combo.AddStringA( "256" );
- m_combo.AddStringA( "512" );
- m_combo.AddStringA( "1024" );
- m_combo.AddStringA( "2048" );
- m_combo.AddStringA( "4096" );
- m_combo.AddStringA( "8192" );
+ m_combo.AddStringA("256");
+ m_combo.AddStringA("512");
+ m_combo.AddStringA("1024");
+ m_combo.AddStringA("2048");
+ m_combo.AddStringA("4096");
+ m_combo.AddStringA("8192");
TCHAR szTemp[10];
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%u"), m_proto->m_DCCPacketSize );
- int i = m_combo.SelectString( szTemp );
- if ( i == CB_ERR )
- m_combo.SelectString( _T("4096"));
-
- if ( m_proto->m_DCCChatAccept == 1 )
- m_radio1.SetState( true );
- if ( m_proto->m_DCCChatAccept == 2 )
- m_radio2.SetState( true );
- if ( m_proto->m_DCCChatAccept == 3 )
- m_radio3.SetState( true );
-
- m_fromServer.SetState( m_proto->m_IPFromServer );
- m_enableIP.SetState( m_proto->m_manualHost );
- m_ip.Enable( m_proto->m_manualHost );
- m_fromServer.Enable( !m_proto->m_manualHost );
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%u"), m_proto->m_DCCPacketSize);
+ int i = m_combo.SelectString(szTemp);
+ if (i == CB_ERR)
+ m_combo.SelectString(_T("4096"));
+
+ if (m_proto->m_DCCChatAccept == 1)
+ m_radio1.SetState(true);
+ if (m_proto->m_DCCChatAccept == 2)
+ m_radio2.SetState(true);
+ if (m_proto->m_DCCChatAccept == 3)
+ m_radio3.SetState(true);
+
+ m_fromServer.SetState(m_proto->m_IPFromServer);
+ m_enableIP.SetState(m_proto->m_manualHost);
+ m_ip.Enable(m_proto->m_manualHost);
+ m_fromServer.Enable(!m_proto->m_manualHost);
if (m_proto->m_manualHost)
- m_ip.SetTextA( m_proto->m_mySpecifiedHost );
+ m_ip.SetTextA(m_proto->m_mySpecifiedHost);
else {
- if ( m_proto->m_IPFromServer ) {
- if ( m_proto->m_myHost[0] ) {
+ if (m_proto->m_IPFromServer) {
+ if (m_proto->m_myHost[0]) {
CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + _T(">");
- m_ip.SetText( s.c_str());
+ m_ip.SetText(s.c_str());
}
- else m_ip.SetText( TranslateT( "<Automatic>" ));
+ else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
- if ( m_proto->m_myLocalHost[0] ) {
- CMString s = ( CMString )TranslateT( "<Local IP: " ) + (TCHAR*)_A2T(m_proto->m_myLocalHost) + _T(">");
- m_ip.SetText( s.c_str());
+ if (m_proto->m_myLocalHost[0]) {
+ CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + _T(">");
+ m_ip.SetText(s.c_str());
}
- else m_ip.SetText( TranslateT( "<Automatic>" ));
-} } }
+ else m_ip.SetText(TranslateT("<Automatic>"));
+ }
+ }
+}
-void CCtcpPrefsDlg::OnClicked( CCtrlData* )
+void CCtcpPrefsDlg::OnClicked(CCtrlData*)
{
- m_ip.Enable( m_enableIP.GetState());
- m_fromServer.Enable( !m_enableIP.GetState());
+ m_ip.Enable(m_enableIP.GetState());
+ m_fromServer.Enable(!m_enableIP.GetState());
- if ( m_enableIP.GetState())
- m_ip.SetTextA( m_proto->m_mySpecifiedHost );
+ if (m_enableIP.GetState())
+ m_ip.SetTextA(m_proto->m_mySpecifiedHost);
else {
- if ( m_fromServer.GetState()) {
- if ( m_proto->m_myHost[0] ) {
- CMString s = (CMString)TranslateT( "<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + _T(">");
- m_ip.SetText( s.c_str());
+ if (m_fromServer.GetState()) {
+ if (m_proto->m_myHost[0]) {
+ CMString s = (CMString)TranslateT("<Resolved IP: ") + (TCHAR*)_A2T(m_proto->m_myHost) + _T(">");
+ m_ip.SetText(s.c_str());
}
- else m_ip.SetText( TranslateT( "<Automatic>" ));
+ else m_ip.SetText(TranslateT("<Automatic>"));
}
else {
- if ( m_proto->m_myLocalHost[0] ) {
- CMString s = ( CMString )TranslateT( "<Local IP: " ) + (TCHAR*)_A2T(m_proto->m_myLocalHost) + _T(">");
- m_ip.SetText( s.c_str());
+ if (m_proto->m_myLocalHost[0]) {
+ CMString s = (CMString)TranslateT("<Local IP: ") + (TCHAR*)_A2T(m_proto->m_myLocalHost) + _T(">");
+ m_ip.SetText(s.c_str());
}
- else m_ip.SetText( TranslateT( "<Automatic>" ));
-} } }
+ else m_ip.SetText(TranslateT("<Automatic>"));
+ }
+ }
+}
void CCtcpPrefsDlg::OnApply()
{
- m_userInfo.GetText( m_proto->m_userInfo, SIZEOF( m_proto->m_userInfo ));
+ m_userInfo.GetText(m_proto->m_userInfo, SIZEOF(m_proto->m_userInfo));
m_proto->m_DCCPacketSize = m_combo.GetInt();
m_proto->m_DCCPassive = m_passive.GetState();
@@ -937,23 +924,23 @@ void CCtcpPrefsDlg::OnApply()
m_proto->m_IPFromServer = m_fromServer.GetState();
m_proto->m_disconnectDCCChats = m_disc.GetState();
- if ( m_enableIP.GetState()) {
+ if (m_enableIP.GetState()) {
char szTemp[500];
- m_ip.GetTextA( szTemp, sizeof( szTemp ));
+ m_ip.GetTextA(szTemp, sizeof(szTemp));
lstrcpynA(m_proto->m_mySpecifiedHost, GetWord(szTemp, 0).c_str(), 499);
- if ( lstrlenA( m_proto->m_mySpecifiedHost ))
- m_proto->ForkThread( &CIrcProto::ResolveIPThread, new IPRESOLVE( m_proto->m_mySpecifiedHost, IP_MANUAL ));
+ if (lstrlenA(m_proto->m_mySpecifiedHost))
+ m_proto->ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_proto->m_mySpecifiedHost, IP_MANUAL));
}
else m_proto->m_mySpecifiedHost[0] = 0;
- if ( m_radio1.GetState())
+ if (m_radio1.GetState())
m_proto->m_DCCChatAccept = 1;
- if ( m_radio2.GetState())
+ if (m_radio2.GetState())
m_proto->m_DCCChatAccept = 2;
- if ( m_radio3.GetState())
+ if (m_radio3.GetState())
m_proto->m_DCCChatAccept = 3;
- m_proto->WriteSettings( CtcpSettings, SIZEOF( CtcpSettings ));
+ m_proto->WriteSettings(CtcpSettings, SIZEOF(CtcpSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -984,8 +971,8 @@ static char* sttPerformEvents[] = {
static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
- case WM_CHAR :
+ switch (msg) {
+ case WM_CHAR:
if (wParam == 21 || wParam == 11 || wParam == 2) {
char w[2];
w[1] = '\0';
@@ -995,8 +982,8 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam,
w[0] = 2;
if (wParam == 21)
w[0] = 31;
- SendMessage( hwndDlg, EM_REPLACESEL, false, (LPARAM) w);
- SendMessage( hwndDlg, EM_SCROLLCARET, 0,0);
+ SendMessage(hwndDlg, EM_REPLACESEL, false, (LPARAM)w);
+ SendMessage(hwndDlg, EM_SCROLLCARET, 0, 0);
return 0;
}
break;
@@ -1005,45 +992,45 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam,
return mir_callNextSubclass(hwndDlg, EditSubclassProc, msg, wParam, lParam);
}
-COtherPrefsDlg::COtherPrefsDlg( CIrcProto* _pro ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_PREFS_OTHER, NULL ),
- m_url( this, IDC_CUSTOM ),
- m_performCombo( this, IDC_PERFORMCOMBO ),
- m_codepage( this, IDC_CODEPAGE ),
- m_pertormEdit( this, IDC_PERFORMEDIT ),
- m_perform( this, IDC_PERFORM ),
- m_scripting( this, IDC_SCRIPT ),
- m_autodetect( this, IDC_UTF_AUTODETECT ),
- m_quitMessage( this, IDC_QUITMESSAGE ),
- m_alias( this, IDC_ALIASEDIT ),
- m_add( this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Click to set commands that will be performed for this event")),
- m_delete( this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Click to delete the commands for this event")),
- m_performlistModified( false )
-{
- m_url.OnClick = Callback( this, &COtherPrefsDlg::OnUrl );
- m_performCombo.OnChange = Callback( this, &COtherPrefsDlg::OnPerformCombo );
- m_codepage.OnChange = Callback( this, &COtherPrefsDlg::OnCodePage );
- m_pertormEdit.OnChange = Callback( this, &COtherPrefsDlg::OnPerformEdit );
- m_perform.OnChange = Callback( this, &COtherPrefsDlg::OnPerform );
- m_add.OnClick = Callback( this, &COtherPrefsDlg::OnAdd );
- m_delete.OnClick = Callback( this, &COtherPrefsDlg::OnDelete );
+COtherPrefsDlg::COtherPrefsDlg(CIrcProto* _pro) :
+ CProtoDlgBase<CIrcProto>(_pro, IDD_PREFS_OTHER, NULL),
+ m_url(this, IDC_CUSTOM),
+ m_performCombo(this, IDC_PERFORMCOMBO),
+ m_codepage(this, IDC_CODEPAGE),
+ m_pertormEdit(this, IDC_PERFORMEDIT),
+ m_perform(this, IDC_PERFORM),
+ m_scripting(this, IDC_SCRIPT),
+ m_autodetect(this, IDC_UTF_AUTODETECT),
+ m_quitMessage(this, IDC_QUITMESSAGE),
+ m_alias(this, IDC_ALIASEDIT),
+ m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Click to set commands that will be performed for this event")),
+ m_delete(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Click to delete the commands for this event")),
+ m_performlistModified(false)
+{
+ m_url.OnClick = Callback(this, &COtherPrefsDlg::OnUrl);
+ m_performCombo.OnChange = Callback(this, &COtherPrefsDlg::OnPerformCombo);
+ m_codepage.OnChange = Callback(this, &COtherPrefsDlg::OnCodePage);
+ m_pertormEdit.OnChange = Callback(this, &COtherPrefsDlg::OnPerformEdit);
+ m_perform.OnChange = Callback(this, &COtherPrefsDlg::OnPerform);
+ m_add.OnClick = Callback(this, &COtherPrefsDlg::OnAdd);
+ m_delete.OnClick = Callback(this, &COtherPrefsDlg::OnDelete);
}
void COtherPrefsDlg::OnInitDialog()
{
- mir_subclassWindow( m_alias.GetHwnd(), EditSubclassProc);
- mir_subclassWindow( m_quitMessage.GetHwnd(), EditSubclassProc);
- mir_subclassWindow( m_pertormEdit.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow(m_alias.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow(m_quitMessage.GetHwnd(), EditSubclassProc);
+ mir_subclassWindow(m_pertormEdit.GetHwnd(), EditSubclassProc);
- m_alias.SetText( m_proto->m_alias );
- m_quitMessage.SetText( m_proto->m_quitMessage );
- m_perform.SetState( m_proto->m_perform );
- m_scripting.SetState( m_proto->m_scriptingEnabled );
- m_scripting.Enable( m_bMbotInstalled );
- m_performCombo.Enable( m_proto->m_perform );
- m_pertormEdit.Enable( m_proto->m_perform );
- m_add.Enable( m_proto->m_perform );
- m_delete.Enable( m_proto->m_perform );
+ m_alias.SetText(m_proto->m_alias);
+ m_quitMessage.SetText(m_proto->m_quitMessage);
+ m_perform.SetState(m_proto->m_perform);
+ m_scripting.SetState(m_proto->m_scriptingEnabled);
+ m_scripting.Enable(m_bMbotInstalled);
+ m_performCombo.Enable(m_proto->m_perform);
+ m_pertormEdit.Enable(m_proto->m_perform);
+ m_add.Enable(m_proto->m_perform);
+ m_delete.Enable(m_proto->m_perform);
m_codepage.AddString(TranslateT("Default ANSI codepage"), CP_ACP);
@@ -1051,222 +1038,232 @@ void COtherPrefsDlg::OnInitDialog()
EnumSystemCodePagesA(sttLangAddCallback, CP_INSTALLED);
int i;
- for ( i = m_codepage.GetCount(); i >= 0; i-- ) {
- if ( m_codepage.GetItemData( i ) == m_proto->getCodepage()) {
- m_codepage.SetCurSel( i );
+ for (i = m_codepage.GetCount(); i >= 0; i--) {
+ if (m_codepage.GetItemData(i) == m_proto->getCodepage()) {
+ m_codepage.SetCurSel(i);
break;
- } }
+ }
+ }
+
-
- if ( m_proto->m_codepage == CP_UTF8 )
+ if (m_proto->m_codepage == CP_UTF8)
m_autodetect.Disable();
- for ( i=0; i < g_servers.getCount(); i++ ) {
+ for (i = 0; i < g_servers.getCount(); i++) {
SERVER_INFO& si = g_servers[i];
- int idx = m_performCombo.FindStringA( si.m_group, -1, true );
- if ( idx == CB_ERR ) {
- idx = m_performCombo.AddStringA( si.m_group );
- addPerformComboValue( idx, si.m_group );
- } }
-
- for ( i=0; i < SIZEOF(sttPerformEvents); i++ ) {
- int idx = m_performCombo.InsertString( _A2T( sttPerformEvents[i] ), i );
- addPerformComboValue( idx, sttPerformEvents[i] );
+ int idx = m_performCombo.FindStringA(si.m_group, -1, true);
+ if (idx == CB_ERR) {
+ idx = m_performCombo.AddStringA(si.m_group);
+ addPerformComboValue(idx, si.m_group);
+ }
}
- m_performCombo.SetCurSel( 0 );
- OnPerformCombo( NULL );
- m_autodetect.SetState( m_proto->m_utfAutodetect );
+ for (i = 0; i < SIZEOF(sttPerformEvents); i++) {
+ int idx = m_performCombo.InsertString(_A2T(sttPerformEvents[i]), i);
+ addPerformComboValue(idx, sttPerformEvents[i]);
+ }
+
+ m_performCombo.SetCurSel(0);
+ OnPerformCombo(NULL);
+ m_autodetect.SetState(m_proto->m_utfAutodetect);
}
-void COtherPrefsDlg::OnUrl( CCtrlButton* )
+void COtherPrefsDlg::OnUrl(CCtrlButton*)
{
CallService(MS_UTILS_OPENURL, 0, (LPARAM)"http://members.chello.se/matrix/index.html");
}
-void COtherPrefsDlg::OnPerformCombo( CCtrlData* )
+void COtherPrefsDlg::OnPerformCombo(CCtrlData*)
{
int i = m_performCombo.GetCurSel();
- PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData( i );
+ PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
if (pPerf == 0)
- m_pertormEdit.SetTextA( "" );
+ m_pertormEdit.SetTextA("");
else
- m_pertormEdit.SetText( pPerf->mText.c_str());
+ m_pertormEdit.SetText(pPerf->mText.c_str());
m_add.Disable();
- if ( GetWindowTextLength( m_pertormEdit.GetHwnd()) != 0)
+ if (GetWindowTextLength(m_pertormEdit.GetHwnd()) != 0)
m_delete.Enable();
else
m_delete.Disable();
}
-void COtherPrefsDlg::OnCodePage( CCtrlData* )
+void COtherPrefsDlg::OnCodePage(CCtrlData*)
{
int curSel = m_codepage.GetCurSel();
- m_autodetect.Enable( m_codepage.GetItemData(curSel) != CP_UTF8 );
+ m_autodetect.Enable(m_codepage.GetItemData(curSel) != CP_UTF8);
}
-void COtherPrefsDlg::OnPerformEdit( CCtrlData* )
+void COtherPrefsDlg::OnPerformEdit(CCtrlData*)
{
m_add.Enable();
- if ( GetWindowTextLength( m_pertormEdit.GetHwnd()) != 0)
+ if (GetWindowTextLength(m_pertormEdit.GetHwnd()) != 0)
m_delete.Enable();
else
m_delete.Disable();
}
-void COtherPrefsDlg::OnPerform( CCtrlData* )
+void COtherPrefsDlg::OnPerform(CCtrlData*)
{
- m_performCombo.Enable( m_perform.GetState());
- m_pertormEdit.Enable( m_perform.GetState());
- m_add.Enable( m_perform.GetState());
- m_delete.Enable( m_perform.GetState());
+ m_performCombo.Enable(m_perform.GetState());
+ m_pertormEdit.Enable(m_perform.GetState());
+ m_add.Enable(m_perform.GetState());
+ m_delete.Enable(m_perform.GetState());
}
-void COtherPrefsDlg::OnAdd( CCtrlButton* )
+void COtherPrefsDlg::OnAdd(CCtrlButton*)
{
TCHAR* temp = m_pertormEdit.GetText();
- if ( my_strstri( temp, _T("/away")))
- MessageBox( NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
+ if (my_strstri(temp, _T("/away")))
+ MessageBox(NULL, TranslateT("The usage of /AWAY in your perform buffer is restricted\n as IRC sends this command automatically."), TranslateT("IRC Error"), MB_OK);
else {
int i = m_performCombo.GetCurSel();
- if ( i != CB_ERR ) {
- PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData( i );
- if ( pPerf != NULL )
+ if (i != CB_ERR) {
+ PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
+ if (pPerf != NULL)
pPerf->mText = temp;
m_add.Disable();
m_performlistModified = true;
- } }
- mir_free( temp );
+ }
+ }
+ mir_free(temp);
}
-void COtherPrefsDlg::OnDelete( CCtrlButton* )
+void COtherPrefsDlg::OnDelete(CCtrlButton*)
{
int i = m_performCombo.GetCurSel();
- if ( i != CB_ERR ) {
- PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData( i );
- if ( pPerf != NULL ) {
+ if (i != CB_ERR) {
+ PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
+ if (pPerf != NULL) {
pPerf->mText = _T("");
- m_pertormEdit.SetTextA( "" );
+ m_pertormEdit.SetTextA("");
m_delete.Disable();
m_add.Disable();
}
m_performlistModified = true;
-} }
+ }
+}
void COtherPrefsDlg::OnDestroy()
{
int i = m_performCombo.GetCount();
- if ( i != CB_ERR && i != 0 ) {
+ if (i != CB_ERR && i != 0) {
for (int index = 0; index < i; index++) {
- PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData( index );
- if (( INT_PTR )pPerf != CB_ERR && pPerf != NULL )
+ PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(index);
+ if ((INT_PTR)pPerf != CB_ERR && pPerf != NULL)
delete pPerf;
-} } }
+ }
+ }
+}
void COtherPrefsDlg::OnApply()
{
- mir_free( m_proto->m_alias );
+ mir_free(m_proto->m_alias);
m_proto->m_alias = m_alias.GetText();
- m_quitMessage.GetText( m_proto->m_quitMessage, SIZEOF( m_proto->m_quitMessage ));
+ m_quitMessage.GetText(m_proto->m_quitMessage, SIZEOF(m_proto->m_quitMessage));
int curSel = m_codepage.GetCurSel();
- m_proto->m_codepage = m_codepage.GetItemData( curSel );
- if ( m_proto->IsConnected())
- m_proto->setCodepage( m_proto->m_codepage );
+ m_proto->m_codepage = m_codepage.GetItemData(curSel);
+ if (m_proto->IsConnected())
+ m_proto->setCodepage(m_proto->m_codepage);
m_proto->m_utfAutodetect = m_autodetect.GetState();
m_proto->m_perform = m_perform.GetState();
m_proto->m_scriptingEnabled = m_scripting.GetState();
- if ( m_add.Enabled())
- OnAdd( NULL );
+ if (m_add.Enabled())
+ OnAdd(NULL);
- if ( m_performlistModified ) {
+ if (m_performlistModified) {
int count = m_performCombo.GetCount();
- for ( int i = 0; i < count; i++ ) {
- PERFORM_INFO* pPerf = ( PERFORM_INFO* )m_performCombo.GetItemData( i );
- if (( INT_PTR )pPerf == CB_ERR )
+ for (int i = 0; i < count; i++) {
+ PERFORM_INFO* pPerf = (PERFORM_INFO*)m_performCombo.GetItemData(i);
+ if ((INT_PTR)pPerf == CB_ERR)
continue;
- if ( !pPerf->mText.IsEmpty())
- m_proto->setTString( pPerf->mSetting.c_str(), pPerf->mText.c_str());
+ if (!pPerf->mText.IsEmpty())
+ m_proto->setTString(pPerf->mSetting.c_str(), pPerf->mText.c_str());
else
- db_unset( NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
- } }
- m_proto->WriteSettings( OtherSettings, SIZEOF( OtherSettings ));
+ db_unset(NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
+ }
+ }
+ m_proto->WriteSettings(OtherSettings, SIZEOF(OtherSettings));
}
-void COtherPrefsDlg::addPerformComboValue( int idx, const char* szValueName )
+void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
{
String sSetting = String("PERFORM:") + szValueName;
sSetting.MakeUpper();
PERFORM_INFO* pPref;
DBVARIANT dbv;
- if ( !m_proto->getTString( sSetting.c_str(), &dbv )) {
- pPref = new PERFORM_INFO( sSetting.c_str(), dbv.ptszVal );
- db_free( &dbv );
+ if (!m_proto->getTString(sSetting.c_str(), &dbv)) {
+ pPref = new PERFORM_INFO(sSetting.c_str(), dbv.ptszVal);
+ db_free(&dbv);
}
- else pPref = new PERFORM_INFO( sSetting.c_str(), _T(""));
- m_performCombo.SetItemData( idx, ( LPARAM )pPref );
+ else pPref = new PERFORM_INFO(sSetting.c_str(), _T(""));
+ m_performCombo.SetItemData(idx, (LPARAM)pPref);
}
/////////////////////////////////////////////////////////////////////////////////////////
// 'add ignore' preferences dialog
-CAddIgnoreDlg::CAddIgnoreDlg( CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_ADDIGNORE, _owner->GetHwnd()),
- m_Ok( this, IDOK ),
- m_owner( _owner )
+CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg* _owner) :
+CProtoDlgBase<CIrcProto>(_pro, IDD_ADDIGNORE, _owner->GetHwnd()),
+m_Ok(this, IDOK),
+m_owner(_owner)
{
- if ( mask == NULL )
+ if (mask == NULL)
szOldMask[0] = 0;
else
- _tcsncpy( szOldMask, mask, SIZEOF(szOldMask));
+ _tcsncpy(szOldMask, mask, SIZEOF(szOldMask));
- m_Ok.OnClick = Callback( this, &CAddIgnoreDlg::OnOk );
+ m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk);
}
void CAddIgnoreDlg::OnInitDialog()
{
- if ( szOldMask[0] == 0 ) {
- if ( m_proto->IsConnected())
- SetWindowText(GetDlgItem( m_hwnd, IDC_NETWORK), m_proto->m_info.sNetwork.c_str());
- CheckDlgButton( m_hwnd, IDC_Q, BST_CHECKED);
- CheckDlgButton( m_hwnd, IDC_N, BST_CHECKED);
- CheckDlgButton( m_hwnd, IDC_I, BST_CHECKED);
- CheckDlgButton( m_hwnd, IDC_D, BST_CHECKED);
- CheckDlgButton( m_hwnd, IDC_C, BST_CHECKED);
-} }
+ if (szOldMask[0] == 0) {
+ if (m_proto->IsConnected())
+ SetWindowText(GetDlgItem(m_hwnd, IDC_NETWORK), m_proto->m_info.sNetwork.c_str());
+ CheckDlgButton(m_hwnd, IDC_Q, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_N, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_I, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_D, BST_CHECKED);
+ CheckDlgButton(m_hwnd, IDC_C, BST_CHECKED);
+ }
+}
-void CAddIgnoreDlg::OnOk( CCtrlButton* )
+void CAddIgnoreDlg::OnOk(CCtrlButton*)
{
TCHAR szMask[500];
TCHAR szNetwork[500];
CMString flags;
- if ( IsDlgButtonChecked( m_hwnd, IDC_Q ) == BST_CHECKED ) flags += 'q';
- if ( IsDlgButtonChecked( m_hwnd, IDC_N ) == BST_CHECKED ) flags += 'n';
- if ( IsDlgButtonChecked( m_hwnd, IDC_I ) == BST_CHECKED ) flags += 'i';
- if ( IsDlgButtonChecked( m_hwnd, IDC_D ) == BST_CHECKED ) flags += 'd';
- if ( IsDlgButtonChecked( m_hwnd, IDC_C ) == BST_CHECKED ) flags += 'c';
- if ( IsDlgButtonChecked( m_hwnd, IDC_M ) == BST_CHECKED ) flags += 'm';
+ if (IsDlgButtonChecked(m_hwnd, IDC_Q) == BST_CHECKED) flags += 'q';
+ if (IsDlgButtonChecked(m_hwnd, IDC_N) == BST_CHECKED) flags += 'n';
+ if (IsDlgButtonChecked(m_hwnd, IDC_I) == BST_CHECKED) flags += 'i';
+ if (IsDlgButtonChecked(m_hwnd, IDC_D) == BST_CHECKED) flags += 'd';
+ if (IsDlgButtonChecked(m_hwnd, IDC_C) == BST_CHECKED) flags += 'c';
+ if (IsDlgButtonChecked(m_hwnd, IDC_M) == BST_CHECKED) flags += 'm';
- GetWindowText( GetDlgItem( m_hwnd, IDC_MASK), szMask, SIZEOF(szMask));
- GetWindowText( GetDlgItem( m_hwnd, IDC_NETWORK), szNetwork, SIZEOF(szNetwork));
+ GetWindowText(GetDlgItem(m_hwnd, IDC_MASK), szMask, SIZEOF(szMask));
+ GetWindowText(GetDlgItem(m_hwnd, IDC_NETWORK), szNetwork, SIZEOF(szNetwork));
CMString Mask = GetWord(szMask, 0);
- if ( Mask.GetLength() != 0 ) {
- if ( !_tcschr(Mask.c_str(), '!') && !_tcschr(Mask.c_str(), '@'))
+ if (Mask.GetLength() != 0) {
+ if (!_tcschr(Mask.c_str(), '!') && !_tcschr(Mask.c_str(), '@'))
Mask += _T("!*@*");
- if ( !flags.IsEmpty()) {
- if ( *szOldMask )
- m_proto->RemoveIgnore( szOldMask );
+ if (!flags.IsEmpty()) {
+ if (*szOldMask)
+ m_proto->RemoveIgnore(szOldMask);
m_proto->AddIgnore(Mask.c_str(), flags.c_str(), szNetwork);
-} } }
+ }
+ }
+}
void CAddIgnoreDlg::OnClose()
{
@@ -1278,17 +1275,17 @@ void CAddIgnoreDlg::OnClose()
static TDbSetting IgnoreSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_DCCFileEnabled ), "EnableCtcpFile", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_DCCChatEnabled ), "EnableCtcpChat", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_DCCChatIgnore), "CtcpChatIgnore", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_ignore ), "Ignore", DBVT_BYTE },
- { FIELD_OFFSET(CIrcProto, m_ignoreChannelDefault ), "IgnoreChannelDefault", DBVT_BYTE },
+ { FIELD_OFFSET(CIrcProto, m_DCCFileEnabled), "EnableCtcpFile", DBVT_BYTE, 0, 1 },
+ { FIELD_OFFSET(CIrcProto, m_DCCChatEnabled), "EnableCtcpChat", DBVT_BYTE, 0, 1 },
+ { FIELD_OFFSET(CIrcProto, m_DCCChatIgnore), "CtcpChatIgnore", DBVT_BYTE, 0, 1 },
+ { FIELD_OFFSET(CIrcProto, m_ignore), "Ignore", DBVT_BYTE },
+ { FIELD_OFFSET(CIrcProto, m_ignoreChannelDefault), "IgnoreChannelDefault", DBVT_BYTE },
};
static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
- CIgnorePrefsDlg* hwndDlg = ( CIgnorePrefsDlg* )lParamSort;
- if ( !hwndDlg->GetHwnd())
+ CIgnorePrefsDlg* hwndDlg = (CIgnorePrefsDlg*)lParamSort;
+ if (!hwndDlg->GetHwnd())
return 1;
TCHAR temp1[512];
@@ -1301,23 +1298,23 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam
lvm.iItem = lParam1;
lvm.pszText = temp1;
- hwndDlg->m_list.GetItem( &lvm );
+ hwndDlg->m_list.GetItem(&lvm);
lvm.iItem = lParam2;
lvm.pszText = temp2;
- hwndDlg->m_list.GetItem( &lvm );
+ hwndDlg->m_list.GetItem(&lvm);
- if ( temp1[0] && temp2[0] )
- return lstrcmpi( temp1, temp2 );
+ if (temp1[0] && temp2[0])
+ return lstrcmpi(temp1, temp2);
- return ( temp1[0] == 0 ) ? 1 : -1;
+ return (temp1[0] == 0) ? 1 : -1;
}
static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_KEYUP :
- if ( ListView_GetSelectionMark(GetDlgItem(GetParent(hwnd), IDC_LIST)) != -1) {
+ case WM_KEYUP:
+ if (ListView_GetSelectionMark(GetDlgItem(GetParent(hwnd), IDC_LIST)) != -1) {
EnableWindow(GetDlgItem(GetParent(hwnd), IDC_EDIT), true);
EnableWindow(GetDlgItem(GetParent(hwnd), IDC_DELETE), true);
}
@@ -1339,96 +1336,98 @@ static LRESULT CALLBACK ListviewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
// Callback for the 'Add ignore' dialog
-void CIrcProto::InitIgnore( void )
+void CIrcProto::InitIgnore(void)
{
- TCHAR szTemp[ MAX_PATH ];
+ TCHAR szTemp[MAX_PATH];
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%miranda_path%%\\Plugins\\%S_ignore.ini"), m_szModuleName);
- TCHAR *szLoadFileName = Utils_ReplaceVarsT( szTemp );
+ TCHAR *szLoadFileName = Utils_ReplaceVarsT(szTemp);
char* pszIgnoreData = IrcLoadFile(szLoadFileName);
- if ( pszIgnoreData != NULL ) {
+ if (pszIgnoreData != NULL) {
char *p1 = pszIgnoreData;
- while ( *p1 != '\0' ) {
- while ( *p1 == '\r' || *p1 == '\n' )
+ while (*p1 != '\0') {
+ while (*p1 == '\r' || *p1 == '\n')
p1++;
- if ( *p1 == '\0' )
+ if (*p1 == '\0')
break;
- char* p2 = strstr( p1, "\r\n" );
- if ( !p2 )
- p2 = strchr( p1, '\0' );
+ char* p2 = strstr(p1, "\r\n");
+ if (!p2)
+ p2 = strchr(p1, '\0');
char* pTemp = p2;
- while ( pTemp > p1 && (*pTemp == '\r' || *pTemp == '\n' ||*pTemp == '\0' || *pTemp == ' ' ))
+ while (pTemp > p1 && (*pTemp == '\r' || *pTemp == '\n' || *pTemp == '\0' || *pTemp == ' '))
pTemp--;
*++pTemp = 0;
String mask = GetWord(p1, 0);
String flags = GetWord(p1, 1);
String network = GetWord(p1, 2);
- if ( !mask.IsEmpty())
- m_ignoreItems.insert( new CIrcIgnoreItem( getCodepage(), mask.c_str(), flags.c_str(), network.c_str()));
+ if (!mask.IsEmpty())
+ m_ignoreItems.insert(new CIrcIgnoreItem(getCodepage(), mask.c_str(), flags.c_str(), network.c_str()));
p1 = p2;
}
RewriteIgnoreSettings();
delete[] pszIgnoreData;
- ::_tremove( szLoadFileName );
+ ::_tremove(szLoadFileName);
}
- mir_free( szLoadFileName );
+ mir_free(szLoadFileName);
int idx = 0;
char settingName[40];
- for ( ;; ) {
- mir_snprintf( settingName, sizeof(settingName), "IGNORE:%d", idx++ );
+ for (;;) {
+ mir_snprintf(settingName, sizeof(settingName), "IGNORE:%d", idx++);
DBVARIANT dbv;
- if ( getTString( settingName, &dbv ))
+ if (getTString(settingName, &dbv))
break;
- CMString mask = GetWord( dbv.ptszVal, 0 );
- CMString flags = GetWord( dbv.ptszVal, 1 );
- CMString network = GetWord( dbv.ptszVal, 2 );
- m_ignoreItems.insert( new CIrcIgnoreItem( mask.c_str(), flags.c_str(), network.c_str()));
- db_free( &dbv );
-} }
+ CMString mask = GetWord(dbv.ptszVal, 0);
+ CMString flags = GetWord(dbv.ptszVal, 1);
+ CMString network = GetWord(dbv.ptszVal, 2);
+ m_ignoreItems.insert(new CIrcIgnoreItem(mask.c_str(), flags.c_str(), network.c_str()));
+ db_free(&dbv);
+ }
+}
-void CIrcProto::RewriteIgnoreSettings( void )
+void CIrcProto::RewriteIgnoreSettings(void)
{
- char settingName[ 40 ];
+ char settingName[40];
- int i=0;
- for ( ;; ) {
- mir_snprintf( settingName, sizeof(settingName), "IGNORE:%d", i++ );
- if ( db_unset( NULL, m_szModuleName, settingName ))
+ int i = 0;
+ for (;;) {
+ mir_snprintf(settingName, sizeof(settingName), "IGNORE:%d", i++);
+ if (db_unset(NULL, m_szModuleName, settingName))
break;
}
- for ( i=0; i < m_ignoreItems.getCount(); i++ ) {
- mir_snprintf( settingName, sizeof(settingName), "IGNORE:%d", i );
+ for (i = 0; i < m_ignoreItems.getCount(); i++) {
+ mir_snprintf(settingName, sizeof(settingName), "IGNORE:%d", i);
CIrcIgnoreItem& C = m_ignoreItems[i];
- setTString( settingName, ( C.mask + _T(" ") + C.flags + _T(" ") + C.network ).c_str());
-} }
+ setTString(settingName, (C.mask + _T(" ") + C.flags + _T(" ") + C.network).c_str());
+ }
+}
-CIgnorePrefsDlg::CIgnorePrefsDlg( CIrcProto* _pro ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_PREFS_IGNORE, NULL ),
- m_list( this, IDC_LIST ),
- m_add( this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Add new ignore")),
- m_edit( this, IDC_EDIT, LoadIconEx(IDI_EDIT), LPGEN("Edit this ignore")),
- m_del( this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Delete this ignore")),
- m_enable( this, IDC_ENABLEIGNORE ),
- m_ignoreChat( this, IDC_IGNORECHAT ),
- m_ignoreFile( this, IDC_IGNOREFILE ),
- m_ignoreChannel( this, IDC_IGNORECHANNEL ),
- m_ignoreUnknown( this, IDC_IGNOREUNKNOWN )
-{
- m_enable.OnChange = Callback( this, &CIgnorePrefsDlg::OnEnableIgnore );
- m_ignoreChat.OnChange = Callback( this, &CIgnorePrefsDlg::OnIgnoreChat );
- m_add.OnClick = Callback( this, &CIgnorePrefsDlg::OnAdd );
- m_list.OnDoubleClick = m_edit.OnClick = Callback( this, &CIgnorePrefsDlg::OnEdit );
- m_del.OnClick = Callback( this, &CIgnorePrefsDlg::OnDelete );
- m_list.OnColumnClick = Callback( this, &CIgnorePrefsDlg::List_OnColumnClick );
+CIgnorePrefsDlg::CIgnorePrefsDlg(CIrcProto* _pro) :
+CProtoDlgBase<CIrcProto>(_pro, IDD_PREFS_IGNORE, NULL),
+m_list(this, IDC_LIST),
+m_add(this, IDC_ADD, LoadIconEx(IDI_ADD), LPGEN("Add new ignore")),
+m_edit(this, IDC_EDIT, LoadIconEx(IDI_EDIT), LPGEN("Edit this ignore")),
+m_del(this, IDC_DELETE, LoadIconEx(IDI_DELETE), LPGEN("Delete this ignore")),
+m_enable(this, IDC_ENABLEIGNORE),
+m_ignoreChat(this, IDC_IGNORECHAT),
+m_ignoreFile(this, IDC_IGNOREFILE),
+m_ignoreChannel(this, IDC_IGNORECHANNEL),
+m_ignoreUnknown(this, IDC_IGNOREUNKNOWN)
+{
+ m_enable.OnChange = Callback(this, &CIgnorePrefsDlg::OnEnableIgnore);
+ m_ignoreChat.OnChange = Callback(this, &CIgnorePrefsDlg::OnIgnoreChat);
+ m_add.OnClick = Callback(this, &CIgnorePrefsDlg::OnAdd);
+ m_list.OnDoubleClick = m_edit.OnClick = Callback(this, &CIgnorePrefsDlg::OnEdit);
+ m_del.OnClick = Callback(this, &CIgnorePrefsDlg::OnDelete);
+ m_list.OnColumnClick = Callback(this, &CIgnorePrefsDlg::List_OnColumnClick);
}
void CIgnorePrefsDlg::OnInitDialog()
@@ -1436,108 +1435,109 @@ void CIgnorePrefsDlg::OnInitDialog()
m_proto->m_ignoreDlg = this;
mir_subclassWindow(m_list.GetHwnd(), ListviewSubclassProc);
- m_enable.SetState( m_proto->m_ignore );
- m_ignoreFile.SetState( !m_proto->m_DCCFileEnabled );
- m_ignoreChat.SetState( !m_proto->m_DCCChatEnabled );
- m_ignoreChannel.SetState( m_proto->m_ignoreChannelDefault );
- if ( m_proto->m_DCCChatIgnore == 2 )
- m_ignoreUnknown.SetState( BST_CHECKED );
+ m_enable.SetState(m_proto->m_ignore);
+ m_ignoreFile.SetState(!m_proto->m_DCCFileEnabled);
+ m_ignoreChat.SetState(!m_proto->m_DCCChatEnabled);
+ m_ignoreChannel.SetState(m_proto->m_ignoreChannelDefault);
+ if (m_proto->m_DCCChatIgnore == 2)
+ m_ignoreUnknown.SetState(BST_CHECKED);
- m_ignoreUnknown.Enable( m_proto->m_DCCChatEnabled );
- m_list.Enable( m_proto->m_ignore );
- m_ignoreChannel.Enable( m_proto->m_ignore);
- m_add.Enable( m_proto->m_ignore );
+ m_ignoreUnknown.Enable(m_proto->m_DCCChatEnabled);
+ m_list.Enable(m_proto->m_ignore);
+ m_ignoreChannel.Enable(m_proto->m_ignore);
+ m_add.Enable(m_proto->m_ignore);
- static int COLUMNS_SIZES[3] = {195, 60, 80};
+ static int COLUMNS_SIZES[3] = { 195, 60, 80 };
LV_COLUMN lvC;
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.fmt = LVCFMT_LEFT;
- for ( int index=0; index < 3; index++ ) {
+ for (int index = 0; index < 3; index++) {
lvC.iSubItem = index;
lvC.cx = COLUMNS_SIZES[index];
TCHAR* text = NULL;
switch (index) {
- case 0: text = TranslateT("Ignore mask"); break;
- case 1: text = TranslateT("Flags"); break;
- case 2: text = TranslateT("Network"); break;
+ case 0: text = TranslateT("Ignore mask"); break;
+ case 1: text = TranslateT("Flags"); break;
+ case 2: text = TranslateT("Network"); break;
}
lvC.pszText = text;
- ListView_InsertColumn(GetDlgItem( m_hwnd, IDC_INFO_LISTVIEW),index,&lvC);
+ ListView_InsertColumn(GetDlgItem(m_hwnd, IDC_INFO_LISTVIEW), index, &lvC);
}
- ListView_SetExtendedListViewStyle(GetDlgItem( m_hwnd, IDC_INFO_LISTVIEW), LVS_EX_FULLROWSELECT);
+ ListView_SetExtendedListViewStyle(GetDlgItem(m_hwnd, IDC_INFO_LISTVIEW), LVS_EX_FULLROWSELECT);
RebuildList();
}
INT_PTR CIgnorePrefsDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch( msg ) {
+ switch (msg) {
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_LIST:
switch (((NMHDR*)lParam)->code) {
case NM_CLICK:
case NM_RCLICK:
- if ( m_list.GetSelectionMark() != -1 )
+ if (m_list.GetSelectionMark() != -1)
FixButtons();
break;
- } }
+ }
+ }
break;
}
return CDlgBase::DlgProc(msg, wParam, lParam);
}
-void CIgnorePrefsDlg::OnEnableIgnore( CCtrlData* )
+void CIgnorePrefsDlg::OnEnableIgnore(CCtrlData*)
{
- m_ignoreChannel.Enable( m_enable.GetState());
- m_list.Enable( m_enable.GetState());
- m_add.Enable( m_enable.GetState());
+ m_ignoreChannel.Enable(m_enable.GetState());
+ m_list.Enable(m_enable.GetState());
+ m_add.Enable(m_enable.GetState());
}
-void CIgnorePrefsDlg::OnIgnoreChat( CCtrlData* )
+void CIgnorePrefsDlg::OnIgnoreChat(CCtrlData*)
{
- m_ignoreUnknown.Enable( m_ignoreChat.GetState() == BST_UNCHECKED );
+ m_ignoreUnknown.Enable(m_ignoreChat.GetState() == BST_UNCHECKED);
}
-void CIgnorePrefsDlg::OnAdd( CCtrlButton* )
+void CIgnorePrefsDlg::OnAdd(CCtrlButton*)
{
- CAddIgnoreDlg* dlg = new CAddIgnoreDlg( m_proto, NULL, this );
+ CAddIgnoreDlg *dlg = new CAddIgnoreDlg(m_proto, NULL, this);
dlg->Show();
- SetWindowText( dlg->GetHwnd(), TranslateT( "Add ignore" ));
+ SetWindowText(dlg->GetHwnd(), TranslateT("Add ignore"));
m_add.Disable();
m_edit.Disable();
m_del.Disable();
}
-void CIgnorePrefsDlg::OnEdit( CCtrlButton* )
+void CIgnorePrefsDlg::OnEdit(CCtrlButton*)
{
- if ( !m_add.Enabled())
+ if (!m_add.Enabled())
return;
TCHAR szMask[512];
TCHAR szFlags[512];
TCHAR szNetwork[512];
int i = m_list.GetSelectionMark();
- m_list.GetItemText( i, 0, szMask, 511 );
- m_list.GetItemText( i, 1, szFlags, 511 );
- m_list.GetItemText( i, 2, szNetwork, 511 );
- CAddIgnoreDlg* dlg = new CAddIgnoreDlg( m_proto, szMask, this );
+ m_list.GetItemText(i, 0, szMask, 511);
+ m_list.GetItemText(i, 1, szFlags, 511);
+ m_list.GetItemText(i, 2, szNetwork, 511);
+ CAddIgnoreDlg* dlg = new CAddIgnoreDlg(m_proto, szMask, this);
dlg->Show();
HWND hWnd = dlg->GetHwnd();
SetWindowText(hWnd, TranslateT("Edit ignore"));
- if ( szFlags[0] ) {
- if ( _tcschr(szFlags, 'q'))
+ if (szFlags[0]) {
+ if (_tcschr(szFlags, 'q'))
CheckDlgButton(hWnd, IDC_Q, BST_CHECKED);
- if ( _tcschr(szFlags, 'n'))
+ if (_tcschr(szFlags, 'n'))
CheckDlgButton(hWnd, IDC_N, BST_CHECKED);
- if ( _tcschr(szFlags, 'i'))
+ if (_tcschr(szFlags, 'i'))
CheckDlgButton(hWnd, IDC_I, BST_CHECKED);
- if ( _tcschr(szFlags, 'd'))
+ if (_tcschr(szFlags, 'd'))
CheckDlgButton(hWnd, IDC_D, BST_CHECKED);
- if ( _tcschr(szFlags, 'c'))
+ if (_tcschr(szFlags, 'c'))
CheckDlgButton(hWnd, IDC_C, BST_CHECKED);
- if ( _tcschr(szFlags, 'm'))
+ if (_tcschr(szFlags, 'm'))
CheckDlgButton(hWnd, IDC_M, BST_CHECKED);
}
SetWindowText(GetDlgItem(hWnd, IDC_MASK), szMask);
@@ -1547,20 +1547,20 @@ void CIgnorePrefsDlg::OnEdit( CCtrlButton* )
m_del.Disable();
}
-void CIgnorePrefsDlg::OnDelete( CCtrlButton* )
+void CIgnorePrefsDlg::OnDelete(CCtrlButton*)
{
- if ( !m_del.Enabled())
+ if (!m_del.Enabled())
return;
TCHAR szMask[512];
int i = m_list.GetSelectionMark();
- m_list.GetItemText( i, 0, szMask, SIZEOF(szMask));
- m_proto->RemoveIgnore( szMask );
+ m_list.GetItemText(i, 0, szMask, SIZEOF(szMask));
+ m_proto->RemoveIgnore(szMask);
}
-void CIgnorePrefsDlg::List_OnColumnClick( CCtrlListView::TEventInfo* )
+void CIgnorePrefsDlg::List_OnColumnClick(CCtrlListView::TEventInfo*)
{
- m_list.SortItems( IgnoreListSort, (LPARAM)this );
+ m_list.SortItems(IgnoreListSort, (LPARAM)this);
UpdateList();
}
@@ -1571,7 +1571,7 @@ void CIgnorePrefsDlg::OnApply()
m_proto->m_ignore = m_enable.GetState();
m_proto->m_ignoreChannelDefault = m_ignoreChannel.GetState();
m_proto->m_DCCChatIgnore = m_ignoreUnknown.GetState() ? 2 : 1;
- m_proto->WriteSettings( IgnoreSettings, SIZEOF( IgnoreSettings ));
+ m_proto->WriteSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
}
void CIgnorePrefsDlg::OnDestroy()
@@ -1580,12 +1580,12 @@ void CIgnorePrefsDlg::OnDestroy()
m_proto->m_ignoreItems.destroy();
int i = m_list.GetItemCount();
- for ( int j = 0; j < i; j++ ) {
+ for (int j = 0; j < i; j++) {
TCHAR szMask[512], szFlags[40], szNetwork[100];
- m_list.GetItemText( j, 0, szMask, SIZEOF(szMask));
- m_list.GetItemText( j, 1, szFlags, SIZEOF(szFlags));
- m_list.GetItemText( j, 2, szNetwork, SIZEOF(szNetwork));
- m_proto->m_ignoreItems.insert( new CIrcIgnoreItem( szMask, szFlags, szNetwork ));
+ m_list.GetItemText(j, 0, szMask, SIZEOF(szMask));
+ m_list.GetItemText(j, 1, szFlags, SIZEOF(szFlags));
+ m_list.GetItemText(j, 2, szNetwork, SIZEOF(szNetwork));
+ m_proto->m_ignoreItems.insert(new CIrcIgnoreItem(szMask, szFlags, szNetwork));
}
m_proto->RewriteIgnoreSettings();
@@ -1593,46 +1593,47 @@ void CIgnorePrefsDlg::OnDestroy()
void CIgnorePrefsDlg::FixButtons()
{
- m_add.Enable( m_enable.GetState());
- if ( m_list.GetSelectionMark() != -1 ) {
+ m_add.Enable(m_enable.GetState());
+ if (m_list.GetSelectionMark() != -1) {
m_edit.Enable();
m_del.Enable();
}
else {
m_edit.Disable();
m_del.Disable();
-} }
+ }
+}
void CIgnorePrefsDlg::RebuildList()
{
m_list.DeleteAllItems();
- for ( int i=0; i < m_proto->m_ignoreItems.getCount(); i++ ) {
+ for (int i = 0; i < m_proto->m_ignoreItems.getCount(); i++) {
CIrcIgnoreItem& C = m_proto->m_ignoreItems[i];
- if ( C.mask.IsEmpty() || C.flags[0] != '+' )
+ if (C.mask.IsEmpty() || C.flags[0] != '+')
continue;
LVITEM lvItem;
lvItem.iItem = m_list.GetItemCount();
- lvItem.mask = LVIF_TEXT|LVIF_PARAM ;
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.lParam = lvItem.iItem;
lvItem.pszText = (TCHAR*)C.mask.c_str();
- lvItem.iItem = m_list.InsertItem( &lvItem );
+ lvItem.iItem = m_list.InsertItem(&lvItem);
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
lvItem.pszText = (TCHAR*)C.flags.c_str();
- m_list.SetItem( &lvItem );
+ m_list.SetItem(&lvItem);
lvItem.mask = LVIF_TEXT;
- lvItem.iSubItem =2;
+ lvItem.iSubItem = 2;
lvItem.pszText = (TCHAR*)C.network.c_str();
- m_list.SetItem( &lvItem );
+ m_list.SetItem(&lvItem);
}
UpdateList();
- m_list.SortItems( IgnoreListSort, ( LPARAM )this );
+ m_list.SortItems(IgnoreListSort, (LPARAM)this);
UpdateList();
FixButtons();
@@ -1641,15 +1642,17 @@ void CIgnorePrefsDlg::RebuildList()
void CIgnorePrefsDlg::UpdateList()
{
int j = m_list.GetItemCount();
- if (j > 0 ) {
+ if (j > 0) {
LVITEM lvm;
- lvm.mask= LVIF_PARAM;
+ lvm.mask = LVIF_PARAM;
lvm.iSubItem = 0;
- for ( int i =0; i < j; i++) {
+ for (int i = 0; i < j; i++) {
lvm.iItem = i;
lvm.lParam = i;
- m_list.SetItem( &lvm );
-} } }
+ m_list.SetItem(&lvm);
+ }
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1705,56 +1708,56 @@ void CIrcProto::InitPrefs(void)
OtherSettings[0].defStr = _T(STR_QUITMESSAGE);
- ReadSettings(ConnectSettings, SIZEOF( ConnectSettings ));
- ReadSettings(CtcpSettings, SIZEOF( CtcpSettings ));
- ReadSettings(OtherSettings, SIZEOF( OtherSettings ));
- ReadSettings(IgnoreSettings, SIZEOF( IgnoreSettings ));
+ ReadSettings(ConnectSettings, SIZEOF(ConnectSettings));
+ ReadSettings(CtcpSettings, SIZEOF(CtcpSettings));
+ ReadSettings(OtherSettings, SIZEOF(OtherSettings));
+ ReadSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
- int x = getDword( "SizeOfListBottom", -1 );
- if ( x != -1 ) {
- db_unset( NULL, m_szModuleName, "SizeOfListBottom" );
- setDword( "channelList_height", x );
+ int x = getDword("SizeOfListBottom", -1);
+ if (x != -1) {
+ db_unset(NULL, m_szModuleName, "SizeOfListBottom");
+ setDword("channelList_height", x);
}
- if (( x = getDword( "SizeOfListWidth", -1 )) != -1 ) {
- db_unset( NULL, m_szModuleName, "SizeOfListWidth" );
- setDword( "channelList_width", x );
+ if ((x = getDword("SizeOfListWidth", -1)) != -1) {
+ db_unset(NULL, m_szModuleName, "SizeOfListWidth");
+ setDword("channelList_width", x);
}
- if ( m_pNick[0] == 0 ) {
- if ( m_nick[0] != 0 ) {
- memcpy( m_pNick, m_nick, sizeof( m_pNick ));
+ if (m_pNick[0] == 0) {
+ if (m_nick[0] != 0) {
+ memcpy(m_pNick, m_nick, sizeof(m_pNick));
setTString("PNick", m_nick);
}
}
else {
- memcpy( m_nick, m_pNick, sizeof( m_nick ));
+ memcpy(m_nick, m_pNick, sizeof(m_nick));
setTString("Nick", m_nick);
}
m_mySpecifiedHostIP[0] = 0;
- if ( m_alias == NULL )
- m_alias = mir_tstrdup( _T("/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout" ));
+ if (m_alias == NULL)
+ m_alias = mir_tstrdup(_T("/op /mode ## +ooo $1 $2 $3\r\n/dop /mode ## -ooo $1 $2 $3\r\n/voice /mode ## +vvv $1 $2 $3\r\n/dvoice /mode ## -vvv $1 $2 $3\r\n/j /join #$1 $2-\r\n/p /part ## $1-\r\n/w /whois $1\r\n/k /kick ## $1 $2-\r\n/q /query $1\r\n/logon /log on ##\r\n/logoff /log off ##\r\n/save /log buffer $1\r\n/slap /me slaps $1 around a bit with a large trout"));
- m_quickComboSelection = getDword( "QuickComboSelection", m_serverComboSelection + 1);
+ m_quickComboSelection = getDword("QuickComboSelection", m_serverComboSelection + 1);
m_myHost[0] = '\0';
- colors[0] = RGB(255,255,255);
- colors[1] = RGB(0,0,0);
- colors[2] = RGB(0,0,127);
- colors[3] = RGB(0,147,0);
- colors[4] = RGB(255,0,0);
- colors[5] = RGB(127,0,0);
- colors[6] = RGB(156,0,156);
- colors[7] = RGB(252,127,0);
- colors[8] = RGB(255,255,0);
- colors[9] = RGB(0,252,0);
- colors[10] = RGB(0,147,147);
- colors[11] = RGB(0,255,255);
- colors[12] = RGB(0,0,252);
- colors[13] = RGB(255,0,255);
- colors[14] = RGB(127,127,127);
- colors[15] = RGB(210,210,210);
+ colors[0] = RGB(255, 255, 255);
+ colors[1] = RGB(0, 0, 0);
+ colors[2] = RGB(0, 0, 127);
+ colors[3] = RGB(0, 147, 0);
+ colors[4] = RGB(255, 0, 0);
+ colors[5] = RGB(127, 0, 0);
+ colors[6] = RGB(156, 0, 156);
+ colors[7] = RGB(252, 127, 0);
+ colors[8] = RGB(255, 255, 0);
+ colors[9] = RGB(0, 252, 0);
+ colors[10] = RGB(0, 147, 147);
+ colors[11] = RGB(0, 255, 255);
+ colors[12] = RGB(0, 0, 252);
+ colors[13] = RGB(255, 0, 255);
+ colors[14] = RGB(127, 127, 127);
+ colors[15] = RGB(210, 210, 210);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1765,78 +1768,80 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto>
CCtrlCombo m_serverCombo;
CCtrlEdit m_server, m_port, m_port2, m_pass, m_nick, m_nick2, m_name, m_userID, m_ssl;
- CDlgAccMgrUI( CIrcProto* _pro, HWND _owner ) :
- CProtoDlgBase<CIrcProto>( _pro, IDD_ACCMGRUI, _owner ),
- m_serverCombo( this, IDC_SERVERCOMBO ),
- m_server( this, IDC_SERVER ),
- m_port( this, IDC_PORT ),
- m_port2( this, IDC_PORT2 ),
- m_pass( this, IDC_PASS ),
- m_nick( this, IDC_NICK ),
- m_nick2( this, IDC_NICK2 ),
- m_name( this, IDC_NAME ),
- m_ssl( this, IDC_SSL ),
- m_userID( this, IDC_USERID )
+ CDlgAccMgrUI(CIrcProto* _pro, HWND _owner) :
+ CProtoDlgBase<CIrcProto>(_pro, IDD_ACCMGRUI, _owner),
+ m_serverCombo(this, IDC_SERVERCOMBO),
+ m_server(this, IDC_SERVER),
+ m_port(this, IDC_PORT),
+ m_port2(this, IDC_PORT2),
+ m_pass(this, IDC_PASS),
+ m_nick(this, IDC_NICK),
+ m_nick2(this, IDC_NICK2),
+ m_name(this, IDC_NAME),
+ m_ssl(this, IDC_SSL),
+ m_userID(this, IDC_USERID)
{
- m_serverCombo.OnChange = Callback( this, &CDlgAccMgrUI::OnChangeCombo );
+ m_serverCombo.OnChange = Callback(this, &CDlgAccMgrUI::OnChangeCombo);
}
virtual void OnInitDialog()
{
- for ( int i=0; i < g_servers.getCount(); i++ ) {
+ for (int i = 0; i < g_servers.getCount(); i++) {
SERVER_INFO& si = g_servers[i];
- m_serverCombo.AddStringA( si.m_name, LPARAM( &si ));
+ m_serverCombo.AddStringA(si.m_name, LPARAM(&si));
}
- m_serverCombo.SetCurSel( m_proto->m_serverComboSelection );
- m_server.SetTextA( m_proto->m_serverName );
- m_port.SetTextA( m_proto->m_portStart );
- m_port2.SetTextA( m_proto->m_portEnd );
- m_pass.SetTextA( m_proto->m_password);
- switch ( m_proto->m_iSSL ) {
- case 0: m_ssl.SetTextA( "Off" ); break;
- case 1: m_ssl.SetTextA( "Auto" ); break;
- case 2: m_ssl.SetTextA( "On" ); break;
+ m_serverCombo.SetCurSel(m_proto->m_serverComboSelection);
+ m_server.SetTextA(m_proto->m_serverName);
+ m_port.SetTextA(m_proto->m_portStart);
+ m_port2.SetTextA(m_proto->m_portEnd);
+ m_pass.SetTextA(m_proto->m_password);
+ switch (m_proto->m_iSSL) {
+ case 0: m_ssl.SetTextA("Off"); break;
+ case 1: m_ssl.SetTextA("Auto"); break;
+ case 2: m_ssl.SetTextA("On"); break;
}
- m_nick.SetText( m_proto->m_nick);
- m_nick2.SetText( m_proto->m_alternativeNick );
- m_userID.SetText( m_proto->m_userID);
- m_name.SetText( m_proto->m_name);
+ m_nick.SetText(m_proto->m_nick);
+ m_nick2.SetText(m_proto->m_alternativeNick);
+ m_userID.SetText(m_proto->m_userID);
+ m_name.SetText(m_proto->m_name);
}
virtual void OnApply()
{
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel();
- m_server.GetTextA( m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA( m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA( m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA( m_proto->m_password, SIZEOF(m_proto->m_password));
+ m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
- m_nick.GetText( m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
mir_sntprintf(m_proto->m_pNick, 30, _T("%s"), m_proto->m_nick);
- m_nick2.GetText( m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText( m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText( m_proto->m_name, SIZEOF(m_proto->m_name));
- m_proto->WriteSettings( ConnectSettings, SIZEOF( ConnectSettings ));
+ m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
+ m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
}
- void OnChangeCombo( CCtrlCombo* )
+ void OnChangeCombo(CCtrlCombo*)
{
int i = m_serverCombo.GetCurSel();
- SERVER_INFO* pData = ( SERVER_INFO* )m_serverCombo.GetItemData( i );
- if ( pData && (INT_PTR)pData != CB_ERR ) {
- m_server.SetTextA( pData->m_address );
- m_port.SetInt( pData->m_portStart );
- m_port2.SetInt( pData->m_portEnd );
- m_pass.SetTextA( "" );
- switch ( pData->m_iSSL ) {
- case 0: m_ssl.SetTextA( "Off" ); break;
- case 1: m_ssl.SetTextA( "Auto" ); break;
- case 2: m_ssl.SetTextA( "On" ); break;
- } } }
+ SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
+ if (pData && (INT_PTR)pData != CB_ERR) {
+ m_server.SetTextA(pData->m_address);
+ m_port.SetInt(pData->m_portStart);
+ m_port2.SetInt(pData->m_portEnd);
+ m_pass.SetTextA("");
+ switch (pData->m_iSSL) {
+ case 0: m_ssl.SetTextA("Off"); break;
+ case 1: m_ssl.SetTextA("Auto"); break;
+ case 2: m_ssl.SetTextA("On"); break;
+ }
+ }
+ }
};
INT_PTR CIrcProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
@@ -1849,50 +1854,50 @@ INT_PTR CIrcProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// Initialize servers list
-static void sttImportIni( const TCHAR* szIniFile )
+static void sttImportIni(const TCHAR* szIniFile)
{
- FILE* serverFile = _tfopen( szIniFile, _T("r"));
- if ( serverFile == NULL )
+ FILE* serverFile = _tfopen(szIniFile, _T("r"));
+ if (serverFile == NULL)
return;
- char buf1[ 500 ], buf2[ 200 ];
- while ( fgets( buf1, sizeof( buf1 ), serverFile )) {
- char* p = strchr( buf1, '=' );
- if ( !p )
+ char buf1[500], buf2[200];
+ while (fgets(buf1, sizeof(buf1), serverFile)) {
+ char* p = strchr(buf1, '=');
+ if (!p)
continue;
p++;
- rtrim( p );
- char* p1 = strstr( p, "SERVER:" );
- if ( !p1 )
+ rtrim(p);
+ char* p1 = strstr(p, "SERVER:");
+ if (!p1)
continue;
- memcpy( buf2, p, int(p1-p));
- buf2[ int(p1-p) ] = 0;
- db_set_s( NULL, SERVERSMODULE, buf2, p1 );
+ memcpy(buf2, p, int(p1 - p));
+ buf2[int(p1 - p)] = 0;
+ db_set_s(NULL, SERVERSMODULE, buf2, p1);
}
- fclose( serverFile );
- ::_tremove( szIniFile );
+ fclose(serverFile);
+ ::_tremove(szIniFile);
}
void InitServers()
{
TCHAR *szTemp = Utils_ReplaceVarsT(_T("%miranda_path%\\Plugins\\IRC_servers.ini"));
- sttImportIni( szTemp );
- mir_free( szTemp );
+ sttImportIni(szTemp);
+ mir_free(szTemp);
RereadServers();
- if ( g_servers.getCount() == 0 ) {
+ if (g_servers.getCount() == 0) {
TCHAR *szIniFile = Utils_ReplaceVarsT(_T("%temp%\\default_servers.ini"));
- FILE *serverFile = _tfopen( szIniFile, _T("a"));
+ FILE *serverFile = _tfopen(szIniFile, _T("a"));
if (serverFile) {
- char* pszSvrs = ( char* )LockResource(LoadResource(hInst,FindResource(hInst,MAKEINTRESOURCE(IDR_SERVERS),_T("TEXT"))));
+ char* pszSvrs = (char*)LockResource(LoadResource(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), _T("TEXT"))));
if (pszSvrs)
- fwrite(pszSvrs , 1 , lstrlenA(pszSvrs) + 1 , serverFile );
+ fwrite(pszSvrs, 1, lstrlenA(pszSvrs) + 1, serverFile);
fclose(serverFile);
- sttImportIni( szIniFile );
+ sttImportIni(szIniFile);
RereadServers();
}
mir_free(szIniFile);
diff --git a/protocols/IRCG/src/resource.h b/protocols/IRCG/src/resource.h
index 948b3a4085..9ac60a05f6 100644
--- a/protocols/IRCG/src/resource.h
+++ b/protocols/IRCG/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by IRC.rc
+// Used by D:\Myranda\protocols\IRCG\res\IRC.rc
//
#define ID_INFO_QUERY 3
#define IDD_PREFS_MAIN 101
@@ -71,10 +71,8 @@
#define IDC_SERVERCOMBO 1022
#define IDC_IDENT 1023
#define IDC_IDENT_TIMED 1024
-#define IDC_RETRY 1029
#define IDC_ADDSERVER 1031
#define IDC_EDITSERVER 1032
-#define IDC_RETRYWAIT 1035
#define IDC_IDENTSYSTEM 1036
#define IDC_IDENTPORT 1037
#define IDC_ONLINETIMER 1038
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index c411819a1d..067a357344 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -1088,8 +1088,6 @@ void __cdecl CIrcProto::ConnectServerThread( void* )
Connect(si);
LeaveCriticalSection(&cs);
if (IsConnected()) {
- KillChatTimer( RetryTimer );
-
if ( m_mySpecifiedHost[0] )
ForkThread( &CIrcProto::ResolveIPThread, new IPRESOLVE( m_mySpecifiedHost, IP_MANUAL ));
@@ -1103,16 +1101,14 @@ void __cdecl CIrcProto::ConnectServerThread( void* )
Sleep(100);
} }
- InterlockedDecrement((long *) &m_bConnectThreadRunning);
+ InterlockedDecrement((long *)&m_bConnectThreadRunning);
}
void __cdecl CIrcProto::DisconnectServerThread( void* )
{
- EnterCriticalSection( &cs );
- KillChatTimer( RetryTimer );
- if ( IsConnected())
+ mir_cslock lck(cs);
+ if (IsConnected())
Disconnect();
- LeaveCriticalSection( &cs );
return;
}
@@ -1129,17 +1125,7 @@ void CIrcProto::ConnectToServer(void)
si.iIdentServerPort = StrToInt(m_identPort);
si.sIdentServerType = m_identSystem;
si.m_iSSL = m_iSSL;
- { TCHAR* p = mir_a2t( m_network );
- si.sNetwork = p;
- mir_free(p);
- }
- m_iRetryCount = 1;
- KillChatTimer(RetryTimer);
- if (m_retry) {
- if (StrToInt(m_retryWait)<10)
- lstrcpy(m_retryWait, _T("10"));
- SetChatTimer(RetryTimer, StrToInt(m_retryWait)*1000, RetryTimerProc);
- }
+ si.sNetwork = m_network;
bPerformDone = false;
bTempDisableCheck = false;
@@ -1191,34 +1177,3 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam,LPARAM lParam)
return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(p) : (INT_PTR)mir_t2a(p);
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Service function creation
-
-VOID CALLBACK RetryTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
-{
- CIrcProto *ppro = GetTimerOwner( idEvent );
- if (ppro == NULL)
- return;
-
- if ( ppro->m_iRetryCount <= StrToInt( ppro->m_retryCount) && ppro->m_retry ) {
- ppro->m_portCount++;
- if ( ppro->m_portCount > StrToIntA( ppro->m_portEnd ) || StrToIntA( ppro->m_portEnd ) == 0 )
- ppro->m_portCount = StrToIntA( ppro->m_portStart );
- ppro->si.iPort = ppro->m_portCount;
-
- TCHAR szTemp[300];
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("\0033%s \002%s\002 (%S: %u, try %u)"),
- TranslateT("Reconnecting to"), ppro->si.sNetwork.c_str(), ppro->si.sServer.c_str(), ppro->si.iPort, ppro->m_iRetryCount);
-
- ppro->DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, szTemp, NULL, NULL, NULL, true, false);
-
- if ( !ppro->m_bConnectThreadRunning )
- ppro->ForkThread( &CIrcProto::ConnectServerThread, 0 );
- else
- ppro->m_bConnectRequested = true;
-
- ppro->m_iRetryCount++;
- }
- else ppro->KillChatTimer( ppro->RetryTimer );
-}
diff --git a/protocols/IRCG/src/version.h b/protocols/IRCG/src/version.h
index 1138d8fa66..6bc9f439de 100644
--- a/protocols/IRCG/src/version.h
+++ b/protocols/IRCG/src/version.h
@@ -1,11 +1,11 @@
-#define __FILEVERSION_STRING 0,11,0,1
-#define __VERSION_STRING "0.11.0.1"
-#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 11, 0, 1)
+#define __FILEVERSION_STRING 0,11,0,2
+#define __VERSION_STRING "0.11.0.2"
+#define __VERSION_DWORD PLUGIN_MAKE_VERSION(0, 11, 0, 2)
-#define __DESC "Internet Relay Chat (IRC) protocol support for Miranda NG."
+#define __DESC "Internet Relay Chat (IRC) protocol support for Miranda NG."
#define __AUTHOR "Miranda team"
-#define __AUTHOREMAIL "ghazan@miranda-im.org"
-#define __COPYRIGHT "c 2003-2011 Jurgen Persson, George Hazan"
+#define __AUTHOREMAIL "ghazan@miranda.im"
+#define __COPYRIGHT "c 2003-2013 Jurgen Persson, George Hazan"
#define __AUTHORWEB "http://miranda-ng.org/p/IRC/"
#define __PLUGIN_NAME "IRC protocol"
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index f67e3345fd..78f2f3fe7a 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -654,7 +654,7 @@ void CQuickDlg::OnOk( CCtrlButton* )
m_proto->ConnectToServer();
}
-void CQuickDlg::OnServerCombo( CCtrlData* )
+void CQuickDlg::OnServerCombo(CCtrlData*)
{
int i = m_serverCombo.GetCurSel();
if ( i == CB_ERR )
@@ -1061,12 +1061,12 @@ void CManagerDlg::OnChangeList( CCtrlListBox* )
m_remove.Enable();
} }
-void CManagerDlg::OnChangeModes( CCtrlData* )
+void CManagerDlg::OnChangeModes(CCtrlData*)
{
m_applyModes.Enable();
}
-void CManagerDlg::OnChangeTopic( CCtrlData* )
+void CManagerDlg::OnChangeTopic(CCtrlData*)
{
m_applyTopic.Enable();
}
@@ -1211,24 +1211,24 @@ void CManagerDlg::OnApplyTopic( CCtrlButton* )
m_applyTopic.Disable();
}
-void CManagerDlg::OnCheck( CCtrlData* )
+void CManagerDlg::OnCheck(CCtrlData*)
{
m_applyModes.Enable();
}
-void CManagerDlg::OnCheck5( CCtrlData* )
+void CManagerDlg::OnCheck5(CCtrlData*)
{
m_key.Enable( m_check5.GetState());
m_applyModes.Enable();
}
-void CManagerDlg::OnCheck6( CCtrlData* )
+void CManagerDlg::OnCheck6(CCtrlData*)
{
m_limit.Enable( m_check6.GetState());
m_applyModes.Enable();
}
-void CManagerDlg::OnRadio( CCtrlData* )
+void CManagerDlg::OnRadio(CCtrlData*)
{
ApplyQuestion();
}