-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathIM.Conference.Invite.pas
130 lines (114 loc) · 3.13 KB
/
IM.Conference.Invite.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
unit IM.Conference.Invite;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MD5Hash, ComCtrls, Jabber, Vcl.ExtCtrls, HGM.Button;
type
TFormConfInvite = class(TForm)
GroupBoxList: TPanel;
LabelConfs: TLabel;
Label2: TLabel;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
ListViewConfs: TListView;
ProgressBarLoad: TProgressBar;
EditServer: TEdit;
EditRoom: TEdit;
EditLogin: TEdit;
EditPass: TEdit;
ComboBoxNick: TEdit;
PanelBottom: TPanel;
ButtonFlatOK: TButtonFlat;
ButtonFlatCancel: TButtonFlat;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
ButtonFlatUpdate: TButtonFlat;
Shape6: TShape;
PanelTop: TPanel;
Label6: TLabel;
Shape7: TShape;
procedure ListViewConfsDblClick(Sender: TObject);
procedure ButtonFlatCancelClick(Sender: TObject);
procedure ButtonFlatOKClick(Sender: TObject);
procedure ButtonFlatUpdateClick(Sender: TObject);
private
{ Private declarations }
public
class function Execute(Jabber: TJabberClient; var Conf, Nick: string): Boolean;
end;
var
FormConfInvite: TFormConfInvite;
implementation
uses
IM.Conference, IM.Main, IM.Account, Jabber.Types;
{$R *.dfm}
procedure TFormConfInvite.ListViewConfsDblClick(Sender: TObject);
begin
if ListViewConfs.ItemIndex >= 0 then
begin
EditRoom.Text := NickFromJID(ListViewConfs.Items[ListViewConfs.ItemIndex].SubItems[0]);
end;
end;
class function TFormConfInvite.Execute(Jabber: TJabberClient; var Conf, Nick: string): Boolean;
begin
with TFormConfInvite.Create(nil) do
begin
ComboBoxNick.Text := Jabber.UserNick;
EditServer.Text := 'conference.' + Jabber.UserServer;
EditRoom.Text := '';
EditPass.Text := '';
EditLogin.Text := Jabber.UserName;
Result := ShowModal = mrOK;
Conf := EditRoom.Text + '@' + EditServer.Text;
Nick := ComboBoxNick.Text;
Free;
end;
end;
procedure TFormConfInvite.ButtonFlatUpdateClick(Sender: TObject);
var
i: integer;
Items: TConfList;
begin
if FormMain.JabberClient.Online then
begin
ListViewConfs.Clear;
ButtonFlatUpdate.Enabled := False;
ProgressBarLoad.Style := pbstMarquee;
ProgressBarLoad.Visible := True;
Items := FormMain.JabberClient.GetListOfConference(EditServer.Text);
if Items.Count > 0 then
begin
for i := 0 to Items.Count - 1 do
with ListViewConfs.Items.Add do
begin
Caption := Items[i].Name;
SubItems.Add(Items[i].JID);
end;
end;
LabelConfs.Caption := 'Ñïèñîê êîíôåðåíöèé ñåðâåðà (' + ListViewConfs.Items.Count.ToString + '):';
Items.Free;
ProgressBarLoad.Style := pbstNormal;
ProgressBarLoad.Visible := False;
ButtonFlatUpdate.Enabled := True;
end;
end;
procedure TFormConfInvite.ButtonFlatCancelClick(Sender: TObject);
begin
Close;
end;
procedure TFormConfInvite.ButtonFlatOKClick(Sender: TObject);
begin
if EditRoom.Text = '' then
Exit;
if EditServer.Text = '' then
Exit;
if ComboBoxNick.Text = '' then
Exit;
ModalResult := mrOk;
end;
end.