summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_protocols.inc46
-rw-r--r--include/delphi/m_protomod.inc130
-rw-r--r--include/m_icq.h2
-rw-r--r--include/m_protocols.h247
-rw-r--r--include/m_protoint.h2
-rw-r--r--include/m_protomod.h113
-rw-r--r--include/m_protosvc.h12
7 files changed, 249 insertions, 303 deletions
diff --git a/include/delphi/m_protocols.inc b/include/delphi/m_protocols.inc
index 8e3bd4d455..a7d5d545e7 100644
--- a/include/delphi/m_protocols.inc
+++ b/include/delphi/m_protocols.inc
@@ -168,6 +168,7 @@ type
type
PPROTOCOLDESCRIPTOR = ^TPROTOCOLDESCRIPTOR;
+ PPPROTOCOLDESCRIPTOR = ^PPROTOCOLDESCRIPTOR;
TPROTOCOLDESCRIPTOR = record
cbSize : size_t;
szName : PAnsiChar; // unique name of the module
@@ -202,24 +203,26 @@ const
Returns a pointer to the PROTOCOLDESCRIPTOR if the protocol is loaded, or
NULL if it isn't.
}
- MS_PROTO_ISPROTOCOLLOADED:PAnsiChar = 'Proto/IsProtocolLoaded';
+
+function Proto_IsProtocolLoaded(protoName:PAnsiCHar) : PPROTOCOLDESCRIPTOR; stdcall;
+ external AppDLL name 'Proto_IsProtocolLoaded';
{ gets the network-level protocol associated with a contact
- wParam=(WPARAM)(HANDLE)hContact
- lParam=0
Returns a AnsiChar* pointing to the asciiz name of the protocol or NULL if the
contact has no protocol. There is no need to free() it or anything.
This is the name of the module that actually accesses the network for that
contact. }
- MS_PROTO_GETCONTACTBASEPROTO = 'Proto/GetContactBaseProto';
+
+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
lParam=(LPARAM)(const AnsiChar*)szName
Returns -1 if it is base protocol, positive number if it is filter and 0 if it doesn't }
+const
MS_PROTO_ISPROTOONCONTACT:PAnsiChar = 'Proto/IsProtoOnContact';
-const
PROTOTYPE_SELFTYPING_OFF = 0;
PROTOTYPE_SELFTYPING_ON = 1;
{ This service is for notifying protocols that the user is typing a message v0.3.3+
@@ -256,6 +259,7 @@ const
type
PPROTOACCOUNT = ^TPROTOACCOUNT;
+ PPPROTOACCOUNT = ^PPROTOACCOUNT;
TPROTOACCOUNT = record
cbSize :int; // sizeof this structure
szModuleName :PAnsiChar; // unique physical account name (matches database module name)
@@ -273,13 +277,12 @@ type
end;
tagACCOUNT = TPROTOACCOUNT;
-const
//account enumeration service
-//wParam=(WPARAM)(int)piNumAccounts
-//lParam=(LPARAM)(PROTOACCOUNT**)paAccounts
- MS_PROTO_ENUMACCOUNTS:PAnsiChar = 'Proto/EnumAccounts';
+procedure Proto_EnumAccounts(var nAccs:int; var pAccs:PPPROTOACCOUNT); stdcall;
+ external AppDLL name 'Proto_EnumAccounts';
- MS_PROTO_ENUMPROTOS :PAnsiChar = 'Proto/EnumProtos'; // MIRANDA_VER >= $800
+procedure Proto_EnumProtocols(var nProtos:int; var pProtos:PPPROTOCOLDESCRIPTOR); stdcall;
+ external AppDLL name 'Proto_EnumProtocols';
type
PACC_CREATE = ^TACC_CREATE;
@@ -300,7 +303,10 @@ const
//wParam=0
//lParam=(LPARAM)(AnsiChar*)szAccountName
//return value = PROTOACCOUNT* or NULL
- MS_PROTO_GETACCOUNT:PAnsiChar = 'Proto/GetAccount';
+
+function Proto_GetAccount(proto:PAnsiChar) : PPROTOACCOUNT; stdcall;
+ external AppDLL name 'Proto_GetAccount';
+
(*
__inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
{ return (PROTOACCOUNT* )CallService( MS_PROTO_GETACCOUNT, 0, (LPARAM)accName );
@@ -311,6 +317,7 @@ __inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
//wParam = event type (1 - added, 2 - changed, 3 - deleted, 5 - enabled/disabled)
//lParam = (LPARAM)(PROTOACCOUNT*) - account being changed
+const
PRAC_ADDED = 1;
PRAC_CHANGED = 2;
PRAC_REMOVED = 3;
@@ -329,11 +336,11 @@ __inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
{
determines if an account is enabled or not
- wParam = 0
- lParam = PPROTOACCOUNT
Returns 1 if an account is valid and enabled, 0 otherwise
}
- MS_PROTO_ISACCOUNTENABLED:PAnsiChar = 'Proto/IsAccountEnabled';
+
+function Proto_IsAccountEnabled(proto:PPROTOACCOUNT) : byte; stdcall;
+ external AppDLL name 'Proto_IsAccountEnabled';
{
determines if an account is locked or not
@@ -341,17 +348,19 @@ __inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
lParam = PAnsiChar szAccountName
Returns 1 if an account is locked and not supposed to change status, 0 otherwise
}
- MS_PROTO_ISACCOUNTLOCKED:PAnsiChar = 'Proto/IsAccountLocked';
+
+function Proto_IsAccountLocked(proto:PAnsiChar) : byte; stdcall;
+ external AppDLL name 'Proto_IsAccountLocked';
{
gets the account associated with a contact
- wParam=(WPARAM)(HANDLE)hContact
- lParam=0
Returns a PAnsiChar pointing to the asciiz name of the protocol or NULL if the
contact has no protocol. There is no need to mir_free() it or anything.
This is the name of the module that actually accesses the network for that contact.
}
- MS_PROTO_GETCONTACTBASEACCOUNT:PAnsiChar = 'Proto/GetContactBaseAccount';
+
+function Proto_GetBaseAccountName(hContact:TMCONTACT) : PAnsiChar; stdcall;
+ external AppDLL name 'Proto_GetBaseAccountName';
// -------------- avatar support ---------------------
{
@@ -384,6 +393,7 @@ __inline PROTOACCOUNT* ProtoGetAccount( const AnsiChar* accName )
When ACKRESULT_STATUS, hProcess is the result code - the value of this is protocol dependent,
See protocol documentation to do with avatars for what codes are defined and what they mean.
}
+
const
PA_FORMAT_UNKNOWN = 0; // the protocol can not determine much about the "bitmap"
PA_FORMAT_PNG = 1; // the image is PNG
diff --git a/include/delphi/m_protomod.inc b/include/delphi/m_protomod.inc
index aab9706e37..416d5758e5 100644
--- a/include/delphi/m_protomod.inc
+++ b/include/delphi/m_protomod.inc
@@ -27,78 +27,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
{$INCLUDE m_protocols.inc}
{$ENDIF}
-const
- {
- wParam : 0
- lParam : Pointer to a initalised TPROTOCOLDESCRIPTOR structure
- Affect : Register a protocol module, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : This service MUST be called from your module's Load() function
- TPROTOCOLDESCRIPTOR.type can be a value other than PROTOTYPE_*
- which are used to provide a more precise positioning information
- for the contact protocol lists.
- -
- Relative values to the constants can be given, but this MUST NOT
- be done for PROTOTYPE_PROTOCOL.
- }
- MS_PROTO_REGISTERMODULE:PAnsiChar = 'Proto/RegisterModule';
-
- {
- wParam : TMCONTACT
- lParam : protocol_name_string
- Affect : Add the given protocol module to the chain for a contact, see notes
- Returns: 0 success, [non zero] on failure
- Notes : The module is added to the correct positioning according to it's
- registered type.
- }
- MS_PROTO_ADDTOCONTACT:PAnsiChar = 'Proto/AddToContact';
-
- {
- wParam : TMCONTACT
- lParam : protocol_name_string
- Affect : Remove the given protocol name from the chain for the given contact
- Returns: 0 on success, [non zero] on failure
- }
- MS_PROTO_REMOVEFROMCONTACT:PAnsiChar = 'Proto/RemoveFromContact';
-
- { see m_globaldefs.pas for CreateProtoServiceFunction }
-
- {
- wParam : wParam [arg]
- lParam : lParam [arg]
- Affect : Call the next service in the chain for the send operation, see notes
- Return : Return value should be returned by CallService(MS_PROTO_CHAINSEND,wParam,lParam)
- Notes : wParam MUST remain untouched, lParam is a pointer to a CSSDATA structure
- and can be modified or copid if needed.
- wParam and lParam should be the values passed to your service,
- typically your service should return ASAP.
- }
- MS_PROTO_CHAINSEND:PAnsiChar = 'Proto/ChainSend';
-
- {
- wParam : wParam [arg]
- lParam : lParam [arg]
- Affect : Call the next service in the chain in this receive operation, see notes
- Return : Return value should be returned by CallService(MS_PROTO_CHAINRECV,wParam,lParam)
- Notes : wParam MUST remain untouched, lParam is a pointer to a CSSDATA structure
- and can be modified or copied if needed.
- wParam and lParam should be the values passed to your service,
- typically your service should return ASAP.
- -
- MS_PROTO_CHAINRECV is thread safe since 0.1.2.0 -- calls
- are translated to the main thread and passed from there.
- }
- MS_PROTO_CHAINRECV:PAnsiChar = 'Proto/ChainRecv';
-
- {
- wParam : 0
- lParam : Pointer to an initalised ACKDATA
- Affect : Broadcast a ME_PROTO_ACK event, see notes
- Returns: The return value of the NotifyEventHooks() call
- Notes : ME_PROTO_ACK is completely thread safe since 01.2.0
- see notes in core/modules.h under NotifyEventHooks()
- }
- MS_PROTO_BROADCASTACK:PAnsiChar = 'Proto/BroadcastAck';
+{
+ Affect : Register a protocol module, see notes
+ Returns: 0 on success, [non zero] on failure
+ Notes : This service MUST be called from your module's Load() function
+ TPROTOCOLDESCRIPTOR.type can be a value other than PROTOTYPE_*
+ which are used to provide a more precise positioning information
+ for the contact protocol lists.
+ -
+ Relative values to the constants can be given, but this MUST NOT
+ be done for PROTOTYPE_PROTOCOL.
+}
+
+function Proto_RegisterModule(descr:pPROTOCOLDESCRIPTOR) : int; stdcall;
+ external AppDLL name 'Proto_RegisterModule';
+
+{
+ Affect : Add the given protocol module to the chain for a contact, see notes
+ Returns: 0 success, [non zero] on failure
+ Notes : The module is added to the correct positioning according to it's
+ registered type.
+}
+
+function Proto_AddToContact(hContact:TMCONTACT; proto:PAnsiChar) : int; stdcall;
+ external AppDLL name 'Proto_AddToContact';
+
+{
+ Affect : Remove the given protocol name from the chain for the given contact
+ Returns: 0 on success, [non zero] on failure
+}
+
+function Proto_RemoveFromContact(hContact:TMCONTACT; proto:PAnsiChar) : int; stdcall;
+ external AppDLL name 'Proto_RemoveFromContact';
+
+{
+ Affect : Call the next service in the chain for the send operation, see notes
+ Return : Return value should be returned by CallService(MS_PROTO_CHAINSEND,wParam,lParam)
+ Notes : wParam MUST remain untouched, lParam is a pointer to a CSSDATA structure
+ and can be modified or copid if needed.
+ wParam and lParam should be the values passed to your service,
+ typically your service should return ASAP.
+}
+
+function Proto_ChainSend(order:int; ccs:pCCSDATA) : INT_PTR; stdcall;
+ external AppDLL name 'Proto_ChainSend';
+
+{
+ Affect : Call the next service in the chain in this receive operation, see notes
+ Return : Return value should be returned by CallService(MS_PROTO_CHAINRECV,wParam,lParam)
+ Notes : wParam MUST remain untouched, lParam is a pointer to a CSSDATA structure
+ and can be modified or copied if needed.
+ wParam and lParam should be the values passed to your service,
+ typically your service should return ASAP.
+ -
+ MS_PROTO_CHAINRECV is thread safe since 0.1.2.0 -- calls
+ are translated to the main thread and passed from there.
+}
+function Proto_ChainRecv(order:int; ccs:pCCSDATA) : INT_PTR; stdcall;
+ external AppDLL name 'Proto_ChainRecv';
{$ENDIF}
diff --git a/include/m_icq.h b/include/m_icq.h
index 0f9c17add7..867d9537e4 100644
--- a/include/m_icq.h
+++ b/include/m_icq.h
@@ -32,7 +32,7 @@
#ifndef M_ICQ_H__
#define M_ICQ_H__ 1
-
+#include <m_protosvc.h>
//extended search result structure, used for all searches
typedef struct {
diff --git a/include/m_protocols.h b/include/m_protocols.h
index 0a024340e8..4003efcb85 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -32,11 +32,6 @@ struct PROTO_INTERFACE;
#include "statusmodes.h"
#include <m_core.h>
-// send a general request through the protocol chain for a contact
-// wParam = 0
-// lParam = (LPARAM)(CCSDATA*)&ccs
-// returns the value as documented in the PS_ definition (m_protosvc.h)
-
typedef struct {
MCONTACT hContact;
const char *szProtoService; // a PS_ constant
@@ -44,23 +39,14 @@ typedef struct {
LPARAM lParam;
} CCSDATA;
-#define MS_PROTO_CALLCONTACTSERVICE "Proto/CallContactService"
-
+/////////////////////////////////////////////////////////////////////////////////////////
// a general network 'ack'
// wParam = 0
// lParam = (LPARAM)(ACKDATA*)&ack
// Note that just because definitions are here doesn't mean they will be sent.
// Read the documentation for the function you are calling to see what replies
// you will receive.
-typedef struct {
- int cbSize;
- const char *szModule; // the name of the protocol module which initiated this ack
- MCONTACT hContact;
- int type; // an ACKTYPE_ constant
- int result; // an ACKRESULT_ constant
- HANDLE hProcess; // a caller-defined process code
- LPARAM lParam; // caller-defined extra info
-} ACKDATA;
+
#define ACKTYPE_MESSAGE 0
#define ACKTYPE_URL 1
#define ACKTYPE_FILE 2
@@ -95,9 +81,19 @@ typedef struct {
#define ACKRESULT_CONNECTPROXY 110 // connecting to file proxy
#define ACKRESULT_SEARCHRESULT 111 // result of extended search
-#define ME_PROTO_ACK "Proto/Ack"
+typedef struct {
+ int cbSize;
+ const char *szModule; // the name of the protocol module which initiated this ack
+ MCONTACT hContact;
+ int type; // an ACKTYPE_ constant
+ int result; // an ACKRESULT_ constant
+ HANDLE hProcess; // a caller-defined process code
+ LPARAM lParam; // caller-defined extra info
+} ACKDATA;
+
+#define ME_PROTO_ACK "Proto/Ack"
-// v0.3.2+: When result is ACKRESULT_FAILED or ACKRESULT_DENIED, lParam can point to
+// When result is ACKRESULT_FAILED or ACKRESULT_DENIED, lParam can point to
// a human readable string with an explanation. For example: "The message was too
// long to be delivered". If no error message is specified, lParam must be NULL.
// Right now only explanations from ACKTYPE_MESSAGE is shown.
@@ -149,31 +145,27 @@ typedef struct tagPROTOFILETRANSFERSTATUS
unsigned __int64 currentFileProgress;
unsigned __int64 currentFileTime; // as seconds since 1970
}
-PROTOFILETRANSFERSTATUS;
-
-// Enumerate the currently running protocols
-// wParam = (WPARAM)(int*)&numberOfProtocols
-// lParam = (LPARAM)(PROTOCOLDESCRIPTOR***)&ppProtocolDescriptors
-// Returns 0 on success, nonzero on failure
-// Neither wParam nor lParam may be NULL
-// The list returned by this service is the protocol modules currently installed
-// and running. It is not the complete list of all protocols that have ever been
-// installed.
-// IMPORTANT NOTE #1: the list returned is not static, it may be changed in the
-// program's lifetime. Do not use this list in the global context, copy protocols
-// names otherwise.
-// IMPORTANT NOTE #2: in version 0.8 this service is mapped to the MS_PROTO_ENUMACCOUNTS
-// service to provide the compatibility with old plugins (first three members of
-// PROTOACCOUNT are equal to the old PROTOCOLDESCRIPTOR format). If you declare the
-// MIRANDA_VER macro with value greater or equal to 0x800, use MS_PROTO_ENUMPROTOS
-// service instead to obtain the list of running protocols instead of accounts.
-// Note that a protocol module need not be an interface to an Internet server,
-// they can be encryption and loads of other things, too.
-// And yes, before you ask, that is triple indirection. Deal with it.
-// Access members using ppProtocolDescriptors[index]->element
+ PROTOFILETRANSFERSTATUS;
#define PROTOCOLDESCRIPTOR_V3_SIZE (sizeof(size_t)+sizeof(INT_PTR)+sizeof(char*))
+/////////////////////////////////////////////////////////////////////////////////////////
+// For recv, it will go from lower to higher, so in this case:
+// check ignore, decrypt (encryption), translate
+//
+// For send, it will go translate, encrypt, ignore(??), send
+//
+// The DB will store higher numbers here, LOWER in the protocol chain, and lower numbers
+// here HIGHER in the protocol chain
+
+#define PROTOTYPE_IGNORE 50 // added during v0.3.3
+#define PROTOTYPE_PROTOCOL 1000
+#define PROTOTYPE_VIRTUAL 1001 // virtual protocol (has no accounts)
+#define PROTOTYPE_ENCRYPTION 2000
+#define PROTOTYPE_FILTER 3000
+#define PROTOTYPE_TRANSLATION 4000
+#define PROTOTYPE_OTHER 10000 // avoid using this if at all possible
+
// initializes an empty account
typedef struct PROTO_INTERFACE* (*pfnInitProto)(const char* szModuleName, const TCHAR* szUserName);
@@ -195,69 +187,64 @@ typedef struct {
}
PROTOCOLDESCRIPTOR;
-// v0.3.3+:
-//
-// For recv, it will go from lower to higher, so in this case:
-// check ignore, decrypt (encryption), translate
-//
-// For send, it will go translate, encrypt, ignore(??), send
-//
-// The DB will store higher numbers here, LOWER in the protocol chain, and lower numbers
-// here HIGHER in the protocol chain
-
-#define PROTOTYPE_IGNORE 50 // added during v0.3.3
-#define PROTOTYPE_PROTOCOL 1000
-#define PROTOTYPE_VIRTUAL 1001 // virtual protocol (has no accounts)
-#define PROTOTYPE_ENCRYPTION 2000
-#define PROTOTYPE_FILTER 3000
-#define PROTOTYPE_TRANSLATION 4000
-#define PROTOTYPE_OTHER 10000 // avoid using this if at all possible
+/////////////////////////////////////////////////////////////////////////////////////////
+// Enumerate the currently running protocols
+// Returns 0 on success, nonzero on failure
+// Neither wParam nor lParam may be NULL
+// The list returned by this service is the protocol modules currently installed
+// and running. It is not the complete list of all protocols that have ever been
+// installed.
+// IMPORTANT NOTE #1: the list returned is not static, it may be changed in the
+// program's lifetime. Do not use this list in the global context, copy protocols
+// names otherwise.
+// IMPORTANT NOTE #2: in version 0.8 this service is mapped to the MS_PROTO_ENUMACCOUNTS
+// service to provide the compatibility with old plugins (first three members of
+// PROTOACCOUNT are equal to the old PROTOCOLDESCRIPTOR format). If you declare the
+// MIRANDA_VER macro with value greater or equal to 0x800, use MS_PROTO_ENUMPROTOS
+// service instead to obtain the list of running protocols instead of accounts.
+// Note that a protocol module need not be an interface to an Internet server,
+// they can be encryption and loads of other things, too.
+// And yes, before you ask, that is triple indirection. Deal with it.
+// Access members using ppProtocolDescriptors[index]->element
-#define MS_PROTO_ENUMPROTOS "Proto/EnumProtos"
+EXTERN_C MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR ***pProtos);
+/////////////////////////////////////////////////////////////////////////////////////////
// determines if a protocol module is loaded or not
-// wParam = 0 (unused)
-// lParam = (LPARAM)(const char*)szName
// Returns a pointer to the PROTOCOLDESCRIPTOR if the protocol is loaded, or
// NULL if it isn't.
-#define MS_PROTO_ISPROTOCOLLOADED "Proto/IsProtocolLoaded"
-#ifdef __cplusplus
-extern "C"
-#endif
-MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName);
+EXTERN_C MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName);
+/////////////////////////////////////////////////////////////////////////////////////////
// gets the network-level protocol associated with a contact
-// wParam = (MCONTACT)hContact
-// lParam = 0
// Returns a char* pointing to the asciiz name of the protocol or NULL if the
// contact has no protocol. There is no need to free() it or anything.
// This is the name of the module that actually accesses the network for that
// contact.
-#define MS_PROTO_GETCONTACTBASEPROTO "Proto/GetContactBaseProto"
-__forceinline char* GetContactProto(MCONTACT hContact)
-{ return (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
-}
+EXTERN_C MIR_APP_DLL(char*) GetContactProto(MCONTACT hContact);
+/////////////////////////////////////////////////////////////////////////////////////////
// determines whether the specified contact has the given protocol in its chain
-// wParam = (MCONTACT)hContact
-// lParam = (LPARAM)(const char*)szName
// Returns -1 if it is base protocol, positive number if it is filter and 0 if it doesn't
-#define MS_PROTO_ISPROTOONCONTACT "Proto/IsProtoOnContact"
-#define PROTOTYPE_SELFTYPING_OFF 0
-#define PROTOTYPE_SELFTYPING_ON 1
+EXTERN_C MIR_APP_DLL(int) Proto_IsProtoOnContact(MCONTACT hContact, const char *szProto);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// This service is for notifying protocols that the user is typing a message v0.3.3+
// in a message dialog.
// This is typically sent by a message dialog when a user in the clist is typing.
// wParam = (MCONTACT)hContact
// lParam = (LPARAM)(int)typing state
// NOTE: Only protocols should generally call this service
+
+#define PROTOTYPE_SELFTYPING_OFF 0
+#define PROTOTYPE_SELFTYPING_ON 1
+
#define MS_PROTO_SELFISTYPING "Proto/SelfIsTyping"
-#define PROTOTYPE_CONTACTTYPING_OFF 0
-#define PROTOTYPE_CONTACTTYPING_INFINITE 2147483647
+/////////////////////////////////////////////////////////////////////////////////////////
// This service is for notifying message dialogs/other plugins of a user typing. v0.3.3+
// This is typically sent by a protocol when a user in the clist is typing.
// wParam = (MCONTACT)hContact
@@ -266,8 +253,13 @@ __forceinline char* GetContactProto(MCONTACT hContact)
// how long to display its notification. If time is 0, then notification
// of typing ends.
// NOTE: Only protocols should generally call this service
+
+#define PROTOTYPE_CONTACTTYPING_OFF 0
+#define PROTOTYPE_CONTACTTYPING_INFINITE 2147483647
+
#define MS_PROTO_CONTACTISTYPING "Proto/ContactIsTyping"
+/////////////////////////////////////////////////////////////////////////////////////////
// This hook notifies when a user is typing. If a message dialog supports sending v0.3.3+
// typing notifications it should hook this event and fire the
// ProtoService PSS_USERISTYPING to the contacts protocol *after* verifying
@@ -275,6 +267,7 @@ __forceinline char* GetContactProto(MCONTACT hContact)
// to this user (checked visibility, individual typing blocking, etc).
// wParam = (MCONTACT)hContact
// lParam = (LPARAM)(int)typing state
+
#define ME_PROTO_CONTACTISTYPING "Proto/ContactIsTypingEvent"
// -------------- accounts support --------------------- 0.8.0+
@@ -299,19 +292,19 @@ typedef struct tagACCOUNT
}
PROTOACCOUNT;
+/////////////////////////////////////////////////////////////////////////////////////////
// account enumeration service
// wParam = (WPARAM)(int*)piNumAccounts
// lParam = (LPARAM)(PROTOACCOUNT**)paAccounts
-#define MS_PROTO_ENUMACCOUNTS "Proto/EnumAccounts"
-__forceinline INT_PTR ProtoEnumAccounts(int* accNumber, PROTOACCOUNT*** accArray)
-{ return CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)accNumber, (LPARAM)accArray);
-}
+MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs);
+/////////////////////////////////////////////////////////////////////////////////////////
// creates new account
// wParam = 0
// lParam = (LPARAM)(ACC_CREATE*) account definition
// return value = PROTOACCOUNT* or NULL
+
#define MS_PROTO_CREATEACCOUNT "Proto/CreateAccount"
typedef struct tagACC_CREATE
@@ -325,17 +318,13 @@ __forceinline PROTOACCOUNT* ProtoCreateAccount(ACC_CREATE *pAccountDef)
{ return (PROTOACCOUNT*)CallService(MS_PROTO_CREATEACCOUNT, 0, (LPARAM)pAccountDef);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// retrieves an account's interface by its physical name (database module)
-// wParam = 0
-// lParam = (LPARAM)(char*)szAccountName
// return value = PROTOACCOUNT* or NULL
-#define MS_PROTO_GETACCOUNT "Proto/GetAccount"
-__forceinline PROTOACCOUNT* ProtoGetAccount(const char* accName)
-{
- return (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accName);
-}
+EXTERN_C MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *pszModuleName);
+/////////////////////////////////////////////////////////////////////////////////////////
// this event is fired when the accounts list gets changed
// wParam = event type (1 - added, 2 - changed, 3 - deleted, 4 - upgraded, 5 - enabled/disabled)
// lParam = (LPARAM)(PROTOACCOUNT*) - account being changed
@@ -348,37 +337,37 @@ __forceinline PROTOACCOUNT* ProtoGetAccount(const char* accName)
#define ME_PROTO_ACCLISTCHANGED "Proto/AccListChanged"
+/////////////////////////////////////////////////////////////////////////////////////////
// displays the Account Manager
// wParam = 0
// lParam = 0
+
#define MS_PROTO_SHOWACCMGR "Protos/ShowAccountManager"
+/////////////////////////////////////////////////////////////////////////////////////////
// determines if an account is enabled or not
// wParam = 0
// lParam = (LPARAM)(PROTOACCOUNT*)
// Returns 1 if an account is valid and enabled, 0 otherwise
-#define MS_PROTO_ISACCOUNTENABLED "Proto/IsAccountEnabled"
-__forceinline int IsAccountEnabled(const PROTOACCOUNT *pa)
-{
- return (int)CallService(MS_PROTO_ISACCOUNTENABLED, 0, (LPARAM)pa);
-}
+EXTERN_C MIR_APP_DLL(bool) Proto_IsAccountEnabled(const PROTOACCOUNT *pa);
+/////////////////////////////////////////////////////////////////////////////////////////
// determines if an account is locked or not
// wParam = 0
// lParam = (LPARAM)(char*)szAccountName
// Returns 1 if an account is locked and not supposed to change status, 0 otherwise
-#define MS_PROTO_ISACCOUNTLOCKED "Proto/IsAccountLocked"
+EXTERN_C MIR_APP_DLL(bool) Proto_IsAccountLocked(const char *szModuleName);
+/////////////////////////////////////////////////////////////////////////////////////////
// gets the account associated with a contact
-// wParam = (MCONTACT)hContact
-// lParam = 0
// Returns a char* pointing to the asciiz name of the protocol or NULL if the
// contact has no protocol. There is no need to mir_free() it or anything.
// This is the name of the module that actually accesses the network for that
// contact.
-#define MS_PROTO_GETCONTACTBASEACCOUNT "Proto/GetContactBaseAccount"
+
+EXTERN_C MIR_APP_DLL(char*) Proto_GetBaseAccountName(MCONTACT);
/* -------------- avatar support ---------------------
@@ -446,4 +435,66 @@ typedef struct {
#define PS_GETAVATARINFO "/GetAvatarInformation"
+/////////////////////////////////////////////////////////////////////////////////////////
+// notify the protocol manager that you're around
+// wParam = 0
+// lParam = (PROTOCOLDESCRIPTOR*)&descriptor
+// returns 0 on success, nonzero on failure
+// This service must be called in your module's Load(void) routine.
+// descriptor.type can be a value other than the PROTOTYPE_ constants specified
+// above to provide more precise positioning information for the contact
+// protocol lists. It is strongly recommended that you give values relative to
+// the constants, however, by adding or subtracting small integers ( <= 100).
+// PROTOTYPE_PROTOCOL modules must not do this. The value must be exact.
+// See MS_PROTO_ENUMPROTOCOLS for more notes.
+
+EXTERN_C MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR*);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// adds the specified protocol module to the chain for a contact
+// returns 0 on success, nonzero on failure
+// The module is added in the correct position according to the type given when
+// it was registered.
+
+EXTERN_C MIR_APP_DLL(int) Proto_AddToContact(MCONTACT, const char *szProto);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// removes the specified protocol module from the chain for a contact
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(const char*)szName
+// returns 0 on success, nonzero on failure
+
+EXTERN_C MIR_APP_DLL(int) Proto_RemoveFromContact(MCONTACT, const char *szProto);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Call the next service in the chain for this send operation
+// The return value should be returned immediately
+// iOrder and ccs should be passed as the parameters that your service was
+// called with. iOrder must remain untouched but ccs is a CCSDATA structure
+// that can be copied and modified if needed.
+// Typically, the last line of any chaining protocol function is
+// return Proto_ChainSend(iOrder, ccs);
+
+EXTERN_C MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Call the next service in the chain for this receive operation
+// The return value should be returned immediately
+// iOrder and ccs should be passed as the parameters that your service was
+// called with. iOrder must remain untouched but ccs is a CCSDATA structure
+// that can be copied and modified if needed.
+// When being initiated by the network-access protocol module, wParam should be zero.
+// Thread safety: ms_proto_chainrecv is completely thread safe since 0.1.2.0
+// Calls to it are translated to the main thread and passed on from there. The
+// function will not return until all callees have returned, irrepective of
+// differences between threads the functions are in.
+
+EXTERN_C MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs);
+
+__forceinline INT_PTR ProtoChainRecv(MCONTACT hContact, char *szService, WPARAM wParam, LPARAM lParam)
+{
+ CCSDATA ccs = { hContact, szService, wParam, lParam };
+ return Proto_ChainRecv(0, &ccs);
+}
+
#endif // M_PROTOCOLS_H
diff --git a/include/m_protoint.h b/include/m_protoint.h
index fc2171ad32..515372d603 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define M_PROTOINT_H__ 1
#include <m_system_cpp.h>
-#include <m_protomod.h>
+#include <m_protosvc.h>
#include <m_database.h>
#include <m_utils.h>
diff --git a/include/m_protomod.h b/include/m_protomod.h
deleted file mode 100644
index 2a4abf55d6..0000000000
--- a/include/m_protomod.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org)
-Copyright (c) 2000-08 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-//this module was created in v0.1.1.0
-
-//this header file is for the use of protocol modules only. Other users should
-//use the functions exposed in m_protocols.h and m_protosvc.h
-
-#ifndef M_PROTOMOD_H__
-#define M_PROTOMOD_H__ 1
-
-#include <stdio.h>
-
-#include <m_protocols.h>
-#include <m_protosvc.h>
-
-//notify the protocol manager that you're around
-//wParam = 0
-//lParam = (PROTOCOLDESCRIPTOR*)&descriptor
-//returns 0 on success, nonzero on failure
-//This service must be called in your module's Load(void) routine.
-//descriptor.type can be a value other than the PROTOTYPE_ constants specified
-//above to provide more precise positioning information for the contact
-//protocol lists. It is strongly recommended that you give values relative to
-//the constants, however, by adding or subtracting small integers ( <= 100).
-//PROTOTYPE_PROTOCOL modules must not do this. The value must be exact.
-//See MS_PROTO_ENUMPROTOCOLS for more notes.
-#define MS_PROTO_REGISTERMODULE "Proto/RegisterModule"
-
-//adds the specified protocol module to the chain for a contact
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(const char*)szName
-//returns 0 on success, nonzero on failure
-//The module is added in the correct position according to the type given when
-//it was registered.
-#define MS_PROTO_ADDTOCONTACT "Proto/AddToContact"
-
-//removes the specified protocol module from the chain for a contact
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(const char*)szName
-//returns 0 on success, nonzero on failure
-#define MS_PROTO_REMOVEFROMCONTACT "Proto/RemoveFromContact"
-
-//Call the next service in the chain for this send operation
-//wParam = wParam
-//lParam = lParam
-//The return value should be returned immediately
-//wParam and lParam should be passed as the parameters that your service was
-//called with. wParam must remain untouched but lParam is a CCSDATA structure
-//that can be copied and modified if needed.
-//Typically, the last line of any chaining protocol function is
-//return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
-#define MS_PROTO_CHAINSEND "Proto/ChainSend"
-
-//Call the next service in the chain for this receive operation
-//wParam = wParam
-//lParam = lParam
-//The return value should be returned immediately
-//wParam and lParam should be passed as the parameters that your service was
-//called with. wParam must remain untouched but lParam is a CCSDATA structure
-//that can be copied and modified if needed.
-//When being initiated by the network-access protocol module, wParam should be
-//zero.
-//Thread safety: ms_proto_chainrecv is completely thread safe since 0.1.2.0
-//Calls to it are translated to the main thread and passed on from there. The
-//function will not return until all callees have returned, irrepective of
-//differences between threads the functions are in.
-#define MS_PROTO_CHAINRECV "Proto/ChainRecv"
-
-__forceinline INT_PTR ProtoChainRecv(MCONTACT hContact, char *szService, WPARAM wParam, LPARAM lParam)
-{ CCSDATA ccs = { hContact, szService, wParam, lParam };
- return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
-}
-
-__forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
-{ CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre };
- return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
-}
-
-__forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, PROTORECVFILET *pre)
-{ CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre };
- return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
-}
-
-//Broadcast a ME_PROTO_ACK event
-//wParam = 0
-//lParam = (LPARAM)(ACKDATA*)&ack
-//returns the return value of the notifyeventhooks() call
-//Thread safety: me_proto_ack is completely thread safe since 0.1.2.0
-//See the notes in core/modules.h under NotifyEventHooks()
-#define MS_PROTO_BROADCASTACK "Proto/BroadcastAck"
-
-#endif // M_PROTOMOD_H__
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index b4de5bff4d..510f361364 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -794,6 +794,12 @@ __forceinline INT_PTR Proto_RecvMessage(MCONTACT hContact, PROTORECVEVENT *pcre)
return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs);
}
+__forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
+{
+ CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre };
+ return Proto_ChainRecv(0, &ccs);
+}
+
///////////////////////////////////////////////////////////////////////////////
// Proto/AuthRecv
// Copies the EVENTTYPE_AUTHREQUEST event from PROTORECVEVENT into DBEVENTINFO and adds it
@@ -840,6 +846,12 @@ __forceinline INT_PTR Proto_RecvFile(MCONTACT hContact, PROTORECVFILET *pcre)
return CallService(MS_PROTO_RECVFILET, 0, (LPARAM)&ccs);
}
+__forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, PROTORECVFILET *pre)
+{
+ CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre };
+ return Proto_ChainRecv(0, &ccs);
+}
+
///////////////////////////////////////////////////////////////////////////////
// An URL has been received
// wParam = 0