From 9ac20243efe27f58501c59060a4f22c37104c0e3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 May 2015 15:29:24 +0000 Subject: - PROTOCOLDESCRIPTOR_V3_SIZE to identify an ANSI plugin; - absence of fnInitFunc to identify a protocol without instances; - whole bunch of ansi crutches discarded git-svn-id: http://svn.miranda-ng.org/main/trunk@13937 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_protosvc.inc | 10 - include/m_core.h | 8 +- include/m_protosvc.h | 1027 ++++++++++++++++++++++------------------- 3 files changed, 549 insertions(+), 496 deletions(-) (limited to 'include') diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc index 4a7d8085fb..664b8552c6 100644 --- a/include/delphi/m_protosvc.inc +++ b/include/delphi/m_protosvc.inc @@ -301,7 +301,6 @@ const any requests. } PS_SETAWAYMSG = '/SetAwayMsg'; - PS_SETAWAYMSGW = '/SetAwayMsgW'; { wParam : newMode from statusmodes.inc @@ -370,7 +369,6 @@ const Notes : Protocol modules must be able to cope with lParam=NULL(0) } PS_AUTHDENY = '/AuthDeny'; - PS_AUTHDENYW = '/AuthDenyW'; { Send a "You were added" event @@ -413,7 +411,6 @@ const } PS_BASICSEARCH = '/BasicSearch'; - PS_BASICSEARCHW = '/BasicSearchW'; { wParam : 0 @@ -428,7 +425,6 @@ const Version: v0.1.2.1+ } PS_SEARCHBYEMAIL = '/SearchByEmail'; - PS_SEARCHBYEMAILW = '/SearchByEmailW'; { wParam : 0 @@ -440,7 +436,6 @@ const Version: v0.1.2.1+ } PS_SEARCHBYNAME = '/SearchByName'; - PS_SEARCHBYNAMEW = '/SearchByNameW'; { wParam : 0 @@ -541,7 +536,6 @@ const Version: v0.1.2.2+ } PS_FILERESUME = '/FileResume'; - PS_FILERESUMEW = '/FileResumeW'; { Asks a protocol to join the chatroom from contact v0.8.0+ @@ -797,7 +791,6 @@ const filename(s), description: ASCIIZ } PSS_FILEALLOW = '/FileAllow'; - PSS_FILEALLOWW = '/FileAllowW'; { CCSDATA: Yes @@ -807,7 +800,6 @@ const Returns: 0 on success, [non zero] on failure } PSS_FILEDENY = '/FileDeny'; - PSS_FILEDENYW = '/FileDenyW'; { CCSDATA: Yes @@ -830,7 +822,6 @@ const lParam=null terminated string containing reason } PSS_FILE = '/SendFile'; - PSS_FILEW = '/SendFileW'; { Send an auth request @@ -839,7 +830,6 @@ const Returns 0 on success, nonzero on failure } PSS_AUTHREQUEST = '/AuthRequest'; - PSS_AUTHREQUESTW = '/AuthRequestW'; { Send "User is Typing" (user is typing a message to the user) v0.3.3+ diff --git a/include/m_core.h b/include/m_core.h index 9ed2a86a9d..5e431808a7 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -486,9 +486,15 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); }; typedef union { char *a; // utf8 or ansi strings TCHAR *t; // strings of TCHARs - wchar_t w; // strings of WCHARs + wchar_t *w; // strings of WCHARs } MAllStrings; +typedef union { + char **a; // array of utf8 or ansi strings + TCHAR **t; // array of strings of TCHARs + wchar_t **w; // array of strings of WCHARs +} MAllStringArray; + #ifdef _UNICODE #define mir_t2a(s) mir_u2a(s) #define mir_a2t(s) mir_a2u(s) diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 9c9518b95f..49f3aa57d4 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org) +Copyright (ñ) 2012-15 Miranda NG project (http:// miranda-ng.org) Copyright (c) 2000-09 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -22,11 +22,11 @@ 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 module was created in v0.1.1.0 -//none of these services should be used on their own (ie using CallService, -//CreateServiceFunction(), etc), hence the PS_ prefix. Instead use the services -//exposed in m_protocols.h +// none of these services should be used on their own (ie using CallService, +// CreateServiceFunction(), etc), hence the PS_ prefix. Instead use the services +// exposed in m_protocols.h #ifndef M_PROTOSVC_H__ #define M_PROTOSVC_H__ 1 @@ -44,94 +44,102 @@ convert Unicode to ANSI and call the appropriate service. */ /*************************** NON-CONTACT SERVICES ************************/ -//these should be called with CallProtoServiceInt(NULL,) - -//Get the capability flags of the module. -//wParam = flagNum -//lParam = 0 -//Returns a bitfield corresponding to wParam. See the #defines below -//Should return 0 for unknown values of flagNum -//Non-network-access modules should return flags to represent the things they -//actually actively use, not the values that it is known to pass through -//correctly +// these should be called with CallProtoServiceInt(NULL,) + +// Get the capability flags of the module. +// wParam = flagNum +// lParam = 0 +// Returns a bitfield corresponding to wParam. See the #defines below +// Should return 0 for unknown values of flagNum +// Non-network-access modules should return flags to represent the things they +// actually actively use, not the values that it is known to pass through +// correctly #define PFLAGNUM_1 1 -#define PF1_IMSEND 0x00000001 //supports IM sending -#define PF1_IMRECV 0x00000002 //supports IM receiving +#define PF1_IMSEND 0x00000001 // supports IM sending +#define PF1_IMRECV 0x00000002 // supports IM receiving #define PF1_IM (PF1_IMSEND|PF1_IMRECV) -#define PF1_URLSEND 0x00000004 //supports separate URL sending -#define PF1_URLRECV 0x00000008 //supports separate URL receiving +#define PF1_URLSEND 0x00000004 // supports separate URL sending +#define PF1_URLRECV 0x00000008 // supports separate URL receiving #define PF1_URL (PF1_URLSEND|PF1_URLRECV) -#define PF1_FILESEND 0x00000010 //supports file sending -#define PF1_FILERECV 0x00000020 //supports file receiving +#define PF1_FILESEND 0x00000010 // supports file sending +#define PF1_FILERECV 0x00000020 // supports file receiving #define PF1_FILE (PF1_FILESEND|PF1_FILERECV) -#define PF1_MODEMSGSEND 0x00000040 //supports broadcasting away messages -#define PF1_MODEMSGRECV 0x00000080 //supports reading others' away messages +#define PF1_MODEMSGSEND 0x00000040 // supports broadcasting away messages +#define PF1_MODEMSGRECV 0x00000080 // supports reading others' away messages #define PF1_MODEMSG (PF1_MODEMSGSEND|PF1_MODEMSGRECV) -#define PF1_SERVERCLIST 0x00000100 //contact lists are stored on the server, not locally. See notes below -#define PF1_AUTHREQ 0x00000200 //will get authorisation requests for some or all contacts -#define PF1_ADDED 0x00000400 //will get 'you were added' notifications -#define PF1_VISLIST 0x00000800 //has an invisible list -#define PF1_INVISLIST 0x00001000 //has a visible list for when in invisible mode -#define PF1_INDIVSTATUS 0x00002000 //supports setting different status modes to each contact -#define PF1_EXTENSIBLE 0x00004000 //the protocol is extensible and supports plugin-defined messages -#define PF1_PEER2PEER 0x00008000 //supports direct (not server mediated) communication between clients -#define PF1_NEWUSER 0x00010000 //supports creation of new user IDs -#define PF1_CHAT 0x00020000 //has a realtime chat capability -#define PF1_INDIVMODEMSG 0x00040000 //supports replying to a mode message request with different text depending on the contact requesting -#define PF1_BASICSEARCH 0x00080000 //supports a basic user searching facility -#define PF1_EXTSEARCH 0x00100000 //supports one or more protocol-specific extended search schemes -#define PF1_CANRENAMEFILE 0x00200000 //supports renaming of incoming files as they are transferred -#define PF1_FILERESUME 0x00400000 //can resume broken file transfers, see PS_FILERESUME below -#define PF1_ADDSEARCHRES 0x00800000 //can add search results to the contact list -#define PF1_CONTACTSEND 0x01000000 //can send contacts to other users -#define PF1_CONTACTRECV 0x02000000 //can receive contacts from other users +#define PF1_SERVERCLIST 0x00000100 // contact lists are stored on the server, not locally. See notes below +#define PF1_AUTHREQ 0x00000200 // will get authorisation requests for some or all contacts +#define PF1_ADDED 0x00000400 // will get 'you were added' notifications +#define PF1_VISLIST 0x00000800 // has an invisible list +#define PF1_INVISLIST 0x00001000 // has a visible list for when in invisible mode +#define PF1_INDIVSTATUS 0x00002000 // supports setting different status modes to each contact +#define PF1_EXTENSIBLE 0x00004000 // the protocol is extensible and supports plugin-defined messages +#define PF1_PEER2PEER 0x00008000 // supports direct (not server mediated) communication between clients +#define PF1_NEWUSER 0x00010000 // supports creation of new user IDs +#define PF1_CHAT 0x00020000 // has a realtime chat capability +#define PF1_INDIVMODEMSG 0x00040000 // supports replying to a mode message request with different text depending on the contact requesting +#define PF1_BASICSEARCH 0x00080000 // supports a basic user searching facility +#define PF1_EXTSEARCH 0x00100000 // supports one or more protocol-specific extended search schemes +#define PF1_CANRENAMEFILE 0x00200000 // supports renaming of incoming files as they are transferred +#define PF1_FILERESUME 0x00400000 // can resume broken file transfers, see PS_FILERESUME below +#define PF1_ADDSEARCHRES 0x00800000 // can add search results to the contact list +#define PF1_CONTACTSEND 0x01000000 // can send contacts to other users +#define PF1_CONTACTRECV 0x02000000 // can receive contacts from other users #define PF1_CONTACT (PF1_CONTACTSEND|PF1_CONTACTRECV) -#define PF1_CHANGEINFO 0x04000000 //can change our user information stored on server -#define PF1_SEARCHBYEMAIL 0x08000000 //supports a search by e-mail feature -#define PF1_USERIDISEMAIL 0x10000000 //set if the uniquely identifying field of the network is the e-mail address -#define PF1_SEARCHBYNAME 0x20000000 //supports searching by nick/first/last names -#define PF1_EXTSEARCHUI 0x40000000 //has a dialog box to allow searching all the possible fields -#define PF1_NUMERICUSERID 0x80000000 //the unique user IDs for this protocol are numeric - -#define PFLAGNUM_2 2 //the status modes that the protocol supports -#define PF2_ONLINE 0x00000001 //an unadorned online mode +#define PF1_CHANGEINFO 0x04000000 // can change our user information stored on server +#define PF1_SEARCHBYEMAIL 0x08000000 // supports a search by e-mail feature +#define PF1_USERIDISEMAIL 0x10000000 // set if the uniquely identifying field of the network is the e-mail address +#define PF1_SEARCHBYNAME 0x20000000 // supports searching by nick/first/last names +#define PF1_EXTSEARCHUI 0x40000000 // has a dialog box to allow searching all the possible fields +#define PF1_NUMERICUSERID 0x80000000 // the unique user IDs for this protocol are numeric + +/////////////////////////////////////////////////////////////////////////////// +// the status modes that the protocol supports + +#define PFLAGNUM_2 2 + +#define PF2_ONLINE 0x00000001 // an unadorned online mode #define PF2_INVISIBLE 0x00000002 -#define PF2_SHORTAWAY 0x00000004 //Away on ICQ, BRB on MSN -#define PF2_LONGAWAY 0x00000008 //NA on ICQ, Away on MSN -#define PF2_LIGHTDND 0x00000010 //Occupied on ICQ, Busy on MSN -#define PF2_HEAVYDND 0x00000020 //DND on ICQ +#define PF2_SHORTAWAY 0x00000004 // Away on ICQ, BRB on MSN +#define PF2_LONGAWAY 0x00000008 // NA on ICQ, Away on MSN +#define PF2_LIGHTDND 0x00000010 // Occupied on ICQ, Busy on MSN +#define PF2_HEAVYDND 0x00000020 // DND on ICQ #define PF2_FREECHAT 0x00000040 #define PF2_OUTTOLUNCH 0x00000080 #define PF2_ONTHEPHONE 0x00000100 -#define PF2_IDLE 0x00000200 //added during 0.3.4 (2004/09/13) +#define PF2_IDLE 0x00000200 -//the status modes that the protocol supports -//away-style messages for. Uses the PF2_ flags. +/////////////////////////////////////////////////////////////////////////////// +// the status modes that the protocol supports +// away-style messages for. Uses the PF2_ flags. // PFLAGNUM_3 is implemented by protocol services that support away messages // there may be no support and 0 will be returned, if there is // support it will consist of a set of PF2_* bits + #define PFLAGNUM_3 3 // given a status will return what bit flags to test for static __inline unsigned long Proto_Status2Flag(int status) { - switch(status) { - case ID_STATUS_ONLINE: return PF2_ONLINE; - case ID_STATUS_OFFLINE: return 0; - case ID_STATUS_INVISIBLE: return PF2_INVISIBLE; + switch (status) { + case ID_STATUS_ONLINE: return PF2_ONLINE; + case ID_STATUS_INVISIBLE: return PF2_INVISIBLE; case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH; case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE; - case ID_STATUS_AWAY: return PF2_SHORTAWAY; - case ID_STATUS_NA: return PF2_LONGAWAY; - case ID_STATUS_OCCUPIED: return PF2_LIGHTDND; - case ID_STATUS_DND: return PF2_HEAVYDND; - case ID_STATUS_FREECHAT: return PF2_FREECHAT; - case ID_STATUS_IDLE: return PF2_IDLE; + case ID_STATUS_AWAY: return PF2_SHORTAWAY; + case ID_STATUS_NA: return PF2_LONGAWAY; + case ID_STATUS_OCCUPIED: return PF2_LIGHTDND; + case ID_STATUS_DND: return PF2_HEAVYDND; + case ID_STATUS_FREECHAT: return PF2_FREECHAT; + case ID_STATUS_IDLE: return PF2_IDLE; } return 0; } -#define PFLAGNUM_4 4 // another bunch of flags +/////////////////////////////////////////////////////////////////////////////// +// another bunch of flags + +#define PFLAGNUM_4 4 #define PF4_FORCEAUTH 0x00000001 // forces auth requests to be sent when adding users #define PF4_FORCEADDED 0x00000002 // forces "you were added" requests to be sent @@ -146,96 +154,101 @@ static __inline unsigned long Proto_Status2Flag(int status) #define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats #define PF4_SINGLEFILEONLY 0x00001000 // protocol supports sending files one by one only -#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 //v0.1.2.2+: 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 // 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 - statuses contacts supports, and that PFLAGNUM_5 is for statuses a protocol can SET TO ITSELF, - if this is not replied to, then PFLAGNUM_2 is alone in telling you which statuses a protocol - can set to and what statuses a contact can set to as well. - - E.g. A protocol might report 'wireless' users but a login of the protocol from Miranda can - not set itself to 'wireless' so PFLAGNUM_2 would return PF2_ONTHEPHONE and PFLAGNUM_5 would - return PF2_ONTHEPHONE as well, this means "I will get contacts who are on the phone but you can - not set on the phone" and so on. - - Do note that the reply here is a NEGATION of bitflags reported for PFLAGNUM_2, e.g. returning - PF2_ONTHEPHONE for PFLAGNUM_2 and returning the same for PFLAGNUM_5 says that you DO NOT SUPPORT - PF2_ONTHEPHONE for the user to PS_SETSTATUS to, but you will expect other contacts to have - that status, e.g. you can get onthephone for users but can't go online with onthephone. +#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 + +/////////////////////////////////////////////////////////////////////////////// +// A protocol might not support this cap, it allows a protocol to say that +// PFLAGNUM_2 is for statuses contacts supports, and that PFLAGNUM_5 is for +// statuses a protocol can SET TO ITSELF, if this is not replied to, then +// PFLAGNUM_2 is alone in telling you which statuses a protocol can set to and +// what statuses a contact can set to as well. +// +// E.g. A protocol might report 'wireless' users but a login of the protocol +// from Miranda can not set itself to 'wireless' so PFLAGNUM_2 would return +// PF2_ONTHEPHONE and PFLAGNUM_5 would return PF2_ONTHEPHONE as well, this +// means "I will get contacts who are on the phone but you can not set on the +// phone" and so on. +// +// Do note that the reply here is a NEGATION of bitflags reported for +// PFLAGNUM_2, e.g. returning PF2_ONTHEPHONE for PFLAGNUM_2 and returning the +// same for PFLAGNUM_5 says that you DO NOT SUPPORT PF2_ONTHEPHONE for the user +// to PS_SETSTATUS to, but you will expect other contacts to have that status, +// e.g. you can get onthephone for users but can't go online with onthephone. +// +// The same PF2_* status flags are used in the reply. - The same PF2_* status flags are used in the reply. - -Added during 0.3.4 (2004/09/14) -*/ #define PFLAGNUM_5 5 -/* Deleting contacts from protocols that store the contact list on the server: -If a contact is deleted while the protocol is online, it is expected that the -protocol will have hooked me_db_contact_deleted and take the appropriate -action by itself. -If a contact is deleted while the protocol is offline, the contact list will -display a message to the user about the problem, and set the byte setting -"CList"/"Delete" to 1. Each time such a protocol changes status from offline -or connecting to online the contact list will check for contacts with this -flag set and delete them at that time. Your hook for me_db_contact_deleted -will pick this up and everything will be good. -*/ +/////////////////////////////////////////////////////////////////////////////// +// Deleting contacts from protocols that store the contact list on the server: +// If a contact is deleted while the protocol is online, it is expected that the +// protocol will have hooked me_db_contact_deleted and take the appropriate +// action by itself. +// If a contact is deleted while the protocol is offline, the contact list will +// display a message to the user about the problem, and set the byte setting +// "CList"/"Delete" to 1. Each time such a protocol changes status from offline +// or connecting to online the contact list will check for contacts with this +// flag set and delete them at that time. Your hook for me_db_contact_deleted +// will pick this up and everything will be good. + #define PS_GETCAPS "/GetCaps" -//Get a human-readable name for the protocol -//wParam = cchName -//lParam = (LPARAM)(char*)szName -//Returns 0 on success, nonzero on failure -//cchName is the number of characters in the buffer szName -//This should be translated before being returned -//Some example strings are: -//"ICQ", "AIM", "RSA-1024 Encryption" +/////////////////////////////////////////////////////////////////////////////// +// Get a human-readable name for the protocol +// wParam = cchName +// lParam = (LPARAM)(char*)szName +// Returns 0 on success, nonzero on failure +// cchName is the number of characters in the buffer szName +// This should be translated before being returned +// Some example strings are: +// "ICQ", "AIM", "RSA-1024 Encryption" + #define PS_GETNAME "/GetName" -//Loads one of the protocol-specific icons -//wParam = whichIcon -//lParam = 0 -//Returns the HICON, or NULL on failure -//The returned HICON must be DestroyIcon()ed. -//The UI should overlay the online icon with a further UI-specified icon to -//represent the exact status mode. -#define PLI_PROTOCOL 1 //An icon representing the protocol (eg the multicoloured flower for ICQ) -#define PLI_ONLINE 2 //Online state icon for that protocol (eg green flower for ICQ) -#define PLI_OFFLINE 3 //Offline state icon for that protocol (eg red flower for ICQ) -#define PLIF_LARGE 0 //OR with one of the above to get the large (32x32 by default) icon -#define PLIF_SMALL 0x10000 //OR with one of the above to get the small (16x16 by default) icon -#define PLIF_ICOLIB 0x20000 //the returned HICON is managed by IcoLib, DO NOT DestroyIcon() it -#define PLIF_ICOLIBHANDLE 0x40000 //the function will return IcoLib handle not HICON +/////////////////////////////////////////////////////////////////////////////// +// Loads one of the protocol-specific icons +// wParam = whichIcon +// lParam = 0 +// Returns the HICON, or NULL on failure +// The returned HICON must be DestroyIcon()ed. +// The UI should overlay the online icon with a further UI-specified icon to +// represent the exact status mode. + +#define PLI_PROTOCOL 1 // An icon representing the protocol (eg the multicoloured flower for ICQ) +#define PLI_ONLINE 2 // Online state icon for that protocol (eg green flower for ICQ) +#define PLI_OFFLINE 3 // Offline state icon for that protocol (eg red flower for ICQ) +#define PLIF_LARGE 0 // OR with one of the above to get the large (32x32 by default) icon +#define PLIF_SMALL 0x10000 // OR with one of the above to get the small (16x16 by default) icon +#define PLIF_ICOLIB 0x20000 // the returned HICON is managed by IcoLib, DO NOT DestroyIcon() it +#define PLIF_ICOLIBHANDLE 0x40000 // the function will return IcoLib handle not HICON + #define PS_LOADICON "/LoadIcon" -//Change the protocol's status mode -//wParam = newMode, from ui/contactlist/statusmodes.h -//lParam = 0 -//returns 0 on success, nonzero on failure -//Will send an ack with: -//type = ACKTYPE_STATUS, result = ACKRESULT_SUCCESS, hProcess = (HANDLE)previousMode, lParam = newMode -//when the change completes. This ack is sent for all changes, not just ones -//caused by calling this function. -//Note that newMode can be ID_STATUS_CONNECTING <= newMode