{ Miranda IM: the free IM client for Microsoft* Windows* Copyright 2000-2009 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. } {$IFNDEF M_PROTOSVC} {$DEFINE M_PROTOSVC} { ***** 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. } type // PFNAMECHAR = ^FNAMECHAR; //#if MIRANDA_VER >= 0x0900 FNAMECHAR = TCHAR; //#else // FNAMECHAR = AnsiChar; //#endif TFNAMECHAR = FNAMECHAR; {<>} const PFLAGNUM_1 = $1; PF1_IMSEND = $00000001; // supports IM sending PF1_IMRECV = $00000002; // supports IM receiving PF1_IM = (PF1_IMSEND or PF1_IMRECV); PF1_URLSEND = $00000004; // supports separate URL sending PF1_URLRECV = $00000008; // supports separate URL receiving PF1_URL = (PF1_URLSEND or PF1_URLRECV); PF1_FILESEND = $00000010; // supports file sending PF1_FILERECV = $00000020; // supports file receiving PF1_FILE = (PF1_FILESEND or PF1_FILERECV); PF1_MODEMSGSEND = $00000040; // supports broadcasting away messages PF1_MODEMSGRECV = $00000080; // supports reading others' away messages PF1_MODEMSG = (PF1_MODEMSGSEND or PF1_MODEMSGRECV); PF1_SERVERCLIST = $00000100; // contact lists are stored on the server, not locally. See notes below PF1_AUTHREQ = $00000200; // will get authorisation requests for some or all contacts PF1_ADDED = $00000400; // will get 'you were added' notifications PF1_VISLIST = $00000800; // has an invisible list PF1_INVISLIST = $00001000; // has a visible list for when in invisible mode PF1_INDIVSTATUS = $00002000; // supports setting different status modes to each contact PF1_EXTENSIBLE = $00004000; // the protocol is extensible and supports plugin-defined messages PF1_PEER2PEER = $00008000; // supports direct (not server mediated) communication between clients PF1_NEWUSER = $00010000; // supports creation of new user IDs PF1_CHAT = $00020000; // has a realtime chat capability PF1_INDIVMODEMSG = $00040000; // supports replying to a mode message request with different text depending on the contact requesting PF1_BASICSEARCH = $00080000; // supports a basic user searching facility PF1_EXTSEARCH = $00100000; // supports one or more protocol-specific extended search schemes PF1_CANRENAMEFILE = $00200000; // supports renaming of incoming files as they are transferred PF1_FILERESUME = $00400000; // can resume broken file transfers, see PS_FILERESUME below PF1_ADDSEARCHRES = $00800000; // can add search results to the contact list PF1_CONTACTSEND = $01000000; // can send contacts to other users PF1_CONTACTRECV = $02000000; // can receive contacts from other users PF1_CONTACT = (PF1_CONTACTSEND or PF1_CONTACTRECV); PF1_CHANGEINFO = $04000000; // can change our user information stored on server PF1_SEARCHBYEMAIL = $08000000; // supports a search by e-mail feature PF1_USERIDISEMAIL = $10000000; // set if the uniquely identifying field of the network is the e-mail address PF1_SEARCHBYNAME = $20000000; // supports searching by nick/first/last names PF1_EXTSEARCHUI = $40000000; // has a dialog box to allow searching all the possible fields PF1_NUMERICUSERID = $80000000; // the unique user IDs for this protocol are numeric PFLAGNUM_2 = 2; // the status modes that the protocol supports PF2_ONLINE = $00000001; // an unadorned online mode PF2_INVISIBLE = $00000002; PF2_SHORTAWAY = $00000004; // Away on ICQ, BRB on MSN PF2_LONGAWAY = $00000008; // NA on ICQ, Away on MSN PF2_LIGHTDND = $00000010; // Occupied on ICQ, Busy on MSN PF2_HEAVYDND = $00000020; // DND on ICQ PF2_FREECHAT = $00000040; PF2_OUTTOLUNCH = $00000080; PF2_ONTHEPHONE = $00000100; PF2_IDLE = $00000200; //added during 0.3.4 (2004/09/13) PFLAGNUM_3 = 3; //the status modes that the protocol supports //away-style messages for. Uses the PF2_ flags. PFLAGNUM_4 = 4; // v0.3+: flag asking a protocol plugin how auths are handled PF4_FORCEAUTH = $00000001; // protocol has to send auth's for things to work PF4_FORCEADDED = $00000002; // protocol has to tell people that they were added (otherwise things don't work) PF4_NOCUSTOMAUTH = $00000004; // protocol can't send a custom message while asking others for auth PF4_SUPPORTTYPING = $00000008; // protocol supports user is typing messages v0.3.3+ PF4_SUPPORTIDLE = $00000010; // protocol understands idle, added during v0.3.4+ (2004/09/13) PF4_AVATARS = $00000020; // protocol has avatar support, added during v0.3.4 (2004/09/13) PF4_OFFLINEFILES = $00000040; // protocols supports sending files to offline users (v0.5.2) PF4_IMSENDUTF = $00000080; // protocol is able to process messages in utf-8 (v.0.7.0+) PF4_IMSENDOFFLINE = $00000100; // protocol supports sending offline messages (v0.8.0+) PF4_INFOSETTINGSVC = $00000200; // protocol supports user info translation services (v0.8.0+) PF4_NOAUTHDENYREASON = $00000400; // protocol doesn't support authorization deny reason (v0.9.0+) 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 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) } PFLAGNUM_5 = 5; // for PS_SETSTATUS LOGINERR_WRONGPASSWORD = 1; LOGINERR_NONETWORK = 2; LOGINERR_PROXYFAILURE = 3; LOGINERR_BADUSERID = 4; LOGINERR_NOSERVER = 5; LOGINERR_TIMEOUT = 6; LOGINERR_WRONGPROTOCOL = 7; LOGINERR_OTHERLOCATION = 8; // flag for PS_ADDTOLIST PALF_TEMPORARY = 1; // add the contact temporarily and invisibly, just to get user info or something // flags for PS_GETINFO SGIF_MINIMAL = 1; // get only the most basic information. This should // contain at least a Nick and e-mail. SGIF_ONOPEN = 2; // set when the User Info form is being opened // for PSR_MESSAGE PREF_CREATEREAD = 1; // create the database event with the 'read' flag set PREF_UNICODE = 2; PREF_RTL = 4; // 0.5+ addition: support for right-to-left messages PREF_UTF = 8; // message is in utf-8 (0.7.0+) PREF_SENT = 16; // message will be created with the DBEF_SENT flag // for PS_FILERESUME FILERESUME_OVERWRITE = 1; FILERESUME_RESUME = 2; FILERESUME_RENAME = 3; FILERESUME_SKIP = 4; const PSR_UNICODE = 1; type PPROTOSEARCHRESULT = ^TPROTOSEARCHRESULT; TPROTOSEARCHRESULT = record cbSize : int; nick : TFNAMECHAR; firstName: TFNAMECHAR; lastName : TFNAMECHAR; email : TFNAMECHAR; id : TFNAMECHAR; flags : int; reserved : array [0..(8*SizeOf(THANDLE) div SizeOf(dword))-1] of Byte; // Protocols may extend this structure with extra members at will and supply // a larger cbSize to reflect the new information, but they must not change // any elements above this comment // The 'reserved' field is part of the basic structure, not space to // overwrite with protocol-specific information. // If modules do this, they should take steps to ensure that information // they put there will be retained by anyone trying to save this structure. end; PPROTOSEARCHBYNAME = ^TPROTOSEARCHBYNAME; TPROTOSEARCHBYNAME = record pszNick : TChar; pszFirstName: TChar; pszLastName : TChar; end; PPROTORECVEVENT = ^TPROTORECVEVENT; TPROTORECVEVENT = record flags : DWORD; timestamp : DWORD; szMessage : TChar; lParam : LPARAM; pCustomData : pointer; cbCustomDataSize: DWORD; end; PPROTORECVFILE = ^TPROTORECVFILE; TPROTORECVFILE = record flags : DWORD; timestamp : DWORD; // unix time szDescription: PAnsiChar; pFiles : ^PAnsiChar; // pointer to an array of PAnsiChar's lParam : LPARAM; end; PPROTOFILERESUME = ^TPROTOFILERESUME; TPROTOFILERESUME = record action : int; // FILERESUME_* flag szFilename: TFNAMECHAR; // full path, only valid if action=FILERESUME_RENAME end; const { wParam : PFLAGNUM_* (see above) lParam : 0 Affects: Returns a bitfield for settings corresponding to flag number, see notes Returns: a bitfield of supported features -- or 0 if flag_num is not supported Notes : this checks what sort of things are actively supported by a protocol module } PS_GETCAPS = '/GetCaps'; { wParam : cchName lParam : Pointer to a buffer to fill with human-readable name Affect : Get a human-readable name for the protocol, see notes Result : 0 on success, [non zero] on failure Notes : Should be translated before being returned, cchName has the size of the buffer, example strings: "ICQ", "AIM" } PS_GETNAME = '/GetName'; { wParam : whichIcon lParam : 0 Affect : Loads one of the protocol-sspecific icons Returns: the HICON or NULL on failure, the returned icon must be DestroyIcon()ed, the UI should overlay the online icon with further UI-specified icon to repressent the exact status mode. } PLI_PROTOCOL = $1; // An icon representing the protocol (eg the multicoloured flower for ICQ) PLI_ONLINE = $2; // Online state icon for that protocol (eg green flower for ICQ) PLI_OFFLINE = $3; // Offline state icon for that protocol (eg red flower for ICQ) PLIF_LARGE = $0; // Or with one of the above to get the large (32x32 by default) icon PLIF_SMALL = $10000; // Or with one of the above to get the small (16x16 by default) icon PLIF_ICOLIB = $20000; // the returned HICON is managed by IcoLib, DO NOT DestroyIcon() it PLIF_ICOLIBHANDLE = $40000; // the function will return IcoLib handle not HICON PS_LOADICON = '/LoadIcon'; { wParam : status_mode lParam : Pointer to a null terminated string containing message Affect : Sets the status mode specific message for the user, see notes Returns: 0 on success, [non zero] on failure Notes : This service is not available unless PF1_MODEMSGSEND is set, and PF1_INDIVMODEMSG is *not* set. - Protocol modules smust support lParam=NULL, it may eithere mean to use an empty message or (preferably) not to reply at all to any requests. } PS_SETAWAYMSG = '/SetAwayMsg'; PS_SETAWAYMSGW = '/SetAwayMsgW'; { wParam : newMode from statusmodes.inc lParam : 0 Affect : Change the protocol's status mode, see notes Returns: 0 on success, [non zero] on failure Notes : Will send an ack with : type=ACKTYPE_SUCCESS, result=ACKRESULT_SUCCESS, hProcess=previousMode, lParam=newMode - when the change completes. This ack is sent for all changes, not just ones caused by calling this function. - NewMode can be ID_STATUS_CONNECTING<=newMode