From c2d827972a16f1710406d15e58304aecc4e1c9b5 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 23 May 2012 05:53:27 +0000 Subject: moved some api headers git-svn-id: http://svn.miranda-ng.org/main/trunk@139 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ExternalAPI/m_cln_skinedit.h | 69 ++-- plugins/ExternalAPI/m_ircscript.h | 129 +++++++ plugins/ExternalAPI/m_libJSON.h | 678 +++++++++++++++++++++++++++++++++++ plugins/ExternalAPI/m_listeningto.h | 36 +- plugins/ExternalAPI/m_simpleaway.h | 59 +-- 5 files changed, 915 insertions(+), 56 deletions(-) create mode 100644 plugins/ExternalAPI/m_ircscript.h create mode 100644 plugins/ExternalAPI/m_libJSON.h (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_cln_skinedit.h b/plugins/ExternalAPI/m_cln_skinedit.h index 5ee66829c5..a1e69bb6e1 100644 --- a/plugins/ExternalAPI/m_cln_skinedit.h +++ b/plugins/ExternalAPI/m_cln_skinedit.h @@ -10,18 +10,32 @@ * data structs */ -struct TWindowData; -class CImageItem; - -struct ButtonItem { - TCHAR szName[40]; +typedef struct _tagImageItem { + char szName[40]; + HBITMAP hbm; + BYTE bLeft, bRight, bTop, bBottom; // sizing margins + BYTE alpha; + DWORD dwFlags; + HDC hdc; + HBITMAP hbmOld; + LONG inner_height, inner_width; + LONG width, height; + BLENDFUNCTION bf; + BYTE bStretch; + HBRUSH fillBrush; + LONG glyphMetrics[4]; + struct _tagImageItem *nextItem; +} ImageItem; + +typedef struct _tagButtonItem { + char szName[40]; HWND hWnd; LONG xOff, yOff; LONG width, height; - CImageItem *imgNormal, *imgPressed, *imgHover; - LONG_PTR normalGlyphMetrics[4]; - LONG_PTR hoverGlyphMetrics[4]; - LONG_PTR pressedGlyphMetrics[4]; + ImageItem *imgNormal, *imgPressed, *imgHover; + LONG normalGlyphMetrics[4]; + LONG hoverGlyphMetrics[4]; + LONG pressedGlyphMetrics[4]; DWORD dwFlags, dwStockFlags; DWORD uId; TCHAR szTip[256]; @@ -29,21 +43,19 @@ struct ButtonItem { char szModule[256], szSetting[256]; BYTE bValuePush[256], bValueRelease[256]; DWORD type; - void (*pfnAction)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem); - void (*pfnCallback)(ButtonItem *item, HWND hwndDlg, TWindowData *dat, HWND hwndItem); + void (*pfnAction)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); + void (*pfnCallback)(struct _tagButtonItem *item, HWND hwndDlg, struct MessageWindowData *dat, HWND hwndItem); TCHAR tszLabel[40]; - ButtonItem* nextItem; - HANDLE hContact; - TWindowData *dat; -}; + struct _tagButtonItem *nextItem; +} ButtonItem; typedef struct _tagButtonSet { ButtonItem *items; LONG left, top, right, bottom; // client area offsets, calculated from button layout } ButtonSet; -struct CSkinItem { - TCHAR szName[40]; +typedef struct { + char szName[40]; char szDBname[40]; int statusID; @@ -65,12 +77,28 @@ struct CSkinItem { int MARGIN_BOTTOM; BYTE IGNORED; DWORD BORDERSTYLE; - CImageItem *imageItem; -}; + ImageItem *imageItem; +} StatusItems_t; + +typedef struct { + BOOL bGRADIENT; + BOOL bCORNER; + BOOL bCOLOR; + BOOL bCOLOR2; + BOOL bCOLOR2_TRANSPARENT; + BOOL bTEXTCOLOR; + BOOL bALPHA; + BOOL bMARGIN_LEFT; + BOOL bMARGIN_TOP; + BOOL bMARGIN_RIGHT; + BOOL bMARGIN_BOTTOM; + BOOL bIGNORED; + BOOL bBORDERSTYLE; +} ChangedSItems_t; typedef struct _tagSkinDescription { DWORD cbSize; - CSkinItem *StatusItems; + StatusItems_t *StatusItems; int lastItem; int firstItem; char szModule[100]; @@ -96,7 +124,6 @@ typedef struct _tagSkinDescription { #define CORNER_TR 4 #define CORNER_BR 8 #define CORNER_BL 16 -#define CORNER_ALL (CORNER_TL | CORNER_TR | CORNER_BR | CORNER_BL | CORNER_ACTIVE) #define GRADIENT_NONE 0 #define GRADIENT_ACTIVE 1 diff --git a/plugins/ExternalAPI/m_ircscript.h b/plugins/ExternalAPI/m_ircscript.h new file mode 100644 index 0000000000..ddab3b96bb --- /dev/null +++ b/plugins/ExternalAPI/m_ircscript.h @@ -0,0 +1,129 @@ + +/* + This file is a description of the interface between the Miranda Scripting + Plugin (MSP) and IRC. It is mainly an internal draft. + + The MSP is a powerful PHP based scripting engine + which can automate many tasks in Miranda IM. With the implementation of + this interface IRC can also benefit from the advantages MSP brings. The + interface has been constructed by the respective authors of IRC and MSP. + + The idea is that MSP and IRC should communicate via the interface outlined herein, + but MSP should "package" the data in attractive functions that can be easily + used by eager scripters. + + Note that m_chat.h should be #included as the events defined therein is used in this interface + + The IRC plugin communicates with MSP mainly through 8 (2 x 4) services which are + illustrated by the following matrix (MSP has 4 services and IRC 4 services): + + + -------------------------------------------------- + | | | + | Incoming raw data | Data going | + | from server | to GUI | + | (before processing) | (after processing) | + | | | + -------------------------------------------------- + | | | + | Outgoing raw data | Data going | + | to server | from GUI | + | (after processing) | (before processing) | + | | | + -------------------------------------------------- + + (processing refers to the IRC plugin reacting to different commands) + +*/ + + +//------------------------- HANDLING RAW MESSAGES ------------------------ +/* + + The two leftmost boxes are related to data sent to and from the server in RAW form. + (a typical RAW message looks like this: ":nick!user@host COMMAND PARAMETERS") + + It is very useful for scripters to be able to manipulate and add RAW streams of data. + + The below structure is used when RAW data is generated and IRC must trigger an + event in MSP so the scripts can do their magic. + + If the data is modified make sure to use MS_SYSTEM_GET_MMI and then mmi_realloc() to + allocate from the same heap. Do not free the data. + + wParam= Module name + lParam= (LPARAM)( char* )pszRaw + returns nonzero if the message should be dropped +*/ + +/* + NOTE! IRC will implement two services which also uses the same parameters: + + "/InsertRawIn" //used for inserting a "fake" incoming RAW event + "/InsertRawOut" //used for inserting a "fake" outgoing RAW event + +*/ + + +#define MS_MBOT_IRC_RAW_IN "MBot/IrcRawIn" +#define MS_MBOT_IRC_RAW_OUT "MBot/IrcRawOut" + + +//------------------------- HANDLING GUI MESSAGES 1 ------------------------ +/* + + The top rightmost box is related to data sent to the gui + (currently chat.dll) in the form of GCEVENT's. (see m_chat.h) + + While maybe not as useful to the scripter, it can be useful to be able to + "tap into" messages to the GUI from the IRC plugin. + + If the data is modified make sure to realloc() or similar. + + wParam= (WPARAM) (WPARAM_GUI_IN) &wgi + lParam= (LPARAM)(GCEVENT *)&gce // see m_chat.h + returns nonzero if the message should be dropped +*/ + +/* + NOTE! IRC will implement a service which also uses the same parameters: + + "/InsertGuiIn" //used for inserting a "fake" event to the GUI + +*/ +typedef struct MBOT_GUI_WPARAM_IN_STRUCT +{ + const char* pszModule; + WPARAM wParam; +}WPARAM_GUI_IN; + +#define MS_MBOT_IRC_GUI_IN "MBot/IrcGuiIn" + + +//------------------------- HANDLING GUI MESSAGES 2 ------------------------ +/* + + The bottom rightmost box is related to data sent from the gui + (currently chat.dll) in the form of GCHOOKS's. Originally this is carried out in a hook, + but for MSP this is done via a service instead. + + It can be useful for scripters to simulate user actions, like entering text, closing the window etc + + If the data is modified make sure to realloc() or similar. + + wParam= Module name + lParam= (LPARAM)(GCHOOK *)gch // see m_chat.h + returns nonzero if the message should be dropped +*/ + +/* + NOTE! IRC will implement a service which also uses the same parameters: + + "/InsertGuiOut" //used for inserting a "fake" outgoing event to the GUI + +*/ + +#define MS_MBOT_IRC_GUI_OUT "MBot/IrcGuiOut" + +#define MS_MBOT_REGISTERIRC "MBot/RegisterIRCModule" + diff --git a/plugins/ExternalAPI/m_libJSON.h b/plugins/ExternalAPI/m_libJSON.h new file mode 100644 index 0000000000..6c9597a496 --- /dev/null +++ b/plugins/ExternalAPI/m_libJSON.h @@ -0,0 +1,678 @@ +#ifndef MIM_LIBJSON_H +#define MIM_LIBJSON_H + +#define IsJSONServiceAvailable() (ServiceExists(MS_JSON_FREE)) +#define json_getJSI(a) CallService(MS_JSON_GETINTERFACE,(WPARAM)a,0) + +#ifndef LIBJSON_H + #define JSONNODE void //so that JSONNODE* is void* + typedef JSONNODE** JSONNODE_ITERATOR; +#endif + +// This function get the service interface for direct calling +// wParam=(WPARAM)(LPJSONSERVICEINTERFACE) +// lParam=0 +// Return value ALWAYS 0 + +typedef struct { + /* + stuff that's in namespace libJSON + */ + void (*free)(void * str); + void (*delete_)(JSONNODE * node); + // #ifdef JSON_MEMORY_MANAGE + void (*free_all)(void); + void (*delete_all)(void); + // #endif + JSONNODE * (*parse)(const char * json); + char * (*strip_white_space)(const char * json); + // #ifdef JSON_VALIDATE + JSONNODE * (*validate)(const char * json); + // #endif + + /* + stuff that's in class JSONNode + */ + //ctors + JSONNODE * (*new_a)(const char * name, const char * value); + JSONNODE * (*new_i)(const char * name, long value); + JSONNODE * (*new_f)(const char * name, double value); + JSONNODE * (*new_b)(const char * name, int value); //because C bools are ints and C++ will implicitly cast it + JSONNODE * (*new_)(char type); + JSONNODE * (*copy)(const JSONNODE * orig); + JSONNODE * (*duplicate)(const JSONNODE * orig); + + //assignment + void (*set_a)(JSONNODE * node, const char * value); + void (*set_i)(JSONNODE * node, long value); + void (*set_f)(JSONNODE * node, double value); + void (*set_b)(JSONNODE * node, int value); //because C bools are ints ane C++ will implicit + void (*set_n)(JSONNODE * node, const JSONNODE * orig); + + //inspectors + char (*type)(const JSONNODE * node); + unsigned int (*size)(const JSONNODE * node); + int (*empty)(const JSONNODE * node); + char * (*name)(const JSONNODE * node); + // #ifdef JSON_COMMENTS + char * (*get_comment)(const JSONNODE * node); + // #endif + char * (*as_string)(const JSONNODE * node); + long (*as_int)(const JSONNODE * node); + double (*as_float)(const JSONNODE * node); + int (*as_bool)(const JSONNODE * node); + JSONNODE * (*as_node)(const JSONNODE * node); + JSONNODE * (*as_array)(const JSONNODE * node); + // #ifdef JSON_BINARY + void * (*as_binary)(const JSONNODE * node, unsigned long * size); + // #endif + // #ifdef JSON_WRITER + char * (*write)(const JSONNODE * node); + char * (*write_formatted)(const JSONNODE * node); + // #endif + + //modifiers + void (*set_name)(JSONNODE * node, const char * name); + // #ifdef JSON_COMMENTS + void (*set_comment)(JSONNODE * node, const char * comment); + // #endif + void (*clear)(JSONNODE * node); + void (*nullify)(JSONNODE * node); + void (*swap)(JSONNODE * node, JSONNODE * node2); + void (*merge)(JSONNODE * node, JSONNODE * node2); + // #ifndef JSON_PREPARSE + void (*preparse)(JSONNODE * node); + // #endif + // #ifdef JSON_BINARY + void (*set_binary)(JSONNODE * node, const void * data, unsigned long length); + // #endif + void (*cast)(JSONNODE * node, char type); + + //children access + void (*reserve)(JSONNODE * node, unsigned int siz); + JSONNODE * (*at)(JSONNODE * node, unsigned int pos); + JSONNODE * (*get)(JSONNODE * node, const char * name); + // #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE * (*get_nocase)(JSONNODE * node, const char * name); + JSONNODE * (*pop_back_nocase)(JSONNODE * node, const char * name); + // #endif + void (*push_back)(JSONNODE * node, JSONNODE * node2); + JSONNODE * (*pop_back_at)(JSONNODE * node, unsigned int pos); + JSONNODE * (*pop_back)(JSONNODE * node, const char * name); + // #ifdef JSON_ITERATORS + JSONNODE_ITERATOR (*find)(JSONNODE * node, const char * name); + // #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE_ITERATOR (*find_nocase)(JSONNODE * node, const char * name); + // #endif + JSONNODE_ITERATOR (*erase)(JSONNODE * node, JSONNODE_ITERATOR it); + JSONNODE_ITERATOR (*erase_multi)(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + JSONNODE_ITERATOR (*insert)(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2); + JSONNODE_ITERATOR (*insert_multi)(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + + //iterator functions + JSONNODE_ITERATOR (*begin)(JSONNODE * node); + JSONNODE_ITERATOR (*end)(JSONNODE * node); + // #endif + + //comparison + int (*equal)(JSONNODE * node, JSONNODE * node2); +} JSONSERVICEINTERFACE, *PJSONSERVICEINTERFACE, *LPJSONSERVICEINTERFACE; + +extern JSONSERVICEINTERFACE jsi; + +#ifndef LIBJSON_H +#define json_free(a) jsi.free(a) +#define json_delete(a) jsi.delete_(a) +// #ifdef JSON_MEMORY_MANAGE +#define json_free_all() jsi.free_all() +#define json_delete_all() jsi.delete_all() +// #endif +#define json_parse(a) jsi.parse(a) +#define json_strip_white_space(a) jsi.strip_white_space(a) +// #ifdef JSON_VALIDATE +#define json_validate(a) jsi.validate(a) +// #endif +#define json_new_a(a,b) jsi.new_a(a,b) +#define json_new_i(a,b) jsi.new_i(a,b) +#define json_new_f(a,b) jsi.new_f(a,b) +#define json_new_b(a,b) jsi.new_b(a,b) +#define json_new(a) jsi.new_(a) +#define json_copy(a) jsi.copy(a) +#define json_duplicate(a) jsi.duplicate(a) +#define json_set_a(a,b) jsi.set_a(a,b) +#define json_set_i(a,b) jsi.set_i(a,b) +#define json_set_f(a,b) jsi.set_f(a,b) +#define json_set_b(a,b) jsi.set_b(a,b) +#define json_set_n(a,b) jsi.set_n(a,b) +#define json_type(a) jsi.type(a) +#define json_size(a) jsi.size(a) +#define json_empty(a) jsi.empty(a) +#define json_name(a) jsi.name(a) +// #ifdef JSON_COMMENTS +#define json_get_comment(a) jsi.get_comment(a) +// #endif +#define json_as_string(a) jsi.as_string(a) +#define json_as_int(a) jsi.as_int(a) +#define json_as_float(a) jsi.as_float(a) +#define json_as_bool(a) jsi.as_bool(a) +#define json_as_node(a) jsi.as_node(a) +#define json_as_array(a) jsi.as_array(a) +// #ifdef JSON_BINARY +#define json_as_binary(a,b) jsi.as_binary(a,b) +// #endif +// #ifdef JSON_WRITER +#define json_write(a) jsi.write(a) +#define json_write_formatted(a) jsi.write_formatted(a) +// #endif +#define json_set_name(a,b) jsi.set_name(a,b) +// #ifdef JSON_COMMENTS +#define json_set_comment(a,b) jsi.set_comment(a,b) +// #endif +#define json_clear(a) jsi.clear(a) +#define json_nullify(a) jsi.nullify(a) +#define json_swap(a,b) jsi.swap(a,b) +#define json_merge(a,b) jsi.merge(a,b) +// #ifndef JSON_PREPARSE +#define json_preparse(a) jsi.preparse(a) +// #endif +// #ifdef JSON_BINARY +#define json_set_binary(a,b,c) jsi.set_binary(a,b,c) +// #endif +#define json_cast(a,b) jsi.cast(a,b) +#define json_reserve(a,b) jsi.reserve(a,b) +#define json_at(a,b) jsi.at(a,b) +#define json_get(a,b) jsi.get(a,b) +// #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS +#define json_get_nocase(a,b) jsi.get_nocase(a,b) +#define json_pop_back_nocase(a,b) jsi.pop_back_nocase(a,b) +// #endif +#define json_push_back(a,b) jsi.push_back(a,b) +#define json_pop_back_at(a,b) jsi.pop_back_at(a,b) +#define json_pop_back(a,b) jsi.pop_back(a,b) +// #ifdef JSON_ITERATORS +#define json_find(a,b) jsi.find(a,b) +// #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS +#define json_find_nocase(a,b) jsi.find_nocase(a,b) +// #endif +#define json_erase(a,b) jsi.erase(a,b) +#define json_erase_multi(a,b,c) jsi.erase_multi(a,b,c) +#define json_insert(a,b,c) jsi.insert(a,b,c) +#define json_insert_multi(a,b,c,d) jsi.insert_multi(a,b,c,d) +#define json_begin(a) jsi.begin(a) +#define json_end(a) jsi.end(a) +#define json_equal(a,b) jsi.equal(a,b) +#endif + +#define MS_JSON_GETINTERFACE "JSON/GetInterface" + +// This function removes the memory allocated by various functions that return strings, +// such as MS_JSON_AS_*, json_write... +// wParam=(WPARAM)(LPVOID)pVoid +// lParam=0 +// Return value ALWAYS 0 +#define MS_JSON_FREE "JSON/Free" + +// Delete specified node and all its children +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Return value ALWAYS 0 +#define MS_JSON_DELETE "JSON/Delete" + +// + +// This function parses JSON text and returns you a HANDLE which is the root node of the text +// that you just passed it. If bad JSON is sent to this method it may return NULL. +// wParam=(WPARAM)(LPCSTR)szJSON +// lParam=0 +// Returns a HANDLE on success, NULL on failure +// * Remember to free the handle with MS_JSON_DELETE +#define MS_JSON_PARSE "JSON/Parse" + +// This function removes anything that the JSON standard defines as white space, +// including extra tabs, spaces, formatting, and comments. This makes this function useful +// for compressing json that needs to be stored or sent over a network. +// wParam=(WPARAM)(LPCSTR)szJSON +// lParam=0 +// Returns a newly allocated valid JSON that is free of all white space +// * Remember to free the string with MS_JSON_FREE +#define MS_JSON_STRIP_WHITE_SPACE "JSON/StripWhiteSpace" + + +// + +// This function creates a string node with the name and value specified. +// wParam=(WPARAM)(LPCSTR)szName +// lParam=(LPARAM)(LPCSTR)szValue +// Returns a newly allocated node +// You must (*delete the resulting node or attach it to something as a child. +#define MS_JSON_NEW_STRING "JSON/NewA" + +// This function creates a integer node with the name and value specified. +// wParam=(WPARAM)(LPCSTR)szName +// lParam=(LPARAM)(long)lValue +// Returns a newly allocated node +// You must (*delete the resulting node or attach it to something as a child. +// Warning: The value IS SIGNED, for unsigned use MS_JSON_NEW_FLOAT instead. +#define MS_JSON_NEW_INTEGER "JSON/NewI" + +// This function creates a floating point node with the name and value specified. +// wParam=(WPARAM)(LPCSTR)szName +// lParam=(LPARAM)(float)fValue +// Returns a newly allocated node +// You must (*delete the resulting node or attach it to something as a child. +#define MS_JSON_NEW_FLOAT "JSON/NewF" + +// This function creates a boolean node with the name and value specified. +// wParam=(WPARAM)(LPCSTR)szName +// lParam=(LPARAM)(int)iValue +// Returns a newly allocated node +// You must (*delete the resulting node or attach it to something as a child. +#define MS_JSON_NEW_BOOLEAN "JSON/NewB" + +// This function creates an empty node of the specified type. +// This would normally be used to start serializing something or writing a configuration file. +// wParam=(WPARAM)(char)cType +// lParam=0 +// Returns a newly allocated node +// You must (*delete the resulting node or attach it to something as a child. +#define JSON_NULL '\0' +#define JSON_STRING '\1' +#define JSON_NUMBER '\2' +#define JSON_BOOL '\3' +#define JSON_ARRAY '\4' +#define JSON_NODE '\5' + +#define MS_JSON_NEW "JSON/New" + +// This function copies a JSONNODE and returns the new copy. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns an exact copy of the node parameter +#define MS_JSON_COPY "JSON/Copy" + +// Constructs a JSONNODE object, by copying the contents of JSONNODE. +// This is different from the MS_JSON_COPY because it makes a literal copy, +// not reference counting. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a HANDLE that is a new copy of the original node. +#define MS_JSON_DUPLICATE "JSON/Duplicate" + +// Sets the string value of the JSONNODE. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(LPCSTR)szValue +// Return value ALWAYS 0 +#define MS_JSON_SET_STRING "JSON/SetA" + +// Sets the integer value of the JSONNODE. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(long)lValue +// Return value ALWAYS 0 +// Warning: The value IS SIGNED, for unsigned use MS_JSON_SET_FLOAT instead. +#define MS_JSON_SET_INTEGER "JSON/SetI" + +// Sets the floating point value of the JSONNODE. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(float)fValue +// Return value ALWAYS 0 +#define MS_JSON_SET_FLOAT "JSON/SetF" + +// Sets the boolean value of the JSONNODE. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(int)iValue +// Return value ALWAYS 0 +#define MS_JSON_SET_BOOLEAN "JSON/SetB" + +// Sets the value of the JSONNODE to the value of the other, +// usually through fast and simple reference counting. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(HANDLE)hValueNode +// Return value ALWAYS 0 +#define MS_JSON_SET_NODE "JSON/SetN" + +// Returns the type of the JSONNODE. +// usually through fast and simple reference counting. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns value of JSON_* (See MS_JSON_NEW) +#define MS_JSON_TYPE "JSON/Type" + +// Returns the number of children that the node has. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns the number of children +// This should be zero for anything other than JSON_ARRAY or JSON_NODE, +// but this is only guaranteed with the JSON_SAFE option turned on (by default). +// This is because casting may or may not purge the children. +#define MS_JSON_SIZE "JSON/Size" + +// Returns whether or not the node has any children. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns 0 if the node is empty, nonzero if not +// If the node is not of JSON_NODE or JSON_ARRAY it will invariably return true. +#define MS_JSON_EMPTY "JSON/Empty" + +// Returns the name of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a newly allocated string. +// If there is no name, then it returns a blank string. +#define MS_JSON_NAME "JSON/Name" + +// + +// Returns the string representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a newly allocated string representation of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: "" or "null" depending on how it was created +// JSON_STRING: The unescaped string value +// JSON_NUMBER: The number in string form (may be in scientific notation) +// JSON_BOOL: "true" or "false" +// JSON_ARRAY: "" +// JSON_NODE: "" +#define MS_JSON_AS_STRING "JSON/AsString" + +// Returns the integer representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns the integer representation of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: 0 +// JSON_STRING: Undefined +// JSON_NUMBER: Truncated Value +// JSON_BOOL: 1 if true, 0 if false +// JSON_ARRAY: Undefined +// JSON_NODE: Undefined +// Warning: The value IS SIGNED, for unsigned use MS_JSON_AS_FLOAT instead. +// If the value is actually a floating point value, it will continue on ahead +// and simply truncate the value. So 15.9 will be returned as 15. +#define MS_JSON_AS_INTEGER "JSON/AsInt" + +// Returns the floating point representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns the floating point representation of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: 0.0 +// JSON_STRING: Undefined +// JSON_NUMBER: Value +// JSON_BOOL: 1.0 if true, 0.0 if false +// JSON_ARRAY: Undefined +// JSON_NODE: Undefined +#define MS_JSON_AS_FLOAT "JSON/AsFloat" + +// Returns the boolean representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns the boolean representation of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: 0.0 +// JSON_STRING: Undefined +// JSON_NUMBER: Value == 0.0 +// JSON_BOOL: Value +// JSON_ARRAY: Undefined +// JSON_NODE: Undefined +#define MS_JSON_AS_BOOLEAN "JSON/AsBool" + +// Returns the boolean representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a HANDLE of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: Empty node +// JSON_STRING: Empty node +// JSON_NUMBER: Empty node +// JSON_BOOL: Empty node +// JSON_ARRAY: Array converted to a node +// JSON_NODE: A copy of the node +// For anything other than node and array, it simply returns an +// empty node. If the caller is an array, it will convert it to a node. +// This command creates a new JSONNODE that has to be deleted or attached to a parent. +#define MS_JSON_AS_NODE "JSON/AsNode" + +// Returns the array representation of the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a HANDLE of the node. +// The return value may be different depending on the type of the node +// JSON_NULL: Empty node +// JSON_STRING: Empty node +// JSON_NUMBER: Empty node +// JSON_BOOL: Empty node +// JSON_ARRAY: A copy of the array +// JSON_NODE: An array of the children +// For anything other than node and array, it simply returns an +// empty array. If the caller is an node, it will convert it to an array by stripping +// all of the names of each child. +// This command creates a new JSONNODE that has to be deleted or attached to a parent. +#define MS_JSON_AS_ARRAY "JSON/AsArray" + +// + +// Returns JSON text, with no white space or comments. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a JSON text of the node being written. +// Remember to free the return value with MS_JSON_FREE +// Designed to create JSON that is very small, and therefore, faster to send between +// servers or write to a disk. The flipside is that it's nearly impossible to read by human eyes. +// Only root nodes (JSON_NODE and JSON_ARRAYs) are meant to be written, +// all others will return a blank string. +#define MS_JSON_WRITE "JSON/Write" + +// Returns JSON text that has been indented and prettied up so that it can be easily +// read and modified by humans. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Returns a JSON text of the node being written. +// Remember to free the return value with MS_JSON_FREE +// Only root nodes (JSON_NODE and JSON_ARRAYs) are meant to be written, +// all others will return a blank string. +#define MS_JSON_WRITE_FORMATTED "JSON/WriteFormatted" + +// Sets the name of the JSONNode. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(LPCSTR)szName +// Return value ALWAYS 0 +#define MS_JSON_SET_NAME "JSON/SetName" + +// Clears all children from the node. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Return value ALWAYS 0 +#define MS_JSON_CLEAR "JSON/Clear" + +// Nulls out the node +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Return value ALWAYS 0 +#define MS_JSON_NULLIFY "JSON/Nullify" + +// Swaps the contents of two nodes. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(WPARAM)(HANDLE)hCode2 +// Return value ALWAYS 0 +// This is very fast because JSONNODE is just a wrapper around an +// internal structure, so it simply swaps pointers to those structures. +#define MS_JSON_SWAP "JSON/Swap" + +// Merge the contents of nodes +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(WPARAM)(HANDLE)hCode2 +// Return value ALWAYS 0 +// It's possible that you may end up with multiple copies of the same node, +// through duplication and such. To save space, you might want to merge the +// internal reference counted structure. +#define MS_JSON_MERGE "JSON/Merge" + +// Preparse the json +// wParam=(WPARAM)(HANDLE)hNode +// lParam=0 +// Return value ALWAYS 0 +// libjson's lazy parsing makes parsing JSON that is not entirely used very fast, +// but sometimes you want to parse it all at once, making the next reads a little faster +#define MS_JSON_PREPARSE "JSON/Preparse" + +// (*set_binary not reflected as it requires 3 parameters +/* +#ifdef JSON_BINARY + void (*set_binary(JSONNODE * node, const void * data, unsigned long length); +#endif + */ + +// Will change the node to a different type and do any conversions necessary. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(char)cType +// Return value ALWAYS 0 +// Value of cType refer to MS_JSON_NEW +#define MS_JSON_CAST "JSON/Cast" + +// This function reserves children space, this makes the program faster and use less memory +// as it doesn't have to keep allocating new memory when it runs out. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(int)iSize +// Return value ALWAYS 0 +// Value of cType refer to MS_JSON_NEW +#define MS_JSON_RESERVE "JSON/Reserve" + +// This will give you a reference to a child node at a specific location. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(int)iPos +// Returns the HANDLE to the iPos' node of hNode +// This is a safe function and will return zero if you go out of bounds. +// The returned value is still a child, so do not try and delete the results. +#define MS_JSON_AT "JSON/At" + +// This will give you a reference to a child node by its name. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(LPCSTR)szName +// Returns the HANDLE of the child named szName +// This is a safe function and will return zero if that child does not exist. +// The returned value is still a child, so do not try and delete the results. +#define MS_JSON_GET "JSON/Get" + +// + +// This function pushes a new child node on the back of the child list. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(HANDLE)hNode2 +// Return value ALWAYS 0 +// This method copies the child, so altering the parameter later will not affect the one in the children. +// The child is then managed, so do not try and delete it later. +#define MS_JSON_PUSH_BACK "JSON/PushBack" + +// This will give remove a JSONNODE from it's parent and return it to you. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(int)iPos +// Returns the HANDLE of the child named szName +// Because it's removed from the parent, you must delete it yourself. +#define MS_JSON_POP_BACK_AT "JSON/PopBackAt" + +// This will give remove a JSONNODE from it's parent and return it to you. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(LPCSTR)szName +// Returns the HANDLE of the child named szName +// Because it's removed from the parent, you must delete it yourself. +#define MS_JSON_POP_BACK "JSON/PopBack" + +// functions with JSON_ITERATORS not reflected + #ifdef JSON_ITERATORS + JSONNODE_ITERATOR (*find(JSONNODE * node, const char * name); + #ifdef JSON_CASE_INSENSITIVE_FUNCTIONS + JSONNODE_ITERATOR (*find_nocase(JSONNODE * node, const char * name); + #endif + JSONNODE_ITERATOR (*erase(JSONNODE * node, JSONNODE_ITERATOR it); + JSONNODE_ITERATOR (*erase_multi(JSONNODE * node, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + JSONNODE_ITERATOR (*insert(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE * node2); + JSONNODE_ITERATOR (*insert_multi(JSONNODE * node, JSONNODE_ITERATOR it, JSONNODE_ITERATOR start, JSONNODE_ITERATOR end); + + //iterator functions + JSONNODE_ITERATOR (*begin(JSONNODE * node); + JSONNODE_ITERATOR (*end(JSONNODE * node); + #endif + +// Checks if the value held within the nodes are equal. +// wParam=(WPARAM)(HANDLE)hNode +// lParam=(LPARAM)(HANDLE)hNode2 +// Returns 0 if not equal, nonzero otherwise +// This ignores things like comments, but for JSON_NODE and JSON_ARRAYs, +// this is a deep comparison, checking each child too. +#define MS_JSON_EQUAL "JSON/Equal" + +#endif // MIM_LIBJSON_H diff --git a/plugins/ExternalAPI/m_listeningto.h b/plugins/ExternalAPI/m_listeningto.h index c1d8d63052..cc0b2990d2 100644 --- a/plugins/ExternalAPI/m_listeningto.h +++ b/plugins/ExternalAPI/m_listeningto.h @@ -1,32 +1,29 @@ /* -ListeningTo plugin for Miranda IM -========================================================================== -Copyright (C) 2005-2011 Ricardo Pescuma Domenecci - (C) 2010-2011 Merlin_de +Copyright (C) 2006 Ricardo Pescuma Domenecci This 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. +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. This 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. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library 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. +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ #ifndef __M_LISTENINGTO_H__ # define __M_LISTENINGTO_H__ -#ifndef MIID_LISTENINGTO + #define MIID_LISTENINGTO { 0x1fc1efa, 0xaa9f, 0x461b, { 0x92, 0x69, 0xaf, 0x66, 0x6b, 0x89, 0x31, 0xee } } -#endif + // To be used by other plugins to send listening info to miranda #define MIRANDA_WINDOWCLASS _T("Miranda.ListeningTo") @@ -69,6 +66,15 @@ lParam: BOOL - enabled #define ME_LISTENINGTO_ENABLE_STATE_CHANGED "ListeningTo/EnableStateChanged" +/* +Notification fired when listening info changed + +wParam: LISTENINGTOINFO * - pointer to listening info structure or NULL +lParam: NULL +*/ +#define ME_LISTENINGTO_LISTENING_INFO_CHANGED "ListeningTo/ListeningInfoChanged" + + /* Provide new info about a song change to listening to diff --git a/plugins/ExternalAPI/m_simpleaway.h b/plugins/ExternalAPI/m_simpleaway.h index e451c93f32..e70dcbf4ac 100644 --- a/plugins/ExternalAPI/m_simpleaway.h +++ b/plugins/ExternalAPI/m_simpleaway.h @@ -1,39 +1,42 @@ /* -SimpleAway plugin for Miranda-IM +Simple Status Message plugin for Miranda IM +Copyright (C) 2006-2010 Bartosz 'Dezeath' Białek, (C) 2005 Harven -Copyright © 2005 Harven, © 2006-2008 Dezeath - -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 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. +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., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #ifndef M_SIMPLEAWAY_H__ #define M_SIMPLEAWAY_H__ 1 +// +// NOTE: These services are deprecated. Please do not use them anymore. +// Take a look at m_simplestatusmsg.h instead. +// + // Represents status that a protocol(s) is/are currently in #define ID_STATUS_CURRENT 40082 // Force a change of global status mode/message -// wParam = (int)new status, from statusmodes.h or ID_STATUS_CURRENT -// lParam = (char *)status message +// wParam = (int)new status (from statusmodes.h), 0 or ID_STATUS_CURRENT for current +// lParam = (TCHAR *)status message #define MS_SA_SETSTATUSMODE "SimpleAway/SetStatusMode" #define MS_AWAYSYS_SETSTATUSMODE MS_SA_SETSTATUSMODE // for compatibility with some plugins // Brings up the status message dialog // wParam = 0 -// lParam = (char *)protocol name, NULL if for all protocols +// lParam = (LPARAM)(char *)protocol name, NULL if for all protocols #define MS_SA_SHOWSTATUSMSGDIALOG "SimpleAway/ShowStatusMessageDialog" // Similar to the service above, for internal use only @@ -41,8 +44,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Force a change of status mode/message. The status message dialog will appear, // depending on the configuration of the user -// wParam = (int)new status, from statusmodes.h -// lParam = (char *)protocol name, NULL if for all protocols +// wParam = (int)new status +// lParam = (LPARAM)(char *)protocol name, NULL if for all protocols // Returns 1 when changed without showing the status message dialog #define MS_SA_CHANGESTATUSMSG "SimpleAway/ChangeStatusMessage" @@ -58,13 +61,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Returns immediately, without waiting for the message to retrieve #define MS_SA_COPYAWAYMSG "SimpleAway/CopyAwayMsg" +// Go to URL in away/na/etc message of a contact +// wParam = (WPARAM)(HANDLE)hContact +// lParam = 0 +#define MS_SA_GOTOURLMSG "SimpleAway/GoToURLMsg" + // Returns the default status message for a status in specified protocol module -// or the current status message for the specified protocol if ID_STATUS_CURRENT is used -// wParam = (int)status, from statusmodes.h or ID_STATUS_CURRENT -// lParam = (char *)protocol name, NULL if for all protocols +// or the current status message for the specified protocol if 0 or ID_STATUS_CURRENT is used +// wParam = (int)status, 0 or ID_STATUS_CURRENT for current +// lParam = (LPARAM)(char *)protocol name, NULL if for all protocols // Returns status msg. Remember to free the return value #ifndef MS_AWAYMSG_GETSTATUSMSG -#define MS_AWAYMSG_GETSTATUSMSG "SRAway/GetStatusMessage" + #define MS_AWAYMSG_GETSTATUSMSG "SRAway/GetStatusMessage" +#endif +#ifndef MS_AWAYMSG_GETSTATUSMSGW + #define MS_AWAYMSG_GETSTATUSMSGW "SRAway/GetStatusMessageW" +#endif + +#ifndef MS_AWAYMSG_GETSTATUSMSGT + #ifdef _UNICODE + #define MS_AWAYMSG_GETSTATUSMSGT MS_AWAYMSG_GETSTATUSMSGW + #else + #define MS_AWAYMSG_GETSTATUSMSGT MS_AWAYMSG_GETSTATUSMSG + #endif #endif // Force a change to specified global status mode/message -- cgit v1.2.3