From e7b69721b0d390cec3f81f97134a51bfef228cf8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Mar 2018 20:01:30 +0300 Subject: PFLAG_UNIQUEIDSETTING removed, its functionality transferred to Proto_SetUniqueId / Proto_GetUniqueId --- include/delphi/m_protocols.inc | 31 +++++++++++++++---------------- include/delphi/m_protosvc.inc | 1 - include/m_plugin.h | 4 ++++ include/m_protocols.h | 12 ++++++++++++ include/m_protosvc.h | 1 - 5 files changed, 31 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/delphi/m_protocols.inc b/include/delphi/m_protocols.inc index e5af3b4189..83deebaf44 100644 --- a/include/delphi/m_protocols.inc +++ b/include/delphi/m_protocols.inc @@ -186,8 +186,7 @@ const NULL if it isn't. } -function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdcall; - external AppDLL name 'Proto_IsProtocolLoaded'; +function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdcall; external AppDLL; { gets the network-level protocol associated with a contact Returns a AnsiChar* pointing to the asciiz name of the protocol or NULL if the @@ -195,8 +194,7 @@ function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdc This is the name of the module that actually accesses the network for that contact. } -function Proto_GetProtoName(hContact:TMCONTACT) : PAnsiChar; stdcall; - external AppDLL name 'GetContactProto'; +function Proto_GetProtoName(hContact:TMCONTACT) : PAnsiChar; stdcall; external AppDLL name 'GetContactProto'; { determines whether the specified contact has the given protocol in its chain wParam=(WPARAM)(HANDLE)hContact @@ -260,11 +258,9 @@ type tagACCOUNT = TPROTOACCOUNT; //account enumeration service -procedure Proto_EnumAccounts(var nAccs:int; var pAccs:PPPROTOACCOUNT); stdcall; - external AppDLL name 'Proto_EnumAccounts'; +procedure Proto_EnumAccounts(var nAccs:int; var pAccs:PPPROTOACCOUNT); stdcall; external AppDLL; -procedure Proto_EnumProtocols(var nProtos:int; var pProtos:PPPROTOCOLDESCRIPTOR); stdcall; - external AppDLL name 'Proto_EnumProtocols'; +procedure Proto_EnumProtocols(var nProtos:int; var pProtos:PPPROTOCOLDESCRIPTOR); stdcall; external AppDLL; type PACC_CREATE = ^TACC_CREATE; @@ -286,8 +282,7 @@ const //lParam=(LPARAM)(AnsiChar*)szAccountName //return value = PROTOACCOUNT* or NULL -function Proto_GetAccount(proto:PAnsiChar) : PPROTOACCOUNT; stdcall; - external AppDLL name 'Proto_GetAccount'; +function Proto_GetAccount(proto:PAnsiChar) : PPROTOACCOUNT; stdcall; external AppDLL; (* __inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName ) @@ -321,8 +316,7 @@ const Returns 1 if an account is valid and enabled, 0 otherwise } -function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall; - external AppDLL name 'Proto_IsAccountEnabled'; +function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall; external AppDLL; { determines if an account is locked or not @@ -331,8 +325,7 @@ function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall; Returns 1 if an account is locked and not supposed to change status, 0 otherwise } -function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall; - external AppDLL name 'Proto_IsAccountLocked'; +function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall; external AppDLL; { gets the account associated with a contact @@ -341,8 +334,14 @@ function Proto_IsAccountLocked(proto:PPROTOACCOUNT) : byte; stdcall; This is the name of the module that actually accesses the network for that contact. } -function Proto_GetBaseAccountName(hContact:TMCONTACT) : PAnsiChar; stdcall; - external AppDLL name 'Proto_GetBaseAccountName'; +function Proto_GetBaseAccountName(hContact:TMCONTACT) : PAnsiChar; stdcall; external AppDLL; + +{ + gets and sets unique id name of any contact +} + +function Proto_GetUniqueId(proto:PAnsiChar) : PAnsiChar; stdcall; external AppDLL; +procedure Proto_SetUniqueId(proto, id:PAnsiChar); stdcall; external AppDLL; // -------------- avatar support --------------------- { diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc index 73bc565a72..1e6296d3b3 100644 --- a/include/delphi/m_protosvc.inc +++ b/include/delphi/m_protosvc.inc @@ -133,7 +133,6 @@ const PFLAG_UNIQUEIDTEXT = 100; // returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL PFLAG_MAXCONTACTSPERPACKET = 200; // v0.1.2.2+: returns the maximum number of contacts which can be sent in a single PSS_CONTACTS. lParam=(LPARAM)hContact. - PFLAG_UNIQUEIDSETTING = 300; // v0.3+: returns the DB setting name (e.g. szProto=ICQ, szSetting=UIN) that has the ID which makes this user unique on that system (0.3a ONLY), the string is statically allocated so no need to free() PFLAG_MAXLENOFMESSAGE = 400; // v0.3.2+: return the maximum length of an instant message, lParam=(LPARAM)hContact { A protocol might not support this cap, it allows a protocol to say that PFLAGNUM_2 is for diff --git a/include/m_plugin.h b/include/m_plugin.h index 233e03a432..592aa565bf 100644 --- a/include/m_plugin.h +++ b/include/m_plugin.h @@ -17,6 +17,10 @@ protected: // pass one of PROTOTYPE_* constants as type void RegisterProtocol(int type, pfnInitProto = nullptr, pfnUninitProto = nullptr); + __forceinline void SetUniqueId(const char *pszUniqueId) + { + ::Proto_SetUniqueId(m_szModuleName, pszUniqueId); + } public: void debugLogA(LPCSTR szFormat, ...); diff --git a/include/m_protocols.h b/include/m_protocols.h index a7e13ffab1..cee4513363 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -210,6 +210,16 @@ EXTERN_C MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR EXTERN_C MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName); +///////////////////////////////////////////////////////////////////////////////////////// +// gets a name of a variable inside a protocol's module that identifies a contact + +EXTERN_C MIR_APP_DLL(const char*) Proto_GetUniqueId(const char *szModuleName); + +///////////////////////////////////////////////////////////////////////////////////////// +// sets a name of a variable inside a protocol's module that identifies a contact + +EXTERN_C MIR_APP_DLL(void) Proto_SetUniqueId(const char *szProtoName, const char *szUniqueId); + ///////////////////////////////////////////////////////////////////////////////////////// // gets the network-level protocol associated with a contact // Returns a char* pointing to the asciiz name of the protocol or NULL if the @@ -283,6 +293,8 @@ typedef struct tagACCOUNT int iOrder; // account order in various menus & lists PROTO_INTERFACE *ppro; // pointer to the underlying object + + char* szUniqueId; // setting's unique id for any contact in the account } PROTOACCOUNT; diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 723b7260ae..0709e5b542 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -151,7 +151,6 @@ static __inline unsigned long Proto_Status2Flag(int status) #define PFLAG_UNIQUEIDTEXT 100 // returns a static buffer of text describing the unique field by which this protocol identifies users (already translated), or NULL #define PFLAG_MAXCONTACTSPERPACKET 200 // returns the maximum number of contacts which can be sent in a single PSS_CONTACTS, lParam = (LPARAM)hContact. -#define PFLAG_UNIQUEIDSETTING 300 // returns the setting name of where the unique id is stored #define PFLAG_MAXLENOFMESSAGE 400 // return the maximum length of an instant message, lParam = (LPARAM)hContact /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3