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.
3045 lines
89 KiB
Plaintext
3045 lines
89 KiB
Plaintext
{
|
|
This file is part of R&Q.
|
|
Under same license
|
|
}
|
|
unit prefSheet;
|
|
{$I RnQConfig.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, System.Variants, System.IniFiles,
|
|
Vcl.Forms, Vcl.Controls, Vcl.StdCtrls, Vcl.Graphics, Vcl.Dialogs, Vcl.Imaging.PNGImage,
|
|
RnQPrefsLib, PluginLib, RQThemes, RQUtil, ICQCommon, BaseWindow, Sciter, SciterApi;
|
|
|
|
{$I PubRTTI.inc}
|
|
|
|
type
|
|
TCaps = array [0.. 15] of String;
|
|
|
|
TPrefsObj = record
|
|
profile_index, profile_proxy, profile_proxyport,
|
|
|
|
icq_birthremind, icq_shareinfo, icq_inactinterval, icq_recentlyofflinedelay,
|
|
|
|
spam_ignoreuinvalue, spam_botattempts, spam_botquestion,
|
|
|
|
autoaway_setawaydelay, autoaway_setnadelay,
|
|
|
|
design_blinkspeed, design_clsort, design_clautosizedown, design_docking, design_clbar,
|
|
design_clfilterbar, design_actopacity, design_inactopacity, design_avmaxsizeval,
|
|
|
|
chat_relhours, chat_reldays, chat_msgbuffer, chat_entercount, chat_maximgwidthval, chat_maximgheightval,
|
|
chat_chatimgquality, chat_stickersize, chat_videores, chat_spellcheckstyle,
|
|
|
|
tips_max, tips_space, tips_opacity, tips_position, tips_hindent, tips_vindent,
|
|
|
|
start_withstatus,
|
|
|
|
events_inoutdur, events_volume, events_bdinformdur, events_bdnotifydur,
|
|
|
|
autoupdate_period,
|
|
|
|
other_mwheelspeed, other_clautohideval, other_notinlist, other_browser, other_servertoupload: Integer;
|
|
|
|
profile_proxyauth, profile_proxyntlm,
|
|
net_auto, net_whenavailable, net_lostdlg, net_showtemp,
|
|
|
|
icq_savepass, icq_clearpass, icq_savetoken, icq_ident, icq_addcap,
|
|
icq_msgencrypt, icq_webaware,
|
|
icq_reqauth, icq_showtyping, icq_sendtyping, icq_recentlyoffline, icq_enableavatars,
|
|
icq_autoavatars, icq_failedavatars, icq_autoxstatus,
|
|
|
|
spam_warn, spam_ignoreunk, spam_ignoreunkauth, spam_zero, spam_ignoremult,
|
|
spam_ignoreunk2, spam_ignorenohist, spam_ignoreuin, spam_ignorebadwords, spam_botenable,
|
|
spam_botusequest, spam_ignorelist, spam_quietlist,
|
|
|
|
autoaway_setaway, autoaway_setna, autoaway_setnascreen, autoaway_setnaboss, autoaway_restore, autoaway_setxstatus,
|
|
|
|
design_clontop, design_uindelim, design_xbutton, design_xmain, design_xnew,
|
|
design_trayclick, design_btips, design_blinkstatus, design_userthemes, design_snapwin, design_leveling, design_animwindows,
|
|
design_onlineonly, design_showtip, design_unauthasoff, design_enablegroups,
|
|
design_indentgrp, design_collapsegrp, design_animgrp, design_showborder, design_noborderwithshadow, design_clautosizeup, design_transpcl,
|
|
design_transpchat, design_avchat, design_avhints, design_avtray, design_avmaxsize, design_avtaskbarbtn, design_avusepalette,
|
|
|
|
chat_autocopy, chat_singlemsg, chat_tabstatus, chat_cursorquote, chat_quoteselected, chat_textformat,
|
|
chat_chatontop, chat_pluginsabove, chat_tabhints, chat_wrapinseparate, chat_closeonempty, chat_closetabonsingle,
|
|
chat_smoothrender, chat_msgtrim, chat_smilescaptions,
|
|
chat_inimg, chat_outimg, chat_maximgwidth, chat_maximgheight, chat_enablestickers,
|
|
chat_videothumbs, chat_spellcheck, chat_animatedscroll,
|
|
|
|
tips_transparency,
|
|
|
|
start_autoconnect, start_skipsplash, start_checkro, start_minimized, start_lock,
|
|
start_reopenchats, start_firstonly,
|
|
|
|
security_writehist, security_backup, security_askboss,
|
|
security_savehistpass,
|
|
|
|
events_notinclosed, events_playsnd, events_awayisonline, events_inoutignore, events_skipseen, events_chatfocus,
|
|
events_infoontop, events_logpacketswin, events_logpacketsfile, events_logpacketsclear, events_logeventswin,
|
|
events_logeventsfile, events_logeventsclear, events_bdinform, events_bdnotify,
|
|
|
|
autoupdate_enable, autoupdate_beta, autoupdate_onlogin,
|
|
|
|
other_confirmexit, other_autolayout, other_vacuum, other_indialog,
|
|
other_clautohide, other_trimws, other_handleicqlinks: Boolean;
|
|
|
|
profile_name, profile_proxyhost, profile_proxyuser, profile_proxypasswd, icq_password,
|
|
|
|
spam_badwords, spam_question, spam_answers,
|
|
|
|
design_wintitle,
|
|
|
|
start_withuin, start_userpath,
|
|
|
|
themeedit_maincss, themeedit_chatcss, themeedit_contents,
|
|
|
|
other_mybrowser: String;
|
|
|
|
autoaway_xstatus: Byte;
|
|
|
|
icq_addedcap: TCaps;
|
|
|
|
icq_birthdate: TDateTime;
|
|
end;
|
|
|
|
TListItem = record
|
|
s0: String;
|
|
s1: TUID;
|
|
isSrv: Boolean;
|
|
end;
|
|
|
|
TPrefs = class(TBaseWindow)
|
|
public
|
|
ColorDialog: TColorDialog;
|
|
FontDialog: TFontDialog;
|
|
|
|
histPwd: String;
|
|
ArrPages: array of TPrefPage;
|
|
ThemePropsIni: TMemIniFile;
|
|
themeprops: aTthemeproperty;
|
|
pluginList: array of TPlugin;
|
|
OnStatusDisableLocal: array of TOnStatusDisable;
|
|
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
|
|
function HasPrefPage(pidx: Byte): Boolean;
|
|
procedure SortPrefPages;
|
|
procedure RefreshLangList;
|
|
procedure ResetLangs;
|
|
procedure LoadThemeProps;
|
|
procedure SetThemeProps(const props: String; doUpdate: Boolean = False);
|
|
function GetThemeProps: String;
|
|
|
|
procedure InitConnection;
|
|
procedure InitChat;
|
|
procedure InitAutoaway;
|
|
procedure InitStart;
|
|
procedure InitHotkeys;
|
|
procedure InitEvents;
|
|
procedure InitThemeEdit;
|
|
procedure InitOther;
|
|
procedure Init;
|
|
|
|
procedure ResetConnection(ProfileOnly: Boolean = False);
|
|
procedure ResetICQ;
|
|
procedure ResetAntispam(QuestionsOnly: Boolean = False);
|
|
procedure ResetAutoaway;
|
|
procedure ResetDesign;
|
|
procedure ResetChat;
|
|
procedure ResetTips;
|
|
procedure ResetStart;
|
|
procedure ResetSecurity;
|
|
procedure ResetHotkeys;
|
|
procedure ResetEvents;
|
|
procedure ResetPlugins;
|
|
procedure ResetAutoupdate;
|
|
procedure ResetThemeEdit;
|
|
procedure ResetOther;
|
|
procedure Reset;
|
|
|
|
procedure SetViewMode(pages: array of TPrefPage);
|
|
procedure SetActivePage(i: Integer); overload;
|
|
procedure SetActivePage(const pn: String); overload;
|
|
end;
|
|
|
|
PLangItem = ^TLangItem;
|
|
TLangItem = record
|
|
lang: String;
|
|
locale: String;
|
|
end;
|
|
|
|
procedure OnPrefsCreate(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure OnPrefsClose(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdatePrefsXY(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SetViewMode(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DeleteProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddBotQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DelBotQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddIgnoredContacts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddIgnoredContactToSrv(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure RemoveIgnoredContactFromSrv(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DelIgnoredContact(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddQuietContacts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DelQuietContact(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure StoreProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure StoreQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateQuestions(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateMainProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure OpenContactChat(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ViewContactInfo(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure PrefsApply(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure PrefsReset(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ResetPlugins(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure IsOnline(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ApplyTransp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ChooseColor(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetFont(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SetFontProps(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure RefreshLangs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ManageLangs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UserDicts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SetMainSpellcheckLang(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure TestTips(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetCurrentAccountPath(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetXStatusMsg(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetMainStyles(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetChatStyles(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure EncryptHistory(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure DecryptHistory(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure GetKeyName(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure HotkeySelect(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure HotkeyDefault(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure HotkeySave(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure HotkeyDelete(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateEventTriggers(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure StoreEventTrigger(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateDisabledEvents(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure StoreDisabledEvents(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure PlaySound(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure SoundTest(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure TimeTest(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure IsAudioPresent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure BASSWarning(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure ReloadPlugins(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure OpenPluginPrefs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure UpdateThemeEditProp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure AddThemeProp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
procedure CheckPath(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.Generics.Collections, System.Rtti, System.NetEncoding, System.AnsiStrings, System.StrUtils,
|
|
Vcl.ComCtrls, Vcl.Menus, Winapi.ActiveX, Winapi.ShellAPI,
|
|
RDGlobal, RDUtils, RDFileUtil, RnQGlobal, RnQSysUtils, RnQLangs, RnQPics, RnQNet, RnQCrypt, RnQTips, RnQDialogs, RnQMacros,
|
|
events, globalLib, utilLib, themesLib, iniLib, roasterLib, langLib, SciterLib, Protocols_all, ICQSession, ICQConsts, ICQContacts,
|
|
mainDlg, selectcontactsDlg, tipDlg, HistAllSearch, Dynamic_Bass,
|
|
MsSpellCheckLib_TLB, RnQGraphics32, SQLiteDB;
|
|
|
|
var
|
|
PrefsObj: TPrefsObj;
|
|
v_proxyes: TArrProxy;
|
|
qst: TQuestAnsArr;
|
|
tempBeh: Tbehaviours;
|
|
|
|
const
|
|
sb2index: array [TSortBy] of Integer = (0, 1, 2);
|
|
PrefIsShowBDFirst = 'is-show-bd-first';
|
|
PrefShowBDFirst = 'show-bd-first';
|
|
PrefIsShowBDBefore = 'is-show-bd-before';
|
|
PrefShowBDBefore = 'show-bd-before';
|
|
|
|
function ObjToPrefs(param: Pointer; const pkey: PSciterValue; const pval: PSciterValue): BOOL; stdcall;
|
|
|
|
function FileTimeToDateTime(FileTime: TFileTime): TDateTime;
|
|
var
|
|
ModifiedTime: TFileTime;
|
|
SystemTime: TSystemTime;
|
|
begin
|
|
Result := Now;
|
|
if (FileTime.dwLowDateTime = 0) and (FileTime.dwHighDateTime = 0) then
|
|
Exit;
|
|
try
|
|
FileTimeToLocalFileTime(FileTime, ModifiedTime);
|
|
FileTimeToSystemTime(ModifiedTime, SystemTime);
|
|
Result := SystemTimeToDateTime(SystemTime);
|
|
except end;
|
|
end;
|
|
|
|
var
|
|
keyStr: PWideChar;
|
|
tmpInt: Integer;
|
|
tmpInt64: Int64;
|
|
tmpFloat: Double;
|
|
tmpLen: Cardinal;
|
|
tmpBool: Bool;
|
|
tmpString: PWideChar;
|
|
// tmpDate: TDateTime;
|
|
tmpCaps: TValue;
|
|
tmpVal: TSciterValue;
|
|
field: TRttiField;
|
|
sz, i: UINT;
|
|
vtype: TSciterValueType;
|
|
begin
|
|
keyStr := '';
|
|
API.ValueStringData(pkey, keyStr, tmpLen);
|
|
|
|
field := TRTTIContext.Create.GetType(TypeInfo(TPrefsObj)).GetField(keyStr);
|
|
if not Assigned(field) then
|
|
begin
|
|
ODS('Field not found: ' + keyStr);
|
|
Result := True;
|
|
Exit;
|
|
end;
|
|
|
|
API.ValueType(pval, vtype, tmpLen);
|
|
if not (vtype = T_UNDEFINED) and not (vtype = T_NULL) then
|
|
if field.FieldType.TypeKind = tkInteger then
|
|
begin
|
|
if vtype = T_INT then
|
|
begin
|
|
tmpInt := 0;
|
|
API.ValueIntData(pval, tmpInt);
|
|
field.SetValue(@PrefsObj, tmpInt);
|
|
end else if vtype = T_STRING then
|
|
begin
|
|
tmpString := '';
|
|
API.ValueStringData(pval, tmpString, tmpLen);
|
|
field.SetValue(@PrefsObj, StrToInt(tmpString));
|
|
end else ODS('[INT] Format mismatch: ' + keyStr);
|
|
end else if field.FieldType.TypeKind = tkEnumeration then
|
|
begin
|
|
tmpInt := 0;
|
|
API.ValueIntData(pval, tmpInt);
|
|
tmpBool := tmpInt = 1;
|
|
field.SetValue(@PrefsObj, tmpBool);
|
|
if not (vtype = T_BOOL) then ODS('[BOOL] Format mismatch: ' + keyStr);
|
|
end else if field.FieldType.TypeKind = tkUString then
|
|
begin
|
|
if vtype = T_INT then
|
|
begin
|
|
tmpInt := 0;
|
|
API.ValueIntData(pval, tmpInt);
|
|
field.SetValue(@PrefsObj, IntToStr(tmpInt));
|
|
end else if vtype = T_STRING then
|
|
begin
|
|
tmpString := '';
|
|
API.ValueStringData(pval, tmpString, tmpLen);
|
|
field.SetValue(@PrefsObj, tmpString);
|
|
end else ODS('[STR] Format mismatch: ' + keyStr);
|
|
end else if field.FieldType.TypeKind = tkFloat then
|
|
begin
|
|
if vtype = T_FLOAT then
|
|
begin
|
|
tmpFloat := 0;
|
|
API.ValueFloatData(pval, tmpFloat);
|
|
field.SetValue(@PrefsObj, tmpFloat);
|
|
end else if vtype = T_DATE then
|
|
begin
|
|
tmpInt64 := 0;
|
|
API.ValueInt64Data(pval, tmpInt64);
|
|
field.SetValue(@PrefsObj, FileTimeToDateTime(TFileTime(tmpInt64)));
|
|
end else ODS('[FLOAT] Format mismatch: ' + keyStr + ' | ' + inttostr(integer(vtype)));
|
|
end else if field.FieldType.TypeKind = tkArray then
|
|
begin // caps array only for now
|
|
sz := 0;
|
|
if pval.t = UINT(T_OBJECT) then
|
|
API.ValueIsolate(pval);
|
|
API.ValueElementsCount(pval, sz);
|
|
if sz > 16 then
|
|
sz := 16;
|
|
TValue.Make(nil, TypeInfo(TCaps), tmpCaps);
|
|
for i := 0 to sz - 1 do
|
|
begin
|
|
API.ValueInit(@tmpVal);
|
|
API.ValueNthElementValue(pval, i, tmpVal);
|
|
API.ValueStringData(@tmpVal, tmpString, tmpLen);
|
|
API.ValueClear(@tmpVal);
|
|
tmpCaps.SetArrayElement(i, TValue.From |
|
end;
|
|
field.SetValue(@PrefsObj, tmpCaps);
|
|
end else
|
|
ODS('Pref of unknown type: ' + keyStr);
|
|
|
|
Result := True;
|
|
end;
|
|
|
|
procedure AddProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
|
|
i: Integer;
|
|
begin
|
|
i := Length(v_proxyes);
|
|
SetLength(v_proxyes, i + 1);
|
|
with v_proxyes[i] do
|
|
begin
|
|
name := getTranslation('Profile') + ' ' + IntToStr(i + 1);
|
|
addr.host := '';
|
|
addr.port := 1080;
|
|
proto := PP_NONE;
|
|
auth := False;
|
|
NTLM := False;
|
|
end;
|
|
|
|
CopyProxy(MainProxy, v_proxyes[i]);
|
|
UI.Prefs.ResetConnection(True);
|
|
end;
|
|
|
|
procedure DeleteProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
profile, i: Integer;
|
|
pr: array of TProxy;
|
|
begin
|
|
profile := 0;
|
|
API.ValueIntData(argv, profile);
|
|
|
|
if Length(v_proxyes) > 1 then
|
|
if Length(v_proxyes) = profile + 1 then
|
|
begin
|
|
ClearProxy(v_proxyes[Length(v_proxyes) - 1]);
|
|
SetLength(v_proxyes, Length(v_proxyes) - 1);
|
|
UI.Prefs.ResetConnection(True);
|
|
end
|
|
else
|
|
begin
|
|
SetLength(pr, Length(v_proxyes) - profile - 1);
|
|
for i := profile + 1 to Length(v_proxyes) - 1 do
|
|
pr[i - profile - 1] := v_proxyes[i];
|
|
SetLength(v_proxyes, Length(v_proxyes) - 1);
|
|
for i := profile to Length(v_proxyes) - 1 do
|
|
v_proxyes[i] := pr[i - profile];
|
|
UI.Prefs.ResetConnection(True);
|
|
end;
|
|
end;
|
|
|
|
procedure AddBotQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
i: Integer;
|
|
begin
|
|
i := Length(qst);
|
|
SetLength(qst, i + 1);
|
|
with qst[i] do
|
|
begin
|
|
q := '';
|
|
SetLength(a, 0);
|
|
end;
|
|
|
|
UI.Prefs.ResetAntispam(True);
|
|
end;
|
|
|
|
procedure DelBotQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
i, j: Integer;
|
|
begin
|
|
i := -1;
|
|
API.ValueIntData(argv, i);
|
|
|
|
if (Length(qst) = 0) or (i = -1) then
|
|
Exit;
|
|
|
|
for j := i + 1 to Length(qst) - 1 do
|
|
qst[j - 1] := qst[j];
|
|
SetLength(qst, Length(qst) - 1);
|
|
|
|
UI.Prefs.ResetAntispam(True);
|
|
end;
|
|
|
|
procedure AddIgnoredContacts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Tmp: Variant;
|
|
UINs: TParams;
|
|
I: Integer;
|
|
Contact: TICQContact;
|
|
Item: TListItem;
|
|
begin
|
|
S2V(argv, Tmp);
|
|
UINs := Tmp;
|
|
for I := Low(UINs) to High(UINs) do
|
|
begin
|
|
Contact := Account.AccProto.GetContact(TUID(UINs[I]));
|
|
if Contact = nil then
|
|
// MsgDlg('You must select contact', mtInformation)
|
|
else if AddToIgnorelist(Contact, True) then
|
|
with UI.Prefs do
|
|
begin
|
|
Item.s0 := Contact.Displayed;
|
|
if not (Item.s0 = Contact.UID) then
|
|
Item.s0 := Item.s0 + ' (' + Contact.UIN2Show + ')';
|
|
Item.s1 := Contact.UID;
|
|
Item.isSrv := Account.AccProto.IsInList(LT_SPAM, Contact);
|
|
Call('addIgnoreListItem', [UI.RecordToVar(Item)]);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure AddIgnoredContactToSrv(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
cnt: TICQContact;
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
|
|
if (s = '') or not OnlFeature(Account.AccProto) then
|
|
Exit;
|
|
|
|
cnt := Account.AccProto.GetContact(s);
|
|
if Assigned(cnt) and Account.AccProto.IsOnline then
|
|
begin
|
|
Account.AccProto.AddToList(LT_SPAM, cnt);
|
|
// UI.Prefs.Call('setIgnoreListItemToSrv', [String(s)]);
|
|
end;
|
|
end;
|
|
|
|
procedure RemoveIgnoredContactFromSrv(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
cnt: TICQContact;
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
|
|
if (s = '') or not OnlFeature(Account.AccProto) then
|
|
Exit;
|
|
|
|
cnt := Account.AccProto.GetContact(s);
|
|
if Assigned(cnt) and Account.AccProto.IsOnline then
|
|
begin
|
|
Account.AccProto.RemFromList(LT_SPAM, cnt);
|
|
// UI.Prefs.Call('setIgnoreListItemToSrv', [String(s)]);
|
|
end;
|
|
end;
|
|
|
|
procedure DelIgnoredContact(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
cnt: TICQContact;
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
|
|
cnt := IgnoreList.get(s);
|
|
RemoveFromIgnorelist(cnt);
|
|
end;
|
|
|
|
procedure AddQuietContacts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Tmp: Variant;
|
|
I: Integer;
|
|
UINs: TParams;
|
|
Contact: TICQContact;
|
|
Item: TListItem;
|
|
begin
|
|
S2V(argv, Tmp);
|
|
UINs := Tmp;
|
|
for I := Low(UINs) to High(UINs) do
|
|
begin
|
|
Contact := Account.AccProto.GetContact(TUID(UINs[I]));
|
|
if Contact = nil then
|
|
// MsgDlg('You must select contact', mtInformation)
|
|
else if AddToQuietlist(Contact) then
|
|
with UI.Prefs do
|
|
begin
|
|
Item.s0 := Contact.Displayed;
|
|
if not (Item.s0 = Contact.UID) then
|
|
Item.s0 := item.s0 + ' (' + Contact.UIN2Show + ')';
|
|
Item.s1 := Contact.UID;
|
|
Item.isSrv := False;
|
|
Call('addQuietListItem', [UI.RecordToVar(Item)]);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure DelQuietContact(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
cnt: TICQContact;
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
|
|
cnt := quietList.get(s);
|
|
removeFromQuietlist(cnt);
|
|
end;
|
|
|
|
procedure StoreProfileData(profile: Integer);
|
|
begin
|
|
with v_proxyes[profile], PrefsObj do
|
|
begin
|
|
name := profile_name;
|
|
proto := Tproxyproto(profile_proxy);
|
|
addr.host := profile_proxyhost;
|
|
addr.port := BoundInt(profile_proxyport, 0, 65535);
|
|
user := profile_proxyuser;
|
|
pwd := profile_proxypasswd;
|
|
auth := profile_proxyauth;
|
|
NTLM := profile_proxyntlm;
|
|
end;
|
|
end;
|
|
|
|
procedure StoreQuestionData(lastqst: Integer);
|
|
var
|
|
answ: TStringList;
|
|
i: Integer;
|
|
begin
|
|
if (lastqst >= Low(qst)) and (lastqst <= High(qst)) then
|
|
with qst[lastqst], PrefsObj do
|
|
begin
|
|
q := spam_question;
|
|
SetLength(a, 0);
|
|
answ := TStringList.Create;
|
|
answ.Text := spam_answers;
|
|
for i := 0 to answ.Count - 1 do
|
|
if not (Trim(answ.Strings[i]) = '') then
|
|
begin
|
|
SetLength(a, Length(a) + 1);
|
|
a[Length(a) - 1] := Trim(answ.Strings[i]);
|
|
end;
|
|
answ.Free;
|
|
end;
|
|
end;
|
|
|
|
procedure StoreProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
profile: Integer;
|
|
begin
|
|
if argc = 2 then
|
|
begin
|
|
PrefsObj := Default(TPrefsObj);
|
|
API.ValueEnumElements(argv, @ObjToPrefs, nil);
|
|
Inc(argv);
|
|
profile := 0;
|
|
API.ValueIntData(argv, profile);
|
|
StoreProfileData(profile);
|
|
end;
|
|
end;
|
|
|
|
procedure StoreQuestion(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
lastqst: Integer;
|
|
begin
|
|
if argc = 2 then
|
|
begin
|
|
PrefsObj := Default(TPrefsObj);
|
|
API.ValueEnumElements(argv, @ObjToPrefs, nil);
|
|
lastqst := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, lastqst);
|
|
StoreQuestionData(lastqst);
|
|
end;
|
|
end;
|
|
|
|
procedure UpdateQuestions(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
UI.Prefs.ResetAntispam(True);
|
|
end;
|
|
|
|
procedure UpdateMainProfile(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
last: Integer;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
last := 0;
|
|
API.ValueIntData(argv, last);
|
|
CopyProxy(MainProxy, v_proxyes[last]);
|
|
UI.Prefs.ResetConnection(True);
|
|
end;
|
|
|
|
procedure OpenContactChat(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
if Assigned(UI.Chat) then
|
|
UI.Chat.OpenOn(Account.AccProto.GetContact(s));
|
|
end;
|
|
|
|
procedure ViewContactInfo(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
cnt: TICQContact;
|
|
s: PWideChar;
|
|
len: Cardinal;
|
|
begin
|
|
s := '';
|
|
API.ValueStringData(argv, s, len);
|
|
|
|
cnt := Account.AccProto.GetContact(s);
|
|
if Assigned(cnt) then
|
|
cnt.ViewInfo;
|
|
end;
|
|
|
|
procedure PrefsApply(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
|
|
|
|
function HexArr2Str(const caps: TCaps): RawByteString;
|
|
|
|
var
|
|
i: Integer;
|
|
begin
|
|
Result := '';
|
|
|
|
for i := 0 to 15 do
|
|
if (caps[i] = '') or (caps[i] = '00') or (caps[i] = '0') or (caps[i] = #00) then
|
|
Result := Result + #32
|
|
else
|
|
Result := Result + Char(StrToInt('$' + caps[i]));
|
|
Result := String(Result).TrimRight([#32]);
|
|
|
|
if Length(Result) < 16 then
|
|
for i := Length(Result) to 15 do
|
|
Result := Result + #00;
|
|
end;
|
|
|
|
function index2sb(i: Integer): TSortBy;
|
|
begin
|
|
Result := Low(TSortBy);
|
|
while Result <= High(TsortBy) do
|
|
if i = sb2index[Result] then
|
|
Exit
|
|
else
|
|
Inc(Result);
|
|
Result := SB_EVENT;
|
|
end;
|
|
|
|
|
|
var
|
|
|
|
i, j, k, profile, question, errClr: Integer;
|
|
|
|
icq: TICQSession;
|
|
|
|
cnt: TICQContact;
|
|
|
|
page: TPrefPage;
|
|
|
|
mustUpdPerms, mustUpdSts,
|
|
|
|
mustApplyTransp, mustUpdCapt, mustLoadStickers, mustResetHistory,
|
|
|
|
MustRebuildCL, MustInitCL: Boolean;
|
|
|
|
str: PWideChar;
|
|
|
|
sz, strLen: UINT;
|
|
|
|
tmpVal, tmpVal2: TSciterValue;
|
|
|
|
st: Byte;
|
|
|
|
disPlugins: TStringList;
|
|
|
|
begin
|
|
|
|
PrefsObj := Default(TPrefsObj);
|
|
API.ValueEnumElements(argv, @ObjToPrefs, nil);
|
|
|
|
// mustRepaintCL := False;
|
|
MustRebuildCL := False;
|
|
mustResetHistory := False;
|
|
|
|
Inc(argv);
|
|
if UI.Prefs.HasPrefPage(5) then
|
|
begin
|
|
API.ValueElementsCount(argv, sz);
|
|
for i := 0 to sz - 1 do
|
|
begin
|
|
API.ValueNthElementValue(argv, i, tmpVal);
|
|
API.ValueNthElementValue(@tmpVal, 0, tmpVal2);
|
|
API.ValueIntData(@tmpVal2, j);
|
|
if not (SHOW_ICONS_ORDER[i] = TRnQCLIconsSet(j)) then
|
|
begin
|
|
MustRebuildCL := True;
|
|
SHOW_ICONS_ORDER[i] := TRnQCLIconsSet(j);
|
|
end;
|
|
|
|
API.ValueNthElementValue(@tmpVal, 1, tmpVal2);
|
|
API.ValueIntData(@tmpVal2, j);
|
|
if not (SHOW_ICONS_ORDER[i] = CNT_TEXT) and not (TO_SHOW_ICON[SHOW_ICONS_ORDER[i]] = (j = 1)) then
|
|
begin
|
|
MustRebuildCL := True;
|
|
TO_SHOW_ICON[SHOW_ICONS_ORDER[i]] := (j = 1);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
Inc(argv);
|
|
if UI.Prefs.HasPrefPage(6) then
|
|
begin
|
|
spellLanguages.Clear;
|
|
API.ValueElementsCount(argv, sz);
|
|
for i := 0 to sz - 1 do
|
|
begin
|
|
API.ValueNthElementValue(argv, i, tmpVal);
|
|
API.ValueStringData(@tmpVal, str, strLen);
|
|
spellLanguages.Add(str);
|
|
end;
|
|
end;
|
|
|
|
Inc(argv);
|
|
errClr := 0;
|
|
if UI.Prefs.HasPrefPage(6) then
|
|
API.ValueIntData(argv, errClr);
|
|
|
|
i := 0;
|
|
Inc(argv);
|
|
if UI.Prefs.HasPrefPage(30) then
|
|
begin
|
|
disPlugins := TStringList.Create;
|
|
with disPlugins do
|
|
begin
|
|
Sorted := True;
|
|
Duplicates := dupIgnore;
|
|
StrictDelimiter := True;
|
|
Delimiter := ';';
|
|
DelimitedText := disabledPlugins.Trim([';']);
|
|
end;
|
|
|
|
API.ValueElementsCount(argv, sz);
|
|
plugins.resetEnumeration;
|
|
while plugins.hasMore do
|
|
with plugins.getNext do
|
|
begin
|
|
API.ValueNthElementValue(argv, i, tmpVal);
|
|
j := 0;
|
|
API.ValueIntData(@tmpVal, j);
|
|
if j = 1 then
|
|
begin
|
|
activate;
|
|
for k := disPlugins.Count - 1 downto 0 do
|
|
if disPlugins.Strings[k] = filename then
|
|
disPlugins.Delete(k);
|
|
end
|
|
else
|
|
begin
|
|
disactivate;
|
|
disPlugins.Add(filename);
|
|
end;
|
|
Inc(i);
|
|
end;
|
|
|
|
disabledPlugins := disPlugins.DelimitedText;
|
|
disPlugins.Free;
|
|
end;
|
|
|
|
with PrefsObj do
|
|
for page in UI.Prefs.ArrPages do
|
|
if page.idx = 1 then
|
|
begin
|
|
// Connection
|
|
|
|
profile := profile_index;
|
|
if (profile >= Low(v_proxyes)) and (profile <= High(v_proxyes)) then
|
|
begin
|
|
StoreProfileData(profile);
|
|
CopyProxy(MainProxy, v_proxyes[profile]);
|
|
end;
|
|
|
|
CopyProxyArr(AllProxies, v_proxyes);
|
|
|
|
AutoReconnect := net_auto;
|
|
ConnectOnConnection := net_whenavailable;
|
|
ShowDisconnectedDlg := net_lostdlg;
|
|
ShowTempConnectErrors := net_showtemp;
|
|
end else if page.idx = 2 then
|
|
begin
|
|
// ICQ protocol
|
|
|
|
// if not Assigned(Account.AccProto) or not (Account.AccProto.ProtoName = 'ICQ') then
|
|
// Exit;
|
|
|
|
dontSavePwd := not icq_savepass;
|
|
clearPwdOnDSNCT := icq_clearpass and not icq_savepass;
|
|
|
|
mustUpdSts := False;
|
|
mustUpdPerms := False;
|
|
|
|
icq := Account.AccProto;
|
|
|
|
icq.SaveToken := icq_savetoken;
|
|
icq.setPwd(icq_password);
|
|
|
|
if not (sendBalloonOn = icq_birthremind) then
|
|
begin
|
|
sendBalloonOn := icq_birthremind;
|
|
icq.applyBalloon;
|
|
mustUpdSts := True;
|
|
end;
|
|
sendBalloonOnDate := icq_birthdate;
|
|
|
|
if not (icq.showclientid = icq_ident) then
|
|
begin
|
|
icq.showclientid := icq_ident;
|
|
mustUpdSts := True;
|
|
end;
|
|
|
|
if not (icq_addcap = AddExtCliCaps) then
|
|
begin
|
|
AddExtCliCaps := icq_addcap;
|
|
mustUpdSts := True;
|
|
end;
|
|
|
|
if not (ExtClientCaps = HexArr2Str(icq_addedcap)) then
|
|
begin
|
|
ExtClientCaps := HexArr2Str(icq_addedcap);
|
|
if AddExtCliCaps then
|
|
mustUpdSts := True;
|
|
end;
|
|
{
|
|
if not (showInvisSts = icq_showinvis) then
|
|
begin
|
|
if not showInvisSts and (icq.visibility in [VI_invisible, VI_privacy]) then
|
|
begin
|
|
icq.sendStatusCode(False);
|
|
mustUpdSts := False;
|
|
end;
|
|
showInvisSts := icq_showinvis;
|
|
end;
|
|
}
|
|
if not (icq.UseCryptMsg = icq_msgencrypt) then
|
|
begin
|
|
icq.UseCryptMsg := icq_msgencrypt;
|
|
mustUpdSts := True;
|
|
end;
|
|
{
|
|
if not (icq.webaware = icq_webaware) then
|
|
begin
|
|
icq.webaware := icq_webaware;
|
|
mustUpdPerms := True;
|
|
mustUpdSts := True;
|
|
end;
|
|
|
|
if not (icq.showInfo = icq_shareinfo) then
|
|
begin
|
|
icq.showInfo := icq_shareinfo;
|
|
mustUpdPerms := True;
|
|
// mustUpdSts := True;
|
|
end;
|
|
|
|
if not (icq.authNeeded = icq_reqauth) then
|
|
begin
|
|
icq.authNeeded := icq_reqauth;
|
|
mustUpdPerms := True;
|
|
mustUpdSts := True;
|
|
end;
|
|
}
|
|
if not (icq.SupportTypingNotif = icq_showtyping) then
|
|
begin
|
|
icq.SupportTypingNotif := icq_showtyping;
|
|
mustUpdSts := True;
|
|
end;
|
|
|
|
icq.IsSendTypingNotif := icq_sendtyping;
|
|
TypingInterval := BoundInt(icq_inactinterval, 3, 3600);
|
|
|
|
if not (RecentlyOfflineDelay = BoundInt(icq_recentlyofflinedelay, 1, 1440)) then
|
|
begin
|
|
RecentlyOfflineDelay := BoundInt(icq_recentlyofflinedelay, 1, 1440);
|
|
MustRebuildCL := True;
|
|
end;
|
|
if not (EnableRecentlyOffline = icq_recentlyoffline) then
|
|
begin
|
|
EnableRecentlyOffline := icq_recentlyoffline;
|
|
MustRebuildCL := True;
|
|
end;
|
|
|
|
icq.AvatarsSupport := icq_enableavatars;
|
|
icq.AvatarsAutoGet := icq_autoavatars;
|
|
AvatarsNotDnlddInform := icq_failedavatars;
|
|
AutoRequestXsts := icq_autoxstatus;
|
|
|
|
if icq.IsOnline then
|
|
begin
|
|
if mustUpdSts then
|
|
icq.SendPresenceState;
|
|
|
|
if mustUpdPerms then
|
|
begin
|
|
// icq.sendPrivacy(icq_shareinfo, icq_webaware, icq_reqauth);
|
|
// icq.sendAdvQueryInfo(Account.AccProto.MyAccNum, '');
|
|
// icq.sendFullQueryInfo(Account.AccProto.MyAccNum);
|
|
end;
|
|
end;
|
|
end else if page.idx = 3 then
|
|
begin
|
|
// Antispam
|
|
|
|
EnableIgnoreList := spam_ignorelist;
|
|
enableQuietlist := spam_quietlist;
|
|
SpamFilter.Warn := spam_warn;
|
|
SpamFilter.AddToHist := spam_zero;
|
|
|
|
cnt := icq.GetContact(spamsFilename);
|
|
if Assigned(cnt) then
|
|
if SpamFilter.AddToHist and not cnt.IsInRoster then
|
|
AddToRoster(cnt, True)
|
|
else if not SpamFilter.AddToHist and cnt.IsInRoster then
|
|
RemoveFromRoster(cnt);
|
|
|
|
SpamFilter.IgnoreNIL := spam_ignoreunk;
|
|
SpamFilter.IgnoreAuthNIL := spam_ignoreunkauth;
|
|
SpamFilter.MultiSend := spam_ignoremult;
|
|
SpamFilter.NotNIL := spam_ignoreunk2;
|
|
SpamFilter.NotEmpty := spam_ignorenohist;
|
|
SpamFilter.NoBadWords := spam_ignorebadwords;
|
|
SpamFilter.BadWords := ReplaceStr(Trim(spam_badwords), #10, ';');
|
|
SpamFilter.BotTriesCount := BoundInt(spam_botattempts, 2, 5);
|
|
if spam_ignoreuin then
|
|
SpamFilter.UINgt := BoundInt(spam_ignoreuinvalue, 0, 2000000000)
|
|
else
|
|
SpamFilter.UINgt := 0;
|
|
SpamFilter.UseBot := spam_botenable;
|
|
SpamFilter.UseBotFromFile := spam_botusequest;
|
|
|
|
question := spam_botquestion;
|
|
StoreQuestionData(question);
|
|
SpamFilter.Quests := Copy(qst);
|
|
|
|
SaveListsDelayed := True;
|
|
end else if page.idx = 4 then
|
|
begin
|
|
// Autoaway
|
|
|
|
autoaway.away := autoaway_setaway;
|
|
autoaway.awayTime := BoundInt(autoaway_setawaydelay, 1, 120) * 10 * 60;
|
|
autoaway.na := autoaway_setna;
|
|
autoaway.naTime := BoundInt(autoaway_setnadelay, 1, 120) * 10 * 60;
|
|
autoaway.ss := autoaway_setnascreen;
|
|
autoaway.boss := autoaway_setnaboss;
|
|
autoaway.autoexit := autoaway_restore;
|
|
autoaway.setxstatus := autoaway_setxstatus;
|
|
autoaway.xstatus := autoaway_xstatus;
|
|
end else if page.idx = 5 then
|
|
begin
|
|
// Design
|
|
|
|
mustApplyTransp := False;
|
|
|
|
BarPos := design_clbar;
|
|
FilterPos := design_clfilterbar;
|
|
rosterbarOnTop := design_clbar = 0;
|
|
filterBarOnTop := design_clfilterbar = 0;
|
|
animatedRoster := design_animgrp;
|
|
AnimateWindows := design_animwindows;
|
|
showXStatusMnu := design_xbutton;
|
|
|
|
if sortBy <> index2sb(design_clsort) then
|
|
begin
|
|
MustRebuildCL := True;
|
|
sortBy := index2sb(design_clsort);
|
|
end;
|
|
|
|
// mustRepaintCL := mustRepaintCL or not (ShowUINDelimiter = design_uindelim) or
|
|
// not (UseContactThemes = design_userthemes) or not (indentRoster = design_indentgrp);
|
|
|
|
MustRebuildCL := MustRebuildCL or not (showOnlyOnline = design_onlineonly) or not (showGroups = design_enablegroups) or not (showUnkAsOffline = design_unauthasoff);
|
|
|
|
mustUpdCapt := not (ShowUINDelimiter = design_uindelim);
|
|
|
|
ShowUINDelimiter := design_uindelim;
|
|
SetContactsThemeUse(design_userthemes);
|
|
showOnlyOnline := design_onlineonly;
|
|
showUnkAsOffline := design_unauthasoff;
|
|
XStatusInTray := design_xmain;
|
|
showNewXStatuses := design_xnew;
|
|
showGroups := design_enablegroups;
|
|
indentRoster := design_indentgrp;
|
|
collapseGroups := design_collapsegrp;
|
|
|
|
mustUpdCapt := mustUpdCapt or not (rosterTitle = design_wintitle);
|
|
rosterTitle := design_wintitle;
|
|
blinkSpeed := BoundInt(design_blinkspeed, 1, 15);
|
|
|
|
ShowHintsInCL := design_showtip;
|
|
case design_clautosizedown of
|
|
0:
|
|
autosizeRoster := False;
|
|
1:
|
|
begin
|
|
autosizeRoster := True;
|
|
autosizeFullRoster := False;
|
|
end;
|
|
2:
|
|
begin
|
|
autosizeRoster := True;
|
|
autosizeFullRoster := True;
|
|
end;
|
|
end;
|
|
autosizeUp := design_clautosizeup;
|
|
// snapToScreenEdges := design_snapwin;
|
|
// applySnap;
|
|
|
|
if not (showMainBorder = design_showborder) then
|
|
begin
|
|
ShowMainBorder := design_showborder;
|
|
ToggleMainFormBorder(True, ShowMainBorder);
|
|
end;
|
|
NoBorderWithShadow := design_noborderwithshadow;
|
|
alwaysOnTop := design_clontop;
|
|
useSingleClickTray := design_trayclick;
|
|
|
|
mustApplyTransp := mustApplyTransp or not (transparency.forRoster = design_transpcl) or
|
|
not (transparency.forChat = design_transpchat) or not (transparency.active = design_actopacity) or
|
|
not (transparency.inactive = design_inactopacity);
|
|
|
|
transparency.forRoster := design_transpcl;
|
|
transparency.forChat := design_transpchat;
|
|
transparency.active := BoundInt(design_actopacity, 0, 255);
|
|
transparency.inactive := BoundInt(design_inactopacity, 0, 255);
|
|
|
|
blinkWithStatus := design_blinkstatus;
|
|
showBalloons := design_btips;
|
|
|
|
avatarShowInChat := design_avchat;
|
|
avatarShowInHint := design_avhints;
|
|
avatarShowInTray := design_avtray;
|
|
avatarShowInTaskBar := design_avtaskbarbtn;
|
|
avatarUsePalette := design_avusepalette;
|
|
TipsMaxAvtSizeUse := design_avmaxsize;
|
|
TipsMaxAvtSize := BoundInt(design_avmaxsizeval, 0, 300);
|
|
|
|
docking.enabled := design_docking > 0;
|
|
docking.appBar := design_docking = 2;
|
|
dockSet;
|
|
|
|
if mustApplyTransp then
|
|
ApplyTransparency;
|
|
|
|
if mustUpdCapt then
|
|
UI.CL.UpdateCaption;
|
|
|
|
MustInitCL := True;
|
|
end else if page.idx = 6 then
|
|
begin
|
|
// Chat
|
|
|
|
fontstylecodes.enabled := chat_textformat;
|
|
autoCopyHist := chat_autocopy;
|
|
singleDefault := chat_singlemsg;
|
|
showStatusOnTabs := chat_tabstatus;
|
|
quoting.cursorBelow := chat_cursorquote;
|
|
sendonenter := BoundInt(chat_entercount, 0, 3);
|
|
quoting.quoteselected := chat_quoteselected;
|
|
chatAlwaysOnTop := chat_chatontop;
|
|
usePlugPanel := chat_pluginsabove;
|
|
showHintsInChat := chat_tabhints;
|
|
bViewTextWrap := chat_wrapinseparate;
|
|
closeChatOnSend := chat_closeonempty;
|
|
ClosePageOnSingle := chat_closetabonsingle;
|
|
ShowSmileCaption := chat_smilescaptions;
|
|
EnableImgLinksIn := chat_inimg;
|
|
EnableImgLinksOut := chat_outimg;
|
|
LimitMaxChatImgWidth := chat_maximgwidth;
|
|
LimitMaxChatImgHeight := chat_maximgheight;
|
|
MaxChatImgWidthVal := BoundInt(chat_maximgwidthval, 128, 9999);
|
|
MaxChatImgHeightVal := BoundInt(chat_maximgheightval, 128, 9999);
|
|
mustLoadStickers := chat_enablestickers and not (EnableStickers = chat_enablestickers);
|
|
EnableStickers := chat_enablestickers;
|
|
StickerResolution := chat_stickersize;
|
|
ChatImageQuality := chat_chatimgquality;
|
|
PreferredResolution := chat_videores;
|
|
EnableVideoLinks := chat_videothumbs;
|
|
ChatSmoothFontRendering := chat_smoothrender;
|
|
AnimatedScroll := chat_animatedscroll;
|
|
TrimMsgNewLines := chat_msgtrim;
|
|
EnableSpellCheck := chat_spellcheck;
|
|
RelativeTimeInChatDays := BoundInt(chat_reldays, 2, 31);
|
|
RelativeTimeInChatHours := BoundInt(chat_relhours, 0, 24);
|
|
|
|
spellErrorColor := errClr;
|
|
spellErrorStyle := chat_spellcheckstyle;
|
|
|
|
i := BoundInt(chat_msgbuffer, 10, 50);
|
|
if not (ChatLoadBuffer = i) then
|
|
begin
|
|
ChatLoadBuffer := i;
|
|
mustResetHistory := True;
|
|
end;
|
|
|
|
if Assigned(UI.Chat) then
|
|
with UI.Chat do
|
|
begin
|
|
InitSpellCheck;
|
|
SpellCheck;
|
|
if mustLoadStickers then
|
|
LoadStickers;
|
|
if Visible then
|
|
begin
|
|
SetupChatButtons;
|
|
SetupStickersButton;
|
|
end;
|
|
RedrawTabs;
|
|
if RelativeTimeInChat then
|
|
UpdateRelTimes;
|
|
end;
|
|
end else if page.idx = 7 then
|
|
begin
|
|
// Tips
|
|
|
|
transparency.forTray := tips_transparency;
|
|
transparency.tray := BoundInt(tips_opacity, 0, 255);
|
|
tipstransparency.enabled := tips_transparency;
|
|
tipstransparency.alpha := BoundInt(tips_opacity, 0, 255);
|
|
TipsMaxCnt := BoundInt(tips_max, 0, 30);
|
|
TipsBtwSpace := BoundInt(tips_space, 0, 30);
|
|
TipsAlign := TtipsAlign(Byte(tips_position));
|
|
TipVerIndent := BoundInt(tips_vindent, -9999, 9999);
|
|
TipHorIndent := BoundInt(tips_hindent, -9999, 9999);
|
|
end else if page.idx = 10 then
|
|
begin
|
|
// Start
|
|
|
|
userspath := start_userpath;
|
|
reopenchats := start_reopenchats;
|
|
check4readonly := start_checkro;
|
|
autostartUIN := start_withuin;
|
|
startMinimized := start_minimized;
|
|
skipSplash := start_skipsplash;
|
|
autoconnect := start_autoconnect;
|
|
RnQstartingStatus := start_withstatus;
|
|
RnQstartingVisibility := 0;
|
|
uselastStatus := start_firstonly;
|
|
lockOnStart := start_lock;
|
|
end else if page.idx = 15 then
|
|
begin
|
|
// Security
|
|
|
|
AskPassOnBossKeyOn := security_askboss;
|
|
logpref.writehistory := security_writehist;
|
|
MakeBackups := security_backup;
|
|
histcrypt.savePwd := security_savehistpass;
|
|
end else if page.idx = 20 then
|
|
begin
|
|
// Events
|
|
|
|
behaviour := tempBeh;
|
|
focusOnChatPopup := events_chatfocus;
|
|
minOnOff := events_inoutignore;
|
|
minOnOffTime := BoundInt(events_inoutdur, 1, 2000);
|
|
incomingOnAway := events_awayisonline;
|
|
AlertTopMost := events_infoontop;
|
|
Soundvolume := BoundInt(events_volume, 0, 100);
|
|
autoconsumeevents := events_skipseen;
|
|
playSounds := events_playsnd;
|
|
|
|
for st := Low(Account.AccProto.statuses) to High(Account.AccProto.statuses) do
|
|
with UI.Prefs do
|
|
begin
|
|
OnStatusDisable[st].tips := OnStatusDisableLocal[st].tips;
|
|
OnStatusDisable[st].blinking := OnStatusDisableLocal[st].blinking;
|
|
OnStatusDisable[st].sounds := OnStatusDisableLocal[st].sounds;
|
|
OnStatusDisable[st].OpenChat := OnStatusDisableLocal[st].OpenChat;
|
|
end;
|
|
|
|
DsblEvnt4ClsdGrp := events_notinclosed;
|
|
logpref.pkts.onWindow := events_logpacketswin;
|
|
logpref.pkts.onFile := events_logpacketsfile;
|
|
logpref.pkts.Clear := events_logpacketsclear;
|
|
logpref.evts.onWindow := events_logeventswin;
|
|
logpref.evts.onFile := events_logeventsfile;
|
|
logpref.evts.Clear := events_logeventsclear;
|
|
MainPrefs.addPrefBool(PrefIsShowBDFirst, events_bdinform);
|
|
MainPrefs.addPrefBool(PrefIsShowBDBefore, events_bdnotify);
|
|
MainPrefs.addPrefInt(PrefShowBDFirst, BoundInt(events_bdinformdur, 1, 15));
|
|
MainPrefs.addPrefInt(PrefShowBDBefore, BoundInt(events_bdnotifydur, 1, 15));
|
|
end else if page.idx = 95 then
|
|
begin
|
|
// Autoupdate
|
|
|
|
checkupdate.enabled := autoupdate_enable;
|
|
checkupdate.betas := autoupdate_beta;
|
|
checkupdate.every := BoundInt(autoupdate_period, 1, 9999);
|
|
end else if page.idx = 96 then
|
|
begin
|
|
// ThemeEdit
|
|
|
|
MustInitCL := True;
|
|
MainCSS := themeedit_maincss;
|
|
ChatCSS := themeedit_chatcss;
|
|
|
|
with UI.Prefs do
|
|
if ThemePropsIni.Modified or not (GetThemeProps = themeedit_contents) then
|
|
begin
|
|
SetThemeProps(themeedit_contents, True);
|
|
ReloadCurrentTheme;
|
|
end;
|
|
end else if page.idx = 99 then
|
|
begin
|
|
// Other
|
|
|
|
quitconfirmation := other_confirmexit;
|
|
browserCmdLine := other_mybrowser;
|
|
useDefaultBrowser := other_browser = 1;
|
|
autoswitchKL := other_autolayout;
|
|
NILdoWith := 2 - other_notinlist;
|
|
showIncomingDlg := other_indialog;
|
|
optimizeDB := other_vacuum;
|
|
wheelVelocity := BoundInt(other_mwheelspeed, 1, 30);
|
|
inactivehideTime := BoundInt(other_clautohideval, 0, 36000) * 10;
|
|
inactiveHide := other_clautohide;
|
|
InactiveTrim := other_trimws;
|
|
ServerToUpload := other_servertoupload;
|
|
HandleICQLinks := other_handleicqlinks;
|
|
SetICQLinksHandler(HandleICQLinks);
|
|
end;
|
|
|
|
UI.InitSettings;
|
|
|
|
// Updates
|
|
|
|
if MustInitCL then
|
|
begin
|
|
UI.CL.InitSettings;
|
|
UI.CL.InitMenus;
|
|
UI.CL.UpdateAdditionalImage;
|
|
end;
|
|
|
|
if MustRebuildCL then
|
|
roasterLib.Rebuild;
|
|
// else if mustRepaintCL then
|
|
// RosterRepaintDelayed := True;
|
|
|
|
if Assigned(UI.Chat) then
|
|
with UI.Chat do
|
|
begin
|
|
InitSettings;
|
|
if mustResetHistory then
|
|
ResetHistory;
|
|
end;
|
|
|
|
// TODO: Add when found msg preview is implemented
|
|
//if Assigned(AllHistSrchForm) then
|
|
// AllHistSrchForm.UpdateChatSettings;
|
|
|
|
SaveCfgDelayed := True;
|
|
SaveCommonCFG;
|
|
end;
|
|
|
|
|
|
procedure PrefsReset(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
|
|
begin
|
|
|
|
UI.Prefs.Reset
|
|
end;
|
|
|
|
procedure ResetPlugins(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
|
|
UI.Prefs.ResetPlugins
|
|
end;
|
|
|
|
procedure IsOnline(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if Assigned(Account.AccProto) and Account.AccProto.IsOnline then
|
|
API.ValueIntDataSet(retval, 1, T_BOOL, 0)
|
|
else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
end;
|
|
|
|
procedure ApplyTransp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
val: Integer;
|
|
begin
|
|
val := -1;
|
|
API.ValueIntData(argv, val);
|
|
ApplyTransparency(AW_BOTH, val);
|
|
end;
|
|
|
|
procedure ChooseColor(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
clr: Integer;
|
|
cclr: String;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
clr := 0;
|
|
if argc > 0 then
|
|
API.ValueIntData(argv, clr);
|
|
|
|
with UI.Prefs do
|
|
begin
|
|
ColorDialog.Color := clr;
|
|
if ColorDialog.Execute(Window) then
|
|
begin
|
|
cclr := Color2HTML(ColorDialog.Color);
|
|
API.ValueStringDataSet(retval, PWideChar(cclr), Length(cclr), 0);
|
|
end else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure GetFont(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
openDlg: Integer;
|
|
cclr: String;
|
|
tmpVal: TSciterValue;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
openDlg := 0;
|
|
API.ValueIntData(argv, openDlg);
|
|
|
|
with UI.Prefs do
|
|
begin
|
|
if (openDlg = 0) or ((openDlg = 1) and FontDialog.Execute(Window)) then
|
|
begin
|
|
API.ValueInit(@tmpVal);
|
|
API.ValueStringDataSet(@tmpVal, PWideChar(FontDialog.Font.Name), Length(FontDialog.Font.Name), 0);
|
|
API.ValueNthElementValueSet(retval, 0, @tmpVal);
|
|
API.ValueIntDataSet(@tmpVal, FontDialog.Font.Size, T_INT, 0);
|
|
API.ValueNthElementValueSet(retval, 1, @tmpVal);
|
|
cclr := Color2HTML(FontDialog.Font.Color);
|
|
API.ValueStringDataSet(@tmpVal, PWideChar(cclr), Length(cclr), 0);
|
|
API.ValueNthElementValueSet(retval, 2, @tmpVal);
|
|
API.ValueIntDataSet(@tmpVal, RDUtils.IfThen(fsBold in FontDialog.Font.Style, 1), T_BOOL, 0);
|
|
API.ValueNthElementValueSet(retval, 3, @tmpVal);
|
|
API.ValueIntDataSet(@tmpVal, RDUtils.IfThen(fsItalic in FontDialog.Font.Style, 1), T_BOOL, 0);
|
|
API.ValueNthElementValueSet(retval, 4, @tmpVal);
|
|
API.ValueIntDataSet(@tmpVal, RDUtils.IfThen(fsUnderline in FontDialog.Font.Style, 1), T_BOOL, 0);
|
|
API.ValueNthElementValueSet(retval, 5, @tmpVal);
|
|
API.ValueClear(@tmpVal);
|
|
end else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
end;
|
|
end;
|
|
|
|
procedure SetFontProps(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
fsize, fcolor: Integer;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
fsize := 14;
|
|
fcolor := 0;
|
|
API.ValueIntData(argv, fsize);
|
|
Inc(argv);
|
|
API.ValueIntData(argv, fcolor);
|
|
|
|
with UI.Prefs do
|
|
begin
|
|
FontDialog.Font.Size := fsize;
|
|
FontDialog.Font.Color := fcolor;
|
|
end;
|
|
end;
|
|
|
|
procedure RefreshLangs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
UI.Prefs.RefreshLangList;
|
|
UI.Prefs.ResetLangs;
|
|
end;
|
|
|
|
procedure ManageLangs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
path: String;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
with UI.Prefs do
|
|
if TOSVersion.Check(10) then
|
|
ShellExecute(Window, 'open', 'ms-settings:regionlanguage', '', '', SW_SHOWNORMAL)
|
|
else
|
|
begin
|
|
path := expandEnv('%LocalAppData%') + '\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\%s\AAA_SystemSettings_Language_Add_Profile.settingcontent-ms';
|
|
if ShellExecute(Window, 'open', PChar(Format(path, ['ru-RU'])), '', '', SW_SHOWNORMAL) <= 32 then
|
|
ShellExecute(Window, 'open', PChar(Format(path, ['en-US'])), '', '', SW_SHOWNORMAL);
|
|
end;
|
|
end;
|
|
|
|
procedure UserDicts(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
ShellExecute(UI.Prefs.Window, 'open', PChar(expandEnv('%AppData%') + '\Microsoft\Spelling'), '', '', SW_SHOWNORMAL);
|
|
end;
|
|
|
|
procedure SetMainSpellcheckLang(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
str: PWideChar;
|
|
strLen: UINT;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
str := '';
|
|
API.ValueStringData(argv, str, strLen);
|
|
spellLanguageMain := str;
|
|
end;
|
|
|
|
procedure TestTips(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
e: Thevent;
|
|
i: Integer;
|
|
s: AnsiString;
|
|
begin
|
|
i := EK_msg;
|
|
s := '';
|
|
e := Thevent.new(i, nil, Account.AccProto.getMyInfo, now, s + getTranslation('Testing') + CRLF + 'Second row ------- :)', [], 0);
|
|
TipAdd3(e);
|
|
e.Free;
|
|
end;
|
|
|
|
procedure GetCurrentAccountPath(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Path: String;
|
|
begin
|
|
Path := ExtractFileName(ExcludeTrailingPathDelimiter(AccPath));
|
|
API.ValueStringDataSet(retval, PWideChar(Path), Length(Path), 0);
|
|
end;
|
|
|
|
procedure GetXStatusMsg(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
st: Integer;
|
|
msg: String;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
API.ValueIntData(argv, st);
|
|
msg := ExtStsStrings[st].Desc;
|
|
if msg = '' then
|
|
msg := GetTranslation(' |
|
API.ValueStringDataSet(retval, PWideChar(msg), Length(msg), 0);
|
|
end;
|
|
|
|
procedure GetMainStyles(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
SR: TSearchRec;
|
|
CSSThemes: TParams;
|
|
begin
|
|
SetLength(CSSThemes, 0);
|
|
if FindFirst(MyPath + themesPath + 'CSS\Main_*.css', faAnyFile, SR) = 0 then
|
|
repeat
|
|
if SR.Name[1] <> '.' then
|
|
begin
|
|
SetLength(CSSThemes, Length(CSSThemes) + 1);
|
|
CSSThemes[Length(CSSThemes) - 1] := MyPath + themesPath + 'CSS\' + SR.Name;
|
|
end;
|
|
until FindNext(SR) <> 0;
|
|
FindClose(SR);
|
|
|
|
V2S(CSSThemes, retval);
|
|
end;
|
|
|
|
procedure GetChatStyles(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
SR: TSearchRec;
|
|
CSSThemes: TParams;
|
|
begin
|
|
SetLength(CSSThemes, 0);
|
|
if FindFirst(MyPath + themesPath + 'CSS\Chat_*.css', faAnyFile, SR) = 0 then
|
|
repeat
|
|
if SR.Name[1] <> '.' then
|
|
begin
|
|
SetLength(CSSThemes, Length(CSSThemes) + 1);
|
|
CSSThemes[Length(CSSThemes) - 1] := MyPath + themesPath + 'CSS\' + SR.Name;
|
|
end;
|
|
until FindNext(SR) <> 0;
|
|
FindClose(SR);
|
|
|
|
V2S(CSSThemes, retval);
|
|
end;
|
|
|
|
procedure EncryptHistory(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
with UI.Prefs do
|
|
begin
|
|
histPwd := UI.EnterPassword(GetTranslation('History password'), 0);
|
|
if histPwd = '' then
|
|
Exit;
|
|
|
|
if histcrypt.enabled then
|
|
begin
|
|
if MessageDlg(GetTranslation('Are you sure you want to change the history password?'), mtConfirmation, [mbYes, mbCancel]) = ID_Cancel then
|
|
Exit;
|
|
|
|
if SQLDB.ManageSecurity(SA_CHANGEPASS, histPwd) and histcrypt.enabled then
|
|
MessageDlg(GetTranslation('History password was modified!'), mtInformation, [mbOK])
|
|
else
|
|
MessageDlg(GetTranslation('History password wasn''t modified!'), mtError, [mbOK]);
|
|
end
|
|
else
|
|
begin
|
|
if MessageDlg(GetTranslation('Are you sure you want to encrypt the entire history?'), mtConfirmation, [mbYes, mbCancel]) = ID_Cancel then
|
|
Exit;
|
|
|
|
if SQLDB.ManageSecurity(SA_ENCRYPT, histPwd) and histcrypt.enabled then
|
|
MessageDlg(GetTranslation('History was successfully encrypted!'), mtInformation, [mbOK])
|
|
else
|
|
MessageDlg(GetTranslation('History was not encrypted!'), mtError, [mbOK]);
|
|
end;
|
|
|
|
ResetSecurity;
|
|
end;
|
|
end;
|
|
|
|
procedure DecryptHistory(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
with UI.Prefs do
|
|
begin
|
|
if histPwd = '' then
|
|
histPwd := UI.EnterPassword(GetTranslation('History password'), 0);
|
|
if histPwd = '' then
|
|
Exit;
|
|
|
|
if MessageDlg(GetTranslation('Are you sure you want to decrypt the history?'), mtConfirmation, [mbYes, mbCancel]) = ID_Cancel then
|
|
Exit;
|
|
|
|
if SQLDB.ManageSecurity(SA_DECRYPT, histPwd) and not histcrypt.enabled then
|
|
MessageDlg(GetTranslation('History was successfully decrypted!'), mtInformation, [mbOK])
|
|
else
|
|
MessageDlg(GetTranslation('History was not decrypted!'), mtError, [mbOK]);
|
|
|
|
ResetSecurity;
|
|
end;
|
|
end;
|
|
|
|
procedure GetKeyName(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
code: Integer;
|
|
key: String;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
API.ValueIntData(argv, code);
|
|
key := shortcutToText(code);
|
|
API.ValueStringDataSet(retval, PWideChar(key), Length(key), 0);
|
|
end;
|
|
|
|
procedure HotkeySelect(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
aRow: integer;
|
|
begin
|
|
if (argc = 0) or not running then
|
|
Exit;
|
|
|
|
aRow := -1;
|
|
API.ValueIntData(argv, aRow);
|
|
if (aRow < 0) or (aRow > Length(macros) - 1) then
|
|
Exit;
|
|
with macros[aRow] do
|
|
UI.Prefs.Call('setCurrentHotkey', [hk and not scCommand, shortcutToText(hk), sw, hk and scCommand <> 0, opcode - 1]);
|
|
end;
|
|
|
|
procedure HotkeyDefault(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
SetLength(macros, 0);
|
|
addMacro(TextToShortCut('ctrl+shift+i'), TRUE, OP_TRAY);
|
|
addMacro(TextToShortCut('ctrl+shift+o'), TRUE, OP_CHAT);
|
|
addMacro(TextToShortCut('ctrl+o'), FALSE, OP_OFFLINECONTACTS);
|
|
addMacro(TextToShortCut('ctrl+g'), FALSE, OP_GROUPS);
|
|
addMacro(TextToShortCut('ctrl+a'), FALSE, OP_AUTOSIZE);
|
|
addMacro(TextToShortCut('ctrl+p'), FALSE, OP_PREFERENCES);
|
|
addMacro(TextToShortCut('alt+i'), FALSE, OP_VIEWINFO);
|
|
addMacro(TextToShortCut('F11'), FALSE, OP_TOGGLEBORDER);
|
|
addMacro(TextToShortCut('F3'), FALSE, OP_HINT);
|
|
addMacro(TextToShortCut('ctrl+shift+m'), FALSE, OP_MAINMENU);
|
|
UI.Prefs.ResetHotkeys;
|
|
end;
|
|
|
|
procedure HotkeySave(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
hotkey, sw, index: Integer;
|
|
begin
|
|
if (argc = 0) or not running then
|
|
Exit;
|
|
|
|
hotkey := 0;
|
|
API.ValueIntData(argv, hotkey);
|
|
sw := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, sw);
|
|
index := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, index);
|
|
if index = -1 then
|
|
Exit;
|
|
if addMacro(hotkey, sw = 1, index + 1) then
|
|
API.ValueIntDataSet(retval, 1, T_BOOL, 0)
|
|
else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
|
|
UI.Prefs.ResetHotkeys;
|
|
end;
|
|
|
|
procedure HotkeyDelete(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
aRow: Integer;
|
|
begin
|
|
aRow := -1;
|
|
API.ValueIntData(argv, aRow);
|
|
removeMacro(aRow);
|
|
end;
|
|
|
|
procedure UpdateEventTriggers(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
ev, i: Integer;
|
|
ac: Tbehaction;
|
|
triggers: TParams;
|
|
begin
|
|
if (argc = 0) or not running then
|
|
Exit;
|
|
|
|
ev := -1;
|
|
API.ValueIntData(argv, ev);
|
|
|
|
if ev >= 0 then
|
|
begin
|
|
Inc(ev);
|
|
i := 0;
|
|
for ac := Low(ac) to High(ac) do
|
|
begin
|
|
SetLength(triggers, i + 1);
|
|
triggers[i] := VarArrayCreate([0, 3], varVariant);
|
|
triggers[i][0] := ac;
|
|
triggers[i][1] := ac in supportedBehactions[ev];
|
|
triggers[i][2] := ac in tempBeh[ev].trig;
|
|
triggers[i][3] := behactionName(ac);
|
|
Inc(i);
|
|
end;
|
|
UI.Prefs.Call('updateEventTriggers', [triggers, BE_tip in supportedBehactions[ev], tempBeh[ev].tiptimes, tempBeh[ev].tiptime / 10, tempBeh[ev].tiptimeplus / 10]);
|
|
end;
|
|
end;
|
|
|
|
procedure StoreEventTrigger(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
ev, tmp: Integer;
|
|
ac: Tbehaction;
|
|
dur, plus: Double;
|
|
chk, multiply: Boolean;
|
|
begin
|
|
if (argc < 6) then
|
|
Exit;
|
|
|
|
ev := -1;
|
|
API.ValueIntData(argv, ev);
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
ac := Tbehaction(tmp);
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
chk := tmp = 1;
|
|
|
|
dur := 0;
|
|
Inc(argv);
|
|
API.ValueFloatData(argv, dur);
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
multiply := tmp = 1;
|
|
|
|
plus := 0;
|
|
Inc(argv);
|
|
API.ValueFloatData(argv, plus);
|
|
|
|
if ev >= 0 then
|
|
begin
|
|
Inc(ev);
|
|
if ev in [1 .. EK_last] then
|
|
if chk then
|
|
Include(tempBeh[ev].trig, ac)
|
|
else
|
|
Exclude(tempBeh[ev].trig, ac);
|
|
|
|
tempBeh[ev].tiptime := Round(dur * 10);
|
|
tempBeh[ev].tiptimes := multiply;
|
|
tempBeh[ev].tiptimeplus := Round(plus * 10)
|
|
end;
|
|
end;
|
|
|
|
procedure UpdateDisabledEvents(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
status: Integer;
|
|
events: TParams;
|
|
begin
|
|
if (argc = 0) or not running then
|
|
Exit;
|
|
|
|
status := -1;
|
|
API.ValueIntData(argv, status);
|
|
|
|
if status >= 0 then
|
|
with UI.Prefs do
|
|
begin
|
|
SetLength(events, 4);
|
|
events[0] := OnStatusDisableLocal[status].tips;
|
|
events[1] := OnStatusDisableLocal[status].blinking;
|
|
events[2] := OnStatusDisableLocal[status].sounds;
|
|
events[3] := OnStatusDisableLocal[status].OpenChat;
|
|
Call('updateDisabledEvents', [events]);
|
|
end;
|
|
end;
|
|
|
|
procedure StoreDisabledEvents(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
status, tmp: Integer;
|
|
tips, blink, sound, chat: Boolean;
|
|
begin
|
|
if (argc < 5) or not running then
|
|
Exit;
|
|
|
|
status := -1;
|
|
API.ValueIntData(argv, status);
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
tips := tmp = 1;
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
blink := tmp = 1;
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
sound := tmp = 1;
|
|
|
|
tmp := 0;
|
|
Inc(argv);
|
|
API.ValueIntData(argv, tmp);
|
|
chat := tmp = 1;
|
|
|
|
if status >= 0 then
|
|
with UI.Prefs do
|
|
begin
|
|
OnStatusDisableLocal[status].tips := tips;
|
|
OnStatusDisableLocal[status].blinking := blink;
|
|
OnStatusDisableLocal[status].sounds := sound;
|
|
OnStatusDisableLocal[status].OpenChat := chat;
|
|
end;
|
|
end;
|
|
|
|
procedure PlaySound(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
str: PWideChar;
|
|
strLen: Cardinal;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
str := '';
|
|
API.ValueStringData(argv, str, strLen);
|
|
try
|
|
SoundPlay(str);
|
|
except end;
|
|
end;
|
|
|
|
procedure SoundTest(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
vol: Integer;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
vol := 0;
|
|
API.ValueIntData(argv, vol);
|
|
Soundvolume := vol;
|
|
try
|
|
theme.PlaySound('incoming');
|
|
except end;
|
|
end;
|
|
|
|
procedure TimeTest(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
ev: Integer;
|
|
e: Thevent;
|
|
s: AnsiString;
|
|
begin
|
|
if argc = 0 then
|
|
Exit;
|
|
|
|
ev := -1;
|
|
API.ValueIntData(argv, ev);
|
|
|
|
if ev >= 0 then
|
|
begin
|
|
Inc(ev);
|
|
|
|
s := '';
|
|
if (ev = EK_statuschange) or (ev = EK_incoming) then
|
|
e := Thevent.new(ev, nil, Account.AccProto.getMyInfo, now, '', [Integer(SC_ONLINE), Byte(True), Byte(20)], 0)
|
|
else if ev = EK_XstatusMsg then
|
|
e := Thevent.new(ev, nil, Account.AccProto.getMyInfo, now, 'Status' + AnsiString(#00#00#00#00) + 'Status description', [Byte(SC_ONLINE)], 0)
|
|
else
|
|
e := Thevent.new(ev, nil, Account.AccProto.getMyInfo, now, s + 'Testing' + CRLF + 'Second row ------- :)', [], 0);
|
|
|
|
TipAdd3(e);
|
|
e.Free;
|
|
end;
|
|
end;
|
|
|
|
procedure IsAudioPresent(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if audioPresent then
|
|
API.ValueIntDataSet(retval, 1, T_BOOL, 0)
|
|
else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
end;
|
|
|
|
procedure BASSWarning(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
str: String;
|
|
begin
|
|
str := getTranslation('Need bass.dll version %s', [intToStr(HiByte(BASSVERSION)) + '.' + intToStr(loByte(BASSVERSION))]);
|
|
API.ValueStringDataSet(retval, PWideChar(str), Length(str), 0);
|
|
end;
|
|
|
|
procedure ReloadPlugins(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
plugins.unload;
|
|
plugins.load;
|
|
UI.Prefs.ResetPlugins;
|
|
end;
|
|
|
|
procedure OpenPluginPrefs(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
index: Integer;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
index := -1;
|
|
API.ValueIntData(argv, index);
|
|
|
|
if index >= 0 then
|
|
UI.Prefs.pluginList[index].cast_preferences
|
|
end;
|
|
|
|
procedure UpdateThemeEditProp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
index: Integer;
|
|
p: ^Tthemeproperty;
|
|
data: Variant;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
index := -1;
|
|
API.ValueIntData(argv, index);
|
|
|
|
if index >= 0 then
|
|
with UI.Prefs do
|
|
begin
|
|
p := @themeprops[index];
|
|
case p.kind of
|
|
TP_font:
|
|
begin
|
|
FontDialog.Font.Assign(Screen.MenuFont);
|
|
theme.ApplyFont(Copy(p.name, 1, Length(p.name) - 5), FontDialog.Font);
|
|
end;
|
|
TP_color:
|
|
data := Color2HTML(theme.GetColor(Copy(p.name, 1, Length(p.name) - 6)));
|
|
TP_pic, TP_ico:
|
|
data := p.name;
|
|
TP_string:
|
|
data := theme.GetString(p.name);
|
|
TP_sound:
|
|
data := theme.GetSound(p.name);
|
|
end;
|
|
|
|
Call('refreshThemeEdit', [p.kind, data]);
|
|
end;
|
|
end;
|
|
|
|
procedure AddThemeProp(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
index, tmpInt: Integer;
|
|
props, tmpStr: PWideChar;
|
|
strLen: Cardinal;
|
|
p: ^Tthemeproperty;
|
|
chrst: String;
|
|
begin
|
|
if not running then
|
|
Exit;
|
|
|
|
props := '';
|
|
API.ValueStringData(argv, props, strLen);
|
|
|
|
Inc(argv);
|
|
index := -1;
|
|
API.ValueIntData(argv, index);
|
|
|
|
if index >= 0 then
|
|
with UI.Prefs do
|
|
begin
|
|
SetThemeProps(props);
|
|
p := @themeprops[index];
|
|
case p.kind of
|
|
TP_font:
|
|
with ThemePropsIni do
|
|
begin
|
|
WriteString(p.section, p.name + '.color', color2str(FontDialog.Font.Color));
|
|
WriteInteger(p.section, p.name + '.size', FontDialog.Font.Size);
|
|
WriteString(p.section, p.name + '.name', FontDialog.Font.Name);
|
|
if CharsetToIdent(FontDialog.Font.Charset, chrst) then
|
|
WriteString(p.section, p.name + '.charset', chrst)
|
|
else
|
|
DeleteKey(p.section, p.name + '.charset');
|
|
if fontstyle2str(FontDialog.Font.Style) = '' then
|
|
DeleteKey(p.section, p.name + '.style')
|
|
else
|
|
WriteString(p.section, p.name + '.style', fontstyle2str(FontDialog.Font.Style));
|
|
end;
|
|
TP_color:
|
|
begin
|
|
Inc(argv);
|
|
tmpInt := 0;
|
|
API.ValueIntData(argv, tmpInt);
|
|
ThemePropsIni.WriteString(p.section, p.name, color2str(tmpInt));
|
|
end;
|
|
TP_pic, TP_ico, TP_sound:
|
|
begin
|
|
Inc(argv);
|
|
tmpStr := '';
|
|
API.ValueStringData(argv, tmpStr, strLen);
|
|
ThemePropsIni.WriteString(p.section, p.name, tmpStr);
|
|
end;
|
|
TP_string:
|
|
begin
|
|
Inc(argv);
|
|
tmpStr := '';
|
|
API.ValueStringData(argv, tmpStr, strLen);
|
|
ThemePropsIni.WriteString(p.section, p.name, newline2slashn(tmpStr));
|
|
end;
|
|
end;
|
|
|
|
props := PWideChar(GetThemeProps);
|
|
API.ValueStringDataSet(retval, props, Length(props), 0);
|
|
end else
|
|
API.ValueIntDataSet(retval, 0, T_BOOL, 0);
|
|
end;
|
|
|
|
procedure CheckPath(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
path: PWideChar;
|
|
fpath: String;
|
|
strLen: Cardinal;
|
|
begin
|
|
path := '';
|
|
API.ValueStringData(argv, path, strLen);
|
|
|
|
fpath := Template(path, [
|
|
'%userpath%', ExcludeTrailingPathDelimiter(AccPath),
|
|
'%rnqpath%', ExcludeTrailingPathDelimiter(mypath),
|
|
'%uid%', 'UID',
|
|
'%nick%', 'NICK'
|
|
]);
|
|
fpath := IncludeTrailingPathDelimiter(fpath) + 'FILE';
|
|
|
|
API.ValueStringDataSet(retval, PWideChar(fpath), Length(fpath), 0);
|
|
end;
|
|
|
|
procedure OnPrefsCreate(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
RootVar: Variant;
|
|
begin
|
|
UI.Prefs := TPrefs.Create;
|
|
S2V(argv, RootVar);
|
|
UI.Prefs.Root := Pointer(NativeInt(RootVar));
|
|
API.SciterGetElementHwnd(UI.Prefs.Root, UI.Prefs.Window, True);
|
|
HotkeysEnabled := False;
|
|
//Icon.Handle := LoadIcon(hInstance, 'rnqnewico');
|
|
UI.Prefs.ThemePropsIni := nil;
|
|
UI.Prefs.LoadThemeProps;
|
|
UI.Prefs.SetBounds(PrefsXY);
|
|
|
|
V2S(GetTranslation('Preferences for %s', [RnQUser]), retval);
|
|
end;
|
|
|
|
procedure OnPrefsClose(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
i: Integer;
|
|
begin
|
|
UpdateSWhotkeys;
|
|
HotkeysEnabled := True;
|
|
|
|
if Assigned(UI) and Assigned(UI.Prefs) then
|
|
with UI.Prefs do
|
|
begin
|
|
for i := Low(ArrPages) to High(ArrPages) do
|
|
FreeAndNil(ArrPages[i]);
|
|
SetLength(ArrPages, 0);
|
|
|
|
FreeAndNil(ThemePropsIni);
|
|
SetLength(OnStatusDisableLocal, 0);
|
|
SetLength(pluginList, 0);
|
|
SetLength(themeprops, 0);
|
|
end;
|
|
end;
|
|
|
|
constructor TPrefs.Create;
|
|
begin
|
|
ColorDialog := TColorDialog.Create(nil);
|
|
FontDialog := TFontDialog.Create(nil);
|
|
end;
|
|
|
|
destructor TPrefs.Destroy;
|
|
begin
|
|
ColorDialog.Free;
|
|
FontDialog.Free;
|
|
inherited;
|
|
end;
|
|
|
|
procedure TPrefs.InitConnection;
|
|
begin
|
|
// Call('initConnection', []);
|
|
end;
|
|
|
|
procedure TPrefs.InitChat;
|
|
begin
|
|
if CheckWin32Version(6, 2) then
|
|
RefreshLangList
|
|
else begin
|
|
EnableSpellCheck := False;
|
|
Call('hideSpellcheck', []);
|
|
end;
|
|
end;
|
|
|
|
procedure TPrefs.InitAutoaway;
|
|
var
|
|
x: Integer;
|
|
xstatuses: TParams;
|
|
begin
|
|
for x := Low(XStatusArray) to High(XStatusArray) do
|
|
if (xsf_6 in XStatusArray[x].flags) then
|
|
if not(StartsText('status_', XStatusArray[X].pid6)) then
|
|
begin
|
|
SetLength(xstatuses, Length(xstatuses) + 1);
|
|
xstatuses[Length(xstatuses) - 1] := VarArrayCreate([0, 2], varVariant);
|
|
xstatuses[Length(xstatuses) - 1][0] := x;
|
|
xstatuses[Length(xstatuses) - 1][1] := XStatusArray[x].PicName;
|
|
xstatuses[Length(xstatuses) - 1][2] := GetTranslation(XStatusArray[x].Caption);
|
|
end;
|
|
|
|
Call('initAutoaway', [xstatuses]);
|
|
end;
|
|
|
|
procedure TPrefs.InitStart;
|
|
var
|
|
i: Integer;
|
|
status, vis: TParams;
|
|
smenu: TStatusMenu;
|
|
begin
|
|
smenu := Account.AccProto.getStatusMenu;
|
|
SetLength(status, Length(smenu) + 1);
|
|
status[0] := VarArrayCreate([0, 1], varVariant);
|
|
status[0][0] := -1;
|
|
status[0][1] := getTranslation('Use last set status');
|
|
for i := 0 to Length(smenu) - 1 do
|
|
begin
|
|
status[i + 1] := VarArrayCreate([0, 1], varVariant);
|
|
status[i + 1][0] := smenu[i];
|
|
status[i + 1][1] := getTranslation(status2ShowStr[TICQStatus(smenu[i])]);
|
|
end;
|
|
|
|
smenu := Account.AccProto.getVisMenu;
|
|
SetLength(vis, Length(smenu));
|
|
for i := 0 to Length(smenu) - 1 do
|
|
begin
|
|
vis[i] := VarArrayCreate([0, 1], varVariant);
|
|
vis[i][0] := smenu[i];
|
|
vis[i][1] := getTranslation(visibility2ShowStr[Tvisibility(smenu[i])]);
|
|
end;
|
|
|
|
Call('initStart', [status, vis]);
|
|
end;
|
|
|
|
procedure TPrefs.InitHotkeys;
|
|
var
|
|
actions: TParams;
|
|
i: Integer;
|
|
begin
|
|
RemoveSWHotkeys;
|
|
|
|
SetLength(actions, OP_last - succ(OP_none) + 1);
|
|
for i := succ(OP_none) to OP_last do
|
|
actions[i - succ(OP_none)] := GetTranslation(macro2str[i]);
|
|
|
|
Call('initHotkeys', [actions]);
|
|
end;
|
|
|
|
procedure TPrefs.InitEvents;
|
|
var
|
|
i, j: Integer;
|
|
st: Byte;
|
|
events, statuses: TParams;
|
|
begin
|
|
SetLength(OnStatusDisableLocal, High(Account.AccProto.statuses) + 1);
|
|
SetLength(events, EK_last);
|
|
for i := 1 to EK_last do
|
|
for j := 0 to Length(ActiveEvents) - 1 do
|
|
if i = ActiveEvents[j] then
|
|
events[i - 1] := getTranslation(event2ShowStr[i]);
|
|
|
|
i := 0;
|
|
for st in Account.AccProto.getStatusMenu do
|
|
if not (st = Byte(SC_OFFLINE)) and not (st = Byte(SC_UNK)) then
|
|
begin
|
|
SetLength(statuses, i + 1);
|
|
statuses[i] := VarArrayCreate([0, 1], varVariant);
|
|
statuses[i][0] := Account.AccProto.getStatuses[st].idx;
|
|
statuses[i][1] := getTranslation(Account.AccProto.getStatuses[st].Cptn);
|
|
Inc(i);
|
|
end;
|
|
|
|
Call('initEvents', [events, statuses]);
|
|
end;
|
|
|
|
procedure TPrefs.InitThemeEdit;
|
|
var
|
|
i: Integer;
|
|
Props: TParams;
|
|
begin
|
|
theme.getprops(themeprops);
|
|
SetLength(Props, Length(themeprops));
|
|
for i := 0 to Length(themeprops) - 1 do
|
|
begin
|
|
Props[i] := VarArrayCreate([0, 1], varVariant);
|
|
Props[i][0] := themeprops[i].kind;
|
|
Props[i][1] := Format('[%s] %s', [themeprops[i].section, themeprops[i].name]);
|
|
end;
|
|
|
|
Call('initThemeEdit', [Props]);
|
|
end;
|
|
|
|
procedure TPrefs.InitOther;
|
|
begin
|
|
Call('initOther', []);
|
|
end;
|
|
{
|
|
function EscapeQuotes(text: String): String;
|
|
begin
|
|
Result := text.Replace('\', '\\', [rfReplaceAll]).Replace('"', '\"', [rfReplaceAll]);
|
|
end;
|
|
}
|
|
function FromHTML(const text: String): String;
|
|
begin
|
|
Result := THTMLEncoding.HTML.Decode(text);
|
|
end;
|
|
|
|
procedure TPrefs.ResetConnection(ProfileOnly: Boolean = False);
|
|
var
|
|
profiles: TParams;
|
|
foundProxy: Boolean;
|
|
i, index: Integer;
|
|
obj: TPrefsObj;
|
|
begin
|
|
index := 0;
|
|
if not ProfileOnly then
|
|
CopyProxyArr(v_proxyes, AllProxies);
|
|
if Length(v_proxyes) = 0 then
|
|
begin
|
|
MainProxy.name := 'Default';
|
|
SetLength(v_proxyes, 1);
|
|
CopyProxy(v_proxyes[0], MainProxy);
|
|
end
|
|
else
|
|
begin
|
|
foundProxy := False;
|
|
|
|
for i := 0 to Length(v_proxyes) - 1 do
|
|
if v_proxyes[i].name = MainProxy.name then
|
|
begin
|
|
index := i;
|
|
foundProxy := True;
|
|
break;
|
|
end;
|
|
|
|
if not foundProxy then
|
|
index := 0;
|
|
|
|
if (index >= Low(v_proxyes)) and (index <= High(v_proxyes)) then
|
|
CopyProxy(MainProxy, v_proxyes[index]);
|
|
end;
|
|
|
|
SetLength(profiles, Length(v_proxyes));
|
|
for i := 0 to Length(v_proxyes) - 1 do
|
|
profiles[i] := v_proxyes[i].name;
|
|
|
|
obj := Default(TPrefsObj);
|
|
if (index >= Low(v_proxyes)) and (index <= High(v_proxyes)) then
|
|
with obj, v_proxyes[index] do
|
|
begin
|
|
profile_index := index;
|
|
profile_name := name;
|
|
profile_proxy := ord(proto);
|
|
profile_proxyauth := auth;
|
|
profile_proxyhost := addr.host;
|
|
profile_proxyport := addr.port;
|
|
profile_proxyuser := user;
|
|
profile_proxypasswd := pwd;
|
|
profile_proxyntlm := NTLM;
|
|
|
|
if not ProfileOnly then
|
|
begin
|
|
net_auto := AutoReconnect;
|
|
net_whenavailable := ConnectOnConnection;
|
|
net_lostdlg := ShowDisconnectedDlg;
|
|
net_showtemp := ShowTempConnectErrors;
|
|
end;
|
|
|
|
Call('resetConnection', [profiles, ProfileOnly, UI.RecordToVar(obj)]);
|
|
end;
|
|
end;
|
|
|
|
procedure TPrefs.ResetICQ;
|
|
|
|
function Str2HexArr(const s: RawByteString): TCaps;
|
|
var
|
|
i: Integer;
|
|
begin
|
|
for i := 1 to Length(s) do
|
|
Result[i-1] := IntToHex(ord(s[i]), 2);
|
|
end;
|
|
|
|
var
|
|
icq: TICQSession;
|
|
obj: TPrefsObj;
|
|
begin
|
|
if not Assigned(Account.AccProto) then
|
|
Exit;
|
|
icq := Account.AccProto;
|
|
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
icq_password := icq.pwd;
|
|
icq_savepass := not dontSavePwd;
|
|
icq_clearpass := clearPwdOnDSNCT;
|
|
icq_savetoken:= icq.SaveToken;
|
|
icq_birthremind := sendBalloonOn;
|
|
icq_birthdate := sendBalloonOnDate;
|
|
|
|
icq_ident := icq.ShowClientID;
|
|
icq_addcap := AddExtCliCaps;
|
|
icq_addedcap := Str2HexArr(ExtClientCaps);
|
|
icq_msgencrypt := icq.UseCryptMsg;
|
|
// icq_showinvis := showInvisSts;
|
|
// icq_webaware := icq.webaware;
|
|
// icq_shareinfo := icq.showInfo;
|
|
// icq_reqauth := icq.authNeeded;
|
|
icq_showtyping := icq.SupportTypingNotif;
|
|
icq_sendtyping := icq.isSendTypingNotif;
|
|
icq_inactinterval := TypingInterval;
|
|
icq_recentlyoffline := EnableRecentlyOffline;
|
|
icq_recentlyofflinedelay := RecentlyOfflineDelay;
|
|
icq_enableavatars := icq.AvatarsSupport;
|
|
icq_autoavatars := icq.AvatarsAutoGet;
|
|
icq_failedavatars := AvatarsNotDnlddInform;
|
|
icq_autoxstatus := AutoRequestXsts;
|
|
end;
|
|
|
|
Call('resetICQ', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetAntispam(QuestionsOnly: Boolean = False);
|
|
var
|
|
obj: TPrefsObj;
|
|
questions: TParams;
|
|
ignores, quiets: TParams;
|
|
ign, qts: array of TListItem;
|
|
cnt: TICQContact;
|
|
i: Integer;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
if not QuestionsOnly then
|
|
with obj do
|
|
begin
|
|
spam_warn := SpamFilter.Warn;
|
|
spam_ignoreunk := SpamFilter.IgnoreNIL;
|
|
spam_ignoreunkauth := SpamFilter.IgnoreAuthNIL;
|
|
spam_zero := SpamFilter.AddToHist;
|
|
spam_ignoremult := SpamFilter.MultiSend;
|
|
spam_ignoreunk2 := SpamFilter.NotNIL;
|
|
spam_ignorenohist := SpamFilter.NotEmpty;
|
|
spam_ignorebadwords := SpamFilter.NoBadWords;
|
|
spam_badwords := ReplaceStr(SpamFilter.BadWords, ';', #10);
|
|
|
|
spam_ignoreuin := SpamFilter.UINgt > 0;
|
|
if SpamFilter.UINgt = 0 then
|
|
spam_ignoreuinvalue := 150000000
|
|
else
|
|
spam_ignoreuinvalue := SpamFilter.UINgt;
|
|
|
|
spam_botenable := SpamFilter.UseBot;
|
|
spam_botusequest := SpamFilter.UseBotFromFile;
|
|
spam_botattempts := SpamFilter.BotTriesCount;
|
|
|
|
spam_ignorelist := EnableIgnoreList;
|
|
IgnoreList.resetEnumeration;
|
|
SetLength(ign, IgnoreList.Count);
|
|
i := 0;
|
|
while IgnoreList.hasMore do
|
|
with ign[i] do
|
|
begin
|
|
cnt := IgnoreList.getNext;
|
|
s0 := cnt.displayed;
|
|
if not (s0 = cnt.UID) then
|
|
s0 := s0 + ' (' + cnt.uin2Show + ')';
|
|
s1 := cnt.UID;
|
|
isSrv := Account.AccProto.IsInList(LT_SPAM, cnt);
|
|
Inc(i);
|
|
end;
|
|
|
|
SetLength(ignores, Length(ign));
|
|
for i := 0 to Length(ign) - 1 do
|
|
ignores[i] := UI.RecordToVar(ign[i]);
|
|
|
|
spam_quietlist := enableQuietlist;
|
|
quietList.resetEnumeration;
|
|
SetLength(qts, quietList.Count);
|
|
i := 0;
|
|
while quietList.hasMore do
|
|
with qts[i] do
|
|
begin
|
|
cnt := quietList.getNext;
|
|
s0 := cnt.displayed;
|
|
if not (s0 = cnt.UID) then
|
|
s0 := s0 + ' (' + cnt.uin2Show + ')';
|
|
s1 := cnt.UID;
|
|
isSrv := False;
|
|
Inc(i);
|
|
end;
|
|
|
|
SetLength(quiets, Length(qts));
|
|
for i := 0 to Length(qts) - 1 do
|
|
quiets[i] := UI.RecordToVar(qts[i]);
|
|
|
|
qst := Copy(SpamFilter.Quests);
|
|
end;
|
|
|
|
SetLength(questions, Length(qst));
|
|
for i := 0 to Length(qst) - 1 do
|
|
questions[i] := UI.RecordToVar(qst[i]);
|
|
|
|
Call('resetAntispam', [questions, QuestionsOnly, ignores, quiets, UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetAutoaway;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
autoaway_setaway := autoaway.away;
|
|
autoaway_setawaydelay := autoaway.awayTime div (10 * 60);
|
|
autoaway_setna := autoaway.na;
|
|
autoaway_setnadelay := autoaway.naTime div (10 * 60);
|
|
autoaway_setnascreen := autoaway.ss;
|
|
autoaway_setnaboss := autoaway.boss;
|
|
autoaway_restore := autoaway.autoexit;
|
|
autoaway_setxstatus := autoaway.setxstatus;
|
|
autoaway_xstatus := autoaway.xstatus;
|
|
end;
|
|
|
|
Call('resetAutoaway', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetDesign;
|
|
var
|
|
obj: TPrefsObj;
|
|
items: TParams;
|
|
i: Integer;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
design_clontop := alwaysOnTop;
|
|
design_trayclick := useSingleClickTray;
|
|
// design_snapwin := snapToScreenEdges;
|
|
design_xbutton := showXStatusMnu;
|
|
design_blinkspeed := blinkSpeed;
|
|
design_blinkstatus := blinkWithStatus;
|
|
design_xmain := XStatusInTray;
|
|
design_xnew := showNewXStatuses;
|
|
design_btips := showBalloons;
|
|
design_userthemes := UseContactThemes;
|
|
|
|
StatusIcon.Update;
|
|
|
|
if not autosizeRoster then
|
|
design_clautosizedown := 0
|
|
else if not autosizeFullRoster then
|
|
design_clautosizedown := 1
|
|
else
|
|
design_clautosizedown := 2;
|
|
|
|
if not docking.enabled then
|
|
design_docking := 0
|
|
else if not docking.appBar then
|
|
design_docking := 1
|
|
else
|
|
design_docking := 2;
|
|
|
|
design_clbar := BarPos;
|
|
design_clfilterbar := FilterPos;
|
|
design_clsort := sb2index[sortBy];
|
|
design_wintitle := rosterTitle;
|
|
design_clautosizeup := autosizeUp;
|
|
design_showtip := ShowHintsInCL;
|
|
design_animgrp := animatedRoster;
|
|
design_animwindows := AnimateWindows;
|
|
design_uindelim := ShowUINDelimiter;
|
|
design_showborder := showMainBorder;
|
|
design_noborderwithshadow := NoBorderWithShadow;
|
|
design_enablegroups := showGroups;
|
|
design_indentgrp := indentRoster;
|
|
design_collapsegrp := collapseGroups;
|
|
design_onlineonly := showOnlyOnline;
|
|
design_unauthasoff := showUnkAsOffline;
|
|
|
|
design_transpcl := transparency.forRoster;
|
|
design_transpchat := transparency.forChat;
|
|
design_actopacity := transparency.active;
|
|
design_inactopacity := transparency.inactive;
|
|
|
|
design_avchat := avatarShowInChat;
|
|
design_avhints := avatarShowInHint;
|
|
design_avtray := avatarShowInTray;
|
|
design_avtaskbarbtn := avatarShowInTaskBar;
|
|
design_avusepalette := avatarUsePalette;
|
|
design_avmaxsize := TipsMaxAvtSizeUse;
|
|
design_avmaxsizeval := TipsMaxAvtSize;
|
|
end;
|
|
|
|
SetLength(items, Length(SHOW_ICONS_ORDER));
|
|
for i := 0 to Length(items) - 1 do
|
|
begin
|
|
items[i] := VarArrayCreate([0, 1], varVariant);
|
|
items[i][0] := UI.RecordToVar(RnQCLIcons[SHOW_ICONS_ORDER[i]]);
|
|
items[i][1] := TO_SHOW_ICON[SHOW_ICONS_ORDER[i]];
|
|
end;
|
|
|
|
Call('resetDesign', [items, UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetChat;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
chat_textformat := fontstylecodes.enabled;
|
|
chat_autocopy := autoCopyHist;
|
|
chat_singlemsg := singleDefault;
|
|
chat_tabstatus := showStatusOnTabs;
|
|
chat_cursorquote := quoting.cursorBelow;
|
|
chat_msgbuffer := ChatLoadBuffer;
|
|
chat_entercount := sendonenter;
|
|
chat_quoteselected := quoting.quoteselected;
|
|
chat_chatontop := chatAlwaysOnTop;
|
|
chat_pluginsabove := usePlugPanel;
|
|
chat_tabhints := showHintsInChat;
|
|
chat_wrapinseparate := bViewTextWrap;
|
|
chat_closeonempty := closeChatOnSend;
|
|
chat_smilescaptions := ShowSmileCaption;
|
|
chat_inimg := EnableImgLinksIn;
|
|
chat_outimg := EnableImgLinksOut;
|
|
chat_maximgwidth := LimitMaxChatImgWidth;
|
|
chat_maximgheight := LimitMaxChatImgHeight;
|
|
chat_enablestickers := EnableStickers;
|
|
chat_stickersize := StickerResolution;
|
|
chat_chatimgquality := ChatImageQuality;
|
|
chat_videores := PreferredResolution;
|
|
chat_videothumbs := EnableVideoLinks;
|
|
chat_smoothrender := ChatSmoothFontRendering;
|
|
chat_animatedscroll := AnimatedScroll;
|
|
chat_msgtrim := TrimMsgNewLines;
|
|
chat_spellcheck := EnableSpellCheck;
|
|
chat_maximgwidthval := MaxChatImgWidthVal;
|
|
chat_maximgheightval := MaxChatImgHeightVal;
|
|
chat_closetabonsingle := ClosePageOnSingle;
|
|
chat_spellcheckstyle := spellErrorStyle;
|
|
chat_reldays := RelativeTimeInChatDays;
|
|
chat_relhours := RelativeTimeInChatHours;
|
|
end;
|
|
|
|
Call('resetChat', [Color2HTML(spellErrorColor), UI.RecordToVar(obj)]);
|
|
ResetLangs;
|
|
end;
|
|
|
|
procedure TPrefs.ResetTips;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
tips_transparency := transparency.forTray;
|
|
tips_opacity := transparency.tray;
|
|
tips_max := TipsMaxCnt;
|
|
tips_space := TipsBtwSpace;
|
|
tips_vindent := TipVerIndent;
|
|
tips_hindent := TipHorIndent;
|
|
tips_position := byte(TipsAlign);
|
|
end;
|
|
|
|
Call('resetTips', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetStart;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
start_userpath := userspath;
|
|
start_reopenchats := reopenchats;
|
|
start_checkro := check4readonly;
|
|
if autostartUIN = '' then
|
|
start_withuin := ''
|
|
else
|
|
start_withuin := autostartUIN;
|
|
start_minimized := startMinimized;
|
|
start_autoconnect := autoconnect;
|
|
start_withstatus := RnQstartingStatus;
|
|
start_firstonly := uselastStatus;
|
|
start_skipsplash := skipSplash;
|
|
start_lock := lockOnStart;
|
|
end;
|
|
|
|
Call('resetStart', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetSecurity;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
security_askboss := AskPassOnBossKeyOn;
|
|
security_writehist := logpref.writehistory;
|
|
security_backup := MakeBackups;
|
|
histPwd := histcrypt.pwd;
|
|
security_savehistpass := histcrypt.savePwd;
|
|
end;
|
|
|
|
Call('resetSecurity', [histcrypt.Enabled, UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetHotkeys;
|
|
var
|
|
i: integer;
|
|
hotkeys: TParams;
|
|
begin
|
|
SetLength(hotkeys, Length(macros));
|
|
for i := 0 to Length(macros) - 1 do
|
|
begin
|
|
hotkeys[i] := VarArrayCreate([0, 3], varVariant);
|
|
hotkeys[i][0] := getTranslation(macro2str[macros[i].opcode]);
|
|
hotkeys[i][1] := RDUtils.IfThen(macros[i].hk and scCommand <> 0, 'Win+', '') + shortcutToText(macros[i].hk);
|
|
if macros[i].sw then
|
|
hotkeys[i][2] := getTranslation('Yes')
|
|
else
|
|
hotkeys[i][2] := getTranslation('No');
|
|
hotkeys[i][3] := macros[i].hk;
|
|
end;
|
|
|
|
Call('resetHotkeys', [hotkeys]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetEvents;
|
|
var
|
|
obj: TPrefsObj;
|
|
st: Byte;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
events_chatfocus := focusOnChatPopup;
|
|
events_inoutdur := minOnOffTime;
|
|
events_inoutignore := minOnOff;
|
|
events_awayisonline := incomingOnAway;
|
|
tempBeh := behaviour;
|
|
events_infoontop := AlertTopMost;
|
|
events_volume := Soundvolume;
|
|
events_skipseen := autoconsumeevents;
|
|
events_playsnd := playSounds;
|
|
|
|
for st := Low(Account.AccProto.Statuses) to High(Account.AccProto.Statuses) do
|
|
begin
|
|
OnStatusDisableLocal[st].tips := OnStatusDisable[st].tips;
|
|
OnStatusDisableLocal[st].blinking := OnStatusDisable[st].blinking;
|
|
OnStatusDisableLocal[st].sounds := OnStatusDisable[st].sounds;
|
|
OnStatusDisableLocal[st].OpenChat := OnStatusDisable[st].OpenChat;
|
|
end;
|
|
|
|
events_notinclosed := DsblEvnt4ClsdGrp;
|
|
events_logpacketswin := logpref.pkts.onWindow;
|
|
events_logpacketsfile := logpref.pkts.onFile;
|
|
events_logpacketsclear := logpref.pkts.Clear;
|
|
events_logeventswin := logpref.evts.onWindow;
|
|
events_logeventsfile := logpref.evts.onFile;
|
|
events_logeventsclear := logpref.evts.Clear;
|
|
|
|
events_bdinform := MainPrefs.getPrefBoolDef(PrefIsShowBDFirst, True);
|
|
events_bdnotify := MainPrefs.getPrefBoolDef(PrefIsShowBDBefore, True);
|
|
events_bdinformdur := MainPrefs.getPrefIntDef(PrefShowBDFirst, 7);
|
|
events_bdnotifydur := MainPrefs.getPrefIntDef(PrefShowBDBefore, 3);
|
|
end;
|
|
|
|
Call('resetEvents', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetPlugins;
|
|
var
|
|
i: Integer;
|
|
pls: TParams;
|
|
begin
|
|
i := 0;
|
|
plugins.resetEnumeration;
|
|
while plugins.hasMore do
|
|
begin
|
|
Inc(i);
|
|
SetLength(pls, i);
|
|
SetLength(pluginList, i);
|
|
pls[i-1] := VarArrayCreate([0, 2], varVariant);
|
|
pluginList[i-1] := plugins.getNext;
|
|
if pluginList[i-1].screenname = '' then
|
|
pls[i-1][0] := '(' + getTranslation('Not loaded') + ')'
|
|
else
|
|
pls[i-1][0] := pluginList[i-1].screenname;
|
|
pls[i-1][1] := pluginList[i-1].filename;
|
|
pls[i-1][2] := 0 = pos(pluginList[i-1].filename, disabledPlugins);
|
|
end;
|
|
|
|
Call('resetPlugins', [pls]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetAutoupdate;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
autoupdate_beta := checkupdate.betas;
|
|
autoupdate_enable := checkupdate.enabled;
|
|
autoupdate_period := checkupdate.every;
|
|
end;
|
|
|
|
Call('resetAutoupdate', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetThemeEdit;
|
|
var
|
|
ThemeObj: TPrefsObj;
|
|
begin
|
|
LoadThemeProps;
|
|
|
|
ThemeObj := Default(TPrefsObj);
|
|
ThemeObj.themeedit_contents := GetThemeProps;
|
|
ThemeObj.themeedit_maincss := MainCSS;
|
|
ThemeObj.themeedit_chatcss := ChatCSS;
|
|
|
|
Call('resetThemeEdit', [UI.RecordToVar(ThemeObj)]);
|
|
end;
|
|
|
|
procedure TPrefs.ResetOther;
|
|
var
|
|
obj: TPrefsObj;
|
|
begin
|
|
obj := Default(TPrefsObj);
|
|
with obj do
|
|
begin
|
|
other_confirmexit := quitconfirmation;
|
|
other_autolayout := autoswitchKL;
|
|
other_notinlist := 2 - NILdoWith;
|
|
other_vacuum := optimizeDB;
|
|
other_indialog := showIncomingDlg;
|
|
other_mwheelspeed := wheelVelocity;
|
|
other_clautohide := inactiveHide;
|
|
other_clautohideval := inactivehideTime div 10;
|
|
other_trimws := InactiveTrim;
|
|
other_handleicqlinks := HandleICQLinks;
|
|
other_mybrowser := browserCmdLine;
|
|
other_browser := RDUtils.IfThen(useDefaultBrowser, 1);
|
|
other_servertoupload := ServerToUpload;
|
|
end;
|
|
|
|
Call('resetOther', [UI.RecordToVar(obj)]);
|
|
end;
|
|
|
|
procedure TPrefs.Init;
|
|
var
|
|
page: TPrefPage;
|
|
begin
|
|
for page in ArrPages do
|
|
case page.idx of
|
|
1: InitConnection;
|
|
6: InitChat;
|
|
4: InitAutoaway;
|
|
10: InitStart;
|
|
16: InitHotkeys;
|
|
20: InitEvents;
|
|
96: InitThemeEdit;
|
|
99: InitOther;
|
|
end;
|
|
end;
|
|
|
|
procedure TPrefs.Reset;
|
|
var
|
|
page: TPrefPage;
|
|
begin
|
|
for page in ArrPages do
|
|
case page.idx of
|
|
1: ResetConnection;
|
|
2: ResetICQ;
|
|
3: ResetAntispam;
|
|
4: ResetAutoaway;
|
|
5: ResetDesign;
|
|
6: ResetChat;
|
|
7: ResetTips;
|
|
10: ResetStart;
|
|
15: ResetSecurity;
|
|
16: ResetHotkeys;
|
|
20: ResetEvents;
|
|
30: ResetPlugins;
|
|
95: ResetAutoupdate;
|
|
96: ResetThemeEdit;
|
|
99: ResetOther;
|
|
end;
|
|
end;
|
|
|
|
procedure TPrefs.SetViewMode(pages: array of TPrefPage);
|
|
var
|
|
i, j: Integer;
|
|
args: TParams;
|
|
begin
|
|
if Length(pages) = 0 then
|
|
begin
|
|
j := Length(prefPages);
|
|
SetLength(ArrPages, j);
|
|
for i := 0 to j - 1 do
|
|
ArrPages[i] := prefPages[i].Clone;
|
|
end
|
|
else
|
|
begin
|
|
SetLength(ArrPages, Length(pages));
|
|
for i := 0 to Length(pages) - 1 do
|
|
ArrPages[i] := pages[i].Clone;
|
|
end;
|
|
|
|
SortPrefPages;
|
|
|
|
try
|
|
SetLength(args, Length(ArrPages));
|
|
for i := 0 to Length(ArrPages) - 1 do
|
|
begin
|
|
args[i] := VarArrayCreate([0, 2], varVariant);
|
|
args[i][0] := ArrPages[i].idx;
|
|
args[i][1] := ArrPages[i].Name;
|
|
args[i][2] := ArrPages[i].Caption;
|
|
end;
|
|
|
|
Call('setPages', [args]);
|
|
//SetActivePage(0);
|
|
except end;
|
|
|
|
Init;
|
|
Reset;
|
|
end;
|
|
|
|
procedure TPrefs.LoadThemeProps;
|
|
begin
|
|
FreeAndNil(ThemePropsIni);
|
|
ThemePropsIni := TMemIniFile.Create(AccPath + userthemeFilename);
|
|
ThemePropsIni.AutoSave := False;
|
|
end;
|
|
|
|
procedure TPrefs.SetThemeProps(const props: String; doUpdate: Boolean = False);
|
|
var
|
|
propsList: TStringList;
|
|
begin
|
|
propsList := TStringList.Create;
|
|
propsList.Text := props;
|
|
ThemePropsIni.SetStrings(propsList);
|
|
if doUpdate then
|
|
ThemePropsIni.UpdateFile;
|
|
propsList.Free;
|
|
end;
|
|
|
|
function TPrefs.GetThemeProps: String;
|
|
var
|
|
propsList: TStringList;
|
|
begin
|
|
propsList := TStringList.Create;
|
|
ThemePropsIni.GetStrings(propsList);
|
|
Result := propsList.Text;
|
|
propsList.Free;
|
|
end;
|
|
|
|
procedure TPrefs.SortPrefPages;
|
|
var
|
|
i: Integer;
|
|
pp: TPrefPage;
|
|
bool: Boolean;
|
|
begin
|
|
for i := Low(ArrPages) to High(ArrPages) do
|
|
begin
|
|
if ArrPages[i].idx = 0 then
|
|
ArrPages[i].idx := 100;
|
|
ArrPages[i].Caption := getTranslation(ArrPages[i].Caption);
|
|
end;
|
|
repeat
|
|
bool := True;
|
|
for i := 0 to High(ArrPages) - 1 do
|
|
if ArrPages[i].idx > ArrPages[i + 1].idx then
|
|
begin
|
|
pp := ArrPages[i];
|
|
ArrPages[i] := ArrPages[i + 1];
|
|
ArrPages[i + 1] := pp;
|
|
bool := False
|
|
end;
|
|
until bool;
|
|
end;
|
|
|
|
function TPrefs.HasPrefPage(pidx: Byte): Boolean;
|
|
var
|
|
page: TPrefPage;
|
|
begin
|
|
Result := False;
|
|
for page in ArrPages do
|
|
if page.idx = pidx then
|
|
Result := True;
|
|
end;
|
|
|
|
procedure TPrefs.RefreshLangList;
|
|
var
|
|
iscf: ISpellCheckerFactory;
|
|
langs: IEnumString;
|
|
lang: PChar;
|
|
fetched: Cardinal;
|
|
LangItem: TLangItem;
|
|
locid: Cardinal;
|
|
LangItemArr: array of TLangItem;
|
|
LangArr: TParams;
|
|
i: Integer;
|
|
begin
|
|
iscf := nil;
|
|
if Succeeded(CoCreateInstance(CLASS_SpellCheckerFactory, nil, CLSCTX_INPROC_SERVER, IID_ISpellCheckerFactory, iscf)) and Assigned(iscf) then
|
|
begin
|
|
langs := nil;
|
|
iscf.Get_SupportedLanguages(langs);
|
|
if Assigned(langs) then
|
|
while langs.RemoteNext(1, lang, fetched) = S_OK do
|
|
begin
|
|
LangItem.lang := lang;
|
|
locid := Languages.LocaleIDFromName[lang];
|
|
if locid = 0 then
|
|
LangItem.locale := lang
|
|
else
|
|
LangItem.locale := Languages.NameFromLocaleID[locid];
|
|
SetLength(LangItemArr, Length(LangItemArr)+1);
|
|
LangItemArr[Length(LangItemArr)-1] := LangItem;
|
|
end;
|
|
|
|
SetLength(LangArr, Length(LangItemArr));
|
|
for i := 0 to Length(LangItemArr) - 1 do
|
|
LangArr[i] := UI.RecordToVar(LangItemArr[i]);
|
|
|
|
Call('refreshLangList', [LangArr])
|
|
end;
|
|
end;
|
|
|
|
procedure TPrefs.ResetLangs;
|
|
begin
|
|
Call('resetLangs', [spellLanguages.ToStringArray]);
|
|
Call('resetMainLang', [spellLanguageMain]);
|
|
end;
|
|
|
|
procedure TPrefs.SetActivePage(i: Integer);
|
|
begin
|
|
Call('setActivePageByIndex', [i]);
|
|
end;
|
|
|
|
procedure TPrefs.SetActivePage(const pn: String);
|
|
begin
|
|
Call('setActivePageByName', [pn]);
|
|
end;
|
|
|
|
procedure UpdatePrefsXY(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Rect: Variant;
|
|
I: Integer;
|
|
begin
|
|
S2V(argv, Rect);
|
|
I := 0;
|
|
PrefsXY.Left := Rect[0];
|
|
PrefsXY.Top := Rect[1];
|
|
PrefsXY.Width := Rect[2];
|
|
PrefsXY.Height := Rect[3];
|
|
end;
|
|
|
|
procedure SetViewMode(tag: Pointer; argc: UINT; argv: PSciterValue; retval: PSciterValue); cdecl;
|
|
var
|
|
Arr: array of TPrefPage;
|
|
Page: String;
|
|
FullMode: Boolean;
|
|
I: Integer;
|
|
begin
|
|
Page := SciterVarToString(argv);
|
|
Inc(argv);
|
|
I := 0;
|
|
API.ValueIntData(argv, I);
|
|
FullMode := I = 1;
|
|
|
|
SetLength(Arr, 0);
|
|
if not (Page = '') then
|
|
if not FullMode then
|
|
for I := 0 to Length(prefPages) - 1 do
|
|
if prefPages[i].name = Page then
|
|
begin
|
|
SetLength(arr, 1);
|
|
Arr[0] := prefPages[i];
|
|
Break;
|
|
end;
|
|
|
|
UI.Prefs.SetViewMode(arr);
|
|
UI.Prefs.SetActivePage(Page);
|
|
|
|
SetLength(arr, 0);
|
|
end;
|
|
|
|
initialization
|
|
|
|
|
|
AddPrefPage(1, 'Connection');
|
|
|
|
AddPrefPage(2, 'ICQ');
|
|
|
|
AddPrefPage(3, 'Anti-spam');
|
|
|
|
AddPrefPage(4, 'Auto-away');
|
|
|
|
AddPrefPage(5, 'Design');
|
|
|
|
AddPrefPage(6, 'Chat');
|
|
|
|
AddPrefPage(7, 'Tips');
|
|
|
|
AddPrefPage(10, 'Start');
|
|
|
|
AddPrefPage(15, 'Privacy & Security');
|
|
|
|
AddPrefPage(16, 'Hotkeys');
|
|
|
|
AddPrefPage(20, 'Events');
|
|
|
|
//AddPrefPage(21, 'Log packets & events');
|
|
|
|
AddPrefPage(30, 'Plugins');
|
|
|
|
AddPrefPage(95, 'Updates');
|
|
|
|
AddPrefPage(96, 'Theme editor');
|
|
|
|
AddPrefPage(99, 'Other');
|
|
|
|
|
|
end.
|
|
|