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.
154 lines
4.3 KiB
Plaintext
154 lines
4.3 KiB
Plaintext
{
|
|
This file is part of R&Q.
|
|
Under same license
|
|
}
|
|
unit outboxDlg;
|
|
{$I RnQConfig.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, StrUtils, Classes, Graphics, Controls, Forms,
|
|
Sciter, SciterApi, SciterLib, StdCtrls, ExtCtrls, Menus, ICQCommon, ICQContacts, outboxLib;
|
|
|
|
{$I PubRTTI.inc}
|
|
|
|
type
|
|
TOutboxEvent = record
|
|
UID: TUID;
|
|
index, kind: Integer;
|
|
name, pic, text, info: String;
|
|
end;
|
|
|
|
{$I NoRTTI.inc}
|
|
|
|
procedure GetOutboxMessages(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetOutboxProcess(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SetOutboxProcess(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateOutboxText(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DeleteOutboxEvent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SendOutboxEvent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
|
|
implementation
|
|
|
|
uses
|
|
RnQLangs, RQUtil, RDGlobal, RQThemes, RnQStrings, RnQSysUtils, RnQPics,
|
|
events, globalLib, utilLib, themesLib;
|
|
|
|
procedure GetOutboxMessages(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
I: Integer;
|
|
Info: String;
|
|
Outbox: array of TOutboxEvent;
|
|
OutboxVar: TParams;
|
|
OE: TOEvent;
|
|
begin
|
|
SetLength(Outbox, Account.outbox.Count);
|
|
SetLength(OutboxVar, Account.outbox.Count);
|
|
for I := 0 to Account.outbox.Count - 1 do
|
|
begin
|
|
OE := TOEvent(Account.outbox.List[I]);
|
|
Outbox[I].index := I;
|
|
Outbox[I].kind := OE.kind;
|
|
Outbox[I].uid := OE.whom.UID;
|
|
Outbox[I].text := OE.info;
|
|
if Assigned(OE.whom) then
|
|
Outbox[I].name := OE.whom.displayed
|
|
else
|
|
Outbox[I].name := Str_unk;
|
|
|
|
case oe.kind of
|
|
OE_msg:
|
|
Outbox[I].pic := PIC_MSG;
|
|
OE_contacts:
|
|
Outbox[I].pic := PIC_CONTACTS;
|
|
OE_addedYou:
|
|
Outbox[I].pic := PIC_ADD_CONTACT;
|
|
OE_auth:
|
|
Outbox[I].pic := PIC_AUTH_REQ;
|
|
OE_authDenied:
|
|
Outbox[I].pic := PIC_MSG_BAD;
|
|
end;
|
|
|
|
case OE.kind of
|
|
OE_msg, OE_contacts, OE_addedYou, OE_auth, OE_authDenied:
|
|
Info := GetTranslation(OEvent2ShowStr[OE.kind]);
|
|
else
|
|
Info := '';
|
|
end;
|
|
|
|
Outbox[I].info := getTranslation('%0:s%1:s for %2:s\nWrote: %3:s\nLast modify: %4:s',
|
|
[IfThen(OE.flags and IF_multiple > 0, GetTranslation('(multi-send)') + ' '), Info, Outbox[I].name, DateTimeToStr(OE.wrote),
|
|
IfThen(OE.lastmodify > 0, DateTimeToStr(OE.lastmodify), DateTimeToStr(OE.wrote))]);
|
|
|
|
OutboxVar[I] := UI.RecordToVar(Outbox[I]);
|
|
end;
|
|
V2S(OutboxVar, retval);
|
|
end;
|
|
|
|
procedure GetOutboxProcess(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
V2S(outboxprocessChk, retval);
|
|
end;
|
|
|
|
procedure SetOutboxProcess(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Process: Integer;
|
|
begin
|
|
API.ValueIntData(argv, Process);
|
|
outboxprocessChk := Process = 1;
|
|
ActionManager.Execute(AK_PROCESSOUTBOX);
|
|
end;
|
|
|
|
procedure UpdateOutboxText(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Index: Integer;
|
|
Text: String;
|
|
begin
|
|
Index := -1;
|
|
API.ValueIntData(argv, Index);
|
|
if Index < 0 then
|
|
Exit;
|
|
|
|
Inc(argv);
|
|
Text := SciterVarToString(argv);
|
|
|
|
with Account.outbox.GetAt(Index) do
|
|
begin
|
|
info := Text;
|
|
lastmodify := Now;
|
|
end;
|
|
end;
|
|
|
|
procedure DeleteOutboxEvent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Index: Integer;
|
|
begin
|
|
Index := -1;
|
|
API.ValueIntData(argv, Index);
|
|
if Index >= 0 then
|
|
begin
|
|
Account.outbox.Delete(Index);
|
|
UI.CL.UpdateAdditionalImage;
|
|
if Assigned(UI.Chat) then
|
|
UI.Chat.UpdateStatusBar;
|
|
ActionManager.Execute(AK_SAVEOUTBOX, SaveDelay);
|
|
end;
|
|
end;
|
|
|
|
procedure SendOutboxEvent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Index: Integer;
|
|
begin
|
|
Index := -1;
|
|
API.ValueIntData(argv, Index);
|
|
if Index = 0 then
|
|
Exit;
|
|
|
|
processOevent(Account.outbox.GetAt(Index));
|
|
Account.outbox.Delete(Index);
|
|
UI.UpdateOutbox;
|
|
end;
|
|
|
|
end.
|