From 34353afa23f23d9bc3470896248b8c387465a4b2 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Mon, 10 Feb 2014 17:25:36 +0000 Subject: Miranda API sync with small compilation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@8083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_avatars.inc | 18 +- include/delphi/m_chat.inc | 20 +- include/delphi/m_clist.inc | 14 +- include/delphi/m_clistint.inc | 36 +- include/delphi/m_contacts.inc | 2 +- include/delphi/m_core.inc | 97 ++-- include/delphi/m_database.inc | 4 +- include/delphi/m_db_int.inc | 2 +- include/delphi/m_extraicons.inc | 8 +- include/delphi/m_helpers.inc | 65 +-- include/delphi/m_message.inc | 40 +- include/delphi/m_msg_buttonsbar.inc | 2 +- include/delphi/m_popup.inc | 8 +- include/delphi/m_protocols.inc | 28 +- include/delphi/m_protoint.inc | 133 +++++- include/delphi/m_timezones.inc | 32 +- include/delphi/m_utils.inc | 6 +- plugins/Actman30/actman30.dpr | 2 +- plugins/Actman30/hooks/i_opt_dlg.inc | 13 +- plugins/Actman30/i_cnst_service.inc | 12 - plugins/Actman30/i_opt_dlg.inc | 2 +- plugins/Actman30/i_opt_dlg2.inc | 2 +- plugins/Actman30/i_sparam_const.inc | 10 - plugins/Actman30/iac_call.pas | 20 +- plugins/Actman30/iac_contact.pas | 2 +- plugins/Actman30/iac_contact.rc | 2 +- plugins/Actman30/iac_dbrw.pas | 4 +- plugins/Actman30/iac_global.pas | 101 ++-- plugins/Actman30/iac_inout.pas | 2 +- plugins/Actman30/iac_service.pas | 509 ++------------------- plugins/Actman30/iac_service.rc | 21 - plugins/Actman30/services.ini | 23 +- plugins/Actman30/sparam.pas | 708 ----------------------------- plugins/Actman30/sparam.rc | 27 -- plugins/Actman30/tasks/i_opt_dlg.inc | 7 +- plugins/Actman30/ua/i_opt_dlg.inc | 4 +- plugins/Actman30/ua/i_uaplaces.inc | 2 +- plugins/ExternalAPI/delphi/m_smileyadd.inc | 66 ++- plugins/ExternalAPI/delphi/m_tipper.inc | 2 +- plugins/ExternalAPI/delphi/m_variables.inc | 9 +- plugins/QuickSearch/i_ok.inc | 6 +- plugins/QuickSearch/sr_window.pas | 22 +- plugins/Utils.pas/contact.pas | 10 +- plugins/Utils.pas/dbsettings.pas | 93 ++-- plugins/Utils.pas/editwrapper.pas | 4 +- plugins/Utils.pas/mirutils.pas | 98 ++-- plugins/Utils.pas/sparam.pas | 8 +- plugins/Utils.pas/structopts.rc | 5 +- plugins/Utils.pas/structopts.res | Bin 6324 -> 6384 bytes plugins/Utils.pas/wrapper.pas | 4 +- plugins/Watrack/proto/proto.pas | 10 +- plugins/Watrack/watrack.dpr | 4 +- plugins/mRadio/i_myservice.inc | 8 +- plugins/mRadio/i_search.inc | 2 +- plugins/mRadio/i_service.inc | 4 +- plugins/mRadio/rccenter.pas | 4 +- plugins/mRadio/rframeapi.pas | 2 +- plugins/mRadio/rglobal.pas | 9 +- 58 files changed, 641 insertions(+), 1717 deletions(-) delete mode 100644 plugins/Actman30/i_cnst_service.inc delete mode 100644 plugins/Actman30/i_sparam_const.inc delete mode 100644 plugins/Actman30/sparam.pas delete mode 100644 plugins/Actman30/sparam.rc diff --git a/include/delphi/m_avatars.inc b/include/delphi/m_avatars.inc index 74526af386..dc203c110b 100644 --- a/include/delphi/m_avatars.inc +++ b/include/delphi/m_avatars.inc @@ -71,7 +71,7 @@ type PavatarCacheEntryW = ^TavatarCacheEntryW; TavatarCacheEntryW = record cbSize : DWORD; // set to sizeof(struct) - hContact : THANDLE; // contacts handle, 0, if it is a protocol avatar + hContact : HCONTACT; // contacts handle, 0, if it is a protocol avatar hbmPic : HBITMAP; // bitmap handle of the picture itself dwFlags : DWORD; // see above for flag values bmHeight : long; // bitmap dimensions @@ -86,7 +86,7 @@ type PavatarCacheEntry = ^TavatarCacheEntry; TavatarCacheEntry = record cbSize : DWORD; // set to sizeof(struct) - hContact : THANDLE; // contacts handle, 0, if it is a protocol avatar + hContact : HCONTACT; // contacts handle, 0, if it is a protocol avatar hbmPic : HBITMAP; // bitmap handle of the picture itself dwFlags : DWORD; // see above for flag values bmHeight : long; // bitmap dimensions @@ -120,7 +120,7 @@ type TavatarDrawRequest = record cbSize : DWORD; // set this to sizeof(AVATARDRAWREQUEST) - mandatory, // service will return failure code if cbSize is wrong - hContact : THANDLE; // the contact for which the avatar should be drawn. + hContact : HCONTACT; // the contact for which the avatar should be drawn. // set it to 0 to draw a protocol picture hTargetDC : HDC; // target device context rcDraw : TRECT; // target rectangle. The avatar will be centered @@ -242,17 +242,17 @@ const type TContactAvatarChangedNotificationW = record - cbSize :int; // sizeof() - hContact:THANDLE; // this might have to be set by the caller too - format :int; // PA_FORMAT_* + cbSize :int; // sizeof() + hContact:HCONTACT; // this might have to be set by the caller too + format :int; // PA_FORMAT_* filename:array [0..MAX_PATH-1] of WideChar; // full path to filename which contains the avatar hash :array [0..127] of WideChar; // avatar hash (always an empty string by now) end; TContactAvatarChangedNotification = record - cbSize :int; // sizeof() - hContact:THANDLE; // this might have to be set by the caller too - format :int; // PA_FORMAT_* + cbSize :int; // sizeof() + hContact:HCONTACT; // this might have to be set by the caller too + format :int; // PA_FORMAT_* filename:array [0..MAX_PATH-1] of AnsiChar; // full path to filename which contains the avatar hash :array [0..127] of AnsiChar; // avatar hash (always an empty string by now) end; diff --git a/include/delphi/m_chat.inc b/include/delphi/m_chat.inc index f4e080287d..1705b659a3 100644 --- a/include/delphi/m_chat.inc +++ b/include/delphi/m_chat.inc @@ -493,15 +493,15 @@ const } // Flags - GCI_BYINDEX = $0001; // iItem is valid and should contain the index of the session to get - GCI_BYID = $0002; // pszID is valid and should contain the ID of the session to get. This is the default if no - GCI_HCONTACT = $0004; // hContact is valid - GCI_DATA = $0008; // wItemData is valid - GCI_ID = $0010; // pszID is valid. - GCI_NAME = $0020; // pszName is valid - GCI_ITYPE = $0040; // iType is valid - GCI_COUNT = $0080; // iCount is valid - GCI_USERS = $0100; // pszUsers is valid + GCF_BYINDEX = $0001; // iItem is valid and should contain the index of the session to get + GCF_BYID = $0002; // pszID is valid and should contain the ID of the session to get. This is the default if no + GCF_HCONTACT = $0004; // hContact is valid + GCF_DATA = $0008; // wItemData is valid + GCF_ID = $0010; // pszID is valid. + GCF_NAME = $0020; // pszName is valid + GCF_ITYPE = $0040; // iType is valid + GCF_COUNT = $0080; // iCount is valid + GCF_USERS = $0100; // pszUsers is valid // The GC_INFO structure type @@ -516,7 +516,7 @@ type iCount :int; // count of users in the nicklist pszUsers :PAnsiChar; // space separated string containing the UID's of the users in the user list. // NOTE. Use Mirandas mmi_free() on the returned string. - hContact :THANDLE; // hContact for the session (can be NULL) + hContact :HCONTACT; // hContact for the session (can be NULL) end; const diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index e8d95269ac..ed2672d04e 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -226,15 +226,15 @@ const type PCLISTEVENT = ^TCLISTEVENT; TCLISTEVENT = record - cbSize : int; // size in bytes - hContact : THANDLE; // handle to the contact to put the icon by - hIcon : HICON; // icon to flash! + cbSize : int; // size in bytes + hContact : HCONTACT; // handle to the contact to put the icon by + hIcon : HICON; // icon to flash! flags : DWORD; - hDBEvent : THANDLE; // caller defined, but should be unique for hContact - // or pszProtocol:PAnsiChar + hDBEvent : THANDLE; // caller defined, but should be unique for hContact + // or pszProtocol:PAnsiChar lParam : LPARAM; - pszService: PAnsiChar; // name of service to call on activation - szTooltip : TChar; // short description of the event to display as a tooltip on the systray + pszService: PAnsiChar; // name of service to call on activation + szTooltip : TChar; // short description of the event to display as a tooltip on the systray end; const diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index 8c6b089879..61d4d48e4c 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -133,7 +133,7 @@ type case boolean of false: ( iImage:int; - hContact:THANDLE); + hContact:HCONTACT); true : ( groupId:word; group :pClcGroup;); @@ -292,7 +292,7 @@ type type PClcCacheEntryBase = ^ClcCacheEntryBase; ClcCacheEntryBase = record - hContact:THANDLE; + hContact:HCONTACT; name :TCHAR; group :TCHAR; isHidden:int; @@ -349,10 +349,10 @@ type pfnAddInfoItemToGroup : function (var group:ClcGroup; flags:int; pszText:TChar):int; cdecl; pfnAddItemToGroup : function (var group:ClcGroup; iAboveItem:int):int; cdecl; pfnAddContactToGroup : function (var dat:ClcData; var group:ClcGroup; - hContact:THANDLE):int; cdecl; - pfnAddContactToTree : procedure (hwnd:HWND; var dat:ClcData; hContact:THANDLE; + hContact:HCONTACT):int; cdecl; + pfnAddContactToTree : procedure (hwnd:HWND; var dat:ClcData; hContact:HCONTACT; updateTotalCount:int; checkHideOffline:int); cdecl; - pfnDeleteItemFromTree : procedure (hwnd:HWND; hItem:THANDLE); cdecl; + pfnDeleteItemFromTree : procedure (hwnd:HWND; hItem:HCONTACT); cdecl; pfnRebuildEntireList : procedure (hwnd:HWND; var dat:ClcData); cdecl; pfnGetGroupContentsCount : function (var group:ClcGroup; visibleOnly:int):int; cdecl; pfnSortCLC : procedure (hwnd:HWND; var dat:ClcData; useInsertionSort:int); cdecl; @@ -384,7 +384,7 @@ type pfnClcStatusToPf2 : function (status:int):int; cdecl; pfnIsHiddenMode : function (var dat:ClcData; status:int):int; cdecl; pfnHideInfoTip : procedure (hwnd:HWND; var dat:ClcData); cdecl; - pfnNotifyNewContact : procedure (hwnd:HWND; hContact:THANDLE); cdecl; + pfnNotifyNewContact : procedure (hwnd:HWND; hContact:HCONTACT); cdecl; pfnGetDefaultExStyle : function :DWORD; cdecl; pfnGetDefaultFontSetting : procedure (i:int; var lf:LOGFONT; var colour:COLORREF); cdecl; pfnGetFontSetting : procedure (i:int; var lf:LOGFONT; var colour:COLORREF); cdecl; @@ -400,22 +400,22 @@ type pfnRowHitTest : function (var dat:ClcData; y:int):int; cdecl; (* clistevents.c *) - pfnEventsProcessContactDoubleClick : function (hContact:THANDLE):int; cdecl; + pfnEventsProcessContactDoubleClick : function (hContact:HCONTACT):int; cdecl; pfnEventsProcessTrayDoubleClick : function (_para1:int):int; cdecl; (* clistmod.c *) - pfnIconFromStatusMode : function (szProto:PAnsiChar; status:int; hContact:THANDLE):int; cdecl; + pfnIconFromStatusMode : function (szProto:PAnsiChar; status:int; hContact:HCONTACT):int; cdecl; pfnShowHide : function (_para1:WPARAM; _para2:LPARAM):int; cdecl; pfnGetStatusModeDescription : function (mode:int; flags:int):TChar; cdecl; (* clistsettings.c *) - pfnGetCacheEntry : function (hContact:THANDLE):PClcCacheEntry; cdecl; - pfnCreateCacheItem : function (hContact:THANDLE):PClcCacheEntry; cdecl; + pfnGetCacheEntry : function (hContact:HCONTACT):PClcCacheEntry; cdecl; + pfnCreateCacheItem : function (hContact:HCONTACT):PClcCacheEntry; cdecl; pfnCheckCacheItem : procedure (_para1:PClcCacheEntry); cdecl; pfnFreeCacheItem : procedure (_para1:PClcCacheEntry); cdecl; - pfnGetContactDisplayName : function (hContact:THANDLE; mode:int):TChar; cdecl; - pfnInvalidateDisplayNameCacheEntry : procedure (hContact:THANDLE); cdecl; + pfnGetContactDisplayName : function (hContact:HCONTACT; mode:int):TChar; cdecl; + pfnInvalidateDisplayNameCacheEntry : procedure (hContact:HCONTACT); cdecl; (* clisttray.c *) pfnTrayIconUpdateWithImageList : procedure (iImage:int; szNewTip:TChar; @@ -438,7 +438,7 @@ type pfnOnCreateClc : procedure ; cdecl; (* contact.c *) - pfnChangeContactIcon : procedure (hContact:THANDLE; iIcon:int; add:int); cdecl; + pfnChangeContactIcon : procedure (hContact:HCONTACT; iIcon:int; add:int); cdecl; pfnLoadContactTree : procedure ; cdecl; pfnCompareContacts : function (var contact1:ClcContact; var contact2:ClcContact):int; cdecl; pfnSortContacts : procedure ; cdecl; @@ -467,9 +467,9 @@ type pfnFreeEvent : procedure (_para1:PCListEvent); cdecl; pfnAddEvent : function (_para1:PCLISTEVENT):PCListEvent; cdecl; - pfnGetEvent : function (hContact:THANDLE; idx:int):PCLISTEVENT; cdecl; + pfnGetEvent : function (hContact:HCONTACT; idx:int):PCLISTEVENT; cdecl; - pfnRemoveEvent : function (hContact:THANDLE; hDbEvent:THANDLE):int; cdecl; + pfnRemoveEvent : function (hContact:HCONTACT; hDbEvent:THANDLE):int; cdecl; pfnGetImlIconIndex : function (hIcon:HICON):int; cdecl; (************************************************************************************* @@ -510,7 +510,7 @@ type szTip : TChar; bTrayMenuOnScreen : BOOL; - pfnGetIconFromStatusMode : function (hContact:THANDLE; szProto:PAnsiChar; + pfnGetIconFromStatusMode : function (hContact:HCONTACT; szProto:PAnsiChar; status:int):HICON; cdecl; pfnInitTray : procedure ; cdecl; @@ -541,13 +541,13 @@ type * version 7 additions (0.11.0.x) - extra images *************************************************************************************) pfnReloadExtraIcons: procedure; cdecl; - pfnSetAllExtraIcons: procedure(hContact:THANDLE); cdecl; + pfnSetAllExtraIcons: procedure(hContact:HCONTACT); cdecl; (************************************************************************************* * Miranda NG additions *************************************************************************************) - pfnGetContactIcon: function(hContact:THANDLE):int; cdecl; + pfnGetContactIcon: function(hContact:HCONTACT):int; cdecl; pfnTrayCalcChanged:function(szChangedProto:pAnsiChar; averageMode:int; iProtoCount:int):int; cdecl; pfnGetAverageMode:function(pNetProtoCount:pint):int; cdecl; end; diff --git a/include/delphi/m_contacts.inc b/include/delphi/m_contacts.inc index cef88c4b38..930574d3cd 100644 --- a/include/delphi/m_contacts.inc +++ b/include/delphi/m_contacts.inc @@ -23,7 +23,7 @@ type TCONTACTINFO = record cbSize : int; dwFlag : Byte; - hContact: THandle; + hContact: HCONTACT; szProto : PAnsiChar; _type : Byte; retval: record // in C this is a nameless union diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 7ee88e52c0..1383fbf9cf 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -53,7 +53,10 @@ const DBVTF_VARIABLELENGTH = $80; // ? type - MCONTACT = DWORD; + HCONTACT = THANDLE; + THCONTACT = HCONTACT; + MCONTACT = DWORD; +type HDBEVENT = THANDLE; PDBVARIANT = ^TDBVARIANT; TDBVARIANT = record @@ -124,7 +127,7 @@ modules are free to define their own, beginning at 2000 DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services db/time/x below with useful stuff for dealing with it. } -function db_event_add(hContact:THANDLE; dbei:PDBEVENTINFO):THANDLE; stdcall; +function db_event_add(hContact:HCONTACT; dbei:PDBEVENTINFO):THANDLE; stdcall; external CoreDLL name 'db_event_add'; { @@ -132,7 +135,7 @@ Gets the number of events in the chain belonging to a contact in the database. Returns the number of events in the chain owned by hContact or -1 if hContact is invalid. They can be retrieved using the db_event_first/last() services. } -function db_event_count(hContact:THANDLE):int; stdcall; +function db_event_count(hContact:HCONTACT):int; stdcall; external CoreDLL name 'db_event_count'; { @@ -141,7 +144,7 @@ hDbEvent should have been returned by db_event_add/first/last/next/prev() Returns 0 on success, or nonzero if hDbEvent was invalid Triggers a db/event/deleted event just *before* the event is deleted } -function db_event_delete(hContact:THANDLE; hDbEvent:THANDLE):int; stdcall; +function db_event_delete(hContact:HCONTACT; hDbEvent:THANDLE):int; stdcall; external CoreDLL name 'db_event_delete'; { @@ -149,7 +152,7 @@ Retrieves a handle to the first event in the chain for hContact Returns the handle, or NULL if hContact is invalid or has no events Events in a chain are sorted chronologically automatically } -function db_event_first(hContact:THANDLE):THANDLE; stdcall; +function db_event_first(hContact:HCONTACT):THANDLE; stdcall; external CoreDLL name 'db_event_first'; { @@ -163,7 +166,7 @@ should be checked individually with db_event_next() and db_event_get() This service is designed for startup, reloading all the events that remained unread from last time } -function db_event_firstUnread(hContact:THANDLE):THANDLE; stdcall; +function db_event_firstUnread(hContact:HCONTACT):THANDLE; stdcall; external CoreDLL name 'db_event_firstUnread'; { @@ -200,7 +203,7 @@ success This service is exceptionally slow. Use only when you have no other choice at all. } -function db_event_getContact(hDbEvent:THANDLE):THANDLE; stdcall; +function db_event_getContact(hDbEvent:THANDLE):HCONTACT; stdcall; external CoreDLL name 'db_event_getContact'; { @@ -208,7 +211,7 @@ Retrieves a handle to the last event in the chain for hContact Returns the handle, or NULL if hContact is invalid or has no events Events in a chain are sorted chronologically automatically } -function db_event_last(hDbEvent:THANDLE):THANDLE; stdcall; +function db_event_last(hContact:HCONTACT):THANDLE; stdcall; external CoreDLL name 'db_event_last'; { @@ -219,7 +222,7 @@ is invalid. This is the one database write operation that does not trigger an event. Modules should not save flags states for any length of time. } -function db_event_markRead(hContact, hDbEvent:THANDLE):int; stdcall; +function db_event_markRead(hContact:HCONTACT; hDbEvent:THANDLE):int; stdcall; external CoreDLL name 'db_event_markRead'; { @@ -252,7 +255,7 @@ You can specify szProto to find only its contacts Returns a handle to the first contact in the db on success, or NULL if there are no contacts in the db. } -function db_find_first(const szModule:pAnsiChar=nil):THANDLE; stdcall; +function db_find_first(const szModule:pAnsiChar=nil):HCONTACT; stdcall; external CoreDLL name 'db_find_first'; { @@ -262,53 +265,53 @@ You can specify szProto to find only its contacts Returns a handle to the contact after hContact in the db on success or NULL if hContact was the last contact in the db or hContact was invalid. } -function db_find_next(hContact:THANDLE; const szModule:pAnsiChar=nil):THANDLE; stdcall; +function db_find_next(hContact:HCONTACT; const szModule:pAnsiChar=nil):HCONTACT; stdcall; external CoreDLL name 'db_find_next'; (****************************************************************************** * DATABASE SETTINGS *) -function db_get(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; +function db_get(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_get'; -function db_get_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; +function db_get_b(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_b'; -function db_get_w(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; +function db_get_w(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_w'; -function db_get_dw(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:dword):dword; stdcall; +function db_get_dw(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:dword):dword; stdcall; external CoreDLL name 'db_get_dw'; -function db_get_s(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; +function db_get_s(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; external CoreDLL name 'db_get_s'; -function db_get_sa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pAnsiChar; stdcall; +function db_get_sa(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):pAnsiChar; stdcall; external CoreDLL name 'db_get_sa'; -function db_get_wsa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; +function db_get_wsa(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; external CoreDLL name 'db_get_wsa'; -function db_get_static(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; +function db_get_static(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; external CoreDLL name 'db_get_static'; -function db_get_static_utf(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; +function db_get_static_utf(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; external CoreDLL name 'db_get_static_utf'; -function db_get_wstatic(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pWideChar; destLen:int):int; stdcall; +function db_get_wstatic(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pWideChar; destLen:int):int; stdcall; external CoreDLL name 'db_get_wstatic'; -function db_set(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; +function db_set(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_set'; -function db_set_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; +function db_set_b(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; external CoreDLL name 'db_set_b'; -function db_set_w(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:word):int_ptr; stdcall; +function db_set_w(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:word):int_ptr; stdcall; external CoreDLL name 'db_set_w'; -function db_set_dw(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:dword):int_ptr; stdcall; +function db_set_dw(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:dword):int_ptr; stdcall; external CoreDLL name 'db_set_dw'; -function db_set_s(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; +function db_set_s(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_set_s'; -function db_set_ws(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pWideChar):int_ptr; stdcall; +function db_set_ws(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pWideChar):int_ptr; stdcall; external CoreDLL name 'db_set_ws'; -function db_set_utf(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; +function db_set_utf(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_set_utf'; -function db_set_blob(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:pointer; len:uint):int_ptr; stdcall; +function db_set_blob(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:pointer; len:uint):int_ptr; stdcall; external CoreDLL name 'db_set_blob'; -function db_unset(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall; +function db_unset(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_unset'; function db_set_resident(const szModule:pAnsiChar; const szSetting:pAnsiChar; bEnable:int):int; stdcall; @@ -317,36 +320,36 @@ function db_set_resident(const szModule:pAnsiChar; const szSetting:pAnsiChar; bE // deprecated Aliases function DBFreeVariant(dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_free'; -function DBDeleteContactSetting(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall; +function DBDeleteContactSetting(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_unset'; -function DBGetContactSettingByte(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; +function DBGetContactSettingByte(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_b'; -function DBGetContactSettingWord(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; +function DBGetContactSettingWord(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall; external CoreDLL name 'db_get_w'; -function DBGetContactSettingDWord(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:dword):dword; stdcall; +function DBGetContactSettingDWord(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:dword):dword; stdcall; external CoreDLL name 'db_get_dw'; -function DBGetContactSetting(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; +function DBGetContactSetting(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_get'; -function DBGetContactSettingStr(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; +function DBGetContactSettingStr(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; external CoreDLL name 'db_get_s'; -function DBGetContactSettingString(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pAnsiChar; stdcall; +function DBGetContactSettingString(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):pAnsiChar; stdcall; external CoreDLL name 'db_get_sa'; -function DBGetContactSettingWString(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; +function DBGetContactSettingWString(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; external CoreDLL name 'db_get_wsa'; -function DBWriteContactSettingByte(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; +function DBWriteContactSettingByte(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; external CoreDLL name 'db_set_b'; -function DBWriteContactSettingWord(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:word):int_ptr; stdcall; +function DBWriteContactSettingWord(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:word):int_ptr; stdcall; external CoreDLL name 'db_set_w'; -function DBWriteContactSettingDWord(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:dword):int_ptr; stdcall; +function DBWriteContactSettingDWord(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:dword):int_ptr; stdcall; external CoreDLL name 'db_set_dw'; -function DBWriteContactSettingString(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; +function DBWriteContactSettingString(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_set_s'; -function DBWriteContactSettingWString(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pWideChar):int_ptr; stdcall; +function DBWriteContactSettingWString(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pWideChar):int_ptr; stdcall; external CoreDLL name 'db_set_ws'; -function DBWriteContactSettingUTF8String(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; +function DBWriteContactSettingUTF8String(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; const val:pAnsiChar):int_ptr; stdcall; external CoreDLL name 'db_set_utf'; -function DBWriteContactSettingBlob(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:pointer; len:uint):int_ptr; stdcall; +function DBWriteContactSettingBlob(hContact:HCONTACT; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:pointer; len:uint):int_ptr; stdcall; external CoreDLL name 'db_set_blob'; /////////////////////////////////////////////////////////////////////////////// @@ -428,7 +431,7 @@ procedure KillModuleServices(hInst:HINST); stdcall; procedure KillObjectServices(var ptr); stdcall; external CoreDLL name 'KillObjectServices'; -function CallContactService(hContact:THANDLE;const name:PAnsiChar;wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl; +function CallContactService(hContact:HCONTACT;const name:PAnsiChar;wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl; external CoreDLL name 'CallContactService'; function CallProtoService(const szModule:PAnsiChar;const szService:PAnsiChar;wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl; external CoreDLL name 'CallProtoService'; @@ -678,7 +681,7 @@ function mir_vsnwprintf(buffer:pWideChar;count:size_t;fmt:pWideChar;va:va_list): /////////////////////////////////////////////////////////////////////////////// // protocol functions -function ProtoBroadcastAck(const szModule: PAnsiChar; hContact: THandle; type_: int; result_: int; hProcess: THandle; lParam: LPARAM): int_ptr; stdcall; +function ProtoBroadcastAck(const szModule:PAnsiChar; hContact:HCONTACT; type_:int; result_:int; hProcess:THANDLE; lParam:LPARAM): int_ptr; stdcall; external CoreDLL name 'ProtoBroadcastAck'; function ProtoServiceExists(const szModule, szName:PAnsiChar):int; stdcall; diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 82744a43d6..eefe7657d8 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -51,7 +51,7 @@ type value : TDBVARIANT; // variant containing value to set end; - { +{ wParam : Handle of a contact to enum settings for lParam : Pointer to a TDBCONTACTENUMSETTINGS structure, must be initalised affect : Enumerates all settings for a given contact under a module, @@ -69,7 +69,7 @@ type it is unclear how you stop the enumeration once it is started, maybe possible to return -1 to stop it. vesion : only valid for 0.1.0.1+ - } +} type TDBSETTINGENUMPROC = function(const szSetting: PAnsiChar; lParam: LPARAM): int; cdecl; diff --git a/include/delphi/m_db_int.inc b/include/delphi/m_db_int.inc index 106cc3bbfe..4cebeae11c 100644 --- a/include/delphi/m_db_int.inc +++ b/include/delphi/m_db_int.inc @@ -83,7 +83,7 @@ type GetBlobSize:function(hDbEvent:THANDLE):long; stdcall; GetEvent:function(hDbEvent:THANDLE; dbe:PDBEVENTINFO):bool; stdcall; MarkEventRead:function(contactID:MCONTACT; hDbEvent:THANDLE):bool; stdcall; - GetEventContact:function(hDbEvent:THANDLE):THANDLE; stdcall; + GetEventContact:function(hDbEvent:THANDLE):MCONTACT; stdcall; FindFirstEvent:function(contactID:MCONTACT):THANDLE; stdcall; FindFirstUnreadEvent:function(contactID:MCONTACT):THANDLE; stdcall; FindLastEvent:function(contactID:MCONTACT):THANDLE; stdcall; diff --git a/include/delphi/m_extraicons.inc b/include/delphi/m_extraicons.inc index ad64e83c33..92351cf8f6 100644 --- a/include/delphi/m_extraicons.inc +++ b/include/delphi/m_extraicons.inc @@ -66,14 +66,14 @@ type RebuildIcons:TMIRANDAHOOK; // Callback to set the icon to clist, calling MS_CLIST_EXTRA_SET_ICON or MS_EXTRAICON_SET_ICON - // wParam = HANDLE hContact + // wParam = hContact // lParam = int slot ApplyIcon:TMIRANDAHOOK; // Other optional callbacks // [Optional] Callback called when extra icon was clicked - // wParam = HANDLE hContact + // wParam = hContact // lParam = int slot // param = onClickParam OnClick:TMIRANDAHOOKPARAM; @@ -91,8 +91,8 @@ const type TEXTRAICON = record cbSize :int; - hExtraIcon:THANDLE; // Value returned by MS_EXTRAICON_REGISTER - hContact :THANDLE; // Contact to set the extra icon + hExtraIcon:THANDLE; // Value returned by MS_EXTRAICON_REGISTER + hContact :HCONTACT; // Contact to set the extra icon // The icon to be set. This depends on the type of the extra icon: case boolean of false:(hImage :THANDLE); // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK) diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 8d59327c2e..966bf0577d 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -16,22 +16,22 @@ function Netlib_Send(hConn: THandle; const buf: PAnsiChar; len: int; flags: int) function Netlib_Recv(hConn: THandle; const buf: PAnsiChar; len: int; flags: int): int_ptr; procedure Netlib_Log(hNetLib: THandle; const sz: PAnsiChar); -function WindowList_Add(hList: THandle; hWnd: HWND; hContact: THandle): int_ptr; -function WindowList_Remove(hList: THandle; hWnd: THandle): int_ptr; -function WindowList_Find(hList: THandle; hContact: THandle): int_ptr; -function WindowList_Broadcast(hList: THandle; message: int; wParam: WPARAM; lParam: LPARAM): int_ptr; -function Utils_SaveWindowPosition(hWnd: THandle; hContact: THandle; const szModule, szNamePrefix: PAnsiChar): int_ptr; -function Utils_RestoreWindowPosition(hWnd: THandle; hContact: THandle; Flags: int; const szModule, szNamePrefix: PAnsiChar): int_ptr; - -function mir_hashstr(const key:pAnsiChar):uint; {inline;} +function WindowList_Add (hList:THandle; hWnd:HWND; hContact:HCONTACT): int_ptr; +function WindowList_Remove (hList:THandle; hWnd:THandle): int_ptr; +function WindowList_Find (hList:THandle; hContact:HCONTACT): int_ptr; +function WindowList_Broadcast(hList:THandle; message: int; wParam: WPARAM; lParam: LPARAM): int_ptr; +function Utils_SaveWindowPosition (hWnd:THandle; hContact:HCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr; +function Utils_RestoreWindowPosition(hWnd:THandle; hContact:HCONTACT; Flags: int; const szModule, szNamePrefix: PAnsiChar): int_ptr; + +function mir_hashstr (const key:pAnsiChar):uint; {inline;} function mir_hashstrW(const key:pWideChar):uint; {inline;} -function lrtrim(str:pAnsiChar):pAnsiChar; {inline} +function lrtrim (str:pAnsiChar):pAnsiChar; {inline} function lrtrimp(str:pAnsiChar):pAnsiChar; {inline} function mir_utf8decodeA(const src:pAnsiChar):pAnsiChar; {inline} -function Translate(sz: PAnsiChar): PAnsiChar; +function Translate (sz: PAnsiChar): PAnsiChar; function Translatew(sz: PWideChar): PWideChar; -function TranslateString(const sz: AnsiString): AnsiString; +function TranslateString (const sz:AnsiString):AnsiString; function TranslateWideString(const sz:WideString):WideString; function TranslateUnicodeString(sz: UnicodeString): UnicodeString; procedure TranslateDialogDefault(hwndDlg: THandle); @@ -42,8 +42,8 @@ function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; servic function Srmm_AddIcon (sid: PStatusIconData):int_ptr; procedure Srmm_RemoveIcon(sid: PStatusIconData); -procedure Srmm_ModifyIcon(hContact:THANDLE; sid:PStatusIconData); -function Srmm_GetNthIcon(hContact:THANDLE; index:int):pStatusIconData; +procedure Srmm_ModifyIcon(hContact:HCONTACT; sid:PStatusIconData); +function Srmm_GetNthIcon(hContact:HCONTACT; index:int):pStatusIconData; function LoadSkinnedIcon (id: int): HICON; function LoadSkinnedIconHandle(id: int): THandle; @@ -52,37 +52,37 @@ function LoadSkinnedIconName (id: int): PAnsiChar; function LoadSkinnedProtoIcon(const szProto: PAnsiChar; status: int): THandle; function SkinAddNewSound(const name, description, defaultFile: PAnsiChar): int_ptr; -function SkinPlaySound (const name: PAnsiChar): int_ptr; +function SkinPlaySound (const name: PAnsiChar): int_ptr; function Menu_AddContextFrameMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddMainMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddContactMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddStatusMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddProtoMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddSubGroupMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddGroupMenuItem(mi:PCLISTMENUITEM):HGENMENU; -function Menu_AddTrayMenuItem(mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddMainMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddContactMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddStatusMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddProtoMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddSubGroupMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddGroupMenuItem (mi:PCLISTMENUITEM):HGENMENU; +function Menu_AddTrayMenuItem (mi:PCLISTMENUITEM):HGENMENU; function UserInfo_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; -function Options_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; +function Options_AddPage (wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; function Hotkey_Register(hk:PHOTKEYDESC):int_ptr; function Skin_AddIcon(si:PSKINICONDESC):THANDLE; procedure Icon_Register (hInst:HINST; const szSection:pAnsiChar; pIcons:pIconItem ; iCount:size_t; prefix:PAnsiChar); procedure Icon_RegisterW(hInst:HINST; const szSection:pWideChar; pIcons:pIconItemW; iCount:size_t; prefix:PAnsiChar); -procedure FontRegister(pFontID:pFontID); +procedure FontRegister (pFontID:pFontID); procedure FontRegisterW(pFontID:pFontIDW); -procedure ColourRegister(pColorID:pColourID); +procedure ColourRegister (pColorID:pColourID); procedure ColourRegisterW(pColorID:pColourIDW); -procedure EffectRegister(pEffectID:pEffectID); +procedure EffectRegister (pEffectID:pEffectID); procedure EffectRegisterW(pEffectID:pEffectIDW); function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; -function Options_Open(ood:POPENOPTIONSDIALOG):int_ptr; +function Options_Open (ood:POPENOPTIONSDIALOG):int_ptr; function Options_OpenPage(ood:POPENOPTIONSDIALOG):HWND; {$ELSE} @@ -185,7 +185,7 @@ begin end; -function WindowList_Add(hList: THandle; hWnd: hWnd; hContact: THandle): int_ptr; +function WindowList_Add(hList: THandle; hWnd: hWnd; hContact: HCONTACT): int_ptr; var wle: TWINDOWLISTENTRY; begin @@ -201,7 +201,7 @@ begin Result := CallService(MS_UTILS_REMOVEFROMWINDOWLIST, hList, hWnd); end; -function WindowList_Find(hList: THandle; hContact: THandle): int_ptr; +function WindowList_Find(hList: THandle; hContact: HCONTACT): int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin Result := CallService(MS_UTILS_FINDWINDOWINLIST, hList, hContact); @@ -217,7 +217,7 @@ begin Result := CallService(MS_UTILS_BROADCASTTOWINDOWLIST, hList, tLparam(@Msg)); end; -function Utils_SaveWindowPosition(hWnd: THandle; hContact: THandle; const szModule, szNamePrefix: PAnsiChar): int_ptr; +function Utils_SaveWindowPosition(hWnd:THandle; hContact:HCONTACT; const szModule, szNamePrefix: PAnsiChar): int_ptr; var swp: TSAVEWINDOWPOS; begin @@ -228,7 +228,7 @@ begin Result := CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, lParam(@swp)); end; -function Utils_RestoreWindowPosition(hWnd: THandle; hContact: THandle; Flags: int; const szModule, szNamePrefix: PAnsiChar): int_ptr; +function Utils_RestoreWindowPosition(hWnd:THandle; hContact:HCONTACT; Flags:int; const szModule, szNamePrefix: PAnsiChar): int_ptr; var swp: TSAVEWINDOWPOS; begin @@ -329,6 +329,7 @@ begin result:=CallService(MS_LANGPACK_REGISTER,WPARAM(@hLangpack),LPARAM(@PluginInfo)); end; + function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr; var szStr: array[0..MAXMODULELABELLENGTH*2] of AnsiChar; @@ -355,13 +356,13 @@ begin CallService(MS_MSG_REMOVEICON, 0, LPARAM(sid)); end; -procedure Srmm_ModifyIcon(hContact:THANDLE; sid:PStatusIconData); +procedure Srmm_ModifyIcon(hContact:HCONTACT; sid:PStatusIconData); {$IFDEF AllowInline}inline;{$ENDIF} begin CallService(MS_MSG_GETNTHICON, hContact, LPARAM(sid)); end; -function Srmm_GetNthIcon(hContact:THANDLE; index:int):PStatusIconData; +function Srmm_GetNthIcon(hContact:HCONTACT; index:int):PStatusIconData; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=PStatusIconData(CallService(MS_MSG_GETNTHICON, hContact, index)); diff --git a/include/delphi/m_message.inc b/include/delphi/m_message.inc index 73577802d5..19ae286e38 100644 --- a/include/delphi/m_message.inc +++ b/include/delphi/m_message.inc @@ -57,16 +57,16 @@ type PMessageWindowEventData = ^TMessageWindowEventData; TMessageWindowEventData = record cbSize : int; - hContact : THANDLE; - hwndWindow: HWND; // top level window for the contact - szModule : PAnsiChar; // used to get plugin type (which means you could use - // local if needed) - uType : uint; // see event types above - uFlags : uint; // used to indicate message direction for all event - // types except custom - local : pointer; // used to store pointer to custom data - hwndInput : HWND; // input area window for the contact (or NULL if there is none) - hwndLog : HWND; // log area window for the contact (or NULL if there is none) + hContact : HCONTACT; + hwndWindow: HWND; // top level window for the contact + szModule : PAnsiChar; // used to get plugin type (which means you could use + // local if needed) + uType : uint; // see event types above + uFlags : uint; // used to indicate message direction for all event + // types except custom + local : pointer; // used to store pointer to custom data + hwndInput : HWND; // input area window for the contact (or NULL if there is none) + hwndLog : HWND; // log area window for the contact (or NULL if there is none) end; const @@ -87,7 +87,7 @@ type PMessageWindowInputData = ^TMessageWindowInputData; TMessageWindowInputData = record cbSize : int; - hContact: THANDLE; + hContact: HCONTACT; uFlags : int; // see uflags above end; @@ -102,7 +102,7 @@ type PMessageWindowOutputData = ^TMessageWindowOutputData; TMessageWindowOutputData = record cbSize : int; - hContact : THANDLE; + hContact : HCONTACT; uFlags : int; // should be same as input data unless 0, then it // will be the actual type hwndWindow: HWND; // top level window for the contact or NULL if no window exists @@ -131,7 +131,7 @@ type MessageWindowEvent = record cbSize :int; seq :int; // number returned by PSS_MESSAGE - hContact :THANDLE; + hContact :HCONTACT; dbei :PDBEVENTINFO; // database event written on the basis of message sent end; @@ -159,13 +159,13 @@ const type MessageWindowPopupData = record cbSize :int; - uType :uint; // see popup types above - uFlags :uint; // used to indicate in which window the popup was requested - hContact :THANDLE; - hwnd :HWND; // window where the popup was requested - hMenu :HMENU; // The handle to the menu - pt :TPOINT; // The point, in screen coords - selection:int; // The menu control id or 0 if no one was selected + uType :uint; // see popup types above + uFlags :uint; // used to indicate in which window the popup was requested + hContact :HCONTACT; + hwnd :HWND; // window where the popup was requested + hMenu :HMENU; // The handle to the menu + pt :TPOINT; // The point, in screen coords + selection:int; // The menu control id or 0 if no one was selected end; // status icons diff --git a/include/delphi/m_msg_buttonsbar.inc b/include/delphi/m_msg_buttonsbar.inc index 223c48e331..cc982b9f92 100644 --- a/include/delphi/m_msg_buttonsbar.inc +++ b/include/delphi/m_msg_buttonsbar.inc @@ -80,7 +80,7 @@ type pszModule :PAnsiChar; // button owners name dwButtonId:DWORD; // registered button ID hwndFrom :HWND; // button parents HWND - hContact :THANDLE; // + hContact :HCONTACT; flags :DWORD; // BBCF_ flags end; diff --git a/include/delphi/m_popup.inc b/include/delphi/m_popup.inc index 77c5d481dd..804140f6d6 100644 --- a/include/delphi/m_popup.inc +++ b/include/delphi/m_popup.inc @@ -56,7 +56,7 @@ type type PPOPUPDATA = ^TPOPUPDATA; TPOPUPDATA = record - lchContact : THANDLE; + lchContact : HCONTACT; lchIcon : HICON; lpszContactName : array [0..MAX_CONTACTNAME-1] of AnsiChar; lpszText : array [0..MAX_SECONDLINE -1] of AnsiChar; @@ -81,7 +81,7 @@ type type PPOPUPDATAW = ^TPOPUPDATAW; TPOPUPDATAW = record - lchContact : THANDLE; + lchContact : HCONTACT; lchIcon : HICON; lpwzContactName : array [0..MAX_CONTACTNAME-1] of WideChar; lpwzText : array [0..MAX_SECONDLINE -1] of WideChar; @@ -344,7 +344,7 @@ const // wParam = 0 // lParam = (POPUPCLASS *)&pc - MS_POPUP_REGISTERCLASS = 'Popup/RegisterClass'; + MS_POPUP_REGISTERCLASS = 'Popup/RegisterClass'; MS_POPUP_UNREGISTERCLASS = 'Popup/UnregisterClass'; type @@ -354,7 +354,7 @@ type szTitle :TChar; szText :TChar; PluginData :pointer; - hContact :THANDLE; + hContact :HCONTACT; end; POPUPDATACLASS = TPOPUPDATACLASS; diff --git a/include/delphi/m_protocols.inc b/include/delphi/m_protocols.inc index 3f1fea9cc1..70b8465012 100644 --- a/include/delphi/m_protocols.inc +++ b/include/delphi/m_protocols.inc @@ -32,7 +32,7 @@ type PCCSDATA = ^TCCSDATA; TCCSDATA = record - hContact : THANDLE; + hContact : HCONTACT; szProtoService: PAnsiChar; // a PS_* constant wParam : WPARAM; lParam : LPARAM; @@ -51,12 +51,12 @@ type PACKDATA = ^TACKDATA; TACKDATA = record cbSize : int; - szModule: PAnsiChar; // the name of the protocol module which initiated this ack - hContact: THANDLE; - _type : int; // an ACKTYPE_* constant - _result : int; // an ACKRESULT_* constant - hProcess: THANDLE; // caller defined seq, I mean process code - lParam : LPARAM; // caller defined data + szModule: PAnsiChar; // the name of the protocol module which initiated this ack + hContact: HCONTACT; + _type : int; // an ACKTYPE_* constant + _result : int; // an ACKRESULT_* constant + hProcess: THANDLE; // caller defined seq, I mean process code + lParam : LPARAM; // caller defined data end; const @@ -123,7 +123,7 @@ type PPROTOFILETRANSFERSTATUS = ^TPROTOFILETRANSFERSTATUS; TPROTOFILETRANSFERSTATUS = record cbSize : size_t; - hContact : THANDLE; + hContact : HCONTACT; flags : dword; // one of PFTS_* constants files : ^TCHAR; totalFiles : int; @@ -388,18 +388,18 @@ const type PPROTO_AVATAR_INFORMATIONW = ^TPROTO_AVATAR_INFORMATIONW; TPROTO_AVATAR_INFORMATIONW = record - cbSize : int; // sizeof() - hContact: THANDLE; // this might have to be set by the caller too - format : int; // PA_FORMAT_* + cbSize : int; // sizeof() + hContact: HCONTACT; // this might have to be set by the caller too + format : int; // PA_FORMAT_* // full path to filename which contains the avatar filename: array[0..(MAX_PATH)-1] of WideChar; end; PPROTO_AVATAR_INFORMATION = ^TPROTO_AVATAR_INFORMATION; TPROTO_AVATAR_INFORMATION = record - cbSize : int; // sizeof() - hContact: THANDLE; // this might have to be set by the caller too - format : int; // PA_FORMAT_* + cbSize : int; // sizeof() + hContact: HCONTACT; // this might have to be set by the caller too + format : int; // PA_FORMAT_* // full path to filename which contains the avatar filename: array[0..(MAX_PATH)-1] of AnsiChar; end; diff --git a/include/delphi/m_protoint.inc b/include/delphi/m_protoint.inc index dbb7a3665d..da781bc43d 100644 --- a/include/delphi/m_protoint.inc +++ b/include/delphi/m_protoint.inc @@ -46,28 +46,111 @@ type iDesiredStatus:int; iXStatus :int; iVersion :int; // version 2 or higher designate support of Unicode services + tszUserName :TChar; szModuleName :PAnsiChar; hProtoIcon :THandle; hNetlibUser :THandle; - - AddToList :function(intf:PPROTO_INTERFACE;flags:int; var psr:TPROTOSEARCHRESULT):THANDLE; cdecl; - AddToListByEvent:function(intf:PPROTO_INTERFACE;flags:int; iContact:int; hDbEvent:THANDLE):THANDLE; cdecl; - - Authorize :function(intf:PPROTO_INTERFACE;hContact:THANDLE):int; cdecl; - AuthDeny :function(intf:PPROTO_INTERFACE;hContact:THANDLE;const szReason:TChar):int; cdecl; - AuthRecv :function(intf:PPROTO_INTERFACE;hContact:THANDLE;var ptr:TPROTORECVEVENT):int; cdecl; - AuthRequest:function(intf:PPROTO_INTERFACE;hContact:THANDLE;szMessage:TChar):int; cdecl; + ////////////////////////////////////////////////////////////////////////////////////// + // Helpers +(*!! + __forceinline void debugLogA(LPCSTR szFormat, ...) + { + va_list args; + va_start(args, szFormat); + ProtoLogA(this, szFormat, args); + } + __forceinline void debugLogW(LPCWSTR wszFormat, ...) + { + va_list args; + va_start(args, wszFormat); + ProtoLogW(this, wszFormat, args); + } + + __forceinline INT_PTR ProtoBroadcastAck(HCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) { + return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); } + + __forceinline INT_PTR delSetting(const char *name) { return db_unset(NULL, m_szModuleName, name); } + __forceinline INT_PTR delSetting(HCONTACT hContact, const char *name) { return db_unset(hContact, m_szModuleName, name); } + + __forceinline bool getBool(const char *name, bool defaultValue) { + return db_get_b(NULL, m_szModuleName, name, defaultValue) != 0; } + __forceinline bool getBool(HCONTACT hContact, const char *name, bool defaultValue) { + return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; } + + __forceinline bool isChatRoom(HCONTACT hContact) { return getBool(hContact, "ChatRoom", false); } + + __forceinline int getByte(const char *name, BYTE defaultValue) { + return db_get_b(NULL, m_szModuleName, name, defaultValue); } + __forceinline int getByte(HCONTACT hContact, const char *name, BYTE defaultValue) { + return db_get_b(hContact, m_szModuleName, name, defaultValue); } + + __forceinline int getWord(const char *name, WORD defaultValue) { + return db_get_w(NULL, m_szModuleName, name, defaultValue); } + __forceinline int getWord(HCONTACT hContact, const char *name, WORD defaultValue) { + return db_get_w(hContact, m_szModuleName, name, defaultValue); } + + __forceinline DWORD getDword(const char *name, DWORD defaultValue) { + return db_get_dw(NULL, m_szModuleName, name, defaultValue); } + __forceinline DWORD getDword(HCONTACT hContact, const char *name, DWORD defaultValue) { + return db_get_dw(hContact, m_szModuleName, name, defaultValue); } + + __forceinline INT_PTR getString(const char *name, DBVARIANT *result) { + return db_get_s(NULL, m_szModuleName, name, result); } + __forceinline INT_PTR getString(HCONTACT hContact, const char *name, DBVARIANT *result) { + return db_get_s(hContact, m_szModuleName, name, result); } + + __forceinline INT_PTR getWString(const char *name, DBVARIANT *result) { + return db_get_ws(NULL, m_szModuleName, name, result); } + __forceinline INT_PTR getWString(HCONTACT hContact, const char *name, DBVARIANT *result) { + return db_get_ws(hContact, m_szModuleName, name, result); } + + __forceinline char* getStringA(const char *name) { + return db_get_sa(NULL, m_szModuleName, name); } + __forceinline char* getStringA(HCONTACT hContact, const char *name) { + return db_get_sa(hContact, m_szModuleName, name); } + + __forceinline WCHAR* getWStringA(const char *name) { + return db_get_wsa(NULL, m_szModuleName, name); } + __forceinline WCHAR* getWStringA(HCONTACT hContact, const char *name) { + return db_get_wsa(hContact, m_szModuleName, name); } + + __forceinline void setByte(const char *name, BYTE value) { db_set_b(NULL, m_szModuleName, name, value); } + __forceinline void setByte(HCONTACT hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); } + + __forceinline void setWord(const char *name, WORD value) { db_set_w(NULL, m_szModuleName, name, value); } + __forceinline void setWord(HCONTACT hContact, const char *name, WORD value) { db_set_w(hContact, m_szModuleName, name, value); } + + __forceinline void setDword(const char *name, DWORD value) { db_set_dw(NULL, m_szModuleName, name, value); } + __forceinline void setDword(HCONTACT hContact, const char *name, DWORD value) { db_set_dw(hContact, m_szModuleName, name, value); } + + __forceinline void setString(const char *name, const char* value) { db_set_s(NULL, m_szModuleName, name, value); } + __forceinline void setString(HCONTACT hContact, const char *name, const char* value) { db_set_s(hContact, m_szModuleName, name, value); } + + __forceinline void setWString(const char *name, const WCHAR* value) { db_set_ws(NULL, m_szModuleName, name, value); } + __forceinline void setWString(HCONTACT hContact, const char *name, const WCHAR* value) { db_set_ws(hContact, m_szModuleName, name, value); } + +*) + ////////////////////////////////////////////////////////////////////////////////////// + // Virtual functions + + AddToList :function(intf:PPROTO_INTERFACE;flags:int; var psr:TPROTOSEARCHRESULT):HCONTACT; cdecl; + AddToListByEvent:function(intf:PPROTO_INTERFACE;flags:int; iContact:int; hDbEvent:THANDLE):HCONTACT; cdecl; + + Authorize :function(intf:PPROTO_INTERFACE;hDbEvent:THANDLE):int; cdecl; + AuthDeny :function(intf:PPROTO_INTERFACE;hDbEvent:THANDLE;const szReason:TChar):int; cdecl; + AuthRecv :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;var ptr:TPROTORECVEVENT):int; cdecl; + AuthRequest:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;szMessage:TChar):int; cdecl; ChangeInfo:function(intf:PPROTO_INTERFACE;iInfoType:int; var pInfoData:pointer):THANDLE; cdecl; - FileAllow :function(intf:PPROTO_INTERFACE;hContact:THANDLE;hTransfer:THANDLE; szPath:PROTOCHAR):THANDLE; cdecl; - FileCancel:function(intf:PPROTO_INTERFACE;hContact:THANDLE;hTransfer:THANDLE):int; cdecl; - FileDeny :function(intf:PPROTO_INTERFACE;hContact:THANDLE;hTransfer:THANDLE; var szReason:PROTOCHAR):int; cdecl; + FileAllow :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;hTransfer:THANDLE; szPath:PROTOCHAR):THANDLE; cdecl; + FileCancel:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;hTransfer:THANDLE):int; cdecl; + FileDeny :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;hTransfer:THANDLE; var szReason:PROTOCHAR):int; cdecl; FileResume:function(intf:PPROTO_INTERFACE;hTransfer:THANDLE;var action:Integer; var szFilename:PROTOCHAR):int; cdecl; - GetCaps:function(intf:PPROTO_INTERFACE;_type:int):dword_ptr; cdecl; - GetInfo:function(intf:PPROTO_INTERFACE;hContact:THANDLE;infoType:int):int; cdecl; + GetCaps:function(intf:PPROTO_INTERFACE;_type:int;hContact:HCONTACT=0):dword_ptr; cdecl; + GetInfo:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;infoType:int):int; cdecl; SearchBasic :function(intf:PPROTO_INTERFACE;id:PAnsiChar):THANDLE; cdecl; SearchByEmail :function(intf:PPROTO_INTERFACE;email:PAnsiChar):THANDLE; cdecl; @@ -75,24 +158,24 @@ type SearchAdvanced :function(intf:PPROTO_INTERFACE;owner:HWND):HWND; cdecl; CreateExtendedSearchUI:function(intf:PPROTO_INTERFACE;owner:HWND):HWND; cdecl; - RecvContacts:function(intf:PPROTO_INTERFACE;hContact:THANDLE;var ptr:TPROTORECVEVENT):int; cdecl; - RecvFile :function(intf:PPROTO_INTERFACE;hContact:THANDLE;var ptr:TPROTORECVEVENT):int; cdecl; - RecvMessage :function(intf:PPROTO_INTERFACE;hContact:THANDLE;var ptr:TPROTORECVEVENT):int; cdecl; - RecvUrl :function(intf:PPROTO_INTERFACE;hContact:THANDLE;var ptr:TPROTORECVEVENT):int; cdecl; + RecvContacts:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;var ptr:TPROTORECVEVENT):int; cdecl; + RecvFile :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;var ptr:TPROTORECVEVENT):int; cdecl; + RecvMessage :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;var ptr:TPROTORECVEVENT):int; cdecl; + RecvUrl :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;var ptr:TPROTORECVEVENT):int; cdecl; - SendContacts:function(intf:PPROTO_INTERFACE;hContact:THANDLE;flags:int; nContacts:int; var hContactsList:THANDLE):int; cdecl; - SendFile :function(intf:PPROTO_INTERFACE;hContact:THANDLE;szDescription:PROTOCHAR; var ppszFiles:PROTOCHAR):THANDLE; cdecl; - SendMessage :function(intf:PPROTO_INTERFACE;hContact:THANDLE;flags:int; const msg:PAnsiChar):int; cdecl; - SendUrl :function(intf:PPROTO_INTERFACE;hContact:THANDLE;flags:int; const url:PAnsiChar):int; cdecl; + SendContacts:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;flags:int; nContacts:int; var hContactsList:THANDLE):int; cdecl; + SendFile :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;szDescription:PROTOCHAR; var ppszFiles:PROTOCHAR):THANDLE; cdecl; + SendMessage :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;flags:int; const msg:PAnsiChar):int; cdecl; + SendUrl :function(intf:PPROTO_INTERFACE;hContact:HCONTACT;flags:int; const url:PAnsiChar):int; cdecl; - SetApparentMode:function(intf:PPROTO_INTERFACE;hContact:THANDLE;mode:int):int; cdecl; + SetApparentMode:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;mode:int):int; cdecl; SetStatus :function(intf:PPROTO_INTERFACE;iNewStatus:int):int; cdecl; - GetAwayMsg :function(intf:PPROTO_INTERFACE;hContact:THANDLE):THANDLE; cdecl; - RecvAwayMsg:function(intf:PPROTO_INTERFACE;hContact:THANDLE;mode:int;var evt:TPROTORECVEVENT):int; cdecl; + GetAwayMsg :function(intf:PPROTO_INTERFACE;hContact:HCONTACT):THANDLE; cdecl; + RecvAwayMsg:function(intf:PPROTO_INTERFACE;hContact:HCONTACT;mode:int;var evt:TPROTORECVEVENT):int; cdecl; SetAwayMsg :function(intf:PPROTO_INTERFACE;iStatus:int; const msg:PAnsiChar):int; cdecl; - UserIsTyping:function(intf:PPROTO_INTERFACE;hContact:THANDLE; _type:int):int; cdecl; + UserIsTyping:function(intf:PPROTO_INTERFACE;hContact:HCONTACT; _type:int):int; cdecl; OnEvent:function(intf:PPROTO_INTERFACE;iEventType:TPROTOEVENTTYPE;wParam:WPARAM;lParam:LPARAM):int; cdecl; end; diff --git a/include/delphi/m_timezones.inc b/include/delphi/m_timezones.inc index 8ee937d4ed..927d24c277 100644 --- a/include/delphi/m_timezones.inc +++ b/include/delphi/m_timezones.inc @@ -42,25 +42,41 @@ type TIME_API = record cbSize:size_t; - createByName:function(tszName:TChar; dwFlags:dword):THANDLE; cdecl; - createByContact:function(hContact:THANDLE; dwFlags:dword):THANDLE; - storeByContact:procedure(hContact:THANDLE; hTZ:THANDLE); cdecl; + createByName :function (tszName:TChar; dwFlags:dword):THANDLE; cdecl; + createByContact:function (hContact:HCONTACT; dwFlags:dword):THANDLE; + storeByContact :procedure(hContact:HCONTACT; hTZ:THANDLE); cdecl; printDateTime:function(hTZ:THANDLE; szFormat:TChar; szDest:TChar; cbDest:int; dwFlags:dword):int; cdecl; printTimeStamp:function(hTZ:THANDLE; ts:mir_time; szFormat:TChar; szDest:TChar; cbDest:int; dwFlags:dword):int; cdecl; - prepareList :function (hContact:THANDLE; hWnd:HWND; dwFlags:dword):int; cdecl; - selectListItem :function (hContact:THANDLE; hWnd:HWND; dwFlags:dword):int; cdecl; - storeListResults:procedure(hContact:THANDLE; hWnd:HWND; dwFlags:dword); cdecl; + prepareList :function (hContact:HCONTACT; hWnd:HWND; dwFlags:dword):int; cdecl; + selectListItem :function (hContact:HCONTACT; hWnd:HWND; dwFlags:dword):int; cdecl; + storeListResults:procedure(hContact:HCONTACT; hWnd:HWND; dwFlags:dword); cdecl; getTimeZoneTime:function(hTZ:THANDLE; var st:SYSTEMTIME):int; cdecl; timeStampToTimeZoneTimeStamp:function(hTZ:THANDLE; ts:mir_time):time_t; cdecl; - getTzi:function(hTZ:THANDLE):PTimeZoneInformation; cdecl; - getTzName:function(hTZ:THANDLE):TChar; cdecl; + getTzi :function(hTZ:THANDLE):PTimeZoneInformation; cdecl; + getTzName :function(hTZ:THANDLE):TChar; cdecl; getTzDescription:function(TZName:TChar):TChar; cdecl; +(* + int printDateTimeByContact (HCONTACT hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) + { return printDateTime(createByContact(hContact, dwFlags), szFormat, szDest, cbDest, dwFlags); } + + int printTimeStampByContact(HCONTACT hContact, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) + { return printTimeStamp(createByContact(hContact, dwFlags), ts, szFormat, szDest, cbDest, dwFlags); } + + LPTIME_ZONE_INFORMATION getTziByContact(HCONTACT hContact) + { return getTzi(createByContact(hContact, 0)); } + + int getTimeZoneTimeByContact(HCONTACT hContact, SYSTEMTIME *st) + { return getTimeZoneTime(createByContact(hContact, 0), st); } + + mir_time timeStampToTimeZoneTimeStampByContact(HCONTACT hContact, mir_time ts) + { return timeStampToTimeZoneTimeStamp(createByContact(hContact, 0), ts); } +*) end; // every protocol should declare this variable to use the Time API diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index 5b67bffb2b..effcad304d 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -78,13 +78,13 @@ type TWINDOWLISTENTRY = record hList : THANDLE; hWnd : HWND; - hContact: THANDLE; + hContact: HCONTACT; end; PSAVEWINDOWPOS = ^TSAVEWINDOWPOS; TSAVEWINDOWPOS = record hWnd : HWND; - hContact : THANDLE; + hContact : HCONTACT; szModule : PAnsiChar; // module name eto store the settings in szNamePrefix: PAnsiChar; // text to prefix on 'x', 'width', etc end; @@ -349,7 +349,7 @@ type TREPLACEVARSDATA = record cbSize :int; dwFlags :dword; - hContact :THANDLE; + hContact :HCONTACT; variables:PREPLACEVARSARRAY; end; diff --git a/plugins/Actman30/actman30.dpr b/plugins/Actman30/actman30.dpr index 404b2f1054..2f7a24e573 100644 --- a/plugins/Actman30/actman30.dpr +++ b/plugins/Actman30/actman30.dpr @@ -28,8 +28,8 @@ library actman; uses // fastmm4, - m_api, Windows, + m_api, messages, commctrl, common, diff --git a/plugins/Actman30/hooks/i_opt_dlg.inc b/plugins/Actman30/hooks/i_opt_dlg.inc index 69c59c7cc2..8fac1007a1 100644 --- a/plugins/Actman30/hooks/i_opt_dlg.inc +++ b/plugins/Actman30/hooks/i_opt_dlg.inc @@ -157,7 +157,7 @@ procedure CheckButtons(Dialog:HWND); var b:bool; begin - b:=ListView_GetItemCount(GetDlgItem(Dialog,IDC_HOOKLIST))>0; + b:=SendDlgItemMessage(Dialog,IDC_HOOKLIST,LVM_GETITEMCOUNT, 0, 0)>0; EnableWindow(GetDlgItem(Dialog,IDC_EVENTLIST ),b); EnableWindow(GetDlgItem(Dialog,IDC_ACTIONLIST ),b); @@ -190,13 +190,14 @@ end; function DeleteHook(Dialog:HWND):integer; var wnd:HWND; - i:integer; + i,j:integer; begin result:=0; wnd:=GetDlgItem(Dialog,IDC_HOOKLIST); - for i:=ListView_GetItemCount(wnd)-1 downto 0 do + j:=SendMessage(wnd,LVM_GETITEMCOUNT,0,0); + for i:=j-1 downto 0 do begin - if ListView_GetItemState(wnd,i,LVIS_SELECTED)<>0 then + if SendMessage(wnd,LVM_GETITEMSTATE,i,LVIS_SELECTED)<>0 then SendMessage(wnd,LVM_DELETEITEM,i,0); end; Listview_SetItemState(wnd,0, @@ -302,8 +303,6 @@ end; function DlgProcOpt(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; var - wnd:HWND; - lv:LV_COLUMNW; i:integer; tmp:pAnsiChar; buf:array [0..255] of AnsiChar; @@ -330,7 +329,7 @@ begin FillActionList(GetDlgItem(Dialog,IDC_ACTIONLIST)); CreateHKTable(Dialog); - FillHookList(wnd); + FillHookList(GetDlgItem(Dialog,IDC_HOOKLIST)); ShowHookData(Dialog); CheckButtons(Dialog); diff --git a/plugins/Actman30/i_cnst_service.inc b/plugins/Actman30/i_cnst_service.inc deleted file mode 100644 index 2e5f0cca83..0000000000 --- a/plugins/Actman30/i_cnst_service.inc +++ /dev/null @@ -1,12 +0,0 @@ -const - IDC_FLAG_WPAR = 2154; - IDC_FLAG_LPAR = 2155; - IDC_EDIT_WPAR = 2156; - IDC_EDIT_LPAR = 2157; - IDC_EDIT_SERVICE = 2159; - IDC_WSTRUCT = 2160; - IDC_LSTRUCT = 2161; - - IDC_SRV_RESULT = 2255; - IDC_RES_FREEMEM = 2256; - IDC_RES_UNICODE = 2257; diff --git a/plugins/Actman30/i_opt_dlg.inc b/plugins/Actman30/i_opt_dlg.inc index 62a0a6c66f..e7a9e206ef 100644 --- a/plugins/Actman30/i_opt_dlg.inc +++ b/plugins/Actman30/i_opt_dlg.inc @@ -17,7 +17,7 @@ var i:integer; begin result:=0; - NoDescription:=TranslateW('No Description'); + NoDescription:=TranslateW('No description'); StrCopyW(xmlfilename,'c:\export.xml'); diff --git a/plugins/Actman30/i_opt_dlg2.inc b/plugins/Actman30/i_opt_dlg2.inc index 330be64780..3a816a481a 100644 --- a/plugins/Actman30/i_opt_dlg2.inc +++ b/plugins/Actman30/i_opt_dlg2.inc @@ -225,7 +225,7 @@ begin while p<>nil do begin StrCopy(StrCopyE(@buf,IcoLibPrefix),p^.Name); - ImageList_AddIcon(il,CallService(MS_SKIN2_GETICON,0,lparam(@buf))); + ImageList_ReplaceIcon(il,-1,CallService(MS_SKIN2_GETICON,0,lparam(@buf))); cbei.pszText :=TranslateW(FastAnsiToWideBuf(p^.Name,buf)); cbei.iItem :=i; diff --git a/plugins/Actman30/i_sparam_const.inc b/plugins/Actman30/i_sparam_const.inc deleted file mode 100644 index 5571dd96e0..0000000000 --- a/plugins/Actman30/i_sparam_const.inc +++ /dev/null @@ -1,10 +0,0 @@ -const - IDC_FLAG_PAR = 2150; - IDC_EDIT_PAR = 2151; - IDC_STRUCT = 2152; - IDC_STAT_PAR = 2153; - - IDC_RES_TYPE = 2160; - IDC_RES_FREEMEM = 2161; - IDC_RES_GROUP = 2162; - IDC_RES_STAT = 2163; diff --git a/plugins/Actman30/iac_call.pas b/plugins/Actman30/iac_call.pas index 9b0c8dbe3a..33208fb16a 100644 --- a/plugins/Actman30/iac_call.pas +++ b/plugins/Actman30/iac_call.pas @@ -57,17 +57,6 @@ const ACF_CACHE_NOW = $00000002; ACF_CACHE_MACRO = $00000004; -// param flags, same as for service -const - ACF_RSTRING = $00010000; // Service result is string - ACF_RUNICODE = $00020000; // Service result is Widestring - ACF_RSTRUCT = $00040000; // Service result in structure - ACF_RFREEMEM = $00080000; // Need to free memory - - ACF_SCRIPT_PARAM = $00001000; - // dummy - ACF_STRING = 0; - type sp0 = function:int_ptr; stdcall; sp1 = function(arg1:int_ptr):int_ptr; stdcall; @@ -144,7 +133,7 @@ begin for i:=0 to argcount-1 do begin largv[i]:=argv[i]; - PreProcess(argf[i],LPARAM(largv[i]),WorkData); +//!! PreProcess(argf[i],LPARAM(largv[i]),WorkData); end; // call function case argcount of @@ -206,7 +195,7 @@ begin ClearResult(WorkData); // result type processing - if (flags and ACF_RSTRING)<>0 then + if (flags and (ACF_RSTRING or ACF_UNICODE))<>0 then begin if (flags and ACF_RUNICODE)=0 then AnsiToWide(pAnsiChar(res),pWideChar(WorkData.LastResult),MirandaCP) @@ -659,7 +648,8 @@ begin pt.x:=rc.left; pt.y:=rc.bottom; ScreenToClient(Dialog,pt); - SetWindowLongPtrW(wnd1,GWLP_USERDATA,CreateParamBlock(Dialog,0,pt.y+2,168)); + GetClientRect(wnd1,rc); + SetWindowLongPtrW(wnd1,GWLP_USERDATA,CreateParamBlock(Dialog,0,pt.y+2,rc.right)); CheckDlgButton(Dialog,IDC_CLOSE_RES,BST_UNCHECKED); wnd:=GetDlgItem(Dialog,IDC_CLOSE_RES); // count offset from initial pos @@ -668,7 +658,7 @@ begin pt.x:=rc.left; pt.y:=rc.bottom; ScreenToClient(Dialog,pt); - wnd1:=CreateResultBlock(Dialog,0,pt.y+2,168); + wnd1:=CreateResultBlock(Dialog,0,pt.y+2,rc.right-rc.left,ACF_NOVISUAL); SetWindowLongPtrW(wnd,GWLP_USERDATA,wnd1); ShowWindow(wnd1,SW_HIDE); diff --git a/plugins/Actman30/iac_contact.pas b/plugins/Actman30/iac_contact.pas index eb9a5790cd..1ab918e43f 100644 --- a/plugins/Actman30/iac_contact.pas +++ b/plugins/Actman30/iac_contact.pas @@ -24,7 +24,7 @@ const type tContactAction = class(tBaseAction) private - contact:THANDLE; + contact:HCONTACT; public constructor Create(uid:dword); // function Clone:tBaseAction; override; diff --git a/plugins/Actman30/iac_contact.rc b/plugins/Actman30/iac_contact.rc index b3923502b3..65a7d2843e 100644 --- a/plugins/Actman30/iac_contact.rc +++ b/plugins/Actman30/iac_contact.rc @@ -7,7 +7,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0 { - RTEXT "Choose Contact", -1 , 0, 2, 160, 10 + RTEXT "Choose contact", -1 , 0, 2, 160, 10 CONTROL "Refresh",IDC_CNT_REFRESH,"MButtonClass",WS_TABSTOP,1,12,16,16,$18000000 COMBOBOX IDC_CONTACTLIST, 19, 14, 148, 128, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL AUTOCHECKBOX "Keep handle only", IDC_CNT_KEEP , 1, 31, 160, 11 diff --git a/plugins/Actman30/iac_dbrw.pas b/plugins/Actman30/iac_dbrw.pas index 0c9e0ad502..96a44b3f7f 100644 --- a/plugins/Actman30/iac_dbrw.pas +++ b/plugins/Actman30/iac_dbrw.pas @@ -68,7 +68,7 @@ const type tDataBaseAction = class(tBaseAction) private - dbcontact:THANDLE; + dbcontact:HCONTACT; dbmodule :PWideChar; dbsetting:PWideChar; dbvalue :PWideChar; // keep all in unicode (str to int translation fast) @@ -129,7 +129,7 @@ var ambuf,asbuf:array [0..127] of AnsiChar; ls,tmp:pWideChar; tmpa,tmpa1:pAnsiChar; - hContact:THANDLE; + hContact:THCONTACT; proto:pAnsiChar; avalue:uint_ptr; begin diff --git a/plugins/Actman30/iac_global.pas b/plugins/Actman30/iac_global.pas index 1d7957a3bc..cba955d762 100644 --- a/plugins/Actman30/iac_global.pas +++ b/plugins/Actman30/iac_global.pas @@ -89,8 +89,8 @@ procedure InsertString(wnd:HWND;num:dword;str:PAnsiChar); function GetLink(hash:dword):pActModule; function GetLinkByName(name:pAnsiChar):pActModule; -function ImportContact (node:HXML ):THANDLE; -function ImportContactINI(node:pointer):THANDLE; +function ImportContact (node:HXML ):HCONTACT; +function ImportContactINI(node:pointer):HCONTACT; implementation @@ -301,7 +301,7 @@ const ioCUID = 'cuid'; ioCUIDType = 'cuidtype'; -function ImportContact(node:HXML):THANDLE; +function ImportContact(node:HXML):HCONTACT; var proto:pAnsiChar; tmpbuf:array [0..63] of AnsiChar; @@ -352,7 +352,7 @@ begin end; end; -function ImportContactINI(node:pointer):THANDLE; +function ImportContactINI(node:pointer):HCONTACT; { var proto:pAnsiChar; @@ -441,48 +441,84 @@ type const actDLLCache: tDLLCache = nil; -function GetDllHandle(dllname:pAnsiChar;mode:dword=0):THANDLE; +function GetDllHandle(adllname:pAnsiChar;mode:dword=0):THANDLE; var - i:integer; + i,zero:integer; begin - result:=LoadLibraryA(dllname); -exit; + // 1 - search that name in cache i:=0; + zero:=-1; while i<=HIGH(actDLLCache) do begin - if StrCmp(actDLLCache[i].DllName,dllname)=0 then + with actDLLCache[i] do begin - result:=actDLLCache[i].DllHandle; - // check mode - exit; + // remember first empty slot + if DllHandle=0 then + begin + if zero<0 then + zero:=i; + end + else if StrCmp(DllName,adllname)=0 then + begin + result:=DllHandle; + inc(count); + if mode=3 then // per-session + flags:=3; + exit; + end; end; inc(i); end; - result:=LoadLibraryA(dllname); - // check mode - SetLength(actDLLCache,i); - StrDup(actDLLCache[i].DllName,dllname); - actDLLCache[i].DllHandle:=result; -// actDLLCache.flags:=; + // 2 - not found, load library + result:=LoadLibraryA(adllname); + // 3 - add to cache if not per-action + if mode<>0 then + begin + if zero>=0 then + i:=zero + else + begin + SetLength(actDLLCache,i); + dec(i); + end; + + with actDLLCache[i] do + begin + StrDup(DllName,adllname); + DllHandle:=result; + count :=0; + flags :=mode; + end; + end; end; procedure CloseDllHandle(handle:THANDLE); var i:integer; begin - FreeLibrary(handle); -exit; - i:=0; - while i<=HIGH(actDLLCache) do + i:=HIGH(actDLLCache); + while i>=0 do begin - if actDLLCache[i].DllHandle=handle then + with actDLLCache[i] do begin - // check mode - FreeLibrary(actDLLCache[i].DllHandle); - exit; + if DllHandle=handle then + begin + dec(count); + if count=0 then + begin + if flags=2 then // per-macro+not needed -> free + begin + FreeLibrary(DllHandle); + DllHandle:=0; + mFreeMem(DllName); + end; + end; + exit; + end; end; - inc(i); + dec(i); end; + // if not found in cache FreeLibrary(handle); end; @@ -490,10 +526,17 @@ procedure FreeDllHandleCache; var i:integer; begin - i:=0; - while i<=HIGH(actDLLCache) do + i:=HIGH(actDLLCache); + while i>=0 do begin + if actDLLCache[i].DllHandle<>0 then + begin + FreeLibrary(actDLLCache[i].DllHandle); + mFreeMem(actDLLCache[i].DllName); + end; + dec(i); end; + SetLength(actDLLCache,0); end; end. diff --git a/plugins/Actman30/iac_inout.pas b/plugins/Actman30/iac_inout.pas index 999d3fccaf..c64b96e669 100644 --- a/plugins/Actman30/iac_inout.pas +++ b/plugins/Actman30/iac_inout.pas @@ -85,7 +85,7 @@ var tmp:PWideChar; blob,p:PAnsiChar; w:PWideChar; - hContact:THANDLE; + hContact:THCONTACT; wnd:HWND; fexist:bool; dbei:TDBEVENTINFO; diff --git a/plugins/Actman30/iac_service.pas b/plugins/Actman30/iac_service.pas index 67a565c477..b31ab403b1 100644 --- a/plugins/Actman30/iac_service.pas +++ b/plugins/Actman30/iac_service.pas @@ -10,9 +10,9 @@ uses m_api, sedit,strans,mApiCardM, mirutils,dbsettings, editwrapper, + sparam,srvblock, syswin,wrapper,common; -{$include i_cnst_service.inc} {$resource iac_service.res} const @@ -254,7 +254,7 @@ begin ClearResult(WorkData); // result type processing - if (flags and ACF_RSTRING)<>0 then + if (flags and (ACF_RSTRING or ACF_UNICODE))<>0 then begin //!! delete old or not? if (flags and ACF_RUNICODE)=0 then @@ -467,420 +467,62 @@ end; //----- Dialog realization ----- -const - ptNumber = 0; - ptString = 1; - ptUnicode = 2; - ptCurrent = 3; - ptResult = 4; - ptParam = 5; - ptStruct = 6; -const - sresInt = 0; - sresString = 1; - sresStruct = 2; - -procedure MakeResultTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,sresInt ,'Integer'); - InsertString(wnd,sresString,'String'); - InsertString(wnd,sresStruct,'Structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -procedure MakeParamTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,ptNumber ,'number value'); - InsertString(wnd,ptString ,'ANSI string'); - InsertString(wnd,ptUnicode,'Unicode string'); - InsertString(wnd,ptCurrent,'current contact'); - InsertString(wnd,ptResult ,'last result'); - InsertString(wnd,ptParam ,'parameter'); - InsertString(wnd,ptStruct ,'structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -var - ApiCard:tmApiCard; - -function FixParam(Dialog:HWND;buf:PAnsiChar;flag:integer):integer; -begin - if StrCmp(buf,Translate('hContact' ))=0 then result:=ptCurrent - else if StrCmp(buf,Translate('parameter' ))=0 then result:=ptParam - else if StrCmp(buf,Translate('result' ))=0 then result:=ptResult - else if StrCmp(buf,Translate('structure' ))=0 then result:=ptStruct - else if StrCmp(buf,Translate('Unicode text'))=0 then result:=ptUnicode - else - begin - if (buf[0] in ['0'..'9']) or ((buf[0]='-') and (buf[1] in ['0'..'9'])) or - ((buf[0]='$') and (buf[1] in sHexNum)) or - ((buf[0]='0') and (buf[1]='x') and (buf[2] in sHexNum)) then - result:=ptNumber - else - result:=ptString; - end; - - CB_SelectData(Dialog,flag,result); -// SendDlgItemMessage(Dialog,flag,CB_SETCURSEL,result,0); - SendMessage(Dialog,WM_COMMAND,(CBN_SELCHANGE shl 16) or flag,GetDlgItem(Dialog,flag)); -end; - -procedure ReloadService(Dialog:HWND;setvalue:boolean); -var - pc:pAnsiChar; - buf,buf1:array [0..127] of AnsiChar; - wnd:hwnd; - i:integer; - struct:pAnsiChar; -// bufw:array [0..MaxDescrLen] of WideChar; -begin - wnd:=GetDlgItem(Dialog,IDC_EDIT_SERVICE); - SendMessageA(wnd,CB_GETLBTEXT,SendMessage(wnd,CB_GETCURSEL,0,0),tlparam(@buf)); - ApiCard.Service:=@buf; - - pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_WPAR),true); - if pc<>nil then - begin - if GetDlgItemTextA(Dialog,IDC_EDIT_WPAR,buf1,SizeOf(buf1))>0 then - case FixParam(Dialog,@buf1,IDC_FLAG_WPAR) of - ptStruct: begin - if setvalue then - begin - struct:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(struct,StrScan(pc,'|')+1)))); - mFreeMem(struct); - end; - -{ struct:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(struct); - StrDup(struct,StrScan(pc,'|')+1); - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA,long_ptr(struct)); -// AnsiToWide(StrScan(pc,'|')+1,wstruct,MirandaCP); -} - end; - end; - mFreeMem(pc); - end; - - pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_LPAR),false); - if pc<>nil then - begin - if GetDlgItemTextA(Dialog,IDC_EDIT_LPAR,buf1,SizeOf(buf1))>0 then - case FixParam(Dialog,@buf1,IDC_FLAG_LPAR) of - ptStruct: begin - if setvalue then - begin - struct:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(struct,StrScan(pc,'|')+1)))); - mFreeMem(struct); - end; -{ - struct:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(struct); - StrDup(struct,StrScan(pc,'|')+1); - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA,long_ptr(struct)); -// AnsiToWide(StrScan(pc,'|')+1,lstruct,MirandaCP); -} - end; - end; - mFreeMem(pc); - end; - - pc:=ApiCard.ResultType; - i:=sresInt; - if pc<>nil then - begin - if lstrcmpia(pc,'struct')=0 then i:=sresStruct - else if lstrcmpia(pc,'str')=0 then - begin - i:=sresString; - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_UNCHECKED); - end - else if lstrcmpia(pc,'wide')=0 then - begin - i:=sresString; - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_CHECKED); - end; - mFreeMem(pc); - end; - CB_SelectData(Dialog,IDC_SRV_RESULT,i); -// ApiCard.Show; -end; - -// true - need to show structure -function SetParam(Dialog:HWND; aflags:dword; id:integer; aparam:pWideChar):integer; -var - wnd:HWND; -begin - wnd:=GetDlgItem(Dialog,id); - if (aflags and ACF_PARAM)<>0 then - begin - EnableWindow(wnd,false); - result:=ptParam; - end - else if (aflags and ACF_RESULT)<>0 then - begin - EnableWindow(wnd,false); - result:=ptResult; - end - else if (aflags and ACF_CURRENT)<>0 then - begin - EnableWindow(wnd,false); - result:=ptCurrent; - end - else if (aflags and ACF_PARNUM)<>0 then - begin - result:=ptNumber; - SetDlgItemTextW(Dialog,id,aparam); - end - else if (aflags and ACF_STRUCT)<>0 then - begin - result:=ptStruct; - end - else if (aflags and ACF_UNICODE)<>0 then - begin - result:=ptUnicode; - SetDlgItemTextW(Dialog,id,aparam); - end - else - begin - result:=ptString; - SetDlgItemTextW(Dialog,id,aparam); - end; - SetEditFlags(wnd,EF_SCRIPT,ord((aflags and ACF_SCRIPT_PARAM)<>0)); -end; - -procedure ClearFields(Dialog:HWND); -var - wnd:HWND; -begin - ShowWindow(GetDlgItem(Dialog,IDC_WSTRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_WPAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); -//?? SetDlgItemTextW(Dialog,IDC_EDIT_WPAR,nil); - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),ptNumber); - SetEditFlags(wnd,EF_ALL,0); - - ShowWindow (GetDlgItem(Dialog,IDC_LSTRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_LPAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); -//?? SetDlgItemTextW(Dialog,IDC_EDIT_LPAR,nil); - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),ptNumber); - SetEditFlags(wnd,EF_ALL,0); - - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_HIDE); - CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_UNCHECKED); - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_UNCHECKED); - - CB_SelectData(Dialog,IDC_SRV_RESULT,sresInt); -end; - function DlgProc(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -const - NoProcess:boolean=true; var - i:integer; - pc,pc1:pAnsiChar; - wnd,wnd1:HWND; - pcw:PWideChar; + ServiceBlock:HWND; + rc:TRECT; + sv:tServiceValue; begin result:=0; case hMessage of WM_DESTROY: begin - ApiCard.Free; - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(pc); - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(pc); end; WM_INITDIALOG: begin - MakeResultTypeList(GetDlgItem(Dialog,IDC_SRV_RESULT)); - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_WPAR)); - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_LPAR)); + GetClientRect(Dialog,rc); + ServiceBlock:=CreateServiceBlock(Dialog,0,0,rc.right,rc.bottom,ACF_NOVISUAL or ACF_SCRIPT_EXPAND); + SetWindowLongPtrW(Dialog,GWLP_USERDATA,ServiceBlock); + SetServiceListMode(ServiceBlock,DBReadByte(0,DBBranch,'SrvListMode')); TranslateDialogDefault(Dialog); - -//?? - MakeEditField(Dialog,IDC_EDIT_SERVICE); - MakeEditField(Dialog,IDC_EDIT_WPAR); - MakeEditField(Dialog,IDC_EDIT_LPAR); - - ApiCard:=CreateServiceCard(Dialog); - ApiCard.FillList(GetDlgItem(Dialog,IDC_EDIT_SERVICE), - DBReadByte(0,DBBranch,'SrvListMode')); end; WM_ACT_SETVALUE: begin - NoProcess:=true; - ClearFields(Dialog); - + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); with tServiceAction(lParam) do begin - if CB_SelectData(Dialog,IDC_EDIT_SERVICE,Hash(service,StrLen(service)))<>CB_ERR then -// if SendDlgItemMessageA(Dialog,IDC_EDIT_SERVICE,CB_SELECTSTRING,twparam(-1),tlparam(service))<>CB_ERR then - ReloadService(Dialog,false) - else - SetDlgItemTextA(Dialog,IDC_EDIT_SERVICE,service); -//!! - SetEditFlags(GetDlgItem(Dialog,IDC_EDIT_SERVICE),EF_SCRIPT, - ord((flags and ACF_SCRIPT_SERVICE)<>0)); - - // RESULT - if (flags and ACF_RSTRUCT)<>0 then - i:=sresStruct - else if (flags and ACF_RSTRING)<>0 then - begin - i:=sresString; - if (flags and ACF_RUNICODE)<>0 then CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_CHECKED); - if (flags and ACF_RFREEMEM)<>0 then CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_CHECKED); - end - else - begin - i:=sresInt; - end; - CB_SelectData(Dialog,IDC_SRV_RESULT,i); - - // WPARAM - i:=SetParam(Dialog,flags,IDC_EDIT_WPAR,pWideChar(wparam)); - if i=ptStruct then - begin - ShowEditField(GetDlgItem(Dialog,IDC_EDIT_WPAR),SW_HIDE); - ShowWindow (GetDlgItem(Dialog,IDC_WSTRUCT ),SW_SHOW); - -{ - p:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(p); -} - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(pc,pAnsiChar(wparam)))); - end; - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),i); - - // LPARAM - i:=SetParam(Dialog,flags2,IDC_EDIT_LPAR,pWideChar(lparam)); - if i=ptStruct then - begin - ShowEditField(GetDlgItem(Dialog,IDC_EDIT_LPAR),SW_HIDE); - ShowWindow (GetDlgItem(Dialog,IDC_LSTRUCT ),SW_SHOW); - -{ - p:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(p); -} - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(pc,pAnsiChar(lparam)))); - end; - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),i); - + sv.service:=service; + sv.w_flag :=flags; + sv.wparam :=wparam; + sv.l_flag :=flags2; + sv.lparam :=lparam; + sv.flags :=flags; end; - NoProcess:=false; + SetSrvBlockValue(ServiceBlock,sv); end; WM_ACT_RESET: begin - NoProcess:=true; - ClearFields(Dialog); - SetDlgItemTextW(Dialog,IDC_EDIT_SERVICE,nil); - SetDlgItemTextW(Dialog,IDC_EDIT_WPAR,'0'); - SetDlgItemTextW(Dialog,IDC_EDIT_LPAR,'0'); -{ - ShowWindow(GetDlgItem(Dialog,IDC_WSTRUCT),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_LSTRUCT),SW_HIDE); -} - NoProcess:=false; + ClearServiceBlock(GetWindowLongPtrW(Dialog,GWLP_USERDATA)); end; WM_ACT_SAVE: begin with tServiceAction(lParam) do begin - //WPARAM - wnd:=GetDlgItem(Dialog,IDC_EDIT_WPAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_WPAR)) of - ptParam: begin - flags:=flags or ACF_PARAM - end; - ptResult: begin - flags:=flags or ACF_RESULT - end; - ptCurrent: begin - flags:=flags or ACF_CURRENT - end; - ptNumber: begin - flags:=flags or ACF_PARNUM; - wparam:=GetDlgText(wnd); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(wparam), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - wparam:=GetDlgText(wnd); - end; - ptString: wparam:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_PARAM; - - // LPARAM - wnd:=GetDlgItem(Dialog,IDC_EDIT_LPAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_LPAR)) of - ptParam: begin - flags2:=flags2 or ACF_PARAM - end; - ptResult: begin - flags2:=flags2 or ACF_RESULT - end; - ptCurrent: begin - flags2:=flags2 or ACF_CURRENT - end; - ptNumber: begin - flags2:=flags2 or ACF_PARNUM; - lparam:=GetDlgText(wnd); - end; - ptStruct: begin - flags2:=flags2 or ACF_STRUCT; - StrDup(pAnsiChar(lparam), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags2:=flags2 or ACF_UNICODE; - lparam:=GetDlgText(wnd); - end; - ptString: lparam:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags2:=flags2 or ACF_SCRIPT_PARAM; - - // RESULT - case CB_GetData(GetDlgItem(Dialog,IDC_SRV_RESULT)) of - sresString: begin - flags:=flags or ACF_RSTRING; - if IsDlgButtonChecked(Dialog,IDC_RES_UNICODE)=BST_CHECKED then - flags:=flags or ACF_RUNICODE; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - flags:=flags or ACF_RFREEMEM; - end; - sresStruct: flags:=flags or ACF_RSTRUCT; - end; - - service:=ApiCard.NameFromList(GetDlgItem(Dialog,IDC_EDIT_SERVICE)); -//!! - if (GetEditFlags(Dialog,IDC_EDIT_SERVICE) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_SERVICE; + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); + GetSrvBlockValue(ServiceBlock,sv); + + service:=sv.service; + wparam :=sv.wparam; + lparam :=sv.lparam; + flags2 :=sv.l_flag; + flags :=sv.flags or sv.w_flag; end; end; + //?? WM_SHOWWINDOW: begin +{ // hide window by ShowWindow function if (lParam=0) and (wParam=0) then begin @@ -889,100 +531,15 @@ begin pc:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA,0)); mFreeMem(pc); end; +} end; - +{ WM_COMMAND: begin - case wParam shr 16 of -{ CBN_EDITUPDATE, -} - CBN_EDITCHANGE, - EN_CHANGE: if not NoProcess then - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - - CBN_SELCHANGE: begin - case loword(wParam) of - IDC_SRV_RESULT: begin - i:=CB_GetData(lParam); - case i of - sresInt,sresStruct: begin - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_HIDE); - end; - sresString: begin - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_SHOW); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_SHOW); - end; - end; - end; - - IDC_FLAG_WPAR,IDC_FLAG_LPAR: begin - if loword(wParam)=IDC_FLAG_WPAR then - begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_WPAR); - wnd1:=GetDlgItem(Dialog,IDC_WSTRUCT); - end - else - begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_LPAR); - wnd1:=GetDlgItem(Dialog,IDC_LSTRUCT); - end; - i:=CB_GetData(GetDlgItem(Dialog,loword(wParam))); - - if i=ptStruct then - begin - ShowEditField(wnd,SW_HIDE); - ShowWindow(wnd1,SW_SHOW); - end - else - begin - ShowEditField(wnd,SW_SHOW); - ShowWindow(wnd1,SW_HIDE); - if i in [ptCurrent,ptResult,ptParam] then - EnableEditField(wnd,false) - else - begin - if i=ptNumber then - begin - pcw:='0'; - SendMessageW(wnd,WM_SETTEXT,0,TLParam(pcw)); - end; - EnableEditField(wnd,true); - end; - end; - end; - - IDC_EDIT_SERVICE: ReloadService(Dialog,true); - end; - if not NoProcess then - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - - BN_CLICKED: begin - case loword(wParam) of - IDC_WSTRUCT, IDC_LSTRUCT: begin - pc:=pAnsiChar(GetWindowLongPtrW(lParam,GWLP_USERDATA)); -//!!!! - pc1:=EditStructure(pAnsiChar(pc),Dialog); - if pc1<>nil then - begin - mFreeMem(pc); - SetWindowLongPtrW(lParam,GWLP_USERDATA,long_ptr(pc1)); - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - end; - else - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - end; - - end; end; - +} WM_HELP: begin - pc:=ApiCard.NameFromList(GetDlgItem(Dialog,IDC_EDIT_SERVICE)); - ApiCard.Service:=pc; - mFreeMem(pc); - ApiCard.Show; + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); + SendMessage(ServiceBlock,WM_HELP,0,0); result:=1; end; diff --git a/plugins/Actman30/iac_service.rc b/plugins/Actman30/iac_service.rc index 10160c5361..ff9f972ff4 100644 --- a/plugins/Actman30/iac_service.rc +++ b/plugins/Actman30/iac_service.rc @@ -1,4 +1,3 @@ -#include "i_cnst_service.inc" LANGUAGE 0,0 @@ -7,26 +6,6 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0 { - GROUPBOX "Result" , -1, 1, 0, 166, 64, WS_GROUP - RTEXT "Result type" , -1 , 4, 10, 159, 11 - COMBOBOX IDC_SRV_RESULT , 4, 21, 159, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - AUTOCHECKBOX "Free memory" , IDC_RES_FREEMEM, 4, 38, 159, 11 - AUTOCHECKBOX "Unicode string", IDC_RES_UNICODE, 4, 50, 159, 11 - - RTEXT "Service name", -1, 1, 68, 160, 8 - COMBOBOX IDC_EDIT_SERVICE , 1, 78, 166, 96, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL | CBS_SORT - - RTEXT "wParam type", -1, 1, 101, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_WPAR, 66, 101, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "wParam" , -1, 1, 116, 160, 8 - COMBOBOX IDC_EDIT_WPAR, 1, 116, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_WSTRUCT , 1, 116, 166, 14 - - RTEXT "lParam type", -1, 1, 142, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_LPAR, 66, 142, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "lParam" , -1, 1, 157, 160, 8 - COMBOBOX IDC_EDIT_LPAR, 1, 157, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_LSTRUCT , 1, 157, 166, 14 } IDI_SERVICE ICON "ico\service.ico" diff --git a/plugins/Actman30/services.ini b/plugins/Actman30/services.ini index 853155450d..f40d814f67 100644 --- a/plugins/Actman30/services.ini +++ b/plugins/Actman30/services.ini @@ -11,10 +11,10 @@ ;if "return" starts from int/hex/str/struct then separator, result type will set -;[Event:Event (name or constant] +;[Event:Event (name or constant)] ;alias=constant name ;descr=text -;plugin=placement (including "core" and empty = "unknown" +;plugin=placement (including "core" and empty = "unknown") ;wparam= ;lparam= @@ -23,6 +23,14 @@ ;descr: structure description ;plugin: where defined +[Service:DB/UI/ChangePassword] +alias=MS_DB_CHANGEPASSWORD +wparam=0 +lparam=0 +return=0 +descr=Show window for new/changed profile password +plugin=db3x_mmap + [Service:CListFrames/HideALLFramesTB] alias=MS_CLIST_FRAMES_HIDEALLFRAMESTB wparam=0 @@ -280,7 +288,14 @@ alias=MS_PROTO_CALLCONTACTSERVICE wparam=0 lparam=structure|0|native|b.ptr|native|native| return=result of protocol service call -descr=send a general request through the protocol chain for a contact +descr=Send a general request through the protocol chain for a contact + +[Service:Proto/GetContactBaseAccount] +alias=MS_PROTO_GETCONTACTBASEACCOUNT +wparam=hContact +lparam=0 +return=str, account name +descr=Return account name associated to contact (no need to free it) [Service:Protos/ShowAccountManager] alias=MS_PROTO_SHOWACCMGR @@ -464,7 +479,7 @@ lparam=0 [Event:CList/DoubleClicked] alias=ME_CLIST_DOUBLECLICKED plugin=contact list -descr='Double click on the CList' +descr='Double click on the contact list' wparam=hContact lparam=0 diff --git a/plugins/Actman30/sparam.pas b/plugins/Actman30/sparam.pas deleted file mode 100644 index e29d375ae4..0000000000 --- a/plugins/Actman30/sparam.pas +++ /dev/null @@ -1,708 +0,0 @@ -unit sparam; - -interface - -uses windows,iac_global; - -const - ACF_PARNUM = $00000001; // Param is number - ACF_UNICODE = $00000002; // Param is Unicode string - ACF_CURRENT = $00000004; // Param is ignored, used current user handle - // from current message window - ACF_RESULT = $00000008; // Param is previous action result - ACF_PARAM = $00000010; // Param is Call parameter - ACF_STRUCT = $00000020; - ACF_PARTYPE = ACF_PARNUM or ACF_UNICODE or - ACF_CURRENT or ACF_RESULT or - ACF_PARAM or ACF_STRUCT; - ACF_TEMPLATE = $00000800; - ACF_SCRIPT_PARAM = $00001000; - // dummy - ACF_STRING = 0; - - ACF_RSTRING = $00010000; // Service result is string - ACF_RUNICODE = $00020000; // Service result is Widestring - ACF_RSTRUCT = $00040000; // Service result in structure - ACF_RFREEMEM = $00080000; // Need to free memory - -function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE; -procedure ClearParamFields(Dialog:HWND); -function FillParam (Dialog:HWND;txt:pAnsiChar):integer; -function SetParamValue (Dialog:HWND; flags:dword; value:pointer):boolean; -function GetParamValue (Dialog:HWND;var flags:dword;var value:pointer):boolean; - -procedure ClearParam (flags:dword; var param); -function DuplicateParam(flags:dword; var sparam,dparam):dword; - -procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData); - -function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE; -procedure ClearResultFields(Dialog:HWND); -function SetResultValue(Dialog:HWND;flags:dword):integer; -function GetResultValue(Dialog:HWND):dword; - -implementation - -uses - messages, - common, editwrapper, wrapper, syswin, - m_api, sedit, strans, mirutils; - -{$include i_sparam_const.inc} -{$resource sparam.res} - -const - ptNumber = 0; - ptString = 1; - ptUnicode = 2; - ptCurrent = 3; - ptResult = 4; - ptParam = 5; - ptStruct = 6; - -const - sresInt = 0; - sresString = 1; - sresWide = 2; - sresStruct = 3; - -//----- Processing functions ----- - -procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData); -var - tmp1:pWideChar; -begin - with WorkData do - begin - if (flags and ACF_STRUCT)<>0 then - begin - l_param:=uint_ptr(MakeStructure(pAnsiChar(l_param),Parameter,LastResult,ResultType)) - end - else if (flags and ACF_PARAM)<>0 then - begin - l_param:=Parameter; - end - else if (flags and ACF_RESULT)<>0 then - begin - l_param:=LastResult; - end - else if (flags and ACF_CURRENT)<>0 then - begin - l_param:=WndToContact(WaitFocusedWndChild(GetForegroundwindow){GetFocus}); - end - else - begin - if (flags and ACF_SCRIPT_PARAM)<>0 then - l_param:=uint_ptr(ParseVarString(pWideChar(l_param),Parameter)); - - tmp1:=pWideChar(l_param); - if (flags and ACF_PARNUM)=0 then - begin - if (flags and ACF_UNICODE)=0 then - WideToAnsi(tmp1,pAnsiChar(l_param),MirandaCP) - else - StrDupW(pWideChar(l_param),tmp1); - end - else - l_param:=NumToInt(tmp1); - - if (flags and ACF_SCRIPT_PARAM)<>0 then - mFreeMem(tmp1); - end; - end; -end; - -procedure PostProcess(flags:dword;var l_param:LPARAM; var WorkData:tWorkData); -var - code:integer; - len:integer; - pc:pAnsiChar; -begin - if (flags and ACF_STRUCT)<>0 then - begin - with WorkData do - begin - LastResult:=GetStructureResult(l_param,@code,@len); - case code of -{ - SST_LAST: begin - result:=LastResult; - end; -} - SST_PARAM: begin //?? - LastResult:=Parameter; - ResultType:=rtInt; - end; - SST_BYTE,SST_WORD,SST_DWORD, - SST_QWORD,SST_NATIVE: begin - ResultType:=rtInt; - end; - SST_BARR: begin - StrDup(pAnsiChar(pc),pAnsiChar(LastResult),len); - AnsiToWide(pAnsiChar(pc),PWideChar(LastResult),MirandaCP); - mFreeMem(pAnsiChar(pc)); - ResultType:=rtWide; - end; - SST_WARR: begin - StrDupW(pWideChar(LastResult),pWideChar(LastResult),len); - ResultType:=rtWide; - end; - SST_BPTR: begin - AnsiToWide(pAnsiChar(LastResult),pWideChar(LastResult),MirandaCP); - ResultType:=rtWide; - end; - SST_WPTR: begin - StrDupW(pWideChar(LastResult),pWideChar(LastResult)); - ResultType:=rtWide; - end; - end; - FreeStructure(l_param); - l_param:=0; - end - end; -end; - -//----- Dialog functions ----- - -procedure MakeParamTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,ptNumber ,'number value'); - InsertString(wnd,ptString ,'ANSI string'); - InsertString(wnd,ptUnicode,'Unicode string'); - InsertString(wnd,ptCurrent,'current contact'); - InsertString(wnd,ptResult ,'last result'); - InsertString(wnd,ptParam ,'parameter'); - InsertString(wnd,ptStruct ,'structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -function IsParamNumber(txt:pAnsiChar):boolean; -begin - if (txt[0] in ['0'..'9']) or ((txt[0]='-') and (txt[1] in ['0'..'9'])) or - ((txt[0]='$') and (txt[1] in sHexNum)) or - ((txt[0]='0') and (txt[1]='x') and (txt[2] in sHexNum)) then - result:=true - else - result:=false; -end; - -// Set parameter type by parameter template -function FixParam(buf:PAnsiChar):integer; -begin - if StrCmp(buf,'hContact' )=0 then result:=ptCurrent - else if StrCmp(buf,'parameter' )=0 then result:=ptParam - else if StrCmp(buf,'result' )=0 then result:=ptResult - else if StrCmp(buf,'structure' )=0 then result:=ptStruct - else if StrCmp(buf,'Unicode text')=0 then result:=ptUnicode - else result:=ptString; -end; - -// get line from template -function GetParamLine(src:pAnsiChar;dst:pWideChar;var ltype:integer):pAnsiChar; -var - pp,pc:pAnsiChar; - savechar:AnsiChar; - j:integer; -begin - pc:=StrScan(src,'|'); - - if pc<>nil then - begin - savechar:=pc^; - pc^:=#0; - end; - - if IsParamNumber(src) then - begin - j:=0; - pp:=src; - repeat - dst[j]:=WideChar(pp^); - inc(j); inc(pp); - until (pp^=#0) or (pp^=' '); - dst[j]:=WideChar(pp^); // anyway, #0 or " " needs - if pp^<>#0 then - begin - dst[j+1]:='-'; dst[j+2]:=' '; inc(j,3); - FastAnsitoWideBuf(pp+1,dst+j); - StrCopyW(dst+j,TranslateW(dst+j)); - end; - ltype:=ptNumber; - end - else - begin - ltype:=FixParam(src); - StrCopyW(dst,TranslateW(FastAnsitoWideBuf(src,dst))); - end; - - if pc<>nil then - begin - pc^:=savechar; - inc(pc); - end; - - result:=pc; -end; - -// Set parameter value by parameter template -function FillParam(Dialog:HWND;txt:pAnsiChar):integer; -var - bufw:array [0..2047] of WideChar; - wnd:HWND; - p,pc:PAnsiChar; - ltype:integer; -begin - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - SendMessage(wnd,CB_RESETCONTENT,0,0); - if (txt<>nil) and (txt^<>#0) then - begin - result:=-1; - p:=txt; - repeat - pc:=GetParamLine(p,bufw,ltype); - if result<0 then - result:=ltype; - SendMessageW(wnd,CB_ADDSTRING,0,lparam(@bufw)); - - if result=ptStruct then - break - else - p:=pc; - until pc=nil; - end - else - result:=ptNumber; - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -procedure ClearParamFields(Dialog:HWND); -var - wnd:HWND; -begin - ShowWindow(GetDlgItem(Dialog,IDC_STRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); - SetEditFlags (wnd,EF_ALL,0); - CB_SelectData(Dialog,IDC_FLAG_PAR,ptNumber); -end; - -function ParamDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl; -begin - case urc^.wId of - IDC_FLAG_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT - IDC_EDIT_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_STRUCT: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_STAT_PAR: result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP; -// IDC_CLOSE: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - else - result:=0; - end; -end; - -function DlgParamProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -var - wnd,wnd1:HWND; - i:integer; - pcw:pWideChar; - pc:pAnsiChar; - urd:TUTILRESIZEDIALOG; -begin - result:=0; - - case hMessage of - WM_DESTROY: begin - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA)); - mFreeMem(pc); - end; - - WM_INITDIALOG: begin - MakeEditField(Dialog,IDC_EDIT_PAR); - - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_PAR)); - end; - - WM_SIZE: begin - FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0); - urd.cbSize :=SizeOf(urd); - urd.hwndDlg :=Dialog; - urd.hInstance :=hInstance; - urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SPARAM'); - urd.lParam :=0; - urd.pfnResizer:=@ParamDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd)); - end; - - WM_SHOWWINDOW: begin - // hide window by ShowWindow function - if (lParam=0) and (wParam=0) then - begin - pc:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA,0)); - mFreeMem(pc); - end; - end; - - WM_COMMAND: begin - case wParam shr 16 of - CBN_EDITCHANGE, - EN_CHANGE: begin - SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog); - end; - - CBN_SELCHANGE: begin - SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog); - case loword(wParam) of - IDC_FLAG_PAR: begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_PAR); - wnd1:=GetDlgItem(Dialog,IDC_STRUCT); - - i:=CB_GetData(GetDlgItem(Dialog,loword(wParam))); - - if i=ptStruct then - begin - ShowEditField(wnd ,SW_HIDE); - ShowWindow (wnd1,SW_SHOW); - end - else - begin - ShowEditField(wnd ,SW_SHOW); - ShowWindow (wnd1,SW_HIDE); - - if i in [ptCurrent,ptResult,ptParam] then - EnableEditField(wnd,false) - else - begin - if i=ptNumber then - begin - pcw:='0'; - SendMessageW(wnd,WM_SETTEXT,0,TLParam(pcw)); - end; - EnableEditField(wnd,true); - end; - end; - end; - end; - end; - end; - end; - end; -end; - -//----- Common interface functions ----- - -function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE; -var - rc,rc1:TRECT; -begin - SetRect(rc,x,y,x+width,y+0{dlgheight}); - MapDialogRect(parent,rc); - - result:=CreateDialogW(hInstance,'IDD_SPARAM',parent,@DlgParamProc); - GetClientRect(result,rc1); - SetWindowPos(result,0, - x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top, - SWP_NOZORDER); -end; - -// if separate -function DestroyBlock(block:pointer):integer; -begin - result:=0; -end; - -function SetParamValue(Dialog:HWND;flags:dword;value:pointer):boolean; -var - wnd,wnd1:HWND; - pc:pAnsiChar; - vtype:integer; -begin - result:=true; -//?? Check for "Apply" activation - - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - if (flags and ACF_TEMPLATE)<>0 then - begin - vtype:=FillParam(Dialog,value); - end - else if (flags and ACF_PARAM)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Parameter'))); - EnableWindow(wnd,false); - vtype:=ptParam; - end - else if (flags and ACF_RESULT)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Last result'))); - EnableWindow(wnd,false); - vtype:=ptResult; - end - else if (flags and ACF_CURRENT)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Current user'))); - EnableWindow(wnd,false); - vtype:=ptCurrent; - end - else if (flags and ACF_STRUCT)<>0 then - begin - vtype:=ptStruct; - - ShowEditField(wnd,SW_HIDE); - wnd1:=GetDlgItem(Dialog,IDC_STRUCT); - ShowWindow(wnd1,SW_SHOW); - // delete old value - pc:=pAnsiChar(GetWindowLongPtrW(wnd1,GWLP_USERDATA)); - mFreeMem(pc); - // set newly allocated - SetWindowLongPtrW(wnd1,GWLP_USERDATA,long_ptr(StrDup(pc,pAnsiChar(value)))); -//!!!!!!!! - end - else if (flags and ACF_PARNUM)<>0 then - begin - vtype:=ptNumber; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end - else if (flags and ACF_UNICODE)<>0 then - begin - vtype:=ptUnicode; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end - else - begin - vtype:=ptString; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end; - SetEditFlags(wnd,EF_SCRIPT,ord((flags and ACF_SCRIPT_PARAM)<>0)); - - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_PAR),vtype); -end; - -function GetParamValue(Dialog:HWND;var flags:dword;var value:pointer):boolean; -var - wnd:HWND; -begin - result:=true; - flags:=0; - value:=nil; - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_PAR)) of - ptParam: begin - flags:=flags or ACF_PARAM - end; - ptResult: begin - flags:=flags or ACF_RESULT - end; - ptCurrent: begin - flags:=flags or ACF_CURRENT - end; - ptNumber: begin - flags:=flags or ACF_PARNUM; - value:=GetDlgText(wnd); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(value), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - value:=GetDlgText(wnd); - end; - ptString: value:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_PARAM; -end; - -procedure ClearParam(flags:dword; var param); -begin - if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then - mFreeMem(pointer(param)); -end; - -function DuplicateParam(flags:dword; var sparam,dparam):dword; -var - tmpdst:array [0..2047] of WideChar; - ltype:integer; -begin - mFreeMem(dparam); - - if (flags and ACF_TEMPLATE)<>0 then - begin - flags:=flags and not (ACF_TEMPLATE or ACF_PARTYPE); - GetParamLine(pAnsiChar(sparam),tmpdst,ltype); - case ltype of - ptNumber: begin - flags:=flags or ACF_PARNUM; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptString: begin - flags:=flags or ACF_STRING; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(dparam),pAnsiChar(sparam)+10); //10=StrLen('structure|') - end; - ptCurrent: flags:=flags or ACF_CURRENT; - ptResult : flags:=flags or ACF_RESULT; - ptParam : flags:=flags or ACF_PARAM; - end; - end - else if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then - begin - if (flags and ACF_PARNUM)<>0 then - StrDupW(pWideChar(dparam),pWideChar(sparam)) - else if (flags and ACF_STRUCT)<>0 then - StrDup(pAnsiChar(dparam),pAnsiChar(sparam)) - else if (flags and ACF_UNICODE)<>0 then - StrDupW(pWideChar(dparam),pWideChar(sparam)) - else - StrDupW(pWideChar(dparam),pWideChar(sparam)); - end; - result:=flags; -end; - -//----- result block ----- - -procedure MakeResultTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,sresInt ,'Integer'); - InsertString(wnd,sresString,'String'); - InsertString(wnd,sresWide ,'Wide String'); - InsertString(wnd,sresStruct,'Structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -function ResultDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl; -begin - case urc^.wId of - IDC_RES_TYPE : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT - IDC_RES_FREEMEM: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_RES_STAT : result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP; - IDC_RES_GROUP : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - else - result:=0; - end; -end; - -procedure ClearResultFields(Dialog:HWND); -begin - CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_UNCHECKED); - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - CB_SelectData(Dialog,IDC_RES_TYPE,sresInt); -end; - -function DlgResultProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -var - urd:TUTILRESIZEDIALOG; - i:integer; -begin - result:=0; - - case hMessage of - WM_INITDIALOG: begin - MakeResultTypeList(GetDlgItem(Dialog,IDC_RES_TYPE)); - end; - - WM_SIZE: begin - FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0); - urd.cbSize :=SizeOf(urd); - urd.hwndDlg :=Dialog; - urd.hInstance :=hInstance; - urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SRESULT'); - urd.lParam :=0; - urd.pfnResizer:=@ResultDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd)); - end; - - WM_COMMAND: begin - case wParam shr 16 of - CBN_SELCHANGE: begin - case loword(wParam) of - IDC_RES_TYPE: begin - case CB_GetData(lParam) of - sresInt,sresStruct: begin - i:=SW_HIDE; - end; - sresString,sresWide: begin - i:=SW_SHOW; - end; - end; - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),i); - end; - end; - end; - end; - end; - end; -end; - -function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE; -var - rc,rc1:TRECT; -begin - SetRect(rc,x,y,x+width,y+0{dlgheight}); - MapDialogRect(parent,rc); - - result:=CreateDialogW(hInstance,'IDD_SRESULT',parent,@DlgResultProc); - GetClientRect(result,rc1); - SetWindowPos(result,0, - x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top, - SWP_NOZORDER); -end; - -function SetResultValue(Dialog:HWND;flags:dword):integer; -var - btn:integer; -begin - // RESULT - if (flags and ACF_RSTRUCT)<>0 then - result:=sresStruct - else if (flags and ACF_RSTRING)<>0 then - begin - if (flags and ACF_RFREEMEM)<>0 then - btn:=BST_CHECKED - else - btn:=BST_UNCHECKED; - CheckDlgButton(Dialog,IDC_RES_FREEMEM,btn); - - if (flags and ACF_RUNICODE)<>0 then - result:=sresWide - else - result:=sresString; - end - else - begin - result:=sresInt; - end; - CB_SelectData(Dialog,IDC_RES_TYPE,result); -end; - -function GetResultValue(Dialog:HWND):dword; -begin - case CB_GetData(GetDlgItem(Dialog,IDC_RES_TYPE)) of - sresString: begin - result:=ACF_RSTRING; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - result:=result or ACF_RFREEMEM; - end; - sresWide: begin - result:=ACF_RSTRING or ACF_RUNICODE; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - result:=result or ACF_RFREEMEM; - end; - sresStruct: result:=ACF_RSTRUCT; - else - result:=0; - end; - -end; - -end. diff --git a/plugins/Actman30/sparam.rc b/plugins/Actman30/sparam.rc deleted file mode 100644 index a36fc5b680..0000000000 --- a/plugins/Actman30/sparam.rc +++ /dev/null @@ -1,27 +0,0 @@ -#include "i_sparam_const.inc" - -LANGUAGE 0,0 - -IDD_SPARAM DIALOGEX 0, 0, 168, 31, 0 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0 -{ -// PUSHBUTTON "open/close" , IDC_CLOSE , 1, 116, 166, 14 - RTEXT "wParam type", IDC_STAT_PAR, 1, 1, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_PAR, 66, 1, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "wParam" , -1, 1, 116, 160, 8 - COMBOBOX IDC_EDIT_PAR, 1, 16, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_STRUCT , 1, 16, 166, 14 -} - -IDD_SRESULT DIALOGEX 0, 0, 168, 53, 0 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0 -{ - GROUPBOX "Result" , IDC_RES_GROUP , 1, 0, 166, 50, WS_GROUP - RTEXT "Result type" , IDC_RES_STAT , 4, 9, 159, 11 - COMBOBOX IDC_RES_TYPE , 4, 20, 159, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - AUTOCHECKBOX "Free memory" , IDC_RES_FREEMEM, 4, 36, 159, 11 -} diff --git a/plugins/Actman30/tasks/i_opt_dlg.inc b/plugins/Actman30/tasks/i_opt_dlg.inc index c8025c278d..e6797e3a9a 100644 --- a/plugins/Actman30/tasks/i_opt_dlg.inc +++ b/plugins/Actman30/tasks/i_opt_dlg.inc @@ -275,13 +275,14 @@ function DeleteTask(Dialog:HWND):integer; var li:LV_ITEM; wnd:HWND; - i:integer; + i,j:integer; begin result:=0; wnd:=GetDlgItem(Dialog,IDC_TASK_NAME); - for i:=ListView_GetItemCount(wnd)-1 downto 0 do + j:=SendMessage(wnd,LVM_GETITEMCOUNT,0,0); + for i:=j-1 downto 0 do begin - if ListView_GetItemState(wnd,i,LVIS_SELECTED)<>0 then + if SendMessage(wnd,LVM_GETITEMSTATE,i,LVIS_SELECTED)<>0 then begin li.iItem :=i; li.mask :=LVIF_PARAM; diff --git a/plugins/Actman30/ua/i_opt_dlg.inc b/plugins/Actman30/ua/i_opt_dlg.inc index b7ff28483a..643aa253b7 100644 --- a/plugins/Actman30/ua/i_opt_dlg.inc +++ b/plugins/Actman30/ua/i_opt_dlg.inc @@ -372,7 +372,7 @@ begin li.iItem :=i; li.lParam :=i; li.pszText :=UActionList[i].szActDescr; - li.iImage:=ImageList_AddIcon(il, + li.iImage:=ImageList_ReplaceIcon(il, -1, HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,LPARAM(UActionList[i].hIcolibIcon)))); li.iItem :=SendMessageW(wnd,LVM_INSERTITEMW,0,LPARAM(@li)); @@ -405,7 +405,7 @@ begin li.mask :=LVIF_IMAGE; li.iSubItem:=0; li.iItem :=i; - li.iImage:=ImageList_AddIcon(il, + li.iImage:=ImageList_ReplaceIcon(il, -1, HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,TLPARAM(UActionList[i].hIcolibIcon)))); SendMessageW(wnd,LVM_SETITEM,0,TLPARAM(@li)); end; diff --git a/plugins/Actman30/ua/i_uaplaces.inc b/plugins/Actman30/ua/i_uaplaces.inc index bbd6571aaa..4bd8d18bd0 100644 --- a/plugins/Actman30/ua/i_uaplaces.inc +++ b/plugins/Actman30/ua/i_uaplaces.inc @@ -463,7 +463,7 @@ begin end; -function PreBuildMenu(mtype:tMenuType;hContact:THANDLE=0):int; +function PreBuildMenu(mtype:tMenuType;hContact:HCONTACT=0):int; var i:integer; mi:TCListMenuItem; diff --git a/plugins/ExternalAPI/delphi/m_smileyadd.inc b/plugins/ExternalAPI/delphi/m_smileyadd.inc index ecb3ebb7d1..4562f575f1 100644 --- a/plugins/ExternalAPI/delphi/m_smileyadd.inc +++ b/plugins/ExternalAPI/delphi/m_smileyadd.inc @@ -33,15 +33,15 @@ type cbSize :uint; // size of the structure hwndRichEditControl:HWND; // handle to the rich edit control rangeToReplace :PCHARRANGE; // same meaning as for normal Richedit use (NULL = replaceall) - Protocolname :PAnsiChar; // protocol to use... if you have defined a + Protocolname :PAnsiChar; // protocol to use... if you have defined a // protocol, u can use your own protocol name. SmileyAdd will // automatically select the smileypack that is defined for your protocol. // Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" // if you prefer those icons. // If not found or NULL, "Standard" will be used - flags :uint; // Flags (SAFLRE_*) that define the behaivior - disableRedraw :BOOL; // Parameter have been depricated, have no effect on operation - hContact :THANDLE; // Contact handle + flags :uint; // Flags (SAFLRE_*) that define the behaivior + disableRedraw :BOOL; // Parameter have been depricated, have no effect on operation + hContact :HCONTACT; // Contact handle end; { @@ -63,17 +63,15 @@ type // Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" // if you prefer those icons. // If not found or NULL: "Standard" will be used - xPosition : int; // Postition to place the selectwindow + xPosition : int; // Postition to place the selectwindow yPosition : int; - Direction : int; // Direction (i.e. size upwards/downwards/etc) of - // the window 0, 1, 2, 3 - hwndTarget : HWND; // Window, where to send the message when smiley - // is selected. - targetMessage: uint; // Target message, to be sent. - targetWParam : LPARAM; // Target WParam to be sent (LParam will be PAnsiChar to - // select smiley) see the example file. - hwndParent : HWND; // Parent window for smiley dialog - hContact : THANDLE; // Contact handle + Direction : int; // Direction (i.e. size upwards/downwards/etc) of the window 0, 1, 2, 3 + hwndTarget : HWND; // Window, where to send the message when smiley is selected. + targetMessage: uint; // Target message, to be sent. + targetWParam : LPARAM; // Target WParam to be sent (LParam will be PAnsiChar to + // select smiley) see the example file. + hwndParent : HWND; // Parent window for smiley dialog + hContact : HCONTACT; // Contact handle end; { @@ -93,14 +91,14 @@ const type PSMADD_INFO2 = ^TSMADD_INFO2; TSMADD_INFO2 = record - cbSize : int; // size of the structure + cbSize : int; // size of the structure Protocolname : PAnsiChar; - ButtonIcon : HICON; // RETURN VALUE: this is filled with the + ButtonIcon : HICON; // RETURN VALUE: this is filled with the // icon handle of the smiley that can be used on the button // do not destroy! NULL if the buttonicon is not defined... - NumberOfVisibleSmileys: int; // Number of visible smileys defined. - NumberOfSmileys : int; // Number of total smileys defined - hContact : THANDLE; //Contact handle + NumberOfVisibleSmileys: int; // Number of visible smileys defined. + NumberOfSmileys : int; // Number of total smileys defined + hContact : HCONTACT; //Contact handle end; const @@ -120,18 +118,18 @@ type TSMADD_BATCHPARSE2 = record cbSize :uint; // size of the structure Protocolname:PAnsiChar; // protocol to use... if you have defined a protocol, u can - // use your own protocol name. Smiley add wil automatically - // select the smileypack that is defined for your protocol. - // Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" - // if you prefer those icons. - // If not found or NULL: "Standard" will be used - str :TChar; // String to parse - flag :uint; // One of the SAFL_ flags specifies parsing requirements - // This parameter should be filled by the user - numSmileys :uint; // Number of Smileys found, this parameter filled by SmileyAdd - oflag :uint; // One of the SAFL_ flags specifies content of the parse results - // this parameter filled by SmileyAdd - hContact :THANDLE; // Contact handle + // use your own protocol name. Smiley add wil automatically + // select the smileypack that is defined for your protocol. + // Or, use "Standard" for standard smiley set. Or "ICQ", "MSN" + // if you prefer those icons. + // If not found or NULL: "Standard" will be used + str :TChar; // String to parse + flag :uint; // One of the SAFL_ flags specifies parsing requirements + // This parameter should be filled by the user + numSmileys :uint; // Number of Smileys found, this parameter filled by SmileyAdd + oflag :uint; // One of the SAFL_ flags specifies content of the parse results + // this parameter filled by SmileyAdd + hContact :HCONTACT; // Contact handle end; type @@ -239,9 +237,9 @@ const type SMADD_CONT = record cbSize :uint; - hContact:THANDLE; - _type :int; // 0 - directory, 1 - file; - path :TChar; // smiley category name for reference + hContact:HCONTACT; + _type :int; // 0 - directory, 1 - file; + path :TChar; // smiley category name for reference end; const //Loads all smileys for the contact diff --git a/plugins/ExternalAPI/delphi/m_tipper.inc b/plugins/ExternalAPI/delphi/m_tipper.inc index d9fea8208d..452904113d 100644 --- a/plugins/ExternalAPI/delphi/m_tipper.inc +++ b/plugins/ExternalAPI/delphi/m_tipper.inc @@ -10,7 +10,7 @@ {$IFNDEF M_TIPPER} {$DEFINE M_TIPPER} type - TranslateFunc = function (hContact:THANDLE;module:PAnsiChar;setting_or_prefix:PAnsiChar; + TranslateFunc = function (hContact:HCONTACT;module:PAnsiChar;setting_or_prefix:PAnsiChar; buff:pWideChar;bufflen:int):pWideChar; cdecl; type diff --git a/plugins/ExternalAPI/delphi/m_variables.inc b/plugins/ExternalAPI/delphi/m_variables.inc index bcc1f9889f..3d4f1ae940 100644 --- a/plugins/ExternalAPI/delphi/m_variables.inc +++ b/plugins/ExternalAPI/delphi/m_variables.inc @@ -56,7 +56,7 @@ type szExtraText:TCHAR; // Extra, context-specific string (can be NULL) -> // The field "extratext" will be replaced by this // string. (Previously szSource). - hContact :THANDLE; // Handle to contact (can be NULL) -> The field "subject" + hContact :HCONTACT; // Handle to contact (can be NULL) -> The field "subject" // represents this contact. pCount :int; // (output) Number of succesful parsed tokens, needs to // be set to 0 before the call @@ -67,13 +67,6 @@ type cbTemporaryVarsSize:int; // Number of elements in szaTemporaryVars array end; -const -// FORMATINFOV2_SIZE = (SizeOf(int)*4+SizeOf(pointer)*2 + SizeOf(THANDLE)); - {$IFNDEF WIN64} - FORMATINFOV2_SIZE = 28; - {$ELSE} - FORMATINFOV2_SIZE = SIZEOF(TFORMATINFO); - {$ENDIF} const // Possible flags: diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc index 52c617b66d..40708b8901 100644 --- a/plugins/QuickSearch/i_ok.inc +++ b/plugins/QuickSearch/i_ok.inc @@ -209,7 +209,7 @@ begin end; -function DoMeta(hContact:THANDLE):pointer; +function DoMeta(hContact:HCONTACT):pointer; var pw:pWideChar; i:integer; @@ -433,7 +433,7 @@ end; //----- Initial table filling ----- -procedure AddContact(num:integer;hContact:THANDLE); +procedure AddContact(num:integer;hContact:HCONTACT); var col:pcolumnitem; tmpstr:array [0..63] of AnsiChar; @@ -476,7 +476,7 @@ end; function PrepareToFill:boolean; var cnt,cnt1:integer; - hContact:THANDLE; + hContact:THCONTACT; i:integer; begin result:=false; diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index b9d94ef2d0..fd241bb3d4 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -51,7 +51,7 @@ type end; pQSFRec = ^tQSFRec; tQSFRec = record // row (contact) - contact:THANDLE; + contact:HCONTACT; proto :uint_ptr; flags :dword; status :dword; @@ -115,7 +115,7 @@ begin end; end; -procedure AddContactToList(hContact:THANDLE;num:integer); +procedure AddContactToList(hContact:HCONTACT;num:integer); var li:LV_ITEMW; i:integer; @@ -337,7 +337,7 @@ end; //----- contacts actions ----- -function GetFocusedhContact:THANDLE; +function GetFocusedhContact:HCONTACT; var i:integer; begin @@ -348,7 +348,7 @@ begin result:=FlagBuf[i].contact; end; -procedure ShowContactMsgDlg(hContact:THANDLE); +procedure ShowContactMsgDlg(hContact:HCONTACT); begin if hContact<>0 then begin @@ -357,7 +357,7 @@ begin end; end; -procedure DeleteOneContact(hContact:THANDLE); +procedure DeleteOneContact(hContact:HCONTACT); begin if ServiceExists(strCListDel)>0 then CallService(strCListDel,hContact,0) @@ -388,8 +388,8 @@ end; procedure ConvertToMeta; var - hMeta:THANDLE; - tmp:THANDLE; + hMeta:HCONTACT; + tmp:HCONTACT; i,j:integer; begin j:=ListView_GetItemCount(grid)-1; @@ -438,7 +438,7 @@ end; procedure UpdateLVCell(item,column:integer;text:pWideChar=pWideChar(-1)); var li:LV_ITEMW; - contact:THANDLE; + contact:HCONTACT; row:integer; begin contact:=FlagBuf[LV_GetLParam(grid,item)].contact; @@ -469,7 +469,7 @@ end; procedure MoveToGroup(group:PWideChar); var - contact:THANDLE; + contact:HCONTACT; i,j,grcol,row:integer; begin j:=ListView_GetItemCount(grid)-1; @@ -512,7 +512,7 @@ end; procedure MoveToContainer(container:PWideChar); var - contact:THANDLE; + contact:HCONTACT; i,j,grcol,row:integer; begin j:=ListView_GetItemCount(grid)-1; @@ -784,7 +784,7 @@ begin UpdateLVCell(SendMessage(grid,LVM_GETNEXTITEM,-1,LVNI_FOCUSED),cmcolumn,qsr.text); end; -function ShowContactMenu(wnd:HWND;hContact:THANDLE;col:integer=-1):HMENU; +function ShowContactMenu(wnd:HWND;hContact:HCONTACT;col:integer=-1):HMENU; var mi:TCListMenuItem; pt:tpoint; diff --git a/plugins/Utils.pas/contact.pas b/plugins/Utils.pas/contact.pas index 9dc959c91f..697c603591 100644 --- a/plugins/Utils.pas/contact.pas +++ b/plugins/Utils.pas/contact.pas @@ -3,21 +3,21 @@ unit contact; interface -uses windows; +uses windows, m_api; procedure FillContactList(list:hwnd; filter:boolean=true;format:pWideChar=nil); -function FindContact(list:hwnd;contact:THANDLE):integer; +function FindContact(list:hwnd;contact:HCONTACT):integer; implementation -uses messages, common, m_api, dbsettings, mirutils; +uses messages, common, dbsettings, mirutils; const defformat = '%name% - %uid% (%account%:%group%)'; procedure FillContactList(list:hwnd; filter:boolean=true;format:pWideChar=nil); var - hContact:THANDLE; + hContact:THCONTACT; buf:array [0..511] of WideChar; buf1:array [0..63] of WideChar; p:PWideChar; @@ -109,7 +109,7 @@ begin end; end; -function FindContact(list:hwnd;contact:THANDLE):integer; +function FindContact(list:hwnd;contact:HCONTACT):integer; var j:integer; begin diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index dcd880175b..dfbdd8ee69 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -4,78 +4,78 @@ interface uses windows,m_api; -function DBReadByte (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte =0):byte; -function DBReadWord (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:word =0):word; -function DBReadDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword; +function DBReadByte (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte =0):byte; +function DBReadWord (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:word =0):word; +function DBReadDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword; -function DBReadSetting (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; -function DBReadSettingStr(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBReadSetting (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBReadSettingStr(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; -function DBReadStringLength(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer; -function DBReadString (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBReadStringLength(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer; +function DBReadString (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; default:PAnsiChar=nil;enc:integer=DBVT_ASCIIZ):PAnsiChar; -function DBReadUTF8 (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar; -function DBReadUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar; +function DBReadUTF8 (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar; +function DBReadUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar; -function DBReadStruct (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBReadStruct (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; ptr:pointer;size:dword):uint_ptr; -function DBWriteStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBWriteStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; ptr:pointer;size:dword):Integer; -function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; -function DBWriteByte (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte ):int_ptr; -function DBWriteWord (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word ):int_ptr; -function DBWriteDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr; +function DBWriteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBWriteByte (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte ):int_ptr; +function DBWriteWord (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word ):int_ptr; +function DBWriteDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr; -function DBWriteString (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBWriteString (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; val:PAnsiChar;enc:integer=DBVT_ASCIIZ):int_ptr; -function DBWriteUTF8 (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr; -function DBWriteUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr; +function DBWriteUTF8 (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr; +function DBWriteUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr; -function DBFreeVariant(dbv:PDBVARIANT):int_ptr; -function DBDeleteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr; +//function DBFreeVariant(dbv:PDBVARIANT):int_ptr; +function DBDeleteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr; -function DBDeleteGroup(hContact:THANDLE;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr; +function DBDeleteGroup(hContact:HCONTACT;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr; function DBDeleteModule(szModule:PAnsiChar):integer; // 0.8.0+ -function DBGetSettingType(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer; +function DBGetSettingType(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer; implementation uses common; -function DBReadByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte=0):byte; +function DBReadByte(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte=0):byte; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_get_b(hContact, szModule, szSetting, default); end; -function DBReadWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:word=0):word; +function DBReadWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:word=0):word; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_get_w(hContact, szModule, szSetting, default); end; -function DBReadDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword; +function DBReadDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_get_dw(hContact, szModule, szSetting, default); end; -function DBReadSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBReadSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_get(hContact, szModule, szSetting, dbv); end; -function DBReadSettingStr(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBReadSettingStr(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ); end; -function DBReadStringLength(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer; +function DBReadStringLength(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer; var dbv:TDBVARIANT; i:int_ptr; @@ -86,10 +86,11 @@ begin result:=0 else result:=StrLen(dbv.szVal.a); + DBFreeVariant(@dbv); end; -function DBReadString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBReadString(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; default:PAnsiChar=nil;enc:integer=DBVT_ASCIIZ):PAnsiChar; var dbv:TDBVARIANT; @@ -108,13 +109,13 @@ begin DBFreeVariant(@dbv); end; -function DBReadUTF8(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar; +function DBReadUTF8(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=DBReadString(hContact,szModule,szSetting,default,DBVT_UTF8); end; -function DBReadUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar; +function DBReadUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar; var dbv:TDBVARIANT; i:int_ptr; @@ -132,7 +133,7 @@ begin DBFreeVariant(@dbv); end; -function DBReadStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBReadStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; ptr:pointer;size:dword):uint_ptr; var dbv:TDBVariant; @@ -153,63 +154,57 @@ begin result:=0; end; -function DBWriteStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBWriteStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; ptr:pointer;size:dword):Integer; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_blob(hContact, szModule, szSetting, ptr, size); end; -function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; +function DBWriteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin Result:=db_set(hContact, szModule, szSetting, dbv); end; -function DBWriteByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr; +function DBWriteByte(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_b(hContact, szModule, szSetting, val); end; -function DBWriteWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word):int_ptr; +function DBWriteWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_w(hContact, szModule, szSetting, val); end; -function DBWriteDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr; +function DBWriteDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_dw(hContact, szModule, szSetting, val); end; -function DBWriteString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar; +function DBWriteString(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar; val:PAnsiChar;enc:integer=DBVT_ASCIIZ):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_s(hContact, szModule, szSetting, val); end; -function DBWriteUTF8(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr; +function DBWriteUTF8(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_utf(hContact, szModule, szSetting, val); end; -function DBWriteUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr; +function DBWriteUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_set_ws(hContact, szModule, szSetting, val); end; -function DBFreeVariant(dbv:PDBVARIANT):int_ptr; - {$IFDEF AllowInline}inline;{$ENDIF} -begin - result:=db_free(dbv); -end; - -function DBDeleteSetting(hContact:THandle;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr; +function DBDeleteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr; {$IFDEF AllowInline}inline;{$ENDIF} begin result:=db_unset(hContact, szModule, szSetting); @@ -231,7 +226,7 @@ begin result:=0; end; -function DBDeleteGroup(hContact:THANDLE;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr; +function DBDeleteGroup(hContact:HCONTACT;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr; var ces:TDBCONTACTENUMSETTINGS; p:PAnsiChar; @@ -319,7 +314,7 @@ begin CallService(MS_DB_MODULE_DELETE,0,lParam(szModule)); end; -function DBGetSettingType(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer; +function DBGetSettingType(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer; var ldbv:TDBVARIANT; begin diff --git a/plugins/Utils.pas/editwrapper.pas b/plugins/Utils.pas/editwrapper.pas index a3cd58debc..ff3c77a423 100644 --- a/plugins/Utils.pas/editwrapper.pas +++ b/plugins/Utils.pas/editwrapper.pas @@ -2,7 +2,7 @@ unit EditWrapper; interface -uses windows; +uses windows,m_api; // exported flags const @@ -32,7 +32,7 @@ function ShowEditBox(parent:HWND;var text:pWideChar;title:pWideChar):int_ptr; implementation -uses messages,commctrl,common,wrapper,m_api; +uses messages,commctrl,common,wrapper; {$R editwrapper.res} {$include 'i_text_const.inc'} diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index e5e761b24b..920a969b49 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -20,10 +20,10 @@ function RegisterSingleIcon(resname,ilname,descr,group:PAnsiChar):int; // others -function ConvertFileName(src:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload; -function ConvertFileName(src:pWideChar;hContact:THANDLE=0):pWideChar; overload; -function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload; -function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:THANDLE=0):pWideChar; overload; +function ConvertFileName(src:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload; +function ConvertFileName(src:pWideChar;hContact:HCONTACT=0):pWideChar; overload; +function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload; +function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:HCONTACT=0):pWideChar; overload; procedure ShowPopupW(text:pWideChar;title:pWideChar=nil); function GetAddonFileName(prefix,altname,path:PAnsiChar;ext:PAnsiChar):PAnsiChar; @@ -31,31 +31,31 @@ function TranslateA2W(sz:PAnsiChar):PWideChar; function MirandaCP:integer; function isVarsInstalled:bool; -function ParseVarString(astr:pAnsiChar;aContact:THANDLE=0;extra:pAnsiChar=nil):pAnsiChar; overload; -function ParseVarString(astr:pWideChar;aContact:THANDLE=0;extra:pWideChar=nil):pWideChar; overload; +function ParseVarString(astr:pAnsiChar;aContact:HCONTACT=0;extra:pAnsiChar=nil):pAnsiChar; overload; +function ParseVarString(astr:pWideChar;aContact:HCONTACT=0;extra:pWideChar=nil):pWideChar; overload; function ShowVarHelp(dlg:HWND;id:integer=0):integer; -function IsChat(hContact:THANDLE):bool; -procedure SendToChat(hContact:THANDLE;pszText:PWideChar); - -function LoadContact(group,setting:PAnsiChar):THANDLE; -function SaveContact(hContact:THANDLE;group,setting:PAnsiChar):integer; - -function SetCListSelContact(hContact:THANDLE):THANDLE; -function GetCListSelContact:THANDLE; {$IFDEF DELPHI_10_UP}inline;{$ENDIF} -function GetContactProtoAcc(hContact:THANDLE):PAnsiChar; -function IsMirandaUser(hContact:THANDLE):integer; // >0=Miranda; 0=Not miranda; -1=unknown -procedure ShowContactDialog(hContact:THANDLE;DblClk:boolean=true;anystatus:boolean=true); -function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):THANDLE; -function WndToContact(wnd:hwnd):THANDLE; overload; -function WndToContact:THANDLE; overload; -function GetContactStatus(hContact:THANDLE):integer; +function IsChat(hContact:HCONTACT):bool; +procedure SendToChat(hContact:HCONTACT;pszText:PWideChar); + +function LoadContact(group,setting:PAnsiChar):HCONTACT; +function SaveContact(hContact:HCONTACT;group,setting:PAnsiChar):integer; + +function SetCListSelContact(hContact:HCONTACT):HCONTACT; +function GetCListSelContact:HCONTACT; {$IFDEF DELPHI_10_UP}inline;{$ENDIF} +function GetContactProtoAcc(hContact:HCONTACT):PAnsiChar; +function IsMirandaUser(hContact:HCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown +procedure ShowContactDialog(hContact:HCONTACT;DblClk:boolean=true;anystatus:boolean=true); +function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):HCONTACT; +function WndToContact(wnd:hwnd):HCONTACT; overload; +function WndToContact:HCONTACT; overload; +function GetContactStatus(hContact:HCONTACT):integer; // -2 - deleted account, -1 - disabled account, 0 - hidden // 1 - metacontact, 2 - submetacontact, positive - active // proto - ASSIGNED buffer -function IsContactActive(hContact:THANDLE;proto:pAnsiChar=nil):integer; +function IsContactActive(hContact:HCONTACT;proto:pAnsiChar=nil):integer; -function CreateGroupW(name:pWideChar;hContact:THANDLE):integer; +function CreateGroupW(name:pWideChar;hContact:HCONTACT):integer; function MakeGroupMenu(idxfrom:integer=100):HMENU; function GetNewGroupName(parent:HWND):pWideChar; @@ -95,7 +95,7 @@ begin SendMessage(btn,BM_SETIMAGE,IMAGE_ICON,result); end; -function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:THANDLE=0):pWideChar; overload; +function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:HCONTACT=0):pWideChar; overload; var pc:pWideChar; begin @@ -115,7 +115,7 @@ begin end; end; -function ConvertFileName(src:pWideChar;hContact:THANDLE=0):pWideChar; overload; +function ConvertFileName(src:pWideChar;hContact:HCONTACT=0):pWideChar; overload; var buf1:array [0..511] of WideChar; begin @@ -125,7 +125,7 @@ begin result:=nil; end; -function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload; +function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload; var pc:pAnsiChar; begin @@ -145,7 +145,7 @@ begin end; end; -function ConvertFileName(src:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload; +function ConvertFileName(src:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload; var buf1:array [0..511] of AnsiChar; begin @@ -165,7 +165,7 @@ begin result:=MirCP; end; -function IsChat(hContact:THANDLE):bool; +function IsChat(hContact:HCONTACT):bool; begin result:=DBReadByte(hContact, PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)), @@ -173,16 +173,19 @@ begin end; function isVarsInstalled:bool; +{$IFDEF AllowInline}inline;{$ENDIF} begin result:=ServiceExists(MS_VARS_FORMATSTRING)<>0; end; -function ParseVarString(astr:pAnsiChar;aContact:THANDLE=0;extra:pAnsiChar=nil):pAnsiChar; +function ParseVarString(astr:pAnsiChar;aContact:HCONTACT=0;extra:pAnsiChar=nil):pAnsiChar; var tfi:TFORMATINFO; tmp,pc:pAnsiChar; dat:TREPLACEVARSDATA; begin + if (astr=nil) or (astr^=#0) then exit; + if ServiceExists(MS_UTILS_REPLACEVARS)<>0 then begin FillChar(dat,SizeOf(TREPLACEVARSDATA),0); @@ -214,12 +217,14 @@ begin mir_free(pc); end; -function ParseVarString(astr:pWideChar;aContact:THANDLE=0;extra:pWideChar=nil):pWideChar; +function ParseVarString(astr:pWideChar;aContact:HCONTACT=0;extra:pWideChar=nil):pWideChar; var tfi:TFORMATINFO; tmp,pc:pWideChar; dat:TREPLACEVARSDATA; begin + if (astr=nil) or (astr^=#0) then exit; + if ServiceExists(MS_UTILS_REPLACEVARS)<>0 then begin FillChar(dat,SizeOf(TREPLACEVARSDATA),0); @@ -251,7 +256,6 @@ begin StrDupW(result,astr); end; mir_free(pc); // forced! -// mFreeMem(pc); end; function ShowVarHelp(dlg:HWND;id:integer=0):integer; @@ -310,7 +314,7 @@ begin end; end; -function GetContactProtoAcc(hContact:THANDLE):PAnsiChar; +function GetContactProtoAcc(hContact:HCONTACT):PAnsiChar; begin if ServiceExists(MS_PROTO_GETCONTACTBASEACCOUNT)<>0 then result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEACCOUNT,hContact,0)) @@ -318,7 +322,7 @@ begin result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)); end; -function IsMirandaUser(hContact:THANDLE):integer; // >0=Miranda; 0=Not miranda; -1=unknown +function IsMirandaUser(hContact:HCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown var sz:PAnsiChar; begin @@ -333,7 +337,7 @@ begin result:=-1; end; -function SetCListSelContact(hContact:THANDLE):THANDLE; +function SetCListSelContact(hContact:HCONTACT):HCONTACT; var wnd:HWND; begin @@ -349,7 +353,7 @@ begin result:=SendMessageW(CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETSELECTION,0,0); end; -function LoadContact(group,setting:PAnsiChar):THANDLE; +function LoadContact(group,setting:PAnsiChar):HCONTACT; var p,proto:pAnsiChar; section:array [0..63] of AnsiChar; @@ -374,7 +378,7 @@ begin mFreeMem(dbv.szVal.W); end; -function SaveContact(hContact:THANDLE;group,setting:PAnsiChar):integer; +function SaveContact(hContact:HCONTACT;group,setting:PAnsiChar):integer; var p,proto,uid:pAnsiChar; cws:TDBVARIANT; @@ -416,9 +420,9 @@ begin end; end; -function WndToContact(wnd:hwnd):THANDLE; overload; +function WndToContact(wnd:hwnd):HCONTACT; overload; var - hContact:THANDLE; + hContact:THCONTACT; mwid:TMessageWindowInputData; mwod:TMessageWindowOutputData; begin @@ -446,7 +450,7 @@ begin result:=0; end; -function WndToContact:THANDLE; overload; +function WndToContact:HCONTACT; overload; var wnd:HWND; begin @@ -461,7 +465,7 @@ begin result:=GetCListSelContact; end; -function GetContactStatus(hContact:THANDLE):integer; +function GetContactStatus(hContact:HCONTACT):integer; var szProto:PAnsiChar; begin @@ -551,7 +555,7 @@ begin end; end; -procedure ShowContactDialog(hContact:THANDLE;DblClk:boolean=true;anystatus:boolean=true); +procedure ShowContactDialog(hContact:HCONTACT;DblClk:boolean=true;anystatus:boolean=true); var pc:array [0..127] of AnsiChar; begin @@ -605,7 +609,7 @@ begin CallServiceSync(MS_GC_EVENT,0,lparam(@gce)); end; -procedure SendToChat(hContact:THANDLE;pszText:PWideChar); +procedure SendToChat(hContact:HCONTACT;pszText:PWideChar); var gci:TGC_INFO; pszModule:PAnsiChar; @@ -618,7 +622,7 @@ begin while i0 do @@ -415,7 +415,7 @@ begin end; end; -function HookAddUser(hContact:WPARAM;lParam:LPARAM):integer; cdecl; +function HookAddUser(hContact:WPARAM;lParam:LPARAM):int; cdecl; begin result:=0; if not IsChat(hContact) then diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index 0664dfa8f2..ca63bb7fa8 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -113,7 +113,7 @@ begin result:=int_ptr(ReturnInfo(wParam,lParam)); end; -function WATGetFileInfo(wParam:WPARAM;lParam:LPARAM):int;cdecl; +function WATGetFileInfo(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl; var // si:TSongInfo; dst:pSongInfo; @@ -163,7 +163,7 @@ begin end; end; -function WATGetMusicInfo(wParam:WPARAM;lParam:LPARAM):int;cdecl; +function WATGetMusicInfo(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl; type ppointer = ^pointer; const diff --git a/plugins/mRadio/i_myservice.inc b/plugins/mRadio/i_myservice.inc index 4f50cf573c..e4cf178a5c 100644 --- a/plugins/mRadio/i_myservice.inc +++ b/plugins/mRadio/i_myservice.inc @@ -4,7 +4,7 @@ function Service_RadioPlayStop(wParam:WPARAM;lParam:LPARAM):int;cdecl; var p:PAnsiChar; lnew:bool; - hContact:THANDLE; + hContact:THCONTACT; cni:TCONTACTINFO; i:integer; begin @@ -145,7 +145,7 @@ end; //----- Import-export ----- -function ImportOneStation(group:PAnsiChar;section:pointer):int; +function ImportOneStation(group:PAnsiChar;section:pointer):HCONTACT; var p:pWideChar; pc:pAnsiChar; @@ -218,7 +218,7 @@ begin end; end; -procedure ExportRadioContact(num:integer;fname:PAnsiChar;hContact:THANDLE); +procedure ExportRadioContact(num:integer;fname:PAnsiChar;hContact:HCONTACT); var pc:pAnsiChar; section:array [0..15] of AnsiChar; @@ -257,7 +257,7 @@ end; function ExportAll(wParam:WPARAM;lParam:LPARAM):int; cdecl; var dst:array [0..MAX_PATH-1] of AnsiChar; - hContact:THANDLE; + hContact:THCONTACT; begin result:=0; if lParam<>0 then diff --git a/plugins/mRadio/i_search.inc b/plugins/mRadio/i_search.inc index bcbe6662a7..d585c72d73 100644 --- a/plugins/mRadio/i_search.inc +++ b/plugins/mRadio/i_search.inc @@ -276,7 +276,7 @@ end; function Service_AddToList(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl; var - hContact:THANDLE; + hContact:THCONTACT; p:PWideChar; lurl:pWideChar; begin diff --git a/plugins/mRadio/i_service.inc b/plugins/mRadio/i_service.inc index fbc644711e..e1a528d84f 100644 --- a/plugins/mRadio/i_service.inc +++ b/plugins/mRadio/i_service.inc @@ -27,7 +27,7 @@ begin result:=0; end; -procedure GetAwayMsgProc(hContact:THANDLE); cdecl; +procedure GetAwayMsgProc(hContact:HCONTACT); cdecl; var buf,p:PWideChar; begin @@ -131,7 +131,7 @@ begin if wParam<>ID_STATUS_OFFLINE then wParam:=ID_STATUS_ONLINE; - if wParam=PluginStatus then + if wParam=TWPARAM(PluginStatus) then exit; PluginStatus:=ID_STATUS_OFFLINE; diff --git a/plugins/mRadio/rccenter.pas b/plugins/mRadio/rccenter.pas index 6f75ef48ae..ac8c762228 100644 --- a/plugins/mRadio/rccenter.pas +++ b/plugins/mRadio/rccenter.pas @@ -4,14 +4,14 @@ unit rccenter; interface uses - windows; + windows,m_api; function ControlCenter(code:WPARAM;arg:LPARAM):int_ptr; cdecl; implementation uses - common, m_api, + common, dbsettings, playlist, mirutils, rglobal, rbass, Dynamic_Bass, diff --git a/plugins/mRadio/rframeapi.pas b/plugins/mRadio/rframeapi.pas index 0aba02c517..471f8ccf71 100644 --- a/plugins/mRadio/rframeapi.pas +++ b/plugins/mRadio/rframeapi.pas @@ -220,7 +220,7 @@ begin height :=tr.bottom-tr.top+2; Flags :=F_VISIBLE or F_NOBORDER or F_UNICODE; name.w :=cPluginName; - TBName.w:=cPluginName + ' volume control'; + TBName.w:=TranslateW(cPluginName + ' volume control'); end; FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,wparam(@Frame),0); diff --git a/plugins/mRadio/rglobal.pas b/plugins/mRadio/rglobal.pas index 283daae17c..d914d4dc21 100644 --- a/plugins/mRadio/rglobal.pas +++ b/plugins/mRadio/rglobal.pas @@ -6,6 +6,7 @@ interface uses windows, Dynamic_Bass, + m_api, playlist; {$include m_radio.inc} @@ -20,7 +21,7 @@ const const chan :HSTREAM = 0; - ActiveContact:THANDLE = 0; + ActiveContact:HCONTACT = 0; ActiveURL :PWideChar = nil; const @@ -158,7 +159,7 @@ const function MakeMessage:pWideChar; -procedure SetStatus(hContact:THANDLE;status:integer); +procedure SetStatus(hContact:HCONTACT;status:integer); function GetDefaultRecPath:pWideChar; function GetStatusText(status:integer;toCList:boolean=false):PWideChar; @@ -166,9 +167,9 @@ function GetStatusText(status:integer;toCList:boolean=false):PWideChar; implementation uses - m_api, common, dbsettings; + common, dbsettings; -procedure SetStatus(hContact:THANDLE;status:integer); +procedure SetStatus(hContact:HCONTACT;status:integer); begin // if Status=ID_STATUS_OFFLINE then // MyStopBass; -- cgit v1.2.3