You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RnQ/RnQ/ICQ/viewinfoDlg.pas

1568 lines
48 KiB
Plaintext

{
This file is part of R&Q.
Under same license
}
unit viewinfoDlg;
{$I RnQConfig.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, System.Types,
StdCtrls, ICQContacts, ExtCtrls, ComCtrls, Menus, strutils, RnQButtons, RnQSpin,
// OverbyteIcsWSocket,
// wsocket,
{$IFDEF USE_GDIPLUS}
RnQGraphics,
{$ELSE}
RnQGraphics32,
{$ENDIF USE_GDIPLUS}
globalLib, RnQDialogs, RnQNet, RnQProtocol;
{$I NoRTTI.inc}
type
// TviewinfoFrm = class(TForm)
TviewinfoFrm = class(TRnQViewInfoForm)
pagectrl: TPageControl;
mainSheet: TTabSheet;
Label7: TLabel;
Label8: TLabel;
Label2: TLabel;
Label13: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
aboutBox: TMemo;
ipBox: TEdit;
genderBox: TComboBox;
lang1Box: TComboBox;
lang2Box: TComboBox;
lang3Box: TComboBox;
TabSheet2: TTabSheet;
dontdeleteChk: TCheckBox;
mailBtn: TRnQSpeedButton;
Bevel2: TBevel;
Label28: TLabel;
uinlistsBox: TMemo;
groupBox: TLabeledEdit;
TabSheet1: TTabSheet;
notesBox: TMemo;
publicChk: TCheckBox;
smsChk: TCheckBox;
topPnl: TPanel;
deleteBtn: TRnQSpeedButton;
saveBtn: TRnQSpeedButton;
updateBtn: TRnQSpeedButton;
nickBox: TLabeledEdit;
lastBox: TLabeledEdit;
firstBox: TLabeledEdit;
emailBox: TLabeledEdit;
displayBox: TLabeledEdit;
uinBox: TLabeledEdit;
statusBox: TLabeledEdit;
timeBox: TLabeledEdit;
birthBox: TDateTimePicker;
birthageBox: TComboBox;
birthageLbl: TLabel;
xstatusBox: TLabeledEdit;
InterSheet: TTabSheet;
BirthLBox: TDateTimePicker;
BirthLChk: TCheckBox;
ipbox2: TMemo;
Label26: TLabel;
resolveBtn: TRnQSpeedButton;
copyBtn: TRnQSpeedButton;
ChkSendTransl: TCheckBox;
protoBox: TLabeledEdit;
clientBox: TLabeledEdit;
GroupBox9: TGroupBox;
Inter1Box: TComboBox;
Inter2Box: TComboBox;
Inter3Box: TComboBox;
Inter1: TEdit;
Inter2: TEdit;
Inter3: TEdit;
Inter4Box: TComboBox;
Inter4: TEdit;
Bevel3: TBevel;
lastupdateBox: TLabeledEdit;
membersinceBox: TLabeledEdit;
onlinesinceBox: TLabeledEdit;
lastonlineBox: TLabeledEdit;
lastmsgBox: TLabeledEdit;
CapsLabel: TLabel;
XstatusBtn: TRnQSpeedButton;
CliCapsMemo: TMemo;
// Avatars
avtTS: TTabSheet;
AVTGrp: TGroupBox;
IcShRGrp: TRadioGroup;
PhtGrp: TGroupBox;
StatusBtn: TRnQSpeedButton;
PhtLoadBtn2: TRnQButton;
PhtLoadBtn3: TRnQButton;
AvtPBox: TPaintBox;
PhotoPBox: TPaintBox;
ClrAvtLbl: TLabel;
ClrAvtBtn: TRnQButton;
avtSaveBtn: TRnQButton;
avtLoadBtn: TRnQButton;
PhtLoadBtn: TRnQButton;
PhtBigLoadBtn: TRnQButton;
// Work
WorkTS: TTabSheet;
WkpgEdt: TLabeledEdit;
workCityEdt: TLabeledEdit;
workStateEdt: TLabeledEdit;
WorkCntryBox: TComboBox;
workZipEdt: TLabeledEdit;
Label1: TLabel;
WorkCellEdit: TLabeledEdit;
WorkPosEdit: TLabeledEdit;
WorkDeptEdit: TLabeledEdit;
WorkCompanyEdit: TLabeledEdit;
loginMailEdt: TLabeledEdit;
GoWkPgBtn: TRnQButton;
LUPDDATEEdt: TEdit;
PrivacyTab: TTabSheet;
gmtBox: TComboBox;
MarStsBox: TComboBox;
Label3: TLabel;
StsMsgEdit: TLabeledEdit;
RnQButton2: TRnQButton;
Label4: TLabel;
FontSelectBtn: TRnQSpeedButton;
ssNotesGrp: TGroupBox;
ssNoteStrEdit: TLabeledEdit;
localMailEdt: TLabeledEdit;
CellularEdt: TLabeledEdit;
ApplyMyTextBtn: TRnQButton;
lclNoteStrEdit: TLabeledEdit;
LastChgInfoBox: TLabeledEdit;
LInfoDATEEdt: TEdit;
TabSheet3: TTabSheet;
goBtn: TRnQButton;
homepageBox: TLabeledEdit;
countryBox: TComboBox;
cityBox: TLabeledEdit;
stateBox: TLabeledEdit;
cellularBox: TLabeledEdit;
zipBox: TLabeledEdit;
Label14: TLabel;
GroupBox1: TGroupBox;
birthCityBox: TLabeledEdit;
birthStateBox: TLabeledEdit;
birthCountryBox: TComboBox;
Label5: TLabel;
addressBox: TLabeledEdit;
regularBox: TLabeledEdit;
workAddressEdt: TLabeledEdit;
ageSpin: TLabel;
verifyPhone: TRnQButton;
verifyPhone2: TRnQButton;
CellularEdt2: TLabeledEdit;
CellularEdt3: TLabeledEdit;
procedure PhtBigLoadBtnClick(Sender: TObject);
procedure StatusBtnClick(Sender: TObject);
procedure PhtLoadBtnClick(Sender: TObject);
procedure avtSaveBtnClick(Sender: TObject);
procedure avtLoadBtnClick(Sender: TObject);
procedure XstatusBtnClick(Sender: TObject);
procedure BirthLChkKeyPress(Sender: TObject; var Key: Char);
procedure BirthLChkClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure updateBtnClick(Sender: TObject);
procedure deleteBtnClick(Sender: TObject);
procedure saveBtnClick(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure goBtnClick(Sender: TObject);
procedure mailBtnClick(Sender: TObject);
procedure resolveBtnClick(Sender: TObject);
procedure dnslookup(Sender: TObject; Error: Word);
procedure copyBtnClick(Sender: TObject);
procedure addcontactAction(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure birthBoxChange(Sender: TObject);
procedure birthageBoxChange(Sender: TObject);
procedure OnlyDigitChange(Sender: TObject);
procedure AvtPBoxPaint(Sender: TObject);
procedure PhotoPBoxPaint(Sender: TObject);
procedure GoWkPgBtnClick(Sender: TObject);
procedure ClrAvtBtnClick(Sender: TObject);
procedure avtTSShow(Sender: TObject);
procedure pagectrlChange(Sender: TObject);
procedure PhtLoadBtn2Click(Sender: TObject);
procedure PhtLoadBtn3Click(Sender: TObject);
procedure RnQButton2Click(Sender: TObject);
procedure statusBoxSubLabelDblClick(Sender: TObject);
// procedure RnQButton3Click(Sender: TObject);
procedure ApplyMyTextBtnClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure removeAllPhotos();
procedure verifyPhoneClick(Sender: TObject);
protected
addmenu: TPopupMenu;
procedure SetPhtBtnEnb(val: Boolean);
procedure TickAniTimer(Sender: TObject);
public
// contact: TICQContact;
{$IFDEF RNQ_AVATARS}
FAniTimer: TTimer;
contactAvt, contactPhoto: TRnQBitmap;
{$ENDIF RNQ_AVATARS}
lookup: TRnQSocket;
// readOnlyContact:boolean;
procedure updateInfo; OverRide; final;
constructor doAll(owner_: Tcomponent; c: TRnQContact); OverRide; final;
function isUpToDate: Boolean;
procedure setupBirthage;
procedure updateAge;
procedure UpdateCntAvatar; OverRide; final;
procedure ClearAvatar; OverRide; final;
procedure UpdateClock; OverRide; final;
end;
// var
// viewinfoFrm: TviewinfoFrm;
implementation
uses
clipbrd, DateUtils,
RQCodes, RDGlobal, RDUtils, RnQLangs, RnQStrings,
RQUtil, RQThemes, RnQBinUtils,
RnQSysUtils, RnQGlobal, RnQPics,
mainDlg, langLib, roasterLib, chatDlg, utilLib,
themesLib,
{$IFDEF RNQ_AVATARS}
RnQ_Avatars,
// AsyncCalls,
{$ENDIF}
Protocols_all,
RQ_ICQ, ICQConsts, Protocol_ICQ, ICQv9,
menusUnit;
{$R *.DFM}
// Delete all photos before downloading,
// otherwise ExtByContent may change extension and photo won't be replaced
procedure TviewinfoFrm.removeAllPhotos();
var
sr: TSearchRec;
begin
if FindFirst(AccPath + avtPath + contact.uid2Cmp + '.photo.*', faAnyFile, sr) = 0 then
repeat
if (sr.name <> '.') and (sr.name <> '..') then
if isSupportedPicFile(sr.name) then
DeleteFile(AccPath + avtPath + sr.name);
until findNext(sr) <> 0;
findClose(sr);
end;
procedure TviewinfoFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
childWindows.remove(self);
visible := FALSE;
if displayBox.text <> contact.displayed then
begin
contact.display := displayBox.text;
// SSI_UpdateContact -- In Contacts.pas
roasterLib.sort(contact);
chatFrm.userChanged(contact);
end;
// if contact = ICQ.myInfo then
// curXStatusStr := xstatusBox.Text;
// if xstatusBox.Text <> contact.xStatusStr then
// contact.xStatusStr := xstatusBox.Text;
TCE(contact.data^).dontdelete := dontdeleteChk.checked;
TCE(contact.data^).notes := notesBox.text;
contact.lclImportant := lclNoteStrEdit.text;
TICQcontact(contact).ssImportant := ssNoteStrEdit.text;
TICQcontact(contact).ssCell := CellularEdt.text;
TICQcontact(contact).ssCell2 := CellularEdt2.text;
TICQcontact(contact).ssCell3 := CellularEdt3.text;
TICQcontact(contact).ssMail := localMailEdt.text;
contact.SendTransl := ChkSendTransl.checked;
if contact.icon.ToShow <> IcShRGrp.ItemIndex then
begin
case IcShRGrp.ItemIndex of
0:
contact.icon.ToShow := IS_AVATAR;
1:
contact.icon.ToShow := IS_PHOTO;
2:
contact.icon.ToShow := IS_NONE;
end;
updateAvatar(contact);
updateAvatarFor(contact);
end;
addmenu.Free;
{$IFDEF RNQ_AVATARS}
if Assigned(contactAvt) then
contactAvt.Free;
contactAvt := NIL;
if Assigned(contactPhoto) then
contactPhoto.Free;
contactPhoto := NIL;
{$ENDIF RNQ_AVATARS}
FreeAndNil(FAniTimer);
Action := caFree;
destroyHandle;
self := NIL;
end;
function findInStrings(s: string; ss: Tstrings): integer;
begin
result := 0;
while result < ss.count do
if ss[result] = s then
exit
else
inc(result);
result := -1;
end; // findInStrings
procedure TviewinfoFrm.updateInfo;
function gmt2str(gmt: Tdatetime): string;
var
halfs: integer;
begin
// result:=getTranslation('GMT')+' ';
result := '';
if gmt < 0 then
begin
result := result + '-';
gmt := -gmt;
end
else
result := result + '+';
halfs := round(gmt * 48);
if halfs = 100 then
begin
result := '';
exit;
end;
result := result + intToStr(halfs div 2);
if odd(halfs) then
result := result + ':30'
else
result := result + ':00';
end; // gmt2str
function datetime2str(dt: Tdatetime): string; overload;
begin
result := datetimeTostrMinMax(dt, { 1980 } 80 * 365, now)
end;
var
i: Byte;
sr: TSearchRec;
b: Boolean;
fn: String;
tmpCaps: TStringList;
begin
pagectrl.visible := FALSE;
with TICQcontact(contact) do
begin
caption := getTranslation('%s', [displayed]);
if nodb then
caption := caption + ' ' + getTranslation('- user not found on server')
else if infoUpdatedTo = 0 then
caption := caption + ' ' + getTranslation('- no info')
else if not isUpToDate then
caption := caption + ' ' + getTranslation('- newer info available on server');
displayBox.text := displayed;
firstBox.text := first;
lastBox.text := last;
emailBox.text := email;
cityBox.text := city;
addressBox.text := address;
stateBox.text := state;
// aboutBox.text:=unUTF(about);
aboutBox.text := about;
nickBox.text := nick;
uinBox.text := uid;
if contact.fProto.isMyAcc(contact) then
ipBox.text := TICQSession(contact.fProto).getLocalIPstr
else if connection.ip = 0 then
ipBox.text := ''
else
ipBox.text := ip2str(connection.ip);
if ipBox.text = '' then
begin
ipBox.text := getTranslation(Str_unk);
resolveBtn.enabled := FALSE;
end
else
resolveBtn.enabled := TRUE;
copyBtn.enabled := resolveBtn.enabled;
ipbox2.text := ipBox.text;
if connection.internal_ip <> 0 then
ipbox2.text := ipbox2.text + CRLF + getTranslation('Internal IP') + ': ' + ip2str(connection.internal_ip);
if xStatusStr > '' then
statusBox.text := xStatusStr
else
statusBox.text := statusNameExt2(Byte(status), xStatus);
StatusBtn.ImageName := statusImg;
// theme.getPic(statusImg, statusImg.Picture.bitmap);
{$IFDEF RNQ_FULL}
xstatusBox.text := xStatusDesc;
XstatusBtn.ImageName := XStatusArray[xStatus].PicName;
XstatusBtn.enabled := xStatus > 0;
// theme.getPic(aXStatus[xStatus].PicName, xstatusImg.Picture.bitmap);
{$ENDIF}
if zip = '' then
zipBox.text := ''
else
zipBox.text := zip;
// else zipBox.text:=StringOfChar('0',6-length(zip))+zip;
cellularBox.text := cellular;
regularBox.text := regular;
timeBox.text := '';
smsChk.checked := smsable;
with gmtBox do
ItemIndex := findInStrings(gmt2str(getGMT), Items);
with genderBox do
ItemIndex := findInStrings(GendersByID(gender), Items);
with countryBox do
ItemIndex := findInStrings(CountriesByID(country), Items);
with lang1Box do
ItemIndex := findInStrings(languagesByID(lang[1]), Items);
with lang2Box do
ItemIndex := findInStrings(languagesByID(lang[2]), Items);
with lang3Box do
ItemIndex := findInStrings(languagesByID(lang[3]), Items);
with MarStsBox do
ItemIndex := findInStrings(MarStsByID(MarStatus), Items);
// i := interests.Count;
if interests.count > 0 then
begin
with Inter1Box do
ItemIndex := findInStrings(InterestsByID(interests.InterestBlock[0].Code), Items);
with Inter2Box do
ItemIndex := findInStrings(InterestsByID(interests.InterestBlock[1].Code), Items);
with Inter3Box do
ItemIndex := findInStrings(InterestsByID(interests.InterestBlock[2].Code), Items);
with Inter4Box do
ItemIndex := findInStrings(InterestsByID(interests.InterestBlock[3].Code), Items);
Inter1.text := strings2str(', ', interests.InterestBlock[0].Names);
Inter2.text := strings2str(', ', interests.InterestBlock[1].Names);
Inter3.text := strings2str(', ', interests.InterestBlock[2].Names);
Inter4.text := strings2str(', ', interests.InterestBlock[3].Names);
end
else
begin
Inter1.text := '';
Inter2.text := '';
Inter3.text := '';
Inter4.text := '';
end;
homepageBox.text := homepage;
if birth > 712 then
try
birthBox.date := birth;
birthageBox.ItemIndex := 1;
except
birthBox.date := now;
birthageBox.ItemIndex := 1;
end
// else
// if age > 0 then
// begin
// ageSpin.value:=age;
// birthageBox.itemIndex:=2
// end
else
birthageBox.ItemIndex := 0;
if not(age = 0) then
ageSpin.caption := intToStr(age) + getYearsWord(age)
else
ageSpin.caption := '';
setupBirthage;
if birthL = 0 then // <20><> Birthday By self!!!
begin
BirthLBox.date := date;
BirthLChk.checked := FALSE;
BirthLBox.enabled := FALSE;
end
else
begin
BirthLBox.date := birthL;
BirthLChk.checked := TRUE;
BirthLBox.enabled := TRUE;
end;
notesBox.text := TCE(data^).notes;
ssNoteStrEdit.text := ssImportant;
ssNoteStrEdit.enabled := True;
lclNoteStrEdit.text := lclImportant;
lclNoteStrEdit.enabled := True;
CellularEdt.text := ssCell;
CellularEdt2.text := ssCell2;
CellularEdt3.text := ssCell3;
CellularEdt.enabled := True;
CellularEdt2.enabled := True;
CellularEdt3.enabled := True;
localMailEdt.text := ssMail;
localMailEdt.enabled := True;
ApplyMyTextBtn.enabled :=
{$IFDEF UseNotSSI}
TICQSession(contact.fProto).useSSI and
{$ENDIF UseNotSSI}
contact.fProto.isOnline;
publicChk.checked := TICQSession(contact.fProto).pPublicEmail;
dontdeleteChk.checked := TCE(data^).dontdelete;
ChkSendTransl.checked := SendTransl;
lastmsgBox.text := datetime2str(TCE(data^).lastMsgTime);
lastonlineBox.text := datetime2str(lastTimeSeenOnline);
lastupdateBox.text := datetime2str(infoUpdatedTo);
onlinesinceBox.text := datetime2str(onlineSince);
membersinceBox.text := datetime2str(memberSince);
LastChgInfoBox.text := datetime2str(lastInfoUpdate);
lastmsgBox.ReadOnly := TRUE;
lastonlineBox.ReadOnly := TRUE;
lastupdateBox.ReadOnly := TRUE;
onlinesinceBox.ReadOnly := TRUE;
membersinceBox.ReadOnly := TRUE;
LastChgInfoBox.ReadOnly := TRUE;
if contact.group = 0 then
groupBox.text := '(' + getTranslation('None') + ')'
else
groupBox.text := groups.id2name(contact.group);
// end; // end with
groupBox.ReadOnly := TRUE;
uinlistsBox.text := '';
uinlists.resetEnumeration;
while uinlists.hasMore do
with uinlists.getNext^ do
if cl.exists(contact) then
uinlistsBox.lines.add(name);
uinlistsBox.ReadOnly := TRUE;
// RnQSpeedButton1.Enabled := contact.Icon_hash > '';
// Image1.Picture.Assign(contact.icon);
LUPDDATEEdt.text := IntToHex(integer(TICQcontact(contact).lastUpdate_dw), 8);
LInfoDATEEdt.text := IntToHex(TICQcontact(contact).lastinfoupdate_dw, 8);
LUPDDATEEdt.ReadOnly := TRUE;
LInfoDATEEdt.ReadOnly := TRUE;
// clientBox.text := getClientFor(contact, True);
clientBox.text := contact.ClientDesc;
if clientBox.text = '' then
clientBox.text := getTranslation(Str_unk);
if contact.fProto.isMyAcc(contact) then
begin
protoBox.text := 'ver.' + intToStr(My_proto_ver);
loginMailEdt.text := Attached_login_email;
end
else
begin
protoBox.text := ifThen(TICQcontact(contact).proto = 0, getTranslation(Str_unk),
'ver.' + intToStr(TICQcontact(contact).proto));
loginMailEdt.text := '';
loginMailEdt.visible := FALSE;
end;
CliCapsMemo.Clear;
tmpCaps := TStringList.Create;
{$IFDEF DEBUG_PACKETS}
for i in capabilitiesSm do
tmpCaps.Append(str2hex(CapsSmall[i].v));
for i in capabilitiesBig do
tmpCaps.Append(str2hex(BigCapability[i].v));
for i in capabilitiesXTraz do
tmpCaps.Append(str2hex(XStatusArray[i].pid6));
if length(extracapabilities) > 15 then
for i := 0 to length(extracapabilities) div 16 - 1 do
tmpCaps.Append(str2Hex(copy(extracapabilities, i * 16 + 1, 16)));
{$ELSE}
// CliCapsList.Clear;
// for I := 1 to Length(CapsSmall) do
// if i in contact.capabilitiesSm then
for i in capabilitiesSm do
tmpCaps.Append(getTranslation(CapsSmall[i].s));
// CliCapsList.AddItem(getTranslation(CapsSmall[i].s), NIL);
// for I := 1 to Length(BigCapability) do
// if i in contact.capabilitiesBig then
for i in capabilitiesBig do
tmpCaps.Append(getTranslation(BigCapability[i].s));
// CliCapsList.AddItem(getTranslation(BigCapability[i].s), NIL);
// for I := 1 to Length(XStatusArray) do
// if i in contact.capabilitiesXTraz then
for i in capabilitiesXTraz do
tmpCaps.Append(getTranslation('Old XStatus "%s"', [getTranslation(XStatusArray[i].caption)]));
if length(extracapabilities) > 15 then
for i := 0 to length(extracapabilities) div 16 - 1 do
tmpCaps.Append(str2HexU(copy(extracapabilities, i * 16 + 1, 16)) + ' - ' +
BetterStr(copy(extracapabilities, i * 16 + 1, 16)));
// CliCapsList.AddItem(str2Hex(copy(contact.extracapabilities, i*16+1, 16)), NIL);
{$ENDIF DEBUG_PACKETS}
try
tmpCaps.Sort;
CliCapsMemo.Lines.Assign(tmpCaps);
finally
tmpCaps.Free;
end;
clientBox.ReadOnly := TRUE;
protoBox.ReadOnly := TRUE;
loginMailEdt.ReadOnly := TRUE;
CliCapsMemo.ReadOnly := TRUE;
ipbox2.ReadOnly := TRUE;
WkpgEdt.text := workpage;
WorkPosEdit.text := workPos;
WorkDeptEdit.text := workDep;
workAddressEdt.text := workaddress;
workCityEdt.text := workcity;
workStateEdt.text := workstate;
with WorkCntryBox do
ItemIndex := findInStrings(CountriesByID(workCountry), Items);
workZipEdt.text := workzip;
WorkCellEdit.text := workphone;
WorkCompanyEdit.text := workCompany;
StsMsgEdit.text := ICQ6Status;
birthCityBox.text := birthcity;
birthStateBox.text := birthstate;
with birthCountryBox do
ItemIndex := findInStrings(CountriesByID(birthCountry), Items);
{$IFDEF RNQ_AVATARS}
b := FALSE;
if FindFirst(AccPath + avtPath + contact.uid2Cmp + '.photo.*', faAnyFile, sr) = 0 then
repeat
b := FALSE;
if (sr.name <> '.') and (sr.name <> '..') then
// if sr.Attr and faDirectory > 0 then
// deltree(path+sr.name)
// else
// if isSupportedPicFile(AccPath + avtPath+sr.name) then
if isSupportedPicFile(sr.name) then
begin
// b := pos('.photo.', sr.Name) > 1;
loadPic2(AccPath + avtPath + sr.name, contactPhoto);
b := TRUE;
Break;
end;
until findNext(sr) <> 0;
findClose(sr);
// if FileExists(userPath + avtPath+contact.uinAsStr + '.photo.jpeg') then
// loadPic(userPath + avtPath+contact.uinAsStr + '.photo.jpeg', contactPhoto)
// else
if not b then
try
if Assigned(contactPhoto) then
contactPhoto.Free;
contactPhoto := NIL;
except
end;
// PhotoPBox.Invalidate;
{
if Assigned(contact.icon) then
begin
AvtImg.Picture.Assign(contact.icon);
AvtImg.Transparent := contact.icon.Transparent;
end;
if FileExists(userPath + avtPath+str2hex(contact.Icon_hash_safe) + '.*') then
loadPic(userPath + avtPath+contact.uinAsStr + '.photo.jpeg', PhotoImg.Picture.Bitmap);
}
// PhotoImg.Height := 10;
// try_load_avatar3(contactAvt, ICQIcon.hash_safe);
if not LoadAvtByHash(ICQIcon.hash_safe, contactAvt, b, fn) then
if Assigned(contactAvt) then
FreeAndNil(contactAvt);
avtLoadBtn.enabled := ICQIcon.hash > '';
if Assigned(contactAvt) and contactAvt.Animated then
FAniTimer.enabled := TRUE
else
FAniTimer.enabled := FALSE;
{$ENDIF RNQ_AVATARS}
// avtSaveBtn.Enabled := ism;
// {$IFNDEF RNQ_FULL or $IFDEF RNQ_LITE}
(*
{$IFDEF RNQ_LITE}
PhtLoadBtn.Enabled := False;
PhtBigLoadBtn.Enabled := False;
PhtLoadBtn2.Enabled := False;
PhtLoadBtn3.Enabled := False;
{$ENDIF RNQ_FULL}
*)
case contact.icon.ToShow of
IS_NONE:
IcShRGrp.ItemIndex := 2;
IS_AVATAR:
IcShRGrp.ItemIndex := 0;
IS_PHOTO:
IcShRGrp.ItemIndex := 1;
end;
// MarStsBox.Enabled := False;
pagectrl.visible := TRUE;
end; // end with
end;
procedure TviewinfoFrm.verifyPhoneClick(Sender: TObject);
begin
openICQURL('http://www.icq.com/attach-phone/');
end;
procedure TviewinfoFrm.XstatusBtnClick(Sender: TObject);
begin
TICQSession(contact.fProto).RequestXStatus(contact.uid);
end;
// updateInfo
procedure TviewinfoFrm.updateBtnClick(Sender: TObject);
var
wpS : TwpSearch;
begin
if OnlFeature(contact.fProto) then
begin
// Produces a lot of incoming packets with data
// TICQSession(contact.fProto).sendFullQueryInfo(contact.UID2cmp);
// All data in one packet
TICQSession(contact.fProto).sendAdvQueryInfo(contact.uid2Cmp, TICQcontact(contact).InfoToken);
{
wpS.uin := contact.UID2cmp;
//TICQSession(contact.iProto.ProtoElem).sendQueryInfo(StrToIntDef(wpS.uin, 0));
wpS.token := TICQcontact(contact).InfoToken;
TICQSession(contact.fProto).sendWPsearch2(wpS, 0, False);
}
end
end;
constructor TviewinfoFrm.doAll(owner_: Tcomponent; c: TRnQContact);
var
i: integer;
comp: Tcomponent;
itsme: Boolean;
begin
if c = NIL then
exit;
inherited create(owner_);
position := poDefaultPosOnly;
contact := c;
itsme := c.fProto.isMyAcc(c);
readOnlyContact := not itsme;
applyCommonSettings(self);
// countryBox.Items.text:=CRLF+CountrysToStr;
CountrysToCB(countryBox);
// WorkCntryBox.Items.text:=countryBox.Items.text;
CountrysToCB(WorkCntryBox);
CountrysToCB(birthCountryBox);
genderBox.Items.text := CRLF + GendersToStr;
lang1Box.Items.text := CRLF + LanguagesToStr;
lang2Box.Items.text := lang1Box.Items.text;
lang3Box.Items.text := lang1Box.Items.text;
Inter1Box.Items.text := CRLF + InterestsToStr;
Inter2Box.Items.text := Inter1Box.Items.text;
Inter3Box.Items.text := Inter1Box.Items.text;
Inter4Box.Items.text := Inter1Box.Items.text;
gmtBox.Items.text := gmtsToStr;
MarStsBox.Items.text := MarStsToStr;
if TICQcontact(contact).infoUpdatedTo = 0 then
TICQSession(contact.fProto).sendQueryInfo(StrToIntDef(contact.uid2Cmp, 0));
theme.pic2ico(RQteFormIcon, PIC_INFO, icon);
updateBtn.ImageName := PIC_LOAD_NET;
deleteBtn.ImageName := PIC_DELETE;
goBtn.ImageName := PIC_URL;
verifyPhone.ImageName := PIC_URL;
verifyPhone2.ImageName := PIC_URL;
GoWkPgBtn.ImageName := goBtn.ImageName;
mailBtn.ImageName := PIC_MAIL;
{ theme.getPic(PIC_LOAD_NET, updateBtn.Glyph );
theme.getPic(PIC_DELETE, deleteBtn.Glyph);
theme.getPic(PIC_URL, goBtn.Glyph);
theme.getPic(PIC_MAIL, mailBtn.glyph); }
if itsme then
begin
birthBox.MinDate := 715; // 14.12.1901 (712) = No birthday, so +1 and +2 because of ICQ/QIP
// birthBox.MaxDate := now - 130 * 365;
birthBox.MaxDate := now;
BirthLBox.MinDate := now - 130 * 365;
BirthLBox.MaxDate := now;
end;
for i := componentcount - 1 downto 0 do
begin
comp := components[i];
if comp is TMemo then
(comp as TMemo).ReadOnly := not itsme;
if comp is TEdit then
(comp as TEdit).ReadOnly := not itsme;
if comp is TDateTimePicker then
(comp as TDateTimePicker).enabled := itsme;
if comp is TLabeledEdit then
(comp as TLabeledEdit).ReadOnly := not itsme;
if comp is TComboBox then
(comp as TComboBox).enabled := itsme;
// if (comp is Tcheckbox) then
// (comp as Tcheckbox).enabled:=itsme;
{ if (comp is Tdateedit) then
(comp as Tdateedit).readonly:=not itsme; //Rapid }
if (comp is TRnQSpinEdit) then
TRnQSpinEdit(comp).ReadOnly := not itsme;
end;
publicChk.visible := itsme;
smsChk.enabled := False;
displayBox.ReadOnly := False;
// BirthLBox.Enabled := True;
// displayBox.readonly := itsme;
// displayBox.visible := not itsme;
deleteBtn.visible := not itsme;
dontdeleteChk.visible := not itsme;
ChkSendTransl.visible := not itsme;
notesBox.ReadOnly := False;
ssNoteStrEdit.ReadOnly := False;
lclNoteStrEdit.ReadOnly := False;
localMailEdt.ReadOnly := False;
CellularEdt.ReadOnly := False;
CellularEdt2.ReadOnly := False;
CellularEdt3.ReadOnly := False;
ipBox.ReadOnly := True;
statusBox.ReadOnly := True;
xstatusBox.ReadOnly := True;
// xstatusBox.readonly := not itsme;
uinBox.ReadOnly := True;
emailBox.ReadOnly := True;
timeBox.ReadOnly := True;
if itsme then
begin
saveBtn.caption := getTranslation('save my info');
saveBtn.ImageName := PIC_SAVE_NET;
// theme.getPic(PIC_SAVE_NET, saveBtn.Glyph);
end
else
begin
saveBtn.caption := getTranslation('add to list');
saveBtn.ImageName := PIC_ADD_CONTACT;
// theme.getPic(PIC_ADD_CONTACT, saveBtn.Glyph);
end;
{$IFDEF RNQ_AVATARS}
// avtSaveBtn.Enabled := itsme;
avtSaveBtn.visible := itsme;
avtTS.TabVisible := TICQSession(contact.fProto).AvatarsSupport;
ClrAvtBtn.enabled := (itsme and (TICQSession(contact.fProto).myAvatarHash > '')) or
(not itsme and (TICQcontact(contact).ICQIcon.hash_safe > '') and (TICQcontact(contact).ICQIcon.hash = ''));
ClrAvtLbl.visible := itsme and ClrAvtBtn.enabled;
{$ENDIF RNQ_AVATARS}
LUPDDATEEdt.ReadOnly := TRUE;
LInfoDATEEdt.ReadOnly := TRUE;
LUPDDATEEdt.visible := not itsme;
LInfoDATEEdt.visible := not itsme;
// PrivacyTab.TabVisible := UseContactThemes;
RnQButton2.visible := itsme;
// StsMsgEdit.Visible := PREVIEWversion;
// RnQButton2.Visible := itsme and PREVIEWversion;
// PrivacyTab.TabVisible := itsme and PREVIEWversion;
// RnQButton2.Visible := itsme;
// PrivacyTab.TabVisible := UseContactThemes;
PrivacyTab.TabVisible := FALSE;
translateWindow(self);
childWindows.add(self);
updateViewInfo(c);
end; // doAll
procedure TviewinfoFrm.deleteBtnClick(Sender: TObject);
begin
// if not roasterLib.exists(contact) then
if not contact.isInRoster then
msgDlg('This contact is NOT in your list', TRUE, mtWarning)
else if messageDlg(getTranslation('Are you sure you want to delete %s from your list?', [contact.displayed]), mtConfirmation,
[mbYes, mbNo], 0) = mrYes then
roasterLib.remove(contact);
end;
procedure TviewinfoFrm.saveBtnClick(Sender: TObject);
var
c: TICQcontact;
i, j: integer;
begin
if not contact.fProto.isMyAcc(contact) then
begin
addGroupsToMenu(self, addmenu.Items, addcontactAction, TRUE);
with topPnl.clientToScreen(saveBtn.BoundsRect.bottomRight) do
addmenu.popup(x, y);
end
else if OnlFeature(contact.fProto) then
begin
// c:=Tcontact.create(0);
c := TICQcontact(contact.fProto.getMyInfo);
c.uid := contact.uid;
c.nick := nickBox.text;
c.first := firstBox.text;
c.last := lastBox.text;
c.email := emailBox.text;
c.address := addressBox.text;
c.city := cityBox.text;
c.state := stateBox.text;
// if TryStrToInt(zipBox.text, i) then
c.zip := zipBox.text;
// else
// c.zip := '';
c.age := 0;
c.birth := 0;
case birthageBox.ItemIndex of
1:
c.birth := trunc(birthBox.date);
2:
begin
ageSpin.caption := '';
trystrtoint(ageSpin.caption, c.age);
if ageSpin.caption <> '' then
ageSpin.caption := ageSpin.caption + getYearsWord(c.age);
end;
end;
c.cellular := cellularBox.text;
c.regular := regularBox.text;
c.homepage := homepageBox.text;
c.about := aboutBox.text;
c.gender := StrToGenderI(genderBox.text);
// c.country:=StrToCountryI(countryBox.text);
c.country := CB2ID(countryBox);
c.lang[1] := StrToLanguageI(lang1Box.text);
c.lang[2] := StrToLanguageI(lang2Box.text);
c.lang[3] := StrToLanguageI(lang3Box.text);
c.MarStatus := StrToMarStI(MarStsBox.text);
c.interests.InterestBlock[0].Code := StrToInterestI(Inter1Box.text);
c.interests.InterestBlock[1].Code := StrToInterestI(Inter2Box.text);
c.interests.InterestBlock[2].Code := StrToInterestI(Inter3Box.text);
c.interests.InterestBlock[3].Code := StrToInterestI(Inter4Box.text);
for i := Low(c.interests.InterestBlock) to High(c.interests.InterestBlock) do
if not Assigned(c.interests.InterestBlock[i].Names) then
c.interests.InterestBlock[i].Names := TStringList.create
else
c.interests.InterestBlock[i].Names.Clear;
c.interests.count := 0;
if c.interests.InterestBlock[0].Code > 0 then
begin
str2strings(',', Inter1.text, c.interests.InterestBlock[0].Names);
inc(c.interests.count);
end;
if c.interests.InterestBlock[1].Code > 0 then
begin
str2strings(',', Inter2.text, c.interests.InterestBlock[1].Names);
inc(c.interests.count);
end;
if c.interests.InterestBlock[2].Code > 0 then
begin
str2strings(',', Inter3.text, c.interests.InterestBlock[2].Names);
inc(c.interests.count);
end;
if c.interests.InterestBlock[3].Code > 0 then
begin
str2strings(',', Inter4.text, c.interests.InterestBlock[3].Names);
inc(c.interests.count);
end;
for i := Low(c.interests.InterestBlock) to High(c.interests.InterestBlock) do
for j := 0 to c.interests.InterestBlock[i].Names.count - 1 do
c.interests.InterestBlock[i].Names[j] := Trim(c.interests.InterestBlock[i].Names[j]);
c.GMThalfs := StrToGMTI(gmtBox.text);
// c.xStatusStr := xstatusBox.Text;
TICQSession(c.fProto).pPublicEmail := publicChk.checked;
c.workpage := WkpgEdt.text;
c.workPos := WorkPosEdit.text;
c.workDep := WorkDeptEdit.text;
c.workaddress := workAddressEdt.text;
c.workcity := workCityEdt.text;
c.workstate := workStateEdt.text;
// c.workCountry := StrToCountryI(WorkCntryBox.text);
c.workCountry := CB2ID(WorkCntryBox);
c.workzip := workZipEdt.text;
c.workphone := WorkCellEdit.text;
c.ICQ6Status := StsMsgEdit.text;
c.workCompany := WorkCompanyEdit.text;
c.birthcity := birthCityBox.text;
c.birthstate := birthStateBox.text;
// c.birthCountry := StrToCountryI(birthCntryBox.text);
c.birthCountry := CB2ID(birthCountryBox);
// ICQ.sendSaveMyInfoAs(c);
TICQSession(c.fProto).sendsaveMyInfoNew(c);
{ // retrieves new datas from the server
ICQ.sendStatusCode;
ICQ.sendSimpleQueryInfo(c.uin); }
// c := NIL;
// c.free;
end;
end;
procedure TviewinfoFrm.FormPaint(Sender: TObject);
begin
wallpaperize(canvas)
end;
procedure TviewinfoFrm.goBtnClick(Sender: TObject);
var
s: string;
begin
s := homepageBox.text;
if Trim(s) = '' then
exit;
if not Imatches(s, 1, 'http://') and not Imatches(s, 1, 'https://') then
s := 'http://' + s;
openURL(s);
end;
procedure TviewinfoFrm.GoWkPgBtnClick(Sender: TObject);
var
s: string;
begin
s := WkpgEdt.text;
if Trim(s) = '' then
exit;
if not Imatches(s, 1, 'http://') and not Imatches(s, 1, 'https://') then
s := 'http://' + s;
openURL(s);
end;
procedure TviewinfoFrm.mailBtnClick(Sender: TObject);
begin
sendEmailTo(contact)
end;
procedure TviewinfoFrm.SetPhtBtnEnb(val: Boolean);
begin
if Application.Terminated then
exit;
if Assigned(self) and Assigned(PhtLoadBtn) then
try
PhtLoadBtn.enabled := val;
PhtBigLoadBtn.enabled := val;
PhtLoadBtn2.enabled := val;
PhtLoadBtn3.enabled := val;
except
end;
end;
procedure TviewinfoFrm.PhtBigLoadBtnClick(Sender: TObject);
var
s: String;
begin
{$IFDEF RNQ_AVATARS}
s := AccPath + avtPath + contact.uid2Cmp + '.photo.jpeg';
SetPhtBtnEnb(FALSE);
if Assigned(contactPhoto) then
contactPhoto.Free;
contactPhoto := NIL;
removeAllPhotos();
if LoadFromURL(ICQ_PHOTO_URL + contact.uid2Cmp, s, 0, TRUE) then
if Assigned(self) then // and Assigned(PhotoImg)and Assigned(PhotoImg.Picture) then
begin
loadPic2(s, contactPhoto);
if Assigned(self) and Assigned(PhotoPBox) then
PhotoPBox.Repaint;
end;
SetPhtBtnEnb(TRUE);
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.PhtLoadBtn2Click(Sender: TObject);
var
s: String;
begin
{$IFDEF RNQ_AVATARS}
s := AccPath + avtPath + contact.uid2Cmp + '.photo.jpeg';
if Assigned(contactPhoto) then
contactPhoto.Free;
contactPhoto := NIL;
SetPhtBtnEnb(FALSE);
removeAllPhotos();
if LoadFromURL(Format(ICQ_PHOTO_AVATAR, [contact.uid2Cmp, TICQcontact(contact).gender]), s, 0, TRUE) then
if Assigned(self) then // and Assigned(PhotoImg)and Assigned(PhotoImg.Picture) then
begin
loadPic2(s, contactPhoto);
if Assigned(self) and Assigned(PhotoPBox) then
PhotoPBox.Repaint;
end;
SetPhtBtnEnb(TRUE);
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.PhtLoadBtn3Click(Sender: TObject);
var
// s : String;
prm: TLoadURLParams;
// Dir3: IAsyncCall;
begin
{$IFDEF RNQ_AVATARS}
prm.fn := AccPath + avtPath + contact.uid2Cmp + '.photo.jpeg';
// if Assigned(contactPhoto) then
// contactPhoto.Free;
// contactPhoto := NIL;
SetPhtBtnEnb(FALSE);
prm.URL := ICQ_PHOTO_USER_URL + contact.uid2Cmp;
// prm.fn := s;
prm.Treshold := 0;
prm.ExtByContent := TRUE;
// prm.UID := contact.UID;
prm.cnt := contact;
prm.Proc := @OnPhotoDownLoaded;
{
SetMaxAsyncCallThreads(100);
// Dir3 := AsyncCall(@LoadFromURL2, Integer(@prm));
Dir3 := AsyncCallEx(@LoadFromURL2, prm);
while AsyncMultiSync([Dir3], false, 100) < 0 do
Application.ProcessMessages; }
removeAllPhotos();
LoadFromURL2(prm);
SetPhtBtnEnb(TRUE);
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.PhtLoadBtnClick(Sender: TObject);
var
s: String;
begin
{$IFDEF RNQ_AVATARS}
s := AccPath + avtPath + contact.uid2Cmp + '.photo.jpeg';
if Assigned(contactPhoto) then
contactPhoto.Free;
contactPhoto := NIL;
SetPhtBtnEnb(FALSE);
removeAllPhotos();
if LoadFromURL(ICQ_PHOTO_THUMB_URL + contact.uid2Cmp, s, 0, TRUE) then
if Assigned(self) then // and Assigned(PhotoImg)and Assigned(PhotoImg.Picture) then
begin
loadPic2(s, contactPhoto);
if Assigned(self) and Assigned(PhotoPBox) then
PhotoPBox.Repaint;
end;
SetPhtBtnEnb(TRUE);
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.resolveBtnClick(Sender: TObject);
begin
lookup.OnDnsLookupDone := dnslookup;
lookup.reverseDnsLookup(ipBox.text)
end;
procedure TviewinfoFrm.RnQButton2Click(Sender: TObject);
begin
TICQSession(contact.fProto).sendInfoStatus(StsMsgEdit.text);
end;
{
procedure TviewinfoFrm.RnQButton3Click(Sender: TObject);
var
I: Integer;
begin
if not Assigned(serverSSI.items) then
TicqSession(contact.fProto).RequestContactList(false)
else
begin
i := FindSSIItemType(serverSSI, FEEDBAG_CLASS_ID_PDINFO);
if i >= 0 then
with TOSSIItem(serverSSI.items.Objects[i]) do
TicqSession(contact.fProto).SSI_DeleteItem(GroupID, ItemID, ItemType);
serverSSI.items.Delete(i);
end;
end;
}
procedure TviewinfoFrm.dnslookup(Sender: TObject; Error: Word);
begin
if ipbox2 = NIL then
exit;
if Error = 0 then
ipbox2.text := ipbox2.text + CRLF + TRnQSocket(Sender).DnsResultList.text
else
ipbox2.text := ipbox2.text + CRLF + getTranslation(Str_Error) + ' ' + intToStr(Error);
end; // dnslookup
procedure TviewinfoFrm.copyBtnClick(Sender: TObject);
begin
if ipbox2.lines.count > 1 then
clipboard.astext := ipbox2.lines[1];
end;
procedure TviewinfoFrm.addcontactAction(Sender: TObject);
begin
addToRoster(contact, (Sender as Tmenuitem).tag)
end;
procedure TviewinfoFrm.FormShow(Sender: TObject);
begin
pagectrl.ActivePageIndex := 0;
if readOnlyContact then
displayBox.setFocus
else
nickBox.setFocus;
applyTaskButton(self);
PhotoPBox.Invalidate;
AvtPBox.Invalidate;
end;
procedure TviewinfoFrm.FormCreate(Sender: TObject);
begin
pagectrl.Left := -1;
lookup := TRnQSocket.create(self);
lookup.proxySettings(MainProxy);
addmenu := TPopupMenu.create(self);
{$IFDEF RNQ_AVATARS}
contactPhoto := NIL;
contactAvt := NIL;
{$ENDIF RNQ_AVATARS}
FAniTimer := TTimer.create(nil);
FAniTimer.enabled := FALSE;
FAniTimer.Interval := 40;
// timer.Enabled:= UseAnime;
FAniTimer.OnTimer := TickAniTimer;
end;
procedure TviewinfoFrm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then
begin
Close;
Key := #0;
end;
end;
function TviewinfoFrm.isUpToDate: Boolean;
function newer(d: Tdatetime): Boolean;
begin
result := (d > 10000) and (d < now) and (d > TICQcontact(contact).infoUpdatedTo)
end;
begin
with TICQcontact(contact) do
result := not(newer(lastUpdate) or newer(lastInfoUpdate) or newer(lastStatusUpdate))
end;
// isUpToDate
procedure TviewinfoFrm.birthBoxChange(Sender: TObject);
begin
setupBirthage
end;
procedure TviewinfoFrm.setupBirthage;
var
i: integer;
begin
i := birthageBox.ItemIndex;
birthBox.visible := i = 1;
updateAge;
// birthageLbl.Visible := i = 0;
end;
procedure TviewinfoFrm.updateAge;
var
num: integer;
begin
if birthageBox.ItemIndex = 1 then
contact.birth := birthBox.date
else
contact.birth := 712;
if BirthLChk.checked then
contact.birthL := BirthLBox.date
else
contact.birthL := 0;
ageSpin.caption := '';
if not(contact.birthL = 0) then
begin
num := YearsBetween(now, contact.birthL);
if not(num = 0) then
ageSpin.caption := intToStr(num) + getYearsWord(num)
end
else if not(contact.birth = 0) and (birthageBox.ItemIndex = 1) then
begin
num := YearsBetween(now, contact.birth);
if not(num = 0) then
ageSpin.caption := intToStr(num) + getYearsWord(num);
end;
end;
procedure TviewinfoFrm.statusBoxSubLabelDblClick(Sender: TObject);
var
wpS: TwpSearch;
begin
wpS.uin := contact.uid;
wpS.token := TICQcontact(contact).InfoToken;
TICQSession(contact.fProto).sendWPsearch2(wpS, 0, FALSE);
end;
procedure TviewinfoFrm.StatusBtnClick(Sender: TObject);
begin
TICQSession(contact.fProto).getUINStatus(contact.uid2Cmp);
// getUINStatus
// contact
end;
procedure TviewinfoFrm.birthageBoxChange(Sender: TObject);
begin
setupBirthage
end;
procedure TviewinfoFrm.OnlyDigitChange(Sender: TObject);
begin
onlydigits(Sender)
end;
procedure TviewinfoFrm.pagectrlChange(Sender: TObject);
begin
PhotoPBox.Invalidate;
AvtPBox.Invalidate;
end;
procedure TviewinfoFrm.ApplyMyTextBtnClick(Sender: TObject);
begin
with TICQcontact(contact) do
begin
ssImportant := ssNoteStrEdit.text;
lclImportant := lclNoteStrEdit.text;
ssCell := CellularEdt.text;
ssCell2 := CellularEdt2.text;
ssCell3 := CellularEdt3.text;
ssMail := localMailEdt.text;
end;
if not contact.CntIsLocal and contact.fProto.isOnline then
TICQSession(contact.fProto).SSI_UpdateContact(TICQcontact(contact));
end;
procedure TviewinfoFrm.avtLoadBtnClick(Sender: TObject);
begin
// avt_icq.RequestIcon(contact);
reqAvatarsQ.add(contact);
end;
procedure TviewinfoFrm.AvtPBoxPaint(Sender: TObject);
// var
// gr : TGPGraphics;
begin
{$IFDEF RNQ_AVATARS}
if Assigned(contactAvt) then
begin
if contactAvt.Animated and FAniTimer.enabled then
TickAniTimer(NIL)
else
DrawRbmp(TPaintBox(Sender).canvas.Handle, contactAvt, DestRect(contactAvt.GetWidth, contactAvt.GetHeight,
TPaintBox(Sender).ClientWidth, TPaintBox(Sender).ClientHeight));
{ gr := TGPGraphics.Create(TPaintBox(sender).Canvas.Handle);
with DestRect(contactAvt.GetWidth, contactAvt.GetHeight,
TPaintBox(sender).ClientWidth, TPaintBox(sender).ClientHeight) do
gr.DrawImage(contactAvt, Left, Top, Right-Left, Bottom - Top);
gr.Free; }
end;
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.avtSaveBtnClick(Sender: TObject);
begin
openICQURL('http://www.icq.com/people/' + Account.AccProto.ProtoElem.MyAccNum + '/edit/');
(*
// if OpenSaveFileDialog(Application.Handle, '', 'Pictures (*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.xml)|*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.xml'
if OpenSaveFileDialog(Application.Handle, '', 'Pictures (*.gif;*.jpg;*.jpeg;*.bmp;*.xml)|*.gif;*.jpg;*.jpeg;*.bmp;*.xml'
// getSupPicExts + ';'#0 + 'R&Q Pics Files|*.wbmp'
, '', 'Select R&Q Pic File', fn, True) then
if isSupportedPicFile(fn) or (lowercase(ExtractFileExt(fn))='.xml') then
ToUploadAvatarFN := fn;
*)
end;
procedure TviewinfoFrm.PhotoPBoxPaint(Sender: TObject);
// var
// gr : TGPGraphics;
begin
{$IFDEF RNQ_AVATARS}
if Assigned(contactPhoto) then
begin
DrawRbmp(TPaintBox(PhotoPBox).canvas.Handle, contactPhoto, DestRect(contactPhoto.GetWidth, contactPhoto.GetHeight,
TPaintBox(PhotoPBox).ClientWidth, TPaintBox(PhotoPBox).ClientHeight))
{ gr := TGPGraphics.Create(TPaintBox(sender).Canvas.Handle);
with DestRect(contactPhoto.GetWidth, contactPhoto.GetHeight,
TPaintBox(sender).ClientWidth, TPaintBox(sender).ClientHeight) do
gr.DrawImage(contactPhoto, Left, Top, Right-Left, Bottom - Top);
gr.Free; }
end;
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.avtTSShow(Sender: TObject);
begin
// PhotoPBox.Show;
PhotoPBox.Invalidate;
AvtPBox.Invalidate;
// PhotoPBox.Canvas.Refresh;
AvtPBoxPaint(AvtPBox);
PhotoPBoxPaint(PhotoPBox);
end;
procedure TviewinfoFrm.BirthLChkClick(Sender: TObject);
begin
BirthLBox.enabled := BirthLChk.checked;
updateAge
end;
procedure TviewinfoFrm.BirthLChkKeyPress(Sender: TObject; var Key: Char);
begin
BirthLBox.enabled := BirthLChk.checked;
updateAge;
end;
procedure TviewinfoFrm.ClrAvtBtnClick(Sender: TObject);
var
itsme: Boolean;
begin
if not Assigned(contact) then
exit;
{$IFDEF RNQ_AVATARS}
itsme := contact.fProto.isMyAcc(contact);
if itsme then
begin
if TICQSession(contact.fProto).SSI_deleteAvatar then
begin
TICQSession(contact.fProto).myAvatarHash := '';
// updateAvatarFor(contact);
end;
end;
// else
if Assigned(contact) then
with TICQcontact(contact) do
begin
ICQIcon.hash_safe := '';
if Assigned(icon.Bmp) then
try
icon.Bmp.Free;
except
icon.Bmp := NIL;
end;
icon.Bmp := NIL;
if Assigned(contactAvt) then
contactAvt.Free;
contactAvt := NIL;
updateAvatarFor(contact);
end;
AvtPBox.Repaint;
ClrAvtBtn.enabled := (itsme and (TICQSession(contact.fProto).myAvatarHash > '')) or
(not itsme and (TICQcontact(contact).ICQIcon.hash_safe > '') and (TICQcontact(contact).ICQIcon.hash = ''));
ClrAvtLbl.visible := itsme and ClrAvtBtn.enabled;
{$ENDIF RNQ_AVATARS}
end;
procedure TviewinfoFrm.TickAniTimer(Sender: TObject);
var
b2: TBitmap;
paramSmile: TAniPicParams;
// w, h : Integer;
resW, resH: integer;
// ch : TchatInfo;
begin
// if not UseAnime then Exit;
// checkGifTime;
// ch := thisChat;
// if (ch = NIL)or (ch.chatType <> CT_ICQ)or not (Assigned(ch.avtPic.Pic)) then
if (contactAvt = NIL) or not contactAvt.Animated then
exit;
if not Assigned(AvtPBox) then
exit;
if not contactAvt.RnQCheckTime then
exit;
// w := ch.avtPic.PicAni.Width;
// h := ch.avtPic.PicAni.Height;
resW := AvtPBox.ClientWidth;
resH := AvtPBox.ClientHeight;
paramSmile.Bounds := DestRect( // w, h,
contactAvt.Width, contactAvt.Height,
// ch.avtPic.AvtPBox.ClientWidth, ch.avtPic.AvtPBox.ClientHeight);
resW, resH);
paramSmile.canvas := AvtPBox.canvas;
paramSmile.Color := AvtPBox.Color;
paramSmile.selected := FALSE;
begin
if Assigned(paramSmile.canvas) then
begin
// gr := TGPGraphics.Create(paramSmile.Canvas.Handle);
// if gr.IsVisible(MakeRect(paramSmile.Bounds)) then
// bmp:= TGPBitmap.Create(Width, Height, PixelFormat32bppRGB);
b2 := createBitmap(resW, resH);
b2.canvas.Brush.Color := paramSmile.Color;
b2.canvas.FillRect(b2.canvas.ClipRect);
// DrawRbmp(b2.Canvas.Handle, ch.avtPic.PicAni);
// ch.avtPic.PicAni.Draw(b2.Canvas.Handle, 0, 0);
contactAvt.Draw(b2.canvas.Handle, paramSmile.Bounds);
if Assigned(paramSmile.canvas)
// and (paramSmile.Canvas.HandleAllocated )
then
BitBlt(paramSmile.canvas.Handle, 0, 0, // paramSmile.Bounds.Left, paramSmile.Bounds.Top,
resW, resH,
// w, h,
b2.canvas.Handle, 0, 0, SRCCOPY);
b2.Free;
end;
end;
end;
procedure TviewinfoFrm.UpdateCntAvatar;
var
fn: String;
h: RawByteString;
b1, b: Boolean;
begin
begin
// frm.AvtImg.Picture.Assign(cnt.icon);
avtLoadBtn.enabled := TICQcontact(contact).ICQIcon.hash > '';
h := TICQcontact(contact).ICQIcon.hash_safe;
b := FALSE;
if h > '' then
b := LoadAvtByHash(h, contactAvt, b1, fn);
if not b then
if Assigned(contactAvt) then
FreeAndNil(contactAvt);
// try_load_avatar3(frm.contactAvt, cnt.ICQIcon.hash_safe);
// frm.contactAvt := cnt.icon.Bmp.Clone(0, 0, cnt.icon.Bmp.GetWidth,
// cnt.icon.Bmp.GetHeight, cnt.icon.Bmp.GetPixelFormat);
// frm.AvtPBox.Repaint;
AvtPBox.Invalidate;
if Assigned(contactAvt) and contactAvt.Animated then
FAniTimer.enabled := TRUE
else
FAniTimer.enabled := FALSE;
// frm.AvtImg.Height := cnt.iconBmp.GetHeight;
end;
end;
procedure TviewinfoFrm.ClearAvatar;
begin
FreeAndNil(contactAvt);
// frm.AvtPBox.Repaint;
AvtPBox.Invalidate;
end;
procedure TviewinfoFrm.UpdateClock;
begin
if contact is TICQcontact then
if TICQcontact(contact).GMTavailable then
timeBox.text := formatDatetime(timeformat.clock, now - GMToffset0 + TICQcontact(contact).getGMT);
end;
end.