forked from HemulGM/IMJabber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIM.Account.pas
97 lines (82 loc) · 2.08 KB
/
IM.Account.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
unit IM.Account;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, HGM.Button;
type
TFormAccount = class(TForm)
PanelBottom: TPanel;
Label1: TLabel;
sLabel1: TLabel;
sLabel2: TLabel;
sLabel3: TLabel;
sLabel5: TLabel;
EditNick: TEdit;
EditLogin: TEdit;
EditServer: TEdit;
EditPassword: TEdit;
EditJabberPort: TEdit;
ButtonFlatSave: TButtonFlat;
ButtonFlatCancel: TButtonFlat;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
PanelTop: TPanel;
Label2: TLabel;
Shape7: TShape;
procedure EditPasswordChange(Sender: TObject);
procedure ButtonFlatSaveClick(Sender: TObject);
procedure ButtonFlatCancelClick(Sender: TObject);
private
FPasswordChanged: Boolean;
public
class function Execute(var JID, Nick, Password, Server, Port: string): Boolean;
end;
var
FormAccount: TFormAccount;
implementation
uses
IM.Main, CryptUnit, IM.Core, Jabber;
{$R *.dfm}
procedure TFormAccount.ButtonFlatCancelClick(Sender: TObject);
begin
Close;
end;
procedure TFormAccount.ButtonFlatSaveClick(Sender: TObject);
begin
if (EditNick.Text <> '') and (EditLogin.Text <> '') and (EditServer.Text <> '') then
begin
ModalResult := mrOk;
end
else
ShowMessage('Íå âñå ïîëÿ çàïîëíåíû!');
end;
procedure TFormAccount.EditPasswordChange(Sender: TObject);
begin
FPasswordChanged := True;
end;
class function TFormAccount.Execute(var JID, Nick, Password, Server, Port: string): Boolean;
begin
with TFormAccount.Create(nil) do
begin
EditLogin.Text := JID;
EditServer.Text := Server;
EditJabberPort.Text := Port;
EditNick.Text := Nick;
if Password <> '' then
EditPassword.Text := '123456789123';
FPasswordChanged := False;
Result := ShowModal = mrOK;
JID := EditLogin.Text;
Server := EditServer.Text;
Port := EditJabberPort.Text;
Nick := EditNick.Text;
if FPasswordChanged then
Password := EditPassword.Text;
Free;
end;
end;
end.