#ifndef __ISLPRONTO_PLUGIN_H__ #define __ISLPRONTO_PLUGIN_H__ /* use this template to implement plugin: ... functions go here ... void ISLProntoPluginStart() { ... initialization goes here ... } ISLPRONTO_PLUGIN(ISLProntoPluginStart) */ #define ISLPRONTO_CONNECTION_INFO_ID 1000 #define ISLPRONTO_CONNECTION_INFO_SERVER 0 #define ISLPRONTO_CONNECTION_INFO_USERNAME 1 #define ISLPRONTO_CONNECTION_INFO_DESCRIPTION 2 #define ISLPRONTO_CLIENT_EVENT_NEW 0 #define ISLPRONTO_CLIENT_EVENT_UPDATE 1 #define ISLPRONTO_CLIENT_EVENT_GONE 2 #define ISLPRONTO_CLIENT_INFO_ID 1000 #define ISLPRONTO_CLIENT_INFO_NAME 0 #define ISLPRONTO_CLIENT_INFO_EMAIL 1 #define ISLPRONTO_CLIENT_INFO_TIME 2 #define ISLPRONTO_CLIENT_INFO_URL 3 #define ISLPRONTO_CLIENT_INFO_REFERRER 4 #define ISLPRONTO_CLIENT_INFO_BROWSER 5 #define ISLPRONTO_CLIENT_INFO_GEO_COUNTRY_CODE 6 #define ISLPRONTO_CLIENT_INFO_GEO_COUNTRY 7 #define ISLPRONTO_CLIENT_INFO_GEO_CITY 8 #define ISLPRONTO_CLIENT_INFO_IP 9 #define ISLPRONTO_CLIENT_INFO_INTERNAL_IP 10 #define ISLPRONTO_CLIENT_INFO_REVERSE_DNS 11 #define ISLPRONTO_CLIENT_INFO_CHAT_ID 12 #define ISLPRONTO_USER_EVENT_NEW 0 #define ISLPRONTO_USER_EVENT_UPDATE 1 #define ISLPRONTO_USER_EVENT_GONE 2 #define ISLPRONTO_USER_INFO_ID 1000 #define ISLPRONTO_USER_INFO_MYSELF 1001 #define ISLPRONTO_USER_INFO_NAME 0 #define ISLPRONTO_USER_INFO_EMAIL 1 #define ISLPRONTO_USER_INFO_PHOTO 2 #define ISLPRONTO_USER_INFO_GEO_COUNTRY_CODE 3 #define ISLPRONTO_USER_INFO_GEO_COUNTRY 4 #define ISLPRONTO_USER_INFO_GEO_CITY 5 #define ISLPRONTO_USER_STATUS_UNKNOWN -1 #define ISLPRONTO_USER_STATUS_AVAILABLE 0 #define ISLPRONTO_USER_STATUS_BUSY 1 #define ISLPRONTO_USER_STATUS_UNAVAILABLE 2 #define ISLPRONTO_CHAT_INFO_ID 1000 #define ISLPRONTO_CHAT_INFO_CLIENT_CHAT 0 #define ISLPRONTO_MESSAGE_INFO_RAWHTML 0 #define ISLPRONTO_MESSAGE_INFO_TIME 1 #define ISLPRONTO_MESSAGE_INFO_TEXT 2 #define ISLPRONTO_MESSAGE_TYPE_RESET_CHAT -2 #define ISLPRONTO_MESSAGE_TYPE_RESET_CHAT_DONE -1 #define ISLPRONTO_MESSAGE_TYPE_CLIENT 0 #define ISLPRONTO_MESSAGE_TYPE_SUPPORTER 1 #define ISLPRONTO_MESSAGE_TYPE_SUPPORTER_COMMENT 2 #define ISLPRONTO_MESSAGE_TYPE_SYSTEM 3 #ifdef __cplusplus extern "C" { #endif struct internalislpronto_ISLProntoString; typedef struct internalislpronto_ISLProntoString *ISLProntoString; struct internalislpronto_ISLProntoClientInfo; typedef struct internalislpronto_ISLProntoClientInfo *ISLProntoClientInfo; struct internalislpronto_ISLProntoCustomFields; typedef struct internalislpronto_ISLProntoCustomFields *ISLProntoCustomFields; struct internalislpronto_ISLProntoUserInfo; typedef struct internalislpronto_ISLProntoUserInfo *ISLProntoUserInfo; struct internalislpronto_ISLProntoStringSet; typedef struct internalislpronto_ISLProntoStringSet *ISLProntoStringSet; struct internalislpronto_ISLProntoChatInfo; typedef struct internalislpronto_ISLProntoChatInfo *ISLProntoChatInfo; struct internalislpronto_ISLProntoMessageInfo; typedef struct internalislpronto_ISLProntoMessageInfo *ISLProntoMessageInfo; struct internalislpronto_ISLProntoConnectionInfo; typedef struct internalislpronto_ISLProntoConnectionInfo *ISLProntoConnectionInfo; struct internalislpronto_ISLProntoApplication { int PluginApiRevision; void (*FreeString)(ISLProntoString); const char *(*StringAsUtf8)(ISLProntoString); const wchar_t *(*StringAsWide)(ISLProntoString); const char *(*StringAsLocal8bit)(ISLProntoString); ISLProntoString (*StringFromUtf8)(const char *); ISLProntoString (*StringFromWide)(const wchar_t *); ISLProntoString (*StringFromLocal8bit)(const char *); ISLProntoString (*Version)(); ISLProntoString (*CurrentLanguageCode)(); void (*ExecuteInMainThread)(void (*fn)(void*), void *arg); void (*RegisterClientEventHandler)(void (*fn)(void*, int, ISLProntoClientInfo), void*); void (*UnRegisterClientEventHandler)(void (*fn)(void*, int, ISLProntoClientInfo)); ISLProntoString (*ClientInfoGetKey)(ISLProntoClientInfo, int); void (*FreeCustomFields)(ISLProntoCustomFields); ISLProntoCustomFields (*ClientInfoGetCustomFields)(ISLProntoClientInfo); int (*CustomFieldsCount)(ISLProntoCustomFields); ISLProntoString (*CustomFieldsGetKey)(ISLProntoCustomFields, int); ISLProntoString (*CustomFieldsGetValue)(ISLProntoCustomFields, int); ISLProntoString (*CustomFieldsGetKeyValue)(ISLProntoCustomFields, ISLProntoString); void (*RegisterUserEventHandler)(void (*fn)(void*, int, ISLProntoUserInfo), void*); void (*UnRegisterUserEventHandler)(void (*fn)(void*, int, ISLProntoUserInfo)); ISLProntoString (*UserInfoGetKey)(ISLProntoUserInfo, int); int (*UserInfoGetStatus)(ISLProntoUserInfo); ISLProntoStringSet (*UserInfoGetChatMembership)(ISLProntoUserInfo); ISLProntoStringSet (*UserInfoGetFilterMembership)(ISLProntoUserInfo); void (*FreeStringSet)(ISLProntoStringSet); void (*StringSetIterateReset)(ISLProntoStringSet); ISLProntoString (*StringSetIterateGet)(ISLProntoStringSet); void (*StringSetIterateAdvance)(ISLProntoStringSet); int (*StringSetContains)(ISLProntoStringSet, ISLProntoString); void (*RegisterChatEventHandler)(void (*fn)(void*, ISLProntoChatInfo), void*); void (*UnRegisterChatEventHandler)(void (*fn)(void*, ISLProntoChatInfo)); ISLProntoString (*ChatInfoGetKey)(ISLProntoChatInfo, int); int (*ChatInfoIAmMember)(ISLProntoChatInfo); ISLProntoStringSet (*ChatInfoGetMemberUsers)(ISLProntoChatInfo); ISLProntoStringSet (*ChatInfoGetMemberClients)(ISLProntoChatInfo); void (*AttachDebugger)(); void (*RegisterMessageEventHandler)(void (*fn)(void*, ISLProntoMessageInfo), void*); void (*UnRegisterMessageEventHandler)(void (*fn)(void*, ISLProntoMessageInfo)); ISLProntoString (*MessageInfoGetKey)(ISLProntoMessageInfo, int); int (*MessageInfoGetType)(ISLProntoMessageInfo); ISLProntoChatInfo (*MessageInfoAccessChatInfo)(ISLProntoMessageInfo); ISLProntoConnectionInfo (*MessageInfoAccessConnectionInfo)(ISLProntoMessageInfo); ISLProntoClientInfo (*MessageInfoAccessClientInfo)(ISLProntoMessageInfo); ISLProntoUserInfo (*MessageInfoAccessUserInfo)(ISLProntoMessageInfo); ISLProntoConnectionInfo (*ClientInfoAccessConnectionInfo)(ISLProntoClientInfo); ISLProntoConnectionInfo (*UserInfoAccessConnectionInfo)(ISLProntoUserInfo); ISLProntoConnectionInfo (*ChatInfoAccessConnectionInfo)(ISLProntoChatInfo); ISLProntoString (*ConnectionInfoGetKey)(ISLProntoConnectionInfo, int); void (*JoinChat)(ISLProntoString, ISLProntoString); void (*LeaveChat)(ISLProntoString, ISLProntoString); void (*StartChatWithUser)(ISLProntoString, ISLProntoString); void (*JoinChatWithClient)(ISLProntoString, ISLProntoString); void (*Say)(ISLProntoString, ISLProntoString, ISLProntoString, int); int (*MessageInfoIsReplay)(ISLProntoMessageInfo); int (*ChatInfoIAmOnlyOneInChat)(ISLProntoChatInfo); int (*UserInfoIsMyself)(ISLProntoUserInfo); ISLProntoString (*ConnectionInfoGetId)(ISLProntoConnectionInfo); ISLProntoString (*UserInfoGetId)(ISLProntoUserInfo); ISLProntoString (*ClientInfoGetId)(ISLProntoClientInfo); ISLProntoString (*ChatInfoGetId)(ISLProntoChatInfo); int (*StringNonEmpty)(ISLProntoString); int (*StringSetSize)(ISLProntoStringSet); }; struct internalislpronto_ISLProntoPlugin { int PluginApiRevision; struct internalislpronto_ISLProntoApplication *Application; void (*Initialize)(); }; extern struct internalislpronto_ISLProntoPlugin internalislpronto_plugin; #define internalislpronto_PLUGIN_API_REVISION 1 #define internalislpronto_PLUGIN(init) \ void internalislpronto_plugin_init() { init(); } \ struct internalislpronto_ISLProntoPlugin internalislpronto_plugin = { \ internalislpronto_PLUGIN_API_REVISION, \ 0, \ internalislpronto_plugin_init \ }; \ __declspec(dllexport) struct internalislpronto_ISLProntoPlugin *export_islpronto_plugin() { return &internalislpronto_plugin; } #define ISLPronto internalislpronto_plugin.Application #ifdef __cplusplus #define ISLPRONTO_PLUGIN(init) extern "C" { internalislpronto_PLUGIN(init) } #else #define ISLPRONTO_PLUGIN(init) internalislpronto_PLUGIN(init) #endif #ifdef __cplusplus } #endif #ifdef __cplusplus class ISLProntoStringCxx { ISLProntoString str; void destroy() { if(str) ISLPronto->FreeString(str); } ISLProntoStringCxx(const ISLProntoStringCxx &o); // deny ISLProntoStringCxx &operator = (const ISLProntoStringCxx &o); // deny public: ISLProntoStringCxx(ISLProntoString str_ = 0): str(str_) {} ISLProntoStringCxx &operator = (ISLProntoString o) { destroy(); str = o; return *this; } ~ISLProntoStringCxx() { destroy(); } operator bool () const { return str != 0; } const char *AsUtf8() const { return ISLPronto->StringAsUtf8(str); } const wchar_t *AsWide() const { return ISLPronto->StringAsWide(str); } const char *AsLocal8bit() const { return ISLPronto->StringAsLocal8bit(str); } ISLProntoString Get() const { return str; } void TakeFrom(ISLProntoStringCxx &o) { destroy(); str = o.str; o.str = 0; } bool NonEmpty() const { return str && ISLPronto->StringNonEmpty(str); } }; #endif #endif
islpronto_plugin.h