summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Actman/actman.dpr1
-rw-r--r--plugins/Actman30/actman.dpr254
-rw-r--r--plugins/Actman30/actman30.dpr1
-rw-r--r--plugins/Actman30/dlgshare.pas2
-rw-r--r--plugins/Actman30/i_cnst_database.inc7
-rw-r--r--plugins/Actman30/i_cnst_notes.inc3
-rw-r--r--plugins/Actman30/i_cnst_settings.inc1
-rw-r--r--plugins/Actman30/i_options.inc271
-rw-r--r--plugins/Actman30/iac_chain.pas15
-rw-r--r--plugins/Actman30/iac_contact.pas63
-rw-r--r--plugins/Actman30/iac_database.rc6
-rw-r--r--plugins/Actman30/iac_database.resbin3684 -> 3564 bytes
-rw-r--r--plugins/Actman30/iac_dbrw.pas166
-rw-r--r--plugins/Actman30/iac_global.pas43
-rw-r--r--plugins/Actman30/iac_ini.pas17
-rw-r--r--plugins/Actman30/iac_inout.pas34
-rw-r--r--plugins/Actman30/iac_jump.pas64
-rw-r--r--plugins/Actman30/iac_messagebox.pas4
-rw-r--r--plugins/Actman30/iac_notes.pas173
-rw-r--r--plugins/Actman30/iac_notes.rc13
-rw-r--r--plugins/Actman30/iac_notes.resbin0 -> 2844 bytes
-rw-r--r--plugins/Actman30/iac_program.pas29
-rw-r--r--plugins/Actman30/iac_service.pas94
-rw-r--r--plugins/Actman30/iac_settings.pas20
-rw-r--r--plugins/Actman30/iac_settings.rc5
-rw-r--r--plugins/Actman30/iac_settings.resbin3568 -> 3636 bytes
-rw-r--r--plugins/Actman30/iac_storage.pas6
-rw-r--r--plugins/Actman30/iac_text.pas28
-rw-r--r--plugins/Actman30/ico/notes.icobin0 -> 2550 bytes
-rw-r--r--plugins/Actman30/lowlevelc.pas6
-rw-r--r--plugins/ExternalAPI/delphi/m_actman.inc48
-rw-r--r--plugins/ExternalAPI/delphi/m_addcontactplus.inc29
-rw-r--r--plugins/ExternalAPI/delphi/m_alarms.inc57
-rw-r--r--plugins/ExternalAPI/delphi/m_assocmgr.inc8
-rw-r--r--plugins/ExternalAPI/delphi/m_avatarhistory.inc50
-rw-r--r--plugins/ExternalAPI/delphi/m_changekeyboardlayout.inc8
-rw-r--r--plugins/ExternalAPI/delphi/m_dbeditorpp.inc2
-rw-r--r--plugins/ExternalAPI/delphi/m_dropbox.inc26
-rw-r--r--plugins/ExternalAPI/delphi/m_flags.inc58
-rw-r--r--plugins/ExternalAPI/delphi/m_folders.inc10
-rw-r--r--plugins/ExternalAPI/delphi/m_ftpfile.inc101
-rw-r--r--plugins/ExternalAPI/delphi/m_historypp.inc124
-rw-r--r--plugins/ExternalAPI/delphi/m_historystats.inc6
-rw-r--r--plugins/ExternalAPI/delphi/m_httpserver.inc14
-rw-r--r--plugins/ExternalAPI/delphi/m_kbdnotify.inc12
-rw-r--r--plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc117
-rw-r--r--plugins/ExternalAPI/delphi/m_mydetails.inc2
-rw-r--r--plugins/ExternalAPI/delphi/m_notify.inc45
-rw-r--r--plugins/ExternalAPI/delphi/m_nudge.inc15
-rw-r--r--plugins/ExternalAPI/delphi/m_nxsn.inc20
-rw-r--r--plugins/ExternalAPI/delphi/m_quickcontacts.inc3
-rw-r--r--plugins/ExternalAPI/delphi/m_quotes.inc36
-rw-r--r--plugins/ExternalAPI/delphi/m_sendss.inc66
-rw-r--r--plugins/ExternalAPI/delphi/m_sessions.inc22
-rw-r--r--plugins/ExternalAPI/delphi/m_shutdown.inc25
-rw-r--r--plugins/ExternalAPI/delphi/m_simplestatusmsg.inc51
-rw-r--r--plugins/ExternalAPI/delphi/m_skin_eng.inc445
-rw-r--r--plugins/ExternalAPI/delphi/m_spellchecker.inc6
-rw-r--r--plugins/ExternalAPI/delphi/m_splash.inc11
-rw-r--r--plugins/ExternalAPI/delphi/m_statusplugins.inc9
-rw-r--r--plugins/ExternalAPI/delphi/m_stopspam.inc41
-rw-r--r--plugins/ExternalAPI/delphi/m_text.inc269
-rw-r--r--plugins/ExternalAPI/delphi/m_toptoolbar.inc2
-rw-r--r--plugins/ExternalAPI/delphi/m_versioninfo.inc4
-rw-r--r--plugins/ExternalAPI/delphi/m_winterspeak.inc5
-rw-r--r--plugins/ExternalAPI/delphi/m_yamn.inc43
-rw-r--r--plugins/ExternalAPI/delphi/m_yapp.inc18
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas2
-rw-r--r--plugins/QuickSearch/qs.rc12
-rw-r--r--plugins/QuickSearch/qs.resbin13144 -> 13308 bytes
-rw-r--r--plugins/QuickSearch/quicksearch.dpr4
-rw-r--r--plugins/QuickSearch/resource.inc3
-rw-r--r--plugins/QuickSearch/sr_frame.pas226
-rw-r--r--plugins/QuickSearch/sr_global.pas2
-rw-r--r--plugins/QuickSearch/sr_window.pas2
-rw-r--r--plugins/Utils.pas/CustomGraph.pas56
-rw-r--r--plugins/Utils.pas/appcmdapi.pas2
-rw-r--r--plugins/Utils.pas/contact.pas129
-rw-r--r--plugins/Utils.pas/datetime.pas58
-rw-r--r--plugins/Utils.pas/dbsettings.pas13
-rw-r--r--plugins/Utils.pas/inouttext.pas194
-rw-r--r--plugins/Utils.pas/kolsizer.pas2
-rw-r--r--plugins/Utils.pas/mircontacts.pas673
-rw-r--r--plugins/Utils.pas/mirevents.pas536
-rw-r--r--plugins/Utils.pas/mirutils.pas373
-rw-r--r--plugins/Utils.pas/rtfole.pas560
-rw-r--r--plugins/Utils.pas/rtfutils.pas586
-rw-r--r--plugins/Utils.pas/syswin.pas9
-rw-r--r--plugins/Utils.pas/tlb_richedit.pas898
-rw-r--r--plugins/Watrack/docs/sampledll.dpr33
-rw-r--r--plugins/Watrack/myshows/i_myshows_api.inc2
-rw-r--r--plugins/Watrack/proto/proto.pas2
-rw-r--r--plugins/Watrack/status/status.pas2
-rw-r--r--plugins/Watrack/watrack.dpr1
-rw-r--r--plugins/mRadio/mradio.dpr2
-rw-r--r--plugins/mRadio/rbass.pas10
-rw-r--r--plugins/mRadio/rccenter.pas2
-rw-r--r--plugins/mRadio/roptions.pas2
98 files changed, 6623 insertions, 907 deletions
diff --git a/plugins/Actman/actman.dpr b/plugins/Actman/actman.dpr
index 4a5c795bd1..e2a67414f5 100644
--- a/plugins/Actman/actman.dpr
+++ b/plugins/Actman/actman.dpr
@@ -45,6 +45,7 @@ uses
syswin,
question,
mApiCardM,
+ mircontacts,
global,
sedit,
strans,
diff --git a/plugins/Actman30/actman.dpr b/plugins/Actman30/actman.dpr
new file mode 100644
index 0000000000..d47d57c95a
--- /dev/null
+++ b/plugins/Actman30/actman.dpr
@@ -0,0 +1,254 @@
+{$include compilers.inc}
+{$IFDEF COMPILER_16_UP}
+ {$WEAKLINKRTTI ON}
+ {.$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
+{$ENDIF}
+{$IMAGEBASE $13200000}
+library actman;
+{%File 'm_actman.inc'}
+{%File 'i_const.inc'}
+{%File 'i_opt_dlg2.inc'}
+{%File 'i_opt_dlg.inc'}
+{%File 'i_options.inc'}
+{%File 'i_services.inc'}
+{%File 'i_vars.inc'}
+{%File 'i_inoutxm.inc'}
+{%File 'tasks\i_opt_dlg.inc'}
+{%File 'tasks\i_options.inc'}
+{%File 'tasks\i_task.inc'}
+{%File 'hooks\i_options.inc'}
+{%File 'hooks\i_hook.inc'}
+{%File 'hooks\i_opt_dlg.inc'}
+{%File 'ua\i_opt_dlg.inc'}
+{%File 'ua\i_inoutxm.inc'}
+{%File 'ua\i_options.inc'}
+{%File 'ua\i_ua.inc'}
+{%File 'ua\i_uaplaces.inc'}
+{%File 'ua\i_uconst.inc'}
+
+uses
+// fastmm4,
+ Windows,
+ m_api,
+ messages,
+ commctrl,
+ common,
+ wrapper,
+ io,
+ dbsettings,
+ mirutils,
+ syswin,
+ base64,
+ question,
+ mApiCardM,
+ global,
+ lowlevelc,
+ dlgshare,
+ iac_global,
+ iac_settings,
+ iac_storage,
+ iac_dbrw,
+ iac_messagebox,
+ iac_text,
+ iac_jump,
+ iac_inout,
+ iac_service,
+ iac_program,
+ iac_chain,
+ iac_contact,
+ iac_call,
+ iac_ini,
+ iac_notes,
+ inoutxml,
+ sedit,
+ strans,
+ ua in 'ua\ua.pas',
+ hooks in 'hooks\hooks.pas',
+ scheduler in 'tasks\scheduler.pas';
+
+{$r options.res}
+
+const
+ PluginName = 'Action Manager';
+var
+ hevaction,hHookChanged,hevinout:THANDLE;
+
+{$include m_actman.inc}
+
+
+function MirandaPluginInfoEx(mirandaVersion:dword):PPLUGININFOEX; cdecl;
+begin
+ result:=@PluginInfo;
+ PluginInfo.cbSize :=SizeOf(TPLUGININFOEX);
+ PluginInfo.shortName :='Action manager';
+ PluginInfo.version :=$00030001;
+ PluginInfo.description:='Plugin for manage hotkeys to open contact window, insert text, '+
+ 'run program and call services';
+ PluginInfo.author :='Awkward';
+ PluginInfo.authorEmail:='panda75@bk.ru; awk1975@ya.ru';
+ PluginInfo.copyright :='(c) 2007-2013 Awkward';
+ PluginInfo.homepage :='http://code.google.com/p/delphi-miranda-plugins/';
+ PluginInfo.flags :=UNICODE_AWARE;
+ PluginInfo.uuid :=MIID_ACTMAN;
+end;
+
+{$include i_const.inc}
+
+{$include i_options.inc}
+{$include i_services.inc}
+{$include i_opt_dlg.inc}
+{.$include i_inoutxm.inc}
+
+function PreShutdown(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ ptr:pActionLink;
+begin
+ result:=0;
+
+ ptr:=ActionLink;
+ while ptr<>nil do
+ begin
+ if @ptr^.DeInit<>nil then
+ ptr^.DeInit;
+ ptr:=ptr^.Next;
+ end;
+
+ MacroList.Clear;
+ MacroList.Free;
+
+ DestroyHookableEvent(hHookChanged);
+ DestroyHookableEvent(hevinout);
+ DestroyHookableEvent(hevaction);
+
+end;
+
+procedure RegisterActTypes;
+var
+ p:pActModule;
+ sid:TSKINICONDESC;
+ buf:array [0..63] of AnsiChar;
+ pc:pAnsiChar;
+// ii:tIconItem;
+begin
+ FillChar(sid,SizeOf(sid),0);
+ sid.cbSize:=SizeOf(sid);
+ sid.cx:=16;
+ sid.cy:=16;
+ sid.szSection.a:='Actions';
+ sid.pszName :=@buf;
+ pc:=StrCopyE(buf,IcoLibPrefix);
+ p:=ModuleLink;
+{
+ ii.size :=0;
+ ii.hIcolib:=0;
+ ii.szName :=@buf;
+}
+ while p<>nil do
+ begin
+ if p^.Hash=0 then
+ p^.Hash:=Hash(p^.Name,StrLen(p^.Name));
+ //!! must add icon registration in icolib
+{
+ StrCopy(pc,p^.Name);
+ ii.szDescr :=p^.Name;
+ ii.DefIconID:=;
+ Icon_Register(hInstance,'Actions',@ii,1);
+}
+ sid.hDefaultIcon :=LoadImageA(hInstance,p^.Icon,IMAGE_ICON,16,16,0);
+ sid.szDescription.a:=p^.Name;
+ StrCopy(pc,p^.Name);
+ Skin_AddIcon(@sid);
+ DestroyIcon(sid.hDefaultIcon);
+
+ p:=p^.Next;
+ end;
+end;
+
+// This function implements autostart action execution after all others plugins loading
+function DoAutostart(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ i:integer;
+ Macro:pMacroRecord;
+ section:array [0..127] of AnsiChar;
+ p,p1:pAnsiChar;
+begin
+ Result:=0;
+ CallService(MS_ACT_RUNBYNAME,TWPARAM(AutoStartName),0);
+
+ p1:=StrCopyE(section,opt_group);
+ for i:=0 to MacroList.Count-1 do
+ begin
+ Macro:=MacroList[i];
+ if (Macro^.flags and ACF_FIRSTRUN)<>0 then
+ begin
+ CallService(MS_ACT_RUNBYID,TWPARAM(Macro^.id),0);
+ Macro^.flags:=Macro^.flags and not ACF_FIRSTRUN;
+ p:=StrEnd(IntToStr(p1,i));
+ p^:='/'; inc(p);
+ StrCopy(p,opt_flags); DBWriteDWord(0,DBBranch,section,Macro^.flags);
+ end;
+ end;
+end;
+
+function OnModulesLoaded(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ ptr:pActionLink;
+begin
+ Result:=0;
+
+ RegisterActTypes;
+
+ LoadMacros;
+ RegisterIcons;
+
+ HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
+ HookEvent(ME_SYSTEM_SHUTDOWN{ME_SYSTEM_OKTOEXIT},@PreShutdown);
+ NotifyEventHooks(hHookChanged,twparam(ACTM_LOADED),0);
+
+ IsMultiThread:=true;
+ // Load additional modules
+ ptr:=ActionLink;
+ while ptr<>nil do
+ begin
+ if @ptr^.Init<>nil then
+ ptr^.Init;
+ ptr:=ptr^.Next;
+ end;
+
+ // cheat
+ HookEvent(ME_SYSTEM_MODULESLOADED,@DoAutostart);
+// DoAutostart(0,0);
+end;
+
+function Load:int; cdecl;
+begin
+ Result:=0;
+ Langpack_Register;
+
+ hHookChanged:=CreateHookableEvent(ME_ACT_CHANGED);
+ hevinout :=CreateHookableEvent(ME_ACT_INOUT);
+ hevaction :=CreateHookableEvent(ME_ACT_ACTION);
+
+ CreateServiceFunction(MS_ACT_FREELIST ,@ActFreeList);
+ CreateServiceFunction(MS_ACT_GETLIST ,@ActGetList);
+ CreateServiceFunction(MS_ACT_RUNBYID ,@ActRun);
+ CreateServiceFunction(MS_ACT_RUNBYNAME,@ActRunGroup);
+ CreateServiceFunction(MS_ACT_RUNPARAMS,@ActRunParam);
+//!! CreateServiceFunction(MS_ACT_INOUT ,@ActInOut);
+ CreateServiceFunction(MS_ACT_SELECT ,@ActSelect);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED,@OnModulesLoaded);
+end;
+
+function Unload: int; cdecl;
+begin
+ Result:=0;
+end;
+
+exports
+ Load, Unload,
+ MirandaPluginInfoEx;
+
+begin
+ DisableThreadLibraryCalls(hInstance);
+end.
diff --git a/plugins/Actman30/actman30.dpr b/plugins/Actman30/actman30.dpr
index 55f510418a..d47d57c95a 100644
--- a/plugins/Actman30/actman30.dpr
+++ b/plugins/Actman30/actman30.dpr
@@ -58,6 +58,7 @@ uses
iac_contact,
iac_call,
iac_ini,
+ iac_notes,
inoutxml,
sedit,
strans,
diff --git a/plugins/Actman30/dlgshare.pas b/plugins/Actman30/dlgshare.pas
index cd6dbb9023..0fc89a975b 100644
--- a/plugins/Actman30/dlgshare.pas
+++ b/plugins/Actman30/dlgshare.pas
@@ -27,7 +27,7 @@ procedure OptFillContactList(wnd:HWND);
implementation
-uses messages, m_api, dbsettings, contact, common, global;
+uses messages, m_api, dbsettings, mircontacts, common, global;
{$include i_cnst_dlgshare.inc}
{$resource dlgshare.res}
diff --git a/plugins/Actman30/i_cnst_database.inc b/plugins/Actman30/i_cnst_database.inc
index 01b6e382c5..0727d68451 100644
--- a/plugins/Actman30/i_cnst_database.inc
+++ b/plugins/Actman30/i_cnst_database.inc
@@ -7,10 +7,9 @@ const
IDC_RW_SETTING = 2608;
IDC_RW_VALUE = 2610;
IDC_RW_DATATYPE = 2611;
- IDC_RW_CURRENT = 2614;
- IDC_RW_PARAM = 2615;
- IDC_RW_MANUAL = 2616;
- IDC_RW_RESULT = 2619;
+
+ IDC_CONTACTTYPE = 2614;
+
IDC_RW_LAST = 2620;
IDC_RW_SAVE = 2621;
diff --git a/plugins/Actman30/i_cnst_notes.inc b/plugins/Actman30/i_cnst_notes.inc
new file mode 100644
index 0000000000..d7e779210d
--- /dev/null
+++ b/plugins/Actman30/i_cnst_notes.inc
@@ -0,0 +1,3 @@
+{text data}
+const
+ IDC_TXT_TEXT = 2190;
diff --git a/plugins/Actman30/i_cnst_settings.inc b/plugins/Actman30/i_cnst_settings.inc
index 6728f953a9..c8c495a24a 100644
--- a/plugins/Actman30/i_cnst_settings.inc
+++ b/plugins/Actman30/i_cnst_settings.inc
@@ -9,3 +9,4 @@ const
IDC_FR_FLAG = 2155;
IDC_HC_WPAR = 2156;
+ IDC_VL_FLAG = 2157;
diff --git a/plugins/Actman30/i_options.inc b/plugins/Actman30/i_options.inc
index 3a3d8dc65a..7cbfe6716d 100644
--- a/plugins/Actman30/i_options.inc
+++ b/plugins/Actman30/i_options.inc
@@ -78,16 +78,264 @@ begin
DBWriteWord(0,DBBranch,opt_nummacro,NumMacro);
end;
-//----- Load settings -----
+//===== Load settings =====
-function LoadActions(Macro:pMacroRecord;section:pAnsiChar):integer;
+//----- V2 settings processing -----
+
+const
+ ACT_CONTACT = 1;
+ ACT_SERVICE = 2;
+ ACT_PROGRAM = 3;
+ ACT_TEXT = 4;
+ ACT_ADVANCE = 5;
+ ACT_CHAIN = 6;
+ ACT_RW = 7;
+ ACT_MESSAGE = 8;
+
+// action flags
+const
+ ACF_MASK = $00FFFFFF;
+
+ ACF_OLD_CLIPBRD = $00000002; // Clipboard operations, not window
+ ACF_OLD_FILE = $00000010; // File operations
+ ACF_OLD_FWRITE = $00000020; // read/write file
+ ACF_OLD_FAPPEND = $00000040; // append file
+
+procedure CheckActionList(Macro:pMacroRecord;num:integer);
+var
+ tmplist:pActionList;
+begin
+ if num=Macro^.ActionCount then
+ begin
+ GetMem(tmplist,SizeOf(tBaseAction)*(num+1));
+ move(Macro^.ActionList^,tmplist^,Macro^.ActionCount*SizeOf(tBaseAction));
+ FreeMem(Macro^.ActionList);
+ Macro^.ActionList:=tmplist;
+ Inc(Macro^.ActionCount);
+ end;
+end;
+
+function LoadActionsV2(Macro:pMacroRecord;section:pAnsiChar):boolean; stdcall;
+var
+ buf:array [0..31] of WideChar;
+ p,p1,pc:PAnsiChar;
+ action:tBaseAction;
+ actm:pActModule;
+ flags2,actionType:dword;
+ code,i,num,count:integer;
+ cond,act:byte;
+begin
+ result:=false;
+ p:=StrEnd(section);
+ StrCopy(p,opt_numacts); Macro^.ActionCount:=DBReadWord(0,DBBranch,section);
+
+ if Macro^.ActionCount>0 then
+ begin
+ GetMem(Macro^.ActionList,SizeOf(tBaseAction)*Macro^.ActionCount);
+ p1:=StrCopyE(p,opt_actions); // "Group#/Action"
+
+ num:=0;
+ count:=Macro^.ActionCount;
+ for i:=1 to count do
+ begin
+ p:=StrEnd(IntToStr(p1,i));
+ p^:='/'; inc(p); // "Group#/Action#/"
+
+ StrCopy(p,'type' ); actionType:=DBReadByte (0,DBBranch,section,ACT_CONTACT);
+ case actionType of
+ ACT_CONTACT: pc:='Contact';
+ ACT_SERVICE: pc:='Service';
+ ACT_PROGRAM: pc:='Program';
+ ACT_TEXT: pc:=nil;
+ ACT_ADVANCE: pc:=nil;
+ ACT_CHAIN: pc:='Chain';
+ ACT_RW: pc:='Database';
+ ACT_MESSAGE: pc:='MessageBox';
+ else
+ pc:=nil;
+ end;
+ if pc<>nil then
+ begin
+ actm :=GetLinkByName(pc);
+ action:=actm.Create;
+ end
+ else
+ begin
+ action:=nil;
+ end;
+
+ p^:=#0;
+ case actionType of
+ ACT_CONTACT: begin
+ action.Load(section,0);
+ end;
+
+ ACT_SERVICE: begin
+ action.Load(section,100);
+ end;
+
+ ACT_PROGRAM: begin
+ action.Load(section,100);
+ end;
+
+ ACT_TEXT: begin
+ StrCopy(p,opt_flags); flags2:=DBReadDWord(0,DBBranch,section,0);
+ p^:=#0;
+ if ((flags2 and ACF_OLD_CLIPBRD)=0) then
+ begin
+ if ((flags2 and ACF_OLD_FILE)=0) or ((flags2 and (ACF_OLD_FWRITE or ACF_OLD_FAPPEND)<>0)) then
+ begin
+ actm :=GetLinkByName('Text');
+ action:=actm.Create;
+
+ action.Load(section,100);
+
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+ end;
+ end;
+
+ actm :=GetLinkByName('In/Out');
+ action:=actm.Create;
+
+ action.Load(section,100);
+ end;
+
+ ACT_ADVANCE: begin
+ StrCopy(p,'condition' ); cond:=DBReadByte(0,DBBranch,section);
+ StrCopy(p,'action'); act :=DBReadByte(0,DBBranch,section);
+ p^:=#0;
+ // get code of my list
+ code:=0;
+ if (cond and $0F)=0 then
+ begin
+ if act<>0 then code:=4; // action and jump
+ if (act and $F0)=0 then code:=6; // no action
+ if (act and $0F)=0 then code:=5; // no jump
+ end
+ else // with condition
+ begin
+ if act<>0 then code:=1; // action and jump
+ if (act and $F0)=0 then code:=2; // no action
+ if (act and $0F)=0 then code:=3; // no jump
+ end;
+ case code of
+ 1: begin // conditional action and jump
+ actm :=GetLinkByName('Jump'); // reversed condition jump to tmplabel
+ action:=actm.Create;
+ action.Load(section,102+i);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Text'); // action
+ action:=actm.Create;
+ action.Load(section,101);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Jump'); // jump to label (no condition)
+ action:=actm.Create;
+ action.Load(section,101);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Notes'); // tmplabel
+ action:=actm.Create;
+ mFreeMem(action.ActionDescr); // created by constructor
+ buf[0]:='$'; buf[1]:='$';
+ IntToStr(PWideChar(@buf[2]),i);
+ StrDupW(action.ActionDescr,buf);
+ end;
+ 2,6: begin // conditional and unconditional jump
+ actm :=GetLinkByName('Jump');
+ action:=actm.Create;
+
+ action.Load(section,100);
+ end;
+ 3: begin // conditional action
+ actm :=GetLinkByName('Jump');
+ action:=actm.Create;
+ action.Load(section,101+num);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Text');
+ action:=actm.Create;
+ action.Load(section,101);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Notes');
+ action:=actm.Create;
+ mFreeMem(action.ActionDescr); // created by constructor
+ buf[0]:='$'; buf[1]:='$';
+ StrDupW(action.ActionDescr,IntToStr(PWideChar(@buf[2]),num));
+ end;
+ 4: begin // action + unconditional jump
+ actm :=GetLinkByName('Text');
+ action:=actm.Create;
+ action.Load(section,101);
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+
+ actm :=GetLinkByName('Jump');
+ action:=actm.Create;
+
+ action.Load(section,100);
+ end;
+ 5: begin // direct text action
+ actm :=GetLinkByName('Text');
+ action:=actm.Create;
+
+ action.Load(section,101);
+ end;
+ end;
+ end;
+
+ ACT_CHAIN: begin
+ action.Load(section,100);
+ end;
+
+ ACT_RW: begin
+ action.Load(section,100);
+ end;
+
+ ACT_MESSAGE: begin
+ action.Load(section,0);
+
+ StrCopy(p,'flags2'); flags2:=DBReadDWord(0,DBBranch,section,0);
+ action.flags:=(action.flags and not ACF_MASK) or flags2;
+ end;
+
+ end;
+
+ if action<>nil then
+ begin
+ CheckActionList(Macro,num);
+ Macro^.ActionList^[num]:=action;
+ inc(num);
+ end;
+ end;
+ end;
+end;
+
+//----- V3 settings processing -----
+
+function LoadActions(Macro:pMacroRecord;section:pAnsiChar):integer; stdcall;
var
p,p1:PAnsiChar;
- i,num:integer;
actm:pActModule;
action:tBaseAction;
- uid:dword;
tmp:pActionList;
+ uid:dword;
+ i,num:integer;
begin
result:=0;
p:=StrEnd(section);
@@ -135,12 +383,18 @@ end;
procedure LoadMacros;
var
Macro:pMacroRecord;
- i:cardinal;
p,p1:PAnsiChar;
section:array [0..127] of AnsiChar;
- NumMacros:cardinal;
tmp:pWideChar;
+ i:cardinal;
+ NumMacros:cardinal;
+ v2:bool;
begin
+ //!! Check if old actman version used
+// v2:=DBReadWord(0,DBBranch,opt_numacts,$FFFF)<>$FFFF;
+ // V2 counts actions from 1, not 0
+ v2:=DBReadDWord(0,DBBranch,'Group0/Action0/flags',$FFFFFFFF)=$FFFFFFFF;
+
// Allocate macro list
NumMacros :=DBReadWord(0,DBBranch,opt_nummacro,0);
MacroList:=tMacroList.Create(NumMacros);
@@ -167,7 +421,10 @@ begin
StrCopyW(descr,tmp,MacroNameLen-1);
mFreeMem(tmp);
p^:=#0;
- LoadActions(Macro,section);
+ if v2 then
+ LoadActionsV2(Macro,section)
+ else
+ LoadActions(Macro,section);
end;
end;
inc(Macro);
diff --git a/plugins/Actman30/iac_chain.pas b/plugins/Actman30/iac_chain.pas
index 39e03e13b8..ec695f3077 100644
--- a/plugins/Actman30/iac_chain.pas
+++ b/plugins/Actman30/iac_chain.pas
@@ -6,7 +6,7 @@ implementation
uses
windows, messages, commctrl,
- global, iac_global, mirutils, m_api,
+ global, iac_global, mirutils, m_api, inouttext,
dlgshare,lowlevelc,common,dbsettings, wrapper;
{$include m_actman.inc}
@@ -135,6 +135,12 @@ begin
end;
end;
+ 100: begin
+ flags:=flags and not ACF_BYNAME;
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,'text'); id:=DBReadDWord(0,DBBranch,section);
+ end;
+
1: begin
with xmlparser do
begin
@@ -205,6 +211,13 @@ begin
]);
end;
}
+ 13: begin
+ tTextExport(node).AddTextW('actionname',actname);
+ tTextExport(node).AddFlag('samethread',(flags or ACF_SAMETHREAD)<>0);
+ tTextExport(node).AddFlag('nowait' ,(flags or ACF_NOWAIT )<>0);
+ tTextExport(node).AddFlag('keepold' ,(flags or ACF_KEEPOLD )<>0);
+ tTextExport(node).AddNewLine();
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_contact.pas b/plugins/Actman30/iac_contact.pas
index 318dc8601e..c0a0740995 100644
--- a/plugins/Actman30/iac_contact.pas
+++ b/plugins/Actman30/iac_contact.pas
@@ -7,7 +7,7 @@ implementation
uses
windows, messages, commctrl,
m_api, global, iac_global, common,
- contact, dlgshare, syswin,
+ mircontacts, dlgshare, syswin, inouttext, base64,
wrapper, mirutils, dbsettings;
{$include i_cnst_contact.inc}
@@ -106,6 +106,62 @@ begin
end;
end;
+function ExportContactText(node:tTextExport;hContact:TMCONTACT):integer;
+var
+ proto,uid:pAnsiChar;
+ cws:TDBVARIANT;
+ p1:pAnsiChar;
+ p:pWideChar;
+ tmpbuf:array [0..63] of WideChar;
+ is_chat:boolean;
+begin
+ result:=0;
+ proto:=GetContactProtoAcc(hContact);
+ if proto<>nil then
+ begin
+ is_chat:=IsChat(hContact);
+ if is_chat then
+ begin
+ p:=DBReadUnicode(hContact,proto,'ChatRoomID');
+ node.AddTextW('id',p);
+ mFreeMem(p);
+ result:=1;
+ end
+ else
+ begin
+ uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
+ if DBReadSetting(hContact,proto,uid,@cws)=0 then
+ begin
+ result:=1;
+ node.AddDWord('ctype',cws._type);
+ case cws._type of
+ DBVT_BYTE : node.AddDWord('id',cws.bVal);
+ DBVT_WORD : node.AddDWord('id',cws.wVal);
+ DBVT_DWORD : node.AddDWord('id',cws.dVal);
+ DBVT_ASCIIZ: begin
+ node.AddText('id',cws.szVal.A); // ansi to utf
+ end;
+ DBVT_UTF8 : begin
+ node.AddText('id',cws.szVal.A);
+ end;
+ DBVT_WCHAR : node.AddTextW('id',cws.szVal.W);
+ DBVT_BLOB : begin
+ p1:=Base64Encode(cws.pbVal,cws.cpbVal);
+ node.AddText('id',p1);
+ mFreeMem(p1);
+ end;
+ end;
+ end;
+ DBFreeVariant(@cws);
+ end;
+ if result<>0 then
+ begin
+ node.AddText('protocol',proto);
+ node.AddFlag('ischat' ,is_chat);
+ end;
+ end;
+end;
+
procedure tContactAction.Save(node:pointer;fmt:integer);
begin
inherited Save(node,fmt);
@@ -120,6 +176,11 @@ begin
if (flags and ACF_KEEPONLY)<>0 then AddAttrInt(sub,ioKeepOnly,1);
end;
}
+ 13: begin
+ tTextExport(node).AddFlag('keeponly' ,(flags or ACF_KEEPONLY )<>0);
+ tTextExport(node).AddFlag('getactive',(flags or ACF_GETACTIVE)<>0);
+ ExportContactText(tTextExport(node),contact);
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_database.rc b/plugins/Actman30/iac_database.rc
index 5c5fe1f791..cc9f309ebf 100644
--- a/plugins/Actman30/iac_database.rc
+++ b/plugins/Actman30/iac_database.rc
@@ -7,10 +7,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
{
- AUTORADIOBUTTON "Own settings", IDC_RW_CURRENT, 1, 0, 81, 11, BS_RIGHT | BS_LEFTTEXT | WS_GROUP
- AUTORADIOBUTTON "Manual" , IDC_RW_MANUAL , 1, 12, 81, 11, BS_RIGHT | BS_LEFTTEXT
- AUTORADIOBUTTON "Parameter" , IDC_RW_PARAM , 86, 0, 81, 11
- AUTORADIOBUTTON "Last result" , IDC_RW_RESULT , 86, 12, 81, 11
+ RTEXT "Contact type", -1, 1, 0, 160, 8, SS_CENTERIMAGE
+ COMBOBOX IDC_CONTACTTYPE , 18, 9, 148, 60, CBS_DROPDOWNLIST | WS_VSCROLL
CONTROL "Refresh",IDC_CNT_REFRESH,"MButtonClass",WS_TABSTOP,1,23,16,16,$18000000
COMBOBOX IDC_CONTACTLIST, 18, 25, 148, 128, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL
diff --git a/plugins/Actman30/iac_database.res b/plugins/Actman30/iac_database.res
index b74dee1d7b..b4de95c9e7 100644
--- a/plugins/Actman30/iac_database.res
+++ b/plugins/Actman30/iac_database.res
Binary files differ
diff --git a/plugins/Actman30/iac_dbrw.pas b/plugins/Actman30/iac_dbrw.pas
index c4224f91b2..7ddbe0b61c 100644
--- a/plugins/Actman30/iac_dbrw.pas
+++ b/plugins/Actman30/iac_dbrw.pas
@@ -9,7 +9,7 @@ uses
global, iac_global,
m_api,dbsettings,
common,mirutils,wrapper,
- editwrapper,contact,dlgshare;
+ editwrapper,mircontacts,dlgshare;
{$include i_cnst_database.inc}
{$resource iac_database.res}
@@ -65,6 +65,23 @@ const
ACF_RW_SETTING = $00002000; // script for setting name
ACF_RW_VALUE = $00004000; // script for data value
+const // V2
+ ACF_OLD_DBWRITE = $00000001;
+ ACF_OLD_DBBYTE = $00000002;
+ ACF_OLD_DBWORD = $00000004;
+ ACF_OLD_PARAM = $00000008;
+ ACF_OLD_CURRENT = $00000010;
+ ACF_OLD_RESULT = $00000020;
+ ACF_OLD_LAST = $00000040;
+ ACF_OLD_DBUTEXT = $00000080;
+ ACF_OLD_DBANSI = $00000082;
+ ACF_OLD_DBDELETE = $00000100;
+ ACF_OLD_NOCNTCT = ACF_OLD_PARAM or ACF_OLD_CURRENT or ACF_OLD_RESULT;
+
+ ACF2_RW_MVAR = $00000001;
+ ACF2_RW_SVAR = $00000002;
+ ACF2_RW_TVAR = $00000004;
+
type
tDataBaseAction = class(tBaseAction)
private
@@ -134,6 +151,11 @@ var
avalue:uint_ptr;
begin
result:=0;
+
+ if dbmodule=nil then
+ exit;
+ if (dbsetting=nil) and ((flags and ACF_DBDELETE)=0) then
+ exit;
// contact
case (flags and ACF_NOCONTACT) of
ACF_CURRENT: hContact:=0;
@@ -168,23 +190,30 @@ begin
StrReplace(ambuf,protostr,proto);
// now process settings
- if (flags and ACF_RW_SETTING)<>0 then
+ if dbsetting<>nil then
begin
- tmp:=ParseVarString(dbsetting,hContact,ls);
- StrCopyW(bufw,tmp);
- mFreeMem(tmp);
+ if (flags and ACF_RW_SETTING)<>0 then
+ begin
+ tmp:=ParseVarString(dbsetting,hContact,ls);
+ StrCopyW(bufw,tmp);
+ mFreeMem(tmp);
+ end
+ else
+ StrCopyW(bufw,dbsetting);
+ StrReplaceW(@bufw,'<last>',ls);
+ FastWideToAnsiBuf(bufw,asbuf,SizeOf(asbuf)-1);
+ StrReplace(asbuf,protostr,proto);
end
else
- StrCopyW(bufw,dbsetting);
- StrReplaceW(@bufw,'<last>',ls);
- FastWideToAnsiBuf(bufw,asbuf,SizeOf(asbuf)-1);
- StrReplace(asbuf,protostr,proto);
+ asbuf[0]:=#0;
// Delete data
if (flags and ACF_DBDELETE)<>0 then
begin
if (asbuf[0]='*') or (asbuf[StrLen(asbuf)-1]='*') then
DBDeleteGroup(hContact,ambuf,asbuf)
+ else if asbuf[0]=#0 then
+ DBDeleteModule(hContact,ambuf)
else
DBDeleteSetting(hContact,ambuf,asbuf);
end
@@ -302,8 +331,10 @@ end;
procedure tDataBaseAction.Load(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
+ buf:array [0..31] of WideChar;
pc:pAnsiChar;
tmp:pWideChar;
+ lflags,flags2:dword;
begin
inherited Load(node,fmt);
case fmt of
@@ -313,13 +344,50 @@ begin
pc:=StrCopyE(section,pAnsiChar(node));
StrCopy(pc,opt_module ); dbmodule :=DBReadUnicode(0,DBBranch,section);
StrCopy(pc,opt_setting); dbsetting:=DBReadUnicode(0,DBBranch,section);
- if ((flags and ACF_DBDELETE)=0) and
- ((flags and ACF_LAST)=0) then
+ if (flags and (ACF_DBDELETE or ACF_LAST))=0 then
begin
StrCopy(pc,opt_value); dbvalue:=DBReadUnicode(0,DBBranch,section);
end;
end;
+ 100: begin
+ if (flags and ACF_OLD_NOCNTCT)=0 then
+ dbcontact:=LoadContact(DBBranch,node);
+ pc:=StrCopyE(section,pAnsiChar(node));
+
+ // auto convert ansi to unicode
+ StrCopy(pc,opt_module ); dbmodule :=DBReadUnicode(0,DBBranch,section);
+ StrCopy(pc,opt_setting); dbsetting:=DBReadUnicode(0,DBBranch,section);
+
+ StrCopy(pc,'flags2'); flags2:=DBReadDWord(0,DBBranch,section,0);
+
+ if (flags and (ACF_OLD_DBDELETE or ACF_OLD_LAST))=0 then
+ begin
+ StrCopy(pc,opt_value);
+ if ((flags and ACF_OLD_DBUTEXT)=0) and ((flags2 and ACF2_RW_TVAR)=0) then
+ StrDupW(dbvalue,IntToStr(buf,DBReadDWord(0,DBBranch,section)))
+ else
+ dbvalue:=DBReadUnicode(0,DBBranch,section);
+ end;
+
+ lflags:=flags;
+ flags:=flags and not ACF_MASK;
+ if (lflags and ACF_OLD_DBWRITE )<>0 then flags:=flags or ACF_DBWRITE;
+ if (lflags and ACF_OLD_DBDELETE)<>0 then flags:=flags or ACF_DBDELETE;
+ if (lflags and ACF_OLD_PARAM )<>0 then flags:=flags or ACF_PARAM;
+ if (lflags and ACF_OLD_CURRENT )<>0 then flags:=flags or ACF_CURRENT;
+ if (lflags and ACF_OLD_RESULT )<>0 then flags:=flags or ACF_RESULT;
+ if (lflags and ACF_OLD_LAST )<>0 then flags:=flags or ACF_LAST;
+ if (lflags and ACF_OLD_DBBYTE )=ACF_OLD_DBBYTE then flags:=flags or ACF_DBBYTE;
+ if (lflags and ACF_OLD_DBWORD )=ACF_OLD_DBWORD then flags:=flags or ACF_DBWORD;
+ if (lflags and ACF_OLD_DBUTEXT )=ACF_OLD_DBUTEXT then flags:=flags or ACF_DBUTEXT;
+ if (lflags and ACF_OLD_DBANSI )=ACF_OLD_DBANSI then flags:=(flags or ACF_DBANSI) and not (ACF_DBBYTE or ACF_DBUTEXT);
+ if (flags2 and ACF2_RW_MVAR)<>0 then flags:=flags or ACF_RW_MODULE;
+ if (flags2 and ACF2_RW_SVAR)<>0 then flags:=flags or ACF_RW_SETTING;
+ if (flags2 and ACF2_RW_TVAR)<>0 then flags:=flags or ACF_RW_VALUE;
+
+ end;
+
1: begin
with xmlparser do
begin
@@ -420,11 +488,23 @@ begin
1: begin
end;
}
+ 13: begin
+ end;
end;
end;
//----- Dialog realization -----
+procedure MakeContactTypeList(wnd:HWND);
+begin
+ SendMessage(wnd,CB_RESETCONTENT,0,0);
+ InsertString(wnd,0,'Own settings');
+ InsertString(wnd,1,'Parameter');
+ InsertString(wnd,2,'Last result');
+ InsertString(wnd,3,'Manual');
+ SendMessage(wnd,CB_SETCURSEL,0,0);
+end;
+
procedure MakeDataTypeList(wnd:HWND);
begin
SendMessage(wnd,CB_RESETCONTENT,0,0);
@@ -441,11 +521,6 @@ begin
CheckDlgButton(Dialog,IDC_RW_LAST,BST_UNCHECKED);
CheckDlgButton(Dialog,IDC_RW_SAVE,BST_UNCHECKED);
- CheckDlgButton(Dialog,IDC_RW_CURRENT,BST_UNCHECKED);
- CheckDlgButton(Dialog,IDC_RW_MANUAL ,BST_UNCHECKED);
- CheckDlgButton(Dialog,IDC_RW_PARAM ,BST_UNCHECKED);
- CheckDlgButton(Dialog,IDC_RW_RESULT ,BST_UNCHECKED);
-
CheckDlgButton(Dialog,IDC_RW_READ ,BST_UNCHECKED);
CheckDlgButton(Dialog,IDC_RW_WRITE ,BST_UNCHECKED);
CheckDlgButton(Dialog,IDC_RW_DELETE,BST_UNCHECKED);
@@ -466,7 +541,8 @@ begin
WM_INITDIALOG: begin
TranslateDialogDefault(Dialog);
- MakeDataTypeList(GetDlgItem(Dialog,IDC_RW_DATATYPE));
+ MakeContactTypeList(GetDlgItem(Dialog,IDC_CONTACTTYPE));
+ MakeDataTypeList (GetDlgItem(Dialog,IDC_RW_DATATYPE));
wnd:=GetDlgItem(Dialog,IDC_CNT_REFRESH);
OptSetButtonIcon(wnd,ACI_REFRESH);
@@ -492,18 +568,18 @@ begin
// contact
bb:=false;
+ wnd:=GetDlgItem(Dialog,IDC_CONTACTLIST);
case (flags and ACF_NOCONTACT) of
- ACF_CURRENT: i:=IDC_RW_CURRENT;
- ACF_PARAM : i:=IDC_RW_PARAM;
- ACF_RESULT : i:=IDC_RW_RESULT;
+ ACF_CURRENT: i:=0;
+ ACF_PARAM : i:=1;
+ ACF_RESULT : i:=2;
else
- i:=IDC_RW_MANUAL;
+ i:=3;
bb:=true;
- SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_SETCURSEL,
- FindContact(GetDlgItem(Dialog,IDC_CONTACTLIST),dbcontact),0);
+ SendMessage(wnd,CB_SETCURSEL,FindContact(wnd,dbcontact),0);
end;
- CheckDlgButton(Dialog,i,BST_CHECKED);
- EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),bb);
+ CB_SelectData(GetDlgItem(Dialog,IDC_CONTACTTYPE),i);
+ EnableWindow(wnd,bb);
SetDlgItemTextW(Dialog,IDC_RW_MODULE ,dbmodule);
SetDlgItemTextW(Dialog,IDC_RW_SETTING,dbsetting);
@@ -545,6 +621,8 @@ begin
NoProcess:=true;
ClearFields(Dialog);
+ CB_SelectData(GetDlgItem(Dialog,IDC_CONTACTTYPE),0);
+
SetDlgItemTextW(Dialog,IDC_RW_MODULE ,nil);
SetDlgItemTextW(Dialog,IDC_RW_SETTING,nil);
SetDlgItemTextW(Dialog,IDC_RW_VALUE ,nil);
@@ -554,7 +632,7 @@ begin
CB_SelectData(GetDlgItem(Dialog,IDC_RW_DATATYPE),0);
CheckDlgButton(Dialog,IDC_RW_READ ,BST_CHECKED);
- CheckDlgButton(Dialog,IDC_RW_MANUAL,BST_CHECKED);
+ CheckDlgButton(Dialog,IDC_RW_SAVE ,BST_CHECKED);
EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),true);
EnableWindow(GetDlgItem(Dialog,IDC_RW_VALUE),true);
@@ -565,12 +643,16 @@ begin
with tDataBaseAction(lParam) do
begin
// contact
- if IsDlgButtonChecked(Dialog,IDC_RW_CURRENT)=BST_CHECKED then flags:=flags or ACF_CURRENT
- else if IsDlgButtonChecked(Dialog,IDC_RW_RESULT )=BST_CHECKED then flags:=flags or ACF_RESULT
- else if IsDlgButtonChecked(Dialog,IDC_RW_PARAM )=BST_CHECKED then flags:=flags or ACF_PARAM
- else
- dbcontact:=SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_GETITEMDATA,
- SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_GETCURSEL,0,0),0);
+ i:=CB_GetData(GetDlgItem(Dialog,IDC_CONTACTTYPE));
+ case i of
+ 0: flags:=flags or ACF_CURRENT;
+ 1: flags:=flags or ACF_PARAM;
+ 2: flags:=flags or ACF_RESULT;
+ 3: begin
+ wnd:=GetDlgItem(Dialog,IDC_CONTACTLIST);
+ dbcontact:=SendMessage(wnd,CB_GETITEMDATA,SendMessage(wnd,CB_GETCURSEL,0,0),0);
+ end;
+ end;
{mFreeMem(dbmodule ); }dbmodule :=GetDlgText(Dialog,IDC_RW_MODULE);
{mFreeMem(dbsetting); }dbsetting:=GetDlgText(Dialog,IDC_RW_SETTING);
@@ -606,7 +688,21 @@ begin
WM_COMMAND: begin
case wParam shr 16 of
- CBN_SELCHANGE,
+ CBN_SELCHANGE: begin
+ if loword(wParam)=IDC_CONTACTTYPE then
+ begin
+ i:=CB_GetData(lParam);
+ case i of
+ 0,1,2: bb:=false;
+ else // 3
+ bb:=true;
+ end;
+ EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),bb);
+ end;
+ if not NoProcess then
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ end;
+
EN_CHANGE: if not NoProcess then
SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
@@ -625,10 +721,6 @@ begin
bb:=loword(wParam)=IDC_RW_WRITE;
EnableWindow(GetDlgItem(Dialog,IDC_RW_SAVE),bb);
end;
- IDC_RW_CURRENT,
- IDC_RW_PARAM,
- IDC_RW_RESULT: EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),false);
- IDC_RW_MANUAL: EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),true);
IDC_RW_LAST: begin
EnableEditField(GetDlgItem(Dialog,IDC_RW_VALUE),
diff --git a/plugins/Actman30/iac_global.pas b/plugins/Actman30/iac_global.pas
index 5e7ff9bec1..9a5534d52d 100644
--- a/plugins/Actman30/iac_global.pas
+++ b/plugins/Actman30/iac_global.pas
@@ -21,10 +21,14 @@ const
WM_ACT_SAVE = WM_USER + 15;
WM_ACT_LISTCHANGE = WM_USER + 16; // group, action
+// Action flags
const
- ACF_DISABLED = $10000000; // action disabled
- ACF_REPLACED = $20000000; // action replaced by new in options
- ACF_INTRODUCED = $40000000; // action is newly created (not saved) in options
+ ACF_DISABLED = $10000000; // action disabled
+ // options editor only
+ ACF_REPLACED = $20000000; // action replaced by new in options
+ ACF_INTRODUCED = $40000000; // action is newly created (not saved) in options
+const
+ ACF_MASK = $00FFFFFF; // mask for private action flags
type
tLRType = record
@@ -86,15 +90,19 @@ function GetResultNumber(var WorkData:tWorkData;num:integer=-1):uint_ptr;
procedure InsertString(wnd:HWND;num:dword;str:PAnsiChar);
+function GetLinkName(hash:dword):PAnsiChar;
function GetLink(hash:dword):pActModule;
function GetLinkByName(name:pAnsiChar):pActModule;
function ImportContact (node:HXML ):TMCONTACT;
function ImportContactINI(node:pointer):TMCONTACT;
+
implementation
-uses Common, global, dbsettings, mirutils;
+uses Common, global, dbsettings, inouttext,
+ mirutils, mircontacts;
+
//----- tBaseAction code -----
const
@@ -149,6 +157,7 @@ var
pc:pAnsiChar;
begin
case fmt of
+ 100..199, // for V2
0: begin
pc:=StrCopyE(section,pAnsiChar(node));
mFreeMem(ActionDescr); // created by constructor
@@ -180,7 +189,7 @@ end;
procedure tBaseAction.Save(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
- pc:pAnsiChar;
+ pc:PAnsiChar;
begin
case fmt of
0: begin
@@ -193,6 +202,13 @@ begin
1: begin
end;
}
+ 13: begin
+ tTextExport(node).AddText ('type' ,GetLinkName(UID));
+ tTextExport(node).AddTextW('name' ,ActionDescr);
+ tTextExport(node).AddFlag ('disabled',(flags and ACF_DISABLED)<>0);
+ tTextExport(node).AddNewLine();
+ tTextExport(node).ShiftRight();
+ end;
end;
end;
@@ -281,6 +297,19 @@ begin
}
end;
+function GetLinkName(hash:dword):PAnsiChar;
+var
+ link:pActModule;
+begin
+ link:=ModuleLink;
+ while (link<>nil) and (link.Hash<>hash) do
+ link:=link^.Next;
+ if link<>nil then
+ result:=link^.Name
+ else
+ result:=nil;
+end;
+
function GetLink(hash:dword):pActModule;
begin
result:=ModuleLink;
@@ -431,8 +460,8 @@ end;
//----- DLL Handle Cache -----
type
tDLLCacheElement = record
- DLLName :PAnsiChar;
- DLLHandle:THANDLE;
+ DllName :PAnsiChar;
+ DllHandle:THANDLE;
count :word; // count for end-of-macro flag
flags :byte; // handle free mode
end;
diff --git a/plugins/Actman30/iac_ini.pas b/plugins/Actman30/iac_ini.pas
index 7061d65936..17caa1e334 100644
--- a/plugins/Actman30/iac_ini.pas
+++ b/plugins/Actman30/iac_ini.pas
@@ -7,7 +7,7 @@ implementation
uses
windows,messages,commctrl,
iac_global,global,
- common,m_api,wrapper,
+ common,m_api,wrapper, inouttext,
dbsettings,editwrapper,mirutils;
{$include i_cnst_ini.inc}
@@ -215,6 +215,21 @@ begin
1: begin
end;
}
+ 13: begin
+ tTextExport(node).AddFlag('write' ,(flags and ACF_INI_WRITE )<>0);
+ tTextExport(node).AddFlag('delete' ,(flags and ACF_INI_DELETE)<>0);
+ tTextExport(node).AddFlag('lastresult',(flags and ACF_INI_LR )<>0);
+ tTextExport(node).AddFlag('utf' ,(flags and ACF_INI_UTF )<>0);
+ if flags and (ACF_INI_WRITE or ACF_INI_DELETE or ACF_INI_LR or ACF_INI_UTF)<>0 then
+ tTextExport(node).AddNewLine();
+ tTextExport(node).AddTextW('inifile' ,inifile ); tTextExport(node).AddNewLine();
+ tTextExport(node).AddTextW('section' ,section ); tTextExport(node).AddNewLine();
+ tTextExport(node).AddTextW('parameter',parameter); tTextExport(node).AddNewLine();
+ if flags and (ACF_INI_DELETE or ACF_INI_LR)=0 then
+ begin
+ tTextExport(node).AddTextW('value',value); tTextExport(node).AddNewLine();
+ end;
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_inout.pas b/plugins/Actman30/iac_inout.pas
index c8b63aa1dc..42e36913ff 100644
--- a/plugins/Actman30/iac_inout.pas
+++ b/plugins/Actman30/iac_inout.pas
@@ -7,7 +7,7 @@ implementation
uses
windows, messages, commctrl,
iac_global, global,
- mirutils, common, dbsettings,
+ mirutils, mircontacts, common, dbsettings,
wrapper, editwrapper, io, syswin,
m_api;
@@ -41,6 +41,9 @@ const
ACF_TEXTSEND = $00000400;
// dummy
ACF_MESSAGE = 0;
+
+const // V2
+ ACF2_TXT_FILE = $00000001;
type
tInOutAction = class(tBaseAction)
@@ -302,6 +305,7 @@ var
section: array [0..127] of AnsiChar;
pc:pAnsiChar;
tmp:pWideChar;
+ flags2:dword;
begin
inherited Load(node,fmt);
case fmt of
@@ -313,6 +317,18 @@ begin
end;
end;
+ 100: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ if (flags and ACF_FILE)<>0 then
+ begin
+ StrCopy(pc,opt_file); tfile:=DBReadUnicode(0,DBBranch,section,nil);
+ end;
+
+ StrCopy(pc,'flags2'); flags2:=DBReadDWord(0,DBBranch,section,0);
+ if (flags2 and ACF2_TXT_FILE)<>0 then
+ flags:=flags or ACF_FILE_PATH;
+ end;
+
1: begin
with xmlparser do
begin
@@ -405,6 +421,22 @@ begin
1: begin
end;
}
+ 13: begin
+{
+ ACF_CLIPBRD = $00000002; // Clipboard operations, not window
+ ACF_ANSI = $00000004; // File: ANSI or Unicode (UTF8/UTF16) text
+ ACF_COPYTO = $00000008; // Clipboard operations: 'copy to' or 'paste from'
+
+ ACF_FILE = $00000010; // File operations
+ ACF_FWRITE = $00000020; // read/write file
+ ACF_FAPPEND = $00000040; // append file
+ ACF_UTF8 = $00000080; // File: UTF8 or UTF16
+ ACF_SIGN = $00000100; // File: with signature or not
+ ACF_FILE_PATH = $00000200;
+
+ ACF_TEXTSEND = $00000400;
+}
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_jump.pas b/plugins/Actman30/iac_jump.pas
index c06c1037dd..4f4176e583 100644
--- a/plugins/Actman30/iac_jump.pas
+++ b/plugins/Actman30/iac_jump.pas
@@ -52,6 +52,13 @@ const
ACF_BACK = $00000020;
ACF_VALUE = $00000100;
+const // V2
+ ADV_ACT_BREAK = 1;
+ ADV_COND_NOT = $80;
+ ADV_COND_GT = 1;
+ ADV_COND_LT = 2;
+ ADV_COND_EQ = 3;
+
type
tJumpAction = class(tBaseAction)
private
@@ -219,9 +226,11 @@ end;
procedure tJumpAction.Load(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
+ buf:array [0..31] of WideChar;
pc:pAnsiChar;
tmp:pWideChar;
sub:HXML;
+ oper,cond:byte;
begin
inherited Load(node,fmt);
case fmt of
@@ -238,6 +247,50 @@ begin
end;
end;
+ 100..199: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ if fmt<>101 then // condition
+ begin
+ StrCopy(pc,opt_condition); cond:=DBReadByte(0,DBBranch,section);
+ if (cond and $F0)=0 then
+ flags:=flags or ACF_NOP
+ else
+ begin
+ if (cond and ADV_COND_NOT)<>0 then flags:=flags or ACF_NOT;
+ flags:=flags or ACF_MATH;
+ StrCopy(pc,opt_value); StrDupW(value,IntToStr(buf,DBReadDWord(0,DBBranch,section)));
+
+ case cond and $0F of
+ ADV_COND_GT: condition:=aeGT;
+ ADV_COND_LT: condition:=aeLT;
+ ADV_COND_EQ: condition:=aeEQ;
+ end;
+ end;
+ end
+ else // skip condition, jump
+ begin
+ flags:=flags or ACF_NOP
+ end;
+
+ if fmt>101 then // inverse condition, jump to label
+ begin
+ flags:=flags xor ACF_NOT;
+ buf[0]:='$'; buf[1]:='$';
+ IntToStr(PWideChar(@buf[2]),fmt-102);
+ StrDupW(actlabel,buf);
+ end
+ else
+ begin
+ StrCopy(pc,'oper'); oper:=DBReadByte(0,DBBranch,section) and $0F;
+ if (oper and ADV_ACT_BREAK)<>0 then
+ flags:= flags or ACF_BREAK
+ else
+ begin
+ StrCopy(pc,'operval'); actlabel:=DBReadUnicode(0,DBBranch,section);
+ end;
+ end;
+ end;
+
1: begin
with xmlparser do
begin
@@ -359,6 +412,17 @@ begin
1: begin
end;
}
+ 13: begin
+{
+ ACF_NOP = $00000001;
+ ACF_MATH = $00000002;
+ ACF_NOT = $00000004;
+ ACF_CASE = $00000008;
+ ACF_BREAK = $00000010;
+ ACF_BACK = $00000020;
+ ACF_VALUE = $00000100;
+}
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_messagebox.pas b/plugins/Actman30/iac_messagebox.pas
index 7d99c5ffb3..41a1068ab2 100644
--- a/plugins/Actman30/iac_messagebox.pas
+++ b/plugins/Actman30/iac_messagebox.pas
@@ -143,7 +143,7 @@ begin
pc:=StrCopyE(section,pAnsiChar(node));
StrCopy(pc,opt_msgtitle); msgtitle:=DBReadUnicode(0,DBBranch,section);
StrCopy(pc,opt_msgtext ); msgtext :=DBReadUnicode(0,DBBranch,section);
- StrCopy(pc,opt_boxopts ); boxopts :=DBReadDword (0,DBBranch,section);
+ StrCopy(pc,opt_boxopts ); boxopts :=DBReadDword (0,DBBranch,section); // v2 = byte
end;
1: begin
@@ -187,6 +187,8 @@ begin
1: begin
end;
}
+ 13: begin
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_notes.pas b/plugins/Actman30/iac_notes.pas
new file mode 100644
index 0000000000..182e1aba9e
--- /dev/null
+++ b/plugins/Actman30/iac_notes.pas
@@ -0,0 +1,173 @@
+unit iac_notes;
+
+interface
+
+implementation
+
+uses
+ windows, messages, commctrl,
+ common, wrapper,
+ mirutils, dbsettings, m_api,
+ global, iac_global;
+
+{$include i_cnst_notes.inc}
+{$resource iac_notes.res}
+
+const
+ opt_text = 'text';
+
+type
+ tNotesAction = class(tBaseAction)
+ private
+ note:PWideChar;
+ public
+ constructor Create(uid:dword);
+ destructor Destroy; override;
+// function Clone:tBaseAction; override;
+ function DoAction(var WorkData:tWorkData):LRESULT; override;
+ procedure Save(node:pointer;fmt:integer); override;
+ procedure Load(node:pointer;fmt:integer); override;
+ end;
+
+//----- Support functions -----
+
+//----- Object realization -----
+
+constructor tNotesAction.Create(uid:dword);
+begin
+ inherited Create(uid);
+end;
+
+destructor tNotesAction.Destroy;
+begin
+
+ inherited Destroy;
+end;
+
+function tNotesAction.DoAction(var WorkData:tWorkData):LRESULT;
+begin
+ result:=0;
+end;
+
+procedure tNotesAction.Load(node:pointer;fmt:integer);
+var
+ section: array [0..127] of AnsiChar;
+ pc:pAnsiChar;
+begin
+ inherited Load(node,0);
+ case fmt of
+ 0: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,opt_text); note:=DBReadUnicode(0,DBBranch,section,nil);
+ end;
+{
+ 1: begin
+ end;
+}
+ end;
+end;
+
+procedure tNotesAction.Save(node:pointer;fmt:integer);
+var
+ section: array [0..127] of AnsiChar;
+ pc:pAnsiChar;
+begin
+ inherited Save(node,fmt);
+ case fmt of
+ 0: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,opt_text); DBWriteUnicode(0,DBBranch,section,note);
+ end;
+{
+ 1: begin
+ end;
+}
+ end;
+end;
+
+//----- Dialog realization -----
+
+procedure ClearFields(Dialog:HWND);
+begin
+ SetDlgItemTextW(Dialog,IDC_TXT_TEXT,nil);
+end;
+
+function DlgProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
+const
+ NoProcess:boolean=true;
+begin
+ result:=0;
+
+ case hMessage of
+ WM_INITDIALOG: begin
+ TranslateDialogDefault(Dialog);
+ end;
+
+ WM_ACT_SETVALUE: begin
+ NoProcess:=true;
+ ClearFields(Dialog);
+ with tNotesAction(lParam) do
+ begin
+ SetDlgItemTextW(Dialog,IDC_TXT_TEXT,note);
+ end;
+ NoProcess:=false;
+ end;
+
+ WM_ACT_RESET: begin
+ NoProcess:=true;
+ ClearFields(Dialog);
+ NoProcess:=false;
+ end;
+
+ WM_ACT_SAVE: begin
+ with tNotesAction(lParam) do
+ begin
+ flags:=0;
+ note:=GetDlgText(Dialog,IDC_TXT_TEXT);
+ end;
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+ EN_CHANGE: if not NoProcess then
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ end;
+ end;
+
+ WM_HELP: begin
+ result:=1;
+ end;
+
+ end;
+end;
+
+//----- Export/interface functions -----
+
+var
+ vc:tActModule;
+
+function CreateAction:tBaseAction;
+begin
+ result:=tNotesAction.Create(vc.Hash);
+end;
+
+function CreateDialog(parent:HWND):HWND;
+begin
+ result:=CreateDialogW(hInstance,'IDD_ACTNOTES',parent,@DlgProc);
+end;
+
+procedure Init;
+begin
+ vc.Next :=ModuleLink;
+
+ vc.Name :='Notes';
+ vc.Dialog :=@CreateDialog;
+ vc.Create :=@CreateAction;
+ vc.Icon :='IDI_NOTES';
+
+ ModuleLink :=@vc;
+end;
+
+begin
+ Init;
+end.
diff --git a/plugins/Actman30/iac_notes.rc b/plugins/Actman30/iac_notes.rc
new file mode 100644
index 0000000000..a9ca1bc5ef
--- /dev/null
+++ b/plugins/Actman30/iac_notes.rc
@@ -0,0 +1,13 @@
+#include "i_cnst_notes.inc"
+
+LANGUAGE 0,0
+
+IDD_ACTNOTES DIALOGEX 0, 0, 168, 200, 0
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0
+{
+ EDITTEXT IDC_TXT_TEXT, 1, 4, 166, 192, ES_AUTOHSCROLL
+}
+
+IDI_NOTES ICON "ico\notes.ico"
diff --git a/plugins/Actman30/iac_notes.res b/plugins/Actman30/iac_notes.res
new file mode 100644
index 0000000000..72d05137cd
--- /dev/null
+++ b/plugins/Actman30/iac_notes.res
Binary files differ
diff --git a/plugins/Actman30/iac_program.pas b/plugins/Actman30/iac_program.pas
index bf44fdffa6..33924c4279 100644
--- a/plugins/Actman30/iac_program.pas
+++ b/plugins/Actman30/iac_program.pas
@@ -8,7 +8,7 @@ uses
editwrapper,
windows, messages, commctrl,
global, iac_global, m_api, wrapper, syswin,
- mirutils, common, dbsettings;
+ mirutils, mircontacts, common, dbsettings;
{$include i_cnst_program.inc}
{$resource iac_program.res}
@@ -19,6 +19,12 @@ const
ACF_PRG_PRG = $00000004; // script for program path
ACF_PRG_ARG = $00000008; // script for program args
+const // V2
+ ACF_OLD_CURPATH = $00000002;
+ ACF_OLD_PRTHREAD = $00000004;
+ ACF2_PRG_PRG = $00000001;
+ ACF2_PRG_ARG = $00000002;
+
const
opt_prg = 'program';
opt_args = 'arguments';
@@ -207,6 +213,7 @@ var
section: array [0..127] of AnsiChar;
pc:pAnsiChar;
tmp:pWideChar;
+ flags2,lflags:dword;
begin
inherited Load(node,fmt);
case fmt of
@@ -218,6 +225,24 @@ begin
StrCopy(pc,opt_show); show :=DBReadDWord (0,DBBranch,section,SW_SHOW);
end;
+ 100: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,opt_prg ); prgname:=DBReadUnicode(0,DBBranch,section,nil);
+ StrCopy(pc,opt_args); args :=DBReadUnicode(0,DBBranch,section,nil);
+ StrCopy(pc,opt_time); time :=DBReadDWord (0,DBBranch,section,0);
+ StrCopy(pc,opt_show); show :=DBReadDWord (0,DBBranch,section,SW_SHOW);
+
+ StrCopy(pc,'flags2'); flags2:=DBReadDWord(0,DBBranch,section,0);
+ lflags:=flags;
+ flags:=flags and not ACF_MASK;
+
+ if (lflags and ACF_OLD_CURPATH )<>0 then flags:=flags or ACF_CURPATH;
+ if (lflags and ACF_OLD_PRTHREAD)<>0 then flags:=flags or ACF_PRTHREAD;
+
+ if (flags2 and ACF2_PRG_PRG)<>0 then flags:=flags or ACF_PRG_PRG;
+ if (flags2 and ACF2_PRG_ARG)<>0 then flags:=flags or ACF_PRG_ARG;
+ end;
+
1: begin
with xmlparser do
begin
@@ -290,6 +315,8 @@ begin
1: begin
end;
}
+ 13: begin
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_service.pas b/plugins/Actman30/iac_service.pas
index 88ca4f7f07..d670f2afec 100644
--- a/plugins/Actman30/iac_service.pas
+++ b/plugins/Actman30/iac_service.pas
@@ -9,7 +9,7 @@ uses
global, iac_global,
m_api,
sedit,strans,mApiCardM,
- mirutils,dbsettings, editwrapper,
+ mirutils,mircontacts,dbsettings, editwrapper,
sparam,srvblock,
syswin,wrapper,common;
@@ -37,6 +37,31 @@ const
// dummy
ACF_STRING = 0;
+const // V2
+ ACF2_SRV_WPAR = $00000001;
+ ACF2_SRV_LPAR = $00000002;
+ ACF2_SRV_SRVC = $00000004;
+ ACF2_FREEMEM = $00000100;
+ ACF_OLD_WPARNUM = $00000001;
+ ACF_OLD_LPARNUM = $00000002;
+ ACF_OLD_WUNICODE = $00000004;
+ ACF_OLD_LUNICODE = $00000008;
+ ACF_OLD_WCURRENT = $00000010;
+ ACF_OLD_LCURRENT = $00000020;
+ ACF_OLD_WPARHEX = $00000040;
+ ACF_OLD_LPARHEX = $00000080;
+
+ ACF_OLD_WRESULT = $00010000;
+ ACF_OLD_LRESULT = $00020000;
+ ACF_OLD_WPARAM = $00040000;
+ ACF_OLD_LPARAM = $00080000;
+ ACF_OLD_WSTRUCT = $00100000;
+ ACF_OLD_LSTRUCT = $00200000;
+
+ ACF_OLD_STRING = $00000800;
+ ACF_OLD_UNICODE = $00001000;
+ ACF_OLD_STRUCT = $00008000;
+
const
opt_service = 'service';
opt_flags2 = 'flags2';
@@ -354,10 +379,12 @@ end;
}
procedure tServiceAction.Load(node:pointer;fmt:integer);
var
- section: array [0..127] of AnsiChar;
+ section:array [0..127] of AnsiChar;
+ buf:array [0..31] of WideChar;
pc:pAnsiChar;
sub:HXML;
tmp:pWideChar;
+ lflags,lflags2:dword;
begin
inherited Load(node,fmt);
@@ -372,6 +399,67 @@ begin
StrCopy(pc,opt_lparam); LoadParam(section,flags2,pointer(lparam));
end;
+ 100: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+
+ StrCopy(pc,opt_service); service:=DBReadString(0,DBBranch,section,nil);
+ StrCopy(pc,opt_flags2 ); flags2 :=DBReadDword (0,DBBranch,section);
+
+
+ if (flags and (ACF_OLD_WCURRENT or ACF_OLD_WRESULT or ACF_OLD_WPARAM))=0 then
+ begin
+ StrCopy(pc,opt_wparam);
+
+ if (flags and ACF_OLD_WSTRUCT)<>0 then
+ wparam:=PWideChar(DBReadUTF8(0,DBBranch,section,nil))
+ else if ((flags and ACF_OLD_WPARNUM)=0) or ((flags2 and ACF2_SRV_WPAR)<>0) then
+ wparam:=DBReadUnicode(0,DBBranch,section,nil)
+ else
+ StrDupW(wparam,IntToStr(buf,DBReadDWord(0,DBBranch,section)));
+ end;
+
+ if (flags and (ACF_OLD_LCURRENT or ACF_OLD_LRESULT or ACF_OLD_LPARAM))=0 then
+ begin
+ StrCopy(pc,opt_lparam);
+
+ if (flags and ACF_OLD_LSTRUCT)<>0 then
+ lparam:=PWideChar(DBReadUTF8(0,DBBranch,section,nil))
+ else if ((flags and ACF_OLD_LPARNUM)=0) or ((flags2 and ACF2_SRV_LPAR)<>0) then
+ lparam:=DBReadUnicode(0,DBBranch,section,nil)
+ else
+ StrDupW(lparam,IntToStr(buf,DBReadDWord(0,DBBranch,section)));
+ end;
+
+ lflags :=flags;
+ lflags2:=flags2;
+ flags :=flags and not ACF_MASK;
+ flags2:=0;
+
+ if (lflags2 and ACF2_SRV_SRVC)<>0 then flags:=flags or ACF_SCRIPT_SERVICE;
+
+ if (lflags and ACF_OLD_WPARNUM )<>0 then flags:=flags or ACF_PARNUM;
+ if (lflags and ACF_OLD_WUNICODE)<>0 then flags:=flags or ACF_UNICODE;
+ if (lflags and ACF_OLD_WCURRENT)<>0 then flags:=flags or ACF_CURRENT;
+ if (lflags and ACF_OLD_WRESULT )<>0 then flags:=flags or ACF_RESULT;
+ if (lflags and ACF_OLD_WPARAM )<>0 then flags:=flags or ACF_PARAM;
+ if (lflags and ACF_OLD_WSTRUCT )<>0 then flags:=flags or ACF_STRUCT;
+ if (lflags2 and ACF2_SRV_WPAR )<>0 then flags:=flags or ACF_SCRIPT_PARAM;
+
+ if (lflags and ACF_OLD_LPARNUM )<>0 then flags2:=flags2 or ACF_PARNUM;
+ if (lflags and ACF_OLD_LUNICODE)<>0 then flags2:=flags2 or ACF_UNICODE;
+ if (lflags and ACF_OLD_LCURRENT)<>0 then flags2:=flags2 or ACF_CURRENT;
+ if (lflags and ACF_OLD_LRESULT )<>0 then flags2:=flags2 or ACF_RESULT;
+ if (lflags and ACF_OLD_LPARAM )<>0 then flags2:=flags2 or ACF_PARAM;
+ if (lflags and ACF_OLD_LSTRUCT )<>0 then flags2:=flags2 or ACF_STRUCT;
+ if (lflags2 and ACF2_SRV_LPAR )<>0 then flags2:=flags2 or ACF_SCRIPT_PARAM;
+
+ if (lflags and ACF_OLD_STRING )<>0 then flags:=flags or ACF_RSTRING;
+ if (lflags and ACF_OLD_UNICODE)<>0 then flags:=flags or ACF_RUNICODE;
+ if (lflags and ACF_OLD_STRUCT )<>0 then flags:=flags or ACF_RSTRUCT;
+ if (lflags2 and ACF2_FREEMEM )<>0 then flags:=flags or ACF_RFREEMEM;
+
+ end;
+
1: begin
with xmlparser do
begin
@@ -462,6 +550,8 @@ begin
1: begin
end;
}
+ 13: begin
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_settings.pas b/plugins/Actman30/iac_settings.pas
index 0cd7d82507..3997fbe73d 100644
--- a/plugins/Actman30/iac_settings.pas
+++ b/plugins/Actman30/iac_settings.pas
@@ -34,6 +34,7 @@ begin
SetDlgItemTextW(Dialog,IDC_EDIT_FORMAT,'');
CheckDlgButton(Dialog,IDC_FR_FLAG,BST_UNCHECKED);
+ CheckDlgButton(Dialog,IDC_VL_FLAG,BST_UNCHECKED);
end;
function DlgProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
@@ -79,7 +80,13 @@ begin
stat:=BST_CHECKED
else
stat:=BST_UNCHECKED;
- CheckDlgButton(Dialog,IDC_FR_FLAG,stat);
+ CheckDlgButton(Dialog,IDC_FR_FLAG,stat);
+
+ if (lp and ACF_VOLATILE)<>0 then
+ stat:=BST_CHECKED
+ else
+ stat:=BST_UNCHECKED;
+ CheckDlgButton(Dialog,IDC_VL_FLAG,stat);
end;
end;
@@ -112,6 +119,17 @@ begin
SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
end;
+
+ IDC_VL_FLAG: begin
+ lp:=LV_GetLParam(MacroListWindow);
+ if IsDlgButtonChecked(Dialog,IDC_VL_FLAG)=BST_UNCHECKED then
+ lp:=lp and not ACF_VOLATILE
+ else
+ lp:=lp or ACF_VOLATILE;
+ LV_SetLParam(MacroListWindow,lp);
+
+ SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0);
+ end;
end;
end;
end;
diff --git a/plugins/Actman30/iac_settings.rc b/plugins/Actman30/iac_settings.rc
index 957fba3088..69487dd87d 100644
--- a/plugins/Actman30/iac_settings.rc
+++ b/plugins/Actman30/iac_settings.rc
@@ -18,8 +18,9 @@ FONT 8, "MS Shell Dlg", 0, 0
COMBOBOX IDC_SERVICELIST , 19, 94, 148, 96, CBS_DROPDOWNLIST | WS_VSCROLL
CONTROL "Apply",IDC_SRV_APPLY,"MButtonClass",WS_TABSTOP,1,93,16,16,$18000000
- GROUPBOX "Current Macro", -1, 1, 116, 166, 28, WS_GROUP
- AUTOCHECKBOX "Select for FirstRun",IDC_FR_FLAG, 4, 125, 160, 12
+ GROUPBOX "Current Macro", -1, 1, 116, 166, 40, WS_GROUP
+ AUTOCHECKBOX "Select for FirstRun",IDC_FR_FLAG, 4, 126, 160, 12
+ AUTOCHECKBOX "Select as Volatile" ,IDC_VL_FLAG, 4, 138, 160, 12
// AUTOCHECKBOX "hContact in wParam" ,IDC_HC_WPAR, 4, 138, 160, 12
}
diff --git a/plugins/Actman30/iac_settings.res b/plugins/Actman30/iac_settings.res
index ee1b268205..1aaef00324 100644
--- a/plugins/Actman30/iac_settings.res
+++ b/plugins/Actman30/iac_settings.res
Binary files differ
diff --git a/plugins/Actman30/iac_storage.pas b/plugins/Actman30/iac_storage.pas
index 53be7dd153..37755d0e63 100644
--- a/plugins/Actman30/iac_storage.pas
+++ b/plugins/Actman30/iac_storage.pas
@@ -7,7 +7,7 @@ implementation
uses
windows, messages,
common, wrapper,
- mirutils,m_api,dbsettings,
+ mirutils,m_api,dbsettings, inouttext,
global,iac_global;
{$include i_cnst_storage.inc}
@@ -179,6 +179,10 @@ begin
1: begin
end;
}
+ 13: begin
+ tTextExport(node).AddDWord('slot',Number);
+ tTextExport(node).AddFlag ('copy',(flags or ACF_COPYFROM)<>0);
+ end;
end;
end;
diff --git a/plugins/Actman30/iac_text.pas b/plugins/Actman30/iac_text.pas
index ddebb3f3c8..d7d9890192 100644
--- a/plugins/Actman30/iac_text.pas
+++ b/plugins/Actman30/iac_text.pas
@@ -7,7 +7,7 @@ implementation
uses
windows, messages, commctrl,
global, iac_global, m_api, editwrapper,
- dbsettings, common, io,
+ dbsettings, common, io, inouttext,
mirutils, syswin, wrapper;
{$include i_cnst_text.inc}
@@ -26,6 +26,9 @@ const
ACF_TEXTSCRIPT = $00000001;
ACF_POSTPROCESS = $00000002;
+const // V2
+ ACF2_TXT_TEXT = $00000002;
+
type
tTextAction = class(tBaseAction)
private
@@ -330,6 +333,7 @@ procedure tTextAction.Load(node:pointer;fmt:integer);
var
section: array [0..127] of AnsiChar;
pc:pAnsiChar;
+ flags2:dword;
begin
inherited Load(node,fmt);
case fmt of
@@ -339,6 +343,23 @@ begin
StrCopy(pc,opt_text); text:=DBReadUnicode(0,DBBranch,section,nil);
end;
+ 100: begin
+ pc:=StrCopyE(section,pAnsiChar(node));
+
+ StrCopy(pc,opt_text); text:=DBReadUnicode(0,DBBranch,section,nil);
+
+ StrCopy(pc,'flags2'); flags2:=DBReadDWord(0,DBBranch,section,0);
+ flags:=flags and not ACF_MASK;
+
+ if (flags2 and ACF2_TXT_TEXT)<>0 then flags:=flags or ACF_TEXTSCRIPT;
+ end;
+
+ 101: begin // v2, from "Advanced"
+ pc:=StrCopyE(section,pAnsiChar(node));
+ StrCopy(pc,'varval'); text:=DBReadUnicode(0,DBBranch,section);
+ flags:=flags or ACF_TEXTSCRIPT;
+ end;
+
1: begin
with xmlparser do
begin
@@ -375,6 +396,11 @@ begin
1: begin
end;
}
+ 13: begin
+ tTextExport(node).AddTextW('text' ,text);
+ tTextExport(node).AddFlag ('script' ,(flags or ACF_TEXTSCRIPT )<>0);
+ tTextExport(node).AddFlag ('postprocess',(flags or ACF_POSTPROCESS)<>0);
+ end;
end;
end;
diff --git a/plugins/Actman30/ico/notes.ico b/plugins/Actman30/ico/notes.ico
new file mode 100644
index 0000000000..fa6c604542
--- /dev/null
+++ b/plugins/Actman30/ico/notes.ico
Binary files differ
diff --git a/plugins/Actman30/lowlevelc.pas b/plugins/Actman30/lowlevelc.pas
index 5c4d6b7965..fe6d9bde31 100644
--- a/plugins/Actman30/lowlevelc.pas
+++ b/plugins/Actman30/lowlevelc.pas
@@ -6,13 +6,15 @@ uses
windows,
iac_global;
+// Macro flags
const
- ACF_ASSIGNED = $80000000; // action assigned
+ ACF_ASSIGNED = $80000000; // macro assigned
ACF_FIRSTRUN = $40000000; // FirstRun flag
- ACF_USEDNOW = $20000000; // action in use (reserved)
+ ACF_USEDNOW = $20000000; // macro in use (reserved)
ACF_VOLATILE = $10000000; // don't save in DB
ACF_TOSAVE = ACF_ASSIGNED or ACF_FIRSTRUN;
+
type
pActionList = ^tActionList;
tActionList = array [0..1023] of tBaseAction;
diff --git a/plugins/ExternalAPI/delphi/m_actman.inc b/plugins/ExternalAPI/delphi/m_actman.inc
index 635b576758..5f0089a60c 100644
--- a/plugins/ExternalAPI/delphi/m_actman.inc
+++ b/plugins/ExternalAPI/delphi/m_actman.inc
@@ -7,24 +7,17 @@
const
AutoStartName:PWideChar = '#Autostart';
const
- DBBranch = 'ActMan';
-const
- ACCF_DISABLED = $10000000; // action disabled
- ACCF_EXPORT = $08000000; // action to export
- ACCF_VOLATILE = $04000000; // don't save in DB
- ACCF_IMPORTED = ACCF_EXPORT;
- ACCF_FLAGS = ACCF_DISABLED or ACCF_EXPORT or ACCF_IMPORTED or ACCF_VOLATILE;
- ACCF_OVERLOAD = $01000000; // imported action overwrite old
-
- ACCF_ID = $02000000; // for MS_ACT_SELECT, lParam is ID (else name)
- ACCF_CLEAR = $01000000; // clear other flags, else - set
+ // Get list service (full share)
+ ACCF_EXPORT = $08000000; // action to export (UA export)
+ ACCF_IMPORT = ACCF_EXPORT; // (UA import)
+
type
pChain = ^tChain;
tChain = record
- descr:PWideChar;
+ descr:pWideChar;
id :dword;
- flags:dword; // ACCF_* flags
- order:dword;
+ flags:dword; // ACCF_* flags ?? right now - just selection/overload
+ order:dword; // ??
end;
const
@@ -58,26 +51,27 @@ const
}
MS_ACT_RUNPARAMS:PAnsiChar = 'Actions/RunWithParams';
const
- ACTP_BYNAME = 1;
- ACTP_WAIT = 2;
+ ACTP_BYNAME = 1; // id points on unicode name
+ ACTP_WAIT = 2; // waiting for macro finish
+ ACTP_NOTIFY = 4; // notify (raise event) for start/finish macro
+ ACTP_SAMETHREAD = 8; // execute macro in same thread (with finish waiting)
+ ACTP_KEEPRESULT = 16; // (internal) keep last result
type
pAct_Param = ^tAct_Param;
tAct_Param = record
- flags :dword; // ACTP_*
Id :uint_ptr; // Id or name
wParam:WPARAM;
lParam:LPARAM;
+ flags :dword; // ACTP_*
+ lPType:dword; // last result (in lParam) type
end;
const
- ACTM_NEW = $00000001;
- ACTM_DELETE = $00000002;
- ACTM_RELOAD = $00000004;
- ACTM_RENAME = $00000008;
- ACTM_SORT = $00000010;
- ACTM_ACT = $10000000; // do not check, internal
- ACTM_ACTS = $20000000; // do not check, internal
- ACTM_LOADED = $80000000;
+ ACTM_NEW = $00000001; // new macros was added
+ ACTM_DELETE = $00000002; // some macros was deleted
+ ACTM_RENAME = $00000008; // possible, some macro names was changed
+ ACTM_SORT = $00000010; // possible, macro order in list was changed
+ ACTM_LOADED = $80000000; // All macros loaded and ready to work (at plugin start)
{
Event: action group list was changed: some was added or deleted
@@ -107,9 +101,9 @@ const
{
Select/unselect specified action
- wParam - set of ACCF_* consts
+ wParam - mask (bit 0 = ID if set/name; bit 1 = clear if set/set; bit 2 = get if set/set)
lParam - unicode action name / number
- Return - -1 if unsuccesful
+ Return - 0 if unsuccesful
}
MS_ACT_SELECT:PAnsiChar = 'Actions/Select';
diff --git a/plugins/ExternalAPI/delphi/m_addcontactplus.inc b/plugins/ExternalAPI/delphi/m_addcontactplus.inc
new file mode 100644
index 0000000000..678d796dcc
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_addcontactplus.inc
@@ -0,0 +1,29 @@
+{
+AddContact+ plugin for Miranda IM
+
+Copyright (C) 2007-2011 Bartosz 'Dezeath' Bia³ek
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+}
+
+{$IFNDEF M_ADDCONTACTPLUS}
+{$DEFINE M_ADDCONTACTPLUS}
+
+// Brings up the add contact dialog
+// wParam = lParam = 0
+const
+ MS_ADDCONTACTPLUS_SHOW:PAnsiChar = 'AddContactPlus/Show';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_alarms.inc b/plugins/ExternalAPI/delphi/m_alarms.inc
new file mode 100644
index 0000000000..4882407160
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_alarms.inc
@@ -0,0 +1,57 @@
+{$IFNDEF M_ALARMS}
+{$DEFINE M_ALARMS}
+
+const
+// flags for alarm action
+ AAF_POPUP = 1; // show a popup window (or a popup from popups plugin, if installed and activated via options)
+ AAF_SOUND = 2; // play a sound
+ AAF_COMMAND = 4; // run a command
+ AAF_SYSTRAY = 8; // flash systray icon (not implemented)
+
+type
+ TOccurrence = (
+ OC_ONCE, // all fields in time (see below) are valid
+ OC_DAILY, // only wHour, wMinute, and wSecond are valid
+ OC_WEEKLY, // wHour, wMinute, wSecond, and wDayOfWeek are valid
+ OC_WEEKDAYS, // only wHour, wMinute, and wSecond are valid
+ OC_MONTHLY, // wHour, wMinute, wSecond, and wDay are valid
+ OC_YEARLY // all fields except wYear are valid
+ );
+
+const
+// flags
+ ALF_HIDDEN = $01; // do not show in GUI (either options or reminder frame)
+ ALF_NOREMINDER = $02; // do not show in reminder frame
+ ALF_SUSPENDED = $04; // do not trigger next occurence
+ ALF_NOSTARTUP = $08; // do not trigger on startup if it was due when miranda was not running
+ ALF_NOSNOOZE = $10; // do not allow snoozing of this alarm
+
+type
+ TALARMINFO = record
+ szTitle :TChar;
+ szDesc :TChar;
+ occurrence :TOccurrence;
+ snoozer :LongBool; // this alarm is a 'once-off', the result of the user pressing the 'snooze'
+ // button - the time field no longer contains the original alarm time
+ time :TSYSTEMTIME; // the time the alarm is triggered at - different fields are valid depending on
+ // what the 'occurence' value is set to (see definition of Occurence type above)
+ action :word; // bitwise OR of AAF_* constants above
+ szCommand :TChar; // passed to ShellExecute (if action & AAF_COMMAND) when the alarm is triggered
+ szCommandParams:TChar; // passed as parameters for above command
+ sound_num :byte; // use alarm sound 1, 2, or 3 (if action & AAF_SOUND) (4 == speak, version 0.0.7.0+)
+ flags :int; // ALF_* above
+ end;
+
+const
+// set an alarm
+// wparam = 0
+// lparam = (ALARMINFO *)&alarm
+ MS_ALARMS_ADDALARM:PAnsiChar = 'Alarms/AddAlarm';
+
+// event sent when an alarm is triggered
+// wparam=0
+// lparam=(ALARMINFO *)&alarm
+// returning non-zero from your hook will prevent the alarm actions from being carried out
+ ME_ALARMS_TRIGGERED:PAnsiChar = 'Alarms/Triggered';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_assocmgr.inc b/plugins/ExternalAPI/delphi/m_assocmgr.inc
index 22321a00b4..44b0892196 100644
--- a/plugins/ExternalAPI/delphi/m_assocmgr.inc
+++ b/plugins/ExternalAPI/delphi/m_assocmgr.inc
@@ -40,7 +40,7 @@ ME_SYSTEM_MODULESLOADED is fired.
lParam : (PFILETYPEDESC)ftd
Returns 0 on success, nonzero otherwise.
}
- MS_ASSOCMGR_ADDNEWFILETYPE = 'AssocMgr/AddNewFileType';
+ MS_ASSOCMGR_ADDNEWFILETYPE:PAnsiChar = 'AssocMgr/AddNewFileType';
type
PFILETYPEDESC = ^TFILETYPEDESC;
@@ -115,7 +115,7 @@ associated with the file type.
lParam : (PAnsiChar)pszFileExt
Returns 0 on success, nonzero otherwise.
}
- MS_ASSOCMGR_REMOVEFILETYPE = 'AssocMgr/RemoveFileType';
+ MS_ASSOCMGR_REMOVEFILETYPE:PAnsiChar = 'AssocMgr/RemoveFileType';
{ Add a new url protocol type v0.1.0.0+
Add a new url type to be registered with Windows.
@@ -125,7 +125,7 @@ ME_SYSTEM_MODULESLOADED is fired.
lParam : (PURLTYPEDESC)utd
Returns 0 on success, nonzero otherwise.
}
- MS_ASSOCMGR_ADDNEWURLTYPE = 'AssocMgr/AddNewUrlType';
+ MS_ASSOCMGR_ADDNEWURLTYPE:PAnsiChar = 'AssocMgr/AddNewUrlType';
type
PURLTYPEDESC = ^TURLTYPEDESC;
@@ -171,6 +171,6 @@ associated with the url type.
lParam : (PAnsiChar)pszProtoPrefix
Returns 0 on success, nonzero otherwise.
}
- MS_ASSOCMGR_REMOVEURLTYPE = 'AssocMgr/RemoveUrlType';
+ MS_ASSOCMGR_REMOVEURLTYPE:PAnsiChar = 'AssocMgr/RemoveUrlType';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_avatarhistory.inc b/plugins/ExternalAPI/delphi/m_avatarhistory.inc
new file mode 100644
index 0000000000..5cfdd7b190
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_avatarhistory.inc
@@ -0,0 +1,50 @@
+{
+Copyright (C) 2006 MattJ, Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+}
+
+
+{$IFNDEF M_AVATARHISTORY}
+{$DEFINE M_AVATARHISTORY}
+
+const
+ EVENTTYPE_AVATAR_CHANGE = 9003;
+
+{
+Return TRUE is Avatar History is enabled for this contact
+
+wParam: hContact
+lParam: ignored
+}
+ MS_AVATARHISTORY_ENABLED:PAnsiChar = 'AvatarHistory/IsEnabled';
+
+
+{
+Get cached avatar
+
+wParam: (char *) protocol name
+lParam: (char *) hash
+return: (TCHAR *) NULL if none is found or the path to the avatar. You need to free this string
+ with mir_free.
+}
+ MS_AVATARHISTORY_GET_CACHED_AVATAR:PAnsiChar = 'AvatarHistory/GetCachedAvatar';
+
+
+ MS_AVATARHISTORY_SHOWDIALOG:PAnsiChar = 'AvatarHistory/ShowDialog';
+
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_changekeyboardlayout.inc b/plugins/ExternalAPI/delphi/m_changekeyboardlayout.inc
index b1df7628c1..99f7ddcdd7 100644
--- a/plugins/ExternalAPI/delphi/m_changekeyboardlayout.inc
+++ b/plugins/ExternalAPI/delphi/m_changekeyboardlayout.inc
@@ -6,18 +6,18 @@ const
// wParam - HWND or NULL for current window
// lParam must be 0
// returns 0 on success and returns non-zero (-1) on error.
- MS_CKL_CHANGELAYOUT 'ChangeKeyboardLayout/ChangeLayout';
+ MS_CKL_CHANGELAYOUT:PAnsiChar = 'ChangeKeyboardLayout/ChangeLayout';
//wParam äîëæåí áûòü íîëü.
//lParam - LPCTSTR òåêñòà, ðàñêëàäêó êîòîðîãî òðåáóåòñÿ îïðåäåëèòü,
//Âîçâðàùàåò HKL ðàñêëàäêó òåêñòà, èëè NULL â ñëó÷àå îøèáêè.
//Ïðèìå÷àíèå: Ïðè îïðåäåëåíèè ðàñêëàäêè ó÷èòûâàåòñÿ îïöèÿ "Ðàñêëàäêà òåêñòà - òåêóùàÿ ðàñêëàäêà"
- MS_CKL_GETLAYOUTOFTEXT = 'ChangeKeyboardLayout/GetLayoutOfText';
+ MS_CKL_GETLAYOUTOFTEXT:PAnsiChar = 'ChangeKeyboardLayout/GetLayoutOfText';
type
CKLLayouts = record
hklFrom:HKL; // layout of the current text
- hklTo :HKL; // layout of the result text
+ hklTo :HKL; // layout of the result text
bTwoWay:bool;
end;
@@ -26,6 +26,6 @@ const
//lParam - óêàçàòåëü íà ñòðóêòóðó CKLLayouts, ñîäåðæàùóþ ðàñêëàäêè äëÿ
//èçìåíåíèÿ òåêñòà è îïöèþ "äâóíàïðàâëåííîãî ïðåîáðàçîâàíèÿ"
//Âîçâðàùàåò LPTSTR íà ðåçóëüòèðóþùóþ ñòðîêó
- MS_CKL_CHANGETEXTLAYOUT = 'ChangeKeyboardLayout/ChangeTextLayout';
+ MS_CKL_CHANGETEXTLAYOUT:PAnsiChar = 'ChangeKeyboardLayout/ChangeTextLayout';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_dbeditorpp.inc b/plugins/ExternalAPI/delphi/m_dbeditorpp.inc
index e6e9a0c5c8..d9b11f23b3 100644
--- a/plugins/ExternalAPI/delphi/m_dbeditorpp.inc
+++ b/plugins/ExternalAPI/delphi/m_dbeditorpp.inc
@@ -11,7 +11,7 @@ const
{
Import settings\contacts from file
- wParam=(HANDLE)hContact
+ wParam=hContact
lParam=(char*)FilePath
always returns 0
}
diff --git a/plugins/ExternalAPI/delphi/m_dropbox.inc b/plugins/ExternalAPI/delphi/m_dropbox.inc
index e2b6ab0cba..8e7cb913e2 100644
--- a/plugins/ExternalAPI/delphi/m_dropbox.inc
+++ b/plugins/ExternalAPI/delphi/m_dropbox.inc
@@ -2,21 +2,27 @@
{$DEFINE M_DROPBOX}
const
-//upload file on Dropbox
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(const wchar_t*)path - full path to file
+// upload file on Dropbox
+// wParam = (MCONTACT)hContact - NULL to send to the Dropbox contact
+// lParam = (LPARAM)(const wchar_t*)path - full path to file
// returns file htansfer handle or NULL on failure
// returns immediately, without waiting for the send
+// note, that you can track progress by using ME_PROTO_ACK
MS_DROPBOX_SEND_FILE:PAnsiChar = 'Dropbox/Send/File';
-// notifies a caller about file send end
-// wParam = (MCONTACT)hContact
-// lParam = (LPARAM)(const wchar_t*)url - "\r\n" separated download link to file
- ME_DROPBOX_SEND_SUCCEEDED:PAnsiChar = 'Dropbox/Send/Succeeded';
+// if you want to get download links of sent files
+// use ME_DROPBOX_SENT hook. you'll get:
+type
+ TTRANSFERINFO = record
+ hProcess:THANDLE; // hProcess
+ status :int; // status of transfer. 0 on success otherwise fail
+ data :pointer; // NULL ended array of download links
+ end;
-// notifies a caller about file send failure
+const
+// notifies a caller that file has been sent
// wParam = (MCONTACT)hContact
-// lParam = (LPARAM)(HANDLE)hProcess
- ME_DROPBOX_SEND_FAILED:PAnsiChar = 'Dropbox/Send/Failed';
+// lParam = (LPARAM)(TRANSFERINFO*)info - transfer info
+ ME_DROPBOX_SENT:PAnsiChar = 'Dropbox/Sent/Event';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_flags.inc b/plugins/ExternalAPI/delphi/m_flags.inc
index f060b10608..0fc53209c0 100644
--- a/plugins/ExternalAPI/delphi/m_flags.inc
+++ b/plugins/ExternalAPI/delphi/m_flags.inc
@@ -21,54 +21,56 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
{$DEFINE M_FLAGS}
const
-
-{
- Country Flags Plugin v0.1.0.3
-}
-
-{ interface id }
- MIID_FLAGS: TGUID = '{88A3B66E-C438-4381-BC17-71D99D225F9C}';
-
-{ Load a country flag icon from the skin library. v0.1.0.0+
+{* Load a country flag icon from the skin library. v0.1.0.0+
The retrieved icon should be released using MS_SKIN2_RELEASEICON after use.
The country numbers can be retrieved using MS_UTILS_GETCOUNTRYLIST.
Another way to get the country numbers are the CTRY_* constants in winnls.h of WinAPI.
To retrieve the country number from a locale, call GetLocaleInfo().
with LOCALE_ICOUNTRY.
- wParam : countryNumber
- lParam : (bool)fReturnHandle (nonzero to to retrieve the icolib handle instead of the icon)
+ wParam=countryNumber
+ lParam=(BOOL)fReturnHandle (nonzero to to retrieve the icolib handle instead of the icon)
Returns a icon handle (HICON) on success, NULL on error.
-}
- MS_FLAGS_LOADCOUNTRYFLAGICON = 'Flags/LoadCountryFlagIcon';
+*}
+ MS_FLAGS_LOADFLAGICON:PAnsiChar = 'Flags/LoadFlagIcon';
-{ Create a merged country flag icon. v0.1.0.0+
+ CTRY_UNSPECIFIED = 0;
+ CTRY_OTHER = 9999;
+ CTRY_UNKNOWN = $FFFF;
+
+{* Create a merged country flag icon. v0.1.0.0+
The retrieved icon should be released using DestroyIcon() after use.
- wParam : countryNumberUpper
- lParam : countryNumberLower
+ wParam=countryNumberUpper
+ lParam=countryNumberLower
Returns a icon handle (HICON) on success, NULL on error.
-}
- MS_FLAGS_CREATEMERGEDFLAGICON = 'Flags/CreateMergedFlagIcon';
+*}
+ MS_FLAGS_CREATEMERGEDFLAGICON:PAnsiChar = 'Flags/CreateMergedFlagIcon';
-{ Get a corresponding country given an (external) IP address. v0.1.0.0+
+{* Get a corresponding country given an (external) IP address. v0.1.0.0+
The retrieved number can be converted to a normal country name
using MS_UTILS_GETCOUNTRYBYNUMBER.
- wParam : dwExternalIP (same format as used Netlib)
- lParam : 0
+ wParam=dwExternalIP (same format as used in Netlib)
+ lParam=0
Returns a country number on success,
or 0xFFFF on failure (MS_UTILS_GETCOUNTRYBYNUMBER returns "Unknown" for this).
-}
- MS_FLAGS_IPTOCOUNTRY = 'Flags/IpToCountry';
+*}
+ MS_FLAGS_IPTOCOUNTRY:PAnsiChar = 'Flags/IpToCountry';
-{ Detect the origin country of a contact. v0.1.0.0+
+{* Detect the origin country of a contact. v0.1.0.0+
This uses the contacts's IP first, and falls back on using
CNF_COUNTRY and CNF_COCOUNTRY of contact details.
To get the contact's IP it relies on the db setting
"RealIP" in the proto module.
- wParam : (WPARAM)(HANDLE)hContact
- lParam : 0
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
Returns a country number on success,
or 0xFFFF on failure (MS_UTILS_GETCOUNTRYBYNUMBER returns "Unknown" for this).
-}
- MS_FLAGS_DETECTCONTACTORIGINCOUNTRY = 'Flags/DetectContactOriginCountry';
+*}
+ MS_FLAGS_DETECTCONTACTORIGINCOUNTRY:PAnsiChar = 'Flags/DetectContactOriginCountry';
+ MS_FLAGS_GETCONTACTORIGINCOUNTRY :PAnsiChar = 'Flags/GetContactOriginCountry';//for beta version 0.1.1.0
+
+ SETTING_SHOWSTATUSICONFLAG_DEFAULT = 1;
+ SETTING_SHOWEXTRAIMGFLAG_DEFAULT = 1;
+ SETTING_USEUNKNOWNFLAG_DEFAULT = 1;
+ SETTING_USEIPTOCOUNTRY_DEFAULT = 1;
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_folders.inc b/plugins/ExternalAPI/delphi/m_folders.inc
index 7bafe3248e..d1f555d3ae 100644
--- a/plugins/ExternalAPI/delphi/m_folders.inc
+++ b/plugins/ExternalAPI/delphi/m_folders.inc
@@ -41,7 +41,7 @@ const
FOLDER_LOGS = PROFILE_PATH+'\'+CURRENT_PROFILE+'\logs';
FOLDER_RECEIVED_FILES = PROFILE_PATH+'\'+CURRENT_PROFILE+'\received files';
FOLDER_DOCS = MIRANDA_PATH+'\'+'docs';
-
+
FOLDER_CONFIG = PLUGINS_PATH+'\config';
FOLDER_SCRIPTS = MIRANDA_PATH+'\scripts';
FOLDER_UPDATES = MIRANDA_PATH+'\updates';
@@ -84,7 +84,7 @@ const
Returns a handle to the registered path or 0 on error.
You need to use this to call the other services.
}
- MS_FOLDERS_REGISTER_PATH = 'Folders/Register/Path';
+ MS_FOLDERS_REGISTER_PATH:PAnsiChar = 'Folders/Register/Path';
{
Folders/Get/PathSize service
@@ -94,7 +94,7 @@ const
it will either call strlen() or wcslen() to get the length of the string.
Returns the size of the buffer.
}
- MS_FOLDERS_GET_SIZE = 'Folders/Get/PathSize';
+ MS_FOLDERS_GET_SIZE:PAnsiChar = 'Folders/Get/PathSize';
type
TFOLDERSGETDATA = record
@@ -114,7 +114,7 @@ const
lParam - (LPARAM) (FOLDERSGETDATA *) pointer to a FOLDERSGETDATA that has all the relevant fields filled.
Should return 0 on success, or nonzero otherwise.
}
- MS_FOLDERS_GET_PATH = 'Folders/Get/Path';
+ MS_FOLDERS_GET_PATH:PAnsiChar = 'Folders/Get/Path';
{
Folders/On/Path/Changed
@@ -122,6 +122,6 @@ const
lParam - (LPARAM) 0
Triggered when the folders change, you should reget the paths you registered.
}
- ME_FOLDERS_PATH_CHANGED = 'Folders/On/Path/Changed';
+ ME_FOLDERS_PATH_CHANGED:PAnsiChar = 'Folders/On/Path/Changed';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_ftpfile.inc b/plugins/ExternalAPI/delphi/m_ftpfile.inc
new file mode 100644
index 0000000000..0f43e8941e
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_ftpfile.inc
@@ -0,0 +1,101 @@
+{
+FTP File YM plugin
+Copyright (C) 2007-2010 Jan Holub
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+}
+
+
+{$IFNDEF M_FTP_FILE}
+{$DEFINE M_FTP_FILE}
+
+const
+ FNUM_DEFAULT = 0; // user's default FTP server
+ FNUM_FTP1 = 1; // first FTP server in setting
+ FNUM_FTP2 = 2; // second...
+ FNUM_FTP3 = 3;
+ FNUM_FTP4 = 4;
+ FNUM_FTP5 = 5;
+
+ FMODE_RAWFILE = 1; // Object list contains path(s) to file(s) which will be uploaded as they are
+ FMODE_ZIPFILE = 2; // ... path(s) to file(s) which will be zipped and uploaded as one ZIP file
+ FMODE_ZIPFOLDER = 4; // ... path to folder which will be zipped and uploaded as one ZIP file (objectCount == 1)
+
+ FUPL_UNICODE = 1; // Object list contains WCHAR* paths
+
+type
+ TFTPUPLOAD = record
+ cbSize:int; // size of the structure
+ hContact:TMCONTACT; // contact handle, can be NULL
+ ftpNum:byte; // number of the FTP server which will be used for upload, can be one of FNUM_* values
+ mode:byte; // upload mode, can be one of FMODE_* values
+ flags:dword; // bitwise OR of the FUPL_* flags above
+ pszObjects:^TChar; // pointer to the array of the object(s) to upload, content is determined by MODE value
+ objectCount:int; // number of items in Object list
+ end;
+
+const
+//
+// Send file(s) or folder in selected mode to the FTP server
+// wParam = 0; not used
+// lParam = (LPARAM)(FTPUPLOAD*)&ftpu; pointer to FTPUPLOAD
+// returns 0 if upload started with no errors, nonzero otherwise
+//
+ MS_FTPFILE_UPLOAD:PAnsiChar = 'FTPFile/Upload';
+
+(*
+__inline static INT_PTR FTPFileUploadA(MCONTACT hContact, BYTE ftpNum, BYTE mode, char **pszObjects, int objCount)
+{
+ FTPUPLOAD ftpu = {0};
+ ftpu.cbSize = sizeof(ftpu);
+ ftpu.hContact = hContact;
+ ftpu.ftpNum = ftpNum;
+ ftpu.mode = mode;
+ ftpu.pszObjects = pszObjects;
+ ftpu.objectCount = objCount;
+ return CallService(MS_FTPFILE_UPLOAD, 0, (LPARAM)&ftpu);
+}
+
+__inline static INT_PTR FTPFileUploadW(MCONTACT hContact, BYTE ftpNum, BYTE mode, wchar_t **pswzObjects, int objCount)
+{
+ FTPUPLOAD ftpu = {0};
+ ftpu.cbSize = sizeof(ftpu);
+ ftpu.hContact = hContact;
+ ftpu.ftpNum = ftpNum;
+ ftpu.mode = mode;
+ ftpu.flags = FUPL_UNICODE;
+ ftpu.pswzObjects = pswzObjects;
+ ftpu.objectCount = objCount;
+ return CallService(MS_FTPFILE_UPLOAD, 0, (LPARAM)&ftpu);
+}
+*)
+
+//
+// Show a simple file manager
+// wParam = 0; not used
+// lParam = 0; not used
+// returns 0 always
+//
+ MS_FTPFILE_SHOWMANAGER:PAnsiChar = 'FTPFile/ShowManager';
+
+
+//
+// OBSOLOTE SERVICE (used by Send Screenshot plugin)
+// Do NOT use it!
+//
+ MS_FTPFILE_SHAREFILE:PAnsiChar = 'FTPFile/ShareFiles';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_historypp.inc b/plugins/ExternalAPI/delphi/m_historypp.inc
index f651c0a09f..9e0bbec4ea 100644
--- a/plugins/ExternalAPI/delphi/m_historypp.inc
+++ b/plugins/ExternalAPI/delphi/m_historypp.inc
@@ -1,7 +1,7 @@
{
History++ plugin for Miranda IM: the free IM client for Microsoft* Windows*
- Copyright (‘) 2006-2007 theMIROn, 2003-2006 Art Fedorov.
+ Copyright (C) 2006-2009 theMIROn, 2003-2006 Art Fedorov.
History+ parts (C) 2001 Christian Kastner
This program is free software; you can redistribute it and/or modify
@@ -48,60 +48,61 @@
{$DEFINE M_HISTORYPP}
const
- //** VALUES FOR TItemRenderDetails.dwHistoryWindow
- //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
- //** This is one of the following params,
- //** saying what kind of history window displays
- //** processed item.
-
- // IRDHW_CONTACTHISTORY. The window is ordinary
- // contact history.
- IRDHW_CONTACTHISTORY = $0001;
- // IRDHW_GLOBALHISTORY. The window is global
- // history (system history). Invokes by
- // Menu -> System History
- IRDHW_GLOBALHISTORY = $0002;
- // IRDHW_GLOBALSEARCH. The window is search
- // window and the processed item is the
- // result of the global search.
- IRDHW_GLOBALSEARCH = $0003;
- // IRDHW_EXTERNAL. The window is external window
- IRDHW_EXTERNALGRID = $0004;
-
- //** VALUES FOR TItemRenderDetails.dwFlags
- //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
- //** These flags inform you about what you are
- //** processing. Like saying that the item is
- //** selected or it's inline or such stuff
-
- // IRDF_SELECTED. The processed item is selected.
- // The background color will always be clHighlight
- // even if you change it (i will change it back).
- // Though, I will not touch font or font color.
- IRDF_SELECTED = $0001;
- // IRDF_INLINE. The RichEdit provided is not one
- // that is used for drawing a cell, but the one
- // used for "inline editing".
- IRDF_INLINE = $0002;
- // IRDF_EVENT. The RichEdit provided is from "Open Event"
- // window. It's the window which opens when you right-click
- // item in contact's history and select "Open"
- IRDF_EVENT = $0004;
+
+ //** VALUES FOR TItemRenderDetails.dwHistoryWindow
+ //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
+ //** This is one of the following params,
+ //** saying what kind of history window displays
+ //** processed item.
+
+ // IRDHW_CONTACTHISTORY. The window is ordinary
+ // contact history.
+ IRDHW_CONTACTHISTORY = $0001;
+ // IRDHW_GLOBALHISTORY. The window is global
+ // history (system history). Invokes by
+ // Menu -> System History
+ IRDHW_GLOBALHISTORY = $0002;
+ // IRDHW_GLOBALSEARCH. The window is search
+ // window and the processed item is the
+ // result of the global search.
+ IRDHW_GLOBALSEARCH = $0003;
+ // IRDHW_EXTERNAL. The window is external window
+ IRDHW_EXTERNALGRID = $0004;
+
+ //** VALUES FOR TItemRenderDetails.dwFlags
+ //** Used in ME_HPP_RICHEDIT_ITEMPROCESS event
+ //** These flags inform you about what you are
+ //** processing. Like saying that the item is
+ //** selected or it's inline or such stuff
+
+ // IRDF_SELECTED. The processed item is selected.
+ // The background color will always be clHighlight
+ // even if you change it (i will change it back).
+ // Though, I will not touch font or font color.
+ IRDF_SELECTED = $0001;
+ // IRDF_INLINE. The RichEdit provided is not one
+ // that is used for drawing a cell, but the one
+ // used for "inline editing".
+ IRDF_INLINE = $0002;
+ // IRDF_EVENT. The RichEdit provided is from "Open Event"
+ // window. It's the window which opens when you right-click
+ // item in contact's history and select "Open"
+ IRDF_EVENT = $0004;
type
TItemRenderDetails = record
- cbSize :dword; // size of the structure in bytes
- hContact :THANDLE; // handle to the contact for which the event is processed
- hDBEvent :THANDLE; // handle to the event which is processed
- dwEventTime :dword; // timestamp of the event
- wEventType :word; // Event's flags (see m_database, EVENTTYPE_*; m_icq, ICQEVENTTYPE_*)
- IsEventSent :ByteBool; // Outgoing event. True if DBEF_SENT event flag is present (see m_database)
- dwFlags :dword; // Any reasonable combination of IRDF_* flags.
- bHistoryWindow:byte; // What kind of window history. See IRDHW_* values
- pProto :PAnsiChar; // Proto of the event, if available
- pModule :PAnsiChar; // Module of the event, if available
- pText :PWideChar; // Text of the event, not used now
- pExtended :PAnsiChar; // Extended text, used for storing urls, paths and so on
+ cbSize : DWord; // size of the structure in bytes
+ hContact : TMCONTACT; // handle to the contact for which the event is processed
+ hDBEvent : THANDLE; // handle to the event which is processed
+ dwEventTime : DWord; // timestamp of the event
+ wEventType : Word; // Event's flags (see m_database, EVENTTYPE_*; m_icq, ICQEVENTTYPE_*)
+ IsEventSent : ByteBool; // Outgoing event. True if DBEF_SENT event flag is present (see m_database)
+ bHistoryWindow: Byte; // What kind of window history. See IRDHW_* values
+ dwFlags : DWord; // Any reasonable combination of IRDF_* flags.
+ pProto : PAnsiChar; // Proto of the event, if available
+ pModule : PAnsiChar; // Module of the event, if available
+ pText : PWideChar; // Text of the event, not used now
+ pExtended : PAnsiChar; // Extended text, used for storing urls, paths and so on
end;
PItemRenderDetails = ^TItemRenderDetails;
@@ -144,15 +145,14 @@ const
// lParam - zero
MS_HPP_SHOWGLOBALSEARCH = 'History++/ShowGlobalSearch';
-type
- TOpenEventParams = record
- cbSize : dword;
- hContact : THANDLE;
- hDBEvent : THANDLE;
- pPassword: PAnsiChar;
- end;
-
- POpenEventParams = ^TOpenEventParams;
+ type
+ POpenEventParams = ^TOpenEventParams;
+ TOpenEventParams = record
+ cbSize : DWord;
+ hContact : TMCONTACT;
+ hDBEvent : THANDLE;
+ pPassword: PAnsiChar;
+ end;
const
@@ -164,7 +164,7 @@ const
// provided event
// wParam - pointer to TOpenEventParams structure
// lParam - zero
- // Return - bool, True if contact opened, False if password
+ // Return - BOOL, True if contact opened, False if password
// field opened
// Note: if you just want to show contact's history,
// use system service MS_HISTORY_SHOWCONTACTHISTORY
diff --git a/plugins/ExternalAPI/delphi/m_historystats.inc b/plugins/ExternalAPI/delphi/m_historystats.inc
index 03955de447..dbd5c886bf 100644
--- a/plugins/ExternalAPI/delphi/m_historystats.inc
+++ b/plugins/ExternalAPI/delphi/m_historystats.inc
@@ -7,7 +7,7 @@ const
*
* @version 0.1.5.1+
*)
- MIID_HISTORYSTATS:TGUD:= '$AF0DAD8E-$0695-$414B-$B306-$F4C7B7B41DA0';
+ MIID_HISTORYSTATS:TGUID = '{AF0DAD8E-0695-414B-B306-F4C7B7B41DA0}';
(**
* Checks if a specified contact is set to be excluded from the statistics generated
@@ -20,7 +20,7 @@ const
* @param lParam Must be set to 0.
* @return Returns 1 if the specified contact is set to be excluded and 0 otherwise.
*)
- MS_HISTORYSTATS_ISEXCLUDED = 'HistoryStats/IsExcluded';
+ MS_HISTORYSTATS_ISEXCLUDED:PAnsiChar = 'HistoryStats/IsExcluded';
(**
* Sets if a specified contact should be included in or excluded from the statistics
@@ -36,6 +36,6 @@ const
* 0 if you no longer want to exclude the specified contact.
* @return Always returns 0.
*)
- MS_HISTORYSTATS_SETEXCLUDE = 'HistoryStats/SetExclude';
+ MS_HISTORYSTATS_SETEXCLUDE:PAnsiChar = 'HistoryStats/SetExclude';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_httpserver.inc b/plugins/ExternalAPI/delphi/m_httpserver.inc
index 4ac210ce9d..c5ba79d19c 100644
--- a/plugins/ExternalAPI/delphi/m_httpserver.inc
+++ b/plugins/ExternalAPI/delphi/m_httpserver.inc
@@ -27,10 +27,10 @@ type
PSTFileShareInfo = ^TSTFileShareInfo;
TSTFileShareInfo = record
lStructSize :dword; // Set to sizeof(STFileShareInfo)
- pszSrvPath :PAnsiChar; // Server path
+ pszSrvPath :TChar; // Server path
dwMaxSrvPath :dword; // Buffer allocated for Server path only used when information
// is requested from HTTP server.
- pszRealPath :PAnsiChar; // Real path can be relative or complete
+ pszRealPath :TChar; // Real path can be relative or complete
dwMaxRealPath:dword; // Buffer allocated for Real path only used when information is
// requested from HTTP server.
dwAllowedIP :dword; // The IP address which is allowed to access this share
@@ -58,7 +58,7 @@ const
// will just be updated with the new settings.
//
// returns 0 on success, nonzero on failure
- MS_HTTP_ADD_CHANGE_REMOVE = 'HTTPServer/AddChangeRemove';
+ MS_HTTP_ADD_CHANGE_REMOVE:PAnsiChar = 'HTTPServer/AddChangeRemove';
/////////////////////////////////////////////
////// Service MS_HTTP_GET_SHARE //////
@@ -71,7 +71,7 @@ const
//
// returns 0 on success, nonzero on failure
- MS_HTTP_GET_SHARE = 'HTTPServer/GetShare';
+ MS_HTTP_GET_SHARE:PAnsiChar = 'HTTPServer/GetShare';
/////////////////////////////////////////////
/// Service MS_HTTP_ACCEPT_CONNECTIONS ///
@@ -84,7 +84,7 @@ const
//
// returns 0 on success, nonzero on failure
- MS_HTTP_ACCEPT_CONNECTIONS = 'HTTPServer/AcceptConnections';
+ MS_HTTP_ACCEPT_CONNECTIONS:PAnsiChar = 'HTTPServer/AcceptConnections';
/////////////////////////////////////////////
//// Service MS_HTTP_GET_ALL_SHARES /////
@@ -99,7 +99,7 @@ const
//
// returns the count of shares in the buffer pointed to by LPSTFileShareInfo
- MS_HTTP_GET_ALL_SHARES = 'HTTPServer/GetAllShares';
+ MS_HTTP_GET_ALL_SHARES:PAnsiChar = 'HTTPServer/GetAllShares';
/////////////////////////////////////////////
//// Service MS_HTTP_GET_LINK /////
@@ -112,6 +112,6 @@ const
//
// Return the URL link to the pszSrvPath
- MS_HTTP_GET_LINK = 'HTTPServer/GetLink';
+ MS_HTTP_GET_LINK:PAnsiChar = 'HTTPServer/GetLink';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_kbdnotify.inc b/plugins/ExternalAPI/delphi/m_kbdnotify.inc
index b6967ecead..36db2afcb5 100644
--- a/plugins/ExternalAPI/delphi/m_kbdnotify.inc
+++ b/plugins/ExternalAPI/delphi/m_kbdnotify.inc
@@ -22,38 +22,38 @@ const
//wParam=0
//lParam=0
//returns 0
- MS_KBDNOTIFY_ENABLE = 'KeyboardNotify/Enable';
+ MS_KBDNOTIFY_ENABLE:PAnsiChar = 'KeyboardNotify/Enable';
//Disables all notifications (for use by BossKey)
//wParam=0
//lParam=0
//returns 0
- MS_KBDNOTIFY_DISABLE = 'KeyboardNotify/Disable';
+ MS_KBDNOTIFY_DISABLE:PAnsiChar = 'KeyboardNotify/Disable';
//Makes the flashing begin
//wParam=(unsigned int)eventCount
//lParam=(AnsiChar *)szFlashingSequence or NULL if you want the plugin to use current settings
//returns 0
- MS_KBDNOTIFY_STARTBLINK = 'KeyboardNotify/StartBlinking';
+ MS_KBDNOTIFY_STARTBLINK:PAnsiChar = 'KeyboardNotify/StartBlinking';
//Receives the number of events that were opened (usuful for the 'until events opened' setting)
//wParam=(unsigned int)eventCount
//lParam=0
//returns 0
- MS_KBDNOTIFY_EVENTSOPENED = 'KeyboardNotify/EventsWereOpened';
+ MS_KBDNOTIFY_EVENTSOPENED:PAnsiChar = 'KeyboardNotify/EventsWereOpened';
//Informs if the flashing is active
//wParam=0
//lParam=0
//returns 0 if the flashing is inactive or a pointer to the string representing the sequence being used
- MS_KBDNOTIFY_FLASHINGACTIVE = 'KeyboardNotify/IsFlashingActive';
+ MS_KBDNOTIFY_FLASHINGACTIVE:PAnsiChar = 'KeyboardNotify/IsFlashingActive';
//Normalizes the flashing sequence informed
//wParam=0
//lParam=(AnsiChar *)szFlashingSequence <- it is rewritten
//returns a pointer to the string representing the sequence normalized (which is in fact lParam)
- MS_KBDNOTIFY_NORMALSEQUENCE = 'KeyboardNotify/NormalizeSequence';
+ MS_KBDNOTIFY_NORMALSEQUENCE:PAnsiChar = 'KeyboardNotify/NormalizeSequence';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc b/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc
new file mode 100644
index 0000000000..ee97f3d3ce
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_msg_buttonsbar.inc
@@ -0,0 +1,117 @@
+{$IFNDEF M_MSG_BUTTONSBAR}
+{$DEFINE M_MSG_BUTTONSBAR}
+
+//////////////////////////////////////////////////////////////////////////
+// Services
+//
+//////////////////////////////////////////////////////////////////////////
+// Adding a button
+//
+// wParam = 0
+// lParam = (BBButton *) &description
+const
+ MS_BB_ADDBUTTON:PAnsiChar = 'TabSRMM/ButtonsBar/AddButton';
+
+//////////////////////////////////////////////////////////////////////////
+// Remove button
+//
+// wParam = 0
+// lParam = (BBButton *) &description, only button ID and ModuleName used
+ MS_BB_REMOVEBUTTON:PAnsiChar = 'TabSRMM/ButtonsBar/RemoveButton';
+
+//////////////////////////////////////////////////////////////////////////
+// ModifyButton(global)
+//
+// wParam = 0
+// lParam = (BBButton *) &description
+ MS_BB_MODIFYBUTTON:PAnsiChar = 'TabSRMM/ButtonsBar/ModifyButton';
+
+
+ BBSF_HIDDEN = 1;
+ BBSF_DISABLED = 2;
+ BBSF_PUSHED = 4;
+ BBSF_RELEASED = 8;
+
+//////////////////////////////////////////////////////////////////////////
+// GetButtonState(local)
+//
+// wParam = hContact
+// lParam = (BBButton *) &description , only ModuleName and ID used
+// Returns BBButton struct with BBSF_ bbbFlags:
+ MS_BB_GETBUTTONSTATE:PansiChar = 'TabSRMM/ButtonsBar/GetButtonState';
+
+//////////////////////////////////////////////////////////////////////////
+// SetButtonState (local)
+//
+// wParam = hContact
+// lParam = (BBButton *) &description , ModuleName, ID,hIcon,Tooltip, and BBSF_ bbbFlags are used
+ MS_BB_SETBUTTONSTATE:PAnsiChar = 'TabSRMM/ButtonsBar/SetButtonState';
+
+
+////////////////////////////////////////////////////////////////
+//Events
+//
+///////////////////////////////////////////////////
+// ToolBar loaded event
+// wParam = 0;
+// lParam = 0;
+// This event will be send after module loaded and after each toolbar reset
+// You should add your buttons on this event
+ ME_MSG_TOOLBARLOADED:PAnsiChar = 'TabSRMM/ButtonsBar/ModuleLoaded';
+
+///////////////////////////////////////////////////
+// ButtonClicked event
+// wParam = (HANDLE)hContact;
+// lParam = (CustomButtonClickData *)&CustomButtonClickData;
+// catch to show a popup menu, etc.
+ ME_MSG_BUTTONPRESSED:PAnsiChar = 'TabSRMM/ButtonsBar/ButtonPressed';
+
+//event flags
+ BBCF_RIGHTBUTTON = 1;
+ BBCF_SHIFTPRESSED = 2;
+ BBCF_CONTROLPRESSED = 4;
+ BBCF_ARROWCLICKED = 8;
+
+type
+ pCustomButtonClickData = ^tCustomButtonClickData;
+ tCustomButtonClickData = record
+ cbSize :int;
+ pt :TPOINT; // screen coordinates for menus
+ pszModule :PAnsiChar; // button owners name
+ dwButtonId:dword; // registered button ID
+ hwndFrom :HWND; // button parents HWND
+ hContact :TMCONTACT;
+ flags :dword; // BBCF_ flags
+ end;
+
+const
+//button flags
+ BBBF_DISABLED = $0001;
+ BBBF_HIDDEN = $0002;
+ BBBF_ISPUSHBUTTON = $0004;
+ BBBF_ISARROWBUTTON = $0008;
+ BBBF_ISCHATBUTTON = $0010;
+ BBBF_ISIMBUTTON = $0020;
+ BBBF_ISLSIDEBUTTON = $0040;
+ BBBF_ISRSIDEBUTTON = $0080;
+ BBBF_CANBEHIDDEN = $0100;
+ BBBF_ISDUMMYBUTTON = $0200;
+ BBBF_ANSITOOLTIP = $0400;
+ BBBF_CREATEBYID = $0800; //only for tabsrmm internal use
+
+type
+ tagBBButton = record
+ cbSize :int; // size of structure
+ dwButtonID :dword; // your button ID, will be combined with pszModuleName for storing settings, etc...
+ pszModuleName:PAnsiChar; // module name without spaces and underline symbols (e.g. "tabsrmm")
+ szTooltip :TChar; // button's tooltip
+ dwDefPos :dword; // default order pos of button, counted from window edge (left or right)
+ // use value >100, because internal buttons using 10,20,30... 80, etc
+ iButtonWidth :int; // must be 0
+ bbbFlags :dword; // combine of BBBF_ flags above
+ hIcon :HICON; // Handle to icolib registered icon, it's better to register with pszSection = "TabSRMM/Toolbar"
+ end;
+ tBBButton = tagBBButton;
+
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_mydetails.inc b/plugins/ExternalAPI/delphi/m_mydetails.inc
index c908849a7b..571504a2a2 100644
--- a/plugins/ExternalAPI/delphi/m_mydetails.inc
+++ b/plugins/ExternalAPI/delphi/m_mydetails.inc
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
}
-{$FINDEF M_MYDETAILS}
+{$IFNDEF M_MYDETAILS}
{$DEFINE M_MYDETAILS}
const
diff --git a/plugins/ExternalAPI/delphi/m_notify.inc b/plugins/ExternalAPI/delphi/m_notify.inc
index e8c614d282..6d269b0f99 100644
--- a/plugins/ExternalAPI/delphi/m_notify.inc
+++ b/plugins/ExternalAPI/delphi/m_notify.inc
@@ -8,60 +8,59 @@ like osd, popup, ticker etc.
const
{ Options UI event and service. The same as for miranda options }
- ME_NOTIFY_OPT_INITIALISE = 'Notify/Opt/Initialise';
- MS_NOTIFY_OPT_ADDPAGE = 'Notify/Opt/AddPage';
+ ME_NOTIFY_OPT_INITIALISE:PAnsiChar = 'Notify/Opt/Initialise';
+ MS_NOTIFY_OPT_ADDPAGE:PAnsiChar = 'Notify/Opt/AddPage';
type
- tagMNOTIFYACTIONINFO = record
+ PMNOTIFYACTIONINFO = ^TMNOTIFYACTIONINFO;
+ TMNOTIFYACTIONINFO = record
icon :HICON;
name :array [0..MAXMODULELABELLENGTH-1] of AnsiChar;
service:array [0..MAXMODULELABELLENGTH-1] of AnsiChar;
cookie :dword;
end;
- MNOTIFYACTIONINFO = tagMNOTIFYACTIONINFO;
// Just like miranda pluginLink... This should work faster then services,
// we need some reactivity in notifications.
type
- tagMNNOTIFYLINK = record
+ PMNOTIFYLINK = ^TMNOTIFYLINK;
+ TMNOTIFYLINK = record
// Create a new notification type
- function Register(name:PAnsiChar;icon:HICON):THANDLE;cdecl;
+ Register:function(name:PAnsiChar;icon:HICON):THANDLE;cdecl;
// Create a new notification object
- function Create(atype:THANDLE):THANDLE;cdecl;
+ Create:function(atype:THANDLE):THANDLE;cdecl;
// Check is handle is a valid notification object
- function IsValid(notify:THANDLE):integer;cdecl;
+ IsValid:function(notify:THANDLE):integer;cdecl;
// Set/get information about object, or type defaults
- function Set(notifyORtype:THANDLE;name:PAnsiChar;val:TDBVARIANT):integer;cdecl;
- function Get(notifyORtype:THANDLE;name:PAnsiChar;val:PDBVARIANT):integer;cdecl;
+ _Set:function(notifyORtype:THANDLE;name:PAnsiChar;val:TDBVARIANT):integer;cdecl;
+ _Get:function(notifyORtype:THANDLE;name:PAnsiChar;val:PDBVARIANT):integer;cdecl;
// Set/get actions
- function AddAction (notifyORtype:THANDLE;icon:HICON;name:PAnsiChar;service:PAnsiChar;cookie:dword):integer;cdecl;
- function GetActions(notifyORtype:THANDLE;actions:PMNOTIFYACTIONINFO):integer;cdecl;
+ AddAction :function(notifyORtype:THANDLE;icon:HICON;name:PAnsiChar;service:PAnsiChar;cookie:dword):integer;cdecl;
+ GetActions:function(notifyORtype:THANDLE;actions:PMNOTIFYACTIONINFO):integer;cdecl;
// Increment/decrement refer count of notification object. Unreferred objects are destroyed
- function AddRef (notify:THANDLE):integer;cdecl;
- function Release(notify:THANDLE):integer;cdecl;
+ AddRef :function(notify:THANDLE):integer;cdecl;
+ Release:function(notify:THANDLE):integer;cdecl;
// Notify user
- procedure Show (notify:THANDLE);cdecl;
- procedure Update(notify:THANDLE);cdecl;
- procedure Remove(notify:THANDLE);cdecl;
+ Show :procedure(notify:THANDLE);cdecl;
+ Update:procedure(notify:THANDLE);cdecl;
+ Remove:procedure(notify:THANDLE);cdecl;
end;
- PMNOTIFYLINK = ^TMNOTIFYLINK;
- TMNOTIFYLINK = tagMNOTIFYLINK;
const
// Get the MNOTIFYLINK struct
// result = (LRESULT)(MNOTIFYLINK* )notifyLink
- MS_NOTIFY_GETLINK = 'Notify/GetLink';
+ MS_NOTIFY_GETLINK:PAnsiChar = 'Notify/GetLink';
// Hook this to process corresponding actions
- ME_NOTIFY_SHOW = 'Notify/Show';
- ME_NOTIFY_UPDATE = 'Notify/Update';
- ME_NOTIFY_REMOVE = 'Notify/Remove';
+ ME_NOTIFY_SHOW :PAnsiChar = 'Notify/Show';
+ ME_NOTIFY_UPDATE:PAnsiChar = 'Notify/Update';
+ ME_NOTIFY_REMOVE:PAnsiChar = 'Notify/Remove';
var
notifyLink:PMNOTIFYLINK;
diff --git a/plugins/ExternalAPI/delphi/m_nudge.inc b/plugins/ExternalAPI/delphi/m_nudge.inc
index 631a28f785..dfc72e19db 100644
--- a/plugins/ExternalAPI/delphi/m_nudge.inc
+++ b/plugins/ExternalAPI/delphi/m_nudge.inc
@@ -1,5 +1,5 @@
-{$INFDEF NUDGE}
-{$DEFINE NUDGE}
+{$IFNDEF M_NUDGE}
+{$DEFINE M_NUDGE}
const
// protocol service that sends a nudge
PS_SEND_NUDGE = '/SendNudge';
@@ -8,9 +8,10 @@ const
PE_NUDGE = '/Nudge';
const
- MS_SHAKE_CLIST = 'SHAKE/Service/ShakeClist';
- MS_SHAKE_CHAT = 'SHAKE/Service/ShakeChat';
- MS_SHAKE_CLIST_TRIGGER = 'SHAKE/Service/TriggerShakeClist';
- MS_SHAKE_CHAT_TRIGGER = 'SHAKE/Service/TirggerShakeChat';
- MS_NUDGE_SEND = 'NUDGE/Send';
+ MS_SHAKE_CLIST :PAnsiChar = 'SHAKE/Service/ShakeClist';
+ MS_SHAKE_CHAT :PAnsiChar = 'SHAKE/Service/ShakeChat';
+ MS_SHAKE_CLIST_TRIGGER:PAnsiChar = 'SHAKE/Service/TriggerShakeClist';
+ MS_SHAKE_CHAT_TRIGGER :PAnsiChar = 'SHAKE/Service/TirggerShakeChat';
+ MS_NUDGE_SEND :PAnsiChar = 'NUDGE/Send';
+
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_nxsn.inc b/plugins/ExternalAPI/delphi/m_nxsn.inc
new file mode 100644
index 0000000000..2d1093db74
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_nxsn.inc
@@ -0,0 +1,20 @@
+{$IFNDEF M_NXSN}
+{$DEFINE M_NXSN}
+
+const
+// tabSRMM stuff (logging to message window)
+ EVENTTYPE_STATUSCHANGE = 25368;
+
+{
+MCONTACT hContact = wParam;
+WORD oldStatus = LOWORD(lParam);
+WORD newStatus = HIWORD(lParam);
+oldStatus is the status the contact was before the change.
+newStatus is the status the contact is now.
+Cast them to (int) if you need them that way.
+}
+ ME_STATUSCHANGE_CONTACTSTATUSCHANGED:PAnsiChar = 'Miranda/StatusChange/ContactStatusChanged';
+
+ MS_STATUSCHANGE_MENUCOMMAND:PAnsiChar = 'NewStatusNotify/EnableDisableMenuCommand';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_quickcontacts.inc b/plugins/ExternalAPI/delphi/m_quickcontacts.inc
index d82d23f5e7..af3de6696f 100644
--- a/plugins/ExternalAPI/delphi/m_quickcontacts.inc
+++ b/plugins/ExternalAPI/delphi/m_quickcontacts.inc
@@ -27,5 +27,6 @@ wParam: ignored
lParam: ignored
}
const
- MS_QC_SHOW_DIALOG = 'QuickContacts/ShowDialog';
+ MS_QC_SHOW_DIALOG:PAnsiChar = 'QuickContacts/ShowDialog';
+
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_quotes.inc b/plugins/ExternalAPI/delphi/m_quotes.inc
new file mode 100644
index 0000000000..1a6c597b6d
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_quotes.inc
@@ -0,0 +1,36 @@
+{$IFNDEF M_QUOTES}
+{$DEFINE M_QUOTES}
+
+const
+{*
+ * Export the contact (or all contacts) to xml file
+ * wParam = (WPARAM)(HANDLE)hContact to export or 0 to export all contacts
+ * lParam = (LPARAM)(const char*)pszFileName - pointer to file name to export or
+ * 0 in this case the dialog to select a file to export would be shown
+ * returns 0 if export was successfull,
+ * -1 if user canceled export and
+ * value greater than zero if error occurred during exporting
+ *}
+ MS_QUOTES_EXPORT:PAnsiChar = 'Quotes/Export';
+
+{*
+ * Import the contact (or all contacts) from xml file
+ * wParam = flags
+ * lParam = (LPARAM)(const char*)pszFileName - pointer to file name to import or
+ * 0 in this case the dialog to select a file to import would be shown
+ * returns 0 if import was successfull,
+ * -1 if user canceled import and
+ * value greater than zero if error occurred during importing
+ *}
+
+// if contact(s) exists user would be asked to overwrite these contacts
+// #define QUOTES_IMPORT_PROMPT_TO_OVERWRITE_EXISTING_CONTACTS 0x0000
+// if contact(s) exists it would be overwrite without any prompt
+// #define QUOTES_IMPORT_SILENT_OVERWRITE_EXISTING_CONTACTS 0x0001
+// if contact(s) exists during importing it would be ignored
+ QUOTES_IMPORT_SKIP_EXISTING_CONTACTS = 2;
+
+ MS_QUOTES_IMPORT:PAnsiChar = 'Quotes/Import';
+
+{$ENDIF}
+
diff --git a/plugins/ExternalAPI/delphi/m_sendss.inc b/plugins/ExternalAPI/delphi/m_sendss.inc
new file mode 100644
index 0000000000..e4a58a79ff
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_sendss.inc
@@ -0,0 +1,66 @@
+//This file is part of Send Screenshot a Miranda IM plugin
+//Copyright (c) 2004-2006 Sérgio Vieira Rolanski
+//
+//This program is free software; you can redistribute it and/or
+//modify it under the terms of the GNU General Public License
+//as published by the Free Software Foundation; either
+//version 2 of the License, or (at your option) any later version.
+//
+//This program is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU General Public License for more details.
+//
+//You should have received a copy of the GNU General Public License
+//along with this program; if not, write to the Free Software
+//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+{$IFNDEF M_SENDSS}
+{$DEFINE M_SENDSS}
+
+const
+//////////////////////////////////////////////////////////////////////////////
+// Open the main capture dialog, but does not capture anything
+// wParam = contact handle
+// lParam = 0
+// Returns zero on success
+// -1 if was not possibly to create capture window
+ MS_SENDSS_OPENDIALOG:PAnsiChar = 'SendSS/OpenCaptureDialog';
+
+//////////////////////////////////////////////////////////////////////////////
+// Send an image to imageshack.us
+// wParam = (char*)filename
+// lParam = (HANDLE)contact (can be null)
+// v0.8.0.0+
+// Returns always 0 (if lParam != 0)
+// Returns (char*)URL or error message if lParam = 0. caller must mir_free the pointer
+ MS_SENDSS_SEND2IMAGESHACK:PAnsiChar = 'SendSS/Send2ImageShack';
+
+//////////////////////////////////////////////////////////////////////////////
+// 1. Send a screenshot of the desktop to the selected contact
+// wParam = contact handle
+// lParam = 0
+// 2. Open the capture dialog in take screenshot only mode (it will not be sent)
+// wParam = 0
+// lParam = anything but 0
+// Returns:
+// zero on success
+// -1 if was not possibly to create capture window
+ MS_SENDSS_SENDDESKTOP:PAnsiChar = 'SendSS/SendDesktop';
+
+//////////////////////////////////////////////////////////////////////////////
+// Edit a in-memory bitmap on the edit window
+// wParam = (SENDSSCB) callback function address to call when editing is done
+// lParam = (HBITMAP) bitmap handle, a copy is made so the calling function can free this handle after the service function returns
+// Returns:
+// Zero on success
+// -1 if could not create the edit window
+// -2 if was not possible to alocate needed memory
+ MS_SENDSS_EDITBITMAP:PAnsiChar = 'SendSS/EditBitmap';
+
+// The parameter passed is the bitmap handle
+// the called function must free this handle when it's not needed anymore
+// Don't do much processing on the called function or you will lock miranda up
+//typedef void (__stdcall *SENDSSCB)(LPVOID);
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_sessions.inc b/plugins/ExternalAPI/delphi/m_sessions.inc
index b6e6c19bfd..9fac7d8d23 100644
--- a/plugins/ExternalAPI/delphi/m_sessions.inc
+++ b/plugins/ExternalAPI/delphi/m_sessions.inc
@@ -66,7 +66,7 @@ type
dwFrom :dword; // SDR_*, SDR_ALL is not a good thing
wParam :WPARAM;
lParam :LPARAM;
- reserved[0..1] of dword; // is actually apart of the structure and is used internally
+ reserved:array [0..1] of dword; // is actually apart of the structure and is used internally
end;
{
@@ -78,7 +78,7 @@ a message to an entity by name, e.g. "ICQ" it will only goto "ICQ" and not
to anyone else.
}
const
- MS_SION_PIPE = 'Sion/PipeCall';
+ MS_SION_PIPE:PAnsiChar = 'Sion/PipeCall';
{
wParam=0
@@ -104,7 +104,7 @@ you know what your entity name is already, you should not rely on .szEntity
being anything, but if it is there, the message is for you only and no one else
will get it and the value of .szEntity is dependant on the message.
}
- MS_SION_PIPEHOOK = 'Sion/PipeHook';
+ MS_SION_PIPEHOOK:PAnsiChar = 'Sion/PipeHook';
{
wParam=0
@@ -115,14 +115,14 @@ switch threads if it needs to to send ENTITY_CREATE to both .szUI and .szProto
}
type
SION_ENTITY_DESCRIPTOR = record
- cbSize:int;
- szUI:PAnsiChar;
- szProto:PAnsiChar;
+ cbSize :int;
+ szUI :PAnsiChar;
+ szProto :PAnsiChar;
hSession:THANDLE; // returned if successful
end;
const
- MS_SION_ENTITY_CREATE = 'Sion/EntityCreate';
+ MS_SION_ENTITY_CREATE:PAnsiChar = 'Sion/EntityCreate';
{
wParam=0
@@ -136,7 +136,7 @@ During handle shutdown, ENTITY_DESTROY will be sent to the protocol and then the
note that you do not need to give .szUI or .szProto because the handle knows
who it is binded to.
}
- MS_SION_ENTITY_RELEASE = 'Sion/EntityRelease';
+ MS_SION_ENTITY_RELEASE:PAnsiChar = 'Sion/EntityRelease';
{
wParam=0
@@ -144,7 +144,7 @@ lParam=HANDLE
Add one to the reference count of HANDLE.
}
- MS_SION_ENTITY_CLONE = 'Sion/EntityClone';
+ MS_SION_ENTITY_CLONE:PAnsiChar = 'Sion/EntityClone';
{
wParam=0
@@ -166,7 +166,7 @@ type
persist :int; // if TRUE and data is NULL then data will not be wiped
end;
const
- MS_SION_ENTITY_SETCOOKIE = 'Sion/EntitySetCookie';
+ MS_SION_ENTITY_SETCOOKIE:PAnsiChar = 'Sion/EntitySetCookie';
{
wParam=0
@@ -176,7 +176,7 @@ Given .data and SDR_code, finds the associated .hSession and returns
a reference to it, note that .data can not be NULL, .dwSdr is used
to match the type of cookie.
}
- MS_SION_ENTITY_FINDCOOKIE = 'Sion/EntityFindCookie';
+ MS_SION_ENTITY_FINDCOOKIE:PAnsiChar = 'Sion/EntityFindCookie';
(*
// -- Helper functions --
diff --git a/plugins/ExternalAPI/delphi/m_shutdown.inc b/plugins/ExternalAPI/delphi/m_shutdown.inc
index 9dfa5e7d28..fbdede1fb6 100644
--- a/plugins/ExternalAPI/delphi/m_shutdown.inc
+++ b/plugins/ExternalAPI/delphi/m_shutdown.inc
@@ -113,7 +113,7 @@ Returns 0 on success, nonzero otherwise.
Checks if the watcher is currently active or not.
wParam=lParam=0
Returns TRUE if the watcher is enabled, FALSE otherwise.
-}/
+}
MS_AUTOSHUTDOWN_ISWATCHERENABLED:PAnsiChar = 'AutoShutdown/IsWatcherEnabled';
//******************************************************************/
@@ -148,6 +148,16 @@ Unused, return always 0 here.
}
ME_AUTOSHUTDOWN_WATCHERCHANGED:PAnsiChar = 'AutoShutdown/Watcher/Changed';
+ SDWTF_SPECIFICTIME = $0001;
+ SDWTF_ST_TIME = $0002;
+ SDWTF_ST_COUNTDOWN = $0004;
+ SDWTF_ST_MASK = $0006; // bitmask for SDWTF_ST_* bits
+ SDWTF_MESSAGE = $0008;
+ SDWTF_FILETRANSFER = $0010;
+ SDWTF_IDLE = $0020;
+ SDWTF_STATUS = $0040;
+ SDWTF_CPUUSAGE = $0080;
+ SDWTF_MASK = $00FF; // bitmask for all SDWTF_* bits
SETTING_REMEMBERONRESTART_DEFAULT = 0; // SDROR_RUNNING
SETTING_SHOWCONFIRMDLG_DEFAULT = 1;
@@ -157,23 +167,12 @@ Unused, return always 0 here.
SETTING_SMARTOFFLINECHECK_DEFAULT = 1;
SETTING_SHUTDOWNTYPE_DEFAULT = SDSDT_SHUTDOWN;
- SETTING_WATCHERFLAGS_DEFAULT = (SDWTF_SPECIFICTIME|SDWTF_ST_COUNTDOWN);
+ SETTING_WATCHERFLAGS_DEFAULT = SDWTF_SPECIFICTIME or SDWTF_ST_COUNTDOWN;
SETTING_COUNTDOWN_DEFAULT = 30;
SETTING_COUNTDOWNUNIT_DEFAULT = 60; // x times countdown seconds
SETTING_TIMESTAMP_DEFAULT = SETTING_COUNTDOWN_DEFAULT*SETTING_COUNTDOWNUNIT_DEFAULT;
SETTING_CPUUSAGETHRESHOLD_DEFAULT = 90; // percent
- SDWTF_SPECIFICTIME = $0001;
- SDWTF_ST_TIME = $0002;
- SDWTF_ST_COUNTDOWN = $0004;
- SDWTF_ST_MASK = $0006; // bitmask for SDWTF_ST_* bits
- SDWTF_MESSAGE = $0008;
- SDWTF_FILETRANSFER = $0010;
- SDWTF_IDLE = $0020;
- SDWTF_STATUS = $0040;
- SDWTF_CPUUSAGE = $0080;
- SDWTF_MASK = $00FF; // bitmask for all SDWTF_* bits
-
SDROR_RUNNING = 3;
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_simplestatusmsg.inc b/plugins/ExternalAPI/delphi/m_simplestatusmsg.inc
new file mode 100644
index 0000000000..6a1cea8f8c
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_simplestatusmsg.inc
@@ -0,0 +1,51 @@
+{
+Simple Status Message plugin for Miranda IM
+Copyright (C) 2006-2011 Bartosz 'Dezeath' Bia³ek, (C) 2005 Harven
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+}
+
+{$IFNDEF M_SIMPLESTATUSMSG}
+{$DEFINE M_SIMPLESTATUSMSG}
+
+const
+// Change global status mode/message
+// wParam = (int)new status, 0 if for current
+// lParam = (LPARAM)(TCHAR *)status message
+ MS_SIMPLESTATUSMSG_SETSTATUS:PAnsiChar = 'SimpleStatusMsg/SetStatus';
+
+// Bring up the status message dialog
+// wParam = 0
+// lParam = (LPARAM)(char *)protocol name, NULL if for all protocols
+ MS_SIMPLESTATUSMSG_SHOWDIALOG:PAnsiChar = 'SimpleStatusMsg/ShowDialog';
+
+// Force a change of status mode/message. The status message dialog will
+// appear depending on settings
+// wParam = (int)new status
+// lParam = (LPARAM)(char *)protocol name, NULL if for all protocols
+// Returns 1 when changed without showing the status message dialog
+ MS_SIMPLESTATUSMSG_CHANGESTATUSMSG:PAnsiChar = 'SimpleStatusMsg/ChangeStatusMessage';
+
+// Copy the status message of a contact to clipboard
+// wParam = (WPARAM)(HANDLE)hContact
+// lParam = 0
+ MS_SIMPLESTATUSMSG_COPYMSG:PAnsiChar = 'SimpleStatusMsg/CopyMsg';
+
+// Go to URL in status message of a contact
+// wParam = (WPARAM)(HANDLE)hContact
+// lParam = 0
+ MS_SIMPLESTATUSMSG_GOTOURLMSG:PAnsiChar = 'SimpleStatusMsg/GoToURLMsg';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_skin_eng.inc b/plugins/ExternalAPI/delphi/m_skin_eng.inc
new file mode 100644
index 0000000000..986d31718c
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_skin_eng.inc
@@ -0,0 +1,445 @@
+{
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{$IFNDEF M_SKE}
+{$DEFINE M_SKE}
+
+const
+//*defaults*/
+// DEFAULT_FIT_MODE = FM_STRETCH;
+// DEFAULT_STYLE = ST_BRUSH ;
+// DEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE);
+// DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT);
+
+ SIZING_MARGIN = 3;
+
+//* Fit mode */
+ FM_STRETCH = 0;
+ FM_TILE_HORZ = 1;
+ FM_TILE_VERT = 2;
+ FM_TILE_BOTH = 3;
+
+//*Object types*/
+ OT_ANY = 0;
+ OT_GLYPHOBJECT = 1;
+ OT_FONTOBJECT = 2;
+
+//*STYLE INDEXEX*/
+ ST_SKIP = 0;
+ ST_PARENT = 1;
+ ST_BRUSH = 2;
+ ST_IMAGE = 3;
+ ST_SOLARIZE = 4; //Not used yet.
+ ST_FRAGMENT = 5;
+ ST_GRADIENT = 6;
+
+//formats:
+ ADT_TOP = $00000000;
+ ADT_LEFT = $00000000;
+ ADT_HCENTER = $00000001;
+ ADT_RIGHT = $00000002;
+ ADT_VCENTER = $00000004;
+ ADT_BOTTOM = $00000008;
+// ADT_ECLIPSE = 64;
+
+
+//*SERVICES*/
+
+//toggle the 'hide offline contacts' flag and call CLUI
+//wParam=0
+//lParam=0
+ MS_CLIST_TOGGLEHIDEOFFLINE:PAnsiChar = 'CList/ToggleHideOffline';
+
+ MS_CLIST_TOGGLEGROUPS:PAnsiChar = 'CList/ToggleGroups';
+
+ MS_CLIST_TOGGLESOUNDS:PAnsiChar = 'CList/ToggleSounds';
+
+// Add new object to skin object list.
+// wParam = pointer to SKINOBJECTDESCRIPTOR structure
+// lParam = 0 ( used for internal purposes: pointer to skin object list)
+ MS_SKIN_REGISTEROBJECT:PAnsiChar = 'ModernList/RegisterObject';
+
+// Add new object to skin object list.
+// wParam = pointer to DEF_SKIN_OBJECT_PARAMS structure
+// lParam = 0 ( used for internal purposes: pointer to skin object list)
+ MS_SKIN_REGISTERDEFOBJECT:PAnsiChar = 'ModernList/RegisterDefObject';
+
+type
+ DEF_SKIN_OBJECT_PARAMS = record
+ szObjectID:PAnsiChar;
+ defStyle:byte;
+ defColor:dword;
+ // Skin: PSKINOBJECTSLIST;
+ end;
+
+const
+// Request painting glyph object
+// wParam = pointer to SKINDRAWREQUEST structure
+// lParam = 0
+ MS_SKIN_DRAWGLYPH:PAnsiChar = 'ModernList/DrawGlyph';
+
+
+//* EVENTS */
+ ME_SKIN_SERVICESCREATED:PAnsiChar = 'ModernList/ServicesCreated';
+
+//* DRAWGLYPH Request structure */
+type
+ PSKINDRAWREQUEST = ^TSKINDRAWREQUEST;
+ TSKINDRAWREQUEST = record
+ szObjectID:array [0..254] of AnsiChar; // Unic Object ID (path) to paint
+ rcDestRect:TRECT; // Rectangle to fit
+ rcClipRect:TRECT; // Rectangle to paint in.
+ hDC:HDC; // Handler to device context to paint in.
+ end;
+
+//* SKINOBJECTDESCRIPTOR opbject descriptor structure */
+type
+ PSKINOBJECTDESCRIPTOR = ^TSKINOBJECTDESCRIPTOR;
+ TSKINOBJECTDESCRIPTOR = record
+ bType:byte; // One of OT_* values.
+ szObjectID:PAnsiChar; // Unic Object ID (path) [255] max
+ Data:pointer; // Pointer to GLYPHOBJECT strycture if bType==OT_GLYPHOBJECT
+ end;
+
+//* SKINOBJECTDESCRIPTOR opbject descriptor structure */
+type
+ PGLYPHOBJECT = ^TGLYPHOBJECT;
+ TGLYPHOBJECT = record
+ Style :byte; // One of ST_* values
+ hGlyph :HBITMAP; // Bitmap handler (for internal use only)
+ dwTop,
+ dwLeft,
+ dwBottom,
+ dwRight :dword; // Margins
+ szFileName :PAnsiChar; // FileName of image
+ dwColor :dword; // Fill color
+ dwAlpha :byte; // Constant alpha-transparency level
+ FitMode :byte; // One of FM_* values
+ clipArea :TPOINT; // Object image rect on full image
+ szclipArea :TSIZE; // Object image rect on full image
+ plTextList :PSortedList; // List of GLYPHTEXT
+ bmWidth :long;
+ bmHeight :long;
+ bmBitsPixel:byte;
+ end;
+
+//* SKINTEXTDESCRIPTOR opbject descriptor structure */
+type
+ PGLYPHTEXT = ^TGLYPHTEXT;
+ TGLYPHTEXT = record
+ szGlyphTextID:PAnsiChar;
+ stText :TChar;
+ stValueText :TChar;
+ dwFlags :dword;
+ dwColor :dword; // Color (InvAA)(RR)(GG)(BB)
+ dwShadow :dword; //ToDo: Color2/Shaddow
+ iLeft,iTop,iRight,iBottom:int;
+ RelativeFlags:byte;
+ szFontID :PAnsiChar;
+ hFont :HFONT;
+ szObjectName :PAnsiChar;
+ end;
+
+//* SKINTEXTDESCRIPTOR opbject descriptor structure */
+type
+ PSKINFONT = ^TSKINFONT;
+ TSKINFONT = record
+ szFontID:PAnsiChar;
+ hFont :HFONT;
+ end;
+
+//* HELPER FUNCTIONS */
+(*
+//Paint ObjectID as parent background for frame hwndIn
+int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT * rcClip, char * objectID)
+{
+ SKINDRAWREQUEST rq;
+ POINT pt={0};
+ RECT rc,r1;
+
+ HWND hwnd=(HWND)CallService(MS_CLUI_GETHWND,0,0);
+ if (!objectID) return 0;
+ GetWindowRect(hwndIn,&r1);
+ pt.x=r1.left;
+ pt.y=r1.top;
+ //ClientToScreen(hwndIn,&pt);
+ GetWindowRect(hwnd,&rc);
+ OffsetRect(&rc,-pt.x ,-pt.y);
+ rq.hDC=hdc;
+ rq.rcDestRect=rc;
+ rq.rcClipRect=*rcClip;
+ lstrcpynA(rq.szObjectID,objectID,sizeof(rq.szObjectID));
+ ///ske_Service_DrawGlyph((WPARAM)&rq,0); //$$$
+ return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0);
+}
+
+
+//Paint ObjectID
+int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * objectID);
+
+//Register object with predefined style
+int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle);
+int __inline CreateGlyphedObjectDefColor(char * ObjID,dword defColor);
+//Register default object
+int __inline CreateGlyphedObject(char * ObjID);
+
+
+//// Creating and registering objects
+//int __inline CreateGlyphedObject(char * ObjID)
+//{
+// DEF_SKIN_OBJECT_PARAMS prm={0};
+// prm.defColor=DEFAULT_BKCOLOUR;
+// prm.defStyle=DEFAULT_STYLE;
+// prm.szObjectID=ObjID;
+// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0);
+//}
+static BOOL __inline ScreenToClientRect(HWND hWnd, LPRECT lpRect)
+{
+ BOOL ret;
+
+ POINT pt;
+
+ pt.x = lpRect->left;
+ pt.y = lpRect->top;
+
+ ret = ScreenToClient(hWnd, &pt);
+
+ if (!ret) return ret;
+
+ lpRect->left = pt.x;
+ lpRect->top = pt.y;
+
+
+ pt.x = lpRect->right;
+ pt.y = lpRect->bottom;
+
+ ret = ScreenToClient(hWnd, &pt);
+
+ lpRect->right = pt.x;
+ lpRect->bottom = pt.y;
+
+ return ret;
+}
+
+//int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle)
+//{
+// DEF_SKIN_OBJECT_PARAMS prm={0};
+// prm.defColor=DEFAULT_BKCOLOUR;
+// prm.defStyle=defStyle;
+// prm.szObjectID=ObjID;
+// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0);
+//}
+//int __inline CreateGlyphedObjectDefColor(char * ObjID,dword defColor)
+//{
+// DEF_SKIN_OBJECT_PARAMS prm={0};
+// prm.defColor=defColor;
+// prm.defStyle=ST_BRUSH;
+// prm.szObjectID=ObjID;
+// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0);
+//}
+static int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * objectID)
+{
+ SKINDRAWREQUEST rq;
+ if (!objectID) return 0;
+ rq.hDC=hdc;
+ rq.rcDestRect=*rcSize;
+ rq.rcClipRect=*rcClip;
+ lstrcpynA(rq.szObjectID,objectID,sizeof(rq.szObjectID));
+ return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0);
+}
+*)
+//#include "../hdr/modern_skin_selector.h"
+
+//////////////////////////////////////////////
+// //
+// New Painting sequence servises //
+// //
+//////////////////////////////////////////////
+
+type
+ sPaintRequest = record
+ dStructSize :dword; // size of structure
+ hWnd :HWND; // called by window
+ hDC :HDC; // context to draw on
+ rcUpdate :TRECT; // rectangle to be painted in (relative to Top-Left corner of Main window)
+ dwFlags :dword; // drawing flags
+ CallbackData:pointer; // Data for passing to callback procedure
+ Reserved :array [0..15] of byte; // reserved for farther usage;
+ end;
+
+const
+// Request to register sub for callback painting frame area
+// wParam = hWnd of called frame
+// lParam = pointer to tPaintCallBackProc (or NULL to remove)
+// return 1 - succes, 0 - failure
+ MS_SKINENG_REGISTERPAINTSUB:PAnsiChar = 'SkinEngine/ske_Service_RegisterFramePaintCallbackProcedure';
+
+// Request to repaint frame or change/drop callback data immeadeately
+// wParam = hWnd of called frame
+// lParam = pointer to sPaintRequest (or NULL to redraw all)
+ MS_SKINENG_UPTATEFRAMEIMAGE:PAnsiChar = 'SkinEngine/ske_Service_UpdateFrameImage';
+
+// Request to repaint frame or change/drop callback data
+// wParam = hWnd of called frame
+// lParam = pointer to sPaintRequest (or NULL to redraw all)
+// return 2 - already queued, data updated, 1-have been queued, 0 - failure
+ MS_SKINENG_INVALIDATEFRAMEIMAGE:PAnsiChar = 'SkinEngine/ske_Service_InvalidateFrameImage';
+
+// Callback proc type
+type
+ tPaintCallbackProc = function(hWnd:HWND; hDC:HDC; rcPaint:PRECT; rgnUpdate:HRGN;
+ dFlags:dword; CallBackData:pointer):int;
+
+// HELPER TO UPDATEIMAGEFRAME
+
+(*
+inline BOOL isSkinEngineEnabled()
+{
+ return ServiceExists(MS_SKINENG_REGISTERPAINTSUB) && !DBGetContactSettingByte(NULL, "ModernData", "DisableEngine", FALSE);
+}
+
+
+inline BOOL isLayeredEnabled()
+{
+ return isSkinEngineEnabled() && DBGetContactSettingByte(NULL, "ModernData", "EnableLayering", TRUE);
+}
+
+int __inline SkinEngUpdateImageFrame(HWND hwnd, RECT * rcUpdate, dword dwFlags, void * CallBackData)
+{
+ sPaintRequest sr={0};
+ sr.dStructSize=sizeof(sPaintRequest);
+ sr.hWnd=hwnd;
+ if (rcUpdate)
+ sr.rcUpdate=*rcUpdate;
+ sr.dwFlags=dwFlags;
+ sr.CallbackData=CallBackData;
+ return CallService(MS_SKINENG_UPTATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr);
+}
+
+int __inline SkinEngInvalidateImageFrame(HWND hwnd, CONST RECT * rcUpdate, dword dwFlags, void * CallBackData)
+{
+ sPaintRequest sr={0};
+ if (hwnd && !isLayeredEnabled()) return InvalidateRect(hwnd,rcUpdate,dwFlags);
+ sr.dStructSize=sizeof(sPaintRequest);
+ sr.hWnd=hwnd;
+ if (rcUpdate)
+ sr.rcUpdate=*rcUpdate;
+ sr.dwFlags=dwFlags;
+ sr.CallbackData=CallBackData;
+ return CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr);
+}
+
+
+int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT* lpRect,BOOL bErase)
+{
+ return SkinEngInvalidateImageFrame(hWnd,lpRect,0,0);
+}
+*)
+// Alpha channel GDI replacements/helpers
+
+const
+//
+// Paints text with correct alpha channel
+// wParam - pointer to AlphaTextOutParams
+ MS_SKINENG_ALPHATEXTOUT:PAnsiChar = 'SkinEngine/ske_AlphaTextOut';
+
+type
+ TAlphaTextOutParams = record
+ HDC :HDC;
+ lpString :TChar;
+ nCount :int;
+ lpRect :PRECT;
+ forma :uint;
+ ARGBcolor:dword;
+ reserv :array [0..15] of byte;
+ end;
+(*
+int __inline AlphaText(HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRect, UINT format, dword ARGBcolor)
+{
+ AlphaTextOutParams ap={0};
+ ap.hDC=hDC;
+ ap.lpString=lpString;
+ ap.nCount=nCount;
+ ap.lpRect=lpRect;
+ ap.format=format;
+ ap.ARGBcolor=ARGBcolor;
+ return CallService(MS_SKINENG_ALPHATEXTOUT,(WPARAM)&ap,0);
+}
+*)
+type
+ ImageListFixParam = record
+ himl :THANDLE; //HIMAGELIST;
+ index:int;
+ hicon:HICON;
+ end;
+
+type
+ DrawIconFixParam = record
+ hdc :HDC;
+ xLeft :int;
+ yTop :int;
+ hIcon :HICON;
+ cxWidth :int;
+ cyWidth :int;
+ istepIfAniCur :uint;
+ hbrFlickerFreeDraw:HBRUSH;
+ diFlags :uint;
+ end;
+
+const
+//wParam - pointer to DrawIconFixParam
+ MS_SKINENG_DRAWICONEXFIX:PAnsiChar = 'SkinEngine/DrawIconEx_Fix';
+(*
+int __inline mod_DrawIconEx_helper(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
+{
+ DrawIconFixParam p={0};
+ p.hdc=hdc;
+ p.xLeft=xLeft;
+ p.yTop=yTop;
+ p.hIcon=hIcon;
+ p.cxWidth=cxWidth;
+ p.cyWidth=cyWidth;
+ p.istepIfAniCur=istepIfAniCur;
+ p.hbrFlickerFreeDraw=hbrFlickerFreeDraw;
+ p.diFlags=diFlags;
+ return CallService(MS_SKINENG_DRAWICONEXFIX,(WPARAM)&p,0);
+}
+*)
+const
+// Register of plugin's user
+//
+// wParam = (WPARAM)szSetting - string that describes a user
+// format: Category/ModuleName,
+// eg: "Contact list background/CLUI",
+// "Status bar background/StatusBar"
+// lParam = (LPARAM)dwFlags
+//
+ MS_BACKGROUNDCONFIG_REGISTER:PAnsiChar = 'ModernBkgrCfg/Register';
+
+//
+// Notification about changed background
+// wParam = ModuleName
+// lParam = 0
+ ME_BACKGROUNDCONFIG_CHANGED:PAnsiChar = 'ModernBkgrCfg/Changed';
+
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_spellchecker.inc b/plugins/ExternalAPI/delphi/m_spellchecker.inc
index e2f8c5e0a7..9f776d2fd7 100644
--- a/plugins/ExternalAPI/delphi/m_spellchecker.inc
+++ b/plugins/ExternalAPI/delphi/m_spellchecker.inc
@@ -45,7 +45,7 @@ wParam: SPELLCHECKER_ITEM *
lParam: ignored
return: 0 on success
}
- MS_SPELLCHECKER_ADD_RICHEDIT = 'SpellChecker/AddRichedit';
+ MS_SPELLCHECKER_ADD_RICHEDIT:PAnsiChar = 'SpellChecker/AddRichedit';
{
Removes a richedit control for the spell checker to check
@@ -54,7 +54,7 @@ wParam: HWND
lParam: ignored
return: 0 on success
}
- MS_SPELLCHECKER_REMOVE_RICHEDIT = 'SpellChecker/RemoveRichedit';
+ MS_SPELLCHECKER_REMOVE_RICHEDIT:PAnsiChar = 'SpellChecker/RemoveRichedit';
{
Show context menu
@@ -63,6 +63,6 @@ wParam: SPELLCHECKER_POPUPMENU
lParam: ignored
return: the control id selected by the user, 0 if no one was selected, < 0 on error
}
- MS_SPELLCHECKER_SHOW_POPUP_MENU = 'SpellChecker/ShowPopupMenu';
+ MS_SPELLCHECKER_SHOW_POPUP_MENU:PAnsiChar = 'SpellChecker/ShowPopupMenu';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_splash.inc b/plugins/ExternalAPI/delphi/m_splash.inc
new file mode 100644
index 0000000000..0ff1dde6f6
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_splash.inc
@@ -0,0 +1,11 @@
+{$IFNDEF M_SPLASH}
+{$DEFINE M_SPLASH}
+
+// Shows splash image
+// wParam = (char *) image filename, either relative to Miranda dir or absolute
+// lParam = (int) time to display in milliseconds, 0 - infinite (hangs on screen until clicked)
+// returns: 1 if success and 0 if failed
+const
+ MS_SHOWSPLASH:PAnsiChar = 'SplashScreen/Show';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_statusplugins.inc b/plugins/ExternalAPI/delphi/m_statusplugins.inc
index dea88463fb..9852d0cf14 100644
--- a/plugins/ExternalAPI/delphi/m_statusplugins.inc
+++ b/plugins/ExternalAPI/delphi/m_statusplugins.inc
@@ -80,17 +80,17 @@ const
// -- AdvancedAutoAway --
type
- STATES = [
+ STATES = (
ACTIVE, // user is active
STATUS1_SET, // first status change happened
STATUS2_SET, // second status change happened
SET_ORGSTATUS, // user was active again, original status will be restored
- HIDDEN_ACTIVE, // user is active, but this is not shown to the outside world
+ HIDDEN_ACTIVE // user is active, but this is not shown to the outside world
// STATUS1_SET2, // first status change happened, but user may be active ('on inactive only was disabled')
// STATUS2_SET2 // second status change happened, but user may be active ('on inactive only was disabled')
- ];
+ );
type
AUTOAWAYSETTING = record
@@ -160,6 +160,7 @@ const
// returns 0
MS_KS_ANNOUNCESTATUSCHANGE:PAnsiChar = 'KeepStatus/AnnounceStatusChange';
+{
function announce_status_change(szProto:PAnsiChar;newstatus:integer;szMsg:TChar):integer;// cdecl;
var
ps:PROTOCOLSETTINGEX;
@@ -177,5 +178,5 @@ begin
result:=CallService(MS_KS_ANNOUNCESTATUSCHANGE, 0,dword(@ps));
end;
-
+}
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_stopspam.inc b/plugins/ExternalAPI/delphi/m_stopspam.inc
new file mode 100644
index 0000000000..2bae1fa6a8
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_stopspam.inc
@@ -0,0 +1,41 @@
+{
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2004-009 Roman Miklashevsky, A. Petkevich, Kosh&chka, persei
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+{$IFNDEF M_STOPSPAM}
+{$DEFINE M_STOPSPAM}
+
+const
+ CS_NOTPASSED = 0;
+ CS_PASSED = 1;
+
+//check is contact pass the stopspam
+//wParam=(HANDLE)hContact
+//lParam=0
+//returns a "Contact State" flag
+ MS_STOPSPAM_CONTACTPASSED:PAnsiChar = 'StopSpam/IsContactPassed';
+
+//remove all temporary contacts from db
+//wParam=0
+//lParam=0
+//returns 0
+ MS_STOPSPAM_REMTEMPCONTACTS:PAnsiChar = 'StopSpam/RemoveTempContacts';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_text.inc b/plugins/ExternalAPI/delphi/m_text.inc
new file mode 100644
index 0000000000..5847cd92e1
--- /dev/null
+++ b/plugins/ExternalAPI/delphi/m_text.inc
@@ -0,0 +1,269 @@
+{$IFNDEF M_MTEXT}
+{$DEFINE M_MTEXT}
+
+// NEW mtextcontrol interface:
+//
+// obtain the full mtextcontrol interface from the library. it is much faster as use of
+// miranda core CallService to access to mtextcontrol (no core traffic).
+// This interface provides full access to mtextcontrol internal functions,
+// thus enabling devs to fully utilize the mtextcontrol API.
+// All functions will be exported as miranda services for compatibility.
+//
+// the interface is populated during the Load(PLUGINLINK *link) handler, so you can assume it is ready when Miranda
+// throw the ME_SYSTEM_MODULESLOADED event and you can generate a warning in your ModulesLoaded() when
+// it depends on the mtextcontrol interface and the mtextcontrol plugin is missing.
+//
+// example:
+//
+// MTEXT_INTERFACE MText = {0};
+//
+// mir_getMTI(&MText);
+//
+// all interface function designed as old mtextcontrol helper functions.
+// therefore it is easy to convert your old plugin code to new interface.
+//
+// example:
+//
+// old code: MTextCreate (...
+// new code: MText.Create(...
+
+// Text control
+const
+ MTEXTCONTROLCLASS = 'MTextControl';
+ MTM_SETUSER = WM_USER;
+ MTM_UPDATE = WM_USER+1;
+
+type
+ TMTEXT_INTERFACE = record
+ cbSize:size_t;
+ version:dword;
+
+ Register :function(const userTitle:PAnsiChar; options:dword):THANDLE; stdcall;
+ Create :function(userHandle:THANDLE; text:pointer):THANDLE; stdcall;
+ CreateEx :function(userHandle:THANDLE; hContact:TMCONTACT; text:pointer; flags:dword):THANDLE; stdcall;
+ Measure :function(dc:HDC; sz:PSIZE; text:THANDLE):int; stdcall;
+ Display :function(dc:HDC; pos:TPOINT; sz:TSIZE; text:THANDLE):int; stdcall;
+ SetParent :function(text:THANDLE; hwnd:HWND; rect:TRECT):int; stdcall;
+ SendMsg :function(hwnd:HWND; text:THANDLE; msg:uint; wParam:WPARAM; lParam:LPARAM):int; stdcall;
+ CreateProxy:function(text:THANDLE):HWND; stdcall;
+ Destroy :function(text:THANDLE):int; stdcall;
+ end;
+
+const
+// get access to the interface
+// wParam = 0
+// lParam = (LPARAM)(MTEXT_INTERFACE*)Mtext
+// dont vorget to set cbSize before call service
+ MS_TEXT_GETINTERFACE:PAnsiChar = 'MText/GetInterface';
+(*
+__forceinline INT_PTR mir_getMTI( MTEXT_INTERFACE* dest )
+{
+ dest->cbSize = sizeof(*dest);
+ INT_PTR result = CallService(MS_TEXT_GETINTERFACE, 0, (LPARAM)dest);
+ return result;
+}
+*)
+const
+ // visual text options, used in MS_TEXT_REGISTER
+ MTEXT_FANCY_SMILEYS = $00000010; // SmileyAdd smileys
+ MTEXT_FANCY_BBCODES = $00000020; // [b], [u], [i]
+ MTEXT_FANCY_MATHMOD = $00000040; // enable math module formula parsing
+ MTEXT_FANCY_URLS = $00000080; // underline urls
+ MTEXT_FANCY_BBCODES2 = $00000100; // [color], [img], [url], not implemented yet
+ MTEXT_FANCY_SIMPLEFMT = $00000200; // simple formatting ("_", "/" and "*")
+ MTEXT_FANCY_MASK = $00007FFF;
+ MTEXT_FANCY_DEFAULT = $00008000; // Use default options
+
+ // text options, used in MS_TEXT_REGISTER
+ MTEXT_SYSTEM_HICONS = $00010000; // [$handle=i<HICON as dword>$]
+ MTEXT_SYSTEM_HBITMAPS = $00010000; // [$handle=b<HBITMAP as dword>$], not implemented yet
+ MTEXT_SYSTEM_ESCAPED = $00020000; // passed text is escaped with slashes, not implemented yet
+ MTEXT_SYSTEM_MASK = $7FFF0000;
+ MTEXT_SYSTEM_DEFAULT = $80000000; // Use default option -- just nothing system is used :)
+
+ // text object flags
+ MTEXT_FLG_CHAR = $00000000;
+ MTEXT_FLG_WCHAR = $00000001;
+ MTEXT_FLG_BIDI_RTL = $00000002;
+
+// used in MS_TEXT_CREATEEX
+type
+ PMTEXTCREATE = ^TMTEXTCREATE;
+ TMTEXTCREATE = record
+ cbSize :dword;
+ hContact:TMCONTACT;
+ text :TChar; // this is 'char *' or 'WCHAR *'
+ flags :dword;
+ end;
+
+// used in MS_TEXT_MEASURE and MS_TEXT_DISPLAY
+type
+ PMTEXTDISPLAY = ^TMTEXTDISPLAY;
+ TMTEXTDISPLAY = record
+ cbSize:dword;
+ dc :HDC;
+ pos :TPOINT;
+ sz :TSIZE;
+ text :THANDLE;
+ end;
+
+// used in MS_TEXT_SETPARENT
+type
+ PMTEXTSETPARENT = ^TMTEXTSETPARENT;
+ TMTEXTSETPARENT = record
+ text:THANDLE;
+ hwnd:HWND;
+ rc :TRECT;
+ end;
+
+// used in MS_TEXT_SENDMESSAGE
+type
+ PMTEXTMESSAGE = ^TMTEXTMESSAGE;
+ TMTEXTMESSAGE = record
+ hwnd :HWND;
+ text :THANDLE;
+ msg :uint;
+ wParam:WPARAM;
+ lParam:LPARAM;
+ end;
+
+const
+//---------------------------------------------------------------------------
+// deprecatet service and helper functions
+// replaced by new mtext interface !!!!!!!
+//---------------------------------------------------------------------------
+
+// subscribe to MText services
+// wParam = (WPARAM)(DOWRD)defaultOptions
+// lParam = (LPARAM)(char *)userTitle
+// result = (LRESULT)(HANDLE)userHandle
+ MS_TEXT_REGISTER:PAnsiChar = 'MText/Register';
+
+// allocate text object (unicode)
+// wParam = (WPARAM)(HANDLE)userHandle
+// lParam = (LPARAM)(WCHAR *)text
+// result = (LRESULT)(HANDLE)textHandle
+ MS_TEXT_CREATEW:PAnsiChar = 'MText/CreateW';
+
+// allocate text object (advanced)
+// wParam = (WPARAM)(HANDLE)userHandle
+// lParam = (LPARAM)(LPMTEXTCREATE)createInfo
+// result = (LRESULT)(HANDLE)textHandle
+ MS_TEXT_CREATEEX:PAnsiChar = 'MText/CreateEx';
+
+(*
+__inline HANDLE MTextCreateEx(HANDLE userHandle, HANDLE hContact, void *text, DWORD flags)
+{
+ #ifdef __cplusplus
+ MTEXTCREATE textCreate;
+ #else
+ MTEXTCREATE textCreate = {0};
+ textCreate.cbSize = sizeof(textCreate);
+ #endif
+ textCreate.hContact = hContact;
+ textCreate.text = text;
+ textCreate.flags = flags;
+ return (HANDLE)CallService(MS_TEXT_CREATEEX, (WPARAM)userHandle, (LPARAM)&textCreate);
+}
+*)
+
+// measure text object
+// wParam = (LPARAM)(LPMTEXTDISPLAY)displayInfo
+// result = 1 (success), 0 (failure)
+// displayInfo->size.cx is interpreted as maximum width allowed.
+// wrapped text size is stored in displayInfo->size, text
+ MS_TEXT_MEASURE:PAnsiChar = 'MText/Measure';
+
+(*
+__inline int MTextMeasure(HDC dc, SIZE *sz, HANDLE text)
+{
+ #ifdef __cplusplus
+ MTEXTDISPLAY displayInfo;
+ #else
+ MTEXTDISPLAY displayInfo = {0};
+ displayInfo.cbSize = sizeof(displayInfo);
+ #endif
+ displayInfo.dc = dc;
+ displayInfo.pos.x = displayInfo.pos.y = 0;
+ displayInfo.sz = *sz;
+ displayInfo.text = text;
+ int result = (int)CallService(MS_TEXT_MEASURE, (WPARAM)&displayInfo, 0);
+ *sz = displayInfo.sz;
+ return result;
+}
+*)
+
+// display text object
+// wParam = (LPARAM)(LPMTEXTDISPLAY)displayInfo
+// result = 1 (success), 0 (failure)
+ MS_TEXT_DISPLAY:PAnsiChar = 'MText/Display';
+
+(*
+__inline int MTextDisplay(HDC dc, POINT pos, SIZE sz, HANDLE text)
+{
+ #ifdef __cplusplus
+ MTEXTDISPLAY displayInfo;
+ #else
+ MTEXTDISPLAY displayInfo = {0};
+ displayInfo.cbSize = sizeof(displayInfo);
+ #endif
+ displayInfo.dc = dc;
+ displayInfo.pos = pos;
+ displayInfo.sz = sz;
+ displayInfo.text = text;
+ return (int)CallService(MS_TEXT_DISPLAY, (WPARAM)&displayInfo, 0);
+}
+*)
+
+// set parent window for text object (this is required for mouse handling, etc)
+// wParam = (WPARAM)(LPMTEXTSETPARENT)info
+// result = message result
+ MS_TEXT_SETPARENT:PAnsiChar = 'MText/SetParent';
+
+(*
+__inline int MTextSetParent(HANDLE text, HWND hwnd, RECT rect)
+{
+ MTEXTSETPARENT info;
+ info.text = text;
+ info.hwnd = hwnd;
+ info.rc = rect;
+ return (int)CallService(MS_TEXT_SETPARENT, (WPARAM)&info, 0);
+}
+*)
+
+// send message to an object
+// wParam = (WPARAM)(LPMTEXTMESSAGE)message
+// result = message result
+ MS_TEXT_SENDMESSAGE:PAnsiChar = 'MText/SendMessage';
+
+(*
+__inline int MTextSendMessage(HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ #ifdef __cplusplus
+ MTEXTMESSAGE message;
+ #else
+ MTEXTMESSAGE message = {0};
+ #endif
+ message.hwnd = hwnd;
+ message.text = text;
+ message.msg = msg;
+ message.wParam = wParam;
+ message.lParam = lParam;
+ return (int)CallService(MS_TEXT_SENDMESSAGE, (WPARAM)&message, 0);
+}
+*)
+
+// create a proxy window
+// wParam = (LPARAM)(HANDLE)textHandle
+ MS_TEXT_CREATEPROXY:PAnsiChar = 'MText/CreateProxy';
+
+
+// destroy text object
+// wParam = (LPARAM)(HANDLE)textHandle
+ MS_TEXT_DESTROY:PAnsiChar = 'MText/Destroy';
+
+
+// MS_TEXT_QDISPLAY :PAnsiChar = 'MText/QDisplay';
+// MS_TEXT_QDISPLAYW:PAnsiChar = 'MText/QDisplayW';
+
+{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_toptoolbar.inc b/plugins/ExternalAPI/delphi/m_toptoolbar.inc
index 2d39beea74..5dfbee3b53 100644
--- a/plugins/ExternalAPI/delphi/m_toptoolbar.inc
+++ b/plugins/ExternalAPI/delphi/m_toptoolbar.inc
@@ -72,7 +72,7 @@ const
lparam = (LPARAM) state
returns: 0 on success, -1 on failure.
}
- TTBST_PUSHED = 1;
+ TTBST_PUSHED = 1;
MS_TTB_SETBUTTONSTATE:PAnsiChar = 'TopToolBar/SetState';
diff --git a/plugins/ExternalAPI/delphi/m_versioninfo.inc b/plugins/ExternalAPI/delphi/m_versioninfo.inc
index b56b4138fa..02aa22df49 100644
--- a/plugins/ExternalAPI/delphi/m_versioninfo.inc
+++ b/plugins/ExternalAPI/delphi/m_versioninfo.inc
@@ -27,7 +27,7 @@ const
wParam - not used
lParam - not used
}
- MS_VERSIONINFO_MENU_COMMAND = 'VersionInfo/MenuCommand';
+ MS_VERSIONINFO_MENU_COMMAND:PAnsiChar = 'VersionInfo/MenuCommand';
{
Returns a string containing the versioninfo post
@@ -44,6 +44,6 @@ how to use:
if GetInfoService(TRUE,LPARAM(@data))=0 then
//success
}
- MS_VERSIONINFO_GETINFO = 'Versioninfo/GetInfo';
+ MS_VERSIONINFO_GETINFO:PAnsiChar = 'Versioninfo/GetInfo';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_winterspeak.inc b/plugins/ExternalAPI/delphi/m_winterspeak.inc
index b00c7330d8..597b423c21 100644
--- a/plugins/ExternalAPI/delphi/m_winterspeak.inc
+++ b/plugins/ExternalAPI/delphi/m_winterspeak.inc
@@ -4,6 +4,9 @@ const
{
wParam - contact Handle
lParam - Unicode text
+ Notes: difference of services is for "ignore" checks, status or messages
+ offline contacts don't processes (use hCantact = 0 instead)
+ if English voice choosen, it can't process non-English texts (silence on Russian, for example)
}
- MS_SPEAK_STATUS:PAnsiChar = 'Speak/Status';
+ MS_SPEAK_STATUS :PAnsiChar = 'Speak/Status';
MS_SPEAK_MESSAGE:PAnsiChar = 'Speak/Message';
diff --git a/plugins/ExternalAPI/delphi/m_yamn.inc b/plugins/ExternalAPI/delphi/m_yamn.inc
index f18edb8d19..7ecaa5ae25 100644
--- a/plugins/ExternalAPI/delphi/m_yamn.inc
+++ b/plugins/ExternalAPI/delphi/m_yamn.inc
@@ -5,21 +5,16 @@
//================================== VARIABLES STRUCT ========================================
//
-{$IFNDEF MIRANDASERVICE}
-type
- MIRANDASERVICE = function(WPARAM,LPARAM:int):int; cdecl;
-{$ENDIF}
-
const
YAMN_VARIABLESVERSION = 3;
type
PYAMN_VARIABLES = ^TYAMN_VARIABLES;
TYAMN_VARIABLES = record
- hInst:HINSTANCE;
- MessageWnds:THANDLE;
+ hInst :HINST;
+ MessageWnds :THANDLE;
NewMailAccountWnd:THANDLE;
- Shutdown:int;
+ Shutdown :int;
end;
CYAMNVariables = TYAMN_VARIABLES;
@@ -28,14 +23,14 @@ type
//
type
CExportedFunctions = record
- ID:PAnsiChar;
+ ID :PAnsiChar;
Ptr:pointer;
end;
type
CExportedServices = record
- ID:PAnsiChar;
- Ptr:MIRANDASERVICE;
+ ID :PAnsiChar;
+ Ptr:TMIRANDASERVICE;
end;
//
@@ -45,14 +40,14 @@ type
const
//UninstallPlugin Event
//Sent when user wants to uninstall YAMN and all its plugins
- ME_YAMN_UNINSTALLPLUGINS = 'YAMN/MirandaEvents/UninstallPlugins';
+ ME_YAMN_UNINSTALLPLUGINS:PAnsiChar = 'YAMN/MirandaEvents/UninstallPlugins';
//NewMail Event
//Notifies you about new mail
//no arguments now (Developers, send mail, which params would you like to have, but note there's problem that
//params are 32b numbers. When it is pointer to some data, these data should persist while every plugin read them and
//after that they can be removed from memory. So it is problem)
- ME_YAMN_NEWMAIL = 'YAMN/MirandaEvents/NewMail';
+ ME_YAMN_NEWMAIL:PAnsiChar = 'YAMN/MirandaEvents/NewMail';
//
//================================== YAMN SERVICES ==================================
@@ -74,26 +69,26 @@ const
//WPARAM- function ID. It is string representating function you need to get pointer (e.g. YAMN_WRITEWAITID)
//LPARAM- not used now, but set it to 0
//returns pointer to YAMN function or NULL when functions does not exist
- MS_YAMN_GETFCNPTR = 'YAMN/Service/GetFcn';
+ MS_YAMN_GETFCNPTR:PAnsiChar = 'YAMN/Service/GetFcn';
//GetVariables Service
//Ask YAMN for pointer to CYAMNVariables structure.
//WPARAM- YAMN_VARIABLESVERSION
//LPARAM- any value
//returns pointer to YAMN_VARIABLES or NULL when version of structure does not match
- MS_YAMN_GETVARIABLES = 'YAMN/Service/GetVar';
+ MS_YAMN_GETVARIABLES:PAnsiChar = 'YAMN/Service/GetVar';
//ForceCheck Service
//Check mail on accounts
//WPARAM- not used
//LPARAM- not used
- MS_YAMN_FORCECHECK = 'YAMN/Service/ForceCheck';
+ MS_YAMN_FORCECHECK:PAnsiChar = 'YAMN/Service/ForceCheck';
//AccountCheck Service
//Check mail on individual account
//WPARAM- HACCOUNT
//LPARAM- not used
- MS_YAMN_ACCOUNTCHECK = 'YAMN/Service/AccountCheck';
+ MS_YAMN_ACCOUNTCHECK:PAnsiChar = 'YAMN/Service/AccountCheck';
//Contact List Context Menu Click
//wParam=(WPARAM)hContact
@@ -103,7 +98,7 @@ const
//it is upto the caller to check for the protocol & status
//of the TMCONTACT, it's not done for you anymore since it didn't make
//sense to store all this information in memory, etc.
- MS_YAMN_CLISTCONTEXT = 'YAMN/Service/ClistContactContextMenu';
+ MS_YAMN_CLISTCONTEXT:PAnsiChar = 'YAMN/Service/ClistContactContextMenu';
//Contact List Context Menu Click for application
//wParam=(WPARAM)hContact
@@ -113,7 +108,7 @@ const
//it is upto the caller to check for the protocol & status
//of the TMCONTACT, it's not done for you anymore since it didn't make
//sense to store all this information in memory, etc.
- MS_YAMN_CLISTCONTEXTAPP = 'YAMN/Service/ClistContactContextMenuApp';
+ MS_YAMN_CLISTCONTEXTAPP:PAnsiChar = 'YAMN/Service/ClistContactContextMenuApp';
//Contact List Double Click
//wParam=(WPARAM)hContact
@@ -123,34 +118,34 @@ const
//it is upto the caller to check for the protocol & status
//of the TMCONTACT, it's not done for you anymore since it didn't make
//sense to store all this information in memory, etc.
- MS_YAMN_CLISTDBLCLICK = 'YAMN/Service/ClistContactDoubleclicked';
+ MS_YAMN_CLISTDBLCLICK:PAnsiChar = 'YAMN/Service/ClistContactDoubleclicked';
//FilterMail Service
//Ask YAMN to process mail filtering. YAMN calls filter plugins to mark mail as spam etc... Warning! Leave all
//read or write access to mail as this function waits for write-access to mail!
//WPARAM- (HACCOUNT) account to which mail belongs
//LPARAM- (HYAMNMAIL) mail to filter
- MS_YAMN_FILTERMAIL = 'YAMN/Service/FilterMail';
+ MS_YAMN_FILTERMAIL:PAnsiChar = 'YAMN/Service/FilterMail';
//MailBrowser Service
//runs mail browser window (or tray icon only or popups only)
//WPARAM- pointer to YAMN_MAILBROWSERPARAM structure, data to mailbrowser. You do not need to fill ThreadRunningEV event member.
//LPARAM- YAMN_MAILBROWSERPARAM structure version param. Use YAMN_MAILBROWSERVERSION definition.
//returns zero if failed, nonzero if succeed
- MS_YAMN_MAILBROWSER = 'YAMN/Service/RunMailBrowser';
+ MS_YAMN_MAILBROWSER:PAnsiChar = 'YAMN/Service/RunMailBrowser';
//NoNewMail Service
//runs no new mail procedure (shows popups e.g.)
//WPARAM- pointer to YAMN_NONEWMAILPARAM structure, data to no new mail procedure. You do not need to fill ThreadRunningEV event member.
//LPARAM- YAMN_NONEWMAILPARAM structure version param. Use YAMN_NONEWMAILVERSION definition.
//returns zero if failed, nonzero if succeed
- MS_YAMN_NONEWMAILPROC = 'YAMN/Service/NoNewMailProc';
+ MS_YAMN_NONEWMAILPROC:PAnsiChar = 'YAMN/Service/NoNewMailProc';
//BadConnection Service
//runs bad connection window
//WPARAM- pointer to YAMN_BADCONNECTIONPARAM structure, data to mailbrowser. You do not need to fill ThreadRunningEV event member.
//LPARAM- YAMN_BADCONNECTIONPARAM structure version param. Use YAMN_BADCONNECTIONVERSION definition.
//returns zero if failed, nonzero if succeed
- MS_YAMN_BADCONNECTION = 'YAMN/Service/BadConnection';
+ MS_YAMN_BADCONNECTION:PAnsiChar = 'YAMN/Service/BadConnection';
{$ENDIF}
diff --git a/plugins/ExternalAPI/delphi/m_yapp.inc b/plugins/ExternalAPI/delphi/m_yapp.inc
index ed42f17b91..cd5652fb71 100644
--- a/plugins/ExternalAPI/delphi/m_yapp.inc
+++ b/plugins/ExternalAPI/delphi/m_yapp.inc
@@ -9,13 +9,13 @@ type
TPopupData = record
cbSize :int;
flags :int; // OR of PDF_* flags below
- hContact :HANDLE;
+ hContact :THANDLE;
hIcon :HICON;
szTitle :TChar;
szText :TChar;
colorBack :COLORREF; // if colorBack and colorText are equal, defaults will be used
colorText :COLORREF;
- windowProc:WNDPROC; // optional custom window procedure
+ windowProc:TWNDPROC; // optional custom window procedure
timeout :int; // -1 == infinite, 0 == default, otherwise timeout in seconds
opaque :pointer;
end;
@@ -32,19 +32,19 @@ const
//wParam = &PopupData
//lParam = 0
// returns -1 if popups disabled
- MS_YAPP_SHOWPOPUP = 'YAPP/ShowPopup';
+ MS_YAPP_SHOWPOPUP:PAnsiChar = 'YAPP/ShowPopup';
// get hContact from PopupData
// wParam = hWnd
// lParam = 0
// return hContact
- MS_YAPP_GETCONTACT = 'YAPP/GetContact';
+ MS_YAPP_GETCONTACT:PAnsiChar = 'YAPP/GetContact';
// get opaque from PopupData
// wParam = hWnd
// lParam = 0
// returns opaque
- MS_YAPP_GETOPAQUE = 'YAPP/GetOpaque';
+ MS_YAPP_GETOPAQUE:PAnsiChar = 'YAPP/GetOpaque';
//------------- Class API ----------------//
@@ -57,7 +57,7 @@ type
hIcon :HICON;
colorBack :COLORREF;
colorText :COLORREF;
- windowProc :WNDPROC;
+ windowProc :TWNDPROC;
timeout :int;
end;
@@ -66,7 +66,7 @@ const
// wParam = 0
// lParam = (POPUPCLASS *)&pc
- MS_POPUP_REGISTERCLASS = 'Popup/RegisterClass';
+ MS_POPUP_REGISTERCLASS:PAnsiChar = 'PopUp/RegisterClass';
type
TPopupClassInstance = record
@@ -75,12 +75,12 @@ type
szTitle :TChar;
szText :TChar;
opaque :pointer;
- hContact :HANDLE;
+ hContact :THANDLE;
end;
const
// wParam = 0
// lParam = (POPUPDATACLASS *)&pdc
- MS_POPUP_ADDPOPUPCLASS = 'Popup/AddPopupClass';
+ MS_POPUP_ADDPOPUPCLASS:PAnsiChar = 'PopUp/AddPopupClass';
{$ENDIF}
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas
index 69cc3aef2c..401822797d 100644
--- a/plugins/HistoryPlusPlus/hpp_events.pas
+++ b/plugins/HistoryPlusPlus/hpp_events.pas
@@ -197,7 +197,7 @@ var
(EventType: EVENTTYPE_CONTACTS; MessageType: mtContacts; TextFunction: GetEventTextForContacts),
(EventType: EVENTTYPE_STATUSCHANGE; MessageType: mtStatus; TextFunction: GetEventTextForStatusChange),
(EventType: EVENTTYPE_SMTPSIMPLE; MessageType: mtSMTPSimple; TextFunction: GetEventTextForMessage),
- (EventType: ICQEVENTTYPE_SMS; MessageType: mtSMS; TextFunction: GetEventTextForSMS),
+ (EventType: EVENTTYPE_SMS; MessageType: mtSMS; TextFunction: GetEventTextForSMS),
(EventType: ICQEVENTTYPE_WEBPAGER; MessageType: mtWebPager; TextFunction: GetEventTextForWebPager),
(EventType: ICQEVENTTYPE_EMAILEXPRESS; MessageType: mtEmailExpress; TextFunction: GetEventTextForEmailExpress),
(EventType: EVENTTYPE_NICKNAMECHANGE; MessageType: mtNickChange; TextFunction: GetEventTextForMessage),
diff --git a/plugins/QuickSearch/qs.rc b/plugins/QuickSearch/qs.rc
index 42944aa67d..450e4e31ac 100644
--- a/plugins/QuickSearch/qs.rc
+++ b/plugins/QuickSearch/qs.rc
@@ -1,18 +1,18 @@
#include "resource.inc"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-/*
+
IDD_FRAME DIALOGEX 0, 0, 114, 16, 0
STYLE DS_SETFONT | WS_CHILD | DS_FIXEDSYS | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
{
- PUSHBUTTON "*", IDC_FRAME_OPEN, 2, 2, 12, 12
- EDITTEXT IDC_FRAME_EDIT, 16, 2, 62, 12
- PUSHBUTTON "<", IDC_FRAME_PREV, 80, 2, 15, 12
- PUSHBUTTON ">", IDC_FRAME_NEXT, 97, 2, 15, 12
+ PUSHBUTTON "*", IDC_FRAME_OPEN, 2, 2, 12, 12, BS_ICON
+ EDITTEXT IDC_FRAME_EDIT, 16, 2, 96, 12
+// PUSHBUTTON "<", IDC_FRAME_PREV, 80, 2, 15, 12
+// PUSHBUTTON ">", IDC_FRAME_NEXT, 97, 2, 15, 12
}
-*/
+
/*
IDD_SCRIPT DIALOGEX 0, 0, 256, 82, 0
STYLE DS_SETFONT | DS_FIXEDSYS | WS_VISIBLE | WS_THICKFRAME
diff --git a/plugins/QuickSearch/qs.res b/plugins/QuickSearch/qs.res
index 222402e284..d05f7b9615 100644
--- a/plugins/QuickSearch/qs.res
+++ b/plugins/QuickSearch/qs.res
Binary files differ
diff --git a/plugins/QuickSearch/quicksearch.dpr b/plugins/QuickSearch/quicksearch.dpr
index 9494665bc2..1deb4c5f3d 100644
--- a/plugins/QuickSearch/quicksearch.dpr
+++ b/plugins/QuickSearch/quicksearch.dpr
@@ -16,6 +16,7 @@ uses
sr_optdialog,
sr_global,
sr_window,
+ sr_frame,
mirutils,
common;
@@ -171,6 +172,8 @@ begin
HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ CreateFrame(0);
+
Result:=0;
end;
@@ -187,6 +190,7 @@ function Unload:integer;cdecl;
begin
result:=0;
removetoolbar; //??
+ DestroyFrame;
// unreghotkeys;
diff --git a/plugins/QuickSearch/resource.inc b/plugins/QuickSearch/resource.inc
index ed5b399e6b..8dfa7fd0fb 100644
--- a/plugins/QuickSearch/resource.inc
+++ b/plugins/QuickSearch/resource.inc
@@ -64,3 +64,6 @@ const
IDC_REFRESH = 1033;
IDC_STATUSBAR = 1034;
IDC_CB_PROTOCOLS = 1035;
+
+ IDC_FRAME_OPEN = 1050;
+ IDC_FRAME_EDIT = 1051;
diff --git a/plugins/QuickSearch/sr_frame.pas b/plugins/QuickSearch/sr_frame.pas
new file mode 100644
index 0000000000..4ff26b12b6
--- /dev/null
+++ b/plugins/QuickSearch/sr_frame.pas
@@ -0,0 +1,226 @@
+unit sr_frame;
+
+interface
+
+uses windows;
+
+procedure CreateFrame(parent:HWND);
+procedure DestroyFrame;
+
+implementation
+
+uses commctrl,Messages,m_api,common,wrapper,mirutils,sr_global;
+
+{$include resource.inc}
+
+const
+ frm_back:pAnsiChar = 'Frame background';
+const
+ FrameWnd:HWND = 0;
+ FrameId:integer = -1;
+ OldEditProc:pointer=nil;
+ pattern:pWideChar=nil;
+var
+ colorhook:THANDLE;
+ hbr:HBRUSH;
+ frm_bkg:TCOLORREF;
+
+function NewEditProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
+begin
+// result:=0;
+ case hMessage of
+ WM_CHAR: begin
+ if wParam=27 then
+ begin
+ // clear edit field
+ SendMessage(Dialog,WM_SETTEXT,0,0);
+ result:=0;
+ end
+ else if wParam=13 then
+ begin
+ CallService(QS_SHOWSERVICE,twparam(pattern),0);
+ result:=0;
+ end
+ else
+ result:=1;
+ if result=0 then
+ exit;
+ end;
+ end;
+ result:=CallWindowProc(OldEditProc,Dialog,hMessage,wParam,lParam);
+end;
+
+function QSDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
+begin
+ case urc^.wId of
+ IDC_FRAME_OPEN: result:=RD_ANCHORX_LEFT or RD_ANCHORY_CENTRE;
+ IDC_FRAME_EDIT: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_CENTRE;
+ else
+ result:=0;
+ end;
+end;
+
+function QSFrameProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
+var
+ urd:TUTILRESIZEDIALOG;
+ rc:TRECT;
+ ti:TTOOLINFOW;
+ hwndTooltip:HWND;
+begin
+ result:=0;
+ case hMessage of
+ WM_DESTROY: begin
+ DeleteObject(hbr);
+ hbr:=0;
+ end;
+
+ WM_INITDIALOG: begin
+ OldEditProc:=pointer(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_FRAME_EDIT),
+ GWL_WNDPROC,LONG_PTR(@NewEditProc)));
+
+ hwndTooltip:=CreateWindowW(TOOLTIPS_CLASS,nil,TTS_ALWAYSTIP,
+ integer(CW_USEDEFAULT),integer(CW_USEDEFAULT),
+ integer(CW_USEDEFAULT),integer(CW_USEDEFAULT),
+ Dialog,0,hInstance,nil);
+
+ FillChar(ti,SizeOf(ti),0);
+ ti.cbSize :=sizeof(TOOLINFO);
+ ti.uFlags :=TTF_IDISHWND or TTF_SUBCLASS;
+ ti.hwnd :=Dialog;
+ ti.hinst :=hInstance;
+ ti.uId :=GetDlgItem(Dialog,IDC_FRAME_OPEN);
+ ti.lpszText:=pWideChar(TranslateW('Open QS window'));
+ SendMessageW(hwndTooltip,TTM_ADDTOOLW,0,tlparam(@ti));
+
+ SetButtonIcon(GetDlgItem(Dialog,IDC_FRAME_OPEN),QS_QS);
+ end;
+
+ WM_SIZE: begin
+ FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
+ urd.cbSize :=SizeOf(urd);
+ urd.hwndDlg :=Dialog;
+ urd.hInstance :=hInstance;
+ urd.lpTemplate:=MAKEINTRESOURCEA(IDD_FRAME);
+ urd.lParam :=0;
+ urd.pfnResizer:=@QSDlgResizer;
+ CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ end;
+
+ WM_ERASEBKGND: begin
+ GetClientRect(Dialog,rc);
+ FillRect(wParam,rc,hbr);
+ result:=1;
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+ EN_CHANGE: begin
+ mFreeMem(pattern);
+ pattern:=GetDlgText(Dialog,IDC_FRAME_EDIT);
+ if pattern<>nil then
+ CharLowerW(pattern);
+ end;
+
+ BN_CLICKED: begin
+ case loword(wParam) of
+ IDC_FRAME_OPEN: CallService(QS_SHOWSERVICE,twparam(pattern),0);
+ end;
+ end;
+ end;
+ end;
+
+ else
+ result:=DefWindowProc(Dialog,hMessage,wParam,lParam);
+ end;
+end;
+
+function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ cid:TColourID;
+begin
+ result:=0;
+ cid.cbSize:=SizeOf(cid);
+ StrCopy(cid.group,'QuickSearch');
+ StrCopy(cid.name ,frm_back);
+ frm_bkg:=CallService(MS_COLOUR_GETA,twparam(@cid),0);
+ DeleteObject(hbr);
+ hbr:=CreateSolidBrush(frm_bkg);
+
+ RedrawWindow(FrameWnd,nil,0,RDW_ERASE);
+end;
+
+procedure CreateFrame(parent:HWND);
+var
+ Frame:TCLISTFrame;
+ wnd:HWND;
+ tmp:cardinal;
+ tr:TRECT;
+ cid:TColourID;
+begin
+ if ServiceExists(MS_CLIST_FRAMES_ADDFRAME)=0 then
+ exit;
+
+ hbr:=0;
+
+ if parent=0 then
+ parent:=CallService(MS_CLUI_GETHWND,0,0);
+
+ if FrameWnd=0 then
+ FrameWnd:=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_FRAME),parent,@QSFrameProc);
+
+ if FrameWnd<>0 then
+ begin
+ GetWindowRect(FrameWnd,tr);
+ FillChar(Frame,SizeOf(Frame),0);
+ with Frame do
+ begin
+ cbSize :=SizeOf(Frame);
+ hWnd :=FrameWnd;
+ hIcon :=CallService(MS_SKIN2_GETICON,0,tlparam(QS_QS));
+ align :=alTop;
+ height :=tr.bottom-tr.top+2;
+ Flags :=F_NOBORDER or F_UNICODE;
+ name.w :='Quick search';
+ TBName.w:='Quick search';
+ end;
+
+ FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,wparam(@Frame),0);
+ if FrameId>=0 then
+ begin
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME,FrameId, FU_FMPOS);
+
+ wnd:=CallService(MS_CLUI_GETHWND{MS_CLUI_GETHWNDTREE},0,0);
+ tmp:=SendMessage(wnd,CLM_GETEXSTYLE,0,0);
+ SendMessage(wnd,CLM_SETEXSTYLE,tmp or CLS_EX_SHOWSELALWAYS,0);
+
+ cid.cbSize:=SizeOf(cid);
+ cid.flags :=0;
+ StrCopy(cid.group,'QuickSearch');
+ StrCopy(cid.dbSettingsGroup,qs_module);
+
+ StrCopy(cid.name ,frm_back);
+ StrCopy(cid.setting,'frame_back');
+ cid.defcolour:=GetSysColor(COLOR_3DFACE);
+ cid.order :=0;
+ ColourRegister(@cid);
+
+ colorhook:=HookEvent(ME_COLOUR_RELOAD,@ColorReload);
+ ColorReload(0,0);
+ end;
+ end;
+end;
+
+procedure DestroyFrame;
+begin
+ if FrameId>=0 then
+ begin
+ UnhookEvent(colorhook);
+ CallService(MS_CLIST_FRAMES_REMOVEFRAME,FrameId,0);
+ FrameId:=-1;
+ end;
+ DestroyWindow(FrameWnd);
+ FrameWnd:=0;
+ mFreeMem(pattern);
+end;
+
+end.
diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas
index 955c18e692..7f2a6a85b3 100644
--- a/plugins/QuickSearch/sr_global.pas
+++ b/plugins/QuickSearch/sr_global.pas
@@ -743,7 +743,7 @@ var
begin
if DBGetSettingType(0,qs_module,so_flags)=DBVT_DELETED then
begin
- DBDeleteModule(qs_module);
+ DBDeleteModule(0,qs_module);
qsopt.flags:=
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas
index e16b17c168..838e38fb13 100644
--- a/plugins/QuickSearch/sr_window.pas
+++ b/plugins/QuickSearch/sr_window.pas
@@ -15,7 +15,7 @@ const
implementation
uses messages,commctrl,sr_global,common,dbsettings,mirutils,
- wrapper,protocols,sparam,srvblock,editwrapper;
+ wrapper,protocols,sparam,srvblock,editwrapper, mircontacts;
const
IDM_STAYONTOP = WM_USER+1;
diff --git a/plugins/Utils.pas/CustomGraph.pas b/plugins/Utils.pas/CustomGraph.pas
index 638967df0c..fcd14c1ec6 100644
--- a/plugins/Utils.pas/CustomGraph.pas
+++ b/plugins/Utils.pas/CustomGraph.pas
@@ -5,32 +5,32 @@ interface
uses windows;
const
- clScrollBar = TCOLORREF(COLOR_SCROLLBAR or $80000000);
- clBackground = TCOLORREF(COLOR_BACKGROUND or $80000000);
- clActiveCaption = TCOLORREF(COLOR_ACTIVECAPTION or $80000000);
- clInactiveCaption = TCOLORREF(COLOR_INACTIVECAPTION or $80000000);
- clMenu = TCOLORREF(COLOR_MENU or $80000000);
- clWindow = TCOLORREF(COLOR_WINDOW or $80000000);
- clWindowFrame = TCOLORREF(COLOR_WINDOWFRAME or $80000000);
- clMenuText = TCOLORREF(COLOR_MENUTEXT or $80000000);
- clWindowText = TCOLORREF(COLOR_WINDOWTEXT or $80000000);
- clCaptionText = TCOLORREF(COLOR_CAPTIONTEXT or $80000000);
- clActiveBorder = TCOLORREF(COLOR_ACTIVEBORDER or $80000000);
- clInactiveBorder = TCOLORREF(COLOR_INACTIVEBORDER or $80000000);
- clAppWorkSpace = TCOLORREF(COLOR_APPWORKSPACE or $80000000);
- clHighlight = TCOLORREF(COLOR_HIGHLIGHT or $80000000);
- clHighlightText = TCOLORREF(COLOR_HIGHLIGHTTEXT or $80000000);
- clBtnFace = TCOLORREF(COLOR_BTNFACE or $80000000);
- clBtnShadow = TCOLORREF(COLOR_BTNSHADOW or $80000000);
- clGrayText = TCOLORREF(COLOR_GRAYTEXT or $80000000);
- clGreyText = TCOLORREF(COLOR_GRAYTEXT or $80000000);
- clBtnText = TCOLORREF(COLOR_BTNTEXT or $80000000);
+ clScrollBar = TCOLORREF(COLOR_SCROLLBAR or $80000000);
+ clBackground = TCOLORREF(COLOR_BACKGROUND or $80000000);
+ clActiveCaption = TCOLORREF(COLOR_ACTIVECAPTION or $80000000);
+ clInactiveCaption = TCOLORREF(COLOR_INACTIVECAPTION or $80000000);
+ clMenu = TCOLORREF(COLOR_MENU or $80000000);
+ clWindow = TCOLORREF(COLOR_WINDOW or $80000000);
+ clWindowFrame = TCOLORREF(COLOR_WINDOWFRAME or $80000000);
+ clMenuText = TCOLORREF(COLOR_MENUTEXT or $80000000);
+ clWindowText = TCOLORREF(COLOR_WINDOWTEXT or $80000000);
+ clCaptionText = TCOLORREF(COLOR_CAPTIONTEXT or $80000000);
+ clActiveBorder = TCOLORREF(COLOR_ACTIVEBORDER or $80000000);
+ clInactiveBorder = TCOLORREF(COLOR_INACTIVEBORDER or $80000000);
+ clAppWorkSpace = TCOLORREF(COLOR_APPWORKSPACE or $80000000);
+ clHighlight = TCOLORREF(COLOR_HIGHLIGHT or $80000000);
+ clHighlightText = TCOLORREF(COLOR_HIGHLIGHTTEXT or $80000000);
+ clBtnFace = TCOLORREF(COLOR_BTNFACE or $80000000);
+ clBtnShadow = TCOLORREF(COLOR_BTNSHADOW or $80000000);
+ clGrayText = TCOLORREF(COLOR_GRAYTEXT or $80000000);
+ clGreyText = TCOLORREF(COLOR_GRAYTEXT or $80000000);
+ clBtnText = TCOLORREF(COLOR_BTNTEXT or $80000000);
clInactiveCaptionText = TCOLORREF(COLOR_INACTIVECAPTIONTEXT or $80000000);
- clBtnHighlight = TCOLORREF(COLOR_BTNHIGHLIGHT or $80000000);
- cl3DDkShadow = TCOLORREF(COLOR_3DDKSHADOW or $80000000);
- cl3DLight = TCOLORREF(COLOR_3DLIGHT or $80000000);
- clInfoText = TCOLORREF(COLOR_INFOTEXT or $80000000);
- clInfoBk = TCOLORREF(COLOR_INFOBK or $80000000);
+ clBtnHighlight = TCOLORREF(COLOR_BTNHIGHLIGHT or $80000000);
+ cl3DDkShadow = TCOLORREF(COLOR_3DDKSHADOW or $80000000);
+ cl3DLight = TCOLORREF(COLOR_3DLIGHT or $80000000);
+ clInfoText = TCOLORREF(COLOR_INFOTEXT or $80000000);
+ clInfoBk = TCOLORREF(COLOR_INFOBK or $80000000);
clBlack = TCOLORREF( $000000 );
clMaroon = TCOLORREF( $000080 );
@@ -67,9 +67,9 @@ const
clGRushHiLight = TCOLORREF( $F3706C );
clGRushLighten = TCOLORREF( $F1EEDF );
- clGRushLight = TCOLORREF( $e1cebf );
- clGRushNormal = TCOLORREF( $D1beaf );
- clGRushMedium = TCOLORREF( $b6bFc6 );
+ clGRushLight = TCOLORREF( $E1CEBF );
+ clGRushNormal = TCOLORREF( $D1BEAF );
+ clGRushMedium = TCOLORREF( $B6BFC6 );
clGRushDark = TCOLORREF( $9EACB4 );
function ColorToRGB(Color: TCOLORREF):TCOLORREF;
diff --git a/plugins/Utils.pas/appcmdapi.pas b/plugins/Utils.pas/appcmdapi.pas
index b316838ba3..5140e74f65 100644
--- a/plugins/Utils.pas/appcmdapi.pas
+++ b/plugins/Utils.pas/appcmdapi.pas
@@ -91,7 +91,7 @@ const
function SendMMCommand(wnd:HWND; cmd:integer):integer;
begin
// result:=ord(SendMessageW(wnd,WM_APPCOMMAND,wnd,cmd shl 16));
- result:=ord(SendnotifyMessageW(wnd,WM_APPCOMMAND,wnd,cmd shl 16));
+ result:=ord(SendNotifyMessageW(wnd,WM_APPCOMMAND,wnd,cmd shl 16));
end;
end.
diff --git a/plugins/Utils.pas/contact.pas b/plugins/Utils.pas/contact.pas
deleted file mode 100644
index 128d4fa6a7..0000000000
--- a/plugins/Utils.pas/contact.pas
+++ /dev/null
@@ -1,129 +0,0 @@
-{Contact list in combo}
-unit contact;
-
-interface
-
-uses windows, m_api;
-
-procedure FillContactList(list:HWND; filter:boolean=true;format:pWideChar=nil);
-function FindContact(list:HWND;contact:TMCONTACT):integer;
-
-implementation
-
-uses messages, common, dbsettings, mirutils;
-
-const
- defformat = '%name% - %uid% (%account%:%group%)';
-
-procedure FillContactList(list:HWND; filter:boolean=true;format:pWideChar=nil);
-var
- hContact:TMCONTACT;
- buf:array [0..511] of WideChar;
- buf1:array [0..63] of WideChar;
- p:PWideChar;
- uid:pAnsiChar;
- ldbv:TDBVARIANT;
- acc:pAnsiChar;
- lName,
- lGroup,
- lAccount,
- lUID:boolean;
-begin
- if format=nil then format:=defformat;
-
- SendMessage(list,CB_RESETCONTENT,0,0);
- hContact:=db_find_first();
-
- lName :=StrPosW(format,'%name%')<>nil;
- lGroup :=StrPosW(format,'%group%')<>nil;
- lAccount:=StrPosW(format,'%account%')<>nil;
- lUID :=StrPosW(format,'%uid%')<>nil;
-
- while hContact<>0 do
- begin
- if ((not filter) and ((IsContactActive(hContact)+1)>=0)) or // + disabled (not deleted)
- (filter and (IsContactActive(hContact) >=0)) then
- begin
- StrCopyW(buf,format);
- if lName then
- StrReplaceW(buf,'%name%',
- PWideChar(CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_UNICODE)));
-
- if lGroup then
- begin
- p:=DBReadUnicode(hContact,strCList,'Group',nil);
- StrReplaceW(buf,'%group%',p);
- mFreeMem(p);
- end;
-
- if lAccount then
- begin
- acc:=GetContactProtoAcc(hContact);
- StrReplaceW(buf,'%account%',FastAnsiToWideBuf(acc,buf1));
- end
- else
- acc:=nil;
-
- if lUID then
- begin
- if acc=nil then
- acc:=GetContactProtoAcc(hContact);
- if IsChat(hContact) then
- begin
- p:=DBReadUnicode(hContact,acc,'ChatRoomID');
- StrReplaceW(buf,'%uid%',p);
- mFreeMem(p);
- end
- else
- begin
- uid:=pAnsiChar(CallProtoService(acc,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid<>pAnsiChar(CALLSERVICE_NOTFOUND) then
- begin
- if DBReadSetting(hContact,acc,uid,@ldbv)=0 then
- begin
- case ldbv._type of
- DBVT_DELETED: p:='[deleted]';
- DBVT_BYTE : p:=IntToStr(buf1,ldbv.bVal);
- DBVT_WORD : p:=IntToStr(buf1,ldbv.wVal);
- DBVT_DWORD : p:=IntToStr(buf1,ldbv.dVal);
- DBVT_UTF8 : UTF8ToWide(ldbv.szVal.A,p);
- DBVT_ASCIIZ : AnsiToWide(ldbv.szVal.A,p,MirandaCP);
- DBVT_WCHAR : p:=ldbv.szVal.W;
- DBVT_BLOB : p:='blob';
- end;
- StrReplaceW(buf,'%uid%',p);
- if ldbv._type in [DBVT_UTF8,DBVT_ASCIIZ] then
- mFreeMem(p);
- DBFreeVariant(@ldbv);
- end;
- end;
- StrReplaceW(buf,'%uid%',nil);
- end;
- end;
-
- SendMessage(list,CB_SETITEMDATA,
- SendMessageW(list,CB_ADDSTRING,0,tlparam(@buf)),
- hContact);
- end;
- hContact:=db_find_next(hContact);
- end;
-end;
-
-function FindContact(list:HWND;contact:TMCONTACT):integer;
-var
- j:integer;
-begin
- result:=0;
- j:=SendMessage(list,CB_GETCOUNT,0,0);
- while j>0 do
- begin
- dec(j);
- if TMCONTACT(SendMessage(list,CB_GETITEMDATA,j,0))=contact then
- begin
- result:=j;
- break;
- end;
- end;
-end;
-
-end.
diff --git a/plugins/Utils.pas/datetime.pas b/plugins/Utils.pas/datetime.pas
index f30d186b4e..4b13d7b3f4 100644
--- a/plugins/Utils.pas/datetime.pas
+++ b/plugins/Utils.pas/datetime.pas
@@ -18,7 +18,8 @@ function IsLeapYear(Year:word):Boolean;
function EncodeTime(Hour, Minute, Sec: cardinal):TDateTime;
function EncodeDate(Year, Month , Day: cardinal):TDateTime;
-function Timestamp(Year,Month,Day:cardinal;Hour:cardinal=0;Minute:cardinal=0;Sec:cardinal=0):dword;
+function Timestamp(Year,Month,Day:cardinal;Hour:cardinal=0;Minute:cardinal=0;Sec:cardinal=0):dword; overload;
+function Timestamp(const st:TSystemTime):dword; overload;
function GetCurrentTimestamp:DWord;
procedure UnixTimeToFileTime(ts:int_ptr; var pft:TFILETIME);
@@ -31,6 +32,10 @@ function DateTimeToStr(Time:Dword; Format:pWideChar=nil):pWideChar;
function DateToStr (Time:Dword; Format:pWideChar=nil):pWideChar;
function TimeToStr (Time:Dword; Format:pWideChar=nil):pWideChar;
+function CompareDate(const one,two:TSystemTime):integer;
+function CompareTime(const one,two:TSystemTime):integer;
+function TimeToMidnight(const t:TSystemTime):integer;
+
implementation
uses
@@ -83,6 +88,12 @@ begin
result:=Round((t - UnixDateDelta) * SecondsPerDay);
end;
+function Timestamp(const st:TSystemTime):dword;
+ {$IFDEF AllowInline}inline;{$ENDIF}
+begin
+ result:=Timestamp(st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);
+end;
+
function GetCurrentTimestamp:dword;
var
st:tSystemTime;
@@ -171,4 +182,49 @@ begin
StrDupW(result,buf);
end;
+function CompareDate(const one,two:TSystemTime):integer;
+var
+ t1,t2:integer;
+begin
+ t1:=((one.wYear*12)+one.wMonth)*32+one.wDay;
+ t2:=((two.wYear*12)+two.wMonth)*32+two.wDay;
+ result:=t1-t2;
+{
+ result:=one.wYear-two.wYear;
+ if result=0 then
+ begin
+ result:=one.wMonth-two.wMonth;
+ if result=0 then
+ begin
+ result:=one.wDay-two.wDay;
+ end;
+ end;
+}
+end;
+
+function CompareTime(const one,two:TSystemTime):integer;
+var
+ t1,t2:integer;
+begin
+ t1:=one.wHour*3600+one.wMinute*60+one.wSecond;
+ t2:=two.wHour*3600+two.wMinute*60+two.wSecond;
+ result:=t1-t2;
+{
+ result:=one.wHour-two.wHour;
+ if result=0 then
+ begin
+ result:=one.wMinute-two.wMinute;
+ if result=0 then
+ begin
+ result:=one.wSecond-two.wSecond;
+ end;
+ end;
+}
+end;
+
+function TimeToMidnight(const t:TSystemTime):integer;
+begin
+ result:=SecondsPerDay-(t.wHour*3600+t.wMinute*60+t.wSecond);
+end;
+
end.
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas
index 1963248587..5679ef9fd1 100644
--- a/plugins/Utils.pas/dbsettings.pas
+++ b/plugins/Utils.pas/dbsettings.pas
@@ -37,7 +37,7 @@ function DBDeleteSetting(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiCh
function DBDeleteGroup(hContact:TMCONTACT;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
-function DBDeleteModule(szModule:PAnsiChar):integer; // 0.8.0+
+function DBDeleteModule(hContact:TMCONTACT;szModule:PAnsiChar):integer;
function DBGetSettingType(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
@@ -236,6 +236,13 @@ var
len:cardinal;
mask:array [0..31] of AnsiChar;
begin
+ if (prefix=nil) or (prefix^=#0) then
+ begin
+ DBDeleteModule(hContact,szModule);
+ result:=0;
+ exit;
+ end;
+
ces.szModule:=szModule;
num:=0;
//calculate size for setting names buffer
@@ -308,10 +315,10 @@ begin
FreeMem(p);
end;
-function DBDeleteModule(szModule:PAnsiChar):integer;
+function DBDeleteModule(hContact:TMCONTACT;szModule:PAnsiChar):integer;
begin
result:=0;
- CallService(MS_DB_MODULE_DELETE,0,lParam(szModule));
+ CallService(MS_DB_MODULE_DELETE,hContact,lParam(szModule));
end;
function DBGetSettingType(hContact:TMCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
diff --git a/plugins/Utils.pas/inouttext.pas b/plugins/Utils.pas/inouttext.pas
new file mode 100644
index 0000000000..d4013a815e
--- /dev/null
+++ b/plugins/Utils.pas/inouttext.pas
@@ -0,0 +1,194 @@
+unit inouttext;
+
+interface
+
+type
+ TTextExport = class
+ private
+ FCurrent:PAnsiChar;
+ FItems :array of PAnsiChar;
+ FItem :integer;
+ FIndent :integer;
+ FLineLen:integer;
+ FDoTab :boolean;
+
+ function AddTab:boolean;
+ function GetItems(i:integer):PAnsiChar;
+
+ public
+ constructor Create(cnt:integer);
+ destructor Destroy; override;
+
+ function NextItem:integer;
+ procedure EndItem;
+ procedure addText (name:PAnsichar; value:PAnsiChar);
+ procedure addTextW(name:PAnsichar; value:PWideChar);
+ procedure addDWord(name:PAnsichar; value:cardinal);
+ procedure addFlag (name:PAnsichar; value:boolean=true);
+ procedure addNewLine;
+ procedure ShiftRight;
+ procedure ShiftLeft;
+
+ property Items[i:integer]:PAnsiChar read GetItems;
+ end;
+
+implementation
+
+uses Common;
+
+const
+ BUFSIZE = 65536;
+
+constructor TTextExport.Create(cnt:integer);
+begin
+ SetLength(FItems,cnt);
+ FIndent :=0;
+ FDoTab :=true;
+ FLineLen:=0;
+ FItem :=-1;
+end;
+
+destructor TTextExport.Destroy;
+var
+ i:integer;
+begin
+ for i:=0 to HIGH(FItems) do
+ mFreeMem(FItems[i]);
+ FItems:=nil;
+
+ inherited;
+end;
+
+function TTextExport.GetItems(i:integer):PAnsiChar;
+begin
+ if (i>=0) and (i<HIGH(FItems)) then
+ result:=FItems[i]
+ else
+ result:=nil;
+end;
+
+function TTextExport.NextItem:integer;
+begin
+ inc(FItem);
+ mGetMem(FItems[FItem],BUFSIZE);
+ FCurrent:=FItems[FItem];
+ result:=FItem;
+end;
+
+procedure TTextExport.EndItem;
+var
+ p:PAnsiChar;
+begin
+ if FItem>=0 then
+ begin
+ FCurrent^:=#0;
+ p:=FItems[FItem];
+ StrDup(FItems[FItem],p);
+ mFreeMem(p);
+ end;
+end;
+
+function TTextExport.AddTab:boolean;
+var
+ i:integer;
+begin
+ result:=FDoTab;
+ if FDoTab then
+ begin
+ for i:=0 to FIndent-1 do
+ begin
+ FCurrent^:=' '; inc(FCurrent); inc(FLineLen);
+ end;
+ FDoTab:=false;
+ end;
+end;
+
+procedure TTextExport.addText(name:PAnsichar; value:PAnsiChar);
+begin
+ if not AddTab then
+ if (FCurrent-1)^ <> #10 then //!!
+ begin
+ FCurrent^:=' '; inc(FCurrent); inc(FLineLen);
+ end;
+
+ FCurrent:=StrCopyE(FCurrent,name); FCurrent^:='='; inc(FCurrent); inc(FLineLen, StrLen(name)+1);
+ // check and make borders ', " or []
+ FCurrent^:='"'; inc(FCurrent); inc(FLineLen);
+ // delim-start
+ FCurrent:=StrCopyE(FCurrent,value);
+ // delim-end
+ FCurrent^:='"'; inc(FCurrent); inc(FLineLen);
+end;
+
+procedure TTextExport.addTextW(name:PAnsichar; value:PWideChar);
+var
+ pc:PAnsiChar;
+begin
+ if not AddTab then
+ if (FCurrent-1)^ <> #10 then //!!
+ begin
+ FCurrent^:=' '; inc(FCurrent); inc(FLineLen);
+ end;
+
+ FCurrent:=StrCopyE(FCurrent,name); FCurrent^:='='; inc(FCurrent); inc(FLineLen, StrLen(name)+1);
+ // check and make borders ', " or []
+ FCurrent^:='"'; inc(FCurrent); inc(FLineLen);
+ // delim-start
+ FCurrent:=StrCopyE(FCurrent,WideToUTF8(value, pc));
+ // delim-end
+ FCurrent^:='"'; inc(FCurrent); inc(FLineLen);
+
+ mFreeMem(pc);
+end;
+
+procedure TTextExport.addDWord(name:PAnsichar; value:cardinal);
+var
+ p:PAnsiChar;
+begin
+ if not AddTab then
+ begin
+ FCurrent^:=' '; inc(FCurrent); inc(FLineLen);
+ end;
+ FCurrent:=StrCopyE(FCurrent,name);
+ inc(FLineLen,StrLen(name));
+ FCurrent^:='='; inc(FCurrent); inc(FLineLen);
+ p:=IntToStr(FCurrent,value);
+ inc(FLineLen,StrLen(p));
+ FCurrent:=StrEnd(p);
+end;
+
+procedure TTextExport.addFlag(name:PAnsichar; value:boolean=true);
+begin
+ // if set "name=0/1", change here
+ if value then
+ begin
+ if not AddTab then
+ begin
+ FCurrent^:=' '; inc(FCurrent); inc(FLineLen);
+ end;
+ FCurrent:=StrCopyE(FCurrent,name);
+ inc(FLineLen,StrLen(name));
+ end;
+end;
+
+procedure TTextExport.addNewLine;
+begin
+ FCurrent^:=#13; inc(FCurrent);
+ FCurrent^:=#10; inc(FCurrent);
+ FDoTab :=true;
+ FLineLen:=0;
+end;
+
+procedure TTextExport.ShiftRight;
+begin
+ inc(FIndent,2);
+end;
+
+procedure TTextExport.ShiftLeft;
+begin
+ dec(FIndent,2);
+ if FIndent<0 then
+ FIndent:=0;
+end;
+
+end.
diff --git a/plugins/Utils.pas/kolsizer.pas b/plugins/Utils.pas/kolsizer.pas
index 1004e1de57..7ba46a5f2a 100644
--- a/plugins/Utils.pas/kolsizer.pas
+++ b/plugins/Utils.pas/kolsizer.pas
@@ -40,7 +40,7 @@ type
procedure DoKeyUp( Sender: PControl; var Key: Longint; Shift: dword);
procedure DoChar( Sender: PControl; var Key: KOLChar; Shift: dword);
public
- destructor destroy;virtual;
+ destructor Destroy; virtual;//override;
procedure Connect(aName: KOLString; aControl: pControl; flags:cardinal=0);
procedure DisConnect(aControl: pControl);
procedure Paintgrid(sender:pControl;DC:HDC);
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas
new file mode 100644
index 0000000000..50d700b802
--- /dev/null
+++ b/plugins/Utils.pas/mircontacts.pas
@@ -0,0 +1,673 @@
+{$INCLUDE compilers.inc}
+unit mircontacts;
+
+interface
+
+uses
+ Windows,
+ m_api;
+
+//----- Contact info -----
+
+function GetContactProtoAcc(hContact:TMCONTACT):PAnsiChar;
+function GetContactProto(hContact: TMCONTACT): pAnsiChar; overload;
+function GetContactProto(hContact: TMCONTACT; var SubContact: TMCONTACT; var SubProtocol: pAnsiChar): pAnsiChar; overload;
+function GetContactDisplayName(hContact: TMCONTACT; Proto: pAnsiChar = nil; Contact: boolean = false): PWideChar;
+function GetContactID(hContact: TMCONTACT; Proto: pAnsiChar = nil; Contact: boolean = false): PAnsiChar;
+
+function GetContactCodePage (hContact: TMCONTACT; Proto: pAnsiChar; var UsedDefault: boolean): Cardinal; overload;
+function GetContactCodePage (hContact: TMCONTACT; const Proto: pAnsiChar = nil): Cardinal; overload;
+function WriteContactCodePage(hContact: TMCONTACT; CodePage: Cardinal; Proto: pAnsiChar = nil): boolean;
+
+function GetContactStatus(hContact:TMCONTACT):integer;
+
+//----- Contact type check -----
+
+function IsChat(hContact:TMCONTACT):bool;
+function IsMirandaUser(hContact:TMCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
+
+// -2 - deleted account, -1 - disabled account, 0 - hidden
+// 1 - metacontact, 2 - submetacontact, positive - active
+// proto - ASSIGNED buffer
+function IsContactActive(hContact:TMCONTACT;proto:pAnsiChar=nil):integer;
+
+//----- Save / Load contact -----
+
+function LoadContact(group,setting:PAnsiChar):TMCONTACT;
+function SaveContact(hContact:TMCONTACT;group,setting:PAnsiChar):integer;
+function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):TMCONTACT;
+
+//----- Another functions -----
+
+function SetCListSelContact(hContact:TMCONTACT):TMCONTACT;
+function GetCListSelContact:TMCONTACT;
+
+function WndToContact(wnd:HWND):TMCONTACT; overload;
+function WndToContact:TMCONTACT; overload;
+
+procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true);
+procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
+
+//----- List of contacts (combobox) -----
+
+procedure FillContactList(list:HWND;filter:boolean=true;format:pWideChar=nil);
+function FindContact (list:HWND;contact:TMCONTACT):integer;
+
+
+implementation
+
+uses
+ messages,
+ common, syswin,
+ dbsettings;
+
+//----- Contact info -----
+
+function GetContactProtoAcc(hContact:TMCONTACT):PAnsiChar;
+begin
+ if ServiceExists(MS_PROTO_GETCONTACTBASEACCOUNT)<>0 then
+ result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEACCOUNT,hContact,0))
+ else
+ result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
+end;
+
+function GetContactProto(hContact: TMCONTACT): pAnsiChar;
+{$IFDEF AllowInline}inline;{$ENDIF}
+begin
+ Result := PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0));
+end;
+
+function GetContactProto(hContact: TMCONTACT; var SubContact: TMCONTACT; var SubProtocol: pAnsiChar): pAnsiChar;
+begin
+ Result := GetContactProto(hContact);
+ if StrCmp(Result, META_PROTO)=0 then
+ begin
+ SubContact := CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
+ SubProtocol := PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO, SubContact, 0));
+ end
+ else
+ begin
+ SubContact := hContact;
+ SubProtocol := Result;
+ end;
+end;
+
+function GetContactDisplayName(hContact: TMCONTACT; Proto: pAnsiChar = nil; Contact: boolean = false): PWideChar;
+var
+ ci: TContactInfo;
+ pUnk:PWideChar;
+begin
+ if (hContact = 0) and Contact then
+ StrDupW(Result, TranslateW('Server'))
+ else
+ begin
+ if Proto = nil then
+ Proto := GetContactProto(hContact);
+ pUnk := TranslateW('''(Unknown Contact)''');
+ if Proto = nil then
+ StrDupW(Result, pUnk)
+ else
+ begin
+ ci.cbSize := SizeOf(ci);
+ ci.hContact := hContact;
+ ci.szProto := Proto;
+ ci.dwFlag := CNF_DISPLAY + CNF_UNICODE;
+ if CallService(MS_CONTACT_GETCONTACTINFO, 0, LPARAM(@ci)) = 0 then
+ begin
+ if StrCmpW(ci.retval.szVal.w, pUnk)=0 then
+ AnsiToWide(GetContactID(hContact, Proto), Result, CP_ACP)
+ else
+ StrDupW(Result, ci.retval.szVal.w);
+ mir_free(ci.retval.szVal.w);
+ end
+ else
+ AnsiToWide(GetContactID(hContact, Proto), Result);
+
+ if (Result = nil) or (Result^ = #0) then
+ AnsiToWide(Translate(Proto), Result, CallService(MS_LANGPACK_GETCODEPAGE, 0, 0));
+ end;
+ end;
+end;
+
+function GetContactID(hContact: TMCONTACT; Proto: pAnsiChar = nil; Contact: boolean = false): PAnsiChar;
+var
+ uid: PAnsiChar;
+ dbv: TDBVARIANT;
+ buf: array [0..15] of AnsiChar;
+ cp: Cardinal;
+begin
+ Result := nil;
+ if not((hContact = 0) and Contact) then
+ begin
+ if Proto = nil then
+ Proto := GetContactProto(hContact);
+ uid := PAnsiChar(CallProtoService(Proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0));
+ if (int_ptr(uid) <> CALLSERVICE_NOTFOUND) and (uid <> nil) then
+ begin
+ // DBGetContactSettingStr comparing to DBGetContactSetting don't translate strings
+ // when uType=0 (DBVT_ASIS)
+ if DBGetContactSettingStr(hContact, Proto, uid, @dbv, DBVT_ASIS) = 0 then
+ begin
+ case dbv._type of
+ DBVT_BYTE: StrDup(Result, IntToStr(buf,dbv.bVal));
+ DBVT_WORD: StrDup(Result, IntToStr(buf,dbv.wVal));
+ DBVT_DWORD: StrDup(Result, IntToStr(buf,dbv.dVal));
+ DBVT_ASCIIZ: StrDup(Result, dbv.szVal.a);
+ DBVT_UTF8,
+ DBVT_WCHAR: begin
+ cp := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
+ if dbv._type = DBVT_UTF8 then
+ UTF8ToAnsi(dbv.szVal.a, Result, cp)
+ else // dbv._type = DBVT_WCHAR then
+ WideToAnsi(dbv.szVal.w, Result, cp);
+ end;
+ end;
+ // free variant
+ DBFreeVariant(@dbv);
+ end;
+ end;
+ end;
+end;
+
+function GetContactCodePage(hContact: TMCONTACT; Proto: pAnsiChar; var UsedDefault: boolean) : Cardinal;
+begin
+ if Proto = nil then
+ Proto := GetContactProto(hContact);
+ if Proto = nil then
+ Result := CallService(MS_LANGPACK_GETCODEPAGE, 0, 0)
+ else
+ begin
+ Result := DBReadWord(hContact, Proto, 'AnsiCodePage', $FFFF);
+ If Result = $FFFF then
+ Result := DBReadWord(0, Proto, 'AnsiCodePage', CP_ACP);
+ end;
+ UsedDefault := (Result = CP_ACP);
+ if UsedDefault then
+ Result := GetACP();
+end;
+
+function GetContactCodePage(hContact: TMCONTACT; const Proto: pAnsiChar = nil): Cardinal;
+var
+ def: boolean;
+begin
+ Result := GetContactCodePage(hContact, Proto, def);
+end;
+
+function WriteContactCodePage(hContact: TMCONTACT; CodePage: Cardinal; Proto: pAnsiChar = nil): boolean;
+begin
+ Result := false;
+ if Proto = nil then
+ Proto := GetContactProto(hContact);
+ if Proto = nil then
+ exit;
+ DBWriteWord(hContact, Proto, 'AnsiCodePage', CodePage);
+ Result := True;
+end;
+
+function GetContactStatus(hContact:TMCONTACT):integer;
+var
+ szProto:PAnsiChar;
+begin
+ szProto:=GetContactProto(hContact);
+ if szProto=nil then
+ result:=ID_STATUS_OFFLINE
+ else
+ result:=DBReadWord(hContact,szProto,'Status',ID_STATUS_OFFLINE);
+end;
+
+//----- Contact type check -----
+
+function IsChat(hContact:TMCONTACT):bool;
+begin
+ result:=DBReadByte(hContact,GetContactProto(hContact),'ChatRoom',0)=1;
+end;
+
+function IsMirandaUser(hContact:TMCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
+var
+ sz:PAnsiChar;
+begin
+ sz:=DBReadString(hContact,GetContactProto(hContact),'MirVer');
+ if sz<>nil then
+ begin
+ result:=int_ptr(StrPos(sz,'Miranda'));
+ mFreeMem(sz);
+ end
+ else
+ result:=-1;
+end;
+
+function IsContactActive(hContact:TMCONTACT;proto:pAnsiChar=nil):integer;
+var
+ p:PPROTOACCOUNT;
+ name: array [0..31] of AnsiChar;
+begin
+
+ if db_get_static(hContact,'Protocol','p',@name,SizeOf(name))=0 then
+ begin
+ result:=0;
+
+ if ServiceExists(MS_PROTO_GETACCOUNT)<>0 then
+ begin
+ p:=PPROTOACCOUNT(CallService(MS_PROTO_GETACCOUNT,0,lparam(@name)));
+ if p=nil then
+ result:=-2 // deleted
+ else if (not p^.bIsEnabled) or p^.bDynDisabled then
+ result:=-1; // disabled
+ end
+ else
+ begin
+ if CallService(MS_PROTO_ISPROTOCOLLOADED,0,lparam(@name))=0 then
+ result:=-1;
+ end;
+
+ if (result=0) and (DBReadByte(hContact,strCList,'Hidden',0)=0) then
+ begin
+ result:=255;
+ if db_mc_getMeta(hContact)<>0 then
+ result:=2;
+ if StrCmp(GetContactProto(hContact),META_PROTO)=0 then
+ result:=1;
+ end;
+ if proto<>nil then
+ StrCopy(proto,@name);
+ end
+ else
+ begin
+ result:=-2;
+ if proto<>nil then
+ proto^:=#0;
+ end;
+end;
+
+//----- Save / Load contact -----
+
+const
+ opt_cproto = 'cproto';
+ opt_cuid = 'cuid';
+ opt_ischat = 'ischat';
+
+function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):TMCONTACT;
+var
+ uid:pAnsiChar;
+ ldbv:TDBVARIANT;
+ hContact:TMCONTACT;
+ pw:pWideChar;
+begin
+ result:=0;
+ uid:=nil;
+ if not is_chat then
+ begin
+ uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
+ if uid=pAnsiChar(CALLSERVICE_NOTFOUND) then exit;
+ end;
+
+ hContact:=db_find_first();
+ while hContact<>0 do
+ begin
+ if is_chat then
+ begin
+ if IsChat(hContact) then
+ begin
+ pw:=DBReadUnicode(hContact,proto,'ChatRoomID');
+ if StrCmpW(pw,dbv.szVal.W)=0 then result:=hContact;
+ mFreeMem(pw);
+ end
+ end
+ else
+ begin
+ if DBReadSetting(hContact,proto,uid,@ldbv)=0 then
+ begin
+ if dbv._type=ldbv._type then
+ begin
+ case dbv._type of
+// DBVT_DELETED: ;
+ DBVT_BYTE : if dbv.bVal=ldbv.bVal then result:=hContact;
+ DBVT_WORD : if dbv.wVal=ldbv.wVal then result:=hContact;
+ DBVT_DWORD : if dbv.dVal=ldbv.dVal then result:=hContact;
+ DBVT_UTF8,
+ DBVT_ASCIIZ : if StrCmp (dbv.szVal.A,ldbv.szVal.A)=0 then result:=hContact;
+ DBVT_WCHAR : if StrCmpW(dbv.szVal.W,ldbv.szVal.W)=0 then result:=hContact;
+ DBVT_BLOB : begin
+ if dbv.cpbVal = ldbv.cpbVal then
+ begin
+ if CompareMem(dbv.pbVal,ldbv.pbVal,dbv.cpbVal) then
+ result:=hContact;
+ end;
+ end;
+ end;
+ end;
+ DBFreeVariant(@ldbv);
+ end;
+ end;
+ // added 2011.04.20
+ if result<>0 then break;
+ hContact:=db_find_next(hContact);
+ end;
+end;
+
+function LoadContact(group,setting:PAnsiChar):TMCONTACT;
+var
+ p,proto:pAnsiChar;
+ section:array [0..63] of AnsiChar;
+ dbv:TDBVARIANT;
+ is_chat:boolean;
+begin
+ p:=StrCopyE(section,setting);
+ StrCopy(p,opt_cproto); proto :=DBReadString(0,group,section);
+ StrCopy(p,opt_ischat); is_chat:=DBReadByte (0,group,section,0)<>0;
+ StrCopy(p,opt_cuid );
+ if is_chat then
+ dbv.szVal.W:=DBReadUnicode(0,group,section,@dbv)
+ else
+ DBReadSetting(0,group,section,@dbv);
+
+ result:=FindContactHandle(proto,dbv,is_chat);
+
+ mFreeMem(proto);
+ if not is_chat then
+ DBFreeVariant(@dbv)
+ else
+ mFreeMem(dbv.szVal.W);
+end;
+
+function SaveContact(hContact:TMCONTACT;group,setting:PAnsiChar):integer;
+var
+ p,proto,uid:pAnsiChar;
+ cws:TDBVARIANT;
+ section:array [0..63] of AnsiChar;
+ pw:pWideChar;
+ is_chat:boolean;
+begin
+ result:=0;
+ proto:=GetContactProtoAcc(hContact);
+ if proto<>nil then
+ begin
+ p:=StrCopyE(section,setting);
+ is_chat:=IsChat(hContact);
+ if is_chat then
+ begin
+ pw:=DBReadUnicode(hContact,proto,'ChatRoomID');
+ StrCopy(p,opt_cuid); DBWriteUnicode(0,group,section,pw);
+ mFreeMem(pw);
+ result:=1;
+ end
+ else
+ begin
+ uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
+ if uid<>pAnsiChar(CALLSERVICE_NOTFOUND) then
+ begin
+ if DBReadSetting(hContact,proto,uid,@cws)=0 then
+ begin
+ StrCopy(p,opt_cuid); DBWriteSetting(0,group,section,@cws);
+ DBFreeVariant(@cws);
+ result:=1;
+ end;
+ end;
+ end;
+ if result<>0 then
+ begin
+ StrCopy(p,opt_cproto); DBWriteString(0,group,section,proto);
+ StrCopy(p,opt_ischat); DBWriteByte (0,group,section,ord(is_chat));
+ end;
+ end;
+end;
+
+//----- Another functions -----
+
+function SetCListSelContact(hContact:TMCONTACT):TMCONTACT;
+var
+ wnd:HWND;
+begin
+ wnd:=CallService(MS_CLUI_GETHWNDTREE,0,0);
+ result:=hContact;
+// hContact:=SendMessage(wnd,CLM_FINDCONTACT ,hContact,0);
+ SendMessage(wnd,CLM_SELECTITEM ,hContact,0);
+// SendMessage(wnd,CLM_ENSUREVISIBLE,hContact,0);
+end;
+
+function GetCListSelContact:TMCONTACT;
+begin
+ result:=SendMessageW(CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETSELECTION,0,0);
+end;
+
+function WndToContact(wnd:HWND):TMCONTACT;
+var
+ hContact:TMCONTACT;
+ mwid:TMessageWindowInputData;
+ mwod:TMessageWindowOutputData;
+begin
+ wnd:=GetParent(wnd); //!!
+ hContact:=db_find_first();
+ with mwid do
+ begin
+ cbSize:=SizeOf(mwid);
+ uFlags:=MSG_WINDOW_UFLAG_MSG_BOTH;
+ end;
+ mwod.cbSize:=SizeOf(mwod);
+ while hContact<>0 do
+ begin
+ mwid.hContact:=hContact;
+ if CallService(MS_MSG_GETWINDOWDATA,wparam(@mwid),lparam(@mwod))=0 then
+ begin
+ if {((mwod.uState and MSG_WINDOW_STATE_FOCUS)<>0) and} (mwod.hwndWindow=wnd) then
+ begin
+ result:=mwid.hContact;
+ exit;
+ end
+ end;
+ hContact:=db_find_next(hContact);
+ end;
+ result:=0;
+end;
+
+function WndToContact:TMCONTACT; overload;
+var
+ wnd:HWND;
+begin
+ wnd:=GetFocus;
+ if wnd=0 then
+ wnd:=WaitFocusedWndChild(GetForegroundWindow);
+ if wnd<>0 then
+ result:=WndToContact(wnd)
+ else
+ result:=0;
+ if result=0 then
+ result:=GetCListSelContact;
+end;
+
+procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true);
+var
+ pc:array [0..127] of AnsiChar;
+begin
+{
+CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0);
+}
+ if (hContact<>0) and (CallService(MS_DB_CONTACT_IS,hContact,0)<>0) then
+ begin
+ if StrCopy(pc,GetContactProto(hContact))<>nil then
+ if DblClk or (DBReadByte(hContact,pc,'ChatRoom',0)=1) then // chat room
+ begin
+ if not anystatus then
+ begin
+ StrCat(pc,PS_GETSTATUS);
+ anystatus:=(CallService(pc,0,0)<>ID_STATUS_OFFLINE);
+ end;
+ if anystatus then
+ begin
+ CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0); //??
+ // if chat exist, open chat
+ // else create new session
+ end;
+ end
+ else
+ begin
+ if ServiceExists(MS_MSG_CONVERS)<>0 then // Convers compat.
+ CallService(MS_MSG_CONVERS,hContact,0)
+ else
+ CallService(MS_MSG_SENDMESSAGE,hContact,0)
+ end;
+ end;
+end;
+
+procedure SendChatText(pszID:pointer;pszModule:PAnsiChar;pszText:pointer);
+var
+ gcd:TGCDEST;
+ gce:TGCEVENT;
+begin
+ gcd.pszModule:=pszModule;
+ gcd.iType :=GC_EVENT_SENDMESSAGE;
+ gcd.szID.w :=pszID;
+
+ FillChar(gce,SizeOf(TGCEVENT),0);
+ gce.cbSize :=SizeOf(TGCEVENT);
+ gce.pDest :=@gcd;
+ gce.bIsMe :=true;
+ gce.szText.w:=pszText;
+ gce.dwFlags :=GCEF_ADDTOLOG;
+ gce.time :=GetCurrentTime;
+
+ CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
+end;
+
+procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
+var
+ gci:TGC_INFO;
+ pszModule:PAnsiChar;
+ i,cnt:integer;
+begin
+ pszModule:=GetContactProto(hContact);
+ cnt:=CallService(MS_GC_GETSESSIONCOUNT,0,lparam(pszModule));
+ i:=0;
+ gci.pszModule:=pszModule;
+ while i<cnt do
+ begin
+ gci.iItem:=i;
+ gci.Flags:=GCF_BYINDEX+GCF_HCONTACT+GCF_ID;
+ CallService(MS_GC_GETINFO,0,lparam(@gci));
+ if gci.hContact=hContact then
+ begin
+ SendChatText(gci.pszID.w,pszModule,pszText);
+ break;
+ end;
+ inc(i);
+ end;
+end;
+
+//----- List of contacts -----
+
+const
+ defformat = '%name% - %uid% (%account%:%group%)';
+
+procedure FillContactList(list:HWND; filter:boolean=true;format:pWideChar=nil);
+var
+ hContact:TMCONTACT;
+ buf:array [0..511] of WideChar;
+ buf1:array [0..63] of WideChar;
+ p:PWideChar;
+ uid:pAnsiChar;
+ ldbv:TDBVARIANT;
+ acc:pAnsiChar;
+ lName,
+ lGroup,
+ lAccount,
+ lUID:boolean;
+begin
+ if format=nil then format:=defformat;
+
+ SendMessage(list,CB_RESETCONTENT,0,0);
+ hContact:=db_find_first();
+
+ lName :=StrPosW(format,'%name%')<>nil;
+ lGroup :=StrPosW(format,'%group%')<>nil;
+ lAccount:=StrPosW(format,'%account%')<>nil;
+ lUID :=StrPosW(format,'%uid%')<>nil;
+
+ while hContact<>0 do
+ begin
+ if ((not filter) and ((IsContactActive(hContact)+1)>=0)) or // + disabled (not deleted)
+ (filter and (IsContactActive(hContact) >=0)) then
+ begin
+ StrCopyW(buf,format);
+ if lName then
+ StrReplaceW(buf,'%name%',
+ PWideChar(CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_UNICODE)));
+
+ if lGroup then
+ begin
+ p:=DBReadUnicode(hContact,strCList,'Group',nil);
+ StrReplaceW(buf,'%group%',p);
+ mFreeMem(p);
+ end;
+
+ if lAccount then
+ begin
+ acc:=GetContactProtoAcc(hContact);
+ StrReplaceW(buf,'%account%',FastAnsiToWideBuf(acc,buf1));
+ end
+ else
+ acc:=nil;
+
+ if lUID then
+ begin
+ if acc=nil then
+ acc:=GetContactProtoAcc(hContact);
+ if IsChat(hContact) then
+ begin
+ p:=DBReadUnicode(hContact,acc,'ChatRoomID');
+ StrReplaceW(buf,'%uid%',p);
+ mFreeMem(p);
+ end
+ else
+ begin
+ uid:=pAnsiChar(CallProtoService(acc,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
+ if uid<>pAnsiChar(CALLSERVICE_NOTFOUND) then
+ begin
+ if DBReadSetting(hContact,acc,uid,@ldbv)=0 then
+ begin
+ case ldbv._type of
+ DBVT_DELETED: p:='[deleted]';
+ DBVT_BYTE : p:=IntToStr(buf1,ldbv.bVal);
+ DBVT_WORD : p:=IntToStr(buf1,ldbv.wVal);
+ DBVT_DWORD : p:=IntToStr(buf1,ldbv.dVal);
+ DBVT_UTF8 : UTF8ToWide(ldbv.szVal.A,p);
+ DBVT_ASCIIZ : AnsiToWide(ldbv.szVal.A,p,CallService(MS_LANGPACK_GETCODEPAGE,0,0));
+ DBVT_WCHAR : p:=ldbv.szVal.W;
+ DBVT_BLOB : p:='blob';
+ end;
+ StrReplaceW(buf,'%uid%',p);
+ if ldbv._type in [DBVT_UTF8,DBVT_ASCIIZ] then
+ mFreeMem(p);
+ DBFreeVariant(@ldbv);
+ end;
+ end;
+ StrReplaceW(buf,'%uid%',nil);
+ end;
+ end;
+
+ SendMessage(list,CB_SETITEMDATA,
+ SendMessageW(list,CB_ADDSTRING,0,tlparam(@buf)),
+ hContact);
+ end;
+ hContact:=db_find_next(hContact);
+ end;
+end;
+
+function FindContact(list:HWND;contact:TMCONTACT):integer;
+var
+ j:integer;
+begin
+ result:=0;
+ j:=SendMessage(list,CB_GETCOUNT,0,0);
+ while j>0 do
+ begin
+ dec(j);
+ if TMCONTACT(SendMessage(list,CB_GETITEMDATA,j,0))=contact then
+ begin
+ result:=j;
+ break;
+ end;
+ end;
+end;
+
+
+end.
diff --git a/plugins/Utils.pas/mirevents.pas b/plugins/Utils.pas/mirevents.pas
new file mode 100644
index 0000000000..62ffecb61e
--- /dev/null
+++ b/plugins/Utils.pas/mirevents.pas
@@ -0,0 +1,536 @@
+{$Include compilers.inc}
+unit mirevents;
+
+interface
+
+uses
+ Windows,
+ m_api;
+
+type
+ TBaseEventType = (
+ mtUnknown,
+ mtMessage, mtUrl, mtFile, mtSystem, mtContacts, mtStatus,
+ mtOther);
+
+ PMessageTypes = ^TMessageTypes;
+ TMessageTypes = set of TBaseEventType;
+
+const
+ BaseEventNames: array[TBaseEventType] of PAnsiChar = (
+ 'Unknown',
+ 'Message', // SKINICON_EVENT_MESSAGE
+ 'Link', // SKINICON_EVENT_URL
+ 'File transfer', // SKINICON_EVENT_FILE
+ 'System message', // SKINICON_OTHER_MIRANDA, SKINICON_OTHER_MIRANDAWEB,
+ 'Contacts', // SKINICON_OTHER_ADDCONTACT, SKINICON_OTHER_USERDETAILS
+ 'Status changes', // SKINICON_OTHER_STATUS, SKINICON_STATUS_* (MS_SKIN_LOADPROTOICON)
+ 'Other events (unknown)'
+ );
+
+//----- Event info -----
+
+procedure GetEventInfo (hDBEvent: THANDLE; var EventInfo: TDBEventInfo);
+function GetEventTimestamp(hDBEvent: THANDLE): DWord;
+function GetEventDateTime (hDBEvent: THANDLE): TDateTime;
+function GetEventCoreText (const EventInfo: TDBEventInfo; CP: integer = CP_ACP): PWideChar;
+
+//----- Event check -----
+
+function IsIncomingEvent(const EventInfo: TDBEventInfo):boolean; overload;
+function IsIncomingEvent(hDBEvent: THANDLE):boolean; overload;
+function IsOutgoingEvent(const EventInfo: TDBEventInfo):boolean; overload;
+function IsOutgoingEvent(hDBEvent: THANDLE):boolean; overload;
+function IsReadedEvent (const EventInfo: TDBEventInfo):boolean; overload;
+function IsReadedEvent (hDBEvent: THANDLE):boolean; overload;
+
+function GetEventBaseType(EventInfo: TDBEventInfo): TBaseEventType; overload;
+function GetEventBaseType(hDBEvent : THANDLE ): TBaseEventType; overload;
+
+//----- Custom events processing -----
+
+//procedure ReadEvent (hDBEvent: THANDLE; var EventInfo: TDBEventInfo; UseCP: Cardinal = CP_ACP);
+//function GetEventName(const Hi: THistoryItem):pAnsiChar;
+
+function GetEventText(hDBEvent: THANDLE ; custom:boolean; cp:integer=CP_ACP):PWideChar; overload;
+function GetEventText(const EventInfo: TDBEventInfo; custom:boolean; cp:integer=CP_ACP):PWideChar; overload;
+
+
+implementation
+
+uses
+ common,
+ datetime;
+
+//----- Event info -----
+
+procedure GetEventInfo(hDBEvent: THANDLE; var EventInfo: TDBEventInfo);
+var
+ BlobSize: integer;
+begin
+ ZeroMemory(@EventInfo, SizeOf(EventInfo));
+ EventInfo.cbSize := SizeOf(EventInfo);
+ BlobSize := db_event_getBlobSize(hDBEvent);
+ if BlobSize > 0 then
+ begin
+ mGetMem(EventInfo.pBlob,BlobSize+2); // cheat, for possible crash avoid
+ end
+ else
+ BlobSize := 0;
+ EventInfo.cbBlob := BlobSize;
+ if db_event_get(hDBEvent, @EventInfo) = 0 then
+ begin
+ EventInfo.cbBlob := BlobSize;
+ if BlobSize > 0 then
+ begin
+ pAnsiChar(EventInfo.pBlob)[BlobSize ]:=#0;
+ pAnsiChar(EventInfo.pBlob)[BlobSize+1]:=#0;
+ end;
+ end
+ else
+ EventInfo.cbBlob := 0;
+end;
+
+function GetEventCoreText(const EventInfo: TDBEventInfo; CP: integer = CP_ACP): PWideChar;
+var
+ dbegt: TDBEVENTGETTEXT;
+ msg: pWideChar;
+begin
+ dbegt.dbei := @EventInfo;
+ dbegt.datatype := DBVT_WCHAR;
+ dbegt.codepage := CP;
+
+ msg := pWideChar(CallService(MS_DB_EVENT_GETTEXT,0,LPARAM(@dbegt)));
+
+ result := AdjustLineBreaks(msg);
+ result := rtrimw(result);
+
+ mir_free(msg);
+end;
+
+//----- Info functions (no blob required) -----
+var
+ RecentEvent: THANDLE = 0;
+ RecentEventInfo: TDBEventInfo;
+
+procedure CheckRecent(hDBEvent: THANDLE);
+begin
+ if RecentEvent <> hDBEvent then
+ begin
+ ZeroMemory(@RecentEventInfo, SizeOf(RecentEventInfo));
+ RecentEventInfo.cbSize := SizeOf(RecentEventInfo);
+ RecentEventInfo.cbBlob := 0;
+ db_event_get(hDBEvent, @RecentEventInfo);
+ RecentEvent := hDBEvent;
+ end;
+end;
+
+function GetEventTimestamp(hDBEvent: THANDLE): DWord;
+begin
+ CheckRecent(hDBEvent);
+ Result := RecentEventInfo.timestamp;
+end;
+
+function GetEventDateTime(hDBEvent: THANDLE): TDateTime;
+begin
+ Result := TimestampToDateTime(GetEventTimestamp(hDBEvent));
+end;
+
+//----- Event check -----
+
+function IsIncomingEvent(const EventInfo: TDBEventInfo):boolean;
+ {$IFDEF AllowInline}inline;{$ENDIF}
+begin
+ Result:=(EventInfo.flags and DBEF_SENT) = 0
+end;
+
+function IsIncomingEvent(hDBEvent: THANDLE):boolean;
+begin
+ CheckRecent(hDBEvent);
+ Result:=(RecentEventInfo.flags and DBEF_SENT) = 0
+end;
+
+function IsOutgoingEvent(const EventInfo: TDBEventInfo):boolean;
+ {$IFDEF AllowInline}inline;{$ENDIF}
+begin
+ result:=(EventInfo.flags and DBEF_SENT) <> 0;
+end;
+
+function IsOutgoingEvent(hDBEvent: THANDLE):boolean;
+begin
+ CheckRecent(hDBEvent);
+ result:=(RecentEventInfo.flags and DBEF_SENT) <> 0;
+end;
+
+function IsReadedEvent(const EventInfo: TDBEventInfo):boolean;
+ {$IFDEF AllowInline}inline;{$ENDIF}
+begin
+ result:=(EventInfo.flags and DBEF_READ) <> 0;
+end;
+
+function IsReadedEvent(hDBEvent: THANDLE):boolean;
+begin
+ CheckRecent(hDBEvent);
+ result:=(RecentEventInfo.flags and DBEF_READ) <> 0;
+end;
+
+//----- Not pure miranda functions -----
+
+type
+ TEventTableItem = record
+ EventType : Word;
+ MessageType : TBaseEventType;
+ end;
+
+var
+ BuiltinEventTable: array[0..6] of TEventTableItem = (
+ // must be the first item in array for unknown events
+ (EventType: MaxWord; MessageType: mtOther),
+ // events definitions
+ (EventType: EVENTTYPE_MESSAGE; MessageType: mtMessage),
+ (EventType: EVENTTYPE_FILE; MessageType: mtFile),
+ (EventType: EVENTTYPE_URL; MessageType: mtUrl),
+ (EventType: EVENTTYPE_AUTHREQUEST; MessageType: mtSystem),
+ (EventType: EVENTTYPE_ADDED; MessageType: mtSystem),
+ (EventType: EVENTTYPE_CONTACTS; MessageType: mtContacts)
+ );
+
+function GetEventBaseType(EventInfo: TDBEventInfo): TBaseEventType;
+var
+ i: Integer;
+ EventIndex: Integer;
+begin
+ EventIndex := 0;
+
+ if EventInfo.szModule = nil then
+ begin
+ for i := 1 to High(BuiltinEventTable) do
+ if BuiltinEventTable[i].EventType = EventInfo.EventType then
+ begin
+ EventIndex := i;
+ break;
+ end;
+ end;
+
+ Result := BuiltinEventTable[EventIndex].MessageType;
+end;
+
+function GetEventBaseType(hDBEvent: THANDLE): TBaseEventType;
+begin
+ CheckRecent(hDBEvent);
+ Result := GetEventBaseType(RecentEventInfo);
+end;
+
+//----- Custom events processing -----
+
+
+function _WideCharType(WC: WideChar; dwInfoType: Cardinal): Word;
+begin
+ GetStringTypeExW(GetThreadLocale, dwInfoType, PWideChar(@WC), 1, Result)
+end;
+
+function IsWideCharAlphaNumeric(WC: WideChar): Boolean;
+begin
+ Result := (_WideCharType(WC, CT_CTYPE1) and (C1_ALPHA + C1_DIGIT)) <> 0;
+end;
+
+const
+ UrlPrefix: array[0..1] of pWideChar = (
+ 'www.',
+ 'ftp.');
+
+const
+ UrlProto: array[0..12] of record
+ Proto: PWideChar;
+ Idn : Boolean;
+ end = (
+ (Proto: 'http:/'; Idn: True;),
+ (Proto: 'ftp:/'; Idn: True;),
+ (Proto: 'file:/'; Idn: False;),
+ (Proto: 'mailto:/'; Idn: False;),
+ (Proto: 'https:/'; Idn: True;),
+ (Proto: 'gopher:/'; Idn: False;),
+ (Proto: 'nntp:/'; Idn: False;),
+ (Proto: 'prospero:/'; Idn: False;),
+ (Proto: 'telnet:/'; Idn: False;),
+ (Proto: 'news:/'; Idn: False;),
+ (Proto: 'wais:/'; Idn: False;),
+ (Proto: 'outlook:/'; Idn: False;),
+ (Proto: 'callto:/'; Idn: False;));
+
+function TextHasUrls(Text: pWideChar): Boolean;
+var
+ i,len: Integer;
+ buf,pPos: PWideChar;
+begin
+ Result := False;
+ len := StrLenW(Text);
+ if len=0 then exit;
+
+ // search in URL Prefixes like "www"
+ // make Case-insensitive??
+
+ for i := 0 to High(UrlPrefix) do
+ begin
+ pPos := StrPosW(Text, UrlPrefix[i]);
+ if not Assigned(pPos) then
+ continue;
+ Result := ((uint_ptr(pPos) = uint_ptr(Text)) or not IsWideCharAlphaNumeric((pPos - 1)^)) and
+ IsWideCharAlphaNumeric((pPos + StrLenW(UrlPrefix[i]))^);
+ if Result then
+ exit;
+ end;
+
+ // search in url protos like "http:/"
+
+ if StrPosW(Text,':/') = nil then exit;
+
+ StrDupW(buf,Text);
+
+ CharLowerBuffW(buf,len);
+ for i := 0 to High(UrlProto) do
+ begin
+ pPos := StrPosW(buf, UrlProto[i].proto);
+ if not Assigned(pPos) then
+ continue;
+ Result := ((uint_ptr(pPos) = uint_ptr(buf)) or
+ not IsWideCharAlphaNumeric((pPos - 1)^));
+ if Result then
+ break;
+ end;
+ mFreeMem(buf);
+end;
+
+
+// reads event from hDbEvent handle
+// reads all THistoryItem fields
+// *EXCEPT* Proto field. Fill it manually, plz
+(*
+procedure ReadEvent(hDBEvent: THANDLE; var hi: THistoryItem; UseCP: Cardinal = CP_ACP);
+var
+ EventInfo: TDBEventInfo;
+ EventIndex: integer;
+ Handled: Boolean;
+begin
+ ZeroMemory(@hi,SizeOf(hi));
+ hi.Height := -1;
+ GetEventInfo(hDBEvent, EventInfo);
+
+ hi.Module := EventInfo.szModule; {*}
+ hi.proto := nil;
+ hi.Time := EventInfo.Timestamp; {*}
+ hi.IsRead := Boolean(EventInfo.flags and DBEF_READ); {*}
+ hi.MessageType := GetMessageType(EventInfo, EventIndex); {!}
+ hi.CodePage := UseCP; {?}
+ // enable autoRTL feature
+ if Boolean(EventInfo.flags and DBEF_RTL) then
+ hi.RTLMode := hppRTLEnable; {*}
+
+ hi.Text := GetEventCoreText(EventInfo, UseCP);
+{!!
+ if hi.Text = nil then
+ EventTable[EventIndex].TextFunction(EventInfo, hi);
+}
+ hi.Text := AdjustLineBreaks(hi.Text);
+ hi.Text := rtrimw(hi.Text);
+
+ if hi.MessageType.code=mtMessage then
+ if TextHasUrls(hi.Text) then
+ begin
+ hi.MessageType.code:=mtUrl;
+ end;
+
+ mFreeMem(EventInfo.pBlob);
+end;
+*)
+(*
+function GetEventName(const Hi: THistoryItem):pAnsiChar;
+var
+ MesType: THppMessageType;
+ mt: TBuiltinMessageType;
+ etd: PDBEVENTTYPEDESCR;
+begin
+ MesType := Hi.MessageType;
+ for mt := Low(BuiltinEventNames) to High(BuiltinEventNames) do
+ begin
+ if MesType.code = mt then
+ begin
+ Result := BuiltinEventNames[mt];
+ exit;
+ end;
+ end;
+
+ etd := Pointer(CallService(MS_DB_EVENT_GETTYPE, WPARAM(Hi.Module), LPARAM(Hi.MessageType.event)));
+ if etd = nil then
+ begin
+ Result := BuiltinEventNames[mtOther];
+ end
+ else
+ Result := etd.descr;
+
+end;
+*)
+
+type
+ TCustomEvent = record
+ Module : PAnsiChar;
+ EventType : Word;
+ MessageType : TBaseEventType;
+ end;
+const
+ CustomEventTable: array [0..4] of TCustomEvent = (
+ (Module:'WATrack' ; EventType:EVENTTYPE_WAT_REQUEST {; MessageType:}),
+ (Module:'WATrack' ; EventType:EVENTTYPE_WAT_ANSWER {; MessageType:}),
+ (Module:'WATrack' ; EventType:EVENTTYPE_WAT_MESSAGE {; MessageType:}),
+ (Module:'NewStatusNotify'; EventType:EVENTTYPE_STATUSCHANGE {; MessageType:}),
+ (Module:'Nudge' ; EventType:1 {; MessageType:})
+// (Module:nil; EventType:EVENTTYPE_AVATAR_CHANGE {; MessageType:}),
+// (Module:nil; EventType:ICQEVENTTYPE_MISSEDMESSAGE {; MessageType:}), ICQ_DB_GETEVENTTEXT_MISSEDMESSAGE
+// (Module:nil; EventType:ICQEVENTTYPE_EMAILEXPRESS {; MessageType:}),
+// (Module:nil; EventType:ICQEVENTTYPE_WEBPAGER {; MessageType:}),
+// (Module:nil; EventType:EVENTTYPE_SMS {; MessageType:}),
+// (Module:nil; EventType:EVENTTYPE_SMSCONFIRMATION {; MessageType:}),
+// (Module:nil; EventType:TWITTER_DB_EVENT_TYPE_TWEET {; MessageType:}),
+ );
+
+//----- Support functions -----
+
+//----- Custom standard event text -----
+
+function GetEventTextForUrl(const EventInfo: TDBEventInfo):PWideChar;
+var
+ pc:PAnsiChar;
+ len,lend,lenf:integer;
+
+ url,desc: PAnsiChar;
+ urlw: PWideChar;
+// cp: Cardinal;
+begin
+ //blob is: URL(ASCII) or URL(ASCIIZ),description(ASCIIZ)
+ len := StrLen(PAnsiChar(EventInfo.pBlob));
+ if (integer(EventInfo.cbBlob)-len)>2 then // possible have description
+ begin
+ desc := PAnsiChar(EventInfo.pBlob) + len + 1;
+ lend := StrLen(desc);
+ end
+ else
+ begin
+ desc := nil;
+ lend := 0;
+ end;
+
+ lenf := len;
+ if lend > 0 then
+ inc(lenf, lend + 2 + 1); // #13#10 + #0
+ mGetMem(url, lenf);
+ pc := StrCopyE(url, PAnsiChar(EventInfo.pBlob));
+ if lend > 0 then
+ begin
+ pc^ := #13; inc(pc);
+ pc^ := #10; inc(pc);
+ StrCopy(pc,desc);
+ end;
+
+ if (EventInfo.flags and DBEF_UTF)<>0 then
+ UTF8ToWide(url,urlw)
+ else
+ AnsiToWide(url,urlw); // with proper codepage must be
+ mFreeMem(url);
+ result := FormatStrW('URL: %s', [urlw]);
+ mFreeMem(urlw);
+// hi.Extended := PAnsiChar(EventInfo.pBlob);
+end;
+
+function GetEventTextForFile(const EventInfo: TDBEventInfo):PWideChar;
+var
+ pc,filea,fname,desc:PAnsiChar;
+ format, filew:PWideChar;
+ len:integer;
+// cp: Cardinal;
+begin
+ //blob is: sequenceid(DWORD),filename(ASCIIZ),description(ASCIIZ)
+ fname:=PAnsiChar(EventInfo.pBlob) + SizeOf(DWORD);
+ len :=StrLen(fname);
+ desc :=fname + len + 1;
+ if desc^ <> #0 then
+ inc(len, 2 + StrLen(desc)); // +#13#10
+ mGetMem(filea, len + 1); // +#0
+ pc := StrCopyE(filea, fname);
+ if desc^ <> #0 then
+ begin
+ pc^ := #13; inc(pc);
+ pc^ := #10; inc(pc);
+ StrCopy(pc,desc);
+ end;
+
+ if (EventInfo.flags and DBEF_SENT) <> 0 then
+ format := 'Outgoing file transfer: %s'
+ else
+ format := 'Incoming file transfer: %s';
+
+ if (EventInfo.flags and DBEF_UTF)<>0 then
+ UTF8ToWide(filea,filew)
+ else
+ AnsiToWide(filea,filew); // with proper codepage must be
+ mFreeMem(filea);
+ result := FormatStrW(format, [filew]);
+ mFreeMem(filew);
+// Hi.Extended := PAnsiChar(EventInfo.pBlob) + SizeOf(DWORD);
+end;
+
+
+function GetEventText(const EventInfo: TDBEventInfo; custom:boolean; cp:integer=CP_ACP):PWideChar;
+begin
+ result:=nil;
+ if not custom then
+ begin
+ result:=GetEventCoreText(EventInfo);
+ // ok if registered with text service
+ // ok if have text in blob
+ end;
+ if (result = nil) or custom then
+ begin
+ end;
+end;
+
+function GetEventText(hDBEvent: THANDLE; custom:boolean; cp:integer=CP_ACP):PWideChar;
+var
+ EventInfo: TDBEventInfo;
+begin
+ GetEventInfo(hDBEvent, EventInfo);
+ result:=GetEventText(EventInfo, custom);
+end;
+
+function GetStandardEventIcon(const EventInfo: TDBEventInfo):HICON;
+var
+ idx:integer;
+begin
+ case GetEventBaseType(EventInfo) of
+ mtMessage : idx:=SKINICON_EVENT_MESSAGE;
+ mtUrl : idx:=SKINICON_EVENT_URL;
+ mtFile : idx:=SKINICON_EVENT_FILE;
+// mtSystem : idx:=;
+// mtContacts: idx:=;
+ mtStatus : begin
+ result:=0;
+ exit;
+ end;
+ else
+ idx:=0;
+ end;
+ result:=CallService(MS_SKIN_LOADICON,idx,0);
+{
+ case EventInfo.eventType of
+ EVENTTYPE_MESSAGE: idx:=SKINICON_EVENT_MESSAGE;
+ EVENTTYPE_FILE: idx:=SKINICON_EVENT_FILE;
+ EVENTTYPE_URL: idx:=SKINICON_EVENT_URL;
+ EVENTTYPE_AUTHREQUEST: idx:=SKINICON_AUTH_REQUEST;
+ EVENTTYPE_ADDED: idx:=SKINICON_AUTH_ADD;
+ EVENTTYPE_CONTACTS: idx:=
+ EVENTTYPE_SMS: idx:=SKINICON_OTHER_SMS;
+ else
+ end;
+}
+end;
+
+end.
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index 918f615390..976ee5bca1 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -35,26 +35,6 @@ function ParseVarString(astr:pAnsiChar;aContact:TMCONTACT=0;extra:pAnsiChar=nil)
function ParseVarString(astr:pWideChar;aContact:TMCONTACT=0;extra:pWideChar=nil):pWideChar; overload;
function ShowVarHelp(dlg:HWND;id:integer=0):integer;
-function IsChat(hContact:TMCONTACT):bool;
-procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
-
-function LoadContact(group,setting:PAnsiChar):TMCONTACT;
-function SaveContact(hContact:TMCONTACT;group,setting:PAnsiChar):integer;
-
-function SetCListSelContact(hContact:TMCONTACT):TMCONTACT;
-function GetCListSelContact:TMCONTACT; {$IFDEF DELPHI_10_UP}inline;{$ENDIF}
-function GetContactProtoAcc(hContact:TMCONTACT):PAnsiChar;
-function IsMirandaUser(hContact:TMCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
-procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true);
-function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):TMCONTACT;
-function WndToContact(wnd:HWND):TMCONTACT; overload;
-function WndToContact:TMCONTACT; overload;
-function GetContactStatus(hContact:TMCONTACT):integer;
-// -2 - deleted account, -1 - disabled account, 0 - hidden
-// 1 - metacontact, 2 - submetacontact, positive - active
-// proto - ASSIGNED buffer
-function IsContactActive(hContact:TMCONTACT;proto:pAnsiChar=nil):integer;
-
function CreateGroupW(name:pWideChar;hContact:TMCONTACT):integer;
function MakeGroupMenu(idxfrom:integer=100):HMENU;
@@ -79,7 +59,7 @@ implementation
uses
Messages,
dbsettings,freeimage,
- common,io,syswin;
+ common,io;
const
clGroup = 'Group';
@@ -165,13 +145,6 @@ begin
result:=MirCP;
end;
-function IsChat(hContact:TMCONTACT):bool;
-begin
- result:=DBReadByte(hContact,
- PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),
- 'ChatRoom',0)=1;
-end;
-
function isVarsInstalled:bool;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
@@ -306,168 +279,6 @@ begin
end;
end;
-function GetContactProtoAcc(hContact:TMCONTACT):PAnsiChar;
-begin
- if ServiceExists(MS_PROTO_GETCONTACTBASEACCOUNT)<>0 then
- result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEACCOUNT,hContact,0))
- else
- result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
-end;
-
-function IsMirandaUser(hContact:TMCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
-var
- sz:PAnsiChar;
-begin
- sz:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
- sz:=DBReadString(hContact,sz,'MirVer');
- if sz<>nil then
- begin
- result:=int_ptr(StrPos(sz,'Miranda'));
- mFreeMem(sz);
- end
- else
- result:=-1;
-end;
-
-function SetCListSelContact(hContact:TMCONTACT):TMCONTACT;
-var
- wnd:HWND;
-begin
- wnd:=CallService(MS_CLUI_GETHWNDTREE,0,0);
- result:=hContact;
-// hContact:=SendMessage(wnd,CLM_FINDCONTACT ,hContact,0);
- SendMessage(wnd,CLM_SELECTITEM ,hContact,0);
-// SendMessage(wnd,CLM_ENSUREVISIBLE,hContact,0);
-end;
-
-function GetCListSelContact:TMCONTACT;
-begin
- result:=SendMessageW(CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETSELECTION,0,0);
-end;
-
-function LoadContact(group,setting:PAnsiChar):TMCONTACT;
-var
- p,proto:pAnsiChar;
- section:array [0..63] of AnsiChar;
- dbv:TDBVARIANT;
- is_chat:boolean;
-begin
- p:=StrCopyE(section,setting);
- StrCopy(p,opt_cproto); proto :=DBReadString(0,group,section);
- StrCopy(p,opt_ischat); is_chat:=DBReadByte (0,group,section,0)<>0;
- StrCopy(p,opt_cuid );
- if is_chat then
- dbv.szVal.W:=DBReadUnicode(0,group,section,@dbv)
- else
- DBReadSetting(0,group,section,@dbv);
-
- result:=FindContactHandle(proto,dbv,is_chat);
-
- mFreeMem(proto);
- if not is_chat then
- DBFreeVariant(@dbv)
- else
- mFreeMem(dbv.szVal.W);
-end;
-
-function SaveContact(hContact:TMCONTACT;group,setting:PAnsiChar):integer;
-var
- p,proto,uid:pAnsiChar;
- cws:TDBVARIANT;
- section:array [0..63] of AnsiChar;
- pw:pWideChar;
- is_chat:boolean;
-begin
- result:=0;
- proto:=GetContactProtoAcc(hContact);
- if proto<>nil then
- begin
- p:=StrCopyE(section,setting);
- is_chat:=IsChat(hContact);
- if is_chat then
- begin
- pw:=DBReadUnicode(hContact,proto,'ChatRoomID');
- StrCopy(p,opt_cuid); DBWriteUnicode(0,group,section,pw);
- mFreeMem(pw);
- result:=1;
- end
- else
- begin
- uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid<>pAnsiChar(CALLSERVICE_NOTFOUND) then
- begin
- if DBReadSetting(hContact,proto,uid,@cws)=0 then
- begin
- StrCopy(p,opt_cuid); DBWriteSetting(0,group,section,@cws);
- DBFreeVariant(@cws);
- result:=1;
- end;
- end;
- end;
- if result<>0 then
- begin
- StrCopy(p,opt_cproto); DBWriteString(0,group,section,proto);
- StrCopy(p,opt_ischat); DBWriteByte (0,group,section,ord(is_chat));
- end;
- end;
-end;
-
-function WndToContact(wnd:HWND):TMCONTACT; overload;
-var
- hContact:TMCONTACT;
- mwid:TMessageWindowInputData;
- mwod:TMessageWindowOutputData;
-begin
- wnd:=GetParent(wnd); //!!
- hContact:=db_find_first();
- with mwid do
- begin
- cbSize:=SizeOf(mwid);
- uFlags:=MSG_WINDOW_UFLAG_MSG_BOTH;
- end;
- mwod.cbSize:=SizeOf(mwod);
- while hContact<>0 do
- begin
- mwid.hContact:=hContact;
- if CallService(MS_MSG_GETWINDOWDATA,wparam(@mwid),lparam(@mwod))=0 then
- begin
- if {((mwod.uState and MSG_WINDOW_STATE_FOCUS)<>0) and} (mwod.hwndWindow=wnd) then
- begin
- result:=mwid.hContact;
- exit;
- end
- end;
- hContact:=db_find_next(hContact);
- end;
- result:=0;
-end;
-
-function WndToContact:TMCONTACT; overload;
-var
- wnd:HWND;
-begin
- wnd:=GetFocus;
- if wnd=0 then
- wnd:=WaitFocusedWndChild(GetForegroundWindow);
- if wnd<>0 then
- result:=WndToContact(wnd)
- else
- result:=0;
- if result=0 then
- result:=GetCListSelContact;
-end;
-
-function GetContactStatus(hContact:TMCONTACT):integer;
-var
- szProto:PAnsiChar;
-begin
- szProto:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
- if szProto=NIL then
- result:=ID_STATUS_OFFLINE
- else
- result:=DBReadWord(hContact,szProto,'Status',ID_STATUS_OFFLINE);
-end;
-
function CheckPath(filename,profilepath,path:PAnsiChar):PAnsiChar;
var
buf:array [0..511] of AnsiChar;
@@ -547,188 +358,6 @@ begin
end;
end;
-procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true);
-var
- pc:array [0..127] of AnsiChar;
-begin
-{
-CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0);
-}
- if (hContact<>0) and (CallService(MS_DB_CONTACT_IS,hContact,0)<>0) then
- begin
- if StrCopy(pc,PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)))<>nil then
- if DblClk or (DBReadByte(hContact,pc,'ChatRoom',0)=1) then // chat room
- begin
- if not anystatus then
- begin
- StrCat(pc,PS_GETSTATUS);
- anystatus:=(CallService(pc,0,0)<>ID_STATUS_OFFLINE);
- end;
- if anystatus then
- begin
- CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0); //??
- // if chat exist, open chat
- // else create new session
- end;
- end
- else
- begin
- if ServiceExists(MS_MSG_CONVERS)<>0 then // Convers compat.
- CallService(MS_MSG_CONVERS,hContact,0)
- else
- CallService(MS_MSG_SENDMESSAGE,hContact,0)
- end;
- end;
-end;
-
-procedure SendChatText(pszID:pointer;pszModule:PAnsiChar;pszText:pointer);
-var
- gcd:TGCDEST;
- gce:TGCEVENT;
-begin
- gcd.pszModule:=pszModule;
- gcd.iType :=GC_EVENT_SENDMESSAGE;
- gcd.szID.w :=pszID;
-
- FillChar(gce,SizeOf(TGCEVENT),0);
- gce.cbSize :=SizeOf(TGCEVENT);
- gce.pDest :=@gcd;
- gce.bIsMe :=true;
- gce.szText.w:=pszText;
- gce.dwFlags :=GCEF_ADDTOLOG;
- gce.time :=GetCurrentTime;
-
- CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
-end;
-
-procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
-var
- gci:TGC_INFO;
- pszModule:PAnsiChar;
- i,cnt:integer;
-begin
- pszModule:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
- cnt:=CallService(MS_GC_GETSESSIONCOUNT,0,lparam(pszModule));
- i:=0;
- gci.pszModule:=pszModule;
- while i<cnt do
- begin
- gci.iItem:=i;
- gci.Flags:=GCF_BYINDEX+GCF_HCONTACT+GCF_ID;
- CallService(MS_GC_GETINFO,0,lparam(@gci));
- if gci.hContact=hContact then
- begin
- SendChatText(gci.pszID.w,pszModule,pszText);
- break;
- end;
- inc(i);
- end;
-end;
-
-function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):TMCONTACT;
-var
- uid:pAnsiChar;
- ldbv:TDBVARIANT;
- hContact:TMCONTACT;
- pw:pWideChar;
-begin
- result:=0;
- uid:=nil;
- if not is_chat then
- begin
- uid:=pAnsiChar(CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0));
- if uid=pAnsiChar(CALLSERVICE_NOTFOUND) then exit;
- end;
-
- hContact:=db_find_first();
- while hContact<>0 do
- begin
- if is_chat then
- begin
- if IsChat(hContact) then
- begin
- pw:=DBReadUnicode(hContact,proto,'ChatRoomID');
- if StrCmpW(pw,dbv.szVal.W)=0 then result:=hContact;
- mFreeMem(pw);
- end
- end
- else
- begin
- if DBReadSetting(hContact,proto,uid,@ldbv)=0 then
- begin
- if dbv._type=ldbv._type then
- begin
- case dbv._type of
-// DBVT_DELETED: ;
- DBVT_BYTE : if dbv.bVal=ldbv.bVal then result:=hContact;
- DBVT_WORD : if dbv.wVal=ldbv.wVal then result:=hContact;
- DBVT_DWORD : if dbv.dVal=ldbv.dVal then result:=hContact;
- DBVT_UTF8,
- DBVT_ASCIIZ : if StrCmp (dbv.szVal.A,ldbv.szVal.A)=0 then result:=hContact;
- DBVT_WCHAR : if StrCmpW(dbv.szVal.W,ldbv.szVal.W)=0 then result:=hContact;
- DBVT_BLOB : begin
- if dbv.cpbVal = ldbv.cpbVal then
- begin
- if CompareMem(dbv.pbVal,ldbv.pbVal,dbv.cpbVal) then
- result:=hContact;
- end;
- end;
- end;
- end;
- DBFreeVariant(@ldbv);
- end;
- end;
- // added 2011.04.20
- if result<>0 then break;
- hContact:=db_find_next(hContact);
- end;
-end;
-
-function IsContactActive(hContact:TMCONTACT;proto:pAnsiChar=nil):integer;
-var
- p:PPROTOACCOUNT;
- name: array [0..31] of AnsiChar;
-begin
-
- if db_get_static(hContact,'Protocol','p',@name,SizeOf(name))=0 then
- begin
- result:=0;
-
- if ServiceExists(MS_PROTO_GETACCOUNT)<>0 then
- begin
- p:=PPROTOACCOUNT(CallService(MS_PROTO_GETACCOUNT,0,lparam(@name)));
- if p=nil then
- result:=-2 // deleted
- else if (not p^.bIsEnabled) or p^.bDynDisabled then
- result:=-1; // disabled
- end
- else
- begin
- if CallService(MS_PROTO_ISPROTOCOLLOADED,0,lparam(@name))=0 then
- result:=-1;
- end;
-
- if (result=0) and (DBReadByte(hContact,strCList,'Hidden',0)=0) then
- begin
- result:=255;
- if db_mc_getMeta(hContact)<>0 then
- result:=2;
- if StrCmp(
- PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),
- META_PROTO)=0 then
- result:=1;
- end;
- if proto<>nil then
- StrCopy(proto,@name);
- end
- else
- begin
- result:=-2;
- if proto<>nil then
- proto^:=#0;
- end;
-end;
-
// Import plugin function adaptation
function CreateGroupW(name:pWideChar;hContact:TMCONTACT):integer;
var
diff --git a/plugins/Utils.pas/rtfole.pas b/plugins/Utils.pas/rtfole.pas
new file mode 100644
index 0000000000..1e646f53c1
--- /dev/null
+++ b/plugins/Utils.pas/rtfole.pas
@@ -0,0 +1,560 @@
+unit rtfole;
+
+interface
+
+uses
+ Windows, RichEdit, ActiveX,
+ tlb_richedit;
+
+const
+ IID_IOleObject : TGUID = '{00000112-0000-0000-C000-000000000046}';
+ IID_IRichEditOle : TGUID = '{00020D00-0000-0000-C000-000000000046}';
+ IID_IRichEditOleCallback: TGUID = '{00020D03-0000-0000-C000-000000000046}';
+
+type
+ TReObject = packed record
+ cbStruct: DWORD; // Size of structure
+ cp : Integer; // Character position of object
+ clsid : TCLSID; // Class ID of object
+ poleobj : IOleObject; // OLE object interface
+ pstg : IStorage; // Associated storage interface
+ polesite: IOLEClientSite; // Associated client site interface
+ sizel : TSize; // Size of object (may be 0,0)
+ dvaspect: DWORD; // Display aspect to use
+ dwFlags : DWORD; // Object status flags
+ dwUser : DWORD; // Dword for user's use
+ end;
+
+const
+ // Flags to specify which interfaces should be returned in the structure above
+ REO_GETOBJ_NO_INTERFACES = $00000000;
+ REO_GETOBJ_POLEOBJ = $00000001;
+ REO_GETOBJ_PSTG = $00000002;
+ REO_GETOBJ_POLESITE = $00000004;
+ REO_GETOBJ_ALL_INTERFACES = $00000007;
+
+ // Place object at selection
+ REO_CP_SELECTION = ULONG(-1);
+
+ // Use character position to specify object instead of index
+ REO_IOB_SELECTION = ULONG(-1);
+ REO_IOB_USE_CP = ULONG(-1);
+
+ // Object flags
+ REO_NULL = $00000000; // No flags
+ REO_READWRITEMASK = $0000003F; // Mask out RO bits
+ REO_DONTNEEDPALETTE = $00000020; // Object doesn't need palette
+ REO_BLANK = $00000010; // Object is blank
+ REO_DYNAMICSIZE = $00000008; // Object defines size always
+ REO_INVERTEDSELECT = $00000004; // Object drawn all inverted if sel
+ REO_BELOWBASELINE = $00000002; // Object sits below the baseline
+ REO_RESIZABLE = $00000001; // Object may be resized
+ REO_LINK = $80000000; // Object is a link (RO)
+ REO_STATIC = $40000000; // Object is static (RO)
+ REO_SELECTED = $08000000; // Object selected (RO)
+ REO_OPEN = $04000000; // Object open in its server (RO)
+ REO_INPLACEACTIVE = $02000000; // Object in place active (RO)
+ REO_HILITED = $01000000; // Object is to be hilited (RO)
+ REO_LINKAVAILABLE = $00800000; // Link believed available (RO)
+ REO_GETMETAFILE = $00400000; // Object requires metafile (RO)
+
+ // flags for IRichEditOle::GetClipboardData(),
+ // IRichEditOleCallback::GetClipboardData() and
+ // IRichEditOleCallback::QueryAcceptData()
+ RECO_PASTE = $00000000; // paste from clipboard
+ RECO_DROP = $00000001; // drop
+ RECO_COPY = $00000002; // copy to the clipboard
+ RECO_CUT = $00000003; // cut to the clipboard
+ RECO_DRAG = $00000004; // drag
+
+type
+ TImageDataObject = class(TInterfacedObject,IDataObject)
+ private
+ FBmp:hBitmap;
+ FMedium:TStgMedium;
+ FFormatEtc: TFormatEtc;
+ procedure SetBitmap(bmp:hBitmap);
+ function GetOleObject(OleClientSite:IOleClientSite; Storage:IStorage):IOleObject;
+ // IDataObject
+ function GetData(const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult; stdcall;
+ function GetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium): HResult; stdcall;
+ function QueryGetData(const formatetc: TFormatEtc): HResult; stdcall;
+ function GetCanonicalFormatEtc(const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult; stdcall;
+{$IFDEF FPC}
+ function SetData(const formatetc: TFormatEtc; const medium: TStgMedium; fRelease: BOOL): HResult; stdcall;
+ function EnumFormatEtc(dwDirection: dword; out enumFormatEtc: IEnumFormatEtc): HResult; stdcall;
+ function DAdvise(const formatetc: TFormatEtc; advf: dword; const advSink: IAdviseSink; out dwConnection: dword): HResult; stdcall;
+ function DUnadvise(dwConnection: dword): HResult; stdcall;
+{$ELSE}
+ function SetData(const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult; stdcall;
+ function EnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult; stdcall;
+ function DAdvise(const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult; stdcall;
+ function DUnadvise(dwConnection: Longint): HResult; stdcall;
+{$ENDIF}
+ function EnumDAdvise(out enumAdvise: IEnumStatData): HResult; stdcall;
+ public
+ destructor Destroy; override;
+ function InsertBitmap(Wnd: HWND; Bitmap: hBitmap; cp: Cardinal): Boolean;
+ end;
+
+ IRichEditOle = interface(IUnknown)
+ ['{00020d00-0000-0000-c000-000000000046}']
+ function GetClientSite(out clientSite: IOleClientSite): HResult; stdcall;
+ function GetObjectCount: HResult; stdcall;
+ function GetLinkCount: HResult; stdcall;
+ function GetObject(iob: Longint; out ReObject: TReObject; dwFlags: DWORD): HResult; stdcall;
+ function InsertObject(var ReObject: TReObject): HResult; stdcall;
+ function ConvertObject(iob: Longint; rclsidNew: TIID; lpstrUserTypeNew: LPCSTR): HResult; stdcall;
+ function ActivateAs(rclsid: TIID; rclsidAs: TIID): HResult; stdcall;
+ function SetHostNames(lpstrContainerApp: LPCSTR; lpstrContainerObj: LPCSTR): HResult; stdcall;
+ function SetLinkAvailable(iob: Longint; fAvailable: BOOL): HResult; stdcall;
+ function SetDvaspect(iob: Longint; dvaspect: DWORD): HResult; stdcall;
+ function HandsOffStorage(iob: Longint): HResult; stdcall;
+ function SaveCompleted(iob: Longint; const stg: IStorage): HResult; stdcall;
+ function InPlaceDeactivate: HResult; stdcall;
+ function ContextSensitiveHelp(fEnterMode: BOOL): HResult; stdcall;
+ function GetClipboardData(var chrg: TCharRange; reco: DWORD; out dataobj: IDataObject): HResult; stdcall;
+ function ImportDataObject(dataobj: IDataObject; cf: TClipFormat; hMetaPict: HGLOBAL): HResult; stdcall;
+ end;
+
+ IRichEditOleCallback = interface(IUnknown)
+ ['{00020d03-0000-0000-c000-000000000046}']
+ function GetNewStorage(out stg: IStorage): HResult; stdcall;
+ function GetInPlaceContext(out Frame: IOleInPlaceFrame; out Doc: IOleInPlaceUIWindow; lpFrameInfo: POleInPlaceFrameInfo): HResult; stdcall;
+ function ShowContainerUI(fShow: BOOL): HResult; stdcall;
+ function QueryInsertObject(const clsid: TCLSID; const stg: IStorage; cp: Longint): HResult; stdcall;
+ function DeleteObject(const oleobj: IOleObject): HResult; stdcall;
+ function QueryAcceptData(const dataobj: IDataObject; var cfFormat: TClipFormat; reco: DWORD; fReally: BOOL; hMetaPict: HGLOBAL): HResult; stdcall;
+ function ContextSensitiveHelp(fEnterMode: BOOL): HResult; stdcall;
+ function GetClipboardData(const chrg: TCharRange; reco: DWORD; out dataobj: IDataObject): HResult; stdcall;
+ function GetDragDropEffect(fDrag: BOOL; grfKeyState: DWORD; var dwEffect: DWORD): HResult; stdcall;
+ function GetContextMenu(seltype: Word; const oleobj: IOleObject; const chrg: TCharRange; out menu: HMENU): HResult; stdcall;
+ end;
+
+ TRichEditOleCallback = class(TObject, IUnknown, IRichEditOleCallback)
+ private
+ FRefCount: Longint;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ function QueryInterface(
+ {$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} iid: TGUID; out Obj): HResult; stdcall;
+ function _AddRef: Longint; stdcall;
+ function _Release: Longint; stdcall;
+
+ function GetNewStorage(out stg: IStorage): HResult; stdcall;
+ function GetInPlaceContext(out Frame: IOleInPlaceFrame; out Doc: IOleInPlaceUIWindow; lpFrameInfo: POleInPlaceFrameInfo): HResult; stdcall;
+ function GetClipboardData(const chrg: TCharRange; reco: DWORD; out dataobj: IDataObject): HResult; stdcall;
+ function GetContextMenu(seltype: Word; const oleobj: IOleObject; const chrg: TCharRange; out menu: HMENU): HResult; stdcall;
+ function ShowContainerUI(fShow: BOOL): HResult; stdcall;
+ function QueryInsertObject(const clsid: TCLSID; const stg: IStorage; cp: Longint): HResult; stdcall;
+ function DeleteObject(const oleobj: IOleObject): HResult; stdcall;
+ function QueryAcceptData(const dataobj: IDataObject; var cfFormat: TClipFormat; reco: DWORD; fReally: BOOL; hMetaPict: HGLOBAL): HResult; stdcall;
+ function ContextSensitiveHelp(fEnterMode: BOOL): HResult; stdcall;
+ function GetDragDropEffect(fDrag: BOOL; grfKeyState: DWORD; var dwEffect: DWORD): HResult; stdcall;
+ end;
+
+function RichEdit_SetOleCallback(Wnd: HWND; const Intf: IRichEditOleCallback): Boolean;
+function RichEdit_GetOleInterface(Wnd: HWND; out Intf: IRichEditOle): Boolean;
+function RichEdit_InsertBitmap(Wnd: HWND; Bitmap: hBitmap; cp: Cardinal): Boolean;
+
+procedure OleCheck(OleResult: HResult);
+procedure ReleaseObject(var Obj);
+
+procedure InitRichEditLibrary;
+
+const
+ RichEditClass:pAnsiChar = nil;
+
+implementation
+
+{
+type
+ EOleError = class(Exception);
+
+const
+ SOleError = 'OLE2 error occured. Error code: %.8xH';
+}
+{ OLE Specific }
+
+function FailedHR(hr: HResult): Boolean;
+begin
+ Result := Failed(hr);
+end;
+
+function OleErrorMsg(ErrorCode: HResult): String;
+begin
+ Result:='';
+//!! FmtStr(Result, SOleError, [Longint(ErrorCode)]);
+end;
+
+procedure OleError(ErrorCode: HResult);
+begin
+//!! raise EOleError.Create(OleErrorMsg(ErrorCode));
+end;
+
+procedure OleCheck(OleResult: HResult);
+begin
+ if FailedHR(OleResult) then OleError(OleResult);
+// if not Succeeded(OleResult) then OleError(OleResult);
+end;
+
+procedure ReleaseObject(var Obj);
+begin
+ if IUnknown(Obj) <> nil then IUnknown(Obj) := nil;
+end;
+
+procedure CreateStorage(var Storage: IStorage);
+var
+ LockBytes: ILockBytes;
+begin
+ OleCheck(CreateILockBytesOnHGlobal(0, True, LockBytes));
+ try
+ OleCheck(StgCreateDocfileOnILockBytes(LockBytes,
+ STGM_READWRITE or STGM_SHARE_EXCLUSIVE or STGM_CREATE, 0, Storage));
+ finally
+ ReleaseObject(LockBytes);
+ end;
+end;
+
+{ TRichEditOleCallback }
+
+constructor TRichEditOleCallback.Create;
+begin
+ inherited Create;
+end;
+
+destructor TRichEditOleCallback.Destroy;
+begin
+ inherited Destroy;
+end;
+
+function TRichEditOleCallback.QueryInterface(
+{$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} iid: TGUID; out Obj): HResult; stdcall;
+begin
+ if GetInterface(iid, Obj) then
+ Result := S_OK
+ else
+ Result := E_NOINTERFACE;
+end;
+
+function TRichEditOleCallback._AddRef: Longint;
+begin
+ Inc(FRefCount);
+ Result := FRefCount;
+end;
+
+function TRichEditOleCallback._Release: Longint;
+begin
+ Dec(FRefCount);
+ Result := FRefCount;
+end;
+
+function TRichEditOleCallback.GetNewStorage(out stg: IStorage): HResult;
+begin
+ try
+ CreateStorage(stg);
+ Result := S_OK;
+ except
+ Result:= E_OUTOFMEMORY;
+ end;
+{
+ OleCheck(CreateILockBytesOnHGlobal(0, True, LockBytes));
+ OleCheck(StgCreateDocfileOnILockBytes(LockBytes,
+ STGM_READWRITE or STGM_SHARE_EXCLUSIVE or STGM_CREATE, 0, Result));
+}
+end;
+
+function TRichEditOleCallback.GetInPlaceContext(
+ out Frame: IOleInPlaceFrame; out Doc: IOleInPlaceUIWindow;
+ lpFrameInfo: POleInPlaceFrameInfo): HResult;
+begin
+ Result := E_NOTIMPL;
+{
+ Doc := nil; //Document window is same as frame window
+ FrameInfo.hWndFrame := 0; // Form.Handle;
+ FrameInfo.fMDIApp := False;
+ FrameInfo.hAccel := 0;
+ FrameInfo.cAccelEntries := 0;
+}
+end;
+
+function TRichEditOleCallback.QueryInsertObject(const clsid: TCLSID; const stg: IStorage; cp: Longint): HResult;
+begin
+ Result := NOERROR;
+end;
+
+const
+ OLECLOSE_NOSAVE = 1;
+
+function TRichEditOleCallback.DeleteObject(const oleobj: IOleObject): HResult;
+begin
+ if Assigned(oleobj) then oleobj.Close(OLECLOSE_NOSAVE);
+ Result := NOERROR;
+end;
+
+function TRichEditOleCallback.QueryAcceptData(const dataobj: IDataObject; var cfFormat: TClipFormat; reco: DWORD; fReally: BOOL; hMetaPict: HGLOBAL): HResult;
+begin
+ Result := S_OK;
+end;
+
+function TRichEditOleCallback.ContextSensitiveHelp(fEnterMode: BOOL): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TRichEditOleCallback.GetClipboardData(const chrg: TCharRange; reco: DWORD; out dataobj: IDataObject): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TRichEditOleCallback.GetDragDropEffect(fDrag: BOOL; grfKeyState: DWORD; var dwEffect: DWORD): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TRichEditOleCallback.GetContextMenu(seltype: Word; const oleobj: IOleObject; const chrg: TCharRange; out menu: HMENU): HResult;
+begin
+ Result := E_NOTIMPL;
+{
+ Menu := 0
+}
+end;
+
+function TRichEditOleCallback.ShowContainerUI(fShow: BOOL): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+
+function RichEdit_SetOleCallback(Wnd: HWND; const Intf: IRichEditOleCallback): Boolean;
+begin
+ Result := SendMessage(Wnd, EM_SETOLECALLBACK, 0, LPARAM(Intf)) <> 0;
+end;
+
+function RichEdit_GetOleInterface(Wnd: HWND; out Intf: IRichEditOle): Boolean;
+begin
+ Result := SendMessage(Wnd, EM_GETOLEINTERFACE, 0, LPARAM(@Intf)) <> 0;
+end;
+
+{ TImageDataObject }
+
+{$IFDEF FPC}
+function TImageDataObject.DAdvise(const formatetc: TFormatEtc; advf: dword; const advSink: IAdviseSink; out dwConnection: dword): HResult;
+{$ELSE}
+function TImageDataObject.DAdvise(const formatetc: TFormatEtc; advf: longint; const advSink: IAdviseSink; out dwConnection: longint): HResult;
+{$ENDIF}
+begin
+ Result := E_NOTIMPL;
+end;
+
+{$IFDEF FPC}
+function TImageDataObject.DUnadvise(dwConnection: dword): HResult;
+{$ELSE}
+function TImageDataObject.DUnadvise(dwConnection: longint): HResult;
+{$ENDIF}
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TImageDataObject.EnumDAdvise(out enumAdvise: IEnumStatData): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+{$IFDEF FPC}
+function TImageDataObject.EnumFormatEtc(dwDirection: dword; out enumFormatEtc: IEnumFormatEtc): HResult;
+{$ELSE}
+function TImageDataObject.EnumFormatEtc(dwDirection: longint; out enumFormatEtc: IEnumFormatEtc): HResult;
+{$ENDIF}
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TImageDataObject.GetCanonicalFormatEtc(const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TImageDataObject.GetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+function TImageDataObject.QueryGetData(const formatetc: TFormatEtc): HResult;
+begin
+ Result := E_NOTIMPL;
+end;
+
+destructor TImageDataObject.Destroy;
+begin
+ ReleaseStgMedium(FMedium);
+ inherited;
+end;
+
+function TImageDataObject.GetData(const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult;
+begin
+ FillChar(medium,SizeOf(medium),0);
+ medium.tymed := TYMED_GDI;
+ medium.hBitmap := FMedium.hBitmap;
+(*
+{$IFDEF FPC}
+ medium.punkForRelease := nil;
+{$ELSE}
+ medium.unkForRelease := nil;
+{$ENDIF}
+*)
+ Result:=S_OK;
+end;
+
+{$IFDEF FPC}
+function TImageDataObject.SetData(const formatetc: TFormatEtc; const medium: TStgMedium; fRelease: BOOL): HResult;
+{$ELSE}
+function TImageDataObject.SetData(const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult;
+{$ENDIF}
+begin
+ FFormatEtc := formatetc;
+ FMedium := medium;
+ Result:= S_OK;
+end;
+
+procedure TImageDataObject.SetBitmap(bmp: hBitmap);
+var
+ stgm: TStgMedium;
+ fm: TFormatEtc;
+begin
+ FillChar(stgm,SizeOf(stgm),0);
+ stgm.tymed := TYMED_GDI;
+ stgm.hBitmap := bmp;
+(*
+{$IFDEF FPC}
+ stgm.pUnkForRelease := nil;
+{$ELSE}
+ stgm.UnkForRelease := nil;
+{$ENDIF}
+*)
+ fm.cfFormat := CF_BITMAP;
+ fm.ptd := nil;
+ fm.dwAspect := DVASPECT_CONTENT;
+ fm.lindex := -1;
+ fm.tymed := TYMED_GDI;
+ SetData(fm, stgm, FALSE);
+end;
+
+const
+ OLERENDER_FORMAT = 2;
+
+function TImageDataObject.GetOleObject(OleClientSite: IOleClientSite; Storage: IStorage):IOleObject;
+begin
+ if (FMedium.hBitmap = 0) then
+ Result := nil
+ else
+ OleCreateStaticFromData(Self, IID_IOleObject, OLERENDER_FORMAT, @FFormatEtc, OleClientSite,
+ Storage, Result);
+end;
+
+function TImageDataObject.InsertBitmap(Wnd: HWND; Bitmap: hBitmap; cp: Cardinal): Boolean;
+var
+ RichEditOLE: IRichEditOLE;
+ OleClientSite: IOleClientSite;
+ Storage: IStorage;
+ OleObject: IOleObject;
+ ReObject: TReObject;
+ clsid: TGUID;
+begin
+ Result := false;
+ if Bitmap = 0 then
+ exit;
+ if not RichEdit_GetOleInterface(Wnd, RichEditOle) then
+ exit;
+ FBmp := CopyImage(Bitmap, IMAGE_BITMAP, 0, 0, 0);
+ try
+ SetBitmap(FBmp);
+ RichEditOle.GetClientSite(OleClientSite);
+ Storage := nil;
+ try
+ CreateStorage(Storage);
+ if not(Assigned(OleClientSite) and Assigned(Storage)) then
+ exit;
+ try
+ OleObject := GetOleObject(OleClientSite, Storage);
+ if OleObject = nil then
+ exit;
+ OleSetContainedObject(OleObject, True);
+ OleObject.GetUserClassID(clsid);
+ ZeroMemory(@ReObject, SizeOf(ReObject));
+ ReObject.cbStruct := SizeOf(ReObject);
+ ReObject.clsid := clsid;
+ ReObject.cp := cp;
+ ReObject.dvaspect := DVASPECT_CONTENT;
+ ReObject.poleobj := OleObject;
+ ReObject.polesite := OleClientSite;
+ ReObject.pstg := Storage;
+ Result := (RichEditOle.InsertObject(ReObject) = NOERROR);
+ finally
+ ReleaseObject(OleObject);
+ end;
+ finally
+ ReleaseObject(OleClientSite);
+ ReleaseObject(Storage);
+ end;
+ finally
+ DeleteObject(FBmp);
+ ReleaseObject(RichEditOLE);
+ end;
+end;
+
+function RichEdit_InsertBitmap(Wnd: HWND; Bitmap: hBitmap; cp: Cardinal): Boolean;
+begin
+ with TImageDataObject.Create do
+ try
+ Result := InsertBitmap(Wnd,Bitmap,cp);
+ finally
+ Free;
+ end
+end;
+
+const
+ RichEditLibnames: array[ 0..3 ] of PAnsiChar =
+ ( 'msftedit', 'riched20', 'riched32', 'riched' );
+ RichEditClasses: array[ 0..3 ] of PAnsiChar =
+ ( 'RichEdit50W', 'RichEdit20A', 'RichEdit', 'RichEdit' );
+
+const
+ FRichEditModule:THANDLE = 0;
+
+procedure InitRichEditLibrary;
+var
+ SaveErrMode:integer;
+ i:integer;
+begin
+ if FRichEditModule = 0 then
+ begin
+ SaveErrMode := SetErrorMode(SEM_NOOPENFILEERRORBOX or SEM_FAILCRITICALERRORS);
+
+ for i:=0 to HIGH(RichEditLibNames) do
+ begin
+ FRichEditModule := LoadLibraryA(RichEditLibNames[i]);
+ if FRichEditModule > HINSTANCE_ERROR then
+ begin
+ RichEditClass := RichEditClasses[i];
+ break;
+ end
+ else
+ FRichEditModule := 0;
+ end;
+
+ if FRichEditModule = 0 then
+ RichEditClass := RichEditClasses[HIGH(RichEditClasses)];
+
+ SetErrorMode(SaveErrMode);
+ end;
+end;
+
+initialization
+ InitRichEditLibrary;
+
+finalization
+ if FRichEditModule <> 0 then FreeLibrary(FRichEditModule);
+
+end.
diff --git a/plugins/Utils.pas/rtfutils.pas b/plugins/Utils.pas/rtfutils.pas
new file mode 100644
index 0000000000..905c98ef0e
--- /dev/null
+++ b/plugins/Utils.pas/rtfutils.pas
@@ -0,0 +1,586 @@
+unit rtfutils;
+
+interface
+
+uses
+ richedit,
+ windows;
+
+
+function IsRTF(const Value: pWideChar): Boolean;
+
+//used for Export only
+function GetRichRTFW(RichEditHandle: THANDLE; var RTFStream: PWideChar;
+ SelectionOnly, PlainText, NoObjects, PlainRTF: Boolean): Integer;
+function GetRichRTFA(RichEditHandle: THANDLE; var RTFStream: PAnsiChar;
+ SelectionOnly, PlainText, NoObjects, PlainRTF: Boolean): Integer;
+
+function GetRichString(RichEditHandle: THANDLE; SelectionOnly: Boolean = false): PWideChar;
+
+function SetRichRTFW(RichEditHandle: THANDLE; const RTFStream: PWideChar;
+ SelectionOnly, PlainText, PlainRTF: Boolean): Integer;
+function SetRichRTFA(RichEditHandle: THANDLE; const RTFStream: PAnsiChar;
+ SelectionOnly, PlainText, PlainRTF: Boolean): Integer;
+
+function FormatString2RTFW(Source: PWideChar; Suffix: PAnsiChar = nil): PAnsiChar;
+function FormatString2RTFA(Source: PAnsiChar; Suffix: PAnsiChar = nil): PAnsiChar;
+
+procedure ReplaceCharFormatRange(RichEditHandle: THANDLE;
+ const fromCF, toCF: CHARFORMAT2; idx, len: Integer);
+procedure ReplaceCharFormat(RichEditHandle: THANDLE; const fromCF, toCF: CHARFORMAT2);
+
+function GetTextLength(RichEditHandle:THANDLE): Integer;
+function GetTextRange (RichEditHandle:THANDLE; cpMin,cpMax: Integer): PWideChar;
+
+function BitmapToRTF(pict: HBITMAP): pAnsiChar;
+
+implementation
+
+uses
+ common;
+
+function IsRTF(const Value: pWideChar): Boolean;
+const
+ RTF_BEGIN_1 = '{\RTF';
+ RTF_BEGIN_2 = '{URTF';
+begin
+ Result := (StrPosW(Value,RTF_BEGIN_1) = Value)
+ or (StrPosW(Value,RTF_BEGIN_2) = Value);
+end;
+
+type
+ PTextStream = ^TTextStream;
+ TTextStream = record
+ Size: Integer;
+ case Boolean of
+ false: (Data: PAnsiChar);
+ true: (DataW: PWideChar);
+ end;
+
+function RichEditStreamLoad(dwCookie: DWORD_PTR; pbBuff: PByte; cb: Longint; var pcb: Longint): dword; stdcall;
+var
+ pBuff: PAnsiChar;
+begin
+ with PTextStream(dwCookie)^ do
+ begin
+ pBuff := Data;
+ pcb := Size;
+ if pcb > cb then
+ pcb := cb;
+ Move(pBuff^, pbBuff^, pcb);
+ Inc(Data, pcb);
+ Dec(Size, pcb);
+ end;
+ Result := 0;
+end;
+
+function RichEditStreamSave(dwCookie: DWORD_PTR; pbBuff: PByte; cb: Longint; var pcb: Longint): dword; stdcall;
+var
+ prevSize: Integer;
+begin
+ with PTextStream(dwCookie)^ do
+ begin
+ prevSize := Size;
+ Inc(Size,cb);
+ ReallocMem(Data,Size);
+ Move(pbBuff^,(Data+prevSize)^,cb);
+ pcb := cb;
+ end;
+ Result := 0;
+end;
+
+function _GetRichRTF(RichEditHandle: THANDLE; TextStream: PTextStream;
+ SelectionOnly, PlainText, NoObjects, PlainRTF, Unicode: Boolean): Integer;
+var
+ es: TEditStream;
+ Format: Longint;
+begin
+ format := 0;
+ if SelectionOnly then
+ Format := Format or SFF_SELECTION;
+ if PlainText then
+ begin
+ if NoObjects then
+ Format := Format or SF_TEXT
+ else
+ Format := Format or SF_TEXTIZED;
+ if Unicode then
+ Format := Format or SF_UNICODE;
+ end
+ else
+ begin
+ if NoObjects then
+ Format := Format or SF_RTFNOOBJS
+ else
+ Format := Format or SF_RTF;
+ if PlainRTF then
+ Format := Format or SFF_PLAINRTF;
+ // if Unicode then format := format or SF_USECODEPAGE or (CP_UTF16 shl 16);
+ end;
+ TextStream^.Size := 0;
+ TextStream^.Data := nil;
+ es.dwCookie := DWORD_PTR(TextStream);
+ es.dwError := 0;
+ es.pfnCallback := @RichEditStreamSave;
+ SendMessage(RichEditHandle, EM_STREAMOUT, format, LPARAM(@es));
+ Result := es.dwError;
+end;
+
+function GetRichRTFW(RichEditHandle: THANDLE; var RTFStream: PWideChar;
+ SelectionOnly, PlainText, NoObjects, PlainRTF: Boolean): Integer;
+var
+ Stream: TTextStream;
+begin
+ Result := _GetRichRTF(RichEditHandle, @Stream,
+ SelectionOnly, PlainText, NoObjects, PlainRTF, PlainText);
+ if Assigned(Stream.DataW) then
+ begin
+ if PlainText then
+ StrDupW(RTFStream, Stream.DataW, Stream.Size div SizeOf(WideChar))
+ else
+ AnsiToWide(Stream.Data, RTFStream, CP_ACP);
+ FreeMem(Stream.Data, Stream.Size);
+ end
+ else
+ RTFStream := nil;
+end;
+
+function GetRichRTFA(RichEditHandle: THANDLE; var RTFStream: PAnsiChar;
+ SelectionOnly, PlainText, NoObjects, PlainRTF: Boolean): Integer;
+var
+ Stream: TTextStream;
+begin
+ Result := _GetRichRTF(RichEditHandle, @Stream,
+ SelectionOnly, PlainText, NoObjects, PlainRTF, False);
+ if Assigned(Stream.Data) then
+ begin
+ StrDup(RTFStream, Stream.Data, Stream.Size - 1);
+ FreeMem(Stream.Data, Stream.Size);
+ end
+ else
+ RTFStream := nil;
+end;
+
+function GetRichString(RichEditHandle: THANDLE; SelectionOnly: Boolean = false): PWideChar;
+begin
+ GetRichRTFW(RichEditHandle,Result,SelectionOnly,True,True,False);
+end;
+
+
+function _SetRichRTF(RichEditHandle: THANDLE; TextStream: PTextStream;
+ SelectionOnly, PlainText, PlainRTF, Unicode: Boolean): Integer;
+var
+ es: TEditStream;
+ Format: Longint;
+begin
+ Format := 0;
+ if SelectionOnly then
+ Format := Format or SFF_SELECTION;
+ if PlainText then
+ begin
+ Format := Format or SF_TEXT;
+ if Unicode then
+ Format := Format or SF_UNICODE;
+ end
+ else
+ begin
+ Format := Format or SF_RTF;
+ if PlainRTF then
+ Format := Format or SFF_PLAINRTF;
+ // if Unicode then format := format or SF_USECODEPAGE or (CP_UTF16 shl 16);
+ end;
+ es.dwCookie := LPARAM(TextStream);
+ es.dwError := 0;
+ es.pfnCallback := @RichEditStreamLoad;
+ SendMessage(RichEditHandle, EM_STREAMIN, format, LPARAM(@es));
+ Result := es.dwError;
+end;
+
+function SetRichRTFW(RichEditHandle: THANDLE; const RTFStream: PWideChar;
+ SelectionOnly, PlainText, PlainRTF: Boolean): Integer;
+var
+ Stream: TTextStream;
+ Buffer: PAnsiChar;
+begin
+ if PlainText then
+ begin
+ Stream.DataW := RTFStream;
+ Stream.Size := StrLenW(RTFStream) * SizeOf(WideChar);
+ Buffer := nil;
+ end
+ else
+ begin
+ WideToAnsi(RTFStream, Buffer, CP_ACP);
+ Stream.Data := Buffer;
+ Stream.Size := StrLen(Buffer);
+ end;
+ Result := _SetRichRTF(RichEditHandle, @Stream,
+ SelectionOnly, PlainText, PlainRTF, PlainText);
+ mFreeMem(Buffer);
+end;
+
+function SetRichRTFA(RichEditHandle: THANDLE; const RTFStream: PAnsiChar;
+ SelectionOnly, PlainText, PlainRTF: Boolean): Integer;
+var
+ Stream: TTextStream;
+begin
+ Stream.Data := RTFStream;
+ Stream.Size := StrLen(RTFStream);
+ Result := _SetRichRTF(RichEditHandle, @Stream,
+ SelectionOnly, PlainText, PlainRTF, False);
+end;
+
+function FormatString2RTFW(Source: PWideChar; Suffix: PAnsiChar = nil): PAnsiChar;
+var
+ Text: PWideChar;
+ res: PAnsiChar;
+ buf: array [0..15] of AnsiChar;
+ len: integer;
+begin
+ // calculate len
+ len:=Length('{\uc1 ');
+ Text := PWideChar(Source);
+ while Text[0] <> #0 do
+ begin
+ if (Text[0] = #13) and (Text[1] = #10) then
+ begin
+ inc(len,Length('\par '));
+ Inc(Text);
+ end
+ else
+ case Text[0] of
+ #10: inc(len,Length('\par '));
+ #09: inc(len,Length('\tab '));
+ '\', '{', '}':
+ inc(len,2);
+ else
+ if Word(Text[0]) < 128 then
+ inc(len)
+ else
+ inc(len,3+IntStrLen(Word(Text[0]),10));
+ end;
+ Inc(Text);
+ end;
+ inc(len,StrLen(Suffix)+2);
+
+ // replace
+ Text := PWideChar(Source);
+ GetMem(Result,len);
+ res:=StrCopyE(Result,'{\uc1 ');
+ while Text[0] <> #0 do
+ begin
+ if (Text[0] = #13) and (Text[1] = #10) then
+ begin
+ res:=StrCopyE(res,'\par ');
+ Inc(Text);
+ end
+ else
+ case Text[0] of
+ #10: res:=StrCopyE(res,'\par ');
+ #09: res:=StrCopyE(res,'\tab ');
+ '\', '{', '}': begin
+ res^:='\'; inc(res);
+ res^:=AnsiChar(Text[0]); inc(res);
+ end;
+ else
+ if Word(Text[0]) < 128 then
+ begin
+ res^:=AnsiChar(Word(Text[0])); inc(res);
+ end
+ else
+ begin
+ res:=StrCopyE(
+ StrCopyE(res,'\u'),
+ IntToStr(buf,Word(Text[0])));
+ res^:='?'; inc(res);
+ end;
+ end;
+ Inc(Text);
+ end;
+
+ res:=StrCopyE(res, Suffix);
+ res^:='}'; inc(res); res^:=#0;
+end;
+
+function FormatString2RTFA(Source: PAnsiChar; Suffix: PAnsiChar = nil): PAnsiChar;
+var
+ Text,res: PAnsiChar;
+ len: integer;
+begin
+ // calculate len
+ len:=1;
+ Text := PAnsiChar(Source);
+ while Text[0] <> #0 do
+ begin
+ if (Text[0] = #13) and (Text[1] = #10) then
+ begin
+ inc(len,Length('\line '));
+ Inc(Text);
+ end
+ else
+ case Text[0] of
+ #10: inc(len,Length('\line '));
+ #09: inc(len,Length('\tab '));
+ '\', '{', '}':
+ inc(len,2);
+ else
+ inc(len);
+ end;
+ Inc(Text);
+ end;
+ inc(len,StrLen(Suffix)+2);
+
+ // replace
+ Text := PAnsiChar(Source);
+ GetMem(Result,len);
+ res:=Result;
+ res^ := '{'; inc(res);
+ while Text[0] <> #0 do
+ begin
+ if (Text[0] = #13) and (Text[1] = #10) then
+ begin
+ res:=StrCopyE(res,'\line ');
+ Inc(Text);
+ end
+ else
+ case Text[0] of
+ #10: res:=StrCopyE(res,'\line ');
+ #09: res:=StrCopyE(res,'\tab ');
+ '\', '{', '}': begin
+ res^:='\'; inc(res);
+ res^:=Text[0]; inc(res);
+ end;
+ else
+ res^:=Text[0]; inc(res);
+ end;
+ Inc(Text);
+ end;
+
+ res:=StrCopyE(res, Suffix);
+ res^:='}'; inc(res); res^:=#0;
+end;
+
+function GetTextLength(RichEditHandle: THANDLE): Integer;
+var
+ gtxl: GETTEXTLENGTHEX;
+begin
+ gtxl.flags := GTL_DEFAULT or GTL_PRECISE;
+ gtxl.codepage := 1200; // Unicode
+ gtxl.flags := gtxl.flags or GTL_NUMCHARS;
+ Result := SendMessage(RichEditHandle, EM_GETTEXTLENGTHEX, WPARAM(@gtxl), 0);
+end;
+
+procedure ReplaceCharFormatRange(RichEditHandle: THANDLE;
+ const fromCF, toCF: CHARFORMAT2; idx, len: Integer);
+var
+ cr: CHARRANGE;
+ cf: CHARFORMAT2;
+ loglen: Integer;
+ res: DWord;
+begin
+ if len = 0 then
+ exit;
+ cr.cpMin := idx;
+ cr.cpMax := idx + len;
+ SendMessage(RichEditHandle, EM_EXSETSEL, 0, LPARAM(@cr));
+ ZeroMemory(@cf, SizeOf(cf));
+ cf.cbSize := SizeOf(cf);
+ cf.dwMask := fromCF.dwMask;
+ res := SendMessage(RichEditHandle, EM_GETCHARFORMAT, SCF_SELECTION, LPARAM(@cf));
+ if (res and fromCF.dwMask) = 0 then
+ begin
+ if len = 2 then
+ begin
+ // wtf, msdn tells that cf will get the format of the first AnsiChar,
+ // and then we have to select it, if format match or second, if not
+ // instead we got format of the last AnsiChar... weired
+ if (cf.dwEffects and fromCF.dwEffects) = fromCF.dwEffects then
+ Inc(cr.cpMin)
+ else
+ Dec(cr.cpMax);
+ SendMessage(RichEditHandle, EM_EXSETSEL, 0, LPARAM(@cr));
+ SendMessage(RichEditHandle, EM_SETCHARFORMAT, SCF_SELECTION, LPARAM(@toCF));
+ end
+ else
+ begin
+ loglen := len div 2;
+ ReplaceCharFormatRange(RichEditHandle, fromCF, toCF, idx, loglen);
+ ReplaceCharFormatRange(RichEditHandle, fromCF, toCF, idx + loglen, len - loglen);
+ end;
+ end
+ else if (cf.dwEffects and fromCF.dwEffects) = fromCF.dwEffects then
+ SendMessage(RichEditHandle, EM_SETCHARFORMAT, SCF_SELECTION, LPARAM(@toCF));
+end;
+
+procedure ReplaceCharFormat(RichEditHandle: THANDLE; const fromCF, toCF: CHARFORMAT2);
+begin
+ ReplaceCharFormatRange(RichEditHandle,fromCF,toCF,0,GetTextLength(RichEditHandle));
+end;
+
+
+function GetTextRange(RichEditHandle: THANDLE; cpMin,cpMax: Integer): PWideChar;
+var
+ tr: TextRangeW;
+begin
+ tr.chrg.cpMin := cpMin;
+ tr.chrg.cpMax := cpMax;
+ GetMem(Result,(cpMax-cpMin+1)*SizeOf(WideChar));
+ tr.lpstrText := Result;
+
+ SendMessageW(RichEditHandle,EM_GETTEXTRANGE,0,LPARAM(@tr));
+end;
+
+{ Direct Bitmap to RTF insertion }
+
+function BytesPerScanline(PixelsPerScanline, BitsPerPixel, Alignment: Longint): Longint;
+begin
+ Dec(Alignment);
+ Result := ((PixelsPerScanline * BitsPerPixel) + Alignment) and not Alignment;
+ Result := Result div 8;
+end;
+
+procedure InitializeBitmapInfoHeader(Bitmap: HBITMAP; var BI: TBitmapInfoHeader; Colors: Integer);
+var
+ DS: TDIBSection;
+ Bytes: Integer;
+begin
+ DS.dsbmih.biSize := 0;
+ Bytes := GetObject(Bitmap, SizeOf(DS), @DS);
+ if Bytes = 0 then {InvalidBitmap}
+ else if (Bytes >= (sizeof(DS.dsbm) + sizeof(DS.dsbmih))) and
+ (DS.dsbmih.biSize >= DWORD(sizeof(DS.dsbmih))) then
+ BI := DS.dsbmih
+ else
+ begin
+ FillChar(BI, sizeof(BI), 0);
+ with BI, DS.dsbm do
+ begin
+ biSize := SizeOf(BI);
+ biWidth := bmWidth;
+ biHeight := bmHeight;
+ end;
+ end;
+ case Colors of
+ 2: BI.biBitCount := 1;
+ 3..16:
+ begin
+ BI.biBitCount := 4;
+ BI.biClrUsed := Colors;
+ end;
+ 17..256:
+ begin
+ BI.biBitCount := 8;
+ BI.biClrUsed := Colors;
+ end;
+ else
+ BI.biBitCount := DS.dsbm.bmBitsPixel * DS.dsbm.bmPlanes;
+ end;
+ BI.biPlanes := 1;
+ if BI.biClrImportant > BI.biClrUsed then
+ BI.biClrImportant := BI.biClrUsed;
+ if BI.biSizeImage = 0 then
+ BI.biSizeImage := BytesPerScanLine(BI.biWidth, BI.biBitCount, 32) * Abs(BI.biHeight);
+end;
+
+procedure InternalGetDIBSizes(Bitmap: HBITMAP; var InfoHeaderSize: DWORD;
+ var ImageSize: DWORD; Colors: Integer);
+var
+ BI: TBitmapInfoHeader;
+begin
+ InitializeBitmapInfoHeader(Bitmap, BI, Colors);
+ if BI.biBitCount > 8 then
+ begin
+ InfoHeaderSize := SizeOf(TBitmapInfoHeader);
+ if (BI.biCompression and BI_BITFIELDS) <> 0 then
+ Inc(InfoHeaderSize, 12);
+ end
+ else
+ if BI.biClrUsed = 0 then
+ InfoHeaderSize := SizeOf(TBitmapInfoHeader) +
+ SizeOf(TRGBQuad) * (1 shl BI.biBitCount)
+ else
+ InfoHeaderSize := SizeOf(TBitmapInfoHeader) +
+ SizeOf(TRGBQuad) * BI.biClrUsed;
+ ImageSize := BI.biSizeImage;
+end;
+
+procedure GetDIBSizes(Bitmap: HBITMAP; var InfoHeaderSize: DWORD; var ImageSize: DWORD);
+begin
+ InternalGetDIBSizes(Bitmap, InfoHeaderSize, ImageSize, 0);
+end;
+
+function InternalGetDIB(Bitmap: HBITMAP; Palette: HPALETTE;
+ var BitmapInfo; var Bits; Colors: Integer): Boolean;
+var
+ OldPal: HPALETTE;
+ DC: HDC;
+begin
+ InitializeBitmapInfoHeader(Bitmap, TBitmapInfoHeader(BitmapInfo), Colors);
+ OldPal := 0;
+ DC := CreateCompatibleDC(0);
+ try
+ if Palette <> 0 then
+ begin
+ OldPal := SelectPalette(DC, Palette, False);
+ RealizePalette(DC);
+ end;
+ Result := GetDIBits(DC, Bitmap, 0, TBitmapInfoHeader(BitmapInfo).biHeight, @Bits,
+ TBitmapInfo(BitmapInfo), DIB_RGB_COLORS) <> 0;
+ finally
+ if OldPal <> 0 then SelectPalette(DC, OldPal, False);
+ DeleteDC(DC);
+ end;
+end;
+
+function GetDIB(Bitmap: HBITMAP; Palette: HPALETTE; var BitmapInfo; var Bits): Boolean;
+begin
+ Result := InternalGetDIB(Bitmap, Palette, BitmapInfo, Bits, 0);
+end;
+
+const
+ HexDigitChr: array [0..15] of AnsiChar = ('0','1','2','3','4','5','6','7',
+ '8','9','A','B','C','D','E','F');
+
+function BitmapToRTF(pict: HBITMAP): pAnsiChar;
+const
+ prefix = '{\rtf1 {\pict\dibitmap ';
+ postfix = ' }}';
+var
+ tmp, bi, bb, rtf: pAnsiChar;
+ bis, bbs: cardinal;
+ len,cnt: integer;
+begin
+ GetDIBSizes(pict, bis, bbs);
+ GetMem(bi, bis);
+ GetMem(bb, bbs);
+ GetDIB(pict, {pict.Palette}0, bi^, bb^);
+
+ len:=(bis+bbs)*2+cardinal(Length(prefix)+Length(postfix))+1;
+ GetMem(result,len);
+
+ rtf:=StrCopyE(result,prefix);
+ tmp:=bi;
+ for cnt := 0 to bis-1 do
+ begin
+ rtf^ := HexDigitChr[ord(tmp^) shr 4]; inc(rtf);
+ rtf^ := HexDigitChr[ord(tmp^) and $F]; inc(rtf);
+ inc(tmp);
+ end;
+ tmp:=bb;
+ for cnt := 0 to bbs-1 do
+ begin
+ rtf^ := HexDigitChr[ord(tmp^) shr 4]; inc(rtf);
+ rtf^ := HexDigitChr[ord(tmp^) and $F]; inc(rtf);
+ inc(tmp);
+ end;
+ StrCopy(rtf,postfix);
+
+ FreeMem(bi);
+ FreeMem(bb);
+end;
+
+
+initialization
+finalization
+
+end.
diff --git a/plugins/Utils.pas/syswin.pas b/plugins/Utils.pas/syswin.pas
index 9b75f711fa..661963d5e6 100644
--- a/plugins/Utils.pas/syswin.pas
+++ b/plugins/Utils.pas/syswin.pas
@@ -38,7 +38,7 @@ function IsExeRunning(exename:PWideChar):boolean; {hwnd}
implementation
uses
- {$IFNDEF FPC}shellapi,{$ENDIF}
+// {$IFNDEF FPC}shellapi,{$ENDIF}
{$IFDEF COMPILER_16_UP}
WinAPI.PsApi,
{$ELSE}
@@ -46,12 +46,13 @@ uses
{$ENDIF}
common,messages;
-{ shellapi import
+{$IFNDEF FPC} // shellapi import
function FindExecutableA(FileName, Directory: PAnsiChar; Result: PAnsiChar): HINST; stdcall;
external 'shell32.dll' name 'FindExecutableA';
function FindExecutableW(FileName, Directory: PWideChar; Result: PWideChar): HINST; stdcall;
external 'shell32.dll' name 'FindExecutableW';
-}
+{$ENDIF}
+
{$IFDEF COMPILER_16_UP}
type pqword = ^int64;
{$ENDIF}
@@ -197,7 +198,7 @@ begin
len:=4;
typ:=REG_DWORD;
if RegQueryValueEx(lKey,'GlobalUserOffline',NIL,@typ,@result,@len)=ERROR_SUCCESS then
- ;
+ ;
RegCloseKey(lKey);
end;
end;
diff --git a/plugins/Utils.pas/tlb_richedit.pas b/plugins/Utils.pas/tlb_richedit.pas
new file mode 100644
index 0000000000..1805aee9b6
--- /dev/null
+++ b/plugins/Utils.pas/tlb_richedit.pas
@@ -0,0 +1,898 @@
+unit tlb_richedit;
+
+interface
+
+uses
+ Windows, Messages, RichEdit, ActiveX;
+
+
+const
+ IID_ITextDocument : TGUID = '{8CC497C0-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextSelection : TGUID = '{8CC497C1-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextRange : TGUID = '{8CC497C2-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextFont : TGUID = '{8CC497C3-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextPara : TGUID = '{8CC497C4-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextStoryRanges: TGUID = '{8CC497C5-A1DF-11CE-8098-00AA0047BE5D}';
+ IID_ITextDocument2 : TGUID = '{01C25500-4268-11D1-883A-3C8B00C10000}';
+ IID_ITextMsgFilter : TGUID = '{A3787420-4267-11D1-883A-3C8B00C10000}';
+
+const
+ tomFalse = $00000000;
+ tomTrue = $FFFFFFFF;
+
+ tomUndefined = $FF676981;
+ tomToggle = $FF676982;
+ tomAutoColor = $FF676983;
+ tomDefault = $FF676984;
+ tomSuspend = $FF676985;
+ tomResume = $FF676986;
+
+ tomApplyNow = $00000000;
+ tomApplyLater = $00000001;
+ tomTrackParms = $00000002;
+ tomCacheParms = $00000003;
+ tomApplyTmp = $00000004;
+
+ tomBackward = $C0000001;
+ tomForward = $3FFFFFFF;
+
+ tomMove = $00000000;
+ tomExtend = $00000001;
+
+ tomNoSelection = $00000000;
+ tomSelectionIP = $00000001;
+ tomSelectionNormal = $00000002;
+ tomSelectionFrame = $00000003;
+ tomSelectionColumn = $00000004;
+ tomSelectionRow = $00000005;
+ tomSelectionBlock = $00000006;
+ tomSelectionInlineShape = $00000007;
+ tomSelectionShape = $00000008;
+
+ tomSelStartActive = $00000001;
+ tomSelAtEOL = $00000002;
+ tomSelOvertype = $00000004;
+ tomSelActive = $00000008;
+ tomSelReplace = $00000010;
+
+ tomEnd = $00000000;
+ tomStart = $00000020;
+
+ tomCollapseEnd = $00000000;
+ tomCollapseStart = $00000001;
+
+ tomClientCoord = $00000100;
+ tomAllowOffClient = $00000200;
+
+ tomNone = $00000000;
+ tomSingle = $00000001;
+ tomWords = $00000002;
+ tomDouble = $00000003;
+ tomDotted = $00000004;
+ tomDash = $00000005;
+ tomDashDot = $00000006;
+ tomDashDotDot = $00000007;
+ tomWave = $00000008;
+ tomThick = $00000009;
+ tomHair = $0000000A;
+ tomDoubleWave = $0000000B;
+ tomHeavyWave = $0000000C;
+ tomLongDash = $0000000D;
+ tomThickDash = $0000000E;
+ tomThickDashDot = $0000000F;
+ tomThickDashDotDot = $00000010;
+ tomThickDotted = $00000011;
+ tomThickLongDash = $00000012;
+
+ tomLineSpaceSingle = $00000000;
+ tomLineSpace1pt5 = $00000001;
+ tomLineSpaceDouble = $00000002;
+ tomLineSpaceAtLeast = $00000003;
+ tomLineSpaceExactly = $00000004;
+ tomLineSpaceMultiple = $00000005;
+
+ tomAlignLeft = $00000000;
+ tomAlignCenter = $00000001;
+ tomAlignRight = $00000002;
+ tomAlignJustify = $00000003;
+ tomAlignDecimal = $00000003;
+ tomAlignBar = $00000004;
+ tomAlignInterWord = $00000003;
+ tomAlignInterLetter = $00000004;
+ tomAlignScaled = $00000005;
+ tomAlignGlyphs = $00000006;
+ tomAlignSnapGrid = $00000007;
+
+ tomSpaces = $00000000;
+ tomDots = $00000001;
+ tomDashes = $00000002;
+ tomLines = $00000003;
+ tomThickLines = $00000004;
+ tomEquals = $00000005;
+
+ tomTabBack = $FFFFFFFD;
+ tomTabNext = $FFFFFFFE;
+ tomTabHere = $FFFFFFFF;
+
+ tomListNone = $00000000;
+ tomListBullet = $00000001;
+ tomListNumberAsArabic = $00000002;
+ tomListNumberAsLCLetter = $00000003;
+ tomListNumberAsUCLetter = $00000004;
+ tomListNumberAsLCRoman = $00000005;
+ tomListNumberAsUCRoman = $00000006;
+ tomListNumberAsSequence = $00000007;
+
+ tomListParentheses = $00010000;
+ tomListPeriod = $00020000;
+ tomListPlain = $00030000;
+
+ tomCharacter = $00000001;
+ tomWord = $00000002;
+ tomSentence = $00000003;
+ tomParagraph = $00000004;
+ tomLine = $00000005;
+ tomStory = $00000006;
+ tomScreen = $00000007;
+ tomSection = $00000008;
+ tomColumn = $00000009;
+ tomRow = $0000000A;
+ tomWindow = $0000000B;
+ tomCell = $0000000C;
+ tomCharFormat = $0000000D;
+ tomParaFormat = $0000000E;
+ tomTable = $0000000F;
+ tomObject = $00000010;
+ tomPage = $00000011;
+
+ tomMatchWord = $00000002;
+ tomMatchCase = $00000004;
+ tomMatchPattern = $00000008;
+
+ tomUnknownStory = $00000000;
+ tomMainTextStory = $00000001;
+ tomFootnotesStory = $00000002;
+ tomEndnotesStory = $00000003;
+ tomCommentsStory = $00000004;
+ tomTextFrameStory = $00000005;
+ tomEvenPagesHeaderStory = $00000006;
+ tomPrimaryHeaderStory = $00000007;
+ tomEvenPagesFooterStory = $00000008;
+ tomPrimaryFooterStory = $00000009;
+ tomFirstPageHeaderStory = $0000000A;
+ tomFirstPageFooterStory = $0000000B;
+
+ tomNoAnimation = $00000000;
+ tomLasVegasLights = $00000001;
+ tomBlinkingBackground = $00000002;
+ tomSparkleText = $00000003;
+ tomMarchingBlackAnts = $00000004;
+ tomMarchingRedAnts = $00000005;
+ tomShimmer = $00000006;
+ tomWipeDown = $00000007;
+ tomWipeRight = $00000008;
+ tomAnimationMax = $00000008;
+
+ tomLowerCase = $00000000;
+ tomUpperCase = $00000001;
+ tomTitleCase = $00000002;
+ tomSentenceCase = $00000004;
+ tomToggleCase = $00000005;
+
+ tomReadOnly = $00000100;
+ tomShareDenyRead = $00000200;
+ tomShareDenyWrite = $00000400;
+ tomPasteFile = $00001000;
+
+ tomCreateNew = $00000010;
+ tomCreateAlways = $00000020;
+ tomOpenExisting = $00000030;
+ tomOpenAlways = $00000040;
+ tomTruncateExisting = $00000050;
+
+ tomRTF = $00000001;
+ tomText = $00000002;
+ tomHTML = $00000003;
+ tomWordDocument = $00000004;
+
+ tomBold = $80000001;
+ tomItalic = $80000002;
+ tomUnderline = $80000004;
+ tomStrikeout = $80000008;
+ tomProtected = $80000010;
+ tomLink = $80000020;
+ tomSmallCaps = $80000040;
+ tomAllCaps = $80000080;
+ tomHidden = $80000100;
+ tomOutline = $80000200;
+ tomShadow = $80000400;
+ tomEmboss = $80000800;
+ tomImprint = $80001000;
+ tomDisabled = $80002000;
+ tomRevised = $80004000;
+
+ tomNormalCaret = $00000000;
+ tomKoreanBlockCaret = $00000001;
+ tomIncludeInset = $00000001;
+ tomIgnoreCurrentFont = $00000000;
+ tomMatchFontCharset = $00000001;
+ tomMatchFontSignature = $00000002;
+ tomCharset = $80000000;
+ tomRE10Mode = $00000001;
+ tomUseAtFont = $00000002;
+
+ tomTextFlowMask = $0000000C;
+ tomTextFlowES = $00000000;
+ tomTextFlowSW = $00000004;
+ tomTextFlowWN = $00000008;
+ tomTextFlowNE = $0000000C;
+
+ tomUsePassword = $00000010;
+
+ tomNoIME = $00080000;
+ tomSelfIME = $00040000;
+
+type
+ ITextDocument = interface;
+ ITextDocumentDisp = dispinterface;
+ ITextRange = interface;
+ ITextRangeDisp = dispinterface;
+ ITextSelection = interface;
+ ITextSelectionDisp = dispinterface;
+ ITextFont = interface;
+ ITextFontDisp = dispinterface;
+ ITextPara = interface;
+ ITextParaDisp = dispinterface;
+ ITextStoryRanges = interface;
+ ITextStoryRangesDisp = dispinterface;
+ ITextDocument2 = interface;
+ ITextDocument2Disp = dispinterface;
+ ITextMsgFilter = interface;
+
+// *********************************************************************//
+// Interface: ITextDocument
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C0-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextDocument = interface(IDispatch)
+ ['{8CC497C0-A1DF-11CE-8098-00AA0047BE5D}']
+ function Get_Name: WideString; safecall;
+ function Get_Selection: ITextSelection; safecall;
+ function Get_StoryCount: Integer; safecall;
+ function Get_StoryRanges: ITextStoryRanges; safecall;
+ function Get_Saved: Integer; safecall;
+ procedure Set_Saved(pValue: Integer); safecall;
+ function Get_DefaultTabStop: Single; safecall;
+ procedure Set_DefaultTabStop(pValue: Single); safecall;
+ procedure New; safecall;
+ procedure Open(var pVar: OleVariant; Flags: Integer; CodePage: Integer); safecall;
+ procedure Save(var pVar: OleVariant; Flags: Integer; CodePage: Integer); safecall;
+ function Freeze: Integer; safecall;
+ function Unfreeze: Integer; safecall;
+ procedure BeginEditCollection; safecall;
+ procedure EndEditCollection; safecall;
+ function Undo(Count: Integer): Integer; safecall;
+ function Redo(Count: Integer): Integer; safecall;
+ function Range(cp1: Integer; cp2: Integer): ITextRange; safecall;
+ function RangeFromPoint(x: Integer; y: Integer): ITextRange; safecall;
+ property Name: WideString read Get_Name;
+ property Selection: ITextSelection read Get_Selection;
+ property StoryCount: Integer read Get_StoryCount;
+ property StoryRanges: ITextStoryRanges read Get_StoryRanges;
+ property Saved: Integer read Get_Saved write Set_Saved;
+ property DefaultTabStop: Single read Get_DefaultTabStop write Set_DefaultTabStop;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextDocumentDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C0-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextDocumentDisp = dispinterface
+ ['{8CC497C0-A1DF-11CE-8098-00AA0047BE5D}']
+ property Name: WideString readonly dispid 0;
+ property Selection: ITextSelection readonly dispid 1;
+ property StoryCount: Integer readonly dispid 2;
+ property StoryRanges: ITextStoryRanges readonly dispid 3;
+ property Saved: Integer dispid 4;
+ property DefaultTabStop: Single dispid 5;
+ procedure New; dispid 6;
+ procedure Open(var pVar: OleVariant; Flags: Integer; CodePage: Integer); dispid 7;
+ procedure Save(var pVar: OleVariant; Flags: Integer; CodePage: Integer); dispid 8;
+ function Freeze: Integer; dispid 9;
+ function Unfreeze: Integer; dispid 10;
+ procedure BeginEditCollection; dispid 11;
+ procedure EndEditCollection; dispid 12;
+ function Undo(Count: Integer): Integer; dispid 13;
+ function Redo(Count: Integer): Integer; dispid 14;
+ function Range(cp1: Integer; cp2: Integer): ITextRange; dispid 15;
+ function RangeFromPoint(x: Integer; y: Integer): ITextRange; dispid 16;
+ end;
+
+// *********************************************************************//
+// Interface: ITextRange
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C2-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextRange = interface(IDispatch)
+ ['{8CC497C2-A1DF-11CE-8098-00AA0047BE5D}']
+ function Get_Text: WideString; safecall;
+ procedure Set_Text(const pbstr: WideString); safecall;
+ function Get_Char: Integer; safecall;
+ procedure Set_Char(pch: Integer); safecall;
+ function Get_Duplicate: ITextRange; safecall;
+ function Get_FormattedText: ITextRange; safecall;
+ procedure Set_FormattedText(const ppRange: ITextRange); safecall;
+ function Get_Start: Integer; safecall;
+ procedure Set_Start(pcpFirst: Integer); safecall;
+ function Get_End_: Integer; safecall;
+ procedure Set_End_(pcpLim: Integer); safecall;
+ function Get_Font: ITextFont; safecall;
+ procedure Set_Font(const pFont: ITextFont); safecall;
+ function Get_Para: ITextPara; safecall;
+ procedure Set_Para(const pPara: ITextPara); safecall;
+ function Get_StoryLength: Integer; safecall;
+ function Get_StoryType: Integer; safecall;
+ procedure Collapse(bStart: Integer); safecall;
+ function Expand(Unit_: Integer): Integer; safecall;
+ function GetIndex(Unit_: Integer): Integer; safecall;
+ procedure SetIndex(Unit_: Integer; Index: Integer; Extend: Integer); safecall;
+ procedure SetRange(cpActive: Integer; cpOther: Integer); safecall;
+ function InRange(const pRange: ITextRange): Integer; safecall;
+ function InStory(const pRange: ITextRange): Integer; safecall;
+ function IsEqual(const pRange: ITextRange): Integer; safecall;
+ procedure Select; safecall;
+ function StartOf(Unit_: Integer; Extend: Integer): Integer; safecall;
+ function EndOf(Unit_: Integer; Extend: Integer): Integer; safecall;
+ function Move(Unit_: Integer; Count: Integer): Integer; safecall;
+ function MoveStart(Unit_: Integer; Count: Integer): Integer; safecall;
+ function MoveEnd(Unit_: Integer; Count: Integer): Integer; safecall;
+ function MoveWhile(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function MoveStartWhile(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function MoveEndWhile(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function MoveUntil(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function MoveStartUntil(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function MoveEndUntil(var Cset: OleVariant; Count: Integer): Integer; safecall;
+ function FindText(const bstr: WideString; cch: Integer; Flags: Integer): Integer; safecall;
+ function FindTextStart(const bstr: WideString; cch: Integer; Flags: Integer): Integer; safecall;
+ function FindTextEnd(const bstr: WideString; cch: Integer; Flags: Integer): Integer; safecall;
+ function Delete(Unit_: Integer; Count: Integer): Integer; safecall;
+ procedure Cut(out pVar: OleVariant); safecall;
+ procedure Copy(out pVar: OleVariant); safecall;
+ procedure Paste(var pVar: OleVariant; Format: Integer); safecall;
+ function CanPaste(var pVar: OleVariant; Format: Integer): Integer; safecall;
+ function CanEdit: Integer; safecall;
+ procedure ChangeCase(Type_: Integer); safecall;
+ procedure GetPoint(Type_: Integer; out px: Integer; out py: Integer); safecall;
+ procedure SetPoint(x: Integer; y: Integer; Type_: Integer; Extend: Integer); safecall;
+ procedure ScrollIntoView(Value: Integer); safecall;
+ function GetEmbeddedObject: IUnknown; safecall;
+ property Text: WideString read Get_Text write Set_Text;
+ property Char: Integer read Get_Char write Set_Char;
+ property Duplicate: ITextRange read Get_Duplicate;
+ property FormattedText: ITextRange read Get_FormattedText write Set_FormattedText;
+ property Start: Integer read Get_Start write Set_Start;
+ property End_: Integer read Get_End_ write Set_End_;
+ property Font: ITextFont read Get_Font write Set_Font;
+ property Para: ITextPara read Get_Para write Set_Para;
+ property StoryLength: Integer read Get_StoryLength;
+ property StoryType: Integer read Get_StoryType;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextRangeDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C2-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextRangeDisp = dispinterface
+ ['{8CC497C2-A1DF-11CE-8098-00AA0047BE5D}']
+ property Text: WideString dispid 0;
+ property Char: Integer dispid 513;
+ property Duplicate: ITextRange readonly dispid 514;
+ property FormattedText: ITextRange dispid 515;
+ property Start: Integer dispid 516;
+ property End_: Integer dispid 517;
+ property Font: ITextFont dispid 518;
+ property Para: ITextPara dispid 519;
+ property StoryLength: Integer readonly dispid 520;
+ property StoryType: Integer readonly dispid 521;
+ procedure Collapse(bStart: Integer); dispid 528;
+ function Expand(Unit_: Integer): Integer; dispid 529;
+ function GetIndex(Unit_: Integer): Integer; dispid 530;
+ procedure SetIndex(Unit_: Integer; Index: Integer; Extend: Integer); dispid 531;
+ procedure SetRange(cpActive: Integer; cpOther: Integer); dispid 532;
+ function InRange(const pRange: ITextRange): Integer; dispid 533;
+ function InStory(const pRange: ITextRange): Integer; dispid 534;
+ function IsEqual(const pRange: ITextRange): Integer; dispid 535;
+ procedure Select; dispid 536;
+ function StartOf(Unit_: Integer; Extend: Integer): Integer; dispid 537;
+ function EndOf(Unit_: Integer; Extend: Integer): Integer; dispid 544;
+ function Move(Unit_: Integer; Count: Integer): Integer; dispid 545;
+ function MoveStart(Unit_: Integer; Count: Integer): Integer; dispid 546;
+ function MoveEnd(Unit_: Integer; Count: Integer): Integer; dispid 547;
+ function MoveWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 548;
+ function MoveStartWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 549;
+ function MoveEndWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 550;
+ function MoveUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 551;
+ function MoveStartUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 552;
+ function MoveEndUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 553;
+ function FindText(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 560;
+ function FindTextStart(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 561;
+ function FindTextEnd(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 562;
+ function Delete(Unit_: Integer; Count: Integer): Integer; dispid 563;
+ procedure Cut(out pVar: OleVariant); dispid 564;
+ procedure Copy(out pVar: OleVariant); dispid 565;
+ procedure Paste(var pVar: OleVariant; Format: Integer); dispid 566;
+ function CanPaste(var pVar: OleVariant; Format: Integer): Integer; dispid 567;
+ function CanEdit: Integer; dispid 568;
+ procedure ChangeCase(Type_: Integer); dispid 569;
+ procedure GetPoint(Type_: Integer; out px: Integer; out py: Integer); dispid 576;
+ procedure SetPoint(x: Integer; y: Integer; Type_: Integer; Extend: Integer); dispid 577;
+ procedure ScrollIntoView(Value: Integer); dispid 578;
+ function GetEmbeddedObject: IUnknown; dispid 579;
+ end;
+
+// *********************************************************************//
+// Interface: ITextSelection
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C1-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextSelection = interface(ITextRange)
+ ['{8CC497C1-A1DF-11CE-8098-00AA0047BE5D}']
+ function Get_Flags: Integer; safecall;
+ procedure Set_Flags(pFlags: Integer); safecall;
+ function Get_Type_: Integer; safecall;
+ function MoveLeft(Unit_: Integer; Count: Integer; Extend: Integer): Integer; safecall;
+ function MoveRight(Unit_: Integer; Count: Integer; Extend: Integer): Integer; safecall;
+ function MoveUp(Unit_: Integer; Count: Integer; Extend: Integer): Integer; safecall;
+ function MoveDown(Unit_: Integer; Count: Integer; Extend: Integer): Integer; safecall;
+ function HomeKey(Unit_: Integer; Extend: Integer): Integer; safecall;
+ function EndKey(Unit_: Integer; Extend: Integer): Integer; safecall;
+ procedure TypeText(const bstr: WideString); safecall;
+ property Flags: Integer read Get_Flags write Set_Flags;
+ property Type_: Integer read Get_Type_;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextSelectionDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C1-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextSelectionDisp = dispinterface
+ ['{8CC497C1-A1DF-11CE-8098-00AA0047BE5D}']
+ property Flags: Integer dispid 257;
+ property Type_: Integer readonly dispid 258;
+ function MoveLeft(Unit_: Integer; Count: Integer; Extend: Integer): Integer; dispid 259;
+ function MoveRight(Unit_: Integer; Count: Integer; Extend: Integer): Integer; dispid 260;
+ function MoveUp(Unit_: Integer; Count: Integer; Extend: Integer): Integer; dispid 261;
+ function MoveDown(Unit_: Integer; Count: Integer; Extend: Integer): Integer; dispid 262;
+ function HomeKey(Unit_: Integer; Extend: Integer): Integer; dispid 263;
+ function EndKey(Unit_: Integer; Extend: Integer): Integer; dispid 264;
+ procedure TypeText(const bstr: WideString); dispid 265;
+ property Text: WideString dispid 0;
+ property Char: Integer dispid 513;
+ property Duplicate: ITextRange readonly dispid 514;
+ property FormattedText: ITextRange dispid 515;
+ property Start: Integer dispid 516;
+ property End_: Integer dispid 517;
+ property Font: ITextFont dispid 518;
+ property Para: ITextPara dispid 519;
+ property StoryLength: Integer readonly dispid 520;
+ property StoryType: Integer readonly dispid 521;
+ procedure Collapse(bStart: Integer); dispid 528;
+ function Expand(Unit_: Integer): Integer; dispid 529;
+ function GetIndex(Unit_: Integer): Integer; dispid 530;
+ procedure SetIndex(Unit_: Integer; Index: Integer; Extend: Integer); dispid 531;
+ procedure SetRange(cpActive: Integer; cpOther: Integer); dispid 532;
+ function InRange(const pRange: ITextRange): Integer; dispid 533;
+ function InStory(const pRange: ITextRange): Integer; dispid 534;
+ function IsEqual(const pRange: ITextRange): Integer; dispid 535;
+ procedure Select; dispid 536;
+ function StartOf(Unit_: Integer; Extend: Integer): Integer; dispid 537;
+ function EndOf(Unit_: Integer; Extend: Integer): Integer; dispid 544;
+ function Move(Unit_: Integer; Count: Integer): Integer; dispid 545;
+ function MoveStart(Unit_: Integer; Count: Integer): Integer; dispid 546;
+ function MoveEnd(Unit_: Integer; Count: Integer): Integer; dispid 547;
+ function MoveWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 548;
+ function MoveStartWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 549;
+ function MoveEndWhile(var Cset: OleVariant; Count: Integer): Integer; dispid 550;
+ function MoveUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 551;
+ function MoveStartUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 552;
+ function MoveEndUntil(var Cset: OleVariant; Count: Integer): Integer; dispid 553;
+ function FindText(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 560;
+ function FindTextStart(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 561;
+ function FindTextEnd(const bstr: WideString; cch: Integer; Flags: Integer): Integer; dispid 562;
+ function Delete(Unit_: Integer; Count: Integer): Integer; dispid 563;
+ procedure Cut(out pVar: OleVariant); dispid 564;
+ procedure Copy(out pVar: OleVariant); dispid 565;
+ procedure Paste(var pVar: OleVariant; Format: Integer); dispid 566;
+ function CanPaste(var pVar: OleVariant; Format: Integer): Integer; dispid 567;
+ function CanEdit: Integer; dispid 568;
+ procedure ChangeCase(Type_: Integer); dispid 569;
+ procedure GetPoint(Type_: Integer; out px: Integer; out py: Integer); dispid 576;
+ procedure SetPoint(x: Integer; y: Integer; Type_: Integer; Extend: Integer); dispid 577;
+ procedure ScrollIntoView(Value: Integer); dispid 578;
+ function GetEmbeddedObject: IUnknown; dispid 579;
+ end;
+
+// *********************************************************************//
+// Interface: ITextFont
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C3-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextFont = interface(IDispatch)
+ ['{8CC497C3-A1DF-11CE-8098-00AA0047BE5D}']
+ function Get_Duplicate: ITextFont; safecall;
+ procedure Set_Duplicate(const ppFont: ITextFont); safecall;
+ function CanChange: Integer; safecall;
+ function IsEqual(const pFont: ITextFont): Integer; safecall;
+ procedure Reset(Value: Integer); safecall;
+ function Get_Style: Integer; safecall;
+ procedure Set_Style(pValue: Integer); safecall;
+ function Get_AllCaps: Integer; safecall;
+ procedure Set_AllCaps(pValue: Integer); safecall;
+ function Get_Animation: Integer; safecall;
+ procedure Set_Animation(pValue: Integer); safecall;
+ function Get_BackColor: Integer; safecall;
+ procedure Set_BackColor(pValue: Integer); safecall;
+ function Get_Bold: Integer; safecall;
+ procedure Set_Bold(pValue: Integer); safecall;
+ function Get_Emboss: Integer; safecall;
+ procedure Set_Emboss(pValue: Integer); safecall;
+ function Get_ForeColor: Integer; safecall;
+ procedure Set_ForeColor(pValue: Integer); safecall;
+ function Get_Hidden: Integer; safecall;
+ procedure Set_Hidden(pValue: Integer); safecall;
+ function Get_Engrave: Integer; safecall;
+ procedure Set_Engrave(pValue: Integer); safecall;
+ function Get_Italic: Integer; safecall;
+ procedure Set_Italic(pValue: Integer); safecall;
+ function Get_Kerning: Single; safecall;
+ procedure Set_Kerning(pValue: Single); safecall;
+ function Get_LanguageID: Integer; safecall;
+ procedure Set_LanguageID(pValue: Integer); safecall;
+ function Get_Name: WideString; safecall;
+ procedure Set_Name(const pbstr: WideString); safecall;
+ function Get_Outline: Integer; safecall;
+ procedure Set_Outline(pValue: Integer); safecall;
+ function Get_Position: Single; safecall;
+ procedure Set_Position(pValue: Single); safecall;
+ function Get_Protected_: Integer; safecall;
+ procedure Set_Protected_(pValue: Integer); safecall;
+ function Get_Shadow: Integer; safecall;
+ procedure Set_Shadow(pValue: Integer); safecall;
+ function Get_Size: Single; safecall;
+ procedure Set_Size(pValue: Single); safecall;
+ function Get_SmallCaps: Integer; safecall;
+ procedure Set_SmallCaps(pValue: Integer); safecall;
+ function Get_Spacing: Single; safecall;
+ procedure Set_Spacing(pValue: Single); safecall;
+ function Get_StrikeThrough: Integer; safecall;
+ procedure Set_StrikeThrough(pValue: Integer); safecall;
+ function Get_Subscript: Integer; safecall;
+ procedure Set_Subscript(pValue: Integer); safecall;
+ function Get_Superscript: Integer; safecall;
+ procedure Set_Superscript(pValue: Integer); safecall;
+ function Get_Underline: Integer; safecall;
+ procedure Set_Underline(pValue: Integer); safecall;
+ function Get_Weight: Integer; safecall;
+ procedure Set_Weight(pValue: Integer); safecall;
+ property Duplicate: ITextFont read Get_Duplicate write Set_Duplicate;
+ property Style: Integer read Get_Style write Set_Style;
+ property AllCaps: Integer read Get_AllCaps write Set_AllCaps;
+ property Animation: Integer read Get_Animation write Set_Animation;
+ property BackColor: Integer read Get_BackColor write Set_BackColor;
+ property Bold: Integer read Get_Bold write Set_Bold;
+ property Emboss: Integer read Get_Emboss write Set_Emboss;
+ property ForeColor: Integer read Get_ForeColor write Set_ForeColor;
+ property Hidden: Integer read Get_Hidden write Set_Hidden;
+ property Engrave: Integer read Get_Engrave write Set_Engrave;
+ property Italic: Integer read Get_Italic write Set_Italic;
+ property Kerning: Single read Get_Kerning write Set_Kerning;
+ property LanguageID: Integer read Get_LanguageID write Set_LanguageID;
+ property Name: WideString read Get_Name write Set_Name;
+ property Outline: Integer read Get_Outline write Set_Outline;
+ property Position: Single read Get_Position write Set_Position;
+ property Protected_: Integer read Get_Protected_ write Set_Protected_;
+ property Shadow: Integer read Get_Shadow write Set_Shadow;
+ property Size: Single read Get_Size write Set_Size;
+ property SmallCaps: Integer read Get_SmallCaps write Set_SmallCaps;
+ property Spacing: Single read Get_Spacing write Set_Spacing;
+ property StrikeThrough: Integer read Get_StrikeThrough write Set_StrikeThrough;
+ property Subscript: Integer read Get_Subscript write Set_Subscript;
+ property Superscript: Integer read Get_Superscript write Set_Superscript;
+ property Underline: Integer read Get_Underline write Set_Underline;
+ property Weight: Integer read Get_Weight write Set_Weight;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextFontDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C3-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextFontDisp = dispinterface
+ ['{8CC497C3-A1DF-11CE-8098-00AA0047BE5D}']
+ property Duplicate: ITextFont dispid 0;
+ function CanChange: Integer; dispid 769;
+ function IsEqual(const pFont: ITextFont): Integer; dispid 770;
+ procedure Reset(Value: Integer); dispid 771;
+ property Style: Integer dispid 772;
+ property AllCaps: Integer dispid 773;
+ property Animation: Integer dispid 774;
+ property BackColor: Integer dispid 775;
+ property Bold: Integer dispid 776;
+ property Emboss: Integer dispid 777;
+ property ForeColor: Integer dispid 784;
+ property Hidden: Integer dispid 785;
+ property Engrave: Integer dispid 786;
+ property Italic: Integer dispid 787;
+ property Kerning: Single dispid 788;
+ property LanguageID: Integer dispid 789;
+ property Name: WideString dispid 790;
+ property Outline: Integer dispid 791;
+ property Position: Single dispid 792;
+ property Protected_: Integer dispid 793;
+ property Shadow: Integer dispid 800;
+ property Size: Single dispid 801;
+ property SmallCaps: Integer dispid 802;
+ property Spacing: Single dispid 803;
+ property StrikeThrough: Integer dispid 804;
+ property Subscript: Integer dispid 805;
+ property Superscript: Integer dispid 806;
+ property Underline: Integer dispid 807;
+ property Weight: Integer dispid 808;
+ end;
+
+// *********************************************************************//
+// Interface: ITextPara
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C4-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextPara = interface(IDispatch)
+ ['{8CC497C4-A1DF-11CE-8098-00AA0047BE5D}']
+ function Get_Duplicate: ITextPara; safecall;
+ procedure Set_Duplicate(const ppPara: ITextPara); safecall;
+ function CanChange: Integer; safecall;
+ function IsEqual(const pPara: ITextPara): Integer; safecall;
+ procedure Reset(Value: Integer); safecall;
+ function Get_Style: Integer; safecall;
+ procedure Set_Style(pValue: Integer); safecall;
+ function Get_Alignment: Integer; safecall;
+ procedure Set_Alignment(pValue: Integer); safecall;
+ function Get_Hyphenation: Integer; safecall;
+ procedure Set_Hyphenation(pValue: Integer); safecall;
+ function Get_FirstLineIndent: Single; safecall;
+ function Get_KeepTogether: Integer; safecall;
+ procedure Set_KeepTogether(pValue: Integer); safecall;
+ function Get_KeepWithNext: Integer; safecall;
+ procedure Set_KeepWithNext(pValue: Integer); safecall;
+ function Get_LeftIndent: Single; safecall;
+ function Get_LineSpacing: Single; safecall;
+ function Get_LineSpacingRule: Integer; safecall;
+ function Get_ListAlignment: Integer; safecall;
+ procedure Set_ListAlignment(pValue: Integer); safecall;
+ function Get_ListLevelIndex: Integer; safecall;
+ procedure Set_ListLevelIndex(pValue: Integer); safecall;
+ function Get_ListStart: Integer; safecall;
+ procedure Set_ListStart(pValue: Integer); safecall;
+ function Get_ListTab: Single; safecall;
+ procedure Set_ListTab(pValue: Single); safecall;
+ function Get_ListType: Integer; safecall;
+ procedure Set_ListType(pValue: Integer); safecall;
+ function Get_NoLineNumber: Integer; safecall;
+ procedure Set_NoLineNumber(pValue: Integer); safecall;
+ function Get_PageBreakBefore: Integer; safecall;
+ procedure Set_PageBreakBefore(pValue: Integer); safecall;
+ function Get_RightIndent: Single; safecall;
+ procedure Set_RightIndent(pValue: Single); safecall;
+ procedure SetIndents(StartIndent: Single; LeftIndent: Single; RightIndent: Single); safecall;
+ procedure SetLineSpacing(LineSpacingRule: Integer; LineSpacing: Single); safecall;
+ function Get_SpaceAfter: Single; safecall;
+ procedure Set_SpaceAfter(pValue: Single); safecall;
+ function Get_SpaceBefore: Single; safecall;
+ procedure Set_SpaceBefore(pValue: Single); safecall;
+ function Get_WidowControl: Integer; safecall;
+ procedure Set_WidowControl(pValue: Integer); safecall;
+ function Get_TabCount: Integer; safecall;
+ procedure AddTab(tbPos: Single; tbAlign: Integer; tbLeader: Integer); safecall;
+ procedure ClearAllTabs; safecall;
+ procedure DeleteTab(tbPos: Single); safecall;
+ procedure GetTab(iTab: Integer; out ptbPos: Single; out ptbAlign: Integer;
+ out ptbLeader: Integer); safecall;
+ property Duplicate: ITextPara read Get_Duplicate write Set_Duplicate;
+ property Style: Integer read Get_Style write Set_Style;
+ property Alignment: Integer read Get_Alignment write Set_Alignment;
+ property Hyphenation: Integer read Get_Hyphenation write Set_Hyphenation;
+ property FirstLineIndent: Single read Get_FirstLineIndent;
+ property KeepTogether: Integer read Get_KeepTogether write Set_KeepTogether;
+ property KeepWithNext: Integer read Get_KeepWithNext write Set_KeepWithNext;
+ property LeftIndent: Single read Get_LeftIndent;
+ property LineSpacing: Single read Get_LineSpacing;
+ property LineSpacingRule: Integer read Get_LineSpacingRule;
+ property ListAlignment: Integer read Get_ListAlignment write Set_ListAlignment;
+ property ListLevelIndex: Integer read Get_ListLevelIndex write Set_ListLevelIndex;
+ property ListStart: Integer read Get_ListStart write Set_ListStart;
+ property ListTab: Single read Get_ListTab write Set_ListTab;
+ property ListType: Integer read Get_ListType write Set_ListType;
+ property NoLineNumber: Integer read Get_NoLineNumber write Set_NoLineNumber;
+ property PageBreakBefore: Integer read Get_PageBreakBefore write Set_PageBreakBefore;
+ property RightIndent: Single read Get_RightIndent write Set_RightIndent;
+ property SpaceAfter: Single read Get_SpaceAfter write Set_SpaceAfter;
+ property SpaceBefore: Single read Get_SpaceBefore write Set_SpaceBefore;
+ property WidowControl: Integer read Get_WidowControl write Set_WidowControl;
+ property TabCount: Integer read Get_TabCount;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextParaDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C4-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextParaDisp = dispinterface
+ ['{8CC497C4-A1DF-11CE-8098-00AA0047BE5D}']
+ property Duplicate: ITextPara dispid 0;
+ function CanChange: Integer; dispid 1025;
+ function IsEqual(const pPara: ITextPara): Integer; dispid 1026;
+ procedure Reset(Value: Integer); dispid 1027;
+ property Style: Integer dispid 1028;
+ property Alignment: Integer dispid 1029;
+ property Hyphenation: Integer dispid 1030;
+ property FirstLineIndent: Single readonly dispid 1031;
+ property KeepTogether: Integer dispid 1032;
+ property KeepWithNext: Integer dispid 1033;
+ property LeftIndent: Single readonly dispid 1040;
+ property LineSpacing: Single readonly dispid 1041;
+ property LineSpacingRule: Integer readonly dispid 1042;
+ property ListAlignment: Integer dispid 1043;
+ property ListLevelIndex: Integer dispid 1044;
+ property ListStart: Integer dispid 1045;
+ property ListTab: Single dispid 1046;
+ property ListType: Integer dispid 1047;
+ property NoLineNumber: Integer dispid 1048;
+ property PageBreakBefore: Integer dispid 1049;
+ property RightIndent: Single dispid 1056;
+ procedure SetIndents(StartIndent: Single; LeftIndent: Single; RightIndent: Single); dispid 1057;
+ procedure SetLineSpacing(LineSpacingRule: Integer; LineSpacing: Single); dispid 1058;
+ property SpaceAfter: Single dispid 1059;
+ property SpaceBefore: Single dispid 1060;
+ property WidowControl: Integer dispid 1061;
+ property TabCount: Integer readonly dispid 1062;
+ procedure AddTab(tbPos: Single; tbAlign: Integer; tbLeader: Integer); dispid 1063;
+ procedure ClearAllTabs; dispid 1064;
+ procedure DeleteTab(tbPos: Single); dispid 1065;
+ procedure GetTab(iTab: Integer; out ptbPos: Single; out ptbAlign: Integer;
+ out ptbLeader: Integer); dispid 1072;
+ end;
+
+// *********************************************************************//
+// Interface: ITextStoryRanges
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C5-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextStoryRanges = interface(IDispatch)
+ ['{8CC497C5-A1DF-11CE-8098-00AA0047BE5D}']
+ function _NewEnum: IUnknown; safecall;
+ function Item(Index: Integer): ITextRange; safecall;
+ function Get_Count: Integer; safecall;
+ property Count: Integer read Get_Count;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextStoryRangesDisp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {8CC497C5-A1DF-11CE-8098-00AA0047BE5D}
+// *********************************************************************//
+ ITextStoryRangesDisp = dispinterface
+ ['{8CC497C5-A1DF-11CE-8098-00AA0047BE5D}']
+ function _NewEnum: IUnknown; dispid -4;
+ function Item(Index: Integer): ITextRange; dispid 0;
+ property Count: Integer readonly dispid 2;
+ end;
+
+// *********************************************************************//
+// Interface: ITextDocument2
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {01C25500-4268-11D1-883A-3C8B00C10000}
+// *********************************************************************//
+ ITextDocument2 = interface(ITextDocument)
+ ['{01C25500-4268-11D1-883A-3C8B00C10000}']
+ procedure AttachMsgFilter(const pFilter: IUnknown); safecall;
+ procedure SetEffectColor(Index: Integer; cr: LongWord); safecall;
+ procedure GetEffectColor(Index: Integer; out pcr: LongWord); safecall;
+ function Get_CaretType: Integer; safecall;
+ procedure Set_CaretType(pCaretType: Integer); safecall;
+ function GetImmContext: Integer; safecall;
+ procedure ReleaseImmContext(Context: Integer); safecall;
+ procedure GetPreferredFont(cp: Integer; CodePage: Integer; Option: Integer;
+ curCodepage: Integer; curFontSize: Integer; out pbstr: WideString;
+ out pPitchAndFamily: Integer; out pNewFontSize: Integer); safecall;
+ function Get_NotificationMode: Integer; safecall;
+ procedure Set_NotificationMode(pMode: Integer); safecall;
+ procedure GetClientRect(Type_: Integer; out pLeft: Integer; out pTop: Integer;
+ out pRight: Integer; out pBottom: Integer); safecall;
+ function Get_SelectionEx: ITextSelection; safecall;
+ procedure GetWindow(out phWnd: Integer); safecall;
+ procedure GetFEFlags(out pFlags: Integer); safecall;
+ procedure UpdateWindow; safecall;
+ procedure CheckTextLimit(cch: Integer; var pcch: Integer); safecall;
+ procedure IMEInProgress(Mode: Integer); safecall;
+ procedure SysBeep; safecall;
+ procedure Update(Mode: Integer); safecall;
+ procedure Notify(Notify: Integer); safecall;
+ function GetDocumentFont: ITextFont; safecall;
+ function GetDocumentPara: ITextPara; safecall;
+ function GetCallManager: IUnknown; safecall;
+ procedure ReleaseCallManager(const pVoid: IUnknown); safecall;
+ property CaretType: Integer read Get_CaretType write Set_CaretType;
+ property NotificationMode: Integer read Get_NotificationMode write Set_NotificationMode;
+ property SelectionEx: ITextSelection read Get_SelectionEx;
+ end;
+
+// *********************************************************************//
+// DispIntf: ITextDocument2Disp
+// Flags: (4544) Dual NonExtensible OleAutomation Dispatchable
+// GUID: {01C25500-4268-11D1-883A-3C8B00C10000}
+// *********************************************************************//
+ ITextDocument2Disp = dispinterface
+ ['{01C25500-4268-11D1-883A-3C8B00C10000}']
+ procedure AttachMsgFilter(const pFilter: IUnknown); dispid 21;
+ procedure SetEffectColor(Index: Integer; cr: LongWord); dispid 22;
+ procedure GetEffectColor(Index: Integer; out pcr: LongWord); dispid 23;
+ property CaretType: Integer dispid 24;
+ function GetImmContext: Integer; dispid 25;
+ procedure ReleaseImmContext(Context: Integer); dispid 26;
+ procedure GetPreferredFont(cp: Integer; CodePage: Integer; Option: Integer;
+ curCodepage: Integer; curFontSize: Integer; out pbstr: WideString;
+ out pPitchAndFamily: Integer; out pNewFontSize: Integer); dispid 27;
+ property NotificationMode: Integer dispid 28;
+ procedure GetClientRect(Type_: Integer; out pLeft: Integer; out pTop: Integer;
+ out pRight: Integer; out pBottom: Integer); dispid 29;
+ property SelectionEx: ITextSelection readonly dispid 30;
+ procedure GetWindow(out phWnd: Integer); dispid 31;
+ procedure GetFEFlags(out pFlags: Integer); dispid 32;
+ procedure UpdateWindow; dispid 33;
+ procedure CheckTextLimit(cch: Integer; var pcch: Integer); dispid 34;
+ procedure IMEInProgress(Mode: Integer); dispid 35;
+ procedure SysBeep; dispid 36;
+ procedure Update(Mode: Integer); dispid 37;
+ procedure Notify(Notify: Integer); dispid 38;
+ function GetDocumentFont: ITextFont; dispid 39;
+ function GetDocumentPara: ITextPara; dispid 40;
+ function GetCallManager: IUnknown; dispid 41;
+ procedure ReleaseCallManager(const pVoid: IUnknown); dispid 42;
+ property Name: WideString readonly dispid 0;
+ property Selection: ITextSelection readonly dispid 1;
+ property StoryCount: Integer readonly dispid 2;
+ property StoryRanges: ITextStoryRanges readonly dispid 3;
+ property Saved: Integer dispid 4;
+ property DefaultTabStop: Single dispid 5;
+ procedure New; dispid 6;
+ procedure Open(var pVar: OleVariant; Flags: Integer; CodePage: Integer); dispid 7;
+ procedure Save(var pVar: OleVariant; Flags: Integer; CodePage: Integer); dispid 8;
+ function Freeze: Integer; dispid 9;
+ function Unfreeze: Integer; dispid 10;
+ procedure BeginEditCollection; dispid 11;
+ procedure EndEditCollection; dispid 12;
+ function Undo(Count: Integer): Integer; dispid 13;
+ function Redo(Count: Integer): Integer; dispid 14;
+ function Range(cp1: Integer; cp2: Integer): ITextRange; dispid 15;
+ function RangeFromPoint(x: Integer; y: Integer): ITextRange; dispid 16;
+ end;
+
+// *********************************************************************//
+// Interface: ITextMsgFilter
+// Flags: (128) NonExtensible
+// GUID: {A3787420-4267-11D1-883A-3C8B00C10000}
+// *********************************************************************//
+ ITextMsgFilter = interface(IUnknown)
+ ['{A3787420-4267-11D1-883A-3C8B00C10000}']
+ function AttachDocument(var hwnd: TGUID; const pTextDoc: ITextDocument2; const punk: IUnknown): HResult; stdcall;
+ function HandleMessage(var pmsg: SYSUINT; var pwparam: UINT_PTR; var plparam: LONG_PTR;
+ out plres: LONG_PTR): HResult; stdcall;
+ function AttachMsgFilter(const pMsgFilter: ITextMsgFilter): HResult; stdcall;
+ end;
+
+
+implementation
+
+end.
diff --git a/plugins/Watrack/docs/sampledll.dpr b/plugins/Watrack/docs/sampledll.dpr
index 908fe60597..d9c6839060 100644
--- a/plugins/Watrack/docs/sampledll.dpr
+++ b/plugins/Watrack/docs/sampledll.dpr
@@ -16,11 +16,8 @@ const
copyright :'(c) 2003 J. Random Hacker';
homepage :'http://miranda-icq.sourceforge.net/';
flags :UNICODE_AWARE;
- replacesDefaultModule:0;
uuid:'{00000000-0000-0000-0000-000000000000}'
);
-var
- PluginInterfaces:array [0..1] of MUUID;
var
hook:integer;
@@ -58,7 +55,19 @@ end;
function GetInfo(var SongInfo:tSongInfo;flags:integer):integer;cdecl;
begin
PluginLink^.CallService(MS_WAT_WINAMPINFO,integer(@SongInfo),flags);
- SongInfo.plyver:=$1234;
+ // static player data
+ if (flags and WAT_OPT_PLAYERDATA)<>0 then
+ begin
+ SongInfo.plyver:=$1234;
+ end
+ // changing during playing data
+ else if (flags and WAT_OPT_CHANGES)<>0 then
+ begin
+ end
+ // track info static data
+ else
+ begin
+ end;
result:=0;
end;
@@ -98,13 +107,13 @@ begin
result:=0;
end;
-function MirandaPluginInfo(mirandaVersion:DWORD):PPLUGININFO; cdecl;
+function MirandaPluginInfo(mirandaVersion:dword):PPLUGININFO; cdecl;
begin
result:=@PluginInfo;
PluginInfo.cbSize:=SizeOf(TPLUGININFO);
end;
-function MirandaPluginInfoEx(mirandaVersion:DWORD):PPLUGININFOEX; cdecl;
+function MirandaPluginInfoEx(mirandaVersion:dword):PPLUGININFOEX; cdecl;
begin
result:=@PluginInfo;
PluginInfo.cbSize:=SizeOf(TPLUGININFOEX);
@@ -112,7 +121,7 @@ end;
function Load(link: PPLUGINLINK): int; cdecl;
begin
- PLUGINLINK := Pointer(link);
+ PLUGINLINK := pointer(link);
InitMMI;
Result:=0;
hook:=HookEvent(ME_SYSTEM_MODULESLOADED,@OnModuleLoaded);
@@ -123,17 +132,9 @@ begin
Result:=0;
end;
-function MirandaPluginInterfaces:PMUUID; cdecl;
-begin
- PluginInterfaces[0]:=PluginInfo.uuid;
- PluginInterfaces[1]:=MIID_LAST;
- result:=@PluginInterfaces;
-end;
-
exports
Load, Unload,
- MirandaPluginInfo
- ,MirandaPluginInterfaces,MirandaPluginInfoEx;
+ MirandaPluginInfoEx;
begin
end.
diff --git a/plugins/Watrack/myshows/i_myshows_api.inc b/plugins/Watrack/myshows/i_myshows_api.inc
index 5290620b1c..6341793016 100644
--- a/plugins/Watrack/myshows/i_myshows_api.inc
+++ b/plugins/Watrack/myshows/i_myshows_api.inc
@@ -208,7 +208,7 @@ begin
end;
}
//!! add option to show it??
- if ServiceExists(MS_POPUP_SHOWMESSAGE)<>0 then
+ if ServiceExists(MS_POPUP_SHOWMESSAGEW)<>0 then
begin
json_free(shId);
json_free(epId);
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas
index ec7c9bc84e..60ea40031c 100644
--- a/plugins/Watrack/proto/proto.pas
+++ b/plugins/Watrack/proto/proto.pas
@@ -7,7 +7,7 @@ implementation
uses
windows,messages,commctrl,
- common,m_api,mirutils,dbsettings,wrapper,
+ common,m_api,mirutils,mircontacts,dbsettings,wrapper,
global,wat_api;
{$include i_proto_rc.inc}
diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas
index 6348ecbb72..7eef03bb14 100644
--- a/plugins/Watrack/status/status.pas
+++ b/plugins/Watrack/status/status.pas
@@ -7,7 +7,7 @@ implementation
uses
windows,messages,commctrl,
- common,m_api,mirutils,protocols,dbsettings,wrapper,
+ common,m_api,mirutils,mircontacts,protocols,dbsettings,wrapper,
global,wat_api,hlpdlg,CBEx,myRTF,Tmpl;
const
diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr
index 64128af477..7bd1de326b 100644
--- a/plugins/Watrack/watrack.dpr
+++ b/plugins/Watrack/watrack.dpr
@@ -549,6 +549,7 @@ begin
dbetd.textService:=nil;
dbetd.iconService:=nil;
p:='WATrack_Info';
+ dbetd.eventIcon :=CallService(MS_SKIN2_GETICON,0,tlparam(p)); //!! from popups
for i:=0 to HIGH(cdbetd) do
begin
diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr
index e20e020ffc..de83095d63 100644
--- a/plugins/mRadio/mradio.dpr
+++ b/plugins/mRadio/mradio.dpr
@@ -12,7 +12,7 @@ uses
Windows,messages,commctrl
,common,io,wrapper,wrapdlgs,syswin
,Dynamic_Bass
- ,m_api,dbsettings,mirutils,memini,
+ ,m_api,dbsettings,mirutils,mircontacts,memini,
rbass,rglobal,rccenter,rframeapi,roptions;
{$include mr_rc.inc}
diff --git a/plugins/mRadio/rbass.pas b/plugins/mRadio/rbass.pas
index 5380c39959..dcf90f118d 100644
--- a/plugins/mRadio/rbass.pas
+++ b/plugins/mRadio/rbass.pas
@@ -17,10 +17,10 @@ procedure EQ_OFF;
procedure SetSndVol(arg:integer);
procedure SetBassConfig;
-procedure MyFreeBASS;
-function MyInitBASS:bool;
+procedure MyFreeBass;
+function MyInitBass:bool;
procedure MyUnloadBass;
-function MyLoadBASS:bool;
+function MyLoadBass:bool;
function CheckBassStatus:bool;
implementation
@@ -281,7 +281,7 @@ begin
MyFreeBASS;
if BassStatus=rbs_load then
begin
- mFreeMem(Proxy);
+ mFreeMem(proxy);
BASS_PluginFree(0);
Unload_BASSDLL;
@@ -423,7 +423,7 @@ begin
begin
SetBassConfig;
- mFreeMem(Proxy);
+ mFreeMem(proxy);
proxy:=GetProxy(hNetLib);
BASS_SetConfigPtr(BASS_CONFIG_NET_PROXY,proxy);
end;
diff --git a/plugins/mRadio/rccenter.pas b/plugins/mRadio/rccenter.pas
index ac8c762228..2b8f48b1a7 100644
--- a/plugins/mRadio/rccenter.pas
+++ b/plugins/mRadio/rccenter.pas
@@ -12,7 +12,7 @@ implementation
uses
common,
- dbsettings, playlist, mirutils,
+ dbsettings, playlist, mirutils, mircontacts,
rglobal, rbass,
Dynamic_Bass,
syswin;
diff --git a/plugins/mRadio/roptions.pas b/plugins/mRadio/roptions.pas
index e25cba52b0..2932dbbcbd 100644
--- a/plugins/mRadio/roptions.pas
+++ b/plugins/mRadio/roptions.pas
@@ -28,7 +28,7 @@ implementation
uses
windows,
- common,dbsettings,mirutils,m_api,
+ common,dbsettings,mircontacts,m_api,
rglobal;
const