From 6064bfec538038fd1e1ccf4da54fa859241f98fa Mon Sep 17 00:00:00 2001 From: Pavel Perminov Date: Wed, 26 Sep 2012 19:14:19 +0000 Subject: Current line of development release (344 rev. truncated adjusted copy) git-svn-id: http://svn.miranda-ng.org/main/trunk@1669 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Chess4Net/MI/Chess4Net_MI.cfg.bak | 47 ----- plugins/Chess4Net/MI/Chess4Net_MI.dof | 64 +++---- plugins/Chess4Net/MI/Chess4Net_MI.dpr | 22 ++- plugins/Chess4Net/MI/ConnectorUnit.pas | 211 +++++++++++---------- plugins/Chess4Net/MI/ControlUnit.pas | 6 + plugins/Chess4Net/MI/GlobalsLocalUnit.pas | 15 +- plugins/Chess4Net/MI/ManagerUnit.MI.pas | 56 ++---- plugins/Chess4Net/MI/PluginCommonUnit.pas | 12 +- plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas | 6 + 9 files changed, 203 insertions(+), 236 deletions(-) delete mode 100644 plugins/Chess4Net/MI/Chess4Net_MI.cfg.bak (limited to 'plugins/Chess4Net/MI') diff --git a/plugins/Chess4Net/MI/Chess4Net_MI.cfg.bak b/plugins/Chess4Net/MI/Chess4Net_MI.cfg.bak deleted file mode 100644 index c2321660ff..0000000000 --- a/plugins/Chess4Net/MI/Chess4Net_MI.cfg.bak +++ /dev/null @@ -1,47 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I- --$J+ --$K- --$L+ --$M- --$N+ --$O- --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --vn --vr --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W+ --M --$M16384,1048576 --K$00400000 --E"..\..\Testing\IMEServices\IMEClient2\Plugins" --N".\dcu" --LE"c:\program files\borland\delphi7\Projects\Bpl" --LN"c:\program files\borland\delphi7\Projects\Bpl" --U"c:\program files\borland\delphi7\Lib\Debug;.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source" --O"c:\program files\borland\delphi7\Lib\Debug;.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source" --I"c:\program files\borland\delphi7\Lib\Debug;.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source" --R"c:\program files\borland\delphi7\Lib\Debug;.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source" --DMIRANDA;xFASTMM4;xDEBUG_LOG --w-UNSAFE_TYPE --w-UNSAFE_CODE --w-UNSAFE_CAST diff --git a/plugins/Chess4Net/MI/Chess4Net_MI.dof b/plugins/Chess4Net/MI/Chess4Net_MI.dof index b7ba2c3184..5b7c6eacea 100644 --- a/plugins/Chess4Net/MI/Chess4Net_MI.dof +++ b/plugins/Chess4Net/MI/Chess4Net_MI.dof @@ -94,17 +94,21 @@ OutputDir=..\bin UnitOutputDir=.\dcu PackageDLLOutputDir= PackageDCPOutputDir= -SearchPath=.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source +SearchPath=.\MirandaINC;..\res\Delphi;..\lib\FastMM4;..\lib\PNGImage;..\lib\XIE;..\lib\TntUnicodeControls\Source Packages=vcl;rtl;dbrtl;vcldb;vclx;bdertl;delphiclxide;proide;delphivclide;direct;vclie;stride;VclSmp;vclactnband Conditionals=MIRANDA;xFASTMM4;xDEBUG_LOG DebugSourceDirs= UsePackages=0 [Parameters] RunParams= -HostApplication=C:\Documents and Settings\Pavel\Мои документы\Programming\Chess4Net\Testing\Client1\TestingHost.exe +HostApplication= Launcher= UseLauncher=0 DebugCWD= +[Language] +ActiveLang= +ProjectLang= +RootDir= [Version Info] IncludeVerInfo=0 AutoIncBuild=0 @@ -131,42 +135,36 @@ ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlConditionals] -Count=14 -Item0=MIRANDA;xFASTMM4;xDEBUG_LOG -Item1=SOCKET;xFASTMM4 -Item2=QIP;xFASTMM4; -Item3=AND_RQ;xFASTMM4 -Item4=TRILLIAN;xFASTMM4 -Item5=SOCKET;FASTMM4 -Item6=MIRANDA;FASTMM4 -Item7=MIRANDA;xFASTMM4 -Item8=xFASTMM4;TRILLIAN -Item9=SOCKET -Item10=QIP -Item11=AND_RQ -Item12=TRILLIAN -Item13=MIRANDA +Count=15 +Item0=SKYPE;xFASTMM4;TESTING;SKYPE_API +Item1=SKYPE;xFASTMM4;xTESTING;SKYPE_API +Item2=SKYPE;xFASTMM4;xTESTING;xSKYPE_API +Item3=SKYPE;xFASTMM4;xTESTING;xSKYPE_API;TESTING +Item4=SKYPE;xFASTMM4;xTESTING;SKYPE_API;TESTING +Item5=SKYPE;xFASTMM4;xTESTING;SKYPE_API;xDEBUG_LOG +Item6=SKYPE;xFASTMM4;TESTING;SKYPE_API;xDEBUG_LOG +Item7=SKYPE;xFASTMM4;xTESTING;xSKYPE_API;xDEBUG_LOG +Item8=SKYPE;xFASTMM4;TESTING;xSKYPE_API;xDEBUG_LOG;xTESTING +Item9=SKYPE;xFASTMM4;TESTING;xSKYPE_API;xDEBUG_LOG;TESTING +Item10=SOCKET;xFASTMM4 +Item11=SKYPE;xFASTMM4;xTESTING;xSKYPE_API;xDEBUG_LOG;TESTING +Item12=SKYPE;xFASTMM4;xTESTING;xSKYPE_API;DEBUG_LOG +Item13=SKYPE;xFASTMM4;TESTING;xSKYPE_API;DEBUG_LOG +Item14=SKYPE;xFASTMM4;TESTING;xSKYPE_API;xDEBUG_LOG [HistoryLists\hlUnitAliases] Count=1 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hlSearchPath] -Count=11 -Item0=.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source -Item1=$(DELPHI)\Lib\Debug;.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source -Item2=..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source -Item3=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source -Item4=.\MirandaINC;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls -Item5=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage;.\MirandaINC -Item6=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage -Item7=..\lib\FastMM4;..\lib\PNGImage;.\MirandaINC -Item8=..\lib\FastMM4;..\lib\PNGImage;.\MI\MirandaINC -Item9=..\lib\FastMM4;..\lib\PNGImage -Item10=..\lib\PNGImage +Count=5 +Item0=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage;..\lib\XIE;..\lib\TntUnicodeControls\Source;.\SkypeAPI +Item1=..\lib\FastMM4;..\lib\PNGImage;..\lib\XIE;..\lib\TntUnicodeControls\Source;.\SkypeAPI +Item2=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source +Item3=..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source;.\SkypeAPI +Item4=$(DELPHI)\Lib\Debug;..\lib\FastMM4;..\lib\PNGImage;..\lib\TntUnicodeControls\Source;.\SkypeAPI [HistoryLists\hlUnitOutputDirectory] -Count=2 +Count=1 Item0=.\dcu -Item1=..\dcu [HistoryLists\hlOutputDirectorry] Count=2 -Item0=..\bin -Item1=C:\Documents and Settings\Pavel\Мои документы\Programming\Chess4Net\Testing\Client1\Plugins +Item0=..\bin\Chess4Net_Skype +Item1=..\bin diff --git a/plugins/Chess4Net/MI/Chess4Net_MI.dpr b/plugins/Chess4Net/MI/Chess4Net_MI.dpr index 0779b4eb35..bc07ffc32c 100644 --- a/plugins/Chess4Net/MI/Chess4Net_MI.dpr +++ b/plugins/Chess4Net/MI/Chess4Net_MI.dpr @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + library Chess4Net_MI; {******************************* plugin library for Miranda @@ -19,6 +25,8 @@ uses BitmapResUnit in '..\BitmapResUnit.pas', ChessBoardHeaderUnit in '..\ChessBoardHeaderUnit.pas', ChessBoardUnit in '..\ChessBoardUnit.pas' {ChessBoard}, + PosBaseChessBoardLayerUnit in '..\PosBaseChessBoardLayerUnit.pas', + GameChessBoardUnit in '..\GameChessBoardUnit.pas' {GameChessBoard}, ConnectingUnit in '..\ConnectingUnit.pas' {ConnectingForm}, ConnectorUnit in 'ConnectorUnit.pas', ContinueUnit in '..\ContinueUnit.pas' {ContinueForm}, @@ -34,12 +42,16 @@ uses MessageDialogUnit in '..\MessageDialogUnit.pas', ModalForm in '..\ModalForm.pas', PluginCommonUnit in 'PluginCommonUnit.pas', - PosBaseChessBoardUnit in '..\PosBaseChessBoardUnit.pas', PosBaseUnit in '..\PosBaseUnit.pas', PromotionUnit in '..\PromotionUnit.pas' {PromotionForm}, ChessRulesEngine in '..\ChessRulesEngine.pas', ManagerUnit.MI in 'ManagerUnit.MI.pas', - TransmitGameSelectionUnit in 'TransmitGameSelectionUnit.pas' {TransmitGameSelectionForm}; + TransmitGameSelectionUnit in 'TransmitGameSelectionUnit.pas' {TransmitGameSelectionForm}, + ChessClockUnit in '..\ChessClockUnit.pas', + URLVersionQueryUnit in '..\URLVersionQueryUnit.pas', + DontShowMessageDlgUnit in '..\DontShowMessageDlgUnit.pas', + IniSettingsUnit in '..\IniSettingsUnit.pas', + NonRefInterfacedObjectUnit in '..\NonRefInterfacedObjectUnit.pas'; {$R ..\Chess4Net.res} @@ -50,11 +62,11 @@ begin with _PluginInfo^ do begin shortName := 'Chess4Net'; - version := MakeMirandaPluginVersion(201,0,0,1); // 2010.0 - description := PLUGIN_PLAYING_VIA; + version := MakeMirandaPluginVersion(201,1,0,1); // 2010.0 + description := PLUGIN_PLAYING_OVER; author := 'Pavel Perminov'; authorEmail := 'packpaul@mail.ru'; - copyright := '(c) 2007-2010 No Copyrights'; + copyright := '(c) 2007-2011 No Copyrights'; homepage := 'http://www.chess4net.ru'; end; diff --git a/plugins/Chess4Net/MI/ConnectorUnit.pas b/plugins/Chess4Net/MI/ConnectorUnit.pas index 5a50610324..525ebb3b22 100644 --- a/plugins/Chess4Net/MI/ConnectorUnit.pas +++ b/plugins/Chess4Net/MI/ConnectorUnit.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit ConnectorUnit; interface @@ -28,6 +34,7 @@ type _msg_sending, _unformated_msg_sending: string; _cntrMsgIn: integer; // счётчик входящих сообщений _cntrMsgOut: integer; // счётчик исходящих сообщений + m_iLastCntrMsgOutInFormatting: integer; _msg_buf: string; // буфер сообщений // системное сообщение _systemDataList: TStringList; @@ -53,6 +60,7 @@ type procedure FNotifySender; procedure FSendSystemData(sd: string); function FDeformatMsg(var msg: string; out lstId, msgCntr: integer): boolean; + // Formatting of outgoing messages function FFormatMsg(const msg: string): string; function FGetOwnerID: integer; function FGetMultiSession: boolean; @@ -172,6 +180,83 @@ begin end; +function NotifySender(wParam: WPARAM; lParam_: LPARAM): int; cdecl; +const + MSG_TRYS: integer = 1; +var + connector: TConnector; + hContact: THandle; +begin + Result := 0; + hContact := PACKDATA(lParam_).hContact; + + if (PACKDATA(lParam_).type_ <> ACKTYPE_MESSAGE) then + exit; + + case PACKDATA(lParam_)^.result_ of + ACKRESULT_SUCCESS: + begin + MSG_TRYS := 1; + + connector := g_connectorList.GetFirstConnector(hContact); + while Assigned(connector) do + begin + if (connector._msg_sending <> '') then + connector.FNotifySender; + connector := g_connectorList.GetNextConnector; + end; + end; + + ACKRESULT_FAILED: + begin + inc(MSG_TRYS); + if (MSG_TRYS <= MAX_MSG_TRYS) then + begin + connector := g_connectorList.GetFirstConnector(hContact); + while (Assigned(connector)) do + begin + if connector._msg_sending <> '' then + with connector do + begin + _msg_buf := _unformated_msg_sending + _msg_buf; + _sendTimer.Enabled := TRUE; + end; + connector := g_connectorList.GetNextConnector; + end; // while + end + else + begin + connector := g_connectorList.GetFirstConnector(hContact); + while (Assigned(connector)) do + begin + if (connector._msg_sending <> '') then + begin + connector.FPluginConnectorHandler(ceError); + end; + connector := g_connectorList.GetNextConnector; + end; + end; // if (MSG_TRYS <= MAX_MSG_TRYS) + end; // ACKRESULT_FAILED + end; // case PACKDATA +end; + + +procedure TConnector.FNotifySender; +begin +{$IFDEF DEBUG_LOG} + WriteToLog('<< ' + _msg_sending); +{$ENDIF} + if (Connected and (_msg_sending <> MSG_INVITATION)) then + begin + _unformated_msg_sending := ''; + inc(_cntrMsgOut); + if (_cntrMsgOut > m_iLastCntrMsgOutInFormatting) then + _cntrMsgOut := m_iLastCntrMsgOutInFormatting + 1; + end; + _msg_sending := ''; +end; + + // деформатирование входящих сообщений. TRUE - если декодирование удалось function TConnector.FDeformatMsg(var msg: string; out lstId, msgCntr: integer): boolean; var @@ -310,30 +395,23 @@ begin { TConnector.FFilterMsg } end else // Connected begin -{ - if (_msg_sending <> '') then - begin - _msg_sending := ''; - _unformated_msg_sending := ''; - inc(_cntrMsgOut); - end; -} - if (FDeformatMsg(msg, lstId, cntrMsg) and ((not g_bMultisession) or (lstId = _lstId))) then begin Result := TRUE; - if cntrMsg > _cntrMsgIn then + if (cntrMsg > _cntrMsgIn) then + begin + inc(_cntrMsgIn); + if (cntrMsg > _cntrMsgIn) then begin - inc(_cntrMsgIn); - if (cntrMsg > _cntrMsgIn) then - begin - FPluginConnectorHandler(ceError); // пакет исчез - exit; - end; - end - else - exit; // пропуск пакетов с более низкими номерами + FPluginConnectorHandler(ceError); // пакет исчез + exit; + end; + end + else if (cntrMsg < _cntrMsgIn) then + exit; // skipping packets with lower numbers + + // if (cntrMsg = _cntrMsgIn) there's no garantee that packets are synchronized, but let's hope it's so. NProceedData(msg); end @@ -343,21 +421,6 @@ begin { TConnector.FFilterMsg } end; -procedure TConnector.FNotifySender; -begin -{$IFDEF DEBUG_LOG} - WriteToLog('<< ' + _msg_sending); -{$ENDIF} - if (Connected and (_msg_sending <> MSG_INVITATION)) then - begin - _unformated_msg_sending := ''; - inc(_cntrMsgOut); - end; - _msg_sending := ''; -end; - - -// форматирование исходящих сообщений function TConnector.FFormatMsg(const msg: string): string; var contactLstIdStr: string; @@ -367,6 +430,7 @@ begin else // -1 contactLstIdStr := ''; Result := PROMPT_HEAD + contactLstIdStr + PROMPT_SEPARATOR + IntToStr(_cntrMsgOut) + PROMPT_TAIL + msg; + m_iLastCntrMsgOutInFormatting := _cntrMsgOut; end; @@ -473,67 +537,6 @@ begin end; -function NotifySender(wParam: WPARAM; lParam_: LPARAM): int; cdecl; -const - MSG_TRYS: integer = 1; -var - connector: TConnector; - hContact: THandle; -begin - Result := 0; - hContact := PACKDATA(lParam_).hContact; - - if (PACKDATA(lParam_).type_ <> ACKTYPE_MESSAGE) then - exit; - - case PACKDATA(lParam_)^.result_ of - ACKRESULT_SUCCESS: - begin - MSG_TRYS := 1; - - connector := g_connectorList.GetFirstConnector(hContact); - while Assigned(connector) do - begin - if (connector._msg_sending <> '') then - connector.FNotifySender; - connector := g_connectorList.GetNextConnector; - end; - end; - - ACKRESULT_FAILED: - begin - inc(MSG_TRYS); - if (MSG_TRYS <= MAX_MSG_TRYS) then - begin - connector := g_connectorList.GetFirstConnector(hContact); - while (Assigned(connector)) do - begin - if connector._msg_sending <> '' then - with connector do - begin - _msg_buf := _unformated_msg_sending + _msg_buf; - _sendTimer.Enabled := TRUE; - end; - connector := g_connectorList.GetNextConnector; - end; // while - end - else - begin - connector := g_connectorList.GetFirstConnector(hContact); - while (Assigned(connector)) do - begin - if (connector._msg_sending <> '') then - begin - connector.FPluginConnectorHandler(ceError); - end; - connector := g_connectorList.GetNextConnector; - end; - end; // if (MSG_TRYS <= MAX_MSG_TRYS) - end; // ACKRESULT_FAILED - end; // case PACKDATA -end; - - constructor TConnector.Create(hContact: THandle); const ID_COUNTER: Longword = 0; @@ -783,6 +786,15 @@ begin end; +procedure TConnector.FSendSystemData(sd: string); +begin + if ((sd <> MSG_INVITATION) and (sd <> CMD_CLOSE)) then + sd := sd + DATA_SEPARATOR; + _systemDataList.Add(sd); + _sendSystemTimer.Enabled := TRUE; +end; + + procedure TConnector.FsendSystemTimerTimer(Sender: TObject); begin if _systemDataList.Count = 0 then @@ -798,15 +810,6 @@ begin end; -procedure TConnector.FSendSystemData(sd: string); -begin - if ((sd <> MSG_INVITATION) and (sd <> CMD_CLOSE)) then - sd := sd + DATA_SEPARATOR; - _systemDataList.Add(sd); - _sendSystemTimer.Enabled := TRUE; -end; - - function TConnector.FGetOwnerID: integer; begin Result := OWNER_ID; diff --git a/plugins/Chess4Net/MI/ControlUnit.pas b/plugins/Chess4Net/MI/ControlUnit.pas index f9f8694e86..5a2743ca3c 100644 --- a/plugins/Chess4Net/MI/ControlUnit.pas +++ b/plugins/Chess4Net/MI/ControlUnit.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit ControlUnit; interface diff --git a/plugins/Chess4Net/MI/GlobalsLocalUnit.pas b/plugins/Chess4Net/MI/GlobalsLocalUnit.pas index 3e1c6018ff..30eef7a2a8 100644 --- a/plugins/Chess4Net/MI/GlobalsLocalUnit.pas +++ b/plugins/Chess4Net/MI/GlobalsLocalUnit.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit GlobalsLocalUnit; // Модуль для глобальных переменных и констант версии для Миранды @@ -9,21 +15,20 @@ uses const CHESS4NET = 'Chess4Net'; - CHESS4NET_VERSION = 201000; // 2010.0 - CHESS4NET_TITLE = 'Chess4Net 2010.0 (http://chess4net.ru)'; + CHESS4NET_VERSION = 201100; // 2011.0 + CHESS4NET_TITLE = 'Chess4Net 2011.0 (http://chess4net.ru)'; MSG_INVITATION = 'Wellcome to Chess4Net. If you don''t have it, please download it from http://chess4net.ru'; PROMPT_HEAD = 'Ch4N'; MSG_DATA_SEPARATOR = '&&'; PLUGIN_NAME = CHESS4NET; PLUGIN_VERSION = CHESS4NET_VERSION; - PLUGIN_PLAYING_VIA = 'Plugin for playing chess via Miranda'; - PLUGIN_INFO_NAME = 'Chess4Net 2010.0.1'; + PLUGIN_PLAYING_OVER = 'Plugin for playing chess over Miranda'; + PLUGIN_INFO_NAME = 'Chess4Net 2011.0.0'; PLUGIN_URL = 'http://chess4net.ru'; PLUGIN_EMAIL = 'packpaul@mail.ru'; var - Chess4NetPath: string; Chess4NetIcon, pluginIcon: TIcon; implementation diff --git a/plugins/Chess4Net/MI/ManagerUnit.MI.pas b/plugins/Chess4Net/MI/ManagerUnit.MI.pas index a27ff73463..c50aa58e4d 100644 --- a/plugins/Chess4Net/MI/ManagerUnit.MI.pas +++ b/plugins/Chess4Net/MI/ManagerUnit.MI.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit ManagerUnit.MI; interface @@ -5,16 +11,9 @@ interface uses SysUtils, // - ControlUnit, ManagerUnit, ConnectorUnit, ModalForm; + ControlUnit, ManagerUnit, ConnectorUnit, ModalForm, NonRefInterfacedObjectUnit; type - TNonRefInterfacedObject = class(TObject, IInterface) - protected - function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall; - function _AddRef: Integer; stdcall; - function _Release: Integer; stdcall; - end; - TManagerMIFactory = class(TNonRefInterfacedObject, IMirandaPlugin) private m_Connector: TConnector; @@ -46,7 +45,8 @@ implementation uses Types, StrUtils, Classes, Dialogs, Controls, // - LocalizerUnit, TransmitGameSelectionUnit, GlobalsLocalUnit, ChessBoardUnit; + LocalizerUnit, TransmitGameSelectionUnit, GlobalsLocalUnit, ChessBoardUnit, + GameChessBoardUnit; type TManagerMI = class(TManager, IMirandaPlugin) // abstract @@ -93,6 +93,7 @@ type private m_GamingManager: TGamingManagerMI; m_bReady: boolean; // ready for transmition + property Ready: boolean read m_bReady; protected procedure Start; procedure ROnCreate; override; @@ -182,7 +183,7 @@ end; procedure TGamingManagerMI.FSetGameContextToTransmitter(ATransmitter: TTransmittingManagerMI); begin - if (not (Assigned(ATransmitter) and ATransmitter.m_bReady)) then + if (not (Assigned(ATransmitter) and ATransmitter.Ready)) then exit; ATransmitter.RSendData(CMD_NICK_ID + ' ' + PlayerNickId + ' ' + OpponentNickId + ' ' + OpponentNick); @@ -294,12 +295,10 @@ begin ceError: begin Connector.Close; - inherited ConnectorHandler(e, d1, d2); end; - - else - inherited ConnectorHandler(e, d1, d2); end; // case + + inherited ConnectorHandler(e, d1, d2); end; @@ -347,7 +346,7 @@ begin for i := 0 to m_lstTransmittingManagers.Count - 1 do begin ATransmitter := m_lstTransmittingManagers[i]; - if (Assigned(ATransmitter) and (ATransmitter.m_bReady)) then + if (Assigned(ATransmitter) and (ATransmitter.Ready)) then ATransmitter.RSendData(strCmd); end; end; @@ -645,29 +644,6 @@ begin end; // case end; -//////////////////////////////////////////////////////////////////////////////// -// TNonRefInterfacedObject - -function TNonRefInterfacedObject.QueryInterface(const IID: TGUID; out Obj): HResult; -begin - if GetInterface(IID, Obj) then - Result := 0 - else - Result := E_NOINTERFACE; -end; - - -function TNonRefInterfacedObject._AddRef: Integer; -begin - Result := -1; -end; - - -function TNonRefInterfacedObject._Release: Integer; -begin - Result := -1; -end; - //////////////////////////////////////////////////////////////////////////////// // TTransmittingManagerMI @@ -767,13 +743,13 @@ begin end else if (sl = CMD_GOODBYE) then begin - Stop; + Stop; end else if (sl = CMD_WELCOME) then begin RSendData(CMD_WELCOME); m_bReady := TRUE; - m_GamingManager.FSetGameContextToTransmitter(self); + m_GamingManager.FSetGameContextToTransmitter(self); end; end; diff --git a/plugins/Chess4Net/MI/PluginCommonUnit.pas b/plugins/Chess4Net/MI/PluginCommonUnit.pas index c2c2bd8d32..30cbdccec5 100644 --- a/plugins/Chess4Net/MI/PluginCommonUnit.pas +++ b/plugins/Chess4Net/MI/PluginCommonUnit.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit PluginCommonUnit; interface @@ -14,9 +20,9 @@ procedure ErrorDuringPluginStart; implementation uses - Windows, Forms, Dialogs, Graphics, SysUtils, Controls + Windows, Forms, Dialogs, Graphics, SysUtils, Controls, // plugin units - , GlobalsLocalUnit, ManagerUnit.MI, ModalForm; + GlobalsUnit, GlobalsLocalUnit, ManagerUnit.MI, ModalForm; function CreatePluginInstance(Connector: TConnector): IMirandaPlugin; begin @@ -30,6 +36,8 @@ begin Chess4NetPath := MirandaPluginPath; if (not DirectoryExists(Chess4NetPath)) then CreateDir(Chess4NetPath); + Chess4NetIniFilePath := Chess4NetPath; + Chess4NetGamesLogPath := Chess4NetPath; Chess4NetIcon := TIcon.Create; Chess4NetIcon.Handle := LoadIcon(hInstance, 'MAINICON'); pluginIcon := Chess4NetIcon; diff --git a/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas b/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas index 8e87d67d66..a70eb65ef5 100644 --- a/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas +++ b/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas @@ -1,3 +1,9 @@ +//////////////////////////////////////////////////////////////////////////////// +// All code below is exclusively owned by author of Chess4Net - Pavel Perminov +// (packpaul@mail.ru, packpaul1@gmail.com). +// Any changes, modifications, borrowing and adaptation are a subject for +// explicit permition from the owner. + unit TransmitGameSelectionUnit; interface -- cgit v1.2.3