/* Miranda NG: the free IM client for Microsoft* Windows* Copyright (c) 2012-14 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. 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 //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 #include "m_protocols.h" /* ***** Unicode Services note ******** ****************************************** Only new style protocols (Miranda 0.9+) with m_iVersion set to 2 or higher support Unicode services documented below, all other support only ANSI. For all other that do not support Unicode services, Miranda core will 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 #define PFLAGNUM_1 1 #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_URL (PF1_URLSEND|PF1_URLRECV) #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_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_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 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_FREECHAT 0x00000040 #define PF2_OUTTOLUNCH 0x00000080 #define PF2_ONTHEPHONE 0x00000100 #define PF2_IDLE 0x00000200 //added during 0.3.4 (2004/09/13) //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; 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; } return 0; } #define PFLAGNUM_4 4 //misc options #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 #define PF4_NOCUSTOMAUTH 0x00000004 // protocol doesn't support custom auth text (doesn't show auth text box) #define PF4_SUPPORTTYPING 0x00000008 // protocol supports user is typing messages v0.3.3+ #define PF4_SUPPORTIDLE 0x00000010 // protocol understands idle, added during v0.3.4+ (2004/09/13) #define PF4_AVATARS 0x00000020 // protocol has avatar support, added during v0.3.4 (2004/09/13) #define PF4_OFFLINEFILES 0x00000040 // protocols supports sending files to offline users (v0.5.2) #define PF4_IMSENDUTF 0x00000080 // protocol is able to process messages in utf-8 (v.0.7.0+) #define PF4_IMSENDOFFLINE 0x00000100 // protocol supports sending offline messages (v0.8.0+) #define PF4_INFOSETTINGSVC 0x00000200 // protocol supports user info translation services (v0.8.0+) #define PF4_NOAUTHDENYREASON 0x00000400 // protocol doesn't support authorization deny reason (v0.9.0+) #define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats (v0.95.2+) #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. 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. */ #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" #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 #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