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/StatusForm.pas

98 lines
3.0 KiB
Plaintext

{
This file is part of R&Q.
Under same license
}
unit StatusForm;
{$I RnQConfig.inc}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
ExtCtrls, StdCtrls, ComCtrls, StrUtils, RnQButtons, ICQSession, Sciter, SciterApi;
{$I PubRTTI.inc}
type
TStsBtn = TRnQSpeedButton;
TStatusData = record
img, caption, text: String;
code: Integer;
current: Boolean;
end;
procedure GetStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
procedure GetStatusMessages(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
procedure SaveStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
procedure SetStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
implementation
uses
Types, RDGlobal, RDUtils, RnQLangs, RQThemes, RnQGraphics32,
mainDlg, utilLib, langLib, GlobalLib, SciterLib, Protocol_ICQ, ICQConsts;
procedure GetStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
var
Status: Integer;
begin
Status := 0;
API.ValueIntData(argv, Status);
V2S(ExtStsStrings[Status].Desc, retval);
end;
procedure GetStatusMessages(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
var
I, X, Pos: Integer;
StatusList: array of TStatusData;
StatusListVar: TParams;
Status: Byte;
begin
Status := Account.AccProto.GetXStatus;
for X := Low(XStatusArray) to High(XStatusArray) do
if xsf_6 in XStatusArray[X].flags then
if ShowNewXStatuses or (not ShowNewXStatuses and (xsf_Old in XStatusArray[X].flags)) then
if not (StartsText('status_', XStatusArray[X].pid6)) then
begin
SetLength(StatusList, Length(StatusList) + 1);
SetLength(StatusListVar, Length(StatusListVar) + 1);
Pos := Length(StatusList) - 1;
StatusList[Pos].code := X;
StatusList[Pos].current := Status = X;
StatusList[Pos].img := XStatusArray[X].PicName;
StatusList[Pos].caption := GetTranslation(XStatusArray[X].Caption);
StatusList[Pos].text := ExtStsStrings[X].Desc;
end;
for I := 0 to Length(StatusList) - 1 do
StatusListVar[I] := RnQmain.CLBox.RecordToVar(StatusList[I]);
V2S(StatusListVar, retval);
end;
procedure SaveStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
var
Text: PWideChar;
StrLen: UINT;
Status: Integer;
begin
Status := 0;
API.ValueIntData(argv, Status);
Inc(argv);
Text := '';
API.ValueStringData(argv, Text, StrLen);
ExtStsStrings[Status].Desc := Copy(String(Text), 1, MaxXStatusDescLen);
SaveListsDelayed := True;
end;
procedure SetStatusMessage(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
var
StrLen: UINT;
Status: Integer;
begin
Status := 0;
API.ValueIntData(argv, Status);
Account.AccProto.SendStatusStr(Status, ExtStsStrings[Status].Desc);
end;
end.