diff options
Diffstat (limited to 'miranda-wine/include')
38 files changed, 8437 insertions, 0 deletions
diff --git a/miranda-wine/include/m_addcontact.h b/miranda-wine/include/m_addcontact.h new file mode 100644 index 0000000..b5a7495 --- /dev/null +++ b/miranda-wine/include/m_addcontact.h @@ -0,0 +1,65 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_ADDCONTACT_H__
+#define M_ADDCONTACT_H__ 1
+
+typedef struct{
+ int handleType; //one of the HANDLE_ constants
+ HANDLE handle; //hDbEvent if acs.handleType==HANDLE_EVENT, hContact if acs.handleType==HANDLE_CONTACT, ignored if acs.handleType==HANDLE_SEARCHRESULT
+ const char *szProto; //ignored if acs.handleType!=HANDLE_SEARCHRESULT
+ PROTOSEARCHRESULT *psr; //ignored if acs.handleType!=HANDLE_SEARCHRESULT
+}ADDCONTACTSTRUCT;
+
+/*
+ Description: Open the add contact dialog, see notes
+
+ wParam=[ (WPARAM)hWndParent ]
+ lParam=(LPARAM)(ADDCONTACTSTRUCT*)&acs
+
+ Notes:
+
+ During 0.3.0.0 development (circa 2003/06/08)
+
+ An entire copy of the ADDCONTACTSTRUCT structure is made,
+ the PROTOSEARCHRESULT is also copied at psr->cbSize, all default
+ strings are copied (even if they're not needed/used)
+ if you pass a structure that is bigger than PROTOSEARCHRESULT
+ then do not use pointers in the newly defined area because
+ they will not be copied.
+
+ passing wParam==NULL will result in a dialog that is created modeless
+
+ Before the circa, a modal dialog was *always* created and
+ strings within PROTOSEARCHRESULT were not copied.
+
+*/
+
+#define HANDLE_SEARCHRESULT 0
+#define HANDLE_EVENT 1
+#define HANDLE_CONTACT 2
+#define MS_ADDCONTACT_SHOW "AddContact/Show"
+
+#endif // M_ADDCONTACT_H__
+
+
diff --git a/miranda-wine/include/m_awaymsg.h b/miranda-wine/include/m_awaymsg.h new file mode 100644 index 0000000..05dd295 --- /dev/null +++ b/miranda-wine/include/m_awaymsg.h @@ -0,0 +1,41 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_AWAYMSG_H__
+#define M_AWAYMSG_H__ 1
+
+//show the away/na/etc message for a contact v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success or nonzero on failure
+//returns immediately, without waiting for the message to retrieve
+#define MS_AWAYMSG_SHOWAWAYMSG "SRAway/GetMessage"
+
+//returns the default status message for a status
+//wParam=(int)status
+//lParam=0
+//returns status msg. Remember to free the return value
+#define MS_AWAYMSG_GETSTATUSMSG "SRAway/GetStatusMessage"
+
+#endif // M_AWAYMSG_H__
+
diff --git a/miranda-wine/include/m_button.h b/miranda-wine/include/m_button.h new file mode 100644 index 0000000..304f1bd --- /dev/null +++ b/miranda-wine/include/m_button.h @@ -0,0 +1,59 @@ +/*
+Miranda IM
+Copyright (C) 2002 Robert Rainwater
+
+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.
+*/
+// Added in 0.3.0.0+
+
+#ifndef M_BUTTON_H__
+#define M_BUTTON_H__ 1
+
+#define MIRANDABUTTONCLASS _T( "MButtonClass" ) // Class of the control
+
+
+// Sets whether a dropdown arrow is used
+// wParam = TRUE/FALSE turns arrow on or off
+// lParam = not used
+// Usage: SendMessage(hwndbutton,BUTTONSETARROW,1,0);
+// Only works on MButtonClass buttons
+#define BUTTONSETARROW (WM_USER+1)
+
+// Sets whether the button is a default button
+// wParam = TRUE/FALSE default on/off
+// lParam = not used
+// Usage: SendMessage(hwndbutton,BUTTONSETDEFAULT,1,0);
+// Only works on MButtonClass buttons
+#define BUTTONSETDEFAULT (WM_USER+2)
+
+// Sets the button as a push button
+// wParam = lParam = not used
+// Usage: SendMessage(hwndbutton,BUTTONSETASPUSHBTN,0,0);
+// Only works on MButtonClass buttons
+#define BUTTONSETASPUSHBTN (WM_USER+3)
+
+// Sets the button type as a flat button without borders v0.3.3+
+// Usage: SendMessage(hwndbutton,BUTTONSETASFLATBTN,0,0);
+// Only works on MButtonClass buttons
+#define BUTTONSETASFLATBTN (WM_USER+4)
+
+// Sets a tooltip for the button v0.3.3+
+// wParam = (WPARAM)(char *)szTip
+// lParam = not used
+// Usage: SendMessage(hwndButton,BUTTONADDTOOLTIP,(WPARAM)"My Tip",0);
+#define BUTTONADDTOOLTIP (WM_USER+5)
+
+#endif // M_BUTTON_H__
+
diff --git a/miranda-wine/include/m_chat.h b/miranda-wine/include/m_chat.h new file mode 100644 index 0000000..8003795 --- /dev/null +++ b/miranda-wine/include/m_chat.h @@ -0,0 +1,631 @@ +/*
+Chat module plugin for Miranda IM
+
+Copyright (C) 2003 Jörgen Persson
+
+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 plugin provides event driven chat rooms for protocols that wish to use it.
+ It is built for IRC, which I also develop and is naturally biased towards IRC,
+ but it should work very well with other protocols too. I will try to explain as
+ careful as possible in this document how to use chat.dll
+
+ -- General guidelines --
+
+ There is ONE rule a protocol MUST follow to use this:
+
+ 1. Do NOT touch hContacts that has a byte "ChatRoom" set to ANYTHING other than 0! (Could be 1, 2, 3, ...)
+ This is because chat.dll adds contacts to the clist using the protocol name
+ supplied by the protocol. But this will naturally not work well if the
+ protocol also tampers with the contacts. The value of the BYTE indicates which type of
+ window/contact it is (see the GCW_* flags below). There is two exceptions to this rule:
+
+ * You should continue to handle the right click menu items of these
+ contacts as usual, by hooking the menu prebuild hook etc. Chat.dll can not
+ handle this in an efficient manner!
+
+ * You should also handle when the user deletes the contact/room from the
+ contact list, as the protocol will then most likely have to send some message
+ to the server that the user has left the room.
+
+ NOTE. Chat keeps its own copies of strings passed.
+
+
+
+
+ * * Example of implementing this rule * *:
+ * * This is a code snippet that is common in protocols * *:
+
+
+
+ hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact)
+ {
+ szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ if (szProto != NULL && !lstrcmpi(szProto, PROTONAME))
+ {
+ ... do something with the hContact here;
+ }
+ hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ }
+
+
+
+ * * You should do this instead * *:
+
+
+
+ hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ while (hContact)
+ {
+ szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ if (szProto != NULL && !lstrcmpi(szProto, PROTONAME))
+ {
+ if(DBGetContactSettingByte(hContact, PROTONAME, "ChatRoom", 0) == 0)
+ {
+ ... do something with the hContact here;
+ }
+ }
+ hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ }
+
+
+ There is not more to it than that! To recapitulate: do NOT touch contacts where the
+ BYTE "ChatRoom" is set to anything other than 0,
+
+
+
+
+
+
+ OK, enough of the precautions, HOW DO YOU USE CHAT? In short you need to do FOUR things:
+
+ 1. REGISTER your protocol with Chat
+ Only registered protocols can use Chat
+
+ 2. CREATE SESSIONS when your protocol are joining a group chat room. (One per room joined)
+ These sessions will be put on the contact-list and are managed totally by chat.
+ This is the reason you must obey to the "precautions" I mentioned above.
+ Do not tamper directly with Chat's hContacts. Use Services provided by Chat instead.
+
+ 3. SEND EVENTS to the sessions created in #3.
+ These events reflect users joining/leaving/speaking etc.
+
+ 4. DESTROY SESSIONS when the user leaves the room (ie the session is not needed anymore).
+
+ These four points are implemented in three services: MS_GC_REGISTER, MS_GC_NEWSESSION
+ and MS_GC_EVENT.
+*/
+
+
+//------------------------- SERVICES ------------------------
+/*
+ Step 1. -- REGISTER with Chat --
+
+ The first thing that a protocol need to do is register with Chat. This is best done
+ when ALL modules has loaded (ME_SYSTEM_MODULESLOADED). The registration is
+ needed to make sure that the protocol obey rule 1 mentioned above, but also to
+ set protocol specific preferences.
+
+ * Use MS_GC_REGISTER like this: CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr;
+
+ * returns 0 on success or error code on failure.
+*/
+
+// Flags
+#define GC_BOLD 0x0001 //enable the 'bold' button
+#define GC_ITALICS 0x0002 //enable the 'italics' button
+#define GC_UNDERLINE 0x0004 //enable the 'underline' button
+#define GC_COLOR 0x0008 //enable the 'foreground color' button
+#define GC_BKGCOLOR 0x0010 //enable the 'background color' button
+#define GC_ACKMSG 0x0020 //the protocol must acknowlege messages sent
+#define GC_TYPNOTIF 0x0040 //NOT SUPPORTED YET! Enable typing notifications.
+#define GC_CHANMGR 0x0080 //enable the 'channel settings' button
+#define GC_UNICODE 0x0100 //NOT SUPPORTED YET! Enable unicode (if chat supports it),
+ //Pass UNICODE instead of ASCII. Note that
+ //registration will fail if the unicode version of chat is not installed //isn't installed. Check what MS_GC_REGISTER returns.
+// Error messages
+#define GC_REGISTER_WRONGVER 1 //You appear to be using the wrong version of this API. Registration failed.
+#define GC_REGISTER_ERROR 2 //An internal error occurred. Registration failed.
+#define GC_REGISTER_NOUNICODE 3 //MS_GC_REGISTER returns this error if the Unicode version of chat
+ //is not installed and GC_UNICODE is set. Registration failed
+
+// GCREGISTER struct
+typedef struct {
+ int cbSize; //Set to sizeof(GCREGISTER);
+ DWORD dwFlags; //Use GC_* flags above to indicate features supported
+ const char* pszModule; //This MUST be the protocol name as registered with Miranda IM
+ const char* pszModuleDispName; //This is the protocol's real name as it will be displayed to the user
+ int iMaxText; //Max message length the protocol supports. Will limit the typing area input. 0 = no limit
+ int nColors; //Number of colors in the colorchooser menu for the color buttons. Max = 100
+ COLORREF* pColors; //pointer to the first item in a static COLORREF array containing the colors
+ //that should be showed in the colorchooser menu.
+ //ie: COLORREF crCols[nColors];
+ // pColors = &crCols[0];
+ } GCREGISTER;
+
+#define MS_GC_REGISTER "GChat/Register"
+
+
+
+
+
+
+
+/*
+ Step 2. -- CREATE a new SESSION --
+
+ Create a new session (chat room) and set various settings related to it.
+ The chat room will not be shown to the user until the 'set up' phase is
+ completed and SESSION_INITDONE is sent. See the MS_GC_EVENT for that.
+
+ * Use MS_GC_NEWSESSION like this: CallService(MS_GC_NEWSESSION, 0, (LPARAM)(GCSESSION *) &gcr;
+
+ * returns 0 on success or error code on failure
+*/
+
+
+// Session type
+#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels".
+ // A hContact will be added for the session
+#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window"
+ // A hContact will be added for the session, but it will default to being hidden (on the CList)
+#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
+ // support for adding more users etc. ex "MSN session".
+
+
+
+// Error messages
+#define GC_NEWSESSION_WRONGVER 1 //You appear to be using the wrong version of this API.
+#define GC_NEWSESSION_ERROR 2 //An internal error occurred.
+
+
+// GCREGISTER structure
+typedef struct {
+ int cbSize; //Set to sizeof(GCSESSION);
+ int iType; //Use one of the GCW_* flags above to set the type of session
+ const char *pszModule; //The name of the protocol owning the session (the same as pszModule when you register)
+ const char *pszName; //The name of the session as it will be displayed to the user
+ const char *pszID; //The unique identifier for the session.
+ const char *pszStatusbarText; //Optional text to set in the statusbar of the chat room window, or NULL.
+ BOOL bDisableNickList; //SUPPORT REMOVED in Chat 0.3+ but still included to not break existing implementations.
+ DWORD dwItemData; //Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
+ } GCSESSION;
+#define MS_GC_NEWSESSION "GChat/NewChat"
+
+
+
+
+
+
+/*
+ Step 3 -- SEND an EVENT --
+
+ Events is what drives Chat! After having created the session in Step 2
+ it is time to make it work for real. Follow these guidelines:
+
+ 1. Start off by telling Chat what possible statuses a user can have (in the nicklist)
+ by sending GC_EVENT_ADDGROUP as many times as needed. Also supply an icon
+ to go with this status. Ex "Voice status" on IRC
+
+ 2.Then send "JOIN" events (GC_EVENT_JOIN) to populate the user list.
+ You will need to send one event per user that should be added. As long as
+ SESSION_INITDONE has not been sent these events will not show up in the log.
+
+ 3.When you are done with filling the user list it is a good time to end
+ the set up phase and make the window visible by calling GC_EVENT_CONTROL event
+ with wParam = SESSION_INITDONE.
+
+ 4.You will also want to send a GC_EVENT_CONTROL with wParam = SESSION_ONLINE to
+ make the statusbar and the CList item go to "online" status
+
+ You have now set up the session and made it active. A CList hContact has been added
+ to the contact list and a chat room window is associated to the session. Send EVENTS to
+ Chat users speaking, users joining and so on. See below for full
+ list of what events are possible.
+
+ IMPORTANT: For sending events you'll use the GCEVENT and GCDEST structures. A GCDEST
+ structure pointer is passed inside GCEVENT and it tells Chat what event type it is
+ and what session it is related to. The GCDEST structure and its members are ALWAYS
+ used (but the members can be NULL in some occasions). Depending on what type of event
+ you are sending, the members of GCEVENT have different usage. Each event and how to
+ use the members are discussed below. The "bAddToLog" and "time" members are always valid
+ and always mean the same. bAddToLog = TRUE means that the event is added to the disk log
+ (at least when this makes sense). This can be used by Jabber for instance, when
+ it needs to add channel history to the window, but without logging to disk.
+ The "time" member is the timestamp of the event.(Tip. use the function time(NULL)
+ to set the current time)
+
+ NOTE. It is possible to send formatted text (bold, italics, underlined, foreground color
+ and background color) to Chat by using the following identifiers in the text (pszText):
+
+ %cXX - set the foreground color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits )
+ %C - reset foreground color to default
+ %fXX - set the background color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits )
+ %F - reset the background color to default
+ %b - enable bold
+ %B - disable bold
+ %u - enable underlined
+ %U - disable underlined
+ %i - enable italics
+ %I - disable italics
+ %r - reset all to default
+ %% - escape the formatting. Translates to %
+
+ IMPORTANT. If you have specified GC_COLOR or GC_BKGCOLOR when you registered you can expect to
+ get these identifiers in the text you receive from Chat as well. Make sure % is ALWAYS
+ translated to %% in text you send to Chat to avoid accidental formatting.
+ NOTE. You will not get %cRRRGGGBBB back, instead you will get the index of the colour as
+ registered with GC_REGISTER. Eg %c3 (the fourth colour of your index)
+
+ * Use MS_GC_EVENT like this: CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce;
+
+ * returns 0 on success or error code on failure
+
+*/
+
+// * List of possible events to send to Chat. Unlisted members are not valid *
+// * for the event. Listed members are mandatory unless otherwise specified *
+
+
+// GC_EVENT_JOIN - "<pszNick> has joined" (A user is joining the session)
+// pszNick - Display name
+// pszUID - Unique identifier of the user
+// pszStatus - Which status does the user have. Should be a status previously
+// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
+// bIsMe - Set to TRUE if it is the Miranda user
+// Chat needs to know which user in the userlist that is "self"
+// It cannot highlight a message containing the "own" nick without this info
+// NOTE. if time == NULL, then the event will not be shown in the message log
+#define GC_EVENT_JOIN 0x0001
+
+// GC_EVENT_PART - "<pszNick> has left: <pszText>" (A user left the session)
+// pszNick - Display name
+// pszUID - Unique identifier
+// pszText - Optional part message, can be NULL
+#define GC_EVENT_PART 0x0002
+
+// GC_EVENT_QUIT - "<pszNick> disconnected: pszText" (A user disconnected from the network)
+// pszID(in GCDEST) - Should be NULL as a disconnect event is global.
+// pszNick - Display name
+// pszUID - Unique identifier
+// pszText - Optional disconnect message, can be NULL
+#define GC_EVENT_QUIT 0x0004
+
+// GC_EVENT_KICK - "<pszStatus> kicked <pszNick>: <pszText>" (A user is kicking another user from the room)
+// pszNick - Display name of the one being being kicked
+// pszUID - Unique identifier of the one being kicked
+// pszStatus - Name of user who is doing the kicking
+// pszText - Optional kick message, can be NULL
+#define GC_EVENT_KICK 0x0008
+
+// GC_EVENT_NICK - "<pszNick> is now known as <pszText>" (A user changed his name)
+// NOTE, see GC_EVENT_CHUID also
+// pszID(in GCDEST) - Should be NULL as a nick change event is global.
+// pszNick - Old display name
+// pszUID - Unique identifier
+// pszText - New display name of the user. Color codes are not valid
+#define GC_EVENT_NICK 0x0010
+
+// GC_EVENT_NOTICE - "Notice from <pszNick>: <pszText>" (An IRC type notice)
+// pszID(in GCDEST) - Should be NULL to send to the active window
+// pszNick - Display name
+// pszUID - Unique identifier
+// pszText - Notice text
+#define GC_EVENT_NOTICE 0x0020
+
+// GC_EVENT_MESSAGE - "<pszNick>: <pszText> (A user is speaking)
+// pszNick - Display name
+// pszUID - Unique identifier
+// bIsMe - Set to TRUE if it is the Miranda user
+// pszText - Message text.
+#define GC_EVENT_MESSAGE 0x0040
+
+// GC_EVENT_TOPIC - "Topic is <pszText> (Set by: <pszNick>" (The room topic was changed/set)
+// pszNick - Optional display name of who set the topic, can be NULL
+// pszUID - Optional unique identifier of who set the topic, can be NULL
+// pszText - Topic text
+#define GC_EVENT_TOPIC 0x0080
+
+// GC_EVENT_INFORMATION (Informational text) Ex a server response to a /WHO command in IRC
+// pszID(in GCDEST) - NULL to send to the active window
+// pszText - Information text
+#define GC_EVENT_INFORMATION 0x0100
+
+// GC_EVENT_ACTION - "<pszNick> <pszText>" (An IRC Style action event)
+// pszNick - Display name
+// pszUID - Unique identifier
+// bIsMe - Set to TRUE if it is the Miranda user
+// pszText - Message text.
+#define GC_EVENT_ACTION 0x0200
+
+// GC_EVENT_ADDSTATUS - "<pszText> enables '<pszStatus>' for <pszNick>" (A status change has occured for a user)
+// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received.
+// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op"
+// pszNick - Display name of the one who receives a new status
+// pszUID - Unique identifier of the one who receives a new status
+// pszText - The display name of the one who is setting the status. Color codes are not valid
+// pszStatus - The status. Should be a status previously
+// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
+#define GC_EVENT_ADDSTATUS 0x0400
+
+// GC_EVENT_REMOVESTATUS - "<pszText> disables '<pszStatus>' for <pszNick>" (A status change has occured for a user)
+// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received.
+// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op"
+// pszNick - Display name of the one who got a status mode disabled
+// pszUID - Unique identifier of the one who got a status mode disabled
+// pszText - The display name of the one disabling the status. Color codes are not valid
+// pszStatus - The status. Should be a status previously
+// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
+#define GC_EVENT_REMOVESTATUS 0x0800
+
+// GC_EVENT_CHUID - not shown in the log (Change the unique identifier of a contact)
+// pszID(in GCDEST) - Should be NULL as a unique id's are global.
+// pszUID - The current unique identifier
+// pszText - The new unique identifier. Color codes are not valid
+#define GC_EVENT_CHUID 0x1000
+
+// GC_EVENT_CHANGESESSIONAME - not shown in the log (Change the display name of a session)
+// pszText - The new name. Color codes are not valid
+#define GC_EVENT_CHANGESESSIONAME 0x1001
+
+// GC_EVENT_ADDGROUP - not shown in the log (Add a possible status mode to the nicklist, ex IRC uses "Op", "Voice", "Normal" etc )
+// NOTE. When adding several statuses, start with the highest status
+// pszStatus - The new group name
+// dwItemData - Optional HICON handle to a 10x10 icon. Set to NULL to use the built in icons.
+#define GC_EVENT_ADDGROUP 0x1002
+
+// GC_EVENT_SETITEMDATA & GC_EVENT_SETITEMDATA - not shown in the log (Get/Set the user defined data of a session)
+// dwItemData - The itemdata to set or get
+#define GC_EVENT_SETITEMDATA 0x1003
+#define GC_EVENT_GETITEMDATA 0x1004
+
+// GC_EVENT_SETSBTEXT - not shown in the log (Set the text of the statusbar for a chat room window)
+// pszText - Statusbar text. Color codes are not valid
+#define GC_EVENT_SETSBTEXT 0x1006
+
+// GC_EVENT_ACK - not shown in the log (Acknowledge a outgoing message, when GC_ACKMSG is set
+#define GC_EVENT_ACK 0x1007
+
+// GC_EVENT_SENDMESSAGE - not shown in the log ("Fake" a message from a chat room as if the user had typed it). Used by IRC to broadcast /AME and /AMSG messages
+// pszText - The text
+#define GC_EVENT_SENDMESSAGE 0x1008
+
+// GC_EVENT_SETSTATUSEX - not shown in the log (Space separated list of pszUID's to indicate as away).
+// Used by IRC to mark users as away in the nicklist. Remember that UID's cannot contain spaces.
+// Let me know if you need some other support for your protocol.
+// pszText - The space separated list of pszUID's
+#define GC_EVENT_SETSTATUSEX 0x1009
+
+// GC_EVENT_CONTROL - not shown in the log (Control window associated to a session and the session itself)
+// NOTE 1: No members of GCEVENT are used, send one of the below flags in wParam instead,
+// Ex CallService(GC_EVENT_CONTROL, SESSION_INITDONE, (LPARAM)&gce);
+// NOTE 2: The first four control events are the only ones you should use most likely!
+// The ones below them are used by IRC to join channels hidden or maximized and show the server window from the system menu.
+// The SESSION_VISIBLE, SESSION_HIDDEN, SESSION_MAXIMIZE and SESSION_MINIMIZE events CAN replace SESSION_INITDONE but I urge you not to
+// do that as it will override any settings the user has made in the Chat options
+// NOTE 3: If pszID (of GCDEST) = NULL then this message will be broadcasted to all sessions, which can be usefule for terminating
+// all sessions when the protocol was disconnected
+#define SESSION_INITDONE 1 //send this when the session is fully set up (all users have ben added to the nicklist)
+#define SESSION_TERMINATE 7 //send to terminate a session and close the window associated with it
+#define SESSION_OFFLINE 8 //send to set the session as "online" (hContact is set to Online etc)
+#define SESSION_ONLINE 9 //send to set the session as "offline" (hContact is set to Offline etc)
+//------------
+#define WINDOW_VISIBLE 2 //make the room window visible
+#define WINDOW_HIDDEN 3 //close the room window. Session is not terminated.
+#define WINDOW_MAXIMIZE 4 //make the room window maximized
+#define WINDOW_MINIMIZE 5 //make the room window minimized
+#define WINDOW_CLEARLOG 6 //clear the log of the room window
+
+#define GC_EVENT_CONTROL 0x1005
+
+
+
+// Error messages
+#define GC_EVENT_WRONGVER 1 //You appear to be using the wrong version of this API.
+#define GC_EVENT_ERROR 2 //An internal error occurred.
+
+
+
+// The GCDEST structure. It is passed to Chat inside GCEVENT.
+typedef struct {
+ char *pszModule; //Name of the protocol (same as you registered with)
+ char *pszID; //Unique identifier of the session, or NULL to broadcast to all sessions as specified above
+ int iType; //Use GC_EVENT_* as defined above. Only one event per service call.
+} GCDEST;
+
+
+// The GCEVENT structure
+typedef struct {
+ int cbSize; // Set to sizeof(GCEVENT);
+ GCDEST* pDest; // pointer to a GCDEST structure which specifies the session to receive the event
+ const char *pszText; // usage depends on type of event, max 2048 characters
+ const char *pszNick; // usage depends on type of event
+ const char *pszUID; // usage depends on type of event, Do NOT use spaces for unique user identifiers.
+ const char *pszStatus; // usage depends on type of event
+ const char *pszUserInfo; // Additional user information that is displayed after the nickname.
+ // IRC use it to display a hostmask for JOIN, PART (and more) events.
+ BOOL bIsMe; // Is this event from the Miranda user?
+ BOOL bAddToLog; // Display in the message log? There is no need to set this to
+ // FALSE any other time than when initializing the window (before sending SESSION_INITDONE)
+ DWORD dwItemData; // User specified data.
+ time_t time; // Timestamp of the event
+ } GCEVENT;
+
+#define MS_GC_EVENT "GChat/NewEvent"
+
+
+
+
+// OK! That was about everything that you need to know about for operating Chat in a basic way.
+// There are however some more things you will need to know about. Some you may use and some you may not need,
+
+
+
+/*
+ -- GETTING info about a SESSION or session data --
+
+ Use this service to get information on different aspects of the sessions that are registered with Chat.
+
+ * Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(char *) pszModule);
+
+ * returns -1 on failure and the sessioncount on success
+*/
+#define MS_GC_GETSESSIONCOUNT "GChat/GetCount"
+
+
+
+
+/*
+ -- GETTING info about a SESSION or session data --
+
+ Use this service to get information on different aspects of the sessions that are registered with Chat.
+
+ * Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci;
+
+ * returns 0 on success or error code on failure
+*/
+
+// Flags
+#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get
+#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no
+#define HCONTACT 0x0004 // hContact is valid
+#define DATA 0x0008 // wItemData is valid
+#define ID 0x0010 // pszID is valid.
+#define NAME 0x0020 // pszName is valid
+#define TYPE 0x0040 // iType is valid
+#define COUNT 0x0080 // iCount is valid
+#define USERS 0x0100 // pszUsers is valid
+
+
+// The GC_INFO structure
+typedef struct {
+ DWORD Flags; // use a combination of the above flags
+ int iItem; // session type (GCW_*)
+ int iType; // session type (GCW_*)
+ char * pszModule; // the module name as registered in MS_GC_REGISTER
+ char * pszID; // unique ID of the session
+ char * pszName; // display name of the session
+ DWORD dwItemData; // user specified data.
+ int iCount; // count of users in the nicklist
+ char * pszUsers; // space separated string containing the UID's of the users in the user list.
+ // NOTE. Use Mirandas mmi_free() on the returned string.
+ HANDLE hContact; // hContact for the session (can be NULL)
+ } GC_INFO;
+#define MS_GC_GETINFO "GChat/GetInfo"
+
+
+
+
+
+//------------------------- HOOKS ------------------------
+/*
+ -- user interaction --
+ Hook this to receive notifications about when user take actions in a chat room window.
+ Check for the below flags to find out what type of user interaction it is. See the
+ to find out which members of GCHOOK that are valid.
+
+ * wParam=0
+ * lParam=(LPARAM)(GCEVENT *)pgch
+
+ * Returning nonzero from your hook will stop other hooks from being called.
+*/
+#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text.
+#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room
+#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU
+#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU
+#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing
+#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid
+#define GC_USER_LEAVE 8 // user requests to leave the session
+#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol
+ // should take action, but MSN may want to terminate the session here)
+#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory.
+#define ME_GC_EVENT "GChat/OutgoingEvent"
+
+typedef struct {
+ GCDEST* pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered
+ char * pszText; // usage depends on type of event
+ char * pszUID; // unique identifier, usage depends on type of event
+ DWORD dwData; // user defined data, usage depends on type of event
+ } GCHOOK;
+
+
+/*
+ -- Build the pop up menus --
+ The user wants to show a right click (popup) menu and your protocol should tell what
+ items should be added to the menu. You should create a static array of struct gc_item's.
+ When you get this notification you should set "nItems" to the number of gc_item's
+ you want to show on the user's popup menu and then set the "Item" member to point to that array.
+
+ * wParam=0
+ * lParam=(LPARAM)(GCMENUITEM *)gcmi
+
+ Returning nonzero from your hook will stop other hooks from being called.
+
+*/
+
+// type of item to add to the popup menu
+#define MENU_NEWPOPUP 1 // add submenu
+#define MENU_POPUPITEM 2 // add item to current submenu
+#define MENU_POPUPSEPARATOR 3 // add separator to current submenu
+#define MENU_SEPARATOR 4 // add separator to menu
+#define MENU_ITEM 5 // add item
+
+// type of menu that is being requested
+#define MENU_ON_LOG 1 // pop up menu on the message log
+#define MENU_ON_NICKLIST 2 // pop up menu on the user list
+
+// contains info on a menuitem to be added
+struct gc_item {
+ char * pszDesc; // Textual description of the menu item to add
+ DWORD dwID; // when/if the user selects this menu item this
+ // value will be returned via the above hook, GC_USER_LOGMENU
+ // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique.
+ int uType; // What kind of menu item is it? Use MENU_* flags above
+ BOOL bDisabled; // should the menu item be shown as disabled
+ };
+
+typedef struct {
+ char * pszModule; // Contains the protocol name, do NOT change.
+ char * pszID; // The unique identifier of the session that triggered the hook, do NOT change.
+ char * pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change.
+ int Type; // Type of menu. MENU_ON_* flags used. do NOT change.
+ int nItems; // Set this to the number of menu items you want to add
+ struct gc_item* Item; // pointer to the first in the array of gc_item's
+ } GCMENUITEMS;
+#define ME_GC_BUILDMENU "GChat/BuildMenu"
+
+/*
+ * Example of how to add 2 items to the popup menu for the userlist *
+
+ GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam;
+ if(gcmi->Type == MENU_ON_NICKLIST)
+ {
+ static struct gc_item Item[] = {
+ {Translate("User &details"), 1, MENU_ITEM, FALSE},
+ {Translate("&Op"), 2, MENU_POPUPITEM, FALSE},
+ };
+
+ gcmi->nItems = sizeof(Item)/sizeof(Item[0]);
+ gcmi->Item = &Item[0];
+ gcmi->Item[gcmi->nItems-1].bDisabled = bFlag;
+
+ return 0;
+ }
+*/
diff --git a/miranda-wine/include/m_clc.h b/miranda-wine/include/m_clc.h new file mode 100644 index 0000000..9f098bf --- /dev/null +++ b/miranda-wine/include/m_clc.h @@ -0,0 +1,265 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_CLC_H__
+#define M_CLC_H__ 1
+
+//This module is new in 0.1.2.1
+
+#define CLISTCONTROL_CLASS _T("CListControl")
+
+//styles
+#define CLS_MANUALUPDATE 0x0001 //todo
+#define CLS_SHOWHIDDEN 0x0002
+#define CLS_HIDEOFFLINE 0x0004 //hides all offline users
+#define CLS_CHECKBOXES 0x0008
+#define CLS_MULTICOLUMN 0x0010 //not true multi-column, just for ignore/vis options
+#define CLS_HIDEEMPTYGROUPS 0x0020 //note: this flag will be spontaneously removed if the 'new subgroup' menu item is clicked, for obvious reasons
+#define CLS_USEGROUPS 0x0040
+#define CLS_NOHIDEOFFLINE 0x0080 //overrides CLS_HIDEOFFLINE and the per-group hideoffline setting
+#define CLS_GREYALTERNATE 0x0100 //make every other line slightly grey
+#define CLS_GROUPCHECKBOXES 0x0200 //put checkboxes on groups too (managed by CLC)
+#define CLS_CONTACTLIST 0x0400 //this control will be the main contact list (v. 0.3.4.3+ 2004/11/02)
+
+#define CLS_EX_DISABLEDRAGDROP 0x00000001
+#define CLS_EX_EDITLABELS 0x00000002
+#define CLS_EX_SHOWSELALWAYS 0x00000004
+#define CLS_EX_TRACKSELECT 0x00000008
+#define CLS_EX_SHOWGROUPCOUNTS 0x00000010
+#define CLS_EX_DIVIDERONOFF 0x00000020
+#define CLS_EX_HIDECOUNTSWHENEMPTY 0x00000040
+#define CLS_EX_NOTRANSLUCENTSEL 0x00000080
+#define CLS_EX_LINEWITHGROUPS 0x00000100
+#define CLS_EX_QUICKSEARCHVISONLY 0x00000200
+#define CLS_EX_SORTGROUPSALPHA 0x00000400
+#define CLS_EX_NOSMOOTHSCROLLING 0x00000800
+
+#define CLM_FIRST 0x1000 //this is the same as LVM_FIRST
+#define CLM_LAST 0x1100
+
+//messages, compare with equivalent TVM_s in the MSDN
+#define CLM_ADDCONTACT (CLM_FIRST+0) //wParam=hContact
+#define CLM_ADDGROUP (CLM_FIRST+1) //wParam=hGroup
+#define CLM_AUTOREBUILD (CLM_FIRST+2)
+#define CLM_DELETEITEM (CLM_FIRST+3) //wParam=hItem
+#define CLM_EDITLABEL (CLM_FIRST+4) //wParam=hItem
+#define CLM_ENDEDITLABELNOW (CLM_FIRST+5) //wParam=cancel, 0 to save
+#define CLM_ENSUREVISIBLE (CLM_FIRST+6) //wParam=hItem, lParam=partialOk
+#define CLE_TOGGLE -1
+#define CLE_COLLAPSE 0
+#define CLE_EXPAND 1
+#define CLE_INVALID 0xFFFF
+#define CLM_EXPAND (CLM_FIRST+7) //wParam=hItem, lParam=CLE_
+#define CLM_FINDCONTACT (CLM_FIRST+8) //wParam=hContact, returns an hItem
+#define CLM_FINDGROUP (CLM_FIRST+9) //wParam=hGroup, returns an hItem
+#define CLM_GETBKCOLOR (CLM_FIRST+10) //returns a COLORREF
+#define CLM_GETCHECKMARK (CLM_FIRST+11) //wParam=hItem, returns 1 or 0
+#define CLM_GETCOUNT (CLM_FIRST+12) //returns the total number of items
+#define CLM_GETEDITCONTROL (CLM_FIRST+13) //returns the HWND, or NULL
+#define CLM_GETEXPAND (CLM_FIRST+14) //wParam=hItem, returns a CLE_, CLE_INVALID if not a group
+#define CLM_GETEXTRACOLUMNS (CLM_FIRST+15) //returns number of extra columns
+#define CLM_GETEXTRAIMAGE (CLM_FIRST+16) //wParam=hItem, lParam=MAKELPARAM(iColumn (0 based),0), returns iImage or 0xFF
+#define CLM_GETEXTRAIMAGELIST (CLM_FIRST+17) //returns HIMAGELIST
+#define CLM_GETFONT (CLM_FIRST+18) //wParam=fontId, see clm_setfont. returns hFont.
+#define CLM_GETINDENT (CLM_FIRST+19) //wParam=new group indent
+#define CLM_GETISEARCHSTRING (CLM_FIRST+20) //lParam=(char*)pszStr, max 120 bytes, returns number of chars in string
+#define CLM_GETITEMTEXT (CLM_FIRST+21) //wParam=hItem, lParam=(char*)pszStr, max 120 bytes
+#define CLM_GETSCROLLTIME (CLM_FIRST+22) //returns time in ms
+#define CLM_GETSELECTION (CLM_FIRST+23) //returns hItem
+#define CLCHT_ABOVE 0x0001 //above client area
+#define CLCHT_BELOW 0x0002 //below client area
+#define CLCHT_TOLEFT 0x0004 //left of client area
+#define CLCHT_TORIGHT 0x0008 //right of client area
+#define CLCHT_NOWHERE 0x0010 //in client area, not on an item
+#define CLCHT_ONITEMICON 0x0020
+#define CLCHT_ONITEMCHECK 0x0040
+#define CLCHT_ONITEMLABEL 0x0080
+#define CLCHT_ONITEMINDENT 0x0100 //to the left of an item icon
+#define CLCHT_ONITEMEXTRA 0x0200 //on an extra icon, HIBYTE(HIWORD()) says which
+#define CLCHT_ONITEM 0x03E0
+#define CLCHT_INLEFTMARGIN 0x0400
+#define CLCHT_BELOWITEMS 0x0800 //in client area but below last item
+#define CLM_HITTEST (CLM_FIRST+25) //lParam=MAKELPARAM(x,y) (relative to control), wParam=(PDWORD)&hitTest (see encoding of HitTest() in clc.h, can be NULL) returns hItem or NULL
+#define CLM_SELECTITEM (CLM_FIRST+26) //wParam=hItem
+#define CLB_TOPLEFT 0
+#define CLB_STRETCHV 1
+#define CLB_STRETCHH 2 //and tile vertically
+#define CLB_STRETCH 3
+#define CLBM_TYPE 0x00FF
+#define CLBF_TILEH 0x1000
+#define CLBF_TILEV 0x2000
+#define CLBF_PROPORTIONAL 0x4000
+#define CLBF_SCROLL 0x8000
+#define CLM_SETBKBITMAP (CLM_FIRST+27) //wParam=mode, lParam=hBitmap (don't delete it), NULL for none
+#define CLM_SETBKCOLOR (CLM_FIRST+28) //wParam=a COLORREF, default is GetSysColor(COLOR_3DFACE)
+#define CLM_SETCHECKMARK (CLM_FIRST+29) //wParam=hItem, lParam=1 or 0
+#define CLM_SETEXTRACOLUMNS (CLM_FIRST+30) //wParam=number of extra columns (zero to MAXEXTRACOLUMNS from clc.h, currently 16)
+#define CLM_SETEXTRAIMAGE (CLM_FIRST+31) //wParam=hItem, lParam=MAKELPARAM(iColumn (0 based),iImage). iImage=0xFF is a blank
+#define CLM_SETEXTRAIMAGELIST (CLM_FIRST+32) //lParam=HIMAGELIST
+
+#define FONTID_CONTACTS 0
+#define FONTID_INVIS 1
+#define FONTID_OFFLINE 2
+#define FONTID_NOTONLIST 3
+#define FONTID_GROUPS 4
+#define FONTID_GROUPCOUNTS 5
+#define FONTID_DIVIDERS 6
+#define FONTID_OFFINVIS 7
+#define FONTID_STATUSMSG 8
+#define FONTID_GROUPSCLOSED 9
+#define FONTID_CONTACTSHOVER 10
+#define FONTID_MAX 18
+
+#define CLM_SETFONT (CLM_FIRST+33) //wParam=hFont, lParam=MAKELPARAM(fRedraw,fontId)
+#define CLM_SETINDENT (CLM_FIRST+34) //wParam=new indent, default is 3 pixels
+#define CLM_SETITEMTEXT (CLM_FIRST+35) //wParam=hItem, lParam=(char*)pszNewText
+#define CLM_SETSCROLLTIME (CLM_FIRST+36) //wParam=time in ms, default 200
+
+#define CLM_SETHIDEEMPTYGROUPS (CLM_FIRST+38) //wParam=TRUE/FALSE
+#define GREYF_UNFOCUS 0x80000000
+#define MODEF_OFFLINE 0x40000000
+//and use the PF2_ #defines from m_protosvc.h
+#define CLM_SETGREYOUTFLAGS (CLM_FIRST+39) //wParam=new flags
+#define CLM_GETHIDEOFFLINEROOT (CLM_FIRST+40) //returns TRUE/FALSE
+#define CLM_SETHIDEOFFLINEROOT (CLM_FIRST+41) //wParam=TRUE/FALSE
+#define CLM_SETUSEGROUPS (CLM_FIRST+42) //wParam=TRUE/FALSE
+#define CLM_SETOFFLINEMODES (CLM_FIRST+43) //for 'hide offline', wParam=PF2_ flags and MODEF_OFFLINE
+#define CLM_GETEXSTYLE (CLM_FIRST+44) //returns CLS_EX_ flags
+#define CLM_SETEXSTYLE (CLM_FIRST+45) //wParam=CLS_EX_ flags
+#define CLM_GETLEFTMARGIN (CLM_FIRST+46) //returns count of pixels
+#define CLM_SETLEFTMARGIN (CLM_FIRST+47) //wParam=pixels
+typedef struct {
+ int cbSize;
+ const TCHAR *pszText;
+ HANDLE hParentGroup;
+ DWORD flags;
+ HICON hIcon; //todo
+} CLCINFOITEM;
+#define CLCIIF_BELOWGROUPS 1 //put it between groups and contacts, default is at top
+#define CLCIIF_BELOWCONTACTS 2 //put it at the bottom
+#define CLCIIF_CHECKBOX 0x40 //give this item a check box
+#define CLCIIF_GROUPFONT 0x80 //draw the item using FONTID_GROUPS
+
+#define CLM_ADDINFOITEMA (CLM_FIRST+48) //lParam=&cii, returns hItem
+#define CLM_ADDINFOITEMW (CLM_FIRST+53) //lParam=&cii, returns hItem
+#if defined( _UNICODE )
+ #define CLM_ADDINFOITEM CLM_ADDINFOITEMW
+#else
+ #define CLM_ADDINFOITEM CLM_ADDINFOITEMA
+#endif
+
+ //the order of info items is never changed, so make sure you add them in the
+ // order you want them to remain
+#define CLCIT_INVALID -1
+#define CLCIT_GROUP 0
+#define CLCIT_CONTACT 1
+#define CLCIT_DIVIDER 2
+#define CLCIT_INFO 3
+#define CLM_GETITEMTYPE (CLM_FIRST+49) //wParam=hItem, returns a CLCIT_
+#define CLGN_ROOT 0
+#define CLGN_CHILD 1
+#define CLGN_PARENT 2
+#define CLGN_NEXT 3
+#define CLGN_PREVIOUS 4
+#define CLGN_NEXTCONTACT 5
+#define CLGN_PREVIOUSCONTACT 6
+#define CLGN_NEXTGROUP 7
+#define CLGN_PREVIOUSGROUP 8
+#define CLM_GETNEXTITEM (CLM_FIRST+50) //wParam=flag, lParam=hItem, returns an hItem
+#define CLM_GETTEXTCOLOR (CLM_FIRST+51) //wParam=FONTID_, returns COLORREF
+#define CLM_SETTEXTCOLOR (CLM_FIRST+52) //wParam=FONTID_, lParam=COLORREF
+
+//notifications (most are omitted because the control processes everything)
+#define CLNF_ISGROUP 1
+#define CLNF_ISINFO 2
+typedef struct {
+ NMHDR hdr;
+ HANDLE hItem;
+ int action;
+ int iColumn; //-1 if not on an extra column
+ DWORD flags;
+ POINT pt;
+} NMCLISTCONTROL;
+#define CLN_FIRST (0U-100U)
+#define CLN_EXPANDED (CLN_FIRST-0) //hItem=hGroup, action=CLE_*
+#define CLN_LISTREBUILT (CLN_FIRST-1)
+#define CLN_ITEMCHECKED (CLN_FIRST-2) //todo //hItem,action,flags valid
+#define CLN_DRAGGING (CLN_FIRST-3) //hItem,pt,flags valid. only sent when cursor outside window, return nonzero if processed
+#define CLN_DROPPED (CLN_FIRST-4) //hItem,pt,flags valid. only sent when cursor outside window, return nonzero if processed
+#define CLN_LISTSIZECHANGE (CLN_FIRST-5) //pt.y valid. the vertical height of the visible items in the list has changed.
+#define CLN_OPTIONSCHANGED (CLN_FIRST-6) //nothing valid. If you set some extended options they have been overwritten and should be re-set
+#define CLN_DRAGSTOP (CLN_FIRST-7) //hItem,flags valid. sent when cursor goes back in to the window having been outside, return nonzero if processed
+#define CLN_NEWCONTACT (CLN_FIRST-8) //hItem,flags valid. sent when a new contact is added without a full list rebuild
+#define CLN_CONTACTMOVED (CLN_FIRST-9) //hItem,flags valid. sent when contact is moved without a full list rebuild
+#define CLN_CHECKCHANGED (CLN_FIRST-10) //hItem,flags valid. sent when any check mark is changed, but only for one change if there are many
+//NM_CLICK //hItem,iColumn,pt,flags valid
+//NM_KEYDOWN //NMKEY structure, only sent when key is not already processed, return nonzero to prevent further processing
+
+//an infotip for an item should be shown now
+//wParam=0
+//lParam=(LPARAM)(CLCINFOTIP*)&it
+//Return nonzero if you process this, because it makes no sense for more than
+//one plugin to grab it.
+//It is up to the plugin to decide the best place to put the infotip. Normally
+//it's a few pixels below and to the right of the cursor
+//This event is called after the mouse has been stationary over a contact for
+//(by default) 200ms, but see below.
+//Everything is in screen coordinates.
+typedef struct {
+ int cbSize;
+ int isTreeFocused; //so the plugin can provide an option
+ int isGroup; //0 if it's a contact, 1 if it's a group
+ HANDLE hItem; //handle to group or contact
+ POINT ptCursor;
+ RECT rcItem;
+} CLCINFOTIP;
+#define ME_CLC_SHOWINFOTIP "CLC/ShowInfoTip"
+
+//it's time to destroy an infotip
+//wParam=0
+//lParam=(LPARAM)(CLCINFOTIP*)&it
+//Only cbSize, isGroup and hItem are set
+//Return nonzero if you process this.
+//This is sent when the mouse moves off a contact when clc/showinfotip has
+//previously been called.
+//If you don't want this behaviour, you should have grabbed the mouse capture
+//yourself and made your own arrangements.
+#define ME_CLC_HIDEINFOTIP "CLC/HideInfoTip"
+
+//set the hover time before the infotip hooks are called
+//wParam=newTime
+//lParam=0
+//Returns 0 on success or nonzero on failure
+//The value of this setting is applied to all current CLC windows, and saved
+//to be applied to all future windows, including after restarts.
+//newTime is in ms.
+//The default is 750ms.
+#define MS_CLC_SETINFOTIPHOVERTIME "CLC/SetInfoTipHoverTime"
+
+//get the hover time before the infotip hooks are called
+//wParam=lParam=0
+//Returns the time in ms
+#define MS_CLC_GETINFOTIPHOVERTIME "CLC/GetInfoTipHoverTime"
+
+#endif // M_CLC_H__
+
diff --git a/miranda-wine/include/m_clist.h b/miranda-wine/include/m_clist.h new file mode 100644 index 0000000..e215992 --- /dev/null +++ b/miranda-wine/include/m_clist.h @@ -0,0 +1,550 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_CLIST_H__
+#define M_CLIST_H__ 1
+
+#include "statusmodes.h"
+
+//sent when the user asks to change their status
+//wParam=new status, from statusmodes.h
+//lParam=protocol name, NULL if for all protocols (added in v0.3.1alpha)
+//also sent due to a ms_clist_setstatusmode call
+#define ME_CLIST_STATUSMODECHANGE "CList/StatusModeChange"
+
+//force a change of status mode
+//wParam=new status, from statusmodes.h
+#define MS_CLIST_SETSTATUSMODE "CList/SetStatusMode"
+
+//get the current status mode
+//wParam=lParam=0
+//returns the current status
+//This is the status *as set by the user*, not any protocol-specific status
+//All protocol modules will attempt to conform to this setting at all times
+#define MS_CLIST_GETSTATUSMODE "CList/GetStatusMode"
+
+//gets a textual description of the given status mode (v0.1.0.1+)
+//wParam=status mode, from statusmodes.h
+//lParam=flags, below
+//returns a static buffer of the description of the given status mode
+//returns NULL if the status mode was unknown
+#define GSMDF_PREFIXONLINE 1 //prefix "Online: " to all status modes that
+ //imply online, eg "Online: Away"
+#define GCMDF_UNICODE 2 //will return TCHAR* instead of char*
+#if defined( _UNICODE )
+ #define GCMDF_TCHAR GCMDF_UNICODE //will return TCHAR* instead of char*
+#else
+ #define GCMDF_TCHAR 0 //will return char*, as usual
+#endif
+#define MS_CLIST_GETSTATUSMODEDESCRIPTION "CList/GetStatusModeDescription"
+
+//add a new item to the main menu
+//wParam=0
+//lParam=(LPARAM)(CLISTMENUITEM*)&mi
+//returns a handle to the new item, or NULL on failure
+//the service that is called when the item is clicked is called with
+//wParam=0, lParam=hwndContactList
+//dividers are inserted every 100000 positions
+//pszContactOwner is ignored for this service.
+//there is a #define PUTPOSITIONSINMENU in clistmenus.c which, when set, will
+//cause the position numbers to be placed in brackets after the menu items
+typedef struct {
+ int cbSize; //size in bytes of this structure
+ union {
+ char* pszName; //text of the menu item
+ TCHAR* ptszName; //Unicode text of the menu item
+ };
+ DWORD flags; //flags
+ int position; //approx position on the menu. lower numbers go nearer the top
+ HICON hIcon; //icon to put by the item. If this was not loaded from
+ //a resource, you can delete it straight after the call
+ char* pszService; //name of service to call when the item gets selected
+ union {
+ char* pszPopupName; //name of the popup menu that this item is on. If this
+ //is NULL the item is on the root of the menu
+ TCHAR* ptszPopupName;
+ };
+
+ int popupPosition; //position of the popup menu on the root menu. Ignored
+ //if pszPopupName is NULL or the popup menu already
+ //existed
+ DWORD hotKey; //keyboard accelerator, same as lParam of WM_HOTKEY
+ //0 for none
+ char *pszContactOwner; //contact menus only. The protocol module that owns
+ //the contacts to which this menu item applies. NULL if it
+ //applies to all contacts. If it applies to multiple but not all
+ //protocols, add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU
+} CLISTMENUITEM;
+#define CMIF_GRAYED 1
+#define CMIF_CHECKED 2
+#define CMIF_HIDDEN 4 //only works on contact menus
+#define CMIF_NOTOFFLINE 8 //item won't appear for contacts that are offline
+#define CMIF_NOTONLINE 16 // " online
+#define CMIF_NOTONLIST 32 //item won't appear on standard contacts
+#define CMIF_NOTOFFLIST 64 //item won't appear on contacts that have the 'NotOnList' setting
+#define MS_CLIST_ADDMAINMENUITEM "CList/AddMainMenuItem"
+
+//add a new item to the user contact menus
+//identical to clist/addmainmenuitem except when item is selected the service
+//gets called with wParam=(WPARAM)(HANDLE)hContact
+//pszContactOwner is obeyed.
+//popup menus are not supported. pszPopupName and popupPosition are ignored.
+//If ctrl is held down when right clicking, the menu position numbers will be
+//displayed in brackets after the menu item text. This only works in debug
+//builds.
+#define MS_CLIST_ADDCONTACTMENUITEM "CList/AddContactMenuItem"
+
+//modify an existing menu item v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hMenuItem
+//lParam=(LPARAM)(CLISTMENUITEM*)&clmi
+//returns 0 on success, nonzero on failure
+//hMenuItem will have been returned by clist/add*menuItem
+//clmi.flags should contain cmim_ constants below specifying which fields to
+//update. Fields without a mask flag cannot be changed and will be ignored
+#define CMIM_NAME 0x80000000
+#define CMIM_FLAGS 0x40000000
+#define CMIM_ICON 0x20000000
+#define CMIM_HOTKEY 0x10000000
+#define CMIM_ALL 0xF0000000
+#define MS_CLIST_MODIFYMENUITEM "CList/ModifyMenuItem"
+
+//the context menu for a contact is about to be built v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//modules should use this to change menu items that are specific to the
+//contact that has them
+#define ME_CLIST_PREBUILDCONTACTMENU "CList/PreBuildContactMenu"
+
+//sets the service to call when a contact is double-clicked
+//wParam=0
+//lParam=(LPARAM)(CLISTDOUBLECLICKACTION*)&dca
+//contactType is one or more of the constants below
+//pszService is called with wParam=hContact, lParam=0
+//pszService will only be called if there is no outstanding event on the
+//selected contact
+//returns 0 on success, nonzero on failure
+//in case of conflicts, the first module to have registered will get the
+//double click, no others will. This service will return success even for
+//duplicates.
+/*
+ Note: During development of 0.3.0.0 (2003/02/15) this service was completely dropped
+ by default it always returns 1 to mark failure, see ME_CLIST_DOUBLECLICKED for
+ a better implementation as a hook.
+*/
+typedef struct {
+ int cbSize;
+ char *pszContactOwner; //name of protocol owning contact, or NULL for all
+ DWORD flags; //any of the CMIF_NOT... flags above
+ char *pszService; //service to call on double click
+} CLISTDOUBLECLICKACTION;
+#define MS_CLIST_SETDOUBLECLICKACTION "CList/SetDoubleClickAction"
+
+/*
+wParam=(WPARAM)hContact
+lParam=0
+
+Event is fired when there is a double click on a CList contact,
+it is upto the caller to check for the protocol & status
+of the HCONTACT, it's not done for you anymore since it didn't make
+sense to store all this information in memory, etc.
+
+*/
+#define ME_CLIST_DOUBLECLICKED "CList/DoubleClicked"
+//gets the string that the contact list will use to represent a contact
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=flags
+//returns a pointer to the name, will always succeed, even if it needs to
+//return "(Unknown Contact)"
+//this pointer is to a statically allocated buffer which will be overwritten
+//on every call to this service. Callers should make sure that they copy the
+//information before they call this service again.
+#define GCDNF_NOMYHANDLE 1 //will never return the user's custom name
+#define GCDNF_UNICODE 2 //will return TCHAR* instead of char*
+#define GCDNF_NOCACHE 4 //will not use the cache
+
+#if defined( _UNICODE )
+ #define GCDNF_TCHAR GCDNF_UNICODE //will return TCHAR* instead of char*
+#else
+ #define GCDNF_TCHAR 0 //will return char*, as usual
+#endif
+
+ //even if it's the one that should be displayed. v0.1.2.0+
+ //v0.3.0.0+ if using GCDNF_NOMYHANDLE you must free your string
+#define MS_CLIST_GETCONTACTDISPLAYNAME "CList/GetContactDisplayName"
+
+// Invalidates the display name cache
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=not used
+#define MS_CLIST_INVALIDATEDISPLAYNAME "CList/InvalidateDiplayName"
+
+//adds an event to the contact list's queue
+//wParam=0
+//lParam=(LPARAM)(CLISTEVENT*)cle
+//The contact list will flash hIcon next to the contact hContact (use NULL for
+//a system message). szServiceName will be called when the user double clicks
+//the icon, at which point the event will be removed from the contact list's
+//queue automatically
+//pszService is called with wParam=(WPARAM)(HWND)hwndContactList,
+//lParam=(LPARAM)(CLISTEVENT*)cle. Its return value is ignored. cle is
+//invalidated when your service returns, so take copies of any important
+//information in it.
+//hDbEvent should be unique since it and hContact are the identifiers used by
+//clist/removeevent if, for example, your module implements a 'read next' that
+//bypasses the double-click.
+typedef struct {
+ int cbSize; //size in bytes of this structure
+ HANDLE hContact; //handle to the contact to put the icon by
+ HICON hIcon; //icon to flash
+ DWORD flags; //...of course
+ HANDLE hDbEvent; //caller defined but should be unique for hContact
+ LPARAM lParam; //caller defined
+ char *pszService; //name of the service to call on activation
+ union {
+ char *pszTooltip; //short description of the event to display as a
+ TCHAR *ptszTooltip; //tooltip on the system tray
+ };
+} CLISTEVENT;
+#define CLEF_URGENT 1 //flashes the icon even if the user is occupied,
+ //and puts the event at the top of the queue
+#define CLEF_ONLYAFEW 2 //the icon will not flash for ever, only a few
+ //times. This is for eg online alert
+#define CLEF_UNICODE 4 //set pszTooltip as unicode
+
+#if defined( _UNICODE )
+ #define CLEF_TCHAR CLEF_UNICODE //will use TCHAR* instead of char*
+#else
+ #define CLEF_TCHAR 0 //will return char*, as usual
+#endif
+
+#define MS_CLIST_ADDEVENT "CList/AddEvent"
+
+//removes an event from the contact list's queue
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(HANDLE)hDbEvent
+//returns 0 if the event was successfully removed, or nonzero if the event
+//was not found
+#define MS_CLIST_REMOVEEVENT "Clist/RemoveEvent"
+
+//gets the details of an event in the queue v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=iEvent
+//returns a CLISTEVENT* on success, NULL on failure
+//Returns the iEvent-th event from the queue for hContact, so iEvent=0 will
+//get the event that will be got when the user clicks on that contact.
+//Use hContact=INVALID_HANDLE_VALUE to search over all contacts, so iEvent=0
+//will get the event that will be got if the user clicks the systray icon.
+#define MS_CLIST_GETEVENT "CList/GetEvent"
+
+//process a WM_MEASUREITEM message for user context menus v0.1.1.0+
+//wParam, lParam, return value as for WM_MEASUREITEM
+//This is for displaying the icons by the menu items. If you don't call this
+//and clist/menudrawitem whne drawing a menu returned by one of the three menu
+//services below then it'll work but you won't get any icons
+#define MS_CLIST_MENUMEASUREITEM "CList/MenuMeasureItem"
+
+//process a WM_DRAWITEM message for user context menus v0.1.1.0+
+//wParam, lParam, return value as for WM_MEASUREITEM
+//See comments for clist/menumeasureitem
+#define MS_CLIST_MENUDRAWITEM "CList/MenuDrawItem"
+
+//builds the context menu for a specific contact v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns a HMENU identifying the menu. This should be DestroyMenu()ed when
+//finished with.
+#define MS_CLIST_MENUBUILDCONTACT "CList/MenuBuildContact"
+
+//gets the image list with all the useful icons in it v0.1.1.0+
+//wParam=lParam=0
+//returns a HIMAGELIST
+//the members of this image list are opaque, and you should trust what you
+//are given
+#define MS_CLIST_GETICONSIMAGELIST "CList/GetIconsImageList"
+#define IMAGE_GROUPOPEN 11
+#define IMAGE_GROUPSHUT 12
+
+//get the icon that should be associated with a contact v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns an index into the contact list imagelist. See clist/geticonsimagelist
+//If the contact is flashing an icon, this function will not return that
+//flashing icon. Use me_clist_contacticonchanged to get info about that.
+#define MS_CLIST_GETCONTACTICON "CList/GetContactIcon"
+
+//The icon of a contact in the contact list has changed v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=iconId
+//iconId is an offset into the clist's imagelist. See clist/geticonsimagelist
+#define ME_CLIST_CONTACTICONCHANGED "CList/ContactIconChanged"
+
+/******************************* CLUI only *********************************/
+
+// Stuff below here is ideally for the use of a CList UI module only.
+
+//get a handle to the main Miranda menu v0.1.1.0+
+//wParam=lParam=0
+//returns a HMENU. This need not be freed since it's owned by clist
+#define MS_CLIST_MENUGETMAIN "CList/MenuGetMain"
+
+//get a handle to the Miranda status menu v0.1.1.0+
+//wParam=lParam=0
+//returns a HMENU. This need not be freed since it's owned by clist
+#define MS_CLIST_MENUGETSTATUS "CList/MenuGetStatus"
+
+//processes a menu selection from a menu v0.1.1.0+
+//wParam=MAKEWPARAM(LOWORD(wParam from WM_COMMAND),flags)
+//lParam=(LPARAM)(HANDLE)hContact
+//returns TRUE if it processed the command, FALSE otherwise
+//hContact is the currently selected contact. It it not used if this is a main
+//menu command. If this is NULL and the command is a contact menu one, the
+//command is ignored
+#define MPCF_CONTACTMENU 1 //test commands from a contact menu
+#define MPCF_MAINMENU 2 //test commands from the main menu
+#define MS_CLIST_MENUPROCESSCOMMAND "CList/MenuProcessCommand"
+
+//processes a menu hotkey v0.1.1.0+
+//wParam=virtual key code
+//lParam=MPCF_ flags
+//returns TRUE if it processed the command, FALSE otherwise
+//this should be called in WM_KEYDOWN
+#define MS_CLIST_MENUPROCESSHOTKEY "CList/MenuProcessHotkey"
+
+//process all the messages required for docking v0.1.1.0+
+//wParam=(WPARAM)(MSG*)&msg
+//lParam=(LPARAM)(LRESULT*)&lResult
+//returns TRUE if the message should not be processed further, FALSE otherwise
+//only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
+//your wndproc should return lResult if and only if TRUE is returned
+#define MS_CLIST_DOCKINGPROCESSMESSAGE "CList/DockingProcessMessage"
+
+//determines whether the contact list is docked v0.1.1.0+
+//wParam=lParam=0
+//returns nonzero if the contact list is docked, of 0 if it is not
+#define MS_CLIST_DOCKINGISDOCKED "CList/DockingIsDocked"
+
+//process all the messages required for the tray icon v0.1.1.0+
+//wParam=(WPARAM)(MSG*)&msg
+//lParam=(LPARAM)(LRESULT*)&lResult
+//returns TRUE if the message should not be processed further, FALSE otherwise
+//only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
+//your wndproc should return lResult if and only if TRUE is returned
+#define MS_CLIST_TRAYICONPROCESSMESSAGE "CList/TrayIconProcessMessage"
+
+//process all the messages required for hotkeys v0.1.1.0+
+//wParam=(WPARAM)(MSG*)&msg
+//lParam=(LPARAM)(LRESULT*)&lResult
+//returns TRUE if the message should not be processed further, FALSE otherwise
+//only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
+//your wndproc should return lResult if and only if TRUE is returned
+#define MS_CLIST_HOTKEYSPROCESSMESSAGE "CList/HotkeysProcessMessage"
+
+//toggles the show/hide status of the contact list v0.1.1.0+
+//wParam=lParam=0
+//returns 0 on success, nonzero on failure
+#define MS_CLIST_SHOWHIDE "CList/ShowHide"
+
+//temporarily disable the autohide feature v0.1.2.1+
+//wParam=lParam=0
+//returns 0 on success, nonzero on failure
+//This service will restart the autohide timer, so if you need to keep the
+//window visible you'll have to be getting user input regularly and calling
+//this function each time
+#define MS_CLIST_PAUSEAUTOHIDE "CList/PauseAutoHide"
+
+//creates a new group and calls CLUI to display it v0.1.1.0+
+//wParam=hParentGroup
+//lParam=0
+//returns a handle to the new group
+//hParentGroup is NULL to create the new group at the root, or can be the
+//handle of the group of which the new group should be a subgroup.
+#define MS_CLIST_GROUPCREATE "CList/GroupCreate"
+
+//deletes a group and calls CLUI to display the change v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=0
+//returns 0 on success, nonzero on failure
+#define MS_CLIST_GROUPDELETE "CList/GroupDelete"
+
+//change the expanded state flag for a group internally v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=newState
+//returns 0 on success, nonzero on failure
+//newState is nonzero if the group is expanded, 0 if it's collapsed
+//CLUI is not called when this change is made
+#define MS_CLIST_GROUPSETEXPANDED "CList/GroupSetExpanded"
+
+//changes the flags for a group v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=MAKELPARAM(flags,flagsMask)
+//returns 0 on success, nonzero on failure
+//Only the flags given in flagsMask are altered.
+//CLUI is called on changes to GROUPF_HIDEOFFLINE.
+#define MS_CLIST_GROUPSETFLAGS "CList/GroupSetFlags"
+
+//get the name of a group v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=(LPARAM)(int*)&isExpanded
+//returns a static buffer pointing to the name of the group
+//returns NULL if hGroup is invalid.
+//this buffer is only valid until the next call to this service
+//&isExpanded can be NULL if you don't want to know if the group is expanded
+//or not.
+#define MS_CLIST_GROUPGETNAME "CList/GroupGetName"
+
+//get the name of a group v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=(LPARAM)(DWORD*)&flags
+//returns a static buffer pointing to the name of the group
+//returns NULL if hGroup is invalid.
+//this buffer is only valid until the next call to this service
+//&flags can be NULL if you don't want any of that info.
+#define GROUPF_EXPANDED 0x04
+#define GROUPF_HIDEOFFLINE 0x08
+#define MS_CLIST_GROUPGETNAME2 "CList/GroupGetName2"
+
+//move a group to directly before another group v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=(LPARAM)(HANDLE)hBeforeGroup
+//returns the new handle of the group on success, NULL on failure
+//The order is represented by the order in which MS_CLUI_GROUPADDED is called,
+//however UIs are free to ignore this order and sort alphabetically if they
+//wish.
+#define MS_CLIST_GROUPMOVEBEFORE "CList/GroupMoveBefore"
+
+//rename a group internally v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=(LPARAM)(char*)szNewName
+//returns 0 on success, nonzero on failure
+//this will fail if the group name is a duplicate of an existing name
+//CLUI is not called when this change is made
+#define MS_CLIST_GROUPRENAME "CList/GroupRename"
+
+//build a menu of the group tree v0.1.2.1+
+//wParam=0
+//lParam=0
+//returns a HMENU on success, or NULL on failure
+//The return value must be DestroyMenu()ed when you're done with it.
+//NULL will be returned if the user doesn't have any groups
+//The dwItemData of every menu item is the handle to that group.
+//Menu item IDs are assigned starting at 100, in no particular order.
+#define MS_CLIST_GROUPBUILDMENU "CList/GroupBuildMenu"
+
+//changes the 'hide offline contacts' flag and call CLUI v0.1.1.0+
+//wParam=newValue
+//lParam=0
+//returns 0 on success, nonzero on failure
+//newValue is 0 to show all contacts, 1 to only show online contacts
+//or -1 to toggle the value
+#define MS_CLIST_SETHIDEOFFLINE "CList/SetHideOffline"
+
+//do the message processing associated with double clicking a contact v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success, nonzero on failure
+#define MS_CLIST_CONTACTDOUBLECLICKED "CList/ContactDoubleClicked"
+
+//do the processing for when some files are dropped on a contact v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(char**)ppFiles
+//returns 0 on success, nonzero on failure
+//ppFiles is an array of fully qualified filenames, ending with a NULL.
+#define MS_CLIST_CONTACTFILESDROPPED "CList/ContactFilesDropped"
+
+//change the group a contact belongs to v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(HANDLE)hGroup
+//returns 0 on success, nonzero on failure
+//use hGroup=NULL to put the contact in no group
+#define MS_CLIST_CONTACTCHANGEGROUP "CList/ContactChangeGroup"
+
+//determines the ordering of two contacts v0.1.1.0+
+//wParam=(WPARAM)(HANDLE)hContact1
+//lParam=(LPARAM)(HANDLE)hContact2
+//returns 0 if hContact1 is the same as hContact2
+//returns +1 if hContact2 should be displayed after hContact1
+//returns -1 if hContact1 should be displayed after hContact2
+#define MS_CLIST_CONTACTSCOMPARE "CList/ContactsCompare"
+
+/*
+ wParam=0 (not used)
+ lParam=(LPARAM) &MIRANDASYSTRAYNOTIFY
+
+ Affects: Show a message in a ballon tip against a protocol icon (if installed)
+ Returns: 0 on success, non zero on failure
+ Notes : This service will not be created on systems that haven't got the Windows
+ support for ballontips, also note that it's upto Windows if it shows your
+ message and it keeps check of delays (don't be stupid about showing messages)
+
+ Version: 0.3.1a
+*/
+#define NIIF_INFO 0x00000001
+#define NIIF_WARNING 0x00000002
+#define NIIF_ERROR 0x00000003
+#define NIIF_ICON_MASK 0x0000000F
+#define NIIF_NOSOUND 0x00000010
+
+typedef struct {
+ int cbSize; // sizeof(MIRANDASYSTRAY)
+ char *szProto; // protocol to show under (may have no effect)
+ char *szInfoTitle; // only 64chars of it will be used
+ char *szInfo; // only 256chars of it will be used
+ DWORD dwInfoFlags; // see NIIF_* stuff
+ UINT uTimeout; // how long to show the tip for
+} MIRANDASYSTRAYNOTIFY;
+#define MS_CLIST_SYSTRAY_NOTIFY "Miranda/Systray/Notify"
+
+#define SETTING_TOOLWINDOW_DEFAULT 1
+#define SETTING_SHOWMAINMENU_DEFAULT 1
+#define SETTING_SHOWCAPTION_DEFAULT 1
+#define SETTING_CLIENTDRAG_DEFAULT 1
+#define SETTING_ONTOP_DEFAULT 0
+#define SETTING_MIN2TRAY_DEFAULT 1
+#define SETTING_TRAY1CLICK_DEFAULT 0
+#define SETTING_HIDEOFFLINE_DEFAULT 0
+#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0
+#define SETTING_USEGROUPS_DEFAULT 1
+#define SETTING_SORTBYSTATUS_DEFAULT 0
+#define SETTING_SORTBYPROTO_DEFAULT 0
+#define SETTING_TRANSPARENT_DEFAULT 0
+#define SETTING_ALPHA_DEFAULT 200
+#define SETTING_AUTOALPHA_DEFAULT 150
+#define SETTING_CONFIRMDELETE_DEFAULT 1
+#define SETTING_AUTOHIDE_DEFAULT 0
+#define SETTING_HIDETIME_DEFAULT 30
+#define SETTING_CYCLETIME_DEFAULT 4
+#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE
+#define SETTING_ALWAYSSTATUS_DEFAULT 0
+#define SETTING_ALWAYSMULTI_DEFAULT 0
+
+#define SETTING_TRAYICON_SINGLE 0
+#define SETTING_TRAYICON_CYCLE 1
+#define SETTING_TRAYICON_MULTI 2
+
+#define SETTING_STATE_HIDDEN 0
+#define SETTING_STATE_MINIMIZED 1
+#define SETTING_STATE_NORMAL 2
+
+#define SETTING_BRINGTOFRONT_DEFAULT 0
+
+#endif // M_CLIST_H__
+
diff --git a/miranda-wine/include/m_clistint.h b/miranda-wine/include/m_clistint.h new file mode 100644 index 0000000..3f97ff6 --- /dev/null +++ b/miranda-wine/include/m_clistint.h @@ -0,0 +1,328 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_CLISTINT_H__
+#define M_CLISTINT_H__ 1
+
+#define HCONTACT_ISGROUP 0x80000000
+#define HCONTACT_ISINFO 0xFFFF0000
+#define IsHContactGroup(h) (((unsigned)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO))
+#define IsHContactInfo(h) (((unsigned)(h)&HCONTACT_ISINFO)==HCONTACT_ISINFO)
+#define IsHContactContact(h) (((unsigned)(h)&HCONTACT_ISGROUP)==0)
+#define MAXEXTRACOLUMNS 16
+
+#define INTM_NAMECHANGED (WM_USER+10)
+#define INTM_ICONCHANGED (WM_USER+11)
+#define INTM_GROUPCHANGED (WM_USER+12)
+#define INTM_GROUPSCHANGED (WM_USER+13)
+#define INTM_CONTACTADDED (WM_USER+14)
+#define INTM_CONTACTDELETED (WM_USER+15)
+#define INTM_HIDDENCHANGED (WM_USER+16)
+#define INTM_INVALIDATE (WM_USER+17)
+#define INTM_APPARENTMODECHANGED (WM_USER+18)
+#define INTM_SETINFOTIPHOVERTIME (WM_USER+19)
+#define INTM_NOTONLISTCHANGED (WM_USER+20)
+#define INTM_RELOADOPTIONS (WM_USER+21)
+#define INTM_NAMEORDERCHANGED (WM_USER+22)
+#define INTM_IDLECHANGED (WM_USER+23)
+#define INTM_SCROLLBARCHANGED (WM_USER+24)
+#define INTM_PROTOCHANGED (WM_USER+25)
+
+#define TIMERID_RENAME 10
+#define TIMERID_DRAGAUTOSCROLL 11
+#define TIMERID_INFOTIP 13
+#define TIMERID_REBUILDAFTER 14
+#define TIMERID_DELAYEDRESORTCLC 15
+
+#define GROUP_ALLOCATE_STEP 8
+
+struct ClcContact;
+struct ClcData;
+struct CListEvent;
+
+/* templates, where are you... */
+
+typedef struct
+{
+ struct ClcContact** items;
+ int count, limit, increment;
+ void* sortFunc;
+}
+ ContactList;
+
+typedef struct
+{
+ struct CListEvent** items;
+ int count, limit, increment;
+ void* sortFunc;
+}
+ EventList;
+
+struct ClcGroup {
+ ContactList cl;
+ int expanded,hideOffline,groupId;
+ struct ClcGroup *parent;
+ int scanIndex;
+ int totalMembers;
+};
+
+struct ClcFontInfo {
+ HFONT hFont;
+ int fontHeight,changed;
+ COLORREF colour;
+};
+
+#define DRAGSTAGE_NOTMOVED 0
+#define DRAGSTAGE_ACTIVE 1
+#define DRAGSTAGEM_STAGE 0x00FF
+#define DRAGSTAGEF_MAYBERENAME 0x8000
+#define DRAGSTAGEF_OUTSIDE 0x4000
+
+#define CONTACTF_ONLINE 1
+#define CONTACTF_INVISTO 2
+#define CONTACTF_VISTO 4
+#define CONTACTF_NOTONLIST 8
+#define CONTACTF_CHECKED 16
+#define CONTACTF_IDLE 32
+
+#define DROPTARGET_OUTSIDE 0
+#define DROPTARGET_ONSELF 1
+#define DROPTARGET_ONNOTHING 2
+#define DROPTARGET_ONGROUP 3
+#define DROPTARGET_ONCONTACT 4
+#define DROPTARGET_INSERTION 5
+
+#define CLCDEFAULT_ROWHEIGHT 16
+#define CLCDEFAULT_EXSTYLE (CLS_EX_EDITLABELS|CLS_EX_TRACKSELECT|CLS_EX_SHOWGROUPCOUNTS|CLS_EX_HIDECOUNTSWHENEMPTY|CLS_EX_TRACKSELECT|CLS_EX_NOTRANSLUCENTSEL) //plus CLS_EX_NOSMOOTHSCROLL is got from the system
+#define CLCDEFAULT_SCROLLTIME 150
+#define CLCDEFAULT_GROUPINDENT 5
+#define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE)
+#define CLCDEFAULT_USEBITMAP 0
+#define CLCDEFAULT_BKBMPUSE CLB_STRETCH
+#define CLCDEFAULT_OFFLINEMODES MODEF_OFFLINE
+#define CLCDEFAULT_GREYOUTFLAGS 0
+#define CLCDEFAULT_FULLGREYOUTFLAGS (MODEF_OFFLINE|PF2_INVISIBLE|GREYF_UNFOCUS)
+#define CLCDEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT)
+#define CLCDEFAULT_SELTEXTCOLOUR GetSysColor(COLOR_HIGHLIGHTTEXT)
+#define CLCDEFAULT_HOTTEXTCOLOUR (IsWinVer98Plus()?RGB(0,0,255):GetSysColor(COLOR_HOTLIGHT))
+#define CLCDEFAULT_QUICKSEARCHCOLOUR RGB(255,255,0)
+#define CLCDEFAULT_LEFTMARGIN 0
+#define CLCDEFAULT_GAMMACORRECT 1
+#define CLCDEFAULT_SHOWIDLE 0
+#define CLCDEFAULT_USEWINDOWSCOLOURS 0
+
+// Miranda 0.4.3.0+
+// retrieves the pointer to a CLIST_INTERFACE structure
+// NOTE: valid only for the clist clone building, not for the regular use
+
+#define MS_CLIST_RETRIEVE_INTERFACE "CList/RetrieveInterface"
+
+/***************************************************************************
+ * CLIST_INTERFACE structure definition
+ ***************************************************************************/
+
+typedef struct {
+ char *szProto;
+ DWORD dwStatus;
+}
+ ClcProtoStatus;
+
+typedef struct
+{
+ HANDLE hContact;
+ TCHAR* name;
+ #if defined( _UNICODE )
+ char* szName;
+ #endif
+ TCHAR* group;
+ int isHidden;
+}
+ ClcCacheEntryBase;
+
+typedef struct
+{
+ int version;
+
+ HWND hwndContactList, hwndContactTree, hwndStatus;
+ HMENU hMenuMain;
+ HMODULE hInst;
+
+ int hClcProtoCount;
+ ClcProtoStatus *clcProto;
+
+ /* clc.h */
+ void ( *pfnClcOptionsChanged )( void );
+ void ( *pfnClcBroadcast )( int, WPARAM, LPARAM );
+ HMENU ( *pfnBuildGroupPopupMenu )( struct ClcGroup* );
+
+ LRESULT ( CALLBACK *pfnContactListControlWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
+ /* clcfiledrop.c */
+ void ( *pfnRegisterFileDropping )( HWND hwnd );
+ void ( *pfnUnregisterFileDropping )( HWND hwnd );
+
+ /* clcidents.c */
+ int ( *pfnGetRowsPriorTo )( struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex );
+ int ( *pfnFindItem )( HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible );
+ int ( *pfnGetRowByIndex )( struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup );
+ HANDLE ( *pfnContactToHItem )( struct ClcContact* contact );
+ HANDLE ( *pfnContactToItemHandle )( struct ClcContact * contact, DWORD * nmFlags );
+
+ /* clcitems.c */
+ struct ClcContact* ( *pfnCreateClcContact )( void );
+ struct ClcGroup* ( *pfnAddGroup )( HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers );
+ struct ClcGroup* ( *pfnRemoveItemFromGroup )(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
+
+ void ( *pfnFreeContact )( struct ClcContact *contact );
+ void ( *pfnFreeGroup )( struct ClcGroup *group );
+
+ int ( *pfnAddInfoItemToGroup )(struct ClcGroup *group, int flags, const TCHAR *pszText);
+ int ( *pfnAddItemToGroup )( struct ClcGroup *group,int iAboveItem );
+ int ( *pfnAddContactToGroup )( struct ClcData *dat, struct ClcGroup *group, HANDLE hContact );
+ void ( *pfnAddContactToTree )( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline);
+ void ( *pfnDeleteItemFromTree )( HWND hwnd, HANDLE hItem );
+ void ( *pfnRebuildEntireList )( HWND hwnd, struct ClcData *dat );
+ int ( *pfnGetGroupContentsCount )( struct ClcGroup *group, int visibleOnly );
+ void ( *pfnSortCLC )( HWND hwnd, struct ClcData *dat, int useInsertionSort );
+ void ( *pfnSaveStateAndRebuildList )(HWND hwnd, struct ClcData *dat);
+
+ /* clcmsgs.c */
+ LRESULT ( *pfnProcessExternalMessages )(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam );
+
+ /* clcpaint.c */
+ void ( *pfnPaintClc )( HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint );
+
+ /* clcutils.c */
+ char* ( *pfnGetGroupCountsText )(struct ClcData *dat, struct ClcContact *contact );
+ int ( *pfnHitTest )( HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags );
+ void ( *pfnScrollTo )( HWND hwnd, struct ClcData *dat, int desty, int noSmooth );
+ void ( *pfnEnsureVisible )(HWND hwnd, struct ClcData *dat, int iItem, int partialOk );
+ void ( *pfnRecalcScrollBar )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnSetGroupExpand )( HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState );
+ void ( *pfnDoSelectionDefaultAction )( HWND hwnd, struct ClcData *dat );
+ int ( *pfnFindRowByText )(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk );
+ void ( *pfnEndRename )(HWND hwnd, struct ClcData *dat, int save );
+ void ( *pfnDeleteFromContactList )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnBeginRenameSelection )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnCalcEipPosition )( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+ int ( *pfnGetDropTargetInformation )( HWND hwnd, struct ClcData *dat, POINT pt );
+ int ( *pfnClcStatusToPf2 )( int status );
+ int ( *pfnIsHiddenMode )( struct ClcData *dat, int status );
+ void ( *pfnHideInfoTip )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnNotifyNewContact )( HWND hwnd, HANDLE hContact );
+ DWORD ( *pfnGetDefaultExStyle )( void );
+ void ( *pfnGetDefaultFontSetting )( int i, LOGFONT* lf, COLORREF* colour );
+ void ( *pfnGetFontSetting )( int i, LOGFONT* lf, COLORREF* colour );
+ void ( *pfnLoadClcOptions )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnRecalculateGroupCheckboxes )( HWND hwnd, struct ClcData *dat );
+ void ( *pfnSetGroupChildCheckboxes )( struct ClcGroup *group, int checked );
+ void ( *pfnInvalidateItem )( HWND hwnd, struct ClcData *dat, int iItem );
+
+ int ( *pfnGetRowBottomY )(struct ClcData *dat, int item);
+ int ( *pfnGetRowHeight )(struct ClcData *dat, int item);
+ int ( *pfnGetRowTopY )(struct ClcData *dat, int item);
+ int ( *pfnGetRowTotalHeight )(struct ClcData *dat);
+ int ( *pfnRowHitTest )(struct ClcData *dat, int y);
+
+ /* clistevents.c */
+ int ( *pfnEventsProcessContactDoubleClick )( HANDLE hContact );
+ int ( *pfnEventsProcessTrayDoubleClick )( void );
+
+ /* clistmod.c */
+ int ( *pfnIconFromStatusMode )( const char *szProto, int status, HANDLE hContact );
+ int ( *pfnShowHide )( WPARAM, LPARAM );
+ TCHAR* ( *pfnGetStatusModeDescription )( int mode, int flags );
+
+ /* clistsettings.c */
+ ClcCacheEntryBase* ( *pfnGetCacheEntry )( HANDLE hContact );
+ ClcCacheEntryBase* ( *pfnCreateCacheItem )( HANDLE hContact );
+ void ( *pfnCheckCacheItem )( ClcCacheEntryBase* );
+ void ( *pfnFreeCacheItem )( ClcCacheEntryBase* );
+
+ TCHAR* ( *pfnGetContactDisplayName )( HANDLE hContact, int mode );
+ void ( *pfnInvalidateDisplayNameCacheEntry )( HANDLE hContact );
+
+ /* clisttray.c */
+ void ( *pfnTrayIconUpdateWithImageList )( int iImage, const TCHAR *szNewTip, char *szPreferredProto );
+ void ( *pfnTrayIconUpdateBase )( const char *szChangedProto );
+ void ( *pfnTrayIconSetToBase )( char *szPreferredProto );
+ void ( *pfnTrayIconIconsChanged )( void );
+ int ( *pfnTrayIconPauseAutoHide )( WPARAM wParam, LPARAM lParam );
+ int ( *pfnTrayIconProcessMessage )( WPARAM wParam, LPARAM lParam );
+ int ( *pfnCListTrayNotify )( MIRANDASYSTRAYNOTIFY* );
+
+ /* clui.c */
+ LRESULT ( CALLBACK *pfnContactListWndProc )( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
+ void ( *pfnCluiProtocolStatusChanged )( int status, const char* szProto );
+ void ( *pfnDrawMenuItem )( LPDRAWITEMSTRUCT, HICON, HICON );
+ void ( *pfnLoadCluiGlobalOpts )( void );
+ BOOL ( *pfnInvalidateRect )( HWND hwnd, CONST RECT* lpRect,BOOL bErase );
+ void ( *pfnOnCreateClc )( void );
+
+ /* contact.c */
+ void ( *pfnChangeContactIcon )( HANDLE hContact, int iIcon, int add );
+ void ( *pfnLoadContactTree )( void );
+ int ( *pfnCompareContacts )( const struct ClcContact *contact1, const struct ClcContact *contact2 );
+ void ( *pfnSortContacts )( void );
+ int ( *pfnSetHideOffline )( WPARAM wParam, LPARAM lParam );
+
+ /* docking.c */
+ int ( *pfnDocking_ProcessWindowMessage )( WPARAM wParam, LPARAM lParam );
+
+ /* group.c */
+ TCHAR* ( *pfnGetGroupName )( int idx, DWORD* pdwFlags );
+ int ( *pfnRenameGroup )( int groupID, TCHAR* newName );
+
+ /* keyboard.c */
+ int ( *pfnHotKeysRegister )( HWND hwnd );
+ void ( *pfnHotKeysUnregister )( HWND hwnd );
+ int ( *pfnHotKeysProcess )( HWND hwnd, WPARAM wParam, LPARAM lParam );
+ int ( *pfnHotkeysProcessMessage )( WPARAM wParam, LPARAM lParam );
+
+ /*************************************************************************************
+ * version 2 - events processing
+ *************************************************************************************/
+
+ EventList events;
+
+ struct CListEvent* ( *pfnCreateEvent )( void );
+ void ( *pfnFreeEvent )( struct CListEvent* );
+
+ struct CListEvent* ( *pfnAddEvent )( CLISTEVENT* );
+ CLISTEVENT* ( *pfnGetEvent )( HANDLE hContact, int idx );
+
+ int ( *pfnRemoveEvent )( HANDLE hContact, HANDLE hDbEvent );
+ int ( *pfnGetImlIconIndex )( HICON hIcon );
+
+ /*************************************************************************************
+ * version 3 additions
+ *************************************************************************************/
+
+ int ( *pfnGetWindowVisibleState )( HWND hWnd, int iStepX, int iStepY );
+}
+ CLIST_INTERFACE;
+
+extern CLIST_INTERFACE cli, *pcli;
+
+#endif // M_CLISTINT_H__
diff --git a/miranda-wine/include/m_clui.h b/miranda-wine/include/m_clui.h new file mode 100644 index 0000000..2c40b9a --- /dev/null +++ b/miranda-wine/include/m_clui.h @@ -0,0 +1,166 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_CLUI_H__
+#define M_CLUI_H__ 1
+
+//this module was created in 0.1.1.0
+//you probably shouldn't need to call anything in here. Look in
+//ui/contactlist/m_clist.h instead
+
+//gets the handle for the contact list window
+//wParam=lParam=0
+//returns the HWND
+//This call has a few very specific purposes internally in Miranda, and
+//shouldn't be gratuitously used. In almost all cases there's another call to
+//do whatever it is you are trying to do.
+#define MS_CLUI_GETHWND "CLUI/GetHwnd"
+
+//get ContactTree hwnd
+#define MS_CLUI_GETHWNDTREE "CLUI/GetHwndTree"
+
+//change protocol-specific status indicators
+//wParam=new status
+//lParam=(LPARAM)(const char*)szProtocolID
+//returns 0 on success, nonzero on failure
+//protocol modules don't want to call this. They want
+//clist/protocolstatuschanged instead
+#define MS_CLUI_PROTOCOLSTATUSCHANGED "CLUI/ProtocolStatusChanged"
+
+//a new group was created. Add it to the list
+//wParam=(WPARAM)(HANDLE)hGroup
+//lParam=newGroup
+//returns 0 on success, nonzero on failure
+//newGroup is set to 1 if the user just created the group, and 0 otherwise
+//this is also called when the contact list is being rebuilt
+//new groups are always created with the name "New Group"
+#define MS_CLUI_GROUPADDED "CLUI/GroupCreated"
+
+//change the icon for a contact
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=iconid
+//returns 0 on sucess, nonzero on failure
+//iconid is an offset in the image list. see clist/geticonsimagelist
+#define MS_CLUI_CONTACTSETICON "CLUI/ContactSetIcon"
+
+//remove a contact from the list
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success, nonzero on failure
+//this is not necessarily the same as a contact being actually deleted, since
+//if a contact goes offline while 'hide offline' is on, this will be called
+#define MS_CLUI_CONTACTDELETED "CLUI/ContactDeleted"
+
+//add a contact to the list
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=iconId
+//returns 0 on success, nonzero on failure
+//The caller processes the 'hide offline' setting, so the callee should not do
+//further processing based on the value of this setting.
+//warning: this will be called to re-add a contact when they come online if
+//'hide offline' is on, but it cannot determine if the contact is already on
+//the list, so you may get requests to add a contact when it is already on the
+//list, which you should ignore.
+//You'll also get this whenever an event is added for a contact, since if the
+//contact was offline it needs to be shown to display the message, even if hide
+//offline is on.
+//You should not re-sort the list on this call. A separate resort request will
+//be sent
+//iconid is an offset in the image list. see clist/geticonsimagelist
+#define MS_CLUI_CONTACTADDED "CLUI/ContactAdded"
+
+//rename a contact in the list
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success, nonzero on failure
+//you should not re-sort the list on this call. A separate resort request will
+//be sent
+//you get the new name from clist/getcontactdisplayname
+#define MS_CLUI_CONTACTRENAMED "CLUI/ContactRenamed"
+
+//start a rebuild of the contact list
+//wParam=lParam=0
+//returns 0 on success, nonzero on failure
+//this is the cue to clear the existing contents of the list
+//expect to get a series of clui/groupadded calls followed by a series of
+//clui/contactadded calls, then a clui/resortlist
+#define MS_CLUI_LISTBEGINREBUILD "CLUI/ListBeginRebuild"
+
+//end a rebuild of the contact list
+//wParam=lParam=0
+//returns 0 on success, nonzero on failure
+//if you displayed an hourglass in beginrebuild, set it back here
+//you do not need to explicitly sort the list
+#define MS_CLUI_LISTENDREBUILD "CLUI/ListEndRebuild"
+
+//sort the contact list now
+//wParam=lParam=0
+//returns 0 on success, nonzero on failure
+//sorts are buffered so you won't get this message lots of times if the list
+//needs to be re-sorted many times rapidly.
+#define MS_CLUI_SORTLIST "CLUI/SortList"
+
+//Gets a load of capabilities for the loaded CLUI v0.1.2.1+
+//wParam=capability, CLUICAPS_*
+//lParam=0
+//returns the requested value, 0 if wParam is an unknown value
+//If this service is not implemented, it is assumed to return 0 to all input
+#define CLUICAPS_FLAGS1 0
+#define CLUIF_HIDEEMPTYGROUPS 1 //the clist has a checkbox in its options
+ //to set this, which will be hidden if this flag is not set. It is
+ //up to the CLUI to provide support for it, but it just seemed insane
+ //to me to have hide offline and hide empty in different pages.
+ //The setting is "CList"/"HideEmptyGroups", a byte. A complete list
+ //reload is sent whenever the user changes it.
+#define CLUIF_DISABLEGROUPS 2 //can show list without groups. Adds option
+ //to change "CList"/"UseGroups", a byte.
+#define CLUIF_HASONTOPOPTION 4 //the clui options page provides a way to
+ //change "CList"/"OnTop", a byte. When it is changed the clui should
+ //also set the topmost flag on the window using SetWindowPos().
+#define CLUIF_HASAUTOHIDEOPTION 8 //the clui options page provides a way to
+ //change the list auto hide options. It should read and write the
+ //byte "CList"/"AutoHide" and the word "CList"/"HideTime". No other
+ //action is needed.
+#define MS_CLUI_GETCAPS "CLUI/GetCaps"
+
+//a contact is being dragged outside the main window v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=MAKELPARAM(screenX,screenY)
+//return nonzero to make the cursor a 'can drop here', or zero for 'no'
+#define ME_CLUI_CONTACTDRAGGING "CLUI/ContactDragging"
+
+//a contact has just been dropped outside the main window v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=MAKELPARAM(screenX,screenY)
+//return nonzero if your hook processed this, so no other hooks get it
+#define ME_CLUI_CONTACTDROPPED "CLUI/ContactDropped"
+
+//a contact that was being dragged outside the main window has gone back in to
+//the main window. v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//return zero
+#define ME_CLUI_CONTACTDRAGSTOP "CLUI/ContactDragStop"
+
+#endif // M_CLUI_H__
+
diff --git a/miranda-wine/include/m_contactdir.h b/miranda-wine/include/m_contactdir.h new file mode 100644 index 0000000..805fa27 --- /dev/null +++ b/miranda-wine/include/m_contactdir.h @@ -0,0 +1,162 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2005 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_CONTACTDIR_H__
+#define M_CONTACTDIR_H__ 1
+
+/* Contactdir module was created on 2005/05/17, 0.4.0.1
+
+ -- How you use this module as a protocol --
+
+ On Load() Register your protocol with the setting name that stores unique IDs, example:
+
+ if ( ContactDir_SupportExists() ) g_Atom=ContactDir_Register("ICQ", "UIN");
+
+ This will register your protocol and walk the database looking for all contacts on PROTOCOL_NAME which have
+ a "UIN" setting and store it in memory (converting to a string as needed) You of course have to
+ provide fallback if the services don't exist, it's an idea to keep existing code for that.
+
+ -
+
+ When you add a new contact via MS_DB_CONTACT_ADD, you must register it with your protocol atom too, via
+ ContactDir_AddContact(atom, "UIN #", hContact) and when it is deleted ContactDir_RemoveContact(atom, "UIN #")
+
+ -
+
+ To find a contact, use ContactDir_Lookup(atom, "ICQ #") which will return the hContact.
+
+*/
+
+typedef struct {
+ int cbSize;
+ char * szProto;
+ char * szSetting;
+ HANDLE atom; // out arg
+} CONTACTDIRECTORYDESCRIPTOR;
+
+/*
+ wParam: 0
+ lParam: (LPARAM) &CONTACTDIRECTORYDESCRIPTOR;
+ Affect: Register a given protocol and it's setting name which contains the unique key entry. e.g. ("ICQ", "UIN")
+ and return a HANDLE for use with other lookup services.
+ Returns: 0 on success, non zero on failure -- a returned handle is in .atom
+ Note: The directory will convert dword values into string representations but will not do this for bytes or words
+ used as IDs -- the protocol has to convert the IDs itself (:
+ Note: See ContactDir_Register() for a quicker way.
+ *** WARNING ***: This service does not expect the given module name to have registered as a protocol module, it
+ completely bypasses this information.
+ Version: 0.4.0.1 (2005/05/17+)
+*/
+#define MS_CONTACTDIR_REGISTER "ContactDir/Register"
+
+typedef struct {
+ int cbSize;
+ HANDLE atom; // Atom handle from MS_CONTACTDIR_REGISTER
+ char * szID; // in: value you wish to find (makes its own copy if needed)
+ HANDLE hContact; // out: hContact associated with szID, if any.
+} CONTACTDIRECTORYLOOKUP;
+
+/*
+
+ wParam: 0
+ lParam: (LPARAM) &CONTACTDIRECTORYLOOKUP;
+ Affect: Given an atom and string ID, will find the associated DB hContact value
+ Returns: 0 on success, non zero on failure
+ Version: 0.4.0.1 (2005/05/17+)
+ Note: ContactDir_Lookup() helper macro might be of use.
+*/
+
+#define MS_CONTACTDIR_LOOKUP "ContactDir/Lookup"
+
+/*
+ wParam: 0
+ lParam: (LPARAM)&CONTACTDIRECTORYLOOKUP;
+ Affect: Add a contact to a protocol atom association.
+ Returns: 0 on success, non zero on failure
+ Version: 0.4.0.1 (2005/05/17+)
+ Note: You must call this when you create a contact with MS_DB_CONTACT_ADD, see ContactDir_AddContact()
+*/
+#define MS_CONTACTDIR_ADDCONTACT "ContactDir/AddContact"
+
+/*
+ wParam: 0
+ lParam: (LPARAM)&CONTACTDIRECTORYLOOKUP;
+ Affect: Remove a contact to a protocol atom association.
+ Returns: 0 on success, non zero on failure
+ Version: 0.4.0.1 (2005/05/17+)
+ Note: see ContactDir_RemoveContact()
+*/
+#define MS_CONTACTDIR_REMOVECONTACT "ContactDir/RemoveContact"
+
+
+/* -- Helper functions -- */
+
+static int ContactDir_SupportExists(void)
+{
+ return ServiceExists(MS_CONTACTDIR_REGISTER);
+}
+
+// Only take as valid if ContactDir_SupportExists() returns true.
+static HANDLE ContactDir_Register(char * szProto, char * szSetting)
+{
+ CONTACTDIRECTORYDESCRIPTOR cd;
+ cd.cbSize=sizeof(CONTACTDIRECTORYDESCRIPTOR);
+ cd.szProto=szProto;
+ cd.szSetting=szSetting;
+ cd.atom=NULL;
+ CallService(MS_CONTACTDIR_REGISTER, 0, (LPARAM)&cd);
+ return cd.atom;
+}
+
+static __inline HANDLE ContactDir_Lookup(HANDLE atom, char * szID)
+{
+ CONTACTDIRECTORYLOOKUP f;
+ f.cbSize=sizeof(f);
+ f.atom=atom;
+ f.szID=szID;
+ f.hContact=NULL;
+ CallService(MS_CONTACTDIR_LOOKUP, 0, (LPARAM)&f);
+ return f.hContact;
+}
+
+static __inline void ContactDir_AddContact(HANDLE atom, char * szID, HANDLE hContact)
+{
+ CONTACTDIRECTORYLOOKUP c = {0};
+ c.cbSize=sizeof(CONTACTDIRECTORYLOOKUP);
+ c.atom=atom;
+ c.szID=szID;
+ c.hContact=hContact;
+ CallService(MS_CONTACTDIR_ADDCONTACT, 0, (LPARAM)&c);
+}
+
+static __inline void ContactDir_RemoveContact(HANDLE atom, char * szID)
+{
+ CONTACTDIRECTORYLOOKUP c = {0};
+ c.cbSize=sizeof(CONTACTDIRECTORYLOOKUP);
+ c.atom=atom;
+ c.szID=szID;
+ c.hContact=NULL;
+ CallService(MS_CONTACTDIR_REMOVECONTACT, 0, (LPARAM)&c);
+}
+
+#endif /* M_CONTACTDIR_H__ */
\ No newline at end of file diff --git a/miranda-wine/include/m_contacts.h b/miranda-wine/include/m_contacts.h new file mode 100644 index 0000000..fe9a82a --- /dev/null +++ b/miranda-wine/include/m_contacts.h @@ -0,0 +1,106 @@ +/*
+Miranda IM
+
+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_CONTACTS_H__
+#define M_CONTACTS_H__ 1
+
+typedef struct {
+ int cbSize;
+ BYTE dwFlag;
+ HANDLE hContact;
+ char *szProto;
+ BYTE type;
+ union {
+ BYTE bVal;
+ WORD wVal;
+ DWORD dVal;
+ TCHAR *pszVal;
+ WORD cchVal;
+ };
+} CONTACTINFO;
+
+// Types of information you can retreive by setting the dwFlag in CONTACTINFO
+#define CNF_FIRSTNAME 1 // returns first name (string)
+#define CNF_LASTNAME 2 // returns last name (string)
+#define CNF_NICK 3 // returns nick name (string)
+#define CNF_CUSTOMNICK 4 // returns custom nick name, clist name (string)
+#define CNF_EMAIL 5 // returns email (string)
+#define CNF_CITY 6 // returns city (string)
+#define CNF_STATE 7 // returns state (string)
+#define CNF_COUNTRY 8 // returns country (string)
+#define CNF_PHONE 9 // returns phone (string)
+#define CNF_HOMEPAGE 10 // returns homepage (string)
+#define CNF_ABOUT 11 // returns about info (string)
+#define CNF_GENDER 12 // returns gender (byte,'M','F' character)
+#define CNF_AGE 13 // returns age (byte, 0==unspecified)
+#define CNF_FIRSTLAST 14 // returns first name + last name (string)
+#define CNF_UNIQUEID 15 // returns uniqueid, protocol username (must check type for type of return)
+#define CNF_FAX 18 // returns fax (string)
+#define CNF_CELLULAR 19 // returns cellular (string)
+#define CNF_TIMEZONE 20 // returns timezone (string)
+#define CNF_MYNOTES 21 // returns user specified notes (string)
+#define CNF_BIRTHDAY 22 // returns birthday day of month (byte)
+#define CNF_BIRTHMONTH 23 // returns birthday month (byte)
+#define CNF_BIRTHYEAR 24 // returns birthday year (word)
+#define CNF_STREET 25 // returns street (string)
+#define CNF_ZIP 26 // returns zip code (string)
+#define CNF_LANGUAGE1 27 // returns language1 (string)
+#define CNF_LANGUAGE2 28 // returns language2 (string)
+#define CNF_LANGUAGE3 29 // returns language3 (string)
+#define CNF_CONAME 30 // returns company name (string)
+#define CNF_CODEPT 31 // returns company department (string)
+#define CNF_COPOSITION 32 // returns company position (string)
+#define CNF_COSTREET 33 // returns company street (string)
+#define CNF_COCITY 34 // returns company city (string)
+#define CNF_COSTATE 35 // returns company state (string)
+#define CNF_COZIP 36 // returns company zip code (string)
+#define CNF_COCOUNTRY 37 // returns company country (string)
+#define CNF_COHOMEPAGE 38 // returns company homepage (string)
+
+// Special types
+// Return the custom name using the name order setting
+// IMPORTANT: When using CNF_DISPLAY you MUST free the string returned
+// You must **NOT** do this from your version of free() you have to use Miranda's free()
+// you can get a function pointer to Miranda's free() via MS_SYSTEM_GET_MMI, see m_system.h
+#define CNF_DISPLAY 16
+// Same as CNF_DISPLAY except the custom handle is not used
+// IMPORTANT: When using CNF_DISPLAYNC you MUST free the string returned
+// You must **NOT** do this from your version of free() you have to use Miranda's free()
+// you can get a function pointer to Miranda's free() via MS_SYSTEM_GET_MMI, see m_system.h
+#define CNF_DISPLAYNC 17
+
+// Add this flag if you want to get the Unicode info
+#define CNF_UNICODE 0x80
+
+// If MS_CONTACT_GETCONTACTINFO returns 0 (valid), then one of the following
+// types is setting telling you what type of info you received
+#define CNFT_BYTE 1
+#define CNFT_WORD 2
+#define CNFT_DWORD 3
+#define CNFT_ASCIIZ 4
+
+// Get contact information
+// wParam = not used
+// lParam = (CONTACTINFO *)
+// Returns 1 on failure to retrieve the info and 0 on success. If
+// sucessful, the type is set and the result is put into the associated
+// member of CONTACTINFO
+#define MS_CONTACT_GETCONTACTINFO "Miranda/Contact/GetContactInfo"
+
+#endif // M_CONTACTS_H__
+
diff --git a/miranda-wine/include/m_database.h b/miranda-wine/include/m_database.h new file mode 100644 index 0000000..44fdca5 --- /dev/null +++ b/miranda-wine/include/m_database.h @@ -0,0 +1,1054 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_DATABASE_H__
+#define M_DATABASE_H__ 1
+
+/******************* DATABASE MODULE ***************************/
+
+/* Notes (as I think of them):
+- The module is 100% thread-safe
+- The database is the main routing point for the vast majority of Miranda.
+ Events are sent from the protocol module to here, and the send/recv message
+ module (for example) hooks the db/event/added event. Events like 'contact
+ online status changed' do not come through here - icqlib will send that one.
+- contacts work much the same. the find/add users module calls db/contact/add
+ and db/contact/writesetting and the contact list will get db/contact/added
+ and db/contact/settingchanged events
+- The user is just a special contact. A hcontact of NULL in most functions
+ means the user. Functions in which it cannot be used will be stated
+- events attached to the user are things like system messages
+- also in this module are crypt/decrypt functions for stuff that should be
+ obfuscated on the disk, and some time functions for dealing with timestamps
+ in events.
+- the contactsettings system is designed for being read by many different
+ modules. eg lots of people will be interested in "ICQ"/"UIN", but the module
+ name passed to contact/writesetting should always be your own. The Mirabilis
+ ICQ database importer clearly has to be an exception to this rule, along with
+ a few other bits.
+- the current database format means that geteventcontact is exceptionally slow.
+ It should be avoidable in most cases so I'm not too concerned, but if people
+ really need to use it a lot, I'll sort it out.
+- handles do not need to be closed unless stated
+- the database is loaded as a memory mapped file. This has various
+ disadvantages but a massive advantage in speed for random access.
+- The database is optimised for reading. Write performance is fairly bad,
+ except for adding events which is the most common activity and pretty good.
+- I'll work on caching to improve this later
+- Deleted items are left as empty space and never reused. All new items are
+ put at the end. A count is kept of this slack space and at some point a
+ separate programme will need to be written to repack the database when the
+ slack gets too high. It's going to be a good few months of usage before this
+ can happen to anyone though, so no rush.
+*/
+
+/******************** GENERALLY USEFUL STUFF***********************/
+
+#include <tchar.h>
+
+//DBVARIANT: used by db/contact/getsetting and db/contact/writesetting
+#define DBVT_DELETED 0 //this setting just got deleted, no other values are valid
+#define DBVT_BYTE 1 //bVal and cVal are valid
+#define DBVT_WORD 2 //wVal and sVal are valid
+#define DBVT_DWORD 4 //dVal and lVal are valid
+#define DBVT_ASCIIZ 255 //pszVal is valid
+#define DBVT_BLOB 254 //cpbVal and pbVal are valid
+#define DBVT_UTF8 253 //pszVal is valid
+#define DBVT_WCHAR 252 //pszVal is valid
+#define DBVTF_VARIABLELENGTH 0x80
+typedef struct {
+ BYTE type;
+ union {
+ BYTE bVal; char cVal;
+ WORD wVal; short sVal;
+ DWORD dVal; long lVal;
+ struct {
+ union {
+ char *pszVal;
+ TCHAR *ptszVal;
+ WCHAR *pwszVal;
+ };
+ WORD cchVal; //only used for db/contact/getsettingstatic
+ };
+ struct {
+ WORD cpbVal;
+ BYTE *pbVal;
+ };
+ };
+} DBVARIANT;
+
+/******************************************************************/
+/************************* SERVICES *******************************/
+/******************************************************************/
+
+/* DB/Contact/GetProfileName service
+Gets the name of the profile currently being used by the database module. This
+is the same as the filename of the database, minus extension
+ wParam=(WPARAM)(UINT)cbName
+ lParam=(LPARAM)(char*)pszName
+pszName is a pointer to the buffer that receives the name of the profile
+cbName is the size in bytes of the pszName buffer
+Returns 0 on success or nonzero otherwise
+*/
+#define MS_DB_GETPROFILENAME "DB/GetProfileName"
+
+/* DB/Contact/GetProfilePath service
+Gets the path of the profile currently being used by the database module. This
+path does not include the last '\'.
+ wParam=(WPARAM)(UINT)cbName
+ lParam=(LPARAM)(char*)pszName
+pszName is a pointer to the buffer that receives the path of the profile
+cbName is the size in bytes of the pszName buffer
+Returns 0 on success or nonzero otherwise
+*/
+#define MS_DB_GETPROFILEPATH "DB/GetProfilePath"
+
+/************************* Contact ********************************/
+
+/* DB/Contact/GetSetting service
+Look up the value of a named setting for a specific contact in the database
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBCONTACTGETSETTING*)&dbcgs
+hContact should have been returned by find*contact or addcontact
+Caller is responsible for free()ing dbcgs.pValue->pszVal and pbVal if they are
+returned. This should be done with db/contact/freevariant if you have your own
+heap (like DLLs do).
+Note that DBCONTACTGETSETTING takes a pointer to a DBVARIANT, whereas
+DBCONTACTWRITESETTING contains a DBVARIANT.
+Returns 0 on success or nonzero if the setting name was not found or hContact
+was invalid
+Because this is such a common function there are some short helper function at
+the bottom of this header that use it.
+
+(Added during 0.3.3+ development!!)
+
+If a setting is queried under for contact and it is deleted it will
+not be returned as a successful attempt, prior to 0.3.3 a *deleted*
+setting would be successfully read (which was a bug because the pValue
+was often garbage and maybe not even NULL terminated)
+
+To test for existing but 'deleted' settings, the return value will
+be 2, and pValue->type==DBVT_DELETED, at this point pValue is undefined.
+*/
+typedef struct {
+ const char *szModule; // pointer to name of the module that wrote the
+ // setting to get
+ const char *szSetting; // pointer to name of the setting to get
+ DBVARIANT *pValue; // pointer to variant to receive the value
+} DBCONTACTGETSETTING;
+#define MS_DB_CONTACT_GETSETTING "DB/Contact/GetSetting"
+
+/* DB/Contact/GetSettingString service 0.4.3+
+Same as DB/Contact/GetSetting, but also gets the required string type inside
+the dbcgs->type parameter
+*/
+#define MS_DB_CONTACT_GETSETTING_STR "DB/Contact/GetSettingStr"
+
+/* DB/Contact/GetSettingStatic service
+Look up the value of a named setting for a specific contact in the database
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBCONTACTGETSETTING*)&dbcgs
+hContact should have been returned by find*contact or addcontact
+This service differs from db/contact/getsetting in that it won't malloc()
+memory for the return value if it needs to do so. This introduces some extra
+constraints:
+Upon calling dbcgs.pValue->type should be initialised to the expected type of
+the setting. If the setting is of an integral type it won't matter if it's
+wrong and the service will correct it before returning, however if the setting
+is a string or a blob the service needs to know where to put the data and will
+fail if type is set wrongly.
+If dbcgs.pValue->type is DBVT_ASCIIZ or DBVT_BLOB upon calling, the
+corresponding data field (pszVal or pbVal) must point to a buffer allocated by
+the caller and the length field (cchVal or cpbVal) must contain the size of
+that buffer in bytes.
+If the setting type is variable length (DBVT_ASCIIZ or DBVT_BLOB), on exit the
+length field (cchVal or cpbVal) will be filled with the full length of the
+setting's value (excluding the terminating nul if it's DBVT_ASCIIZ).
+This service exists as well as db/contact/getsetting because malloc()/free()
+can be too slow for frequently queried settings.
+Returns 0 on success or nonzero if the setting name was not found or hContact
+was invalid.
+*/
+#define MS_DB_CONTACT_GETSETTINGSTATIC "DB/Contact/GetSettingStatic"
+
+/* DB/Contact/FreeVariant service
+Free the memory in a DBVARIANT that is allocated by a call to
+db/contact/getsetting
+ wParam=0
+ lParam=(LPARAM)(DBVARIANT*)&dbv
+Returns 0 on success, nonzero otherwise
+This service is actually just a wrapper around a call to free() and a test to
+check that it is a string or a blob in the variant. It exists because DLLs have
+their own heap and cannot free the memory allocated in db/contact/getsetting.
+Thus it need not be called if you know the variant contains some form of int,
+and you will often see free() used instead in code written before I noticed
+this problem.
+Good style, of course, dictates that it should be present to match all calls to
+db/contact/getsetting, but that's not going to happen of course.
+There's a helper function for this at the bottom of this header too.
+*/
+#define MS_DB_CONTACT_FREEVARIANT "DB/Contact/FreeVariant"
+
+/* DB/Contact/WriteSetting service
+Change the value of, or create a new value with, a named setting for a specific
+contact in the database to the given value
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBCONTACTWRITESETTING*)&dbcws
+hContact should have been returned by find*contact or addcontact
+Returns 0 on success or nonzero if hContact was invalid
+Note that DBCONTACTGETSETTING takes a pointer to a DBVARIANT, whereas
+DBCONTACTWRITESETTING contains a DBVARIANT.
+Because this is such a common function there are some short helper function at
+the bottom of this header that use it.
+Triggers a db/contact/settingchanged event just before it returns.
+*/
+typedef struct {
+ const char *szModule; // pointer to name of the module that wrote the
+ // setting to get
+ const char *szSetting; // pointer to name of the setting to get
+ DBVARIANT value; // variant containing the value to set
+} DBCONTACTWRITESETTING;
+#define MS_DB_CONTACT_WRITESETTING "DB/Contact/WriteSetting"
+
+/* DB/Contact/DeleteSetting service
+Removes a named setting for a specific contact from the database
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBCONTACTGETSETTING*)&dbcgs
+hContact should have been returned by find*contact or addcontact
+pValue from dbcgs is not used.
+Returns 0 on success or nonzero if the setting was not present or hContact was
+invalid
+Triggers a db/contact/settingchanged event before it deletes the setting. The
+'new value' of the setting is set to type=0 and all the other fields are
+undefined.
+*/
+#define MS_DB_CONTACT_DELETESETTING "DB/Contact/DeleteSetting"
+
+/* db/contact/enumsettings v0.1.0.1+
+Lists all the settings a specific modules has stored in the database for a
+specific contact.
+wParam=(WPARAM)(HANDLE)hContact
+lParam=(LPARAM)(DBCONTACTENUMSETTINGS*)&dbces
+Returns the return value of the last call to pfnEnumProc, or -1 if there are
+no settings for that module/contact pair
+Writing to or deleting from the database while enumerating will have
+unpredictable results for the enumeration, but the write will succeed.
+Use db/modules/enum to get a complete list of module names
+szSetting is only guaranteed to be valid for the duration of the callback. If
+you want to keep it for longer you must allocation your own storage.
+*/
+typedef int (*DBSETTINGENUMPROC)(const char *szSetting,LPARAM lParam);
+typedef struct {
+ DBSETTINGENUMPROC pfnEnumProc;
+ LPARAM lParam; //passed direct to pfnEnumProc
+ const char *szModule; //name of the module to get settings for
+ DWORD ofsSettings; //filled by the function to contain the offset from
+ //the start of the database of the requested settings group.
+} DBCONTACTENUMSETTINGS;
+#define MS_DB_CONTACT_ENUMSETTINGS "DB/Contact/EnumSettings"
+
+/* DB/Contact/GetCount service
+Gets the number of contacts in the database, which does not count the user
+ wParam=lParam=0
+Returns the number of contacts. They can be retrieved using contact/findfirst
+and contact/findnext
+*/
+#define MS_DB_CONTACT_GETCOUNT "DB/Contact/GetCount"
+
+/* DB/Contact/FindFirst service
+Gets the handle of the first contact in the database. This handle can be used
+with loads of functions. It does not need to be closed.
+ wParam=lParam=0
+Returns a handle to the first contact in the db on success, or NULL if there
+are no contacts in the db.
+*/
+#define MS_DB_CONTACT_FINDFIRST "DB/Contact/FindFirst"
+
+/* DB/Contact/FindNext service
+Gets the handle of the next contact after hContact in the database. This handle
+can be used with loads of functions. It does not need to be closed.
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns a handle to the contact after hContact in the db on success or NULL if
+hContact was the last contact in the db or hContact was invalid.
+*/
+#define MS_DB_CONTACT_FINDNEXT "DB/Contact/FindNext"
+
+/* DB/Contact/Delete
+Deletes the contact hContact from the database and all events and settings
+associated with it.
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns 0 on success or nonzero if hContact was invalid
+Please don't try to delete the user contact (hContact=NULL)
+Triggers a db/contact/deleted event just *before* it removes anything
+Because all events are deleted, lots of people may end up with invalid event
+handles from this operation, which they should be prepared for.
+*/
+#define MS_DB_CONTACT_DELETE "DB/Contact/Delete"
+
+/* DB/Contact/Add
+Adds a new contact to the database. New contacts initially have no settings
+whatsoever, they must all be added with db/contacts/writesetting.
+ wParam=lParam=0
+Returns a handle to the newly created contact on success, or NULL otherwise.
+Triggers a db/contact/added event just before it returns.
+*/
+#define MS_DB_CONTACT_ADD "DB/Contact/Add"
+
+/* DB/Contact/Is
+Checks if a given value is a valid contact handle, note that due
+to the nature of multiple threading, a valid contact can still become
+invalid after a call to this service.
+ wParam=(WPARAM)hContact
+ lParam=0
+Returns 1 if the contact is a contact, or 0 if the contact is not valid.
+*/
+#define MS_DB_CONTACT_IS "DB/Contact/Is"
+
+/************************** Event *********************************/
+
+/* DB/Event/GetCount service
+Gets the number of events in the chain belonging to a contact in the database.
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns the number of events in the chain owned by hContact or -1 if hContact
+is invalid. They can be retrieved using the event/find* services.
+*/
+#define MS_DB_EVENT_GETCOUNT "DB/Event/GetCount"
+
+/* DB/Event/Add
+Adds a new event to a contact's event list
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBEVENTINFO*)&dbe
+Returns a handle to the newly added event, or NULL on failure
+Triggers a db/event/added event just before it returns.
+Events are sorted chronologically as they are entered, so you cannot guarantee
+that the new hEvent is the last event in the chain, however if a new event is
+added that has a timestamp less than 90 seconds *before* the event that should
+be after it, it will be added afterwards, to allow for protocols that only
+store times to the nearest minute, and slight delays in transports.
+There are a few predefined eventTypes below for easier compatibility, but
+modules are free to define their own, beginning at 2000
+DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services
+db/time/x below with useful stuff for dealing with it.
+*/
+#define DBEF_FIRST 1 //this is the first event in the chain;
+ //internal only: *do not* use this flag
+#define DBEF_SENT 2 //this event was sent by the user. If not set this
+ //event was received.
+#define DBEF_READ 4 //event has been read by the user. It does not need
+ //to be processed any more except for history.
+#define DBEF_RTL 8 //event contains the right-to-left aligned text
+
+typedef struct {
+ int cbSize; //size of the structure in bytes
+ char *szModule; //pointer to name of the module that 'owns' this
+ //event, ie the one that is in control of the data format
+ DWORD timestamp; //seconds since 00:00, 01/01/1970. Gives us times until
+ //2106 unless you use the standard C library which is
+ //signed and can only do until 2038. In GMT.
+ DWORD flags; //the omnipresent flags
+ WORD eventType; //module-defined event type field
+ DWORD cbBlob; //size of pBlob in bytes
+ PBYTE pBlob; //pointer to buffer containing module-defined event data
+} DBEVENTINFO;
+#define EVENTTYPE_MESSAGE 0
+#define EVENTTYPE_URL 1
+#define EVENTTYPE_CONTACTS 2 //v0.1.2.2+
+#define EVENTTYPE_ADDED 1000 //v0.1.1.0+: these used to be module-
+#define EVENTTYPE_AUTHREQUEST 1001 //specific codes, hence the module-
+#define EVENTTYPE_FILE 1002 //specific limit has been raised to 2000
+#define MS_DB_EVENT_ADD "DB/Event/Add"
+
+/* DB/Event/Delete
+Removes a single event from the database
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(HANDLE)hDbEvent
+hDbEvent should have been returned by db/event/add or db/event/find*event
+Returns 0 on success, or nonzero if hDbEvent was invalid
+Triggers a db/event/deleted event just *before* the event is deleted
+*/
+#define MS_DB_EVENT_DELETE "DB/Event/Delete"
+
+/* DB/Event/GetBlobSize
+Retrieves the space in bytes required to store the blob in hDbEvent
+ wParam=(WPARAM)(HANDLE)hDbEvent
+ lParam=0
+hDbEvent should have been returned by db/event/add or db/event/find*event
+Returns the space required in bytes, or -1 if hDbEvent is invalid
+*/
+#define MS_DB_EVENT_GETBLOBSIZE "DB/Event/GetBlobSize"
+
+/* DB/Event/Get
+Retrieves all the information stored in hDbEvent
+ wParam=(WPARAM)(HANDLE)hDbEvent
+ lParam=(LPARAM)(DBEVENTINFO*)&dbe
+hDbEvent should have been returned by db/event/add or db/event/find*event
+Returns 0 on success or nonzero if hDbEvent is invalid
+Don't forget to set dbe.cbSize, dbe.pBlob and dbe.cbBlob before calling this
+service
+The correct value dbe.cbBlob can be got using db/event/getblobsize
+If successful, all the fields of dbe are filled. dbe.cbBlob is set to the
+actual number of bytes retrieved and put in dbe.pBlob
+If dbe.cbBlob is too small, dbe.pBlob is filled up to the size of dbe.cbBlob
+and then dbe.cbBlob is set to the required size of data to go in dbe.pBlob
+On return, dbe.szModule is a pointer to the database module's own internal list
+of modules. Look but don't touch.
+*/
+#define MS_DB_EVENT_GET "DB/Event/Get"
+
+/* DB/Event/MarkRead
+Changes the flags for an event to mark it as read.
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(HANDLE)hDbEvent
+hDbEvent should have been returned by db/event/add or db/event/find*event
+Returns the entire flag DWORD for the event after the change, or -1 if hDbEvent
+is invalid.
+This is the one database write operation that does not trigger an event.
+Modules should not save flags states for any length of time.
+*/
+#define MS_DB_EVENT_MARKREAD "DB/Event/MarkRead"
+
+/* DB/Event/GetContact
+Retrieves a handle to the contact that owns hDbEvent.
+ wParam=(WPARAM)(HANDLE)hDbEvent
+ lParam=0
+hDbEvent should have been returned by db/event/add or db/event/find*event
+NULL is a valid return value, meaning, as usual, the user.
+Returns (HANDLE)(-1) if hDbEvent is invalid, or the handle to the contact on
+success
+This service is exceptionally slow. Use only when you have no other choice at
+all.
+*/
+#define MS_DB_EVENT_GETCONTACT "DB/Event/GetContact"
+
+/* DB/Event/FindFirst
+Retrieves a handle to the first event in the chain for hContact
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns the handle, or NULL if hContact is invalid or has no events
+Events in a chain are sorted chronologically automatically
+*/
+#define MS_DB_EVENT_FINDFIRST "DB/Event/FindFirst"
+
+/* DB/Event/FindFirstUnread
+Retrieves a handle to the first unread event in the chain for hContact
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns the handle, or NULL if hContact is invalid or all its events have been
+read
+Events in a chain are sorted chronologically automatically, but this does not
+necessarily mean that all events after the first unread are unread too. They
+should be checked individually with event/findnext and event/get
+This service is designed for startup, reloading all the events that remained
+unread from last time
+*/
+#define MS_DB_EVENT_FINDFIRSTUNREAD "DB/Event/FindFirstUnread"
+
+/* DB/Event/FindLast
+Retrieves a handle to the last event in the chain for hContact
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+Returns the handle, or NULL if hContact is invalid or has no events
+Events in a chain are sorted chronologically automatically
+*/
+#define MS_DB_EVENT_FINDLAST "DB/Event/FindLast"
+
+/* DB/Event/FindNext
+Retrieves a handle to the next event in a chain after hDbEvent
+ wParam=(WPARAM)(HANDLE)hDbEvent
+ lParam=0
+Returns the handle, or NULL if hDbEvent is invalid or is the last event
+Events in a chain are sorted chronologically automatically
+*/
+#define MS_DB_EVENT_FINDNEXT "DB/Event/FindNext"
+
+/* DB/Event/FindPrev
+Retrieves a handle to the previous event in a chain before hDbEvent
+ wParam=(WPARAM)(HANDLE)hDbEvent
+ lParam=0
+Returns the handle, or NULL if hDbEvent is invalid or is the first event
+Events in a chain are sorted chronologically automatically
+*/
+#define MS_DB_EVENT_FINDPREV "DB/Event/FindPrev"
+
+/************************** Encryption ****************************/
+
+/* DB/Crypt/EncodeString
+Scrambles pszString in-place using a strange encryption algorithm
+ wParam=(WPARAM)(int)cbString
+ lParam=(LPARAM)(char*)pszString
+cbString is the size of the buffer pointed to by pszString, *not* the length
+of pszString. This service may be changed at a later date such that it
+increases the length of pszString
+Returns 0 always
+*/
+#define MS_DB_CRYPT_ENCODESTRING "DB/Crypt/EncodeString"
+
+/* DB/Crypt/DecodeString
+Descrambles pszString in-place using the strange encryption algorithm
+ wParam=(WPARAM)(int)cbString
+ lParam=(LPARAM)(char*)pszString
+Reverses the operation done by crypt/encodestring
+cbString is the size of the buffer pointed to by pszString, *not* the length
+of pszString.
+Returns 0 always
+*/
+#define MS_DB_CRYPT_DECODESTRING "DB/Crypt/DecodeString"
+
+/**************************** Time ********************************/
+
+/* DB/Time/TimestampToLocal
+Converts a GMT timestamp into local time
+ wParam=(WPARAM)(DWORD)timestamp
+ lParam=0
+Returns the converted value
+Timestamps have zero at midnight 1/1/1970 GMT, this service converts such a
+value to be based at midnight 1/1/1970 local time.
+This service does not use a simple conversion based on the current offset
+between GMT and local. Rather, it figures out whether daylight savings time
+would have been in place at the time of the stamp and gives the local time as
+it would have been at the time and date the stamp contains.
+This service isn't nearly as useful as db/time/TimestampToString below and I
+recommend avoiding its use when possible so that you don't get your timezones
+mixed up (like I did. Living at GMT makes things easier for me, but has certain
+disadvantages :-) ).
+*/
+#define MS_DB_TIME_TIMESTAMPTOLOCAL "DB/Time/TimestampToLocal"
+
+/* DB/Time/TimestampToString
+Converts a GMT timestamp into a customisable local time string
+ wParam=(WPARAM)(DWORD)timestamp
+ lParam=(LPARAM)(DBTIMETOSTRING*)&tts
+Returns 0 always
+Uses db/time/timestamptolocal for the conversion so read that description to
+see what's going on.
+The string is formatted according to the current user's locale, language and
+preferences.
+szFormat can have the following special characters:
+ t Time without seconds, eg hh:mm
+ s Time with seconds, eg hh:mm:ss
+ m Time without minutes, eg hh
+ d Short date, eg dd/mm/yyyy
+ D Long date, eg d mmmm yyyy
+All other characters are copied across to szDest as-is
+*/
+typedef struct {
+ char *szFormat; // format string, as above
+ char *szDest; // place to put the output string
+ int cbDest; // maximum number of bytes to put in szDest
+} DBTIMETOSTRING;
+#define MS_DB_TIME_TIMESTAMPTOSTRING "DB/Time/TimestampToString"
+
+typedef struct {
+ TCHAR *szFormat; // format string, as above
+ TCHAR *szDest; // place to put the output string
+ int cbDest; // maximum number of bytes to put in szDest
+} DBTIMETOSTRINGT;
+#define MS_DB_TIME_TIMESTAMPTOSTRINGT "DB/Time/TimestampToStringT"
+
+/*************************** Random *******************************/
+
+/*
+Switches safety settings on or off
+wParam=(WPARAM)(BOOL)newSetting
+lParam=0
+returns 0 always
+newSetting is TRUE initially.
+Miranda's database is normally protected against corruption by agressively
+flushing data to the disk on writes. If you're doing a lot of writes (eg in
+an import plugin) it can sometimes be desirable to switch this feature off to
+speed up the process. If you do switch it off, you must remember that crashes
+are far more likely to be catastrophic, so switch it back on at the earliest
+possible opportunity.
+Note that if you're doing a lot of setting writes, the flush is already delayed
+so you need not use this service for that purpose.
+*/
+#define MS_DB_SETSAFETYMODE "DB/SetSafetyMode"
+
+/*************************** Modules ******************************/
+
+/* db/modules/enum v0.1.0.1+
+Enumerates the names of all modules that have stored or requested information
+from the database.
+wParam=lParam
+lParam=(WPARAM)(DBMODULEENUMPROC)dbmep
+Returns the value returned by the last call to dbmep
+This service is only really useful for debugging, in conjunction with
+db/contact/enumsettings
+lParam is passed directly to dbmep
+dbmep should return 0 to continue enumeration, or nonzero to stop.
+ofsModuleName is the offset of the module name from the start of the profile
+database, and is only useful for really heavyweight debugging
+Modules names will be enumerated in no particular order
+Writing to the database while module names are being enumerated will cause
+unpredictable results in the enumeration, but the write will work.
+szModuleName is only guaranteed to be valid for the duration of the callback.
+If you want to keep it for longer you must allocation your own storage.
+**BUG**: Prior to 0.1.2.0 dbmep was called as (lParam)(szMod,ofsMod,lParam).
+ This means that the lParam parameter to dbmep was useless, and explains the
+ slightly odd 'wParam=lParam' in the definition.
+*/
+typedef int (*DBMODULEENUMPROC)(const char *szModuleName,DWORD ofsModuleName,LPARAM lParam);
+#define MS_DB_MODULES_ENUM "DB/Modules/Enum"
+
+/******************************************************************/
+/************************** EVENTS ********************************/
+/******************************************************************/
+
+/* DB/Event/Added event
+Called when a new event has been added to the event chain for a contact
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(HANDLE)hDbEvent
+hDbEvent is a valid handle to the event. hContact is a valid handle to the
+contact to which hDbEvent refers.
+Since events are sorted chronologically, you cannot guarantee that hDbEvent is
+at any particular position in the chain.
+*/
+#define ME_DB_EVENT_ADDED "DB/Event/Added"
+
+/* DB/Event/FilterAdd (NOTE: Added during 0.3.3+ development!)
+Called **before** a new event is made of a DBEVENTINFO structure, this
+hook is not SAFE unless you know what you're doing with it, the arguments
+are passed as-is (with errors, pointer problems, if any) from any arguments
+passed to MS_DB_EVENT_ADD.
+
+The point of this hook is to stop any unwanted database events, to stop
+an event being added, return 1, to allow the event to pass through return
+0.
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)&DBEVENTINFO
+
+Any changed made to the said DBEVENTINFO are also passed along to the database,
+therefore it is possible to shape the data, however DO NOT DO THIS.
+*/
+#define ME_DB_EVENT_FILTER_ADD "DB/Event/FilterAdd"
+
+/* DB/Event/Deleted event
+Called when an event is about to be deleted from the event chain for a contact
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(HANDLE)hDbEvent
+hDbEvent is a valid handle to the event which is about to be deleted, but it
+won't be once your hook has returned.
+hContact is a valid handle to the contact to which hDbEvent refers, and will
+remain valid.
+Returning nonzero from your hook will not stop the deletion, but it will, as
+usual, stop other hooks from being called.
+*/
+#define ME_DB_EVENT_DELETED "DB/Event/Deleted"
+
+/* DB/Contact/Added event
+Called when a new contact has been added to the database
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+hContact is a valid handle to the new contact.
+Contacts are initially created without any settings, so if you hook this event
+you will almost certainly also want to hook db/contact/settingchanged as well.
+*/
+#define ME_DB_CONTACT_ADDED "DB/Contact/Added"
+
+/* DB/Contact/Deleted event
+Called when an contact is about to be deleted
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=0
+hContact is a valid handle to the contact which is about to be deleted, but it
+won't be once your hook has returned.
+Returning nonzero from your hook will not stop the deletion, but it will, as
+usual, stop other hooks from being called.
+Deleting a contact invalidates all events in its chain.
+*/
+#define ME_DB_CONTACT_DELETED "DB/Contact/Deleted"
+
+/* DB/Contact/SettingChanged event
+Called when a contact has had one of its settings changed
+ wParam=(WPARAM)(HANDLE)hContact
+ lParam=(LPARAM)(DBCONTACTWRITESETTING*)&dbcws
+hContact is a valid handle to the contact that has changed.
+This event will be triggered many times rapidly when a whole bunch of values
+are set.
+Modules which hook this should be aware of this fact and quickly return if they
+are not interested in the value that has been changed.
+Careful not to get into infinite loops with this event.
+The structure dbcws is the same one as is passed to the original service, so
+don't change any of the members.
+*/
+#define ME_DB_CONTACT_SETTINGCHANGED "DB/Contact/SettingChanged"
+
+/* DB/Contact/SetSettingResident service (0.6+)
+Disables a setting saving to the database.
+ wParam=(WPARAM)(BOOL)bIsResident
+ lParam=(LPARAM)(char*)pszSettingName
+*/
+#define MS_DB_SETSETTINGRESIDENT "DB/SetSettingResident"
+
+/******************************************************************/
+/********************* SETTINGS HELPER FUNCTIONS ******************/
+/******************************************************************/
+
+#ifndef DB_NOHELPERFUNCTIONS
+
+/* hate typing the fucking jinormous names of the db "helper" functions, ffs. */
+
+#define db_byte_get(a,b,c,d) DBGetContactSettingByte(a,b,c,d)
+#define db_word_get(a,b,c,d) DBGetContactSettingWord(a,b,c,d)
+#define db_dword_get(a,b,c,d) DBGetContactSettingDword(a,b,c,d)
+#define db_get(a,b,c,d) DBGetContactSetting(a,b,c,d)
+
+#define db_byte_set(a,b,c,d) DBWriteContactSettingByte(a,b,c,d);
+#define db_word_set(a,b,c,d) DBWriteContactSettingWord(a,b,c,d);
+#define db_dword_set(a,b,c,d) DBWriteContactSettingDword(a,b,c,d);
+#define db_string_set(a,b,c,d) DBWriteContactSettingString(a,b,c,d);
+
+#define db_unset(a,b,c) DBDeleteContactSetting(a,b,c);
+
+#define DBGetContactSettingByte(a,b,c,d) DBGetContactSettingByte_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingWord(a,b,c,d) DBGetContactSettingWord_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingDword(a,b,c,d) DBGetContactSettingDword_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSetting(a,b,c,d) DBGetContactSetting_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingW(a,b,c,d) DBGetContactSettingW_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingTString(a,b,c,d) DBGetContactSettingTString_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingWString(a,b,c,d) DBGetContactSettingWString_Helper(a,b,c,d,__FILE__,__LINE__)
+#define DBGetContactSettingStringUtf(a,b,c,d) DBGetContactSettingStringUtf_Helper(a,b,c,d,__FILE__,__LINE__)
+
+#define db_msg_dbg(s) MessageBoxA(0,(s),"",0);
+
+#ifdef _DEBUG
+#include <stdio.h>
+#endif
+
+__inline static int DBGetContactSettingByte_Helper(HANDLE hContact, const char *szModule,
+ const char *szSetting, int errorValue, const char *szFile, const int nLine)
+{
+ DBVARIANT dbv;
+ DBCONTACTGETSETTING cgs;
+
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=&dbv;
+ if(CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs))
+ return errorValue;
+#ifdef _DEBUG
+ if(dbv.type!=DBVT_BYTE) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d for %s/%s not a byte, return: %d",szFile,nLine,szModule,szSetting,dbv.type);
+ db_msg_dbg(buf);
+ }
+#endif
+ return dbv.bVal;
+}
+
+__inline static int DBGetContactSettingWord_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,int errorValue,const char *szFile, const int nLine)
+{
+ DBVARIANT dbv;
+ DBCONTACTGETSETTING cgs;
+
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=&dbv;
+ if(CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs))
+ return errorValue;
+#ifdef _DEBUG
+ if(dbv.type!=DBVT_WORD) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d for %s/%s not a word, return: %d",szFile,nLine,szModule,szSetting,dbv.type);
+ db_msg_dbg(buf);
+ }
+#endif
+ return dbv.wVal;
+}
+
+__inline static DWORD DBGetContactSettingDword_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DWORD errorValue, const char *szFile, const int nLine)
+{
+ DBVARIANT dbv;
+ DBCONTACTGETSETTING cgs;
+
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=&dbv;
+ if(CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs))
+ return errorValue;
+#ifdef _DEBUG
+ if(dbv.type!=DBVT_DWORD) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d for %s/%s not a dword, return: %d",szFile,nLine,szModule,szSetting,dbv.type);
+ db_msg_dbg(buf);
+ }
+#endif
+ return dbv.dVal;
+}
+
+__inline static int DBGetContactSettingW_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
+{
+ int rc;
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=dbv;
+ dbv->type = 0;
+
+ rc=CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&cgs);
+#if defined(_DEBUG) && defined(DBCHECKSETTINGS)
+ if (rc != 0) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d failed to fetch %s/%s",szFile,nLine,szModule,szSetting);
+ db_msg_dbg(buf);
+ }
+#endif
+ return rc;
+}
+
+__inline static int DBGetContactSettingTString_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
+{
+ int rc;
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=dbv;
+#if defined(_UNICODE)
+ dbv->type = DBVT_WCHAR;
+#else
+ dbv->type = DBVT_ASCIIZ;
+#endif
+
+ rc=CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&cgs);
+#if defined(_DEBUG) && defined(DBCHECKSETTINGS)
+ if (rc != 0) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d failed to fetch %s/%s",szFile,nLine,szModule,szSetting);
+ db_msg_dbg(buf);
+ }
+#endif
+ return rc;
+}
+
+__inline static int DBGetContactSettingWString_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
+{
+ int rc;
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=dbv;
+ dbv->type = DBVT_WCHAR;
+
+ rc=CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&cgs);
+#if defined(_DEBUG) && defined(DBCHECKSETTINGS)
+ if (rc != 0) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d failed to fetch %s/%s",szFile,nLine,szModule,szSetting);
+ db_msg_dbg(buf);
+ }
+#endif
+ return rc;
+}
+
+__inline static int DBGetContactSettingStringUtf_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
+{
+ int rc;
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=dbv;
+ dbv->type = DBVT_UTF8;
+
+ rc=CallService(MS_DB_CONTACT_GETSETTING_STR,(WPARAM)hContact,(LPARAM)&cgs);
+#if defined(_DEBUG) && defined(DBCHECKSETTINGS)
+ if (rc != 0) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d failed to fetch %s/%s",szFile,nLine,szModule,szSetting);
+ db_msg_dbg(buf);
+ }
+#endif
+ return rc;
+}
+
+__inline static int DBGetContactSetting_Helper(HANDLE hContact,const char *szModule,
+ const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
+{
+ int rc;
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ cgs.pValue=dbv;
+ rc=CallService(MS_DB_CONTACT_GETSETTING,(WPARAM)hContact,(LPARAM)&cgs);
+#if defined(_DEBUG) && defined(DBCHECKSETTINGS)
+ if (rc != 0) {
+ char buf[128];
+ _snprintf(buf,sizeof(buf),"%s:%d failed to fetch %s/%s",szFile,nLine,szModule,szSetting);
+ db_msg_dbg(buf);
+ }
+#endif
+ return rc;
+}
+
+__inline static int DBFreeVariant(DBVARIANT *dbv)
+{
+ return CallService(MS_DB_CONTACT_FREEVARIANT,0,(LPARAM)dbv);
+}
+
+__inline static int DBDeleteContactSetting(HANDLE hContact,const char *szModule,const char *szSetting)
+{
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule=szModule;
+ cgs.szSetting=szSetting;
+ return CallService(MS_DB_CONTACT_DELETESETTING,(WPARAM)hContact,(LPARAM)&cgs);
+}
+
+__inline static int DBWriteContactSettingByte(HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_BYTE;
+ cws.value.bVal=val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingWord(HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_WORD;
+ cws.value.wVal=val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingDword(HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_DWORD;
+ cws.value.dVal=val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingString(HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_ASCIIZ;
+ cws.value.pszVal=(char*)val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingTString(HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ #if defined( _UNICODE )
+ cws.value.type=DBVT_WCHAR;
+ cws.value.pwszVal=(WCHAR*)val;
+ #else
+ cws.value.type=DBVT_ASCIIZ;
+ cws.value.pszVal=(char*)val;
+ #endif
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingWString(HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_WCHAR;
+ cws.value.pwszVal=(WCHAR*)val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+__inline static int DBWriteContactSettingStringUtf(HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
+{
+ DBCONTACTWRITESETTING cws;
+
+ cws.szModule=szModule;
+ cws.szSetting=szSetting;
+ cws.value.type=DBVT_UTF8;
+ cws.value.pszVal=(char*)val;
+ return CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
+}
+
+/* inlined range tolerate versions */
+
+__inline static BYTE DBGetContactSettingRangedByte(HANDLE hContact, const char *szModule, const char *szSetting, BYTE errorValue, BYTE minValue, BYTE maxValue) {
+ BYTE bVal = DBGetContactSettingByte(hContact, szModule, szSetting, errorValue);
+
+ if (bVal < minValue || bVal > maxValue) {
+#ifdef _DEBUG
+ char szBuf[MAX_PATH];
+ wsprintfA(szBuf, "(%s:%s) not in range of %d..%d", szModule,szSetting,minValue,maxValue);
+ MessageBoxA(0,szBuf,"DBGetContactSettingRangedByte failed",MB_ICONERROR);
+#endif
+ return errorValue;
+ }
+ else
+ return bVal;
+}
+
+__inline static WORD DBGetContactSettingRangedWord(HANDLE hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue) {
+ WORD wVal = DBGetContactSettingWord(hContact, szModule, szSetting, errorValue);
+
+ if (wVal < minValue || wVal > maxValue) {
+#ifdef _DEBUG
+ char szBuf[MAX_PATH];
+ wsprintfA(szBuf, "(%s:%s) not in range of %d..%d", szModule,szSetting,minValue,maxValue);
+ MessageBoxA(0,szBuf,"DBGetContactSettingRangedWord failed",MB_ICONERROR);
+#endif
+ return errorValue;
+ }
+ else
+ return wVal;
+}
+
+__inline static DWORD DBGetContactSettingRangedDword(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue, DWORD minValue, DWORD maxValue) {
+ DWORD dVal = DBGetContactSettingDword(hContact, szModule, szSetting, errorValue);
+
+ if (dVal < minValue || dVal > maxValue) {
+#ifdef _DEBUG
+ char szBuf[MAX_PATH];
+ wsprintfA(szBuf, "(%s:%s) not in range of %d..%d", szModule,szSetting,minValue,maxValue);
+ MessageBoxA(0,szBuf,"DBGetContactSettingRangedDword failed",MB_ICONERROR);
+#endif
+ return errorValue;
+ }
+ else
+ return dVal;
+}
+
+#endif
+
+#endif // M_DATABASE_H__
diff --git a/miranda-wine/include/m_email.h b/miranda-wine/include/m_email.h new file mode 100644 index 0000000..93f515b --- /dev/null +++ b/miranda-wine/include/m_email.h @@ -0,0 +1,36 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_EMAIL_H__
+#define M_EMAIL_H__ 1
+
+//send an e-mail to the specified contact v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success or nonzero on failure
+//if an error occurs the service will display a message box with the error
+//text, so this service should not be used if you do not want this behaviour.
+#define MS_EMAIL_SENDEMAIL "SREMail/SendCommand"
+
+#endif // M_EMAIL_H__
+
diff --git a/miranda-wine/include/m_file.h b/miranda-wine/include/m_file.h new file mode 100644 index 0000000..e0d6136 --- /dev/null +++ b/miranda-wine/include/m_file.h @@ -0,0 +1,62 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_FILE_H__
+#define M_FILE_H__ 1
+
+//brings up the send file dialog for a contact
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success or nonzero on failure
+//returns immediately, without waiting for the send
+#define MS_FILE_SENDFILE "SRFile/SendCommand"
+
+//brings up the send file dialog with the specified files already chosen
+//v0.1.2.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(const char**)ppFiles
+//returns 0 on success or nonzero on failure
+//returns immediately, without waiting for the send
+//the user is not prevented from changing the filename with the 'choose again'
+//button
+//ppFiles is a NULL-terminated array of fully qualified filenames.
+//To send subdirectories, include their name in the list without a trailing
+//backslash. In order to keep contained files in their correct place on
+//receiving, the subdirectory they're in must preceed the file. This applies
+//to subdirectories themselves too: they must be preceeded by their container
+//if you want to send the container and keep the original directory inside it.
+#define MS_FILE_SENDSPECIFICFILES "SRFile/SendSpecificFiles"
+
+//get the received files folder v0.1.2.2+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(char *)pszOutput
+//returns 0 on success or nonzero on failure
+//pszOutput must be at least MAX_PATH characters long
+//If hContact is NULL this function will retrieve the received files folder
+//name without any appended user names.
+//Note that the directory name returned by this function does not necessarily
+//exist.
+#define MS_FILE_GETRECEIVEDFILESFOLDER "SRFile/GetReceivedFilesFolder"
+
+#endif // M_FILE_H__
+
diff --git a/miranda-wine/include/m_findadd.h b/miranda-wine/include/m_findadd.h new file mode 100644 index 0000000..9cc61c2 --- /dev/null +++ b/miranda-wine/include/m_findadd.h @@ -0,0 +1,35 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_FINDADD_H__
+#define M_FINDADD_H__ 1
+
+/* Opens the find/add users dialog box, or gives it the focus if it's already
+open.
+wParam=lParam=0
+returns 0 always
+*/
+#define MS_FINDADD_FINDADD "FindAdd/FindAddCommand"
+
+#endif // M_FINDADD_H__
+
diff --git a/miranda-wine/include/m_fuse.h b/miranda-wine/include/m_fuse.h new file mode 100644 index 0000000..71ac3fe --- /dev/null +++ b/miranda-wine/include/m_fuse.h @@ -0,0 +1,32 @@ +#ifdef _ALPHA_FUSE_
+#ifndef _M_FUSE_
+#define _M_FUSE_
+
+#define CALLSERVICE_NOTFOUND ((int)0x80000000)
+#define MAXMODULELABELLENGTH 64
+typedef int (*MIRANDAHOOK)(WPARAM,LPARAM);
+typedef int (*MIRANDASERVICE)(WPARAM,LPARAM);
+
+#define FUSE_INIT 0 // core started, Param=**FUSE_LINK
+#define FUSE_DEINIT 1 // core stopped
+#define FUSE_DEFMOD 3 // LoadDefaultModules() return code, Param=*int
+#define FUSE_DEATH 4 // DestroyingModularEngine() just got called
+
+typedef struct {
+ int cbSize;
+ HANDLE (*CreateHookableEvent)(const char *);
+ int (*DestroyHookableEvent)(HANDLE);
+ int (*NotifyEventHooks)(HANDLE,WPARAM,LPARAM);
+ HANDLE (*HookEvent)(const char *,MIRANDAHOOK);
+ HANDLE (*HookEventMessage)(const char *,HWND,UINT);
+ int (*UnhookEvent)(HANDLE);
+ HANDLE (*CreateServiceFunction)(const char *,MIRANDASERVICE);
+ HANDLE (*CreateTransientServiceFunction)(const char *,MIRANDASERVICE);
+ int (*DestroyServiceFunction)(HANDLE);
+ int (*CallService)(const char *,WPARAM,LPARAM);
+ int (*ServiceExists)(const char *); //v0.1.0.1+
+ int (*CallServiceSync)(const char*,WPARAM,LPARAM); //v0.1.2.2+
+} FUSE_LINK;
+
+#endif
+#endif
\ No newline at end of file diff --git a/miranda-wine/include/m_history.h b/miranda-wine/include/m_history.h new file mode 100644 index 0000000..3061b45 --- /dev/null +++ b/miranda-wine/include/m_history.h @@ -0,0 +1,34 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_HISTORY_H__
+#define M_HISTORY_H__ 1
+
+//show the History dialog box for a contact
+// wParam=(WPARAM)(HANDLE)hContact
+// lParam=0
+//hContact can be NULL to show system messages
+#define MS_HISTORY_SHOWCONTACTHISTORY "History/ShowContactHistory"
+
+#endif // M_HISTORY_H__
+
diff --git a/miranda-wine/include/m_icq.h b/miranda-wine/include/m_icq.h new file mode 100644 index 0000000..d43c445 --- /dev/null +++ b/miranda-wine/include/m_icq.h @@ -0,0 +1,298 @@ +// ---------------------------------------------------------------------------80
+// ICQ plugin for Miranda Instant Messenger
+// ________________________________________
+//
+// Copyright © 2000,2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede
+// Copyright © 2001,2002 Jon Keating, Richard Hughes
+// Copyright © 2002,2003,2004 Martin berg, Sam Kothari, Robert Rainwater
+// Copyright © 2004,2005,2006 Joe Kucera
+//
+// 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.
+//
+// -----------------------------------------------------------------------------
+//
+// File name : $Source: /cvsroot/miranda/miranda/protocols/IcqOscarJ/m_icq.h,v $
+// Revision : $Revision: 3485 $
+// Last change on : $Date: 2006-08-13 20:00:08 +0400 (Ð’Ñк, 13 Ðвг 2006) $
+// Last change by : $Author: jokusoftware $
+//
+// DESCRIPTION:
+//
+// Describe me here please...
+//
+// -----------------------------------------------------------------------------
+
+#ifndef M_ICQ_H__
+#define M_ICQ_H__ 1
+
+
+// Note: In v0.3 the part before "/Servicename" is dynamic. It will be the name of the protocol.
+// Example: If the plugin was loaded from ICQ.dll, the service name is "ICQ/Servicename", and if
+// the dll was Icq2.dll, the service name will be "Icq2/Servicename". This behaviour is temporary
+// until proper multiaccounts are implemented.
+
+
+//start a search of all ICQ users by e-mail
+//wParam=0
+//lParam=(LPARAM)(const char*)email
+//returns a handle to the search on success, NULL on failure
+//Results are returned using the same scheme documented in PSS_BASICSEARCH
+//**DEPRECATED** in favour of PS_SEARCHBYEMAIL
+typedef struct { //extended search result structure, used for all searches
+ PROTOSEARCHRESULT hdr;
+ DWORD uin;
+ BYTE auth;
+ char* uid;
+} ICQSEARCHRESULT;
+#define MS_ICQ_SEARCHBYEMAIL "/SearchByEmail"
+
+//start a search of all ICQ users by details
+//wParam=0
+//lParam=(LPARAM)(ICQDETAILSSEARCH*)&ids
+//returns a handle to the search on success, NULL on failure
+//Results are returned using the same scheme documented in PSS_BASICSEARCH
+//**DEPRECATED** in favour of PS_SEARCHBYNAME
+typedef struct {
+ char *nick;
+ char *firstName;
+ char *lastName;
+} ICQDETAILSSEARCH;
+#define MS_ICQ_SEARCHBYDETAILS "/SearchByDetails"
+
+// Request authorization
+// wParam=(WPARAM)hContact
+#define MS_REQ_AUTH "/ReqAuth"
+
+// Grant authorization
+// wParam=(WPARAM)hContact;
+#define MS_GRANT_AUTH "/GrantAuth"
+
+// Revoke authorization
+// wParam=(WPARAM)hContact
+#define MS_REVOKE_AUTH "/RevokeAuth"
+
+// Display XStatus detail (internal use only)
+// wParam=(WPARAM)hContact;
+#define MS_XSTATUS_SHOWDETAILS "/ShowXStatusDetails"
+
+//Send an SMS via the ICQ network
+//wParam=(WPARAM)(const char*)szPhoneNumber
+//lParam=(LPARAM)(const char*)szMessage
+//Returns a HANDLE to the send on success, or NULL on failure
+//szPhoneNumber should be the full number with international code and preceeded
+//by a +
+
+//When the server acks the send, an ack will be broadcast:
+// type=ICQACKTYPE_SMS, result=ACKRESULT_SENTREQUEST, lParam=(LPARAM)(char*)szInfo
+//At this point the message is queued to be delivered. szInfo contains the raw
+//XML data of the ack. Here's what I got when I tried:
+//"<sms_response><source>airbornww.com</source><deliverable>Yes</deliverable><network>BT Cellnet, United Kingdom</network><message_id>[my uin]-1-1955988055-[destination phone#, without +]</message_id><messages_left>0</messages_left></sms_response>\r\n"
+
+//Now the hProcess has been deleted. The only way to track which receipt
+//corresponds with which response is to parse the <message_id> field.
+
+//At a (possibly much) later time the SMS will have been delivered. An ack will
+//be broadcast:
+// type=ICQACKTYPE_SMS, result=ACKRESULT_SUCCESS, hProcess=NULL, lParam=(LPARAM)(char*)szInfo
+//Note that the result will always be success even if the send failed, just to
+//save needing to have an attempt at an XML parser in the ICQ module.
+//Here's the szInfo for a success:
+//"<sms_delivery_receipt><message_id>[my uin]-1--1461632229-[dest phone#, without +]</message_id><destination>[dest phone#, without +]</destination><delivered>Yes</delivered><text>[first 20 bytes of message]</text><submition_time>Tue, 30 Oct 2001 22:35:16 GMT</submition_time><delivery_time>Tue, 30 Oct 2001 22:34:00 GMT</delivery_time></sms_delivery_receipt>"
+//And here's a failure:
+//"<sms_delivery_receipt><message_id>[my uin]-1-1955988055-[destination phone#, without leading +]</message_id><destination>[destination phone#, without leading +]</destination><delivered>No</delivered><submition_time>Tue, 23 Oct 2001 23:17:02 GMT</submition_time><error_code>999999</error_code><error><id>15</id><params><param>0</param><param>Multiple message submittion failed</param></params></error></sms_delivery_receipt>"
+
+//SMSes received from phones come through this same ack, again to avoid having
+//an XML parser in the protocol module. Here's one I got:
+//"<sms_message><source>MTN</source><destination_UIN>[UIN of recipient, ie this account]</destination_UIN><sender>[sending phone number, without +]</sender><senders_network>[contains one space, because I sent from ICQ]</senders_network><text>[body of the message]</text><time>Fri, 16 Nov 2001 03:12:33 GMT</time></sms_message>"
+#define ICQACKTYPE_SMS 1001
+#define ICQEVENTTYPE_SMS 2001 //database event type
+#define MS_ICQ_SENDSMS "/SendSMS"
+
+//e-mail express
+//db event added to NULL contact
+//blob format is:
+//ASCIIZ text, usually of the form "Subject: %s\r\n%s"
+//ASCIIZ from name
+//ASCIIZ from e-mail
+#define ICQEVENTTYPE_EMAILEXPRESS 2002 //database event type
+
+//www pager
+//db event added to NULL contact
+//blob format is:
+//ASCIIZ text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
+//ASCIIZ from name
+//ASCIIZ from e-mail
+#define ICQEVENTTYPE_WEBPAGER 2003 //database event type
+
+//for server-side lists, used internally only
+//hProcess=dwSequence
+//lParam=server's error code, 0 for success
+#define ICQACKTYPE_SERVERCLIST 1003
+
+//for rate warning distribution (mainly upload dlg)
+//hProcess=Rate class ID
+//lParam=server's status code
+#define ICQACKTYPE_RATEWARNING 1004
+
+//received Xtraz Notify response
+//hProcess=dwSequence
+//lParam=contents of RES node
+#define ICQACKTYPE_XTRAZNOTIFY_RESPONSE 1005
+
+//received Custom Status details response
+//hProcess=dwSequence
+//lParam=0
+#define ICQACKTYPE_XSTATUS_RESPONSE 1006
+
+
+//Update user details on server
+//Permited operation types:
+#define CIXT_BASIC 0x0001
+#define CIXT_MORE 0x0002
+#define CIXT_WORK 0x0004
+#define CIXT_CONTACT 0x0008
+#define CIXT_LOCATION 0x0010
+#define CIXT_BACKGROUND 0x0020
+#define CIXT_FULL 0x003F
+//wParam=operationType
+#define PS_CHANGEINFOEX "/ChangeInfoEx"
+
+//Change nickname in White pages
+//lParam=(LPARAM)(const char*)szNewNickName
+#define PS_SET_NICKNAME "/SetNickname"
+
+//Set password for current session
+//lParam=(LPARAM)(const char*)szPassword
+#define PS_ICQ_SETPASSWORD "/SetPassword"
+
+//miranda/icqoscar/statusmsgreq event
+//called when our status message is requested
+//wParam=(BYTE)msgType
+//lParam=(DWORD)uin
+//msgType is one of the ICQ_MSGTYPE_GET###MSG constants in icq_constants.h
+//uin is the UIN of the contact requesting our status message
+#define ME_ICQ_STATUSMSGREQ "/StatusMsgReq"
+
+
+//set owner avatar
+//wParam=0
+//lParam=(const char *)Avatar file name
+//return=0 for success
+#define PS_ICQ_SETMYAVATAR "/SetMyAvatar"
+
+//get current owner avatar
+//wParam=(char *)Buffer to file name
+//lParam=(int)Buffer size
+//return=0 for success
+#define PS_ICQ_GETMYAVATAR "/GetMyAvatar"
+
+//get size limit for avatar image
+//wParam=(int *)max width of avatar - will be set
+//lParam=(int *)max height of avatar - will be set
+//return=0 for success
+#define PS_ICQ_GETMYAVATARMAXSIZE "/GetMyAvatarMaxSize"
+
+//check if image format supported for avatars
+//wParam = 0
+//lParam = PA_FORMAT_* // avatar format
+//return = 1 (supported) or 0 (not supported)
+#define PS_ICQ_ISAVATARFORMATSUPPORTED "/IsAvatarFormatSupported"
+
+
+/* Custom Status helper API *
+ - to set custom status message & title use PS_ICQ_GETCUSTOMSTATUS to obtain
+ DB settings and write values to them (UTF-8 strings best). (obsolete)
+ - use PS_ICQ_GETCUSTOMSTATUSEX and PS_ICQ_SETCUSTOMSTATUSEX for controling Custom Status
+ - custom messages for each user supported - ME_ICQ_STATUSMSGREQ with type MTYPE_SCRIPT_NOTIFY
+ */
+#define CSSF_MASK_STATUS 0x0001 // status member valid for set/get
+#define CSSF_MASK_NAME 0x0002 // pszName member valid for set/get
+#define CSSF_MASK_MESSAGE 0x0004 // pszMessage member valid for set/get
+#define CSSF_DISABLE_UI 0x0040 // disable default custom status UI, wParam = bEnable
+#define CSSF_DEFAULT_NAME 0x0080 // only with CSSF_MASK_NAME and get API to get default custom status name (wParam = status)
+#define CSSF_STATUSES_COUNT 0x0100 // returns number of custom statuses in wParam, only get API
+#define CSSF_STR_SIZES 0x0200 // returns sizes of custom status name & message (wParam & lParam members) in chars
+#define CSSF_UNICODE 0x1000 // strings are in UCS-2
+
+#if defined(_UNICODE)
+ #define CSSF_TCHAR CSSF_UNICODE
+#else
+ #define CSSF_TCHAR 0
+#endif
+
+
+typedef struct {
+ int cbSize; // size of the structure
+ int flags; // combination of CSSF_*
+ int *status; // custom status id
+ union {
+ char *pszName; // buffer for custom status name
+ TCHAR *ptszName;
+ WCHAR *pwszName;
+ };
+ union {
+ char *pszMessage; // buffer for custom status message
+ TCHAR *ptszMessage;
+ WCHAR *pwszMessage;
+ };
+ WPARAM *wParam; // extra params, see flags
+ LPARAM *lParam;
+} ICQ_CUSTOM_STATUS;
+
+
+// Sets owner current custom status (obsolete)
+//wParam = (int)N // custom status id (1-32)
+//lParam = 0
+//return = N (id of status set) or 0 (failed - probably bad params)
+#define PS_ICQ_SETCUSTOMSTATUS "/SetXStatus"
+
+// Sets owner current custom status
+//wParam = 0 // reserved
+//lParam = (ICQ_CUSTOM_STATUS*)pData // contains what to set and new values
+//return = 0 (for success)
+#define PS_ICQ_SETCUSTOMSTATUSEX "/SetXStatusEx"
+
+// Retrieves custom status details for specified hContact
+//wParam = (HANDLE)hContact
+//lParam = (ICQ_CUSTOM_STATUS*)pData // receives details (members must be prepared)
+//return = 0 (for success)
+#define PS_ICQ_GETCUSTOMSTATUSEX "/GetXStatusEx"
+
+// Retrieves specified custom status icon
+//wParam = (int)N // custom status id (1-32), 0 = my current custom status
+//lParam = 0
+//return = HICON // custom status icon (use DestroyIcon to release resources)
+#define PS_ICQ_GETCUSTOMSTATUSICON "/GetXStatusIcon"
+
+// Get Custom status DB field names & current owner custom status (obsolete)
+//wParam = (char**)szDBTitle // will receive title DB setting name (do not free)
+//lParam = (char**)szDBMsg // will receive message DB setting name
+//return = N // current custom status id if successful, 0 otherwise
+#define PS_ICQ_GETCUSTOMSTATUS "/GetXStatus"
+
+// Request Custom status details (messages) for specified contact
+//wParam = hContact // request custom status details for this contact
+//lParam = 0
+//return = (int)dwSequence // if successful it is sequence for ICQACKTYPE_XSTATUS_RESPONSE
+ // 0 failed to request (e.g. auto-request enabled)
+ // -1 delayed (rate control) - sequence unknown
+#define PS_ICQ_REQUESTCUSTOMSTATUS "/RequestXStatusDetails"
+
+// Called when contact changes custom status and extra icon is set to clist_mw
+//wParam = hContact // contact changing status
+//lParam = hIcon // HANDLE to clist extra icon set as custom status
+#define ME_ICQ_CUSTOMSTATUS_EXTRAICON_CHANGED "/XStatusExtraIconChanged"
+
+#endif // M_ICQ_H__
diff --git a/miranda-wine/include/m_idle.h b/miranda-wine/include/m_idle.h new file mode 100644 index 0000000..390cb6c --- /dev/null +++ b/miranda-wine/include/m_idle.h @@ -0,0 +1,72 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2005 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_IDLE_H__
+#define M_IDLE_H__ 1
+
+/* The idle module checks how long the user has been idle, it can be at the Miranda level
+or the OS level - the user has optional two settings, one for "short" idle and another
+for "long" idle. Thie module will generate long/short events based on these user preferences
+and other information too. If you are unsure which idle mode to report for, report it
+for short idle.*/
+
+#define IDF_ISIDLE 0x1 // idle has become active (if not set, inactive)
+#define IDF_PRIVACY 0x8 // if set, the information provided shouldn't be given to third parties.
+
+/*
+ wParam: 0
+ lParam: IDF_* (or'd field)
+ Affect: This event is fired when information about idle changes.
+ Note: You will get multiple calls with IDF_ISIDLE set, the first is for short idle
+ then long idle, then anytime during you might get IDF_ONFORCE if the screensaver or station
+ become locked.
+
+ It is up to you to keep state, i.e. once the idle that you care about is reported
+ ignore other status notifications with IDF_ISIDLE set until you get one with IDF_ISIDLE isn't
+ set.
+ Version: 0.3.4a+ (2004/09/16)
+*/
+#define ME_IDLE_CHANGED "Miranda/Idle/Changed"
+
+
+typedef struct {
+ int cbSize; // sizeof()
+ unsigned int idleTime; // idle in mins, if zero then disabled
+ int privacy; // user doesnt want other people seeing anything more than they are idle
+ int aaStatus; // status to go to when user is auto away
+ int aaLock; // the status shouldn't be unset if its set
+} MIRANDA_IDLE_INFO;
+
+/*
+ wParam; 0
+ lParam: &MIRANDA_IDLE_INFO
+ Affect: Return information about current idle settings, like short/long idle time in mins
+ and if the user wants that info kept private, etc
+ Returns: zero on success, non zero on failure
+ Version: 0.3.4 (2004/09/16)
+*/
+
+#define MS_IDLE_GETIDLEINFO "Miranda/Idle/GetInfo"
+
+#endif // M_IDLE_H__
+
diff --git a/miranda-wine/include/m_ignore.h b/miranda-wine/include/m_ignore.h new file mode 100644 index 0000000..b300c6c --- /dev/null +++ b/miranda-wine/include/m_ignore.h @@ -0,0 +1,63 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_IGNORE_H__
+#define M_IGNORE_H__ 1
+
+//this module provides UI and storage for blocking only, protocol modules are
+//responsible for implementing the block
+
+#define IGNOREEVENT_ALL (LPARAM)(-1)
+#define IGNOREEVENT_MESSAGE 1
+#define IGNOREEVENT_URL 2
+#define IGNOREEVENT_FILE 3
+#define IGNOREEVENT_USERONLINE 4
+#define IGNOREEVENT_AUTHORIZATION 5
+#define IGNOREEVENT_YOUWEREADDED 6 // 0.3.3a+
+
+//determines if a message type to a contact should be ignored v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=message type, an ignoreevent_ constant
+//returns 0 if the message should be shown, or nonzero if it should be ignored
+//Use hContact=NULL to retrieve the setting for unknown contacts (not on the
+//contact list, as either permanent or temporary).
+//don't use ignoreevent_all when calling this service
+#define MS_IGNORE_ISIGNORED "Ignore/IsIgnored"
+
+//ignore future messages from a contact v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=message type, an ignoreevent_ constant
+//returns 0 on success or nonzero on failure
+//Use hContact=NULL to retrieve the setting for unknown contacts
+#define MS_IGNORE_IGNORE "Ignore/Ignore"
+
+//receive future messages from a contact v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=message type, an ignoreevent_ constant
+//returns 0 on success or nonzero on failure
+//Use hContact=NULL to retrieve the setting for unknown contacts
+#define MS_IGNORE_UNIGNORE "Ignore/Unignore"
+
+
+#endif // M_IGNORE_H__
+
diff --git a/miranda-wine/include/m_langpack.h b/miranda-wine/include/m_langpack.h new file mode 100644 index 0000000..ac36940 --- /dev/null +++ b/miranda-wine/include/m_langpack.h @@ -0,0 +1,101 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_LANGPACK_H__
+#define M_LANGPACK_H__
+
+#define LANG_UNICODE 0x1000
+
+//translates a single string into the user's local language v0.1.1.0+
+//wParam=0
+//lParam=(LPARAM)(const char*)szEnglish
+//returns a pointer to the localised string. If there is no known translation
+//it will return szEnglish. The return value does not need to be freed in any
+//way
+//Note that the Translate() macro as defined below will crash plugins that are
+//loaded into Miranda 0.1.0.1 and earlier. If anyone's actually using one of
+//these versions, I pity them.
+#define MS_LANGPACK_TRANSLATESTRING "LangPack/TranslateString"
+#define Translate(s) ((char*)CallService(MS_LANGPACK_TRANSLATESTRING,0,(LPARAM)(s)))
+#define TranslateW(s) ((WCHAR*)CallService(MS_LANGPACK_TRANSLATESTRING,LANG_UNICODE,(LPARAM)(s)))
+#if defined( _UNICODE )
+ #define TranslateT(s) TranslateW(_T(s))
+ #define TranslateTS(s) TranslateW(s)
+#else
+ #define TranslateT(s) Translate(s)
+ #define TranslateTS(s) Translate(s)
+#endif
+
+//translates a dialog into the user's local language v0.1.1.0+
+//wParam=0
+//lParam=(LPARAM)(LANGPACKTRANSLATEDIALOG*)&lptd
+//returns 0 on success, nonzero on failure
+//This service only knows about the following controls:
+//Window titles, STATIC, EDIT, Hyperlink, BUTTON
+typedef struct {
+ int cbSize;
+ DWORD flags;
+ HWND hwndDlg;
+ const int *ignoreControls; //zero-terminated list of control IDs *not* to
+ //translate
+} LANGPACKTRANSLATEDIALOG;
+#define LPTDF_NOIGNOREEDIT 1 //translate all edit controls. By default
+ //non-read-only edit controls are not translated
+#define LPTDF_NOTITLE 2 //do not translate the title of the dialog
+
+#define MS_LANGPACK_TRANSLATEDIALOG "LangPack/TranslateDialog"
+__inline static int TranslateDialogDefault(HWND hwndDlg)
+{
+ LANGPACKTRANSLATEDIALOG lptd;
+ lptd.cbSize=sizeof(lptd);
+ lptd.flags=0;
+ lptd.hwndDlg=hwndDlg;
+ lptd.ignoreControls=NULL;
+ return CallService(MS_LANGPACK_TRANSLATEDIALOG,0,(LPARAM)&lptd);
+}
+
+//translates a menu into the user's local language v0.1.1.0+
+//wParam=(WPARAM)(HMENU)hMenu
+//lParam=0
+//returns 0 on success, nonzero on failure
+#define MS_LANGPACK_TRANSLATEMENU "LangPack/TranslateMenu"
+
+//returns the codepage used in the language pack v0.4.3.0+
+//wParam=0
+//lParam=0
+//returns the codepage stated in the langpack, or CP_ACP if no langpack is present
+#define MS_LANGPACK_GETCODEPAGE "LangPack/GetCodePage"
+
+//returns the locale id associated with the language pack v0.4.3.0+
+//wParam=0
+//lParam=0
+//returns the Windows locale id stated in the langpack, or LOCALE_USER_DEFAULT if no langpack is present
+#define MS_LANGPACK_GETLOCALE "LangPack/GetLocale"
+
+//returns the strdup/wcsdup of lparam according to the langpack v0.4.3.0+
+//wParam=0
+//lParam=(LPARAM)(char*)source string
+//returns a string converted from char* to TCHAR* using the langpack codepage.
+//This string should be freed using mir_free() then
+#define MS_LANGPACK_PCHARTOTCHAR "LangPack/PcharToTchar"
+#endif // M_LANGPACK_H__
diff --git a/miranda-wine/include/m_message.h b/miranda-wine/include/m_message.h new file mode 100644 index 0000000..b5191b9 --- /dev/null +++ b/miranda-wine/include/m_message.h @@ -0,0 +1,100 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_MESSAGE_H__
+#define M_MESSAGE_H__ 1
+
+//brings up the send message dialog for a contact
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(char*)szText
+//returns 0 on success or nonzero on failure
+//returns immediately, just after the dialog is shown
+//szText is the text to put in the edit box of the window (but not send)
+//szText=NULL will not use any text
+//szText!=NULL is only supported on v0.1.2.0+
+//NB: Current versions of the convers plugin use the name
+//"SRMsg/LaunchMessageWindow" instead. For compatibility you should call
+//both names and the correct one will work.
+#define MS_MSG_SENDMESSAGE "SRMsg/SendCommand"
+
+#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
+//wparam=0
+//lparam=(WPARAM)(MessageWindowEventData*)hWindowEvent;
+//Event types
+#define MSG_WINDOW_EVT_OPENING 1 //window is about to be opened
+#define MSG_WINDOW_EVT_OPEN 2 //window has been opened
+#define MSG_WINDOW_EVT_CLOSING 3 //window is about to be closed
+#define MSG_WINDOW_EVT_CLOSE 4 //window has been closed
+#define MSG_WINDOW_EVT_CUSTOM 5 //custom event for message plugins to use (custom uFlags may be used)
+
+#define MSG_WINDOW_UFLAG_MSG_FROM 0x00000001
+#define MSG_WINDOW_UFLAG_MSG_TO 0x00000002
+#define MSG_WINDOW_UFLAG_MSG_BOTH 0x00000004
+
+typedef struct {
+ int cbSize;
+ HANDLE hContact;
+ HWND hwndWindow; // top level window for the contact
+ const char* szModule; // used to get plugin type (which means you could use local if needed)
+ unsigned int uType; // see event types above
+ unsigned int uFlags; // used to indicate message direction for all event types except custom
+ void *local; // used to store pointer to custom data
+} MessageWindowEventData;
+
+#define MS_MSG_GETWINDOWAPI "MessageAPI/WindowAPI"
+//wparam=0
+//lparam=0
+//Returns a dword with the current message api version
+//Current version is 0,0,0,3
+
+#define MS_MSG_GETWINDOWCLASS "MessageAPI/WindowClass"
+//wparam=(char*)szBuf
+//lparam=(int)cbSize size of buffer
+//Sets the window class name in wParam (ex. "SRMM" for srmm.dll)
+
+typedef struct {
+ int cbSize;
+ HANDLE hContact;
+ int uFlags; // see uflags above
+} MessageWindowInputData;
+
+#define MSG_WINDOW_STATE_EXISTS 0x00000001 // Window exists should always be true if hwndWindow exists
+#define MSG_WINDOW_STATE_VISIBLE 0x00000002
+#define MSG_WINDOW_STATE_FOCUS 0x00000004
+#define MSG_WINDOW_STATE_ICONIC 0x00000008
+
+typedef struct {
+ int cbSize;
+ HANDLE hContact;
+ int uFlags; // should be same as input data unless 0, then it will be the actual type
+ HWND hwndWindow; //top level window for the contact or NULL if no window exists
+ int uState; // see window states
+ void *local; // used to store pointer to custom data
+} MessageWindowData;
+
+#define MS_MSG_GETWINDOWDATA "MessageAPI/GetWindowData"
+//wparam=(MessageWindowInputData*)
+//lparam=(MessageWindowData*)
+//returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
+#endif // M_MESSAGE_H__
+
diff --git a/miranda-wine/include/m_netlib.h b/miranda-wine/include/m_netlib.h new file mode 100644 index 0000000..8ee4c92 --- /dev/null +++ b/miranda-wine/include/m_netlib.h @@ -0,0 +1,748 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_NETLIB_H__
+#define M_NETLIB_H__ 1
+
+#include "m_utils.h"
+
+//this module was created in 0.1.2.2
+//All error codes are returned via GetLastError() (or WSAGetLastError():
+//they're the same).
+//This module is thread-safe where it is sensible for it to be so. This
+//basically means that you can call anything from any thread, but don't try
+//to predict what will happen if you try to recv() on the same connection from
+//two different threads at the same time.
+//Note that because the vast majority of the routines in this module return
+//a pointer, I have decided to diverge from the rest of Miranda and go with
+//the convention that functions return false on failure and nonzero on success.
+
+struct NETLIBHTTPREQUEST_tag;
+typedef struct NETLIBHTTPREQUEST_tag NETLIBHTTPREQUEST;
+struct NETLIBOPENCONNECTION_tag;
+typedef struct NETLIBOPENCONNECTION_tag NETLIBOPENCONNECTION;
+
+//Initialises the netlib for a set of connections
+//wParam=0
+//lParam=(LPARAM)(NETLIBUSER*)&nu
+//Returns a HANDLE to be used for future netlib calls, NULL on failure
+//NOTE: Netlib is loaded after any plugins, so you need to wait until
+// ME_SYSTEM_MODULESLOADED before calling this function
+//Netlib settings are stored under the module szSettingsModule
+//All netlib settings being with "NL".
+//The default settings for registered users that don't have any settings stored
+//in the database are the same as those displayed by the <All connections> page
+//of the netlib options page.
+//See notes below this function for the behaviour of HTTP gateways
+//Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY, ERROR_DUP_NAME
+typedef int (*NETLIBHTTPGATEWAYINITPROC)(HANDLE hConn,NETLIBOPENCONNECTION *nloc,NETLIBHTTPREQUEST *nlhr);
+typedef int (*NETLIBHTTPGATEWAYBEGINPROC)(HANDLE hConn,NETLIBOPENCONNECTION *nloc);
+typedef int (*NETLIBHTTPGATEWAYWRAPSENDPROC)(HANDLE hConn,PBYTE buf,int len,int flags,MIRANDASERVICE pfnNetlibSend);
+typedef PBYTE (*NETLIBHTTPGATEWAYUNWRAPRECVPROC)(NETLIBHTTPREQUEST *nlhr,PBYTE buf,int len,int *outBufLen,void *(*NetlibRealloc)(void*,size_t));
+typedef struct {
+ int cbSize;
+ char *szSettingsModule; //used for db settings and log
+ char *szDescriptiveName; //used in options dialog, already translated
+ DWORD flags;
+ char *szHttpGatewayHello;
+ char *szHttpGatewayUserAgent; //can be NULL to send no user-agent, also used by HTTPS proxies
+ NETLIBHTTPGATEWAYINITPROC pfnHttpGatewayInit;
+ NETLIBHTTPGATEWAYBEGINPROC pfnHttpGatewayBegin; //can be NULL if no beginning required
+ NETLIBHTTPGATEWAYWRAPSENDPROC pfnHttpGatewayWrapSend; //can be NULL if no wrapping required
+ NETLIBHTTPGATEWAYUNWRAPRECVPROC pfnHttpGatewayUnwrapRecv; //can be NULL if no wrapping required
+ int minIncomingPorts; //only if NUF_INCOMING. Will be used for validation of user input.
+} NETLIBUSER;
+#define NUF_INCOMING 0x01 //binds incoming ports
+#define NUF_OUTGOING 0x02 //makes outgoing plain connections
+#define NUF_HTTPGATEWAY 0x04 //can use HTTP gateway for plain sockets. ???HttpGateway* are valid. Enables the HTTP proxy option in options.
+#define NUF_NOOPTIONS 0x08 //don't create an options page for this. szDescriptiveName is never used.
+#define NUF_HTTPCONNS 0x10 //at least some connections are made for HTTP communication. Enables the HTTP proxy option in options.
+#define NUF_NOHTTPSOPTION 0x20 //disable the HTTPS proxy option in options. Use this if all communication is HTTP.
+#define MS_NETLIB_REGISTERUSER "Netlib/RegisterUser"
+
+//Assign a Netlib user handle a set of dynamic HTTP headers to be used with all
+//
+//HTTP connections that enable the HTTP-use-sticky headers flag.
+//The headers persist until cleared with lParam=NULL.
+//
+//All memory should be allocated by the caller using malloc() from MS_SYSTEM_GET_MMI
+//Once it has passed to Netlib, Netlib is the owner of it, the caller should not refer to the memory
+//In any way after this point.
+//
+//wParam=(WPARAM)hNetLibUser
+//lParam=(LPARAM)(char*)szHeaders
+//
+//NOTE: The szHeaders parameter should be a NULL terminated string following the HTTP header syntax.
+//This string will be injected verbatim, thus the user should be aware of setting strings that are not
+//headers. This service is NOT THREAD SAFE, only a single thread is expected to set the headers and a single
+//thread reading the pointer internally, stopping race conditions and mutual exclusion don't happen.
+//
+//Version 0.3.2a+ (2003/10/27)
+//
+#define MS_NETLIB_SETSTICKYHEADERS "Netlib/SetStickyHeaders"
+
+/* Notes on HTTP gateway usage
+When a connection is initiated through an HTTP proxy using
+MS_NETLIB_OPENCONNECTION, netlib will GET nlu.szHttpGatewayHello and read
+the replied headers. Once this succeeds nlu.pfnHttpGatewayInit will be called
+with a valid handle to the connection, the NETLIBOPENCONNECTION structure that
+MS_NETLIB_OPENCONNECTION was called with, and the replied HTTP headers as its
+parameters. This function is responsible for recving and parsing the data then
+calling MS_NETLIB_SETHTTPPROXYINFO with the appropriate information.
+nlu.pfnHttpGatewayInit should return nonzero on success. If it returns zero
+then the entire connection attempt will return signalling failure. If your
+function needs to return an error code it can do so via SetLastError().
+If nlu.pfnHttpGatewayInit returns success without having called
+MS_NETLIB_SETHTTPPROXYINFO then the connection attempt will fail anyway.
+If you need more fine-tuned control over the GET/POST URLs than just appending
+sequence numbers you can call MS_NETLIB_SETHTTPPROXYINFO from within your
+wrap/unwrap functions (see below).
+
+Just prior to MS_NETLIB_OPENCONNECTION returning nlu.pfnHttpGatewayBegin is
+called with the handle to the connection and the NETLIBOPENCONNECTION structure
+as its parameters. This is for gateways that need special non-protocol
+initialisation. If you do send any packets in this function, you probably want
+to remember to use the MSG_NOHTTPGATEWAYWRAP flag. This function pointer can be
+NULL if this functionality isn't needed. This function must return nonzero on
+success. If it fails the connect attempt will return failure without changing
+LastError.
+
+Whenever MS_NETLIB_SEND is called on a connection through an HTTP proxy and
+the MSG_NOHTTPGATEWAYWRAP flags is not set and nlu.pfnHttpGatewayWrapSend is
+not NULL, nlu.pfnHttpGatewayWrapSend will be called *instead* of sending the
+data. It is this function's responsibility to wrap the sending data
+appropriately for transmission and call pfnNetlibSend to send it again.
+The flags parameter to nlu.pfnHttpGatewayWrapSend should be passed straight
+through to the pfnNetlibSend call. It has already been ORed with
+MSG_NOHTTPGATEWAYWRAP. nlu.pfnHttpGatewayWrapSend should return the a
+number of the same type as MS_NETLIB_SEND, ie the number of bytes sent or
+SOCKET_ERROR. The number of wrapping bytes should be subtracted so that the
+return value appears as if the proxy wasn't there.
+pfnNetlibSend() is identical to CallService(MS_NETLIB_SEND,...) but it's
+quicker to call using this pointer than to do the CallService() lookup again.
+
+Whenever an HTTP reply is received inside MS_NETLIB_RECV the headers and data
+are read into memory. If the headers indicate success then the data is passed
+to nlu.pfnHttpGatewayUnwrapRecv (if it's non-NULL) for processing. This
+function should remove (and do other processing if necessary) all HTTP proxy
+specific headers and return a pointer to the buffer whose size is returned in
+*outBufLen. If the buffer needs to be resized then NetlibRealloc() should be
+used for that purpose, *not* your own CRT's realloc(). NetlibRealloc() behaves
+identically to realloc() so it's possible to free the original buffer and
+create a new one if that's the most sensible way to write your parser.
+If errors are encountered you should SetLastError() and return NULL;
+MS_NETLIB_RECV will return SOCKET_ERROR. If the passed buffer unwraps to
+contain no actual data you should set *outBufLen to 0 but make sure you return
+some non-NULL buffer that can be freed.
+
+When you call MS_NETLIB_SEND or MS_NETLIB_RECV from any of these functions, you
+should use the MSG_DUMPPROXY flag so that the logging is neat.
+*/
+
+//Gets the user-configured settings for a netlib user
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(NETLIBUSERSETTINGS*)&nlus
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//The pointers referred to in the returned struct will remain valid until
+//the hUser handle is closed, or until the user changes the settings in the
+//options page, so it's best not to rely on them for too long.
+//Errors: ERROR_INVALID_PARAMETER
+#define PROXYTYPE_SOCKS4 1
+#define PROXYTYPE_SOCKS5 2
+#define PROXYTYPE_HTTP 3
+#define PROXYTYPE_HTTPS 4
+typedef struct {
+ int cbSize; //to be filled in before calling
+ int useProxy; //1 or 0
+ int proxyType; //a PROXYTYPE_
+ char *szProxyServer; //can be NULL
+ int wProxyPort; //host byte order
+ int useProxyAuth; //1 or 0. Always 0 for SOCKS4
+ char *szProxyAuthUser; //can be NULL, always used by SOCKS4
+ char *szProxyAuthPassword; //can be NULL
+ int useProxyAuthNtlm; //1 or 0, only used by HTTP, HTTPS
+ int dnsThroughProxy; //1 or 0
+ int specifyIncomingPorts; //1 or 0
+ char *szIncomingPorts; //can be NULL. Of form "1024-1050,1060-1070,2000"
+ int specifyOutgoingPorts; // 0.3.3a+
+ char *szOutgoingPorts; // 0.3.3a+
+} NETLIBUSERSETTINGS;
+#define MS_NETLIB_GETUSERSETTINGS "Netlib/GetUserSettings"
+
+//Changes the user-configurable settings for a netlib user
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(NETLIBUSERSETTINGS*)&nlus
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//This function is only really useful for people that specify NUF_NOOPTIONS
+//and want to create their own options.
+//Even if a setting is not active (eg szProxyAuthPassword when useProxyAuth is
+//zero) that settings is still set for use in the options dialog.
+//Errors: ERROR_INVALID_PARAMETER
+#define MS_NETLIB_SETUSERSETTINGS "Netlib/SetUserSettings"
+
+//Closes a netlib handle
+//wParam=(WPARAM)(HANDLE)hNetlibHandle
+//lParam=0
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//This function should be called on all handles returned by netlib functions
+//once you are done with them. If it's called on a socket-type handle, the
+//socket will be closed.
+//Errors: ERROR_INVALID_PARAMETER
+#define MS_NETLIB_CLOSEHANDLE "Netlib/CloseHandle"
+__inline static int Netlib_CloseHandle(HANDLE h) {return CallService(MS_NETLIB_CLOSEHANDLE,(WPARAM)h,0);}
+
+//Open a port and wait for connections on it
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(NETLIBBIND*)&nlb
+//Returns a HANDLE on success, NULL on failure
+//hUser should have been returned by MS_NETLIB_REGISTERUSER
+//This function does the equivalent of socket(), bind(), getsockname(),
+//listen(), accept()
+//Internally this function creates a new thread which waits around in accept()
+//for new connections. When one is received it calls nlb.pfnNewConnection *from
+//this new thread* and then loops back to wait again.
+//Close the returned handle to end the thread and close the open port.
+//Errors: ERROR_INVALID_PARAMETER, any returned by socket() or bind() or
+// listen() or getsockname()
+//
+// Notes:
+//
+// During development of 0.3.1a+ (2003/07/04) passing wPort != 0
+// will result in an attempt to bind on the port given in wPort
+// if this port is taken then you will get an error, so be sure to check
+// for such conditions.
+//
+// passing wPort != 0 is for people who need to open a set port for
+// daemon activities, usually passing wPort==0 is what you want and
+// will result in a free port given by the TCP/IP socket layer and/or
+// seeded from the user selected port ranges.
+//
+// also note that wPort if != 0, will have be converted to network byte order
+//
+/* pExtra was added during 0.3.4+, prior its just two args, since we use the cdecl convention
+it shouldnt matter */
+
+#define NETLIBBIND_SIZEOF_V1 16 // sizeof(NETLIBBIND) prior to 0.3.4+ (2004/08/05)
+#define NETLIBBIND_SIZEOF_V2 20 // sizeof(NETLIBBIND) prior to 0.6+ (2006/07/03)
+
+typedef void (*NETLIBNEWCONNECTIONPROC_V2)(HANDLE hNewConnection,DWORD dwRemoteIP, void * pExtra);
+typedef void (*NETLIBNEWCONNECTIONPROC)(HANDLE hNewConnection,DWORD dwRemoteIP);
+/* This is NETLIBBIND prior to 2004/08/05+, DONT use this anymore unless you want to work
+with older cores, pExtra isnt available on older cores and never will be - for a period of time, the ABI
+for this service was broken and older NETLIBBINDs were not supported, if NULL is returned and the
+argument is good, then tell the user to upgrade to the latest CVS.
+
+The older structure was used til around 2004/08/05 */
+typedef struct {
+ int cbSize;
+ NETLIBNEWCONNECTIONPROC pfnNewConnection;
+ //function to call when there's a new connection. Params are: the
+ //new connection, IP of remote machine (host byte order)
+ DWORD dwInternalIP; //set on return, host byte order
+ WORD wPort; //set on return, host byte order
+} NETLIBBINDOLD;
+
+typedef struct {
+ int cbSize;
+ union { // new code should use V2
+ NETLIBNEWCONNECTIONPROC pfnNewConnection;
+ NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2;
+ };
+ //function to call when there's a new connection. Params are: the
+ //new connection, IP of remote machine (host byte order)
+ DWORD dwInternalIP; //set on return, host byte order
+ WORD wPort; //set on return, host byte order
+ void * pExtra; //argument is sent to callback, added during 0.3.4+
+ DWORD dwExternalIP; //set on return, host byte order
+ WORD wExPort; //set on return, host byte order
+} NETLIBBIND;
+#define MS_NETLIB_BINDPORT "Netlib/BindPort"
+
+//Open a connection
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(NETLIBOPENCONNECTION*)&nloc
+//Returns a HANDLE to the new connection on success, NULL on failure
+//hUser must have been returned by MS_NETLIB_REGISTERUSER
+//Internally this function is the equivalent of socket(), gethostbyname(),
+//connect()
+//If NLOCF_HTTP is set and hUser is configured for an HTTP or HTTPS proxy then
+//this function will connect() to the proxy server only, without performing any
+//initialisation conversation.
+//If hUser is configured for an HTTP proxy and does not support HTTP gateways
+//and you try to open a connection without specifying NLOCF_HTTP then this
+//function will first attempt to open an HTTPS connection, if that fails it
+//will try a direct connection, if that fails it will return failure with the
+//error from the connect() during the direct connection attempt.
+//Errors: ERROR_INVALID_PARAMETER, any returned by socket(), gethostbyname(),
+// connect(), MS_NETLIB_SEND, MS_NETLIB_RECV, select()
+// ERROR_TIMEOUT (during proxy communication)
+// ERROR_BAD_FORMAT (very invalid proxy reply)
+// ERROR_ACCESS_DENIED (by proxy)
+// ERROR_CONNECTION_UNAVAIL (socks proxy can't connect to identd)
+// ERROR_INVALID_ACCESS (proxy refused identd auth)
+// ERROR_INVALID_DATA (proxy returned invalid code)
+// ERROR_INVALID_ID_AUTHORITY (proxy requires use of auth method that's not supported)
+// ERROR_GEN_FAILURE (socks5/https general failure)
+// ERROR_CALL_NOT_IMPLEMENTED (socks5 command not supported)
+// ERROR_INVALID_ADDRESS (socks5 address type not supported)
+// HTTP: anything from nlu.pfnHttpGatewayInit, nlu.pfnHttpGatewayBegin,
+// MS_NETLIB_SENDHTTPREQUEST or MS_NETLIB_RECVHTTPHEADERS
+#define NLOCF_HTTP 0x0001 //this connection will be used for HTTP communications. If configured for an HTTP/HTTPS proxy the connection is opened as if there was no proxy.
+#define NLOCF_STICKYHEADERS 0x0002 //this connection should send the sticky headers associated with NetLib user apart of any HTTP request
+#define NLOCF_V2 0x0004 //this connection understands the newer structure, newer cbSize isnt enough
+
+/* Added during 0.4.0+ development!! (2004/11/29) prior to this, connect() blocks til a connection is made or
+a hard timeout is reached, this can be anywhere between 30-60 seconds, and it stops Miranda from unloading whilst
+this is attempted, clearing sucking - so now you can set a timeout of any value, there is still a hard limit which is
+always reached by Windows, If a timeout occurs, or Miranda is exiting then you will get ERROR_TIMEOUT as soon as possible.
+*/
+#define NETLIBOPENCONNECTION_V1_SIZE 16 /* old sizeof() is 14 bytes, but there is padding of 2 bytes */
+struct NETLIBOPENCONNECTION_tag {
+ int cbSize;
+ const char *szHost; //can contain the string representation of an IP
+ WORD wPort; //host byte order
+ DWORD flags;
+ unsigned int timeout;
+ /* optional, called in the context of the thread that issued the attempt, if it returns 0 the connection attempt is
+ stopped, the remaining timeout value can also be adjusted */
+ int (*waitcallback) (unsigned int * timeout);
+};
+//typedef struct NETLIBOPENCONNECTION_tag NETLIBOPENCONNECTION; //(above for reasons of forward referencing)
+#define MS_NETLIB_OPENCONNECTION "Netlib/OpenConnection"
+
+//Sets the required information for an HTTP proxy connection
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=(LPARAM)(NETLIBHTTPPROXYINFO*)&nlhpi
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//This function is designed to be called from within pfnHttpGatewayInit
+//See notes below MS_NETLIB_REGISTERUSER.
+//Errors: ERROR_INVALID_PARAMETER
+#define NLHPIF_USEGETSEQUENCE 0x0001 //append sequence numbers to GET requests
+#define NLHPIF_USEPOSTSEQUENCE 0x0002 //append sequence numbers to POST requests
+#define NLHPIF_GETPOSTSAMESEQUENCE 0x0004 //GET and POST use the same sequence
+#define NLHPIF_HTTP11 0x0008 //HTTP 1.1 proxy
+typedef struct {
+ int cbSize;
+ DWORD flags;
+ char *szHttpPostUrl;
+ char *szHttpGetUrl;
+ int firstGetSequence,firstPostSequence;
+} NETLIBHTTPPROXYINFO;
+#define MS_NETLIB_SETHTTPPROXYINFO "Netlib/SetHttpProxyInfo"
+
+//Gets the SOCKET associated with a netlib handle
+//wParam=(WPARAM)(HANDLE)hNetlibHandle
+//lParam=0
+//Returns the SOCKET on success, INVALID_SOCKET on failure
+//hNetlibHandle should have been returned by MS_NETLIB_BINDPORT or
+//MS_NETLIB_OPENCONNECTION only.
+//Be careful how you use this socket because you might be connected via an
+//HTTP proxy in which case calling send() or recv() will totally break things.
+//Errors: ERROR_INVALID_PARAMETER
+#define MS_NETLIB_GETSOCKET "Netlib/GetSocket"
+
+//URL-encode a string for x-www-form-urlencoded (and other) transmission
+//wParam=0
+//lParam=(LPARAM)(const char *)pszString
+//Returns a char* containing the new string. This must be freed with
+//HeapFree(GetProcessHeap(),0,pszReturnString) when you're done with it.
+//Returns NULL on error.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY
+#define MS_NETLIB_URLENCODE "Netlib/UrlEncode"
+
+//Base64 decode a string. See rfc1421.
+//wParam=0
+//lParam=(LPARAM)(NETLIBBASE64*)&nlb64
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//nlb64.pszEncoded and nlb64.cchEncoded contain the input string and its length
+//(excluding terminating zero).
+//nlb64.pbDecoded and nlb64.cbDecoded contain the buffer in which to put the
+//output and the length of this buffer. The maximum output size for a given
+//input is available from the macro Netlib_GetBase64DecodedBufferSize() below.
+//On return nlb64.cbDecoded is set to the actual length of the decoded data.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_INVALID_DATA, ERROR_BUFFER_OVERFLOW
+typedef struct {
+ char *pszEncoded;
+ int cchEncoded;
+ PBYTE pbDecoded;
+ int cbDecoded;
+} NETLIBBASE64;
+#define Netlib_GetBase64DecodedBufferSize(cchEncoded) (((cchEncoded)>>2)*3)
+#define MS_NETLIB_BASE64DECODE "Netlib/Base64Decode"
+
+//Base64 encode a string. See rfc1421.
+//wParam=0
+//lParam=(LPARAM)(NETLIBBASE64*)&nlb64
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//nlb64.pbDecoded and nlb64.cbDecoded contain the input buffer and its length
+//nlb64.pszEncoded and nlb64.cchEncoded contain the buffer in which to put the
+//output and the length of this buffer. The maximum output size for a given
+//input is available from the macro Netlib_GetBase64EncodedBufferSize() below.
+//nlb64.pszEncoded is terminated with a 0.
+//On return nlb64.cchEncoded is set to the actual length of the decoded data,
+//excluding the terminating 0.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_BUFFER_OVERFLOW
+#define Netlib_GetBase64EncodedBufferSize(cbDecoded) (((cbDecoded)*4+11)/12*4+1)
+#define MS_NETLIB_BASE64ENCODE "Netlib/Base64Encode"
+
+//Send an HTTP request over a connection
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=(LPARAM)(NETLIBHTTPREQUEST*)&nlhr
+//Returns number of bytes sent on success, SOCKET_ERROR on failure
+//hConnection must have been returned by MS_NETLIB_OPENCONNECTION
+//Note that if you use NLHRF_SMARTAUTHHEADER and NTLM authentication is in use
+//then the full NTLM authentication transaction occurs, comprising sending the
+//domain, receiving the challenge, then sending the response.
+//nlhr.resultCode and nlhr.szResultDescr are ignored by this function.
+//Errors: ERROR_INVALID_PARAMETER, anything returned by MS_NETLIB_SEND
+typedef struct {
+ char *szName;
+ char *szValue;
+} NETLIBHTTPHEADER;
+
+#define REQUEST_RESPONSE 0 //used by structure returned by MS_NETLIB_RECVHTTPHEADERS
+#define REQUEST_GET 1
+#define REQUEST_POST 2
+#define REQUEST_CONNECT 3
+#define REQUEST_HEAD 4 // new in 0.5.1
+#define NLHRF_GENERATEHOST 0x00000001 //auto-generate a "Host" header from szUrl
+#define NLHRF_REMOVEHOST 0x00000002 //remove any host and/or protocol portion of szUrl before sending it
+#define NLHRF_SMARTREMOVEHOST 0x00000004 //removes host and/or protocol from szUrl unless the connection was opened through an HTTP or HTTPS proxy.
+#define NLHRF_SMARTAUTHHEADER 0x00000008 //if the connection was opened through an HTTP or HTTPS proxy then send a Proxy-Authorization header if required.
+#define NLHRF_HTTP11 0x00000010 //use HTTP 1.1 +#define NLHRF_NODUMP 0x00010000 //never dump this to the log
+#define NLHRF_NODUMPHEADERS 0x00020000 //don't dump http headers (only useful for POSTs and MS_NETLIB_HTTPTRANSACTION)
+#define NLHRF_DUMPPROXY 0x00040000 //this transaction is a proxy communication. For dump filtering only.
+#define NLHRF_DUMPASTEXT 0x00080000 //dump posted and reply data as text. Headers are always dumped as text.
+struct NETLIBHTTPREQUEST_tag {
+ int cbSize;
+ int requestType; //a REQUEST_
+ DWORD flags;
+ char *szUrl;
+ NETLIBHTTPHEADER *headers; //If this is a POST request and headers
+ //doesn't contain a Content-Length it'll be added automatically
+ int headersCount;
+ char *pData; //data to be sent in POST request.
+ int dataLength; //must be 0 for REQUEST_GET/REQUEST_CONNECT
+ int resultCode;
+ char *szResultDescr;
+ HANDLE nlc;
+};
+//typedef struct NETLIBHTTPREQUEST_tag NETLIBHTTPREQUEST; //(above for reasons of forward referencing)
+#define MS_NETLIB_SENDHTTPREQUEST "Netlib/SendHttpRequest"
+
+//Receive HTTP headers
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=0
+//Returns a pointer to a NETLIBHTTPREQUEST structure on success, NULL on
+//failure.
+//Call MS_NETLIB_FREEHTTPREQUESTSTRUCT to free this.
+//hConnection must have been returned by MS_NETLIB_OPENCONNECTION
+//nlhr->pData=NULL and nlhr->dataLength=0 always. The requested data should
+//be retrieved using MS_NETLIB_RECV once the header has been parsed.
+//If the headers haven't finished within 60 seconds the function returns NULL
+//and ERROR_TIMEOUT.
+//Errors: ERROR_INVALID_PARAMETER, any from MS_NETLIB_RECV or select()
+// ERROR_HANDLE_EOF (connection closed before headers complete)
+// ERROR_TIMEOUT (headers still not complete after 60 seconds)
+// ERROR_BAD_FORMAT (invalid character or line ending in headers, or first line is blank)
+// ERROR_BUFFER_OVERFLOW (each header line must be less than 4096 chars long)
+// ERROR_INVALID_DATA (first header line is malformed ("http/[01].[0-9] [0-9]+ .*", or no colon in subsequent line)
+#define MS_NETLIB_RECVHTTPHEADERS "Netlib/RecvHttpHeaders"
+
+//Free the memory used by a NETLIBHTTPREQUEST structure
+//wParam=0
+//lParam=(LPARAM)(NETLIBHTTPREQUEST*)pnlhr
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//This should only be called on structures returned by
+//MS_NETLIB_RECVHTTPHEADERS or MS_NETLIB_HTTPTRANSACTION. Calling it on an
+//arbitrary structure will have disastrous results.
+//Errors: ERROR_INVALID_PARAMETER
+#define MS_NETLIB_FREEHTTPREQUESTSTRUCT "Netlib/FreeHttpRequestStruct"
+
+//Do an entire HTTP transaction
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(NETLIBHTTPREQUEST*)&nlhr
+//Returns a pointer to another NETLIBHTTPREQUEST structure on success, NULL on
+//failure.
+//Call MS_NETLIB_FREEHTTPREQUESTSTRUCT to free this.
+//hUser must have been returned by MS_NETLIB_REGISTERUSER
+//nlhr.szUrl should be a full HTTP URL. If it does not start with http://, that
+//will be assumed (but it's best not to use this fact, for reasons of
+//extensibility).
+//This function is the equivalent of MS_NETLIB_OPENCONNECTION,
+//MS_NETLIB_SENDHTTPREQ, MS_NETLIB_RECVHTTPHEADERS, MS_NETLIB_RECV,
+//MS_NETLIB_CLOSEHANDLE
+//nlhr.headers will be augmented with the following headers unless they have
+//already been set by the caller:
+// "Host" (regardless of whether it is requested in nlhr.flags)
+// "User-Agent" (of the form "Miranda/0.1.2.2 (alpha)" or "Miranda/0.1.2.2")
+// "Content-Length" (for POSTs only. Set to nlhr.dataLength)
+//If you do not want to send one of these headers, create a nlhr.headers with
+//szValue=NULL.
+//In the return value headers, headerCount, pData, dataLength, resultCode and
+//szResultDescr are all valid.
+//In the return value pData[dataLength]==0 always, as an extra safeguard
+//against programming slips.
+//Note that the function can succeed (ie not return NULL) yet result in an HTTP
+//error code. You should check that resultCode==2xx before proceeding.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY, anything from the above
+// list of functions
+#define MS_NETLIB_HTTPTRANSACTION "Netlib/HttpTransaction"
+
+//Send data over a connection
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=(LPARAM)(NETLIBBUFFER*)&nlb
+//Returns the number of bytes sent on success, SOCKET_ERROR on failure
+//Errors: ERROR_INVALID_PARAMETER
+// anything from send(), nlu.pfnHttpGatewayWrapSend()
+// HTTP proxy: ERROR_GEN_FAILURE (http result code wasn't 2xx)
+// anything from socket(), connect(),
+// MS_NETLIB_SENDHTTPREQUEST, MS_NETLIB_RECVHTTPHEADERS
+//flags:
+#define MSG_NOHTTPGATEWAYWRAP 0x010000 //don't wrap the outgoing packet using nlu.pfnHttpGatewayWrapSend
+#define MSG_NODUMP 0x020000 //don't dump this packet to the log
+#define MSG_DUMPPROXY 0x040000 //this is proxy communiciation. For dump filtering only.
+#define MSG_DUMPASTEXT 0x080000 //this is textual data, don't dump as hex
+#define MSG_RAW 0x100000 //send as raw data, bypass any HTTP proxy stuff
+typedef struct {
+ char *buf;
+ int len;
+ int flags;
+} NETLIBBUFFER;
+#define MS_NETLIB_SEND "Netlib/Send"
+static __inline int Netlib_Send(HANDLE hConn,const char *buf,int len,int flags) {
+ NETLIBBUFFER nlb={(char*)buf,len,flags};
+ return CallService(MS_NETLIB_SEND,(WPARAM)hConn,(LPARAM)&nlb);
+}
+
+//Receive data over a connection
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=(LPARAM)(NETLIBBUFFER*)&nlb
+//Returns the number of bytes read on success, SOCKET_ERROR on failure,
+//0 if the connection has been closed
+//Flags supported: MSG_PEEK, MSG_NODUMP, MSG_DUMPPROXY, MSG_NOHTTPGATEWAYWRAP,
+// MSG_DUMPASTEXT, MSG_RAW
+//On using MSG_NOHTTPGATEWAYWRAP: Because packets through an HTTP proxy are
+// batched and cached and stuff, using this flag is not a guarantee that it
+// will be obeyed, and if it is it may even be propogated to future calls
+// even if you don't specify it then. Because of this, the flag should be
+// considered an all-or-nothing thing: either use it for the entire duration
+// of a connection, or not at all.
+//Errors: ERROR_INVALID_PARAMETER, anything from recv()
+// HTTP proxy: ERROR_GEN_FAILURE (http result code wasn't 2xx)
+// ERROR_INVALID_DATA (no Content-Length header in reply)
+// ERROR_NOT_ENOUGH_MEMORY (Content-Length very large)
+// ERROR_HANDLE_EOF (connection closed before Content-Length bytes recved)
+// anything from select(), MS_NETLIB_RECVHTTPHEADERS,
+// nlu.pfnHttpGatewayUnwrapRecv, socket(), connect(),
+// MS_NETLIB_SENDHTTPREQUEST
+#define MS_NETLIB_RECV "Netlib/Recv"
+static __inline int Netlib_Recv(HANDLE hConn,char *buf,int len,int flags) {
+ NETLIBBUFFER nlb={buf,len,flags};
+ return CallService(MS_NETLIB_RECV,(WPARAM)hConn,(LPARAM)&nlb);
+}
+
+//Determine the status of one or more connections
+//wParam=0
+//lParam=(LPARAM)(NETLIBSELECT*)&nls
+//Returns the number of ready connections, SOCKET_ERROR on failure,
+//0 if the timeout expired.
+//All handles passed to this function must have been returned by either
+//MS_NETLIB_OPENCONNECTION or MS_NETLIB_BINDPORT.
+//The last handle in each list must be followed by either NULL or
+//INVALID_HANDLE_VALUE.
+//Errors: ERROR_INVALID_HANDLE, ERROR_INVALID_DATA, anything from select()
+typedef struct {
+ int cbSize;
+ DWORD dwTimeout; //in milliseconds, INFINITE is acceptable
+ HANDLE hReadConns[FD_SETSIZE+1];
+ HANDLE hWriteConns[FD_SETSIZE+1];
+ HANDLE hExceptConns[FD_SETSIZE+1];
+} NETLIBSELECT;
+
+typedef struct {
+ int cbSize;
+ DWORD dwTimeout; //in milliseconds, INFINITE is acceptable
+ HANDLE hReadConns[FD_SETSIZE+1];
+ HANDLE hWriteConns[FD_SETSIZE+1];
+ HANDLE hExceptConns[FD_SETSIZE+1];
+ /* Added in v0.3.3+ */
+ BOOL hReadStatus[FD_SETSIZE+1]; /* out, [in, expected to be FALSE] */
+ BOOL hWriteStatus[FD_SETSIZE+1]; /* out, [in, expected to be FALSE] */
+ BOOL hExceptStatus[FD_SETSIZE+1]; /* out, [in, expected to be FALSE] */
+} NETLIBSELECTEX;
+
+#define MS_NETLIB_SELECT "Netlib/Select"
+// added in v0.3.3
+#define MS_NETLIB_SELECTEX "Netlib/SelectEx"
+
+//Create a packet receiver
+//wParam=(WPARAM)(HANDLE)hConnection
+//lParam=(LPARAM)(int)maxPacketSize
+//Returns a HANDLE on success, NULL on failure
+//The packet receiver implements the common situation where you have variable
+//length packets coming in over a connection and you want to split them up
+//in order to handle them.
+//The major limitation is that the buffer is created in memory, so you can't
+//have arbitrarily large packets.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY
+#define MS_NETLIB_CREATEPACKETRECVER "Netlib/CreatePacketRecver"
+
+//Get the next set of packets from a packet receiver
+//wParam=(WPARAM)(HANDLE)hPacketRecver
+//lParam=(LPARAM)(NETLIBPACKETRECVER*)&nlpr
+//Returns the total number of bytes available in the buffer, 0 if the
+//connection was closed, SOCKET_ERROR on error.
+//hPacketRecver must have been returned by MS_NETLIB_CREATEPACKETRECVER
+//If nlpr.bytesUsed is set to zero and the buffer is already full up to
+//maxPacketSize, it is assumed that too large a packet has been received. All
+//data in the buffer is discarded and receiving is begun anew. This will
+//probably cause alignment problems so if you think this is likely to happen
+//then you should deal with it yourself.
+//Closing the packet receiver will not close the associated connection, but
+//will discard any bytes still in the buffer, so if you intend to carry on
+//reading from that connection, make sure you have processed the buffer first.
+//This function is the equivalent of a memmove() to remove the first bytesUsed
+//from the buffer, select() if dwTimeout is not INFINITE, then MS_NETLIB_RECV.
+//Errors: ERROR_INVALID_PARAMETER, ERROR_TIMEOUT,
+// anything from select(), MS_NETLIB_RECV
+typedef struct {
+ int cbSize;
+ DWORD dwTimeout; //fill before calling. In milliseconds. INFINITE is valid
+ int bytesUsed; //fill before calling. This many bytes are removed from the start of the buffer. Set to 0 on return
+ int bytesAvailable; //equal to the return value, unless the return value is 0
+ int bufferSize; //same as parameter to MS_NETLIB_CREATEPACKETRECVER
+ BYTE *buffer; //contains the recved data
+} NETLIBPACKETRECVER;
+#define MS_NETLIB_GETMOREPACKETS "Netlib/GetMorePackets"
+
+//Add a message to the log (if it's running)
+//wParam=(WPARAM)(HANDLE)hUser
+//lParam=(LPARAM)(const char *)szMessage
+//Returns nonzero on success, 0 on failure (!! this is different to most of the rest of Miranda, but consistent with netlib)
+//Do not include a final line ending in szMessage.
+//Errors: ERROR_INVALID_PARAMETER
+#define MS_NETLIB_LOG "Netlib/Log"
+
+//Sets a gateway polling timeout interval
+//wParam=(WPARAM)(HANDLE)hConn
+//lParam=(LPARAM)timeout
+//Returns previous timeout value
+//Errors: -1
+#define MS_NETLIB_SETPOLLINGTIMEOUT "Netlib/SetPollingTimeout"
+
+//here's a handy piece of code to let you log using printf-style specifiers:
+//#include <stdarg.h> and <stdio.h> before including this header in order to
+//use it.
+#if defined va_start && (defined _STDIO_DEFINED || defined _STDIO_H_) && (!defined NETLIB_NOLOGGING)
+static __inline int Netlib_Logf(HANDLE hUser,const char *fmt,...)
+{
+ va_list va;
+ char szText[1024];
+
+ va_start(va,fmt);
+ mir_vsnprintf(szText,sizeof(szText),fmt,va);
+ va_end(va);
+ return CallService(MS_NETLIB_LOG,(WPARAM)hUser,(LPARAM)szText);
+}
+#endif //defined va_start
+
+/* Notes on being backwards compatible with 0.1.2.1
+One way to do back compatibility is to create your own mini netlib that only
+supports a minimal set of features. Here's some sample code:
+
+//This function is called during the ME_SYSTEM_MODULESLOADED hook
+int MyPluginModulesLoaded(WPARAM wParam,LPARAM lParam)
+{
+ //if this is executed on a version of Miranda with netlib then all
+ //these calls will fail and the proper netlib will be used.
+ CreateServiceFunction(MS_NETLIB_CLOSEHANDLE,MiniNetlibCloseHandle);
+ CreateServiceFunction(MS_NETLIB_OPENCONNECTION,MiniNetlibOpenConnection);
+ CreateServiceFunction(MS_NETLIB_SEND,MiniNetlibSend);
+ CreateServiceFunction(MS_NETLIB_RECV,MiniNetlibRecv);
+ CreateServiceFunction(MS_NETLIB_SELECT,MiniNetlibSelect);
+ return 0;
+}
+
+int MiniNetlibCloseHandle(WPARAM wParam,LPARAM lParam)
+{
+ closesocket((SOCKET)wParam);
+ return 1;
+}
+
+int MiniNetlibOpenConnection(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBOPENCONNECTION *nloc=(NETLIBOPENCONNECTION*)lParam;
+ SOCKADDR_IN sin;
+ SOCKET s;
+
+ sin.s_addr=inet_addr(szHost);
+ if(sin.sin_addr.S_un.S_addr==INADDR_NONE) {
+ HOSTENT *host=gethostbyname(szHost);
+ if(host) sin.sin_addr.S_un.S_addr=*(u_long *)host->h_addr_list[0];
+ else return (int)INVALID_SOCKET;
+ }
+ s=socket(AF_INET,SOCK_STREAM,0);
+ sin.sin_family=AF_INET;
+ sin.sin_port=(short)htons(nloc->wPort);
+ if(connect(s,(SOCKADDR*)sin,sizeof(sin))==SOCKET_ERROR) {
+ closesocket(s);
+ return (int)INVALID_SOCKET;
+ }
+ return (int)s;
+}
+
+int MiniNetlibSend(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBBUFFER *nlb=(NETLIBBUFFER*)lParam;
+ return send((SOCKET)wParam,nlb->buf,nlb->len,nlb->flags);
+}
+
+int MiniNetlibRecv(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBBUFFER *nlb=(NETLIBBUFFER*)lParam;
+ return recv((SOCKET)wParam,nlb->buf,nlb->len,nlb->flags);
+}
+
+int MiniNetlibSelect(WPARAM wParam,LPARAM lParam)
+{
+ NETLIBSELECT *nls=(NETLIBSELECT*)lParam;
+ fd_set readfd,writefd,exceptfd;
+ TIMEVAL tv;
+ int i;
+
+ tv.tv_sec=nls->dwTimeout/1000;
+ tv.tv_usec=(nls->dwTimeout%1000)*1000;
+ FD_ZERO(&readfd); for(i=0;nls->hReadConns[i];i++) FD_SET((SOCKET)nls->hReadConns[i],&readfd);
+ FD_ZERO(&writefd); for(i=0;nls->hWriteConns[i];i++) FD_SET((SOCKET)nls->hWriteConns[i],&writefd);
+ FD_ZERO(&exceptfd); for(i=0;nls->hExceptConns[i];i++) FD_SET((SOCKET)nls->hExceptConns[i],&exceptfd);
+ return select(0,&readfd,&writefd,&exceptfd,nls->dwTimeout==INFINITE?NULL:&tv);
+}
+
+///
+NB: I haven't actually tested that this even compiles.
+*/
+
+#endif // M_NETLIB_H__
+
diff --git a/miranda-wine/include/m_options.h b/miranda-wine/include/m_options.h new file mode 100644 index 0000000..6d521bf --- /dev/null +++ b/miranda-wine/include/m_options.h @@ -0,0 +1,108 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_OPTIONS_H__
+#define M_OPTIONS_H__
+
+/* Opt/Initialise
+The user opened the options dialog. Modules should do whatever initialisation
+they need and call opt/addpage one or more times if they want pages displayed
+in the options dialog
+wParam=addInfo
+lParam=0
+addInfo should be passed straight to the wParam of opt/addpage
+*/
+#define ME_OPT_INITIALISE "Opt/Initialise"
+
+/* Opt/AddPage
+Must only be called during an opt/initialise hook
+Adds a page to the options dialog
+wParam=addInfo
+lParam=(LPARAM)(OPTIONSDIALOGPAGE*)odp
+addInfo must have come straight from the wParam of opt/initialise
+Pages in the options dialog operate just like pages in property sheets. See the
+Microsoft documentation for details on how they operate.
+Strings in the structure can be released as soon as the service returns, but
+icons must be kept around. This is not a problem if you're loading them from a
+resource.
+Prior to v0.1.2.1 the options dialog would resize to fit the largest page, but
+since then it is fixed in size. The largest page that fits neatly is 314x240
+DLUs.
+*/
+typedef struct {
+ int cbSize;
+ int position; //a position number, lower numbers are topmost
+ union {
+ char* pszTitle;
+ TCHAR* ptszTitle;
+ };
+ DLGPROC pfnDlgProc;
+ char *pszTemplate;
+ HINSTANCE hInstance;
+ HICON hIcon; //v0.1.0.1+
+ union {
+ char* pszGroup; //v0.1.0.1+
+ TCHAR* ptszGroup; //v0.1.0.1+
+ };
+ int groupPosition; //v0.1.0.1+
+ HICON hGroupIcon; //v0.1.0.1+
+ DWORD flags; //v0.1.2.1+
+ int nIDBottomSimpleControl; //v0.1.2.1+ if in simple mode the dlg will be cut off after this control, 0 to disable
+ int nIDRightSimpleControl; //v0.1.2.1+ if in simple mode the dlg will be cut off after this control, 0 to disable
+ UINT *expertOnlyControls;
+ int nExpertOnlyControls; //v0.1.2.1+ these controls will be hidden in simple mode. Array must remain valid for duration of dlg.
+} OPTIONSDIALOGPAGE;
+#define ODPF_SIMPLEONLY 1 // page is only shown when in simple mode
+#define ODPF_EXPERTONLY 2 // " expert mode
+#define ODPF_BOLDGROUPS 4 // give group box titles a bold font
+#define ODPF_UNICODE 8 // string fields in OPTIONSDIALOGPAGE are WCHAR*
+
+#if defined( _UNICODE )
+ #define ODPF_TCHAR ODPF_UNICODE
+#else
+ #define ODPF_TCHAR 0
+#endif
+
+#define PSN_EXPERTCHANGED 2 //sent to pages via WM_NOTIFY when the expert checkbox is clicked. lParam=new state
+#define PSM_ISEXPERT (WM_USER+101) //returns true/false
+#define PSM_GETBOLDFONT (WM_USER+102) //returns HFONT used for group box titles
+#define MS_OPT_ADDPAGE "Opt/AddPage"
+
+//Opens the options dialog, optionally at the specified page v0.1.2.1+
+//wParam=0
+//lParam=(LPARAM)(OPENOPTIONSDIALOG*)&ood;
+//Returns 0 on success, nonzero on failure
+//The behaviour if the options dialog is already open is that it will just be
+//activated, the page won't be changed. This may change in the future.
+typedef struct {
+ int cbSize;
+ const char *pszGroup; //set to NULL if it's a root item
+ const char *pszPage; //set to NULL to just open the options at no
+ //specific page
+} OPENOPTIONSDIALOG;
+#define MS_OPT_OPENOPTIONS "Opt/OpenOptions"
+
+#define SETTING_SHOWEXPERT_DEFAULT 1
+
+#endif //M_OPTIONS_H__
+
diff --git a/miranda-wine/include/m_plugins.h b/miranda-wine/include/m_plugins.h new file mode 100644 index 0000000..c204394 --- /dev/null +++ b/miranda-wine/include/m_plugins.h @@ -0,0 +1,82 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_PLUGINS_H__
+#define M_PLUGINS_H__
+
+/*
+ Undocumented: Do NOT use.
+ Version: 0.3.4.1+ (2004/10/04)
+*/
+#define DBPE_DONE 1
+#define DBPE_CONT 0
+#define DBPE_HALT (-1)
+typedef struct PLUGIN_DB_ENUM {
+ int cbSize;
+ // 0 = continue, 1 = found, -1 = stop now
+ int (*pfnEnumCallback) ( char * pluginname, /*DATABASELINK*/ void * link, LPARAM lParam);
+ LPARAM lParam;
+} PLUGIN_DB_ENUM;
+#define MS_PLUGINS_ENUMDBPLUGINS "Plugins/DbEnumerate"
+
+
+#define DEFMOD_PROTOCOLICQ 1 //removed from v0.3 alpha
+#define DEFMOD_PROTOCOLMSN 2 //removed from v0.1.2.0+
+#define DEFMOD_UIFINDADD 3
+#define DEFMOD_UIUSERINFO 4
+#define DEFMOD_SRMESSAGE 5 //removed from v0.3.3a (temp)
+#define DEFMOD_SRURL 6
+#define DEFMOD_SREMAIL 7
+#define DEFMOD_SRAUTH 8
+#define DEFMOD_SRFILE 9
+#define DEFMOD_UIHELP 10
+#define DEFMOD_UIHISTORY 11
+//#define DEFMOD_RNDCHECKUPD 12 //removed from v0.3.1 alpha
+//#define DEFMOD_RNDICQIMPORT 13 //removed from v0.3 alpha
+#define DEFMOD_RNDAUTOAWAY 14
+#define DEFMOD_RNDUSERONLINE 15
+#define DEFMOD_RNDCRYPT 16 //v0.1.0.1-v0.1.2.0
+#define DEFMOD_SRAWAY 17 //v0.1.0.1+
+#define DEFMOD_RNDIGNORE 18 //v0.1.0.1+
+#define DEFMOD_UIVISIBILITY 19 //v0.1.1.0+, options page only
+#define DEFMOD_UICLUI 20 //v0.1.1.0+
+//#define DEFMOD_UIPLUGINOPTS 21 //removed from 0.4.0.1
+#define DEFMOD_PROTOCOLNETLIB 22 //v0.1.2.2+
+#define DEFMOD_RNDIDLE 23 //v0.3.4a+
+#define DEFMOD_CLISTALL 24 //v0.3.4a+ (2004/09/28)
+#define DEFMOD_DB 25 //v0.3.4.3+ (2004/10/11)
+
+#define DEFMOD_HIGHEST 25
+
+//plugins/getdisabledefaultarray
+//gets an array of the modules that the plugins report they want to replace
+//wParam=lParam=0
+//returns a pointer to an array of ints, with elements 1 or 0 indexed by the
+//DEFMOD_ constants. 1 to signify that the default module shouldn't be loaded.
+//this is primarily for use by the core's module initialiser, but could also
+//be used by modules that are doing naughty things that are very
+//feature-dependent
+#define MS_PLUGINS_GETDISABLEDEFAULTARRAY "Plugins/GetDisableDefaultArray"
+
+#endif // M_PLUGINS_H__
+
diff --git a/miranda-wine/include/m_png.h b/miranda-wine/include/m_png.h new file mode 100644 index 0000000..c5e8b67 --- /dev/null +++ b/miranda-wine/include/m_png.h @@ -0,0 +1,64 @@ +/*
+Plugin of Miranda IM for reading/writing PNG images.
+Copyright (c) 2004-5 George Hazan (ghazan@postman.ru)
+
+Portions of this code are gotten from the libpng codebase.
+Copyright 2000, Willem van Schaik. For conditions of distribution and
+use, see the copyright/license/disclaimer notice in png.h
+
+Miranda IM: the free icq client for MS Windows
+Copyright (C) 2000-2002 Richard Hughes, Roland Rabien & Tristan Van de Vreede
+
+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.
+
+File name : $Source: /cvsroot/miranda/miranda/include/m_png.h,v $
+Revision : $Revision: 2876 $
+Last change on : $Date: 2006-05-17 01:56:03 +0400 (Срд, 17 Май 2006) $
+Last change by : $Author: ghazan $
+
+*/
+
+/* Image/Dib2Png
+Converts a Device Independent Bitmap to a png stored in memory
+ wParam=0
+ lParam=(WPARAM)(DIB2PNG*)descr
+*/
+
+typedef struct
+{
+ BITMAPINFO* pbmi;
+ BYTE* pDiData;
+ BYTE* pResult;
+ long* pResultLen;
+}
+ DIB2PNG;
+
+#define MS_DIB2PNG "Image/Dib2Png"
+
+/* Image/Png2Dib
+Converts a png stored in memory to a Device Independent Bitmap
+ wParam=0
+ lParam=(WPARAM)(PNG2DIB*)descr
+*/
+
+typedef struct
+{
+ BYTE* pSource;
+ DWORD cbSourceSize;
+ BITMAPINFOHEADER** pResult;
+}
+ PNG2DIB;
+
+#define MS_PNG2DIB "Image/Png2Dib"
diff --git a/miranda-wine/include/m_popup.h b/miranda-wine/include/m_popup.h new file mode 100644 index 0000000..2556f83 --- /dev/null +++ b/miranda-wine/include/m_popup.h @@ -0,0 +1,317 @@ +/*
+===============================================================================
+ PopUp plugin
+Plugin Name: PopUp
+Plugin authors: Luca Santarelli aka hrk (hrk@users.sourceforge.net)
+ Victor Pavlychko aka zazoo (nullbie@gmail.com)
+===============================================================================
+The purpose of this plugin is to give developers a common "platform/interface"
+to show PopUps. It is born from the source code of NewStatusNotify, another
+plugin I've made.
+
+Remember that users *must* have this plugin enabled, or they won't get any
+popup. Write this in the requirements, do whatever you wish ;-)... but tell
+them!
+===============================================================================
+*/
+#ifndef M_POPUP_H
+#define M_POPUP_H
+
+/*
+NOTE! Since Popup 1.0.1.2 there is a main meun group called "PopUps" where I
+have put a "Enable/Disable" item. You can add your own "enable/disable" items
+by adding these lines before you call MS_CLIST_ADDMAINMENUITEM:
+mi.pszPopUpName = Translate("PopUps");
+mi.position = 0; //You don't need it and it's better if you put it to zero.
+*/
+
+//#define MAX_CONTACTNAME 32
+//#define MAX_SECONDLINE 40
+#define MAX_CONTACTNAME 2048
+#define MAX_SECONDLINE 2048
+
+#define POPUP_USE_SKINNED_BG 0xffffffff
+
+//This is the basic data you'll need to fill and pass to the service function.
+typedef struct {
+ HANDLE lchContact; //Handle to the contact, can be NULL (main contact).
+ HICON lchIcon; //Handle to a icon to be shown. Cannot be NULL.
+ char lpzContactName[MAX_CONTACTNAME]; //This is the contact name or the first line in the plugin. Cannot be NULL.
+ char lpzText[MAX_SECONDLINE]; //This is the second line text. Users can choose to hide it. Cannot be NULL.
+ COLORREF colorBack; //COLORREF to be used for the background. Can be NULL, default will be used.
+ COLORREF colorText; //COLORREF to be used for the text. Can be NULL, default will be used.
+ WNDPROC PluginWindowProc; //Read below. Can be NULL; default will be used.
+ void * PluginData; //Read below. Can be NULL.
+} POPUPDATA, * LPPOPUPDATA;
+
+typedef struct {
+ HANDLE lchContact;
+ HICON lchIcon;
+ char lpzContactName[MAX_CONTACTNAME];
+ char lpzText[MAX_SECONDLINE];
+ COLORREF colorBack; //Set background to POPUP_USE_SKINNED_BG to turn on skinning
+ COLORREF colorText;
+ WNDPROC PluginWindowProc;
+ void * PluginData;
+ int iSeconds; //Custom delay time in seconds. -1 means "forever", 0 means "default time".
+ LPCTSTR lpzClass; //PopUp class. Used with skinning. See PopUp/AddClass for details
+ COLORREF skinBack; //Background color for colorizable skins
+ char cZero[16 - sizeof(LPCTSTR) - sizeof(COLORREF)];
+ //some unused bytes which may come useful in the future.
+} POPUPDATAEX, *LPPOPUPDATAEX;
+
+/*
+When you call MS_POPUP_ADDPOPUP, my plugin will check if the given POPUPDATA structure is filled with acceptable values. If not, the data will be rejected and no popup will be shown.
+
+- lpzText should be given, because it's really bad if a user chooses to have the second line displayed
+and it's empty :-) Just write it and let the user choose if it will be displayed or not.
+
+- PluginWindowProc is a WNDPROC address you have to give me. Why? What? Where? Calm down 8)
+My plugin will take care of the creation of the popup, of the destruction of the popup, of the come into
+view and the hiding of the popup. Transparency, animations... all this stuff.
+My plugin will not (as example) open the MessageWindow when you left click on a popup.
+Why? Because I don't know if your popup desires to open the MessageWindow :))))
+This means that you need to make a WNDPROC which takes care of the WM_messages you need.
+For example, WM_COMMAND or WM_CONTEXTMENU or WM_LMOUSEUP or whatever.
+At the end of your WNDPROC remember to "return DefWindowProc(hwnd, msg, wParam, lParam);"
+When you process a message that needs a return value (an example could be WM_CTLCOLORSTATIC,
+but you don't need to catch it 'cause it's my plugin's job), simply return the nedeed value. :)
+The default WNDPROC does nothing.
+
+- PluginData is a pointer to a void, which means a pointer to anything. You can make your own structure
+to store the data you need (example: a status information, a date, your name, whatever) and give me a
+pointer to that struct.
+You will need to destroy that structure and free the memory when the PopUp is going to be destroyed. You'll know this when you receive a UM_FREEPLUGINDATA. The name tells it all: free your own plugin data.
+
+Appendix A: Messages my plugin will handle and your WNDPROC will never see.
+WM_CREATE, WM_DESTROY, WM_TIMER, WM_ERASEBKGND
+WM_CTLCOLOR* [whatever it may be: WM_CTLCOLORDLG, WM_CTLCOLORSTATIC...]
+WM_PAINT, WM_PRINT, WM_PRINTCLIENT
+
+Appendix B: "What do I need to do?!?".
+Here is an example in C.
+
+//Your plugin is in /plugins/myPlugin/ or in miranda32/something/
+#include "../../plugins/PopUp/m_popup.h"
+
+Define your own plugin data if you need it. In this example, we need it and we'll use NewStatusNotify as example: thsi plugin shows a popup when someone in your contact list changes his/hers status. We'll need to know his status, both current and old one.
+typedef struct {
+ WORD oldStatus;
+ WORD newStatus;
+} MY_PLUGIN_DATA;
+
+When we need to show the popup, we do:
+{
+ POPUPDATA ppd;
+ hContact = A_VALID_HANDLE_YOU_GOT_FROM_SOMEWHERE;
+ hIcon = A_VALID_HANDLE_YOU_GOT_SOMEWHERE;
+ char * lpzContactName = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lhContact,0);
+ //99% of the times you'll just copy this line.
+ //1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
+ char * lpzText;
+ //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
+ COLORREF colorBack = GetSysColor(COLOR_BTNFACE); //The colour of Miranda's option Pages (and many other windows...)
+ COLORREF colorText = RGB(255,255,255); //White.
+ MY_PLUGIN_DATA * mpd = (MY_PLUGIN_DATA*)mir_alloc(sizeof(MY_PLUGIN_DATA));
+
+ ZeroMemory(ppd, sizeof(ppd)); //This is always a good thing to do.
+ ppd.lchContact = (HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
+ ppd.lchIcon = hIcon;
+ lstrcpy(ppd.lpzContactName, lpzContactName);
+ lstrcpy(ppd.lpzText, lpzText);
+ ppd.colorBack = colorBack;
+ ppd.colorText = colorText;
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+
+ //Now the "additional" data.
+ mpd->oldStatus = ID_STATUS_OFFLINE;
+ mpd->newStatus = ID_STATUS_ONLINE;
+
+ //Now that the plugin data has been filled, we add it to the PopUpData.
+ ppd.PluginData = mpd;
+
+ //Now that every field has been filled, we want to see the popup.
+ CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
+}
+
+Obviously, you have previously declared some:
+static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch(message) {
+ case WM_COMMAND:
+ if ((HIWORD)wParam == STN_CLICKED) { //It was a click on the Popup.
+ PUDeletePopUp(hWnd);
+ return TRUE;
+ }
+ break;
+ case UM_FREEPLUGINDATA: {
+ MY_PLUGIN_DATA * mpd = NULL;
+ mpd = (MY_PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)mpd);
+ if (mdp > 0) mir_free(mpd);
+ return TRUE; //TRUE or FALSE is the same, it gets ignored.
+ }
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+*/
+
+/*
+Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
+wParam = (WPARAM)(*POPUPDATA)PopUpDataAddress
+lParam = 0
+Returns: > 0 on success, 0 if creation went bad, -1 if the PopUpData contained unacceptable values.
+NOTE: it returns -1 if the PopUpData was not valid, if there were already too many popups, if the module was disabled.
+Otherwise, it can return anything else...
+*/
+#define MS_POPUP_ADDPOPUP "PopUp/AddPopUp"
+static int __inline PUAddPopUp(POPUPDATA* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp,0);
+}
+
+#define MS_POPUP_ADDPOPUPEX "PopUp/AddPopUpEx"
+static int __inline PUAddPopUpEx(POPUPDATAEX* ppdp) {
+ return CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)ppdp,0);
+}
+
+/*
+Returns the handle to the contact associated to the specified PopUpWindow.
+You will probably need to know this handle inside your WNDPROC. Exampole: you want to open the MessageWindow. :-)
+Call MS_POPUP_GETCONTACT on the hWnd you were given in the WNDPROC.
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = 0;
+Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure.
+*/
+#define MS_POPUP_GETCONTACT "PopUp/GetContact"
+static HANDLE __inline PUGetContact(HWND hPopUpWindow) {
+ return (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopUpWindow,0);
+}
+
+/*
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(PLUGINDATA*)PluginDataAddress;
+Returns: the address of the PLUGINDATA structure. Can return NULL, meaning nothing was given. -1 means failure.
+IMPORTANT NOTE: it doesn't seem to work if you do:
+CallService(..., (LPARAM)aPointerToAStruct);
+and then use that struct.
+Do this, instead:
+aPointerToStruct = CallService(..., (LPARAM)aPointerToAStruct);
+and it will work. Just look at the example I've written above (PopUpDlgProc).
+*/
+#define MS_POPUP_GETPLUGINDATA "PopUp/GetPluginData"
+static void __inline * PUGetPluginData(HWND hPopUpWindow) {
+ long * uselessPointer = NULL;
+ return (void*)CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hPopUpWindow,(LPARAM)uselessPointer);
+}
+
+/*
+wParam = 0
+lParam = 0
+Returns: 0 if the user has chosen not to have the second line, 1 if he choose to have the second line.
+*/
+#define MS_POPUP_ISSECONDLINESHOWN "PopUp/IsSecondLineShown"
+static BOOL __inline PUIsSecondLineShown() {
+ return (BOOL)CallService(MS_POPUP_ISSECONDLINESHOWN,0,0);
+}
+
+/*
+Requests an action or an answer from PopUp module.
+wParam = (WPARAM)wpQuery
+returns 0 on success, -1 on error, 1 on stupid calls ;-)
+*/
+#define PUQS_ENABLEPOPUPS 1 //returns 0 if state was changed, 1 if state wasn't changed
+#define PUQS_DISABLEPOPUPS 2 // " "
+#define PUQS_GETSTATUS 3 //Returns 1 (TRUE) if popups are enabled, 0 (FALSE) if popups are disabled.
+
+#define MS_POPUP_QUERY "PopUp/Query"
+
+/*
+UM_FREEPLUGINDATA
+wParam = lParam = 0. Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
+*/
+#define UM_FREEPLUGINDATA (WM_USER + 0x0200)
+
+/*
+UM_DESTROYPOPUP
+wParam = lParam = 0. Send this message when you want to destroy the popup, or use the function below.
+*/
+#define UM_DESTROYPOPUP (WM_USER + 0x0201)
+static int __inline PUDeletePopUp(HWND hWndPopUp) {
+ return (int)SendMessage(hWndPopUp, UM_DESTROYPOPUP,0,0);
+}
+
+/*
+UM_INITPOPUP
+wParam = (WPARAM)(HWND)hPopUpWindow (but this is useless, since I'll directly send it to your hPopUpWindow
+lParam = 0.
+This message is sent to the PopUp when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
+Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
+Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
+*/
+#define UM_INITPOPUP (WM_USER + 0x0202)
+
+/*
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(char*)lpzNewText
+returns: > 0 for success, -1 for failure, 0 if the failure is due to second line not being shown. (but you could call PUIsSecondLineShown() before changing the text...)
+Changes the text displayed in the second line of the popup.
+*/
+#define MS_POPUP_CHANGETEXT "PopUp/Changetext"
+static int __inline PUChangeText(HWND hWndPopUp, LPCTSTR lpzNewText) {
+ return (int)CallService(MS_POPUP_CHANGETEXT, (WPARAM)hWndPopUp, (LPARAM)lpzNewText);
+}
+
+/*
+wParam = (WPARAM)(HWND)hPopUpWindow
+lParam = (LPARAM)(POPUPDATAEX*)newData
+Changes the entire popup
+*/
+#define MS_POPUP_CHANGE "PopUp/Change"
+static int __inline PUChange(HWND hWndPopUp, POPUPDATAEX *newData) {
+ return (int)CallService(MS_POPUP_CHANGE, (WPARAM)hWndPopUp, (LPARAM)newData);
+}
+
+/*
+This is mainly for developers.
+Shows a warning message in a PopUp. It's useful if you need a "MessageBox" like function, but you don't want a modal window (which will interfere with a DialogProcedure. MessageBox steals focus and control, this one not.
+wParam = (char*) lpzMessage
+lParam = 0;
+Returns: 0 if the popup was shown, -1 in case of failure.
+*/
+#define SM_WARNING 0x01 //Triangle icon.
+#define SM_NOTIFY 0x02 //Exclamation mark icon.
+#define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage"
+
+static int __inline PUShowMessage(char* lpzText, BYTE kind) {
+ return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind);
+}
+
+/*
+Each skinned popup (e.g. with colorBack == POPUP_USE_SKINNED_BG) should have
+class set. Then you can choose separate skin for each class (for example, you
+can create separate class for your plugin and use it for all ypu popups. User
+would became able to choose skin for your popups independently from others)
+
+You have to register popup class before using it. To do so call "PopUp/AddClass"
+with lParam = (LPARAM)(const char *)popUpClassName.
+
+All class names are translated (via Translate()) before being added to list. You
+should use english names for them.
+
+There are three predefined classes and one for backward compatability.
+
+Note that you can add clases after popup wal loaded, e.g. you shoul intercept
+ME_SYSTEM_MODULESLOADED event
+*/
+#define MS_POPUP_ADDCLASS "PopUp/AddClass"
+#define POPUP_CLASS_DEFAULT "Default"
+#define POPUP_CLASS_WARNING "Warning"
+#define POPUP_CLASS_NOTIFY "Notify"
+#define POPUP_CLASS_OLDAPI "PopUp 1.0.1.x compatability" // for internal purposes
+
+static void __inline PUAddClass(const char *lpzClass){
+ CallService(MS_POPUP_ADDCLASS, 0, (LPARAM)lpzClass);
+}
+
+#endif
diff --git a/miranda-wine/include/m_protocols.h b/miranda-wine/include/m_protocols.h new file mode 100644 index 0000000..30806d7 --- /dev/null +++ b/miranda-wine/include/m_protocols.h @@ -0,0 +1,288 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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
+
+#ifndef M_PROTOCOLS_H__
+#define M_PROTOCOLS_H__ 1
+
+#include "statusmodes.h"
+
+//call a specific protocol service. See the PS_ constants in m_protosvc.h
+__inline static int CallProtoService(const char *szModule,const char *szService,WPARAM wParam,LPARAM lParam)
+{
+ char str[MAXMODULELABELLENGTH];
+ strcpy(str,szModule);
+ strcat(str,szService);
+ return CallService(str,wParam,lParam);
+}
+
+//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 {
+ HANDLE hContact;
+ const char *szProtoService; //a PS_ constant
+ WPARAM wParam;
+ LPARAM lParam;
+} CCSDATA;
+#define MS_PROTO_CALLCONTACTSERVICE "Proto/CallContactService"
+__inline static int CallContactService(HANDLE hContact,const char *szProtoService,WPARAM wParam,LPARAM lParam)
+{
+ CCSDATA ccs;
+ ccs.hContact=hContact;
+ ccs.szProtoService=szProtoService;
+ ccs.wParam=wParam;
+ ccs.lParam=lParam;
+ return CallService(MS_PROTO_CALLCONTACTSERVICE,0,(LPARAM)&ccs);
+}
+
+//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
+ HANDLE 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
+#define ACKTYPE_CHAT 3
+#define ACKTYPE_AWAYMSG 4
+#define ACKTYPE_AUTHREQ 5
+#define ACKTYPE_ADDED 6
+#define ACKTYPE_GETINFO 7
+#define ACKTYPE_SETINFO 8
+#define ACKTYPE_LOGIN 9
+#define ACKTYPE_SEARCH 10
+#define ACKTYPE_NEWUSER 11
+#define ACKTYPE_STATUS 12
+#define ACKTYPE_CONTACTS 13 //send/recv of contacts
+#define ACKTYPE_AVATAR 14 //send/recv of avatars from a protocol
+#define ACKRESULT_SUCCESS 0
+#define ACKRESULT_FAILED 1
+//'in progress' result codes:
+#define ACKRESULT_CONNECTING 100
+#define ACKRESULT_CONNECTED 101
+#define ACKRESULT_INITIALISING 102
+#define ACKRESULT_SENTREQUEST 103 //waiting for reply...
+#define ACKRESULT_DATA 104 //blob of file data sent/recved, or search result
+#define ACKRESULT_NEXTFILE 105 //file transfer went to next file
+#define ACKRESULT_FILERESUME 106 //a file is about to be received, see PS_FILERESUME
+#define ACKRESULT_DENIED 107 //a file send has been denied
+#define ACKRESULT_STATUS 108 //an ack or a series of acks to do with a task have a status change
+#define ME_PROTO_ACK "Proto/Ack"
+
+// v0.3.2+: 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.
+
+//when type==ACKTYPE_FILE && (result==ACKRESULT_DATA || result==ACKRESULT_FILERESUME),
+//lParam points to this
+typedef struct {
+ int cbSize;
+ HANDLE hContact;
+ int sending; //true if sending, false if receiving
+ char **files;
+ int totalFiles;
+ int currentFileNumber;
+ unsigned long totalBytes;
+ unsigned long totalProgress;
+ char *workingDir;
+ char *currentFile;
+ unsigned long currentFileSize;
+ unsigned long currentFileProgress;
+ unsigned long 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.
+//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
+typedef struct {
+ int cbSize;
+ char *szName; //unique name of the module
+ int type; //module type, see PROTOTYPE_ constants
+} 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_ENCRYPTION 2000
+#define PROTOTYPE_FILTER 3000
+#define PROTOTYPE_TRANSLATION 4000
+#define PROTOTYPE_OTHER 10000 //avoid using this if at all possible
+#define MS_PROTO_ENUMPROTOCOLS "Proto/EnumProtocols"
+
+//determines if a protocol module is loaded or not
+//wParam=0
+//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"
+
+//gets the network-level protocol associated with a contact
+//wParam=(WPARAM)(HANDLE)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"
+
+//determines whether the specified contact has the given protocol in its chain
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(const char*)szName
+//Returns nonzero if it does and 0 if it doesn't
+#define MS_PROTO_ISPROTOONCONTACT "Proto/IsProtoOnContact"
+
+#define PROTOTYPE_SELFTYPING_OFF 0
+#define PROTOTYPE_SELFTYPING_ON 1
+//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=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(int)typing state
+//NOTE: Only protocols should generally call this service
+#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=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(int)time (secs)
+//NOTE: The time in seconds is used to tell a message dialog (or other plugin)
+//how long to display its notification. If time is 0, then notification
+//of typing ends.
+//NOTE: Only protocols should generally call this service
+#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
+//that the hContact is not NULL and the the user wishes to send notifications
+//to this user (checked visibility, individual typing blocking, etc).
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(int)typing state
+#define ME_PROTO_CONTACTISTYPING "Proto/ContactIsTypingEvent"
+
+
+/* -------------- avatar support ---------------------
+
+First a protocol must report it supports PF4_AVATARS via PS_GETCAPS, secondly
+it will return the following acks for certain events, the protocol must use
+ProtoBroadcastAck(), listeners must hook ME_PROTO_ACK, note that lParam = ACKDATA*
+
+*/
+
+/*
+
+ The following ACKs MUST be sent in order of .result via ProtoBroadcastAck()
+
+ .szModule = protocol module
+ .hContact = contact the avatar is for, or 0 if its for the user
+ .type = ACKTYPE_AVATAR
+ .result = ACKRESULT_CONNECTING, ACKRESULT_CONNECTED, ACKRESULT_SENTREQUEST, ACKRESULT_DATA
+ .hProcess = protocol specific
+ .lParam = 0
+
+ Once the transfer is complete the following ACKs MUST be sent by the protocol
+
+ .result = ACKRESULT_SUCCESS or ACKRESULT_FAILED
+ .hProcess = (HANDLE) &PROTO_AVATAR_INFORMATION
+ .lParam = 0;
+
+ Anytime before or during the ack or series of acks ACKRESULT_STATUS maybe sent, this might
+ be sent a long while before anything else happens (or after anything happening) For avatars
+ it allows callers to identify status information to do with the avatar, including the time
+ before background transport has been created, so that you know an avatar will be exchanged
+ sometime in the future.
+
+ 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.
+
+*/
+
+#define PA_FORMAT_UNKNOWN 0 // the protocol can not determine much about the "bitmap"
+#define PA_FORMAT_PNG 1 // the image is PNG
+#define PA_FORMAT_JPEG 2
+#define PA_FORMAT_ICON 3
+#define PA_FORMAT_BMP 4
+#define PA_FORMAT_GIF 5
+#define PA_FORMAT_SWF 6
+#define PA_FORMAT_XML 7
+
+typedef struct {
+ int cbSize; // sizeof()
+ HANDLE hContact; // this might have to be set by the caller too
+ int format; // PA_FORMAT_*
+ char filename[MAX_PATH]; // full path to filename which contains the avatar
+} PROTO_AVATAR_INFORMATION;
+
+#define GAIF_FORCE 1 // force an update of the avatar if there is none
+
+#define GAIR_SUCCESS 0 // information about the avatar has been returned
+#define GAIR_WAITFOR 1 // you must hook ME_PROTO_ACK and wait for replies about avatar status
+#define GAIR_NOAVATAR 2 // sorry, this contact has no avatars
+
+/*
+ wParam : GAIF_*
+ lParam : (LPARAM) &PROTO_AVATAR_INFORMATION
+ Affect : Make a request to the protocol to return information about a hContact's avatar (or main user)
+ it can return information, tell you there is none, or if forced start requesting an avatar.
+ Note:
+ Version: 0.3.4+ (2004/09/13)
+*/
+#define PS_GETAVATARINFO "/GetAvatarInformation"
+
+
+#endif // M_PROTOCOLS_H
+
+
diff --git a/miranda-wine/include/m_protomod.h b/miranda-wine/include/m_protomod.h new file mode 100644 index 0000000..9ab90c1 --- /dev/null +++ b/miranda-wine/include/m_protomod.h @@ -0,0 +1,134 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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 "m_protocols.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() 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=(WPARAM)(HANDLE)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=(WPARAM)(HANDLE)hContact
+//lParam=(LPARAM)(const char*)szName
+//returns 0 on success, nonzero on failure
+#define MS_PROTO_REMOVEFROMCONTACT "Proto/RemoveFromContact"
+
+//Create a protocol service
+//Protocol services are called with wParam and lParam as standard if they are
+//to be called with CallProtoService() (as PS_ services are)
+//If they are called with CallContactService() (PSS_ and PSR_ services) then
+//they are called with lParam=(CCSDATA*)&ccs and wParam an opaque internal
+//reference that should be passed unchanged to MS_PROTO_CHAIN*.
+__inline static HANDLE CreateProtoServiceFunction(const char *szModule,const char *szService,MIRANDASERVICE serviceProc)
+{
+ char str[MAXMODULELABELLENGTH];
+ strcpy(str,szModule);
+ strcat(str,szService);
+ return CreateServiceFunction(str,serviceProc);
+}
+
+//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"
+
+//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"
+__inline static int ProtoBroadcastAck(const char *szModule,HANDLE hContact,int type,int result,HANDLE hProcess,LPARAM lParam)
+{
+ ACKDATA ack={0};
+ ack.cbSize=sizeof(ACKDATA);
+ ack.szModule=szModule; ack.hContact=hContact;
+ ack.type=type; ack.result=result;
+ ack.hProcess=hProcess; ack.lParam=lParam;
+ return CallService(MS_PROTO_BROADCASTACK,0,(LPARAM)&ack);
+}
+
+/* -- Added during 0.3.4 (2004/09/27) development! -----
+*/
+
+/*
+ wParam: (HANDLE)hContact
+ lParam: 0
+ Affect: Given a hContact, return the protocol that is registered for it, or NULL if no such protocol exists,
+ the returned string does not have to be freed and is valid even for multiple threads.
+ Note: Prior to 2004/09/28 this service WAS NOT THREAD SAFE and was slower
+ Note: Prior to 2004/09/28 this service would return NULL for a hContact if the protocol module
+ associated with the hContact was not currently loaded, no such check is performed now.
+ Version: 0.3.4 (2004/09/28)
+*/
+#define MS_PROTODIR_PROTOFROMCONTACT MS_PROTO_GETCONTACTBASEPROTO
+
+#endif // M_PROTOMOD_H__
+
+
diff --git a/miranda-wine/include/m_protosvc.h b/miranda-wine/include/m_protosvc.h new file mode 100644 index 0000000..9ef43df --- /dev/null +++ b/miranda-wine/include/m_protosvc.h @@ -0,0 +1,635 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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"
+
+/*************************** NON-CONTACT SERVICES ************************/
+//these should be called with CallProtoService()
+
+//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 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.
+
+#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 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<ID_STATUS_CONNECTING+
+//MAX_CONNECT_RETRIES to signify that it's connecting and it's the nth retry.
+//Protocols are initially always in offline mode.
+//Non-network-level protocol modules do not have the concept of a status and
+//should leave this service unimplemented
+//If a protocol doesn't support the specific status mode, it should pick the
+//closest one that it does support, and change to that.
+//If the new mode requires that the protocol switch from offline to online then
+//it will do so, but errors will be reported in the form of an additional ack:
+//type=ACKTYPE_LOGIN, result=ACKRESULT_FAILURE, hProcess=NULL, lParam=LOGINERR_
+// (added during 0.3.4.3) the protocol will send LOGINERR_OTHERLOCATION if the login
+// was disconnected because of a login at another location
+#define LOGINERR_WRONGPASSWORD 1
+#define LOGINERR_NONETWORK 2
+#define LOGINERR_PROXYFAILURE 3
+#define LOGINERR_BADUSERID 4
+#define LOGINERR_NOSERVER 5
+#define LOGINERR_TIMEOUT 6
+#define LOGINERR_WRONGPROTOCOL 7
+#define LOGINERR_OTHERLOCATION 8
+//protocols may define more error codes starting at 1000
+#define PS_SETSTATUS "/SetStatus"
+
+//Sets the status-mode specific message for yourself
+//wParam=status mode
+//lParam=(LPARAM)(const char*)szMessage
+//Returns 0 on success, nonzero on failure
+//Note that this service will not be available unless PF1_MODEMSGSEND is set
+//and PF1_INDIVMODEMSG is *not* set.
+//If PF1_INDIVMODEMSG is set, then see PSS_AWAYMSG for details of
+//the operation of away messages
+//Protocol modules must support szMessage=NULL. It may either mean to use an
+//empty message, or (preferably) to not reply at all to any requests
+#define PS_SETAWAYMSG "/SetAwayMsg"
+
+//Get the status mode that a protocol is currently in
+//wParam=lParam=0
+//Returns the status mode
+//Non-network-level protocol modules do not have the concept of a status and
+//should leave this service unimplemented
+#define PS_GETSTATUS "/GetStatus"
+
+//Allow somebody to add us to their contact list
+//wParam=(WPARAM)(HANDLE)hDbEvent
+//lParam=0
+//Returns 0 on success, nonzero on failure
+//Auth requests come in the form of an event added to the database for the NULL
+//user. The form is:
+//DWORD protocolSpecific
+//ASCIIZ nick, firstName, lastName, e-mail, requestReason
+//hDbEvent must be the handle of such an event
+//One or more fields may be empty if the protocol doesn't support them
+#define PS_AUTHALLOW "/Authorize"
+
+//Deny an authorisation request
+//wParam=(WPARAM)(HANDLE)hDbEvent
+//lParam=(LPARAM)(const char*)szReason
+//Returns 0 on success, nonzero on failure
+//Protocol modules must be able to cope with szReason=NULL
+#define PS_AUTHDENY "/AuthDeny"
+
+// Send a "You were added" event
+// wParam=lParam=0
+// Returns 0 on success, nonzero on failure
+#define PSS_ADDED "/YouWereAdded"
+
+//Send a basic search request
+//wParam=0
+//lParam=(LPARAM)(const char*)szId
+//Returns a handle for the search, or zero on failure
+//All protocols identify users uniquely by a single field. This service will
+//search by that field.
+//Note that if users are identified by an integer (eg ICQ) szId should be a
+//string containing that integer, not the integer itself.
+//All search replies (even protocol-specific extended searches) are replied by
+//means of a series of acks:
+//result acks, one of more of:
+//type=ACKTYPE_SEARCH, result=ACKRESULT_DATA, lParam=(LPARAM)(PROTOSEARCHRESULT*)&psr
+//ending ack:
+//type=ACKTYPE_SEARCH, result=ACKRESULT_SUCCESS, lParam=0
+//Note that the pointers in the structure are not guaranteed to be valid after
+//the ack is complete.
+typedef struct {
+ int cbSize;
+ char *nick;
+ char *firstName;
+ char *lastName;
+ char *email;
+ char reserved[16];
+ //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.
+} PROTOSEARCHRESULT;
+#define PS_BASICSEARCH "/BasicSearch"
+
+//Search for users by e-mail address v0.1.2.1+
+//wParam=0
+//lParam=(LPARAM)(char*)szEmail
+//Returns a HANDLE to the search, or NULL on failure
+//Results are returned as for PS_BASICSEARCH.
+//This function is only available if the PF1_SEARCHBYEMAIL capability is set
+//If the PF1_USERIDISEMAIL capability is set then this function and
+//PS_BASICSEARCH should have the same result (and it's best if they are the
+//same function).
+#define PS_SEARCHBYEMAIL "/SearchByEmail"
+
+//Search for users by name v0.1.2.1+
+//wParam=0
+//lParam=(LPARAM)(PROTOSEARCHBYNAME*)&psbn
+//Returns a HANDLE to the search, or NULL on failure
+//Results are returned as for PS_BASICSEARCH.
+//This function is only available if the PF1_SEARCHBYNAME capability is set
+typedef struct {
+ char *pszNick;
+ char *pszFirstName;
+ char *pszLastName;
+} PROTOSEARCHBYNAME;
+#define PS_SEARCHBYNAME "/SearchByName"
+
+//Create the advanced search dialog box v0.1.2.1+
+//wParam=0
+//lParam=(HWND)hwndOwner
+//Returns a HWND, or NULL on failure
+//This function is only available if the PF1_EXTSEARCHUI capability is set
+//Advanced search is very protocol-specific so it is left to the protocol
+//itself to supply a dialog containing the options. This dialog should not
+//have a title bar and contain only search fields. The rest of the UI is
+//supplied by Miranda.
+//The dialog should be created with CreateDialog() or its kin and still be
+//hidden when this function returns.
+//The dialog will be destroyed when the find/add dialog is closed.
+#define PS_CREATEADVSEARCHUI "/CreateAdvSearchUI"
+
+//Search using the advanced search dialog v0.1.2.1+
+//wParam=0
+//lParam=(LPARAM)(HWND)hwndAdvancedSearchDlg
+//Returns a HANDLE to the search, or NULL on failure
+//Results are returned as for PS_BASICSEARCH.
+//This function is only available if the PF1_EXTSEARCHUI capability is set
+#define PS_SEARCHBYADVANCED "/SearchByAdvanced"
+
+//Adds a search result to the contact list
+//wParam=flags
+//lParam=(LPARAM)(PROTOSEARCHRESULT*)&psr
+//Returns a HANDLE to the new contact, or NULL on failure
+//psr must be a result returned by a search function, since the extended
+//information past the end of the official structure may contain important
+//data required by the protocol.
+//The protocol library should not allow duplicate contacts to be added, but if
+//such a request is received it should return the original hContact, and do the
+//appropriate thing with the temporary flag (ie newflag=(oldflag&thisflag))
+#define PALF_TEMPORARY 1 //add the contact temporarily and invisibly, just to get user info or something
+#define PS_ADDTOLIST "/AddToList"
+
+//Adds a contact to the contact list given an auth, added or contacts event
+//wParam=MAKEWPARAM(flags,iContact)
+//lParam=(LPARAM)(HANDLE)hDbEvent
+//Returns a HANDLE to the new contact, or NULL on failure
+//hDbEvent must be either EVENTTYPE_AUTHREQ or EVENTTYPE_ADDED
+//flags are the same as for PS_ADDTOLIST.
+//iContact is only used for contacts events. It is the 0-based index of the
+//contact in the event to add. There is no way to add two or more contacts at
+//once, you should just do lots of calls.
+#define PS_ADDTOLISTBYEVENT "/AddToListByEvent"
+
+//Changes our user details as stored on the server v0.1.2.0+
+//wParam=infoType
+//lParam=(LPARAM)(void*)pInfoData
+//Returns a HANDLE to the change request, or NULL on failure
+//The details information that is stored on the server is very protocol-
+//specific, so this service just supplies an outline for protocols to use.
+//See protocol-specific documentation for what infoTypes are available and
+//what pInfoData should be for each infoType.
+//Sends an ack type=ACKTYPE_SETINFO, result=ACKRESULT_SUCCESS/FAILURE,
+//lParam=0 on completion.
+#define PS_CHANGEINFO "/ChangeInfo"
+
+//Informs the protocol of the users chosen resume behaviour v0.1.2.2+
+//wParam=(WPARAM)(HANDLE)hFileTransfer
+//lParam=(LPARAM)(PROTOFILERESUME*)&pfr
+//Returns 0 on success, nonzero on failure
+//If the protocol supports file resume (PF1_FILERESUME) then before each
+//individual file receive begins (note: not just each file that already exists)
+//it will broadcast an ack with type=ACKTYPE_FILE, result=ACKRESULT_RESUME,
+//hProcess=hFileTransfer, lParam=(LPARAM)(PROTOFILETRANSFERSTATUS*)&fts. If the
+//UI processes this ack it must return nonzero from its hook. If all the hooks
+//complete without returning nonzero then the protocol will assume that no
+//resume UI was available and will continue the file receive with a default
+//behaviour (overwrite for ICQ). If a hook does return nonzero then that UI
+//must call this function, PS_FILERESUME, at some point. When the protocol
+//module receives this call it will proceed with the file receive using the
+//given information.
+//Having said that PS_FILERESUME must be called, it is also acceptable to call
+//PSS_FILECANCEL to completely abort the transfer instead.
+#define FILERESUME_OVERWRITE 1
+#define FILERESUME_RESUME 2
+#define FILERESUME_RENAME 3
+#define FILERESUME_SKIP 4
+typedef struct {
+ int action; //a FILERESUME_ flag
+ const char *szFilename; //full path. Only valid if action==FILERESUME_RENAME
+} PROTOFILERESUME;
+#define PS_FILERESUME "/FileResume"
+
+/****************************** SENDING SERVICES *************************/
+//these should be called with CallContactService()
+
+//Updates a contact's details from the server
+//wParam=flags
+//lParam=0
+//returns 0 on success, nonzero on failure
+//Will update all the information in the database, and then send acks with
+//type=ACKTYPE_GETINFO, result=ACKRESULT_SUCCESS, hProcess=(HANDLE)(int)nReplies, lParam=thisReply
+//Since some protocols do not allow the library to tell when it has got all
+//the information so it can send a final ack, one ack will be sent after each
+//chunk of data has been received. nReplies contains the number of distinct
+//acks that will be sent to get all the information, thisReply is the zero-
+//based index of this ack. When thisReply=0 the 'minimal' information has just
+//been received. All other numbering is arbitrary.
+#define SGIF_MINIMAL 1 //get only the most basic information. This should
+ //contain at least a Nick and e-mail.
+#define SGIF_ONOPEN 2 //set when the User Info form is being opened
+#define PSS_GETINFO "/GetInfo"
+
+//Send an instant message
+//wParam=flags
+//lParam=(LPARAM)(const char*)szMessage
+//returns a hProcess corresponding to the one in the ack event.
+//Will send an ack when the message actually gets sent
+//type=ACKTYPE_MESSAGE, result=success/failure, lParam=0
+//Protocols modules are free to define flags starting at 0x10000
+//The event will *not* be added to the database automatically.
+#define PSS_MESSAGE "/SendMsg"
+
+//Send an URL message
+//wParam=flags
+//lParam=(LPARAM)(const char*)szMessage
+//returns a hProcess corresponding to the one in the ack event.
+//szMessage should be encoded as the URL followed by the description, the
+//separator being a single nul (\0). If there is no description, do not forget
+//to end the URL with two nuls.
+//Will send an ack when the message actually gets sent
+//type=ACKTYPE_URL, result=success/failure, lParam=0
+//Protocols modules are free to define flags starting at 0x10000
+//The event will *not* be added to the database automatically.
+#define PSS_URL "/SendUrl"
+
+//Send a set of contacts
+//wParam=MAKEWPARAM(flags,nContacts)
+//lParam=(LPARAM)(HANDLE*)hContactsList
+//returns a hProcess corresponding to the one in the ack event, NULL on
+//failure.
+//hContactsList is an array of nContacts handles to contacts. If this array
+//includes one or more contacts that cannot be transferred using this protocol
+//the function will fail.
+//Will send an ack when the contacts actually get sent
+//type=ACKTYPE_CONTACTS, result=success/failure, lParam=0
+//No flags have yet been defined.
+//The event will *not* be added to the database automatically.
+#define PSS_CONTACTS "/SendContacts"
+
+//Send a request to retrieve somebody's mode message.
+//wParam=lParam=0
+//returns an hProcess identifying the request, or 0 on failure
+//This function will fail if the contact's current status mode doesn't have an
+//associated message
+//The reply will be in the form of an ack:
+//type=ACKTYPE_AWAYMSG, result=success/failure, lParam=(const char*)szMessage
+#define PSS_GETAWAYMSG "/GetAwayMsg"
+
+//Sends an away message reply to a user
+//wParam=(WPARAM)(HANDLE)hProcess (of ack)
+//lParam=(LPARAM)(const char*)szMessage
+//Returns 0 on success, nonzero on failure
+//This function must only be used if the protocol has PF1_MODEMSGSEND and
+//PF1_INDIVMODEMSG set. Otherwise, PS_SETAWAYMESSAGE should be used.
+//This function must only be called in response to an ack that a user has
+//requested our away message. The ack is sent as:
+//type=ACKTYPE_AWAYMSG, result=ACKRESULT_SENTREQUEST, lParam=0
+#define PSS_AWAYMSG "/SendAwayMsg"
+
+//Allows a file transfer to begin
+//wParam=(WPARAM)(HANDLE)hTransfer
+//lParam=(LPARAM)(const char*)szPath
+//Returns a new handle to the transfer, to be used from now on
+//If szPath does not point to a directory then:
+// if a single file is being transferred and the protocol supports file
+// renaming (PF1_CANRENAMEFILE) then the file is given this name
+// otherwise the filename is removed and the file(s) are placed in the
+// resulting directory
+//File transfers are marked by an EVENTTYPE_FILE added to the database. The
+//format is:
+//DWORD hTransfer
+//ASCIIZ filename(s), description
+#define PSS_FILEALLOW "/FileAllow"
+
+//Refuses a file transfer request
+//wParam=(WPARAM)(HANDLE)hTransfer
+//lParam=(LPARAM)(const char*)szReason
+//Returns 0 on success, nonzero on failure
+#define PSS_FILEDENY "/FileDeny"
+
+//Cancel an in-progress file transfer
+//wParam=(WPARAM)(HANDLE)hTransfer
+//lParam=0
+//Returns 0 on success, nonzero on failure
+#define PSS_FILECANCEL "/FileCancel"
+
+//Initiate a file send
+//wParam=(WPARAM)(const char*)szDescription
+//lParam=(LPARAM)(char **)ppszFiles
+//Returns a transfer handle on success, NULL on failure
+//All notification is done through acks, with type=ACKTYPE_FILE
+//If result=ACKRESULT_FAILED then lParam=(LPARAM)(const char*)szReason
+#define PSS_FILE "/SendFile"
+
+//Set the status mode you will appear in to a user
+//wParam=statusMode
+//lParam=0
+//Returns 0 on success, nonzero on failure
+//Set statusMode=0 to revert to normal behaviour for the contact
+//ID_STATUS_ONLINE is possible iff PF1_VISLIST
+//ID_STATUS_OFFLINE is possible iff PF1_INVISLIST
+//Other modes are possible iff PF1_INDIVSTATUS
+#define PSS_SETAPPARENTMODE "/SetApparentMode"
+
+// Send an auth request
+// wParam=0
+// lParam=(const char *)szMessage
+// Returns 0 on success, nonzero on failure
+#define PSS_AUTHREQUEST "/AuthRequest"
+
+// Send "User is Typing" (user is typing a message to the user) v0.3.3+
+// wParam=(WPARAM)(HANDLE)hContact
+// lParam=(LPARAM)(int)typing type - see PROTOTYPE_SELFTYPING_X defines in m_protocols.h
+#define PSS_USERISTYPING "/UserIsTyping"
+
+/**************************** RECEIVING SERVICES *************************/
+//These services are not for calling by general modules. They serve a specific
+//role in communicating through protocol module chains before the whole app is
+//notified that an event has occurred.
+//When the respective event is received over the network, the network-level
+//protocol module initiates the chain by calling MS_PROTO_CHAINRECV with wParam
+//set to zero and lParam pointing to the CCSDATA structure.
+//Protocol modules should continue the message up the chain by calling
+//MS_PROTO_CHAINRECV with the same wParam they received and a modified (or not)
+//lParam (CCSDATA). If they do not do this and return nonzero then all further
+//processing for the event will cease and the event will be ignored.
+//Once all non-network protocol modules have been called (in reverse order),
+//the network protocol module will be called so that it can finish its
+//processing using the modified information.
+//This final processing should consist of the protocol module adding the
+//event to the database, and it is the ME_DB_EVENT_ADDED event that people who
+//just want to know the final result should hook.
+//In all cases, the database should store what the user read/wrote.
+
+//An instant message has been received
+//wParam=0
+//lParam=(LPARAM)(PROTORECVEVENT*)&pre
+//DB event: EVENTTYPE_MESSAGE, blob contains szMessage without 0 terminator
+typedef struct {
+ DWORD flags;
+ DWORD timestamp; //unix time
+ char *szMessage;
+ LPARAM lParam; //extra space for the network level protocol module
+} PROTORECVEVENT;
+#define PREF_CREATEREAD 1 //create the database event with the 'read' flag set
+#define PREF_UNICODE 2
+#define PREF_RTL 4 // 0.5+ addition: support for right-to-left messages
+#define PSR_MESSAGE "/RecvMessage"
+
+//An URL has been received
+//wParam=0
+//lParam=(LPARAM)(PROTORECVEVENT*)&pre
+//szMessage is encoded the same as for PSS_URL
+//DB event: EVENTTYPE_URL, blob contains szMessage without 0 terminator
+#define PSR_URL "/RecvUrl"
+
+//Contacts have been received
+//wParam=0
+//lParam=(LPARAM)(PROTORECVEVENT*)&pre
+//pre.szMessage is actually a (PROTOSEARCHRESULT**) list.
+//pre.lParam is the number of contacts in that list.
+//PS_ADDTOLIST can be used to add the contacts to the contact list.
+#define PSR_CONTACTS "/RecvContacts"
+
+/* contacts database event format (EVENTTYPE_CONTACTS)
+repeat {
+ ASCIIZ userNick
+ ASCIIZ userId
+}
+userNick should be a human-readable description of the user. It need not
+be the nick, or even confined to displaying just one type of
+information.
+userId should be a machine-readable representation of the unique
+protocol identifying field of the user. Because of the need to be
+zero-terminated, binary data should be converted to text.
+Use PS_ADDTOLISTBYEVENT to add the contacts from one of these to the list.
+*/
+
+//File(s) have been received
+//wParam=0
+//lParam=(LPARAM)(PROTORECVFILE*)&prf
+typedef struct {
+ DWORD flags;
+ DWORD timestamp; //unix time
+ char *szDescription;
+ char **pFiles;
+ LPARAM lParam; //extra space for the network level protocol module
+} PROTORECVFILE;
+#define PSR_FILE "/RecvFile"
+
+//An away message reply has been received
+//wParam=statusMode
+//lParam=(LPARAM)(PROTORECVEVENT*)&pre
+#define PSR_AWAYMSG "/RecvAwayMsg"
+
+//An authorization request has been received
+//wParam=0
+//lParam=(LPARAM)(PROTORECVEVENT*)&pre
+//pre.szMessage is same format as blob
+//pre.lParam is the size of the blob
+#define PSR_AUTH "/RecvAuth"
+
+#endif // M_PROTOSVC_H__
diff --git a/miranda-wine/include/m_sessions.h b/miranda-wine/include/m_sessions.h new file mode 100644 index 0000000..ca38998 --- /dev/null +++ b/miranda-wine/include/m_sessions.h @@ -0,0 +1,343 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_SESSION_H__
+#define M_SESSION_H__ 1
+
+/* Pipe Messages */
+
+/*
+ szEntity=szUI, szProto (always != NULL)
+ hSession=yes
+
+ A new entity handle is about to be created to bind .szUI for usage by .szProto,
+ note that this handle is not yet in the handle list and the .szProto will
+ get the message first, then the .szUI will.
+
+ .szUI must set up any instance data within the given hSession,
+ this is done with Sion_EntityCookieSet(hSession,SDR_UI,data).
+
+ .szProto may also set up data to associate with the given hSession,
+ this is done with Sion_EntityCookieSet(hSession,SDR_PROTO,data);
+
+ This message is always sent from the main thread (a thread context switch
+ occurs if needed).
+
+*/
+#define ENTITY_CREATE 1
+#define ENTITY_DESTROY 2
+
+/* Services/Hooks */
+
+/* either .dwTo, dwFrom may have an SDR_* type, and SDR_* flag */
+#define SDR_ALL 1
+#define SDR_SION 2
+#define SDR_PROTO 3
+#define SDR_UI 4
+
+/* you may extend this structure but .cbSize must stay and the reserved data
+at the end of the structure must not be rewritten into */
+struct PIPE_DATA {
+ int cbSize;
+ char *szEntity; // can be NULL
+ HANDLE hSession; // ""
+ DWORD dwMsg;
+ DWORD dwTo, dwFrom; // SDR_*, SDR_ALL is not a good thing
+ WPARAM wParam;
+ LPARAM lParam;
+ DWORD reserved[2]; // is actually apart of the structure and is used internally
+};
+
+/*
+wParam=0
+lParam=(LPARAM)&PIPE_DATA
+
+Issue a call to an entity by name, type or to everyone, if you send
+a message to an entity by name, e.g. "ICQ" it will only goto "ICQ" and not
+to anyone else.
+*/
+#define MS_SION_PIPE "Sion/PipeCall"
+
+/*
+wParam=0
+lParam=(LPARAM)&PIPE_DATA
+
+Begin your lovely relationship with everyone else who began a relationship
+before you, uh.. fill a pipe data structure and call this service :
+
+struct PIPE_DATA pd;
+pd.cbSize=sizeof(pd);
+pd.dwTo=SDR_PROTO;
+pd.szEntity="ICQ";
+pd.lParam=(MIRANDASERVICE)MyCallback;
+CallService(MS_SION_PIPEHOOK,0,(LPARAM)&pd);
+
+The service returns 0 on success and non zero on failure, once you have registered either as a UI or a protocol
+your MIRANDASERVICE will be called on the event on a pipe message that is
+either directed to your entity name (.szEntity!=NULL) or by SDR_* type.
+
+Note that the entity name may not be yours, but the pipe system may of been
+instructed to issue the call with the caller's entity name given to you, because
+you know what your entity name is already, you should not rely on .szEntity
+being anything, but if it is there, the message is for you only and no one else
+will get it and the value of .szEntity is dependant on the message.
+
+*/
+#define MS_SION_PIPEHOOK "Sion/PipeHook"
+
+/*
+wParam=0
+lParam=(LPARAM)&SION_ENTITY_DESCRIPTOR
+
+Create an entity handle binded to .szUI and for .szProto, this service will
+switch threads if it needs to to send ENTITY_CREATE to both .szUI and .szProto
+*/
+struct SION_ENTITY_DESCRIPTOR {
+ int cbSize;
+ char *szUI;
+ char *szProto;
+ HANDLE hSession; // returned if successful
+};
+#define MS_SION_ENTITY_CREATE "Sion/EntityCreate"
+
+/*
+wParam=0
+lParam=(LPARAM)HANDLE
+
+Decrement the given handle reference count by one, this will cause the
+handle to be freed if the reference count reaches zero, if this is the case
+there will be a thread switch to the main thread (if not called from the main thread)
+
+During handle shutdown, ENTITY_DESTROY will be sent to the protocol and then the UI,
+note that you do not need to give .szUI or .szProto because the handle knows
+who it is binded to.
+*/
+#define MS_SION_ENTITY_RELEASE "Sion/EntityRelease"
+
+/*
+wParam=0
+lParam=HANDLE
+
+Add one to the reference count of HANDLE.
+*/
+#define MS_SION_ENTITY_CLONE "Sion/EntityClone"
+
+/*
+wParam=0
+lParam=&SION_ENTITY_COOKIE
+
+Given a .hSession and a .dwSdr (SDR_*) code get/set a cookie pointer,
+if you pass data=NULL, then the current data stored for (SDR_*) will be
+returned, if you want to wipe that data, set persist=0
+
+Note that this function is now thread safe for SDR_UI, SDR_PROTO, SDR_SION,
+also note that UI's must store their instance data using this method.
+
+*/
+struct SION_ENTITY_COOKIE {
+ int cbSize;
+ HANDLE hSession;
+ DWORD dwSdr; // SDR_* type to store data against, this can be SDR_UI or SDR_PROTO
+ void *data; // can be NULL
+ int persist; // if TRUE and data is NULL then data will not be wiped
+};
+#define MS_SION_ENTITY_SETCOOKIE "Sion/EntitySetCookie"
+
+/*
+wParam=0
+lParam=&SION_ENTITY_COOKIE
+
+Given .data and SDR_code, finds the associated .hSession and returns
+a reference to it, note that .data can not be NULL, .dwSdr is used
+to match the type of cookie.
+
+*/
+#define MS_SION_ENTITY_FINDCOOKIE "Sion/EntityFindCookie"
+
+/* -- Helper functions -- */
+
+__inline int Sion_PipeRegister(DWORD dwSdr,char *szEntity,MIRANDASERVICE pfnService)
+{
+ struct PIPE_DATA pd;
+ pd.cbSize=sizeof(struct PIPE_DATA);
+ pd.dwTo=dwSdr;
+ pd.szEntity=szEntity;
+ pd.lParam=(LPARAM)pfnService;
+ return CallService(MS_SION_PIPEHOOK,0,(LPARAM)&pd);
+}
+
+__inline HANDLE Sion_EntityCreate(char *szProto, char *szUI)
+{
+ struct SION_ENTITY_DESCRIPTOR sed;
+ sed.cbSize=sizeof(sed);
+ sed.szProto=szProto;
+ sed.szUI=szUI;
+ sed.hSession=NULL;
+ if (!CallService(MS_SION_ENTITY_CREATE,0,(LPARAM)&sed) && sed.hSession) {
+ return sed.hSession;
+ }
+ return NULL;
+}
+
+__inline int Sion_EntityRelease(HANDLE seh)
+{
+ return CallService(MS_SION_ENTITY_RELEASE,0,(LPARAM)seh);
+}
+
+__inline int Sion_EntityClone(HANDLE seh)
+{
+ return CallService(MS_SION_ENTITY_CLONE,0,(LPARAM)seh);
+}
+
+__inline void* Sion_EntityCookieGet(HANDLE seh, DWORD dwSdr)
+{
+ struct SION_ENTITY_COOKIE sec;
+ sec.cbSize=sizeof(sec);
+ sec.hSession=seh;
+ sec.dwSdr=dwSdr;
+ sec.data=NULL;
+ sec.persist=1;
+ CallService(MS_SION_ENTITY_SETCOOKIE,0,(LPARAM)&sec);
+ return sec.data;
+}
+
+__inline int Sion_EntityCookieSet(HANDLE seh, DWORD dwSdr, void* cookie)
+{
+ struct SION_ENTITY_COOKIE sec;
+ sec.cbSize=sizeof(sec);
+ sec.hSession=seh;
+ sec.dwSdr=dwSdr;
+ sec.data=cookie;
+ sec.persist=0;
+ return CallService(MS_SION_ENTITY_SETCOOKIE,0,(LPARAM)&sec);
+}
+
+__inline HANDLE Sion_EntityCookieFind(DWORD dwSdr, void* cookie)
+{
+ struct SION_ENTITY_COOKIE sec;
+ sec.cbSize=sizeof(sec);
+ sec.hSession=NULL;
+ sec.dwSdr=dwSdr;
+ sec.data=cookie;
+ CallService(MS_SION_ENTITY_FINDCOOKIE,0,(LPARAM)&sec);
+ return sec.hSession;
+}
+
+__inline int Sion_PipeBroadcast(char* szEntity, HANDLE hSession, DWORD dwMsg,
+ WPARAM wParam, LPARAM lParam, DWORD dwFrom, DWORD dwTo) {
+ struct PIPE_DATA pd;
+ pd.cbSize=sizeof(struct PIPE_DATA);
+ pd.szEntity=szEntity;
+ pd.hSession=hSession;
+ pd.dwMsg=dwMsg;
+ pd.dwTo=dwTo;
+ pd.dwFrom=dwFrom;
+ pd.wParam=wParam;
+ pd.lParam=lParam;
+ return CallService(MS_SION_PIPE,0,(LPARAM)&pd);
+}
+
+/*
+
+--Pipe Convos--
+
+The following is the planned pathway message, not all may make
+it to the final draft.
+
+Because of the nature of some protocols, there are some
+messages that some protocols can ignore since they have no meaning.
+
+SION : sends ENTITY_CREATE after creating a temporary entity handle
+PROTO,
+UI : both UI and protocol store structures as cookies within the handle
+ which it can later fetch. At this point the UI is assumed single
+ contact.
+
+SION : sends a message to the protocol to let it know it should allocate transport
+PROTO: the proto can assume this from ENTITY_CREATE, but I'm not sure this a good idea.
+
+PROTO: Protocol needs to send a message to tell the UI about basic channel stuff
+ like if it is multiple contact from the start (IRC style) or open to change
+ (MSN style) or if it is private and restricted in all forms of JOIN, INVITE, etc.
+UI : Can use this message to present information in a 2 person format even if
+ the protocol level is widly different.
+
+
+SION : ATTACH_CHANNEL or ATTACH_CONTACT
+PROTO: will send "JOIN" or "INVITE" to request a join/a contact
+ this maybe on the transport just created above.
+ These two messages will be have a HPROCESS code
+ that must be acknowledged later.
+
+ Note that if the protocol does not require contacts
+ to be attached in this way (invited) then just fake the
+ ATTACHED_* messages.
+
+ The contacts(s) will be shown in the channel at the UI level
+ even if they are not yet within the channel at the protocol
+ level.
+
+PROTO: sends ATTACHED_CHANNEL or ATTACHED_CONTACT with the HPROCESS
+ code given by the ATTACH_* messages, this is to signal
+ that the JOIN was successful or that the invited contact
+ has joined.
+
+ Note that there maybe more than one ATTACHED_* message.
+
+PROTO: sends a CHANNEL_WHOLIST
+UI : is supposed to listen out for this WHOLIST and present
+ a list of people already inside the channel.
+
+ if for a single user, the channel list maybe hidden.
+
+PROTO: sends a CHANNEL_TOPIC
+UI : displays the topic inside the channel, this message is optional and may not be sent
+
+PROTO: sends a CHANNEL_MODE
+UI : displays the modes that the channel is in, the modes still have to be abstracted
+ to Miranda, e.g. IRC mode +M have another Miranda spec flag.
+
+PROTO: sends a CHANNEL_DONE
+UI : the UI is now sure that no more messages are expected.
+
+UI : sends a UI_TEXT message, with optional source HCONTACT and of course the message.
+PROTO: picks up on this message and transmits it, it must return
+ a HPROCESS code that is later acknowledged.
+
+ It is upto the protocol if it processes this message with the protocol
+ send chain.
+
+PROTO: sends a UI_TEXTED with HPROCESS code given above
+UI : the UI may show the message as 'sent' or show nothing to the user.
+
+UI : sends UI_IAMTYPING
+PROTO: the protocol may or may not send this message to the other parties
+ but it must process it, this message is also optional.
+
+PROTO: sends UI_CONTACT_ISTYPING (source HCONTACT)
+UI : an HCONTACT within the session is typing, the UI may elect to show this
+ message in a status bar, or with a visual effect.
+*/
+
+#endif // M_SESSION_H__
+
diff --git a/miranda-wine/include/m_skin.h b/miranda-wine/include/m_skin.h new file mode 100644 index 0000000..b5fe8c8 --- /dev/null +++ b/miranda-wine/include/m_skin.h @@ -0,0 +1,145 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_SKIN_H__
+#define M_SKIN_H__ 1
+
+//loads an icon from the user's custom skin library, or from the exe if there
+//isn't one of them
+//wParam=id of icon to load - see below
+//lParam=0
+//returns an hIcon for the new icon. Do *not* DestroyIcon() the return value
+//returns NULL if id is invalid, but will always succeed for a valid id
+#define MS_SKIN_LOADICON "Skin/Icons/Load"
+//nice function to wrap this:
+__inline static HICON LoadSkinnedIcon(int id) {return (HICON)CallService(MS_SKIN_LOADICON,id,0);}
+
+//event icons
+#define SKINICON_EVENT_MESSAGE 100
+#define SKINICON_EVENT_URL 101
+#define SKINICON_EVENT_FILE 102
+//other icons
+#define SKINICON_OTHER_MIRANDA 200
+#define SKINICON_OTHER_EXIT 201
+#define SKINICON_OTHER_SHOWHIDE 202
+#define SKINICON_OTHER_GROUPOPEN 203 //v0.1.1.0+
+#define SKINICON_OTHER_GROUPSHUT 205 //v0.1.1.0+
+#define SKINICON_OTHER_USERONLINE 204 //v0.1.0.1+
+//menu icons are owned by the module that uses them so are not and should not
+//be skinnable. Except exit and show/hide
+
+//status mode icons. NOTE: These are deprecated in favour of LoadSkinnedProtoIcon()
+#define SKINICON_STATUS_OFFLINE 0
+#define SKINICON_STATUS_ONLINE 1
+#define SKINICON_STATUS_AWAY 2
+#define SKINICON_STATUS_NA 3
+#define SKINICON_STATUS_OCCUPIED 4
+#define SKINICON_STATUS_DND 5
+#define SKINICON_STATUS_FREE4CHAT 6
+#define SKINICON_STATUS_INVISIBLE 7
+#define SKINICON_STATUS_ONTHEPHONE 8
+#define SKINICON_STATUS_OUTTOLUNCH 9
+
+//Loads an icon representing the status mode for a particular protocol.
+//wParam=(WPARAM)(const char*)szProto
+//lParam=status
+//returns an hIcon for the new icon. Do *not* DestroyIcon() the return value
+//returns NULL on failure
+//if szProto is NULL the function will load the user's selected 'all protocols'
+//status icon.
+#define MS_SKIN_LOADPROTOICON "Skin/Icons/LoadProto"
+//nice function to wrap this:
+__inline static HICON LoadSkinnedProtoIcon(const char *szProto,int status) {return (HICON)CallService(MS_SKIN_LOADPROTOICON,(WPARAM)szProto,status);}
+
+//add a new sound so it has a default and can be changed in the options dialog
+//wParam=0
+//lParam=(LPARAM)(SKINSOUNDDESC*)ssd;
+//returns 0 on success, nonzero otherwise
+typedef struct {
+ int cbSize;
+ const char *pszName; //name to refer to sound when playing and in db
+ const char *pszDescription; //description for options dialog
+ const char *pszDefaultFile; //default sound file to use
+ const char *pszSection; //section name used to group sounds (NULL is acceptable) (added during 0.3.4+ (2004/10/*))
+} SKINSOUNDDESCEX;
+// Old struct pre 0.3.4
+typedef struct {
+ int cbSize;
+ const char *pszName; //name to refer to sound when playing and in db
+ const char *pszDescription; //description for options dialog
+ const char *pszDefaultFile; //default sound file to use
+} SKINSOUNDDESC;
+#define MS_SKIN_ADDNEWSOUND "Skin/Sounds/AddNew"
+
+// inline only works after 0.3.4+ (2004/10/*)
+__inline static int SkinAddNewSoundEx(const char *name,const char *section,const char *description)
+{
+ SKINSOUNDDESCEX ssd;
+ ZeroMemory(&ssd,sizeof(ssd));
+ ssd.cbSize=sizeof(ssd);
+ ssd.pszName=name;
+ ssd.pszSection=section;
+ ssd.pszDescription=description;
+ return CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&ssd);
+}
+
+__inline static int SkinAddNewSound(const char *name,const char *description,const char *defaultFile)
+{
+ SKINSOUNDDESC ssd;
+ ZeroMemory(&ssd,sizeof(ssd));
+ ssd.cbSize=sizeof(ssd);
+ ssd.pszName=name;
+ ssd.pszDescription=description;
+ ssd.pszDefaultFile=defaultFile;
+ return CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&ssd);
+}
+
+//play a named sound event
+//wParam=0
+//lParam=(LPARAM)(const char*)pszName
+//pszName should have been added with Skin/Sounds/AddNew, but if not the
+//function will not fail, it will play the Windows default sound instead.
+#define MS_SKIN_PLAYSOUND "Skin/Sounds/Play"
+__inline static int SkinPlaySound(const char *name) {return CallService(MS_SKIN_PLAYSOUND,0,(LPARAM)name);}
+
+//sent when the icons DLL has been changed in the options dialog, and everyone
+//should re-make their image lists
+//wParam=lParam=0
+#define ME_SKIN_ICONSCHANGED "Skin/IconsChanged"
+
+
+/*
+ wParam: 0 when playing sound (1 when sound is being previewed)
+ lParam: (char*) pszSoundFile
+ Affect: This hook is fired when the sound module needs to play a sound
+ Note : This event has default processing, if no one HookEvent()'s this event then it will
+ use the default hook code, which uses PlaySound()
+ Version: 0.3.4a (2004/09/15)
+*/
+#define ME_SKIN_PLAYINGSOUND "Skin/Sounds/Playing"
+
+//random ideas for the future:
+// Skin/LoadNetworkAnim - get some silly spinner thing when we want to be busy
+
+#endif //M_SKIN_H__
+
+
diff --git a/miranda-wine/include/m_system.h b/miranda-wine/include/m_system.h new file mode 100644 index 0000000..985f615 --- /dev/null +++ b/miranda-wine/include/m_system.h @@ -0,0 +1,366 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_SYSTEM_H__
+#define M_SYSTEM_H__ 1
+
+#ifndef MIRANDANAME
+#define MIRANDANAME "Miranda IM"
+#endif
+#ifndef MIRANDACLASS
+#define MIRANDACLASS "Miranda"
+#endif
+
+//miranda/system/modulesloaded
+//called after all modules have been successfully initialised
+//wParam=lParam=0
+//used to resolve double-dependencies in the module load order
+#define ME_SYSTEM_MODULESLOADED "Miranda/System/ModulesLoaded"
+
+//miranda/system/shutdown event
+//called just before the application terminates
+//the database is still guaranteed to be running during this hook.
+//wParam=lParam=0
+#define ME_SYSTEM_SHUTDOWN "Miranda/System/Shutdown"
+
+//miranda/system/oktoexit event
+//called before the app goes into shutdown routine to make sure everyone is
+//happy to exit
+//wParam=lParam=0
+//return nonzero to stop the exit cycle
+#define ME_SYSTEM_OKTOEXIT "Miranda/System/OkToExitEvent"
+
+//miranda/system/oktoexit service
+//Check if everyone is happy to exit
+//wParam=lParam=0
+//if everyone acknowleges OK to exit then returns true, otherwise false
+#define MS_SYSTEM_OKTOEXIT "Miranda/System/OkToExit"
+
+//gets the version number of Miranda encoded as a DWORD v0.1.0.1+
+//wParam=lParam=0
+//returns the version number, encoded as one version per byte, therefore
+//version 1.2.3.10 is 0x0102030a
+#define MS_SYSTEM_GETVERSION "Miranda/System/GetVersion"
+
+//gets the version of Miranda encoded as text v0.1.0.1+
+//wParam=cch
+//lParam=(LPARAM)(char*)pszVersion
+//cch is the size of the buffer pointed to by pszVersion, in bytes
+//may return a build qualifier, such as "0.1.0.1 alpha"
+//returns 0 on success, nonzero on failure
+#define MS_SYSTEM_GETVERSIONTEXT "Miranda/System/GetVersionText"
+
+//Adds a HANDLE to the list to be checked in the main message loop v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hObject
+//lParam=(LPARAM)(const char*)pszService
+//returns 0 on success or nonzero on failure
+//Causes pszService to be CallService()d (wParam=hObject,lParam=0) from the
+//main thread whenever hObject is signalled.
+//The Miranda message loop has a MsgWaitForMultipleObjects() call in it to
+//implement this feature. See the documentation for that function for
+//information on what objects are supported.
+//There is a limit of MAXIMUM_WAIT_OBJECTS minus one (MWO is defined in winnt.h
+//to be 64) on the number of handles MSFMO() can process. This service will
+//return nonzero if that many handles are already being waited on.
+
+//As of writing, the following parts of Miranda are thread-safe, so can be
+//called from any thread:
+//All of modules.h except NotifyEventHooks()
+//Read-only parts of m_database.h (since the write parts will call hooks)
+//All of m_langpack.h
+//for all other routines your mileage may vary, but I would strongly recommend
+//that you call them from the main thread, or ask about it on plugin-dev if you
+//think it really ought to work.
+
+//Update during 0.1.2.0 development, 16/10/01:
+//NotifyEventHooks() now translates all calls into the context of the main
+//thread, which means that all of m_database.h is now completely safe.
+
+//Update during 0.1.2.2 development, 17/4/02:
+//The main thread's message loop now also deals with asynchronous procedure
+//calls. Loop up QueueUserAPC() for a neater way to accomplish a lot of the
+//things that used to require ms_system_waitonhandle.
+
+//Miranda is compiled with the multithreaded runtime - don't forget to do the
+//same with your plugin.
+#define MS_SYSTEM_WAITONHANDLE "Miranda/System/WaitOnHandle"
+
+//Removes a HANDLE from the wait list v0.1.2.0+
+//wParam=(WPARAM)(HANDLE)hObject
+//lParam=0
+//returns 0 on success or nonzero on failure.
+#define MS_SYSTEM_REMOVEWAIT "Miranda/System/RemoveWait"
+
+/* Returns Miranda's RTL/CRT function poiners to malloc() free() realloc() -- 0.1.2.2+
+This is useful for preallocation of memory for use with Miranda's services
+that Miranda can free -- or reallocation of a block of memory passed with a service.
+Do not use with memory unless it is explicitly expected the memory *can*
+or *shall* be used in this way. the passed structure is expected to have it's .cbSize initialised
+
+wParam=0, lParam = (LPARAM) &MM_INTERFACE
+*/
+
+struct MM_INTERFACE {
+ int cbSize;
+ void* (*mmi_malloc) (size_t);
+ void* (*mmi_realloc) (void*, size_t);
+ void (*mmi_free) (void*);
+};
+
+#define MS_SYSTEM_GET_MMI "Miranda/System/GetMMI"
+
+/* Returns the pointer to the simple lists manager.
+If the sortFunc member of the list gets assigned, the list becomes sorted
+
+wParam=0, lParam = 0
+*/
+
+typedef int ( *FSortFunc )( void*, void* );
+
+typedef struct
+{
+ void** items;
+ int realCount;
+ int limit;
+ int increment;
+
+ FSortFunc sortFunc;
+}
+ SortedList;
+
+struct LIST_INTERFACE {
+ int cbSize;
+
+ SortedList* ( *List_Create )( int, int );
+ void ( *List_Destroy )( SortedList* );
+
+ void* ( *List_Find )( SortedList*, void* );
+ int ( *List_GetIndex )( SortedList*, void*, int* );
+ int ( *List_Insert )( SortedList*, void*, int );
+ int ( *List_Remove )( SortedList*, int );
+ int ( *List_IndexOf )( SortedList*, void* );
+};
+
+#define MS_SYSTEM_GET_LI "Miranda/System/GetLI"
+
+/*
+
+ -- Thread Safety --
+
+ Proper thread safe shutdown was implemented in 0.3.0.0 (2003/04/18)
+ and not before, therefore it is improper that any MT plugins be used
+ with earlier versions of Miranda (as hav0c will result)
+
+ Note: This does not apply to MT plugins which included their own
+ thread-safe shutdown routines.
+
+ Shutdown thread safety works thusly:
+
+ All new threads must call MS_SYSTEM_THREAD_PUSH and MS_SYSTEM_THREAD_POP
+ when they return.
+
+ Due to the nature of thread creation, it is illegal to assume
+ just a call pair of MS_SYSTEM_THREAD_PUSH inside the thread will
+ be enough -- the source thread may only return when the new child
+ thread has actually executed MS_SYSTEM_THREAD_PUSH
+
+ This is because a thread maybe in an undefined state at the point
+ when the thread creation routine returns, thus Miranda may exit
+ thinking it is safe to do so, because MS_SYSTEM_THREAD_PUSH was not
+ called in time.
+
+ See miranda.c for how this can be done using an event object
+ which is signalled just after the MS_SYSTEM_THREAD_PUSH call is executed
+ and so the source thread knows that the created thread is known to Miranda.
+
+ -- What happens when Miranda exits --
+
+ Miranda will firstly set an event object to signalled, this will
+ make MS_SYSTEM_TERMINATED return TRUE, it will then fire ME_SYSTEM_PRESHUTDOWN
+ at this point, no plugins or modules are unloaded.
+
+ Miranda will then enumerate all active threads and queue an APC call
+ to each thread, so any thread in an alertable state will become active,
+ this functionailty may not be required by your threads: but if you use
+ the Winsock2 event object system or Sleep() please use the alertable
+ wait functions, so that the thread will 'wake up' when Miranda queues
+ a message to it, SleepEx() will return WAIT_IO_COMPLETION if this happens.
+
+ After all threads have been signalled, Miranda will spin on the unwind thread stack waiting
+ for it to become empty, in this time, it will carry on processing thread
+ switches, clearing it's own APC calls (used by NotifyEventHooks(), CallServiceSync())
+
+ So a thread should be written in this kind of form:
+
+ void mythread(void *arg)
+ {
+ // assume all thread pushing/popping is done by forkthread()
+ int run=1;
+ for (;run;)
+ {
+ Beep(4391,500);
+ SleepEx(1500,TRUE);
+ if (Miranda_Terminated()) {
+ Beep(5000,150); run=0;
+ } //if
+ } //for
+ }
+
+ The above will make a nice Beep every 1.5 seconds and when the UI
+ quits, it will make a lower beep and then return.
+
+ As many copies of this thread maybe running, the creator does not need
+ to worry about what to do with previous threads, as long as they're on the
+ unwind stack.If there are any global resources (and they're mutex) you can free() them
+ at Unload(), which will only be called, after all threads have returned.
+
+ -- Summary --
+
+ MS_SYSTEM_TERMINATED (will start returning TRUE)
+ ME_SYSTEM_PRESHUTDOWN will be fired (The CList won't be visible at this point)
+
+ All PROTOTYPE_PROTOCOL registered plugins will be sent ID_STATUS_OFFLINE
+ automatically.
+
+ All the threads will be notified via QueueUserAPC() and then Miranda
+ will poll on the unwind thread queue until it is empty.
+
+ ME_SYSTEM_SHUTDOWN will be fired, the database will be unloaded, the core
+ will be unloaded -- Miranda will return.
+
+*/
+
+/*
+wParam=0
+lParam=0
+
+Add a thread to the unwind wait stack that Miranda will poll on
+when it is tearing down modules.
+
+This must be called in the context of the thread that is to be pushed
+i.e. there are no args, it works out what thread is being called
+and gets itself a handle to the calling thread.
+
+*/
+#define MS_SYSTEM_THREAD_PUSH "Miranda/Thread/Push"
+
+/*
+wParam=0
+lParam=0
+
+Remove a thread from the unwind wait stack -- it is expected
+that the call be made in the context of the thread to be removed.
+
+Miranda will begin to tear down modules and plugins if/when the
+last thread from the unwind stack is removed.
+*/
+#define MS_SYSTEM_THREAD_POP "Miranda/Thread/Pop"
+
+/*
+wParam=0
+lParam=0
+
+This hook is fired just before the thread unwind stack is used,
+it allows MT plugins to shutdown threads if they have any special
+processing to do, etc.
+
+*/
+#define ME_SYSTEM_PRESHUTDOWN "Miranda/System/PShutdown"
+
+/*
+wParam=0
+lParam=0
+
+Returns TRUE when Miranda has got WM_QUIT and is in the process
+of shutting down
+*/
+#define MS_SYSTEM_TERMINATED "Miranda/SysTerm"
+
+/*
+ wParam : 0
+ lParam : (address) void (__cdecl *callback) (void)
+ Affect : Setup a function pointer to be called after main loop iterations, it allows for
+ idle processing, See notes
+ Returns: 1 on success, 0 on failure
+
+ Notes : This service will only allow one function to be registered, if one is registered, 0 will be returned
+ Remember that this uses __cdecl.
+ Version: Added during 0.3.4+
+
+*/
+#define MS_SYSTEM_SETIDLECALLBACK "Miranda/SetIdleCallback"
+
+/*
+ wParam : 0
+ lParam : &tick
+ Affect : return the last window tick where a monitored event was seen, currently WM_CHAR/WM_MOUSEMOVE
+ Returns: Always returns 0
+ Version: Added during 0.3.4+ (2004/09/12)
+*/
+#define MS_SYSTEM_GETIDLE "Miranda/GetIdle"
+
+/*
+ wParam: cchMax (max length of buffer)
+ lParam: pointer to buffer to fill
+ Affect: Returns the build timestamp of the core, as a string of YYYYMMDDhhmmss, this service might
+ not exist and therefore the build is before 2004-09-30
+ Returns: zero on success, non zero on failure
+ Version: 0.3.4a+ (2004/09/30)
+ DEFUNCT: This service was removed on 0.3.4.3+ (2004/11/19) use APILEVEL
+*/
+#define MS_SYSTEM_GETBUILDSTRING "Miranda/GetBuildString"
+
+__inline static int Miranda_Terminated(void)
+{
+ return CallService(MS_SYSTEM_TERMINATED,0,0);
+}
+
+__inline static void miranda_sys_free(void *ptr)
+{
+ if (ptr) {
+ struct MM_INTERFACE mm;
+ mm.cbSize=sizeof(struct MM_INTERFACE);
+ CallService(MS_SYSTEM_GET_MMI,0,(LPARAM)&mm);
+ mm.mmi_free(ptr);
+ }
+}
+
+/* Missing service catcher
+Is being called when one calls the non-existent service.
+All parameters are stored in the special structure
+
+The event handler takes 0 as wParam and TMissingServiceParams* as lParam.
+
+0.4.3+ addition (2006/03/27)
+*/
+
+typedef struct
+{
+ const char* name;
+ WPARAM wParam;
+ LPARAM lParam;
+}
+ MISSING_SERVICE_PARAMS;
+
+#define ME_SYSTEM_MISSINGSERVICE "System/MissingService"
+
+#endif // M_SYSTEM_H
diff --git a/miranda-wine/include/m_url.h b/miranda-wine/include/m_url.h new file mode 100644 index 0000000..b692724 --- /dev/null +++ b/miranda-wine/include/m_url.h @@ -0,0 +1,35 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_URL_H__
+#define M_URL_H__ 1
+
+//bring up the send URL dialog for a user
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+//returns 0 on success or nonzero on failure
+//returns immediately, before the url is sent
+#define MS_URL_SENDURL "SRUrl/SendCommand"
+
+#endif // M_URL_H__
+
diff --git a/miranda-wine/include/m_userinfo.h b/miranda-wine/include/m_userinfo.h new file mode 100644 index 0000000..13741ba --- /dev/null +++ b/miranda-wine/include/m_userinfo.h @@ -0,0 +1,75 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_USERINFO_H__
+#define M_USERINFO_H__ 1
+
+#include "m_options.h"
+
+//show the User Details dialog box
+//wParam=(WPARAM)(HANDLE)hContact
+//lParam=0
+#define MS_USERINFO_SHOWDIALOG "UserInfo/ShowDialog"
+
+/* UserInfo/Initialise v0.1.2.0+
+The user opened a details dialog. Modules should do whatever initialisation
+they need and call userinfo/addpage one or more times if they want pages
+displayed in the options dialog
+wParam=addInfo
+lParam=(LPARAM)hContact
+addInfo should be passed straight to the wParam of userinfo/addpage
+NB: The built-in userinfo module is loaded after all plugins, so calling
+HookEvent() in your plugin's Load() function will fail if you specify this
+hook. Look up core/m_system.h:me_system_modulesloaded.
+*/
+#define ME_USERINFO_INITIALISE "UserInfo/Initialise"
+
+/* UserInfo/AddPage v0.1.2.0+
+Must only be called during an userinfo/initialise hook
+Adds a page to the details dialog
+wParam=addInfo
+lParam=(LPARAM)(OPTIONSDIALOGPAGE*)odp
+addInfo must have come straight from the wParam of userinfo/initialise
+Pages in the details dialog operate just like pages in property sheets. See the
+Microsoft documentation for info on how they operate.
+When the pages receive WM_INITDIALOG, lParam=(LPARAM)hContact
+Strings in the structure can be released as soon as the service returns, but
+icons must be kept around. This is not a problem if you're loading them from a
+resource
+The 3 'group' elements in the structure are ignored, and will always be ignored
+Unlike the options dialog, the details dialog does not resize to fit its
+largest page. Details dialog pages should be 222x132 dlus.
+The details dialog (currently) has no Cancel button. I'm waiting to see if it's
+sensible to have one.
+Pages will be sent PSN_INFOCHANGED through WM_NOTIFY (idFrom=0) when a protocol
+ack is broadcast for the correct contact and with type=ACKTYPE_GETINFO.
+To help you out, PSN_INFOCHANGED will also be sent to each page just after it's
+created.
+All PSN_ WM_NOTIFY messages have PSHNOTIFY.lParam=(LPARAM)hContact
+*/
+#define PSN_INFOCHANGED 1
+#define PSM_FORCECHANGED (WM_USER+100) //force-send a PSN_INFOCHANGED to all pages
+#define MS_USERINFO_ADDPAGE "UserInfo/AddPage"
+
+#endif // M_USERINFO_H__
+
diff --git a/miranda-wine/include/m_utils.h b/miranda-wine/include/m_utils.h new file mode 100644 index 0000000..50e2cdb --- /dev/null +++ b/miranda-wine/include/m_utils.h @@ -0,0 +1,325 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_UTILS_H__
+#define M_UTILS_H__ 1
+
+#include <tchar.h>
+
+//this entire module is v0.1.0.1+
+//this module cannot be redefined by a plugin, because it's not useful for it
+//to be possible
+//There are some more utility services in the database for dealing with time
+//and simple string scrambling, but they are very db-orientated
+
+/* Opens a URL in the user's default web browser v0.1.0.1+
+wParam=bOpenInNewWindow
+lParam=(LPARAM)(const char*)szUrl
+returns 0 always
+bOpenInNewWindow should be zero to open the URL in the browser window the user
+last used, or nonzero to open in a new browser window. If there's no browser
+running, one will be opened to show the URL.
+*/
+#define MS_UTILS_OPENURL "Utils/OpenURL"
+
+/* Resizes a dialog by calling a custom routine to move the individual
+controls v0.1.0.1+
+wParam=0
+lParam=(LPARAM)(UTILRESIZEDIALOG*)&urd
+Returns 0 on success, or nonzero on failure
+Does not support dialogtemplateex dialog boxes, and will return failure if you
+try to resize one
+The dialog itself should have been resized prior to calling this service
+pfnResizer is called once for each control in the dialog
+pfnResizer should return a combination of one rd_anchorx_ and one rd_anchory
+constant
+*/
+typedef struct {
+ int cbSize;
+ UINT wId; //control ID
+ RECT rcItem; //original control rectangle, relative to dialog
+ //modify in-place to specify the new position
+ SIZE dlgOriginalSize; //size of dialog client area in template
+ SIZE dlgNewSize; //current size of dialog client area
+} UTILRESIZECONTROL;
+typedef int (*DIALOGRESIZERPROC)(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc);
+typedef struct {
+ int cbSize;
+ HWND hwndDlg;
+ HINSTANCE hInstance; //module containing the dialog template
+ LPCSTR lpTemplate; //dialog template
+ LPARAM lParam; //caller-defined
+ DIALOGRESIZERPROC pfnResizer;
+} UTILRESIZEDIALOG;
+#define RD_ANCHORX_CUSTOM 0 //function did everything required to the x axis, do no more processing
+#define RD_ANCHORX_LEFT 0 //move the control to keep it constant distance from the left edge of the dialog
+#define RD_ANCHORX_RIGHT 1 //move the control to keep it constant distance from the right edge of the dialog
+#define RD_ANCHORX_WIDTH 2 //size the control to keep it constant distance from both edges of the dialog
+#define RD_ANCHORX_CENTRE 4 //move the control to keep it constant distance from the centre of the dialog
+#define RD_ANCHORY_CUSTOM 0
+#define RD_ANCHORY_TOP 0
+#define RD_ANCHORY_BOTTOM 8
+#define RD_ANCHORY_HEIGHT 16
+#define RD_ANCHORY_CENTRE 32
+#define MS_UTILS_RESIZEDIALOG "Utils/ResizeDialog"
+
+/* Gets the name of a country given its number v0.1.2.0+
+wParam=countryId
+lParam=0
+Returns a pointer to the string containing the country name on success,
+or NULL on failure
+*/
+#define MS_UTILS_GETCOUNTRYBYNUMBER "Utils/GetCountryByNumber"
+
+/* Gets the full list of country IDs v0.1.2.0+
+wParam=(WPARAM)(int*)piCount
+lParam=(LPARAM)(struct CountryListEntry**)ppList
+Returns 0 always
+Neither wParam nor lParam can be NULL.
+The list is sorted alphabetically by country name, on the assumption that it's
+quicker to search numbers out of order than it is to search names out of order
+*/
+struct CountryListEntry {
+ int id;
+ const char *szName;
+};
+#define MS_UTILS_GETCOUNTRYLIST "Utils/GetCountryList"
+
+/******************************* Window lists *******************************/
+
+//allocate a window list v0.1.0.1+
+//wParam=lParam=0
+//returns a handle to the new window list
+#define MS_UTILS_ALLOCWINDOWLIST "Utils/AllocWindowList"
+
+//adds a window to the specified window list v0.1.0.1+
+//wParam=0
+//lParam=(LPARAM)(WINDOWLISTENTRY*)&wle
+//returns 0 on success, nonzero on failure
+typedef struct {
+ HANDLE hList;
+ HWND hwnd;
+ HANDLE hContact;
+} WINDOWLISTENTRY;
+#define MS_UTILS_ADDTOWINDOWLIST "Utils/AddToWindowList"
+__inline static int WindowList_Add(HANDLE hList,HWND hwnd,HANDLE hContact) {
+ WINDOWLISTENTRY wle;
+ wle.hList=hList; wle.hwnd=hwnd; wle.hContact=hContact;
+ return CallService(MS_UTILS_ADDTOWINDOWLIST,0,(LPARAM)&wle);
+}
+//removes a window from the specified window list v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hList
+//lParam=(LPARAM)(HWND)hwnd
+//returns 0 on success, nonzero on failure
+#define MS_UTILS_REMOVEFROMWINDOWLIST "Utils/RemoveFromWindowList"
+__inline static int WindowList_Remove(HANDLE hList,HWND hwnd) {
+ return CallService(MS_UTILS_REMOVEFROMWINDOWLIST,(WPARAM)hList,(LPARAM)hwnd);
+}
+
+//finds a window given the hContact v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hList
+//lParam=(WPARAM)(HANDLE)hContact
+//returns the window handle on success, or NULL on failure
+#define MS_UTILS_FINDWINDOWINLIST "Utils/FindWindowInList"
+__inline static HWND WindowList_Find(HANDLE hList,HANDLE hContact) {
+ return (HWND)CallService(MS_UTILS_FINDWINDOWINLIST,(WPARAM)hList,(LPARAM)hContact);
+}
+
+//broadcasts a message to all windows in a list v0.1.0.1+
+//wParam=(WPARAM)(HANDLE)hList
+//lParam=(LPARAM)(MSG*)&msg
+//returns 0 on success, nonzero on failure
+//Only msg.message, msg.wParam and msg.lParam are used
+#define MS_UTILS_BROADCASTTOWINDOWLIST "Utils/BroadcastToWindowList"
+__inline static int WindowList_Broadcast(HANDLE hList,UINT message,WPARAM wParam,LPARAM lParam) {
+ MSG msg;
+ msg.message=message; msg.wParam=wParam; msg.lParam=lParam;
+ return CallService(MS_UTILS_BROADCASTTOWINDOWLIST,(WPARAM)hList,(LPARAM)&msg);
+}
+
+/*
+ Description: Broadcast a message to all windows in the given list using PostMessage()
+ Version: 0.3.0.0+
+ Inline helper: WindowList_BroadcastAsync
+
+ wParam=(WPARAM)(HANDLE)hList
+ lParam=(LPARAM)(MSG*)&msg
+
+ Returns 0 on success, nonzero on failure, this service does not fail, even if PostMessage() fails for whatever reason
+
+*/
+#define MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC "Utils/BroadcastToWindowListAsync"
+
+__inline static int WindowList_BroadcastAsync(HANDLE hList,UINT message,WPARAM wParam,LPARAM lParam) {
+ MSG msg;
+ msg.message=message; msg.wParam=wParam; msg.lParam=lParam;
+ return CallService(MS_UTILS_BROADCASTTOWINDOWLIST_ASYNC,(WPARAM)hList,(LPARAM)&msg);
+}
+
+/***************************** Hyperlink windows ********************************/
+
+//there aren't any services here, because you don't need them.
+#define WNDCLASS_HYPERLINK _T("Hyperlink")
+//the control will obey the SS_LEFT (0), SS_CENTER (1), and SS_RIGHT (2) styles
+//the control will send STN_CLICKED via WM_COMMAND when the link itself is clicked
+
+// Use this in a SendMessage to set the color of the url when control is enabled
+// wParam=DWORD color
+// lParam=not used
+#define HLK_SETENABLECOLOUR (WM_USER+101) // added in 0.3.1
+// Use this in a SendMessage to set the color of the url when control is disabled
+// wParam=DWORD color
+// lParam=not used
+#define HLK_SETDISABLECOLOUR (WM_USER+102) // added in 0.3.1
+
+/***************************** Window Position Saving ***************************/
+
+//saves the position of a window in the database v0.1.1.0+
+//wParam=0
+//lParam=(LPARAM)(SAVEWINDOWPOS*)&swp
+//returns 0 on success, nonzero on failure
+typedef struct {
+ HWND hwnd;
+ HANDLE hContact;
+ const char *szModule; //module name to store the setting in
+ const char *szNamePrefix; //text to prefix on "x", "width", etc, to form setting names
+} SAVEWINDOWPOS;
+#define MS_UTILS_SAVEWINDOWPOSITION "Utils/SaveWindowPos"
+__inline static int Utils_SaveWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix) {
+ SAVEWINDOWPOS swp;
+ swp.hwnd=hwnd; swp.hContact=hContact; swp.szModule=szModule; swp.szNamePrefix=szNamePrefix;
+ return CallService(MS_UTILS_SAVEWINDOWPOSITION,0,(LPARAM)&swp);
+}
+
+//restores the position of a window from the database v0.1.1.0+
+//wParam=flags
+//lParam=(LPARAM)(SAVEWINDOWPOS*)&swp
+//returns 0 on success, nonzero on failure
+//if no position was found in the database, the function returns 1 and does
+//nothing
+//the NoSize version won't use stored size information: the window is left the
+//same size.
+#define RWPF_NOSIZE 1 //don't use stored size info: leave dialog same size
+#define RWPF_NOMOVE 2 //don't use stored position
+#define RWPF_NOACTIVATE 4 //show but don't activate v0.3.3.0+
+#define MS_UTILS_RESTOREWINDOWPOSITION "Utils/RestoreWindowPos"
+__inline static int Utils_RestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix) {
+ SAVEWINDOWPOS swp;
+ swp.hwnd=hwnd; swp.hContact=hContact; swp.szModule=szModule; swp.szNamePrefix=szNamePrefix;
+ return CallService(MS_UTILS_RESTOREWINDOWPOSITION,0,(LPARAM)&swp);
+}
+__inline static int Utils_RestoreWindowPositionNoSize(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix) {
+ SAVEWINDOWPOS swp;
+ swp.hwnd=hwnd; swp.hContact=hContact; swp.szModule=szModule; swp.szNamePrefix=szNamePrefix;
+ return CallService(MS_UTILS_RESTOREWINDOWPOSITION,RWPF_NOSIZE,(LPARAM)&swp);
+}
+__inline static int Utils_RestoreWindowPositionNoMove(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix) {
+ SAVEWINDOWPOS swp;
+ swp.hwnd=hwnd; swp.hContact=hContact; swp.szModule=szModule; swp.szNamePrefix=szNamePrefix;
+ return CallService(MS_UTILS_RESTOREWINDOWPOSITION,RWPF_NOMOVE,(LPARAM)&swp);
+}
+
+/************************ Colour Picker Control (0.1.2.1+) **********************/
+
+#define WNDCLASS_COLOURPICKER _T("ColourPicker")
+
+#define CPM_SETCOLOUR 0x1000 //lParam=new colour
+#define CPM_GETCOLOUR 0x1001 //returns colour
+#define CPM_SETDEFAULTCOLOUR 0x1002 //lParam=default, used as first custom colour
+#define CPM_GETDEFAULTCOLOUR 0x1003 //returns colour
+#define CPN_COLOURCHANGED 1 //sent through WM_COMMAND
+
+/***************************** Bitmap Filter (0.1.2.1+) *************************/
+
+//Loads a bitmap v0.1.2.1+
+//wParam=0
+//lParam=(LPARAM)(const char*)filename
+//returns HBITMAP on success, NULL on failure
+//This function uses OleLoadPicturePath() so supports BMP, JPEG and GIF. It may
+//support PNG on future versions of Windows (or XP for that matter)
+//For speed, if the file extension is .bmp or .rle it'll use LoadImage() so as
+//to avoid the big lag loading OLE.
+//Remember to DeleteObject() when you're done
+#define MS_UTILS_LOADBITMAP "Utils/LoadBitmap"
+
+//Gets the filter strings for use in the open file dialog v0.1.2.1+
+//wParam=cbLengthOfBuffer
+//lParam=(LPARAM)(char*)pszBuffer
+//Returns 0 on success, nonzero on failure
+//See the MSDN under OPENFILENAME.lpstrFilter for the formatting
+//An 'All Bitmaps' item is always first and 'All Files' is last.
+//The returned string is already translated.
+#define MS_UTILS_GETBITMAPFILTERSTRINGS "Utils/GetBitmapFilterStrings"
+
+//Saves a path to a relative path (from the miranda directory)
+//Only saves as a relative path if the file is in the miranda directory (or
+//sub directory)
+//wParam=(WPARAM)(char*)pszPath
+//lParam=(LPARAM)(char*)pszNewPath
+//pszPath is the path to convert and pszNewPath is the buffer that
+//the new path is copied too. pszNewPath MUST be of the size MAX_PATH.
+//Returns numbers of chars copied.
+#define MS_UTILS_PATHTORELATIVE "Utils/PathToRelative"
+
+//Saves a path to a absolute path (from the miranda directory)
+//wParam=(WPARAM)(char*)pszPath
+//lParam=(LPARAM)(char*)pszNewPath
+//pszPath is the path to convert and pszNewPath is the buffer that
+//the new path is copied too. pszNewPath MUST be of the size MAX_PATH.
+//Returns numbers of chars copied.
+#define MS_UTILS_PATHTOABSOLUTE "Utils/PathToAbsolute"
+
+// Added in 0.4.0.1
+// Here are some string wrappers that are more safe than the win32 versions
+
+static __inline int mir_snprintf(char *buffer, size_t count, const char* fmt, ...) {
+ va_list va;
+ int len;
+
+ va_start(va, fmt);
+ len = _vsnprintf(buffer, count-1, fmt, va);
+ va_end(va);
+ buffer[count-1] = 0;
+ return len;
+}
+
+static __inline int mir_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...) {
+ va_list va;
+ int len;
+
+ va_start(va, fmt);
+ len = _vsntprintf(buffer, count-1, fmt, va);
+ va_end(va);
+ buffer[count-1] = 0;
+ return len;
+}
+
+static __inline int mir_vsnprintf(char *buffer, size_t count, const char* fmt, va_list va) {
+ int len;
+
+ len = _vsnprintf(buffer, count-1, fmt, va);
+ buffer[count-1] = 0;
+ return len;
+}
+
+#endif // M_UTILS_H__
diff --git a/miranda-wine/include/newpluginapi.h b/miranda-wine/include/newpluginapi.h new file mode 100644 index 0000000..809c57e --- /dev/null +++ b/miranda-wine/include/newpluginapi.h @@ -0,0 +1,169 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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_NEWPLUGINAPI_H__
+#define M_NEWPLUGINAPI_H__
+
+#include "m_plugins.h"
+
+#define PLUGIN_MAKE_VERSION(a,b,c,d) (((((DWORD)(a))&0xFF)<<24)|((((DWORD)(b))&0xFF)<<16)|((((DWORD)(c))&0xFF)<<8)|(((DWORD)(d))&0xFF))
+#define MAXMODULELABELLENGTH 64
+
+#if defined( _UNICODE )
+ #define UNICODE_AWARE 1
+#else
+ #define UNICODE_AWARE 0
+#endif
+
+typedef struct {
+ int cbSize;
+ char *shortName;
+ DWORD version;
+ char *description;
+ char *author;
+ char *authorEmail;
+ char *copyright;
+ char *homepage;
+ BYTE isTransient; //leave this as 0 for now
+ int replacesDefaultModule; //one of the DEFMOD_ constants in m_plugins.h or zero
+ //if non-zero, this will supress the loading of the specified built-in module
+ //with the implication that this plugin provides back-end-compatible features
+} PLUGININFO;
+
+#ifndef MODULES_H_
+typedef int (*MIRANDAHOOK)(WPARAM,LPARAM);
+typedef int (*MIRANDASERVICE)(WPARAM,LPARAM);
+#define CALLSERVICE_NOTFOUND ((int)0x80000000)
+#endif
+
+//see modules.h for what all this stuff is
+typedef struct {
+ HANDLE (*CreateHookableEvent)(const char *);
+ int (*DestroyHookableEvent)(HANDLE);
+ int (*NotifyEventHooks)(HANDLE,WPARAM,LPARAM);
+ HANDLE (*HookEvent)(const char *,MIRANDAHOOK);
+ HANDLE (*HookEventMessage)(const char *,HWND,UINT);
+ int (*UnhookEvent)(HANDLE);
+ HANDLE (*CreateServiceFunction)(const char *,MIRANDASERVICE);
+ HANDLE (*CreateTransientServiceFunction)(const char *,MIRANDASERVICE);
+ int (*DestroyServiceFunction)(HANDLE);
+ int (*CallService)(const char *,WPARAM,LPARAM);
+ int (*ServiceExists)(const char *); //v0.1.0.1+
+ int (*CallServiceSync)(const char *,WPARAM,LPARAM); //v0.3.3+
+ int (*CallFunctionAsync) (void (__stdcall *)(void *), void *); //v0.3.4+
+ int (*SetHookDefaultForHookableEvent) (HANDLE, MIRANDAHOOK); // v0.3.4 (2004/09/15)
+} PLUGINLINK;
+
+#ifndef MODULES_H_
+#ifndef NODEFINEDLINKFUNCTIONS
+//relies on a global variable 'pluginLink' in the plugins
+extern PLUGINLINK *pluginLink;
+#define CreateHookableEvent(a) pluginLink->CreateHookableEvent(a)
+#define DestroyHookableEvent(a) pluginLink->DestroyHookableEvent(a)
+#define NotifyEventHooks(a,b,c) pluginLink->NotifyEventHooks(a,b,c)
+#define HookEventMessage(a,b,c) pluginLink->HookEventMessage(a,b,c)
+#define HookEvent(a,b) pluginLink->HookEvent(a,b)
+#define UnhookEvent(a) pluginLink->UnhookEvent(a)
+#define CreateServiceFunction(a,b) pluginLink->CreateServiceFunction(a,b)
+#define CreateTransientServiceFunction(a,b) pluginLink->CreateTransientServiceFunction(a,b)
+#define DestroyServiceFunction(a) pluginLink->DestroyServiceFunction(a)
+#define CallService(a,b,c) pluginLink->CallService(a,b,c)
+#define ServiceExists(a) pluginLink->ServiceExists(a)
+#define CallServiceSync(a,b,c) pluginLink->CallServiceSync(a,b,c)
+#define CallFunctionAsync(a,b) pluginLink->CallFunctionAsync(a,b)
+#define SetHookDefaultForHookableEvent(a,b) pluginLink->SetHookDefaultForHookableEvent(a,b)
+#endif
+#endif
+
+/*
+ Database plugin stuff
+*/
+
+// grokHeader() error codes
+#define EGROKPRF_NOERROR 0
+#define EGROKPRF_CANTREAD 1 // can't open the profile for reading
+#define EGROKPRF_UNKHEADER 2 // header not supported, not a supported profile
+#define EGROKPRF_VERNEWER 3 // header correct, version in profile newer than reader/writer
+#define EGROKPRF_DAMAGED 4 // header/version fine, other internal data missing, damaged.
+
+// makeDatabase() error codes
+#define EMKPRF_CREATEFAILED 1 // for some reason CreateFile() didnt like something
+
+typedef struct {
+ int cbSize;
+
+ /*
+ returns what the driver can do given the flag
+ */
+ int (*getCapability) ( int flag );
+
+ /*
+ buf: pointer to a string buffer
+ cch: length of buffer
+ shortName: if true, the driver should return a short but descriptive name, e.g. "3.xx profile"
+ Affect: The database plugin must return a "friendly name" into buf and not exceed cch bytes,
+ e.g. "Database driver for 3.xx profiles"
+ Returns: 0 on success, non zero on failure
+ */
+ int (*getFriendlyName) ( char * buf, size_t cch, int shortName );
+
+ /*
+ profile: pointer to a string which contains full path + name
+ Affect: The database plugin should create the profile, the filepath will not exist at
+ the time of this call, profile will be C:\..\<name>.dat
+ Note: Do not prompt the user in anyway about this operation.
+ Note: Do not initialise internal data structures at this point!
+ Returns: 0 on success, non zero on failure - error contains extended error information, see EMKPRF_*
+ */
+ int (*makeDatabase) ( char * profile, int * error );
+
+ /*
+ profile: [in] a null terminated string to file path of selected profile
+ error: [in/out] pointer to an int to set with error if any
+ Affect: Ask the database plugin if it supports the given profile, if it does it will
+ return 0, if it doesnt return 1, with the error set in error -- EGROKPRF_* can be valid error
+ condition, most common error would be [EGROKPRF_UNKHEADER]
+ Note: Just because 1 is returned, doesnt mean the profile is not supported, the profile might be damaged
+ etc.
+ Returns: 0 on success, non zero on failure
+ */
+ int (*grokHeader) ( char * profile, int * error );
+
+ /*
+ Affect: Tell the database to create all services/hooks that a 3.xx legecy database might support into link,
+ which is a PLUGINLINK structure
+ Returns: 0 on success, nonzero on failure
+ */
+ int (*Load) ( char * profile, void * link );
+
+ /*
+ Affect: The database plugin should shutdown, unloading things from the core and freeing internal structures
+ Returns: 0 on success, nonzero on failure
+ Note: Unload() might be called even if Load() was never called, wasLoaded is set to 1 if Load() was ever called.
+ */
+ int (*Unload) ( int wasLoaded );
+
+} DATABASELINK;
+
+#endif // M_NEWPLUGINAPI_H__
+
diff --git a/miranda-wine/include/statusmodes.h b/miranda-wine/include/statusmodes.h new file mode 100644 index 0000000..3b99de2 --- /dev/null +++ b/miranda-wine/include/statusmodes.h @@ -0,0 +1,48 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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 STATUSMODES_H__
+#define STATUSMODES_H__ 1
+
+//add 1 to ID_STATUS_CONNECTING to mark retries (v0.1.0.1+)
+//eg ID_STATUS_CONNECTING+2 is the third connection attempt, or the second retry
+#define ID_STATUS_CONNECTING 1
+//max retries is just a marker so that the clist knows what numbers represent
+//retries. It does not set any kind of limit on the number of retries you can
+//and/or should do.
+#define MAX_CONNECT_RETRIES 10000
+#define ID_STATUS_OFFLINE 40071
+#define ID_STATUS_ONLINE 40072
+#define ID_STATUS_AWAY 40073
+#define ID_STATUS_DND 40074
+#define ID_STATUS_NA 40075
+#define ID_STATUS_OCCUPIED 40076
+#define ID_STATUS_FREECHAT 40077
+#define ID_STATUS_INVISIBLE 40078
+#define ID_STATUS_ONTHEPHONE 40079
+#define ID_STATUS_OUTTOLUNCH 40080
+#define ID_STATUS_IDLE 40081 /* do not use as a status */
+
+#endif // STATUSMODES_H__
+
+
diff --git a/miranda-wine/include/win2k.h b/miranda-wine/include/win2k.h new file mode 100644 index 0000000..0853d64 --- /dev/null +++ b/miranda-wine/include/win2k.h @@ -0,0 +1,295 @@ +/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2006 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 WIN2K_H__
+#define WIN2K_H__ 1
+
+/*
+This file was made to define the new constants normally provided by the windows
+sdk you can get from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+To not need to install the whole sdk you can simply comment out the following lines.
+To make myself clear, you are supposed to use the sdk, this is just a work around.
+
+All constants are normally declared in winuser.h
+
+File created by Christian Kästner, and tweaked a bit by Richard Hughes*/
+
+//Windows versions in order of feature presence is:
+//95, NT4, 98, ME, 2000, XP
+//This is chronological order of release except for ME/2000. ME is barely an
+//improvement on 98.
+//These macros use the above order, not release order.
+#define WinVerMajor() LOBYTE(LOWORD(GetVersion()))
+#define WinVerMinor() HIBYTE(LOWORD(GetVersion()))
+#define IsWinVerNT() ((GetVersion()&0x80000000)==0)
+// IsWinVerNT4Plus() is buggy, Windows 98 is 4.10.1998
+#define IsWinVerNT4Plus() (WinVerMajor()>=5 || WinVerMinor()>0 || IsWinVerNT())
+#define IsWinVer98Plus() (LOWORD(GetVersion())!=4)
+#define IsWinVerMEPlus() (WinVerMajor()>=5 || WinVerMinor()>10)
+#define IsWinVer2000Plus() (WinVerMajor()>=5)
+#define IsWinVerXPPlus() (WinVerMajor()>=5 && LOWORD(GetVersion())!=5)
+
+// put stuff that's not apart of any SDKs but is used nonetheless
+
+#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
+
+//mii was extended for NT5/Win98, so need the old length for some stuff
+#define MENUITEMINFO_V4_SIZE (offsetof(MENUITEMINFO,cch)+sizeof((*((MENUITEMINFO*)0)).cch))
+
+#if _MSC_VER >= 1300
+#define NOWIN2K
+#endif
+
+#if WINVER >= 0x501
+#define NOWIN2K
+#endif
+
+#ifdef _MSC_VER
+#define BIGI(x) x##i64
+#else
+#define BIGI(x) x##LL
+#endif
+
+#if _MSC_VER
+ // uxtheme.h defines
+ #ifndef THEMEAPI
+ #define WM_THEMECHANGED 0x031A // when windows changes themes
+ #define BP_PUSHBUTTON 1 // Push Button Type
+ #define PBS_NORMAL 1
+ #define PBS_HOT 2
+ #define PBS_PRESSED 3
+ #define PBS_DISABLED 4
+ #define PBS_DEFAULTED 5
+ #define BP_CHECKBOX 3 // CheckBox Type
+ #define TP_BUTTON 1
+ #define TS_NORMAL 1
+ #define TS_HOT 2
+ #define TS_PRESSED 3
+ #define TS_DISABLED 4
+ #define TS_CHECKED 5
+ #define TS_HOTCHECKED 6
+ #define CBS_UNCHECKEDNORMAL 1
+ #define CBS_UNCHECKEDHOT 2
+ #define CBS_CHECKEDNORMAL 5
+ #define CBS_CHECKEDHOT 6
+ #endif
+#endif
+
+#if defined (__GNUC__)
+ #define SECURITY_ENTRYPOINTA "InitSecurityInterfaceA"
+ #define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINTA
+ #define FreeCredentialsHandle FreeCredentialsHandle
+ #ifndef CDSIZEOF_STRUCT
+ #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
+ #endif
+ #ifndef OPENFILENAME_SIZE_VERSION_400
+ #define OPENFILENAME_SIZE_VERSION_400 CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName)
+ #endif
+ #ifndef NOTIFYICONDATAA_V1_SIZE
+ #define NOTIFYICONDATAA_V1_SIZE CDSIZEOF_STRUCT(NOTIFYICONDATAA, szTip[64])
+ #endif
+ #ifndef NOTIFYICONDATA_V1_SIZE
+ #define NOTIFYICONDATA_V1_SIZE CDSIZEOF_STRUCT(NOTIFYICONDATA, szTip[64])
+ #endif
+ typedef struct tagNMKEY {
+ NMHDR hdr;
+ UINT nVKey;
+ UINT uFlags;
+ } NMKEY, *LPNMKEY;
+ #define ODS_HOTLIGHT 0x0040
+ #define ODS_INACTIVE 0x0080
+ #define SPI_GETFLATMENU 0x1022
+ #define COLOR_HOTLIGHT 26
+ #define COLOR_MENUBAR 30
+ #define COLOR_MENUHILIGHT 29
+ #define COLOR_HIGHLIGHT 13
+ #define BP_PUSHBUTTON 1 // Push Button Type
+ #define PBS_NORMAL 1
+ #define PBS_HOT 2
+ #define PBS_PRESSED 3
+ #define PBS_DISABLED 4
+ #define PBS_DEFAULTED 5
+ #define BP_CHECKBOX 3 // CheckBox Type
+ #define TP_BUTTON 1
+ #define TS_NORMAL 1
+ #define TS_HOT 2
+ #define TS_PRESSED 3
+ #define TS_DISABLED 4
+ #define TS_CHECKED 5
+ #define TS_HOTCHECKED 6
+ #define CBS_UNCHECKEDNORMAL 1
+ #define CBS_UNCHECKEDHOT 2
+ #define CBS_CHECKEDNORMAL 5
+ #define CBS_CHECKEDHOT 6
+// SDK isn't present or some older VC compiler was used, include missing things.
+#elif !defined(NOWIN2K) && (!defined WS_EX_LAYERED || !defined IDC_HAND)
+
+ #pragma message("win2k.h")
+
+ #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+
+ #define PSDK_WORKAROUND
+
+ #define MONITOR_DEFAULTTONEAREST 2
+
+ #ifndef EM_SETTEXTEX
+ #define EM_SETTEXTEX (WM_USER + 97)
+ #define ST_DEFAULT 0
+ #define ST_KEEPUNDO 1
+ #define ST_SELECTION 2
+ #define ST_NEWCHARS 4
+ typedef struct _settextex
+ {
+ DWORD flags;
+ UINT codepage;
+ } SETTEXTEX;
+ #endif
+
+ #if(_WIN32_WINNT >= 0x0500)
+ #define WS_EX_LAYERED 0x00080000
+ #define MIIM_STRING 0x00000040
+ #define MIIM_BITMAP 0x00000080
+ #define MIIM_FTYPE 0x00000100
+ #define HBMMENU_CALLBACK ((HBITMAP) -1)
+ #define ODS_HOTLIGHT 0x0040
+ #define ODS_INACTIVE 0x0080
+ #define IDC_HAND MAKEINTRESOURCE(32649)
+ #define COLOR_HOTLIGHT 26
+ #define COLOR_MENUBAR 30
+ #define COLOR_MENUHILIGHT 29
+ #define COLOR_HIGHLIGHT 13
+ #define SPI_GETFLATMENU 0x1022
+ #define TVS_NOHSCROLL 0x8000
+ #define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006
+ #define SPI_GETHOTTRACKING 0x100E
+ #define BIF_NEWDIALOGSTYLE 0x0040
+ #define LVS_EX_LABELTIP 0x00004000
+ #define DFCS_HOT 0x1000
+ #define FLASHW_TRAY 0x00000002;
+ typedef struct {
+ UINT cbSize;
+ HWND hwnd;
+ DWORD dwFlags;
+ UINT uCount;
+ DWORD dwTimeout;
+ } FLASHWINFO;
+ /* for the help plugin without the SDK */
+ #define SM_XVIRTUALSCREEN 76
+ #define SM_YVIRTUALSCREEN 77
+ #define SM_CXVIRTUALSCREEN 78
+ #define SM_CYVIRTUALSCREEN 79
+ #define COLOR_HOTLIGHT 26
+ #define VK_OEM_PLUS 0xBB
+ #define VK_OEM_MINUS 0xBD
+
+ /* the structure only needs to be defined for VC5 or lower */
+ #if _MSC_VER < 1200
+ typedef struct tagLASTINPUTINFO {
+ UINT cbSize;
+ DWORD dwTime;
+ } LASTINPUTINFO, *PLASTINPUTINFO;
+ #endif /* #if _MSC_VER < 1200 */
+
+ #ifndef OPENFILENAME_SIZE_VERSION_400
+ #define OPENFILENAME_SIZE_VERSION_400 sizeof(OPENFILENAME)
+ #endif
+
+ #ifndef CCM_SETVERSION
+ #define CCM_SETVERSION (CCM_FIRST + 0x7)
+ #endif
+
+ #define SYSRGN 4
+ WINGDIAPI int WINAPI GetRandomRgn(IN HDC, IN HRGN, IN INT);
+
+ #endif /* _WIN32_WINNT >= 0x0500 */
+
+ #define LWA_ALPHA 0x00000002
+ #define AW_HIDE 0x00010000
+ #define AW_BLEND 0x00080000
+ #define SPI_GETSCREENSAVERRUNNING 114
+ #define SM_CMONITORS 80
+
+ #ifndef AW_ACTIVATE
+ #define AW_ACTIVATE 0x00020000
+ #define AW_SLIDE 0x00040000
+ #define AW_VER_NEGATIVE 0x00000008
+ #define AW_HOR_POSITIVE 0x00000001
+ #endif
+
+ #ifndef DWORD_PTR
+ typedef DWORD DWORD_PTR;
+ #endif
+
+ #ifndef HMONITOR
+ DECLARE_HANDLE(HMONITOR);
+ typedef struct tagMONITORINFO
+ {
+ DWORD cbSize;
+ RECT rcMonitor;
+ RECT rcWork;
+ DWORD dwFlags;
+ } MONITORINFO, *LPMONITORINFO;
+ #endif
+
+
+ #ifndef IDropTargetHelper
+ #define INTERFACE IDropTargetHelper
+ DECLARE_INTERFACE_( IDropTargetHelper, IUnknown )
+ {
+ // IUnknown methods
+ STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
+ STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
+ STDMETHOD_(ULONG, Release) ( THIS ) PURE;
+
+ // IDropTargetHelper
+ STDMETHOD (DragEnter)(THIS_ HWND hwndTarget, IDataObject* pDataObject,
+ POINT* ppt, DWORD dwEffect) PURE;
+ STDMETHOD (DragLeave)(THIS) PURE;
+ STDMETHOD (DragOver)(THIS_ POINT* ppt, DWORD dwEffect) PURE;
+ STDMETHOD (Drop)(THIS_ IDataObject* pDataObject, POINT* ppt,
+ DWORD dwEffect) PURE;
+ STDMETHOD (Show)(THIS_ BOOL fShow) PURE;
+
+ };
+ #endif /* IDropTargetHelper */
+
+ #define WM_MENURBUTTONUP 0x0122
+
+// tabsrmm uses these
+
+#define SES_EXTENDBACKCOLOR 4
+#define EM_SETEDITSTYLE (WM_USER + 204)
+#define EM_SETSCROLLPOS (WM_USER + 222)
+#define SF_USECODEPAGE 0x00000020
+
+#define TreeView_SetItemState(hwndTV, hti, data, _mask) \
+{ TVITEM _TVi; \
+ _TVi.mask = TVIF_STATE; \
+ _TVi.hItem = hti; \
+ _TVi.stateMask = _mask; \
+ _TVi.state = data; \
+ SendMessage((hwndTV), TVM_SETITEM, 0, (LPARAM)(TV_ITEM *)&_TVi); \
+}
+
+#endif /* SDK check */
+#endif // WIN2K_H__
|