summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-28 14:52:02 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-28 14:52:02 +0000
commitc1a1fb853547a1e9d50c95c8183d349b45e347ee (patch)
tree8c172e0d2dc2b2bfe17a4a40d158d83038568363 /include
parent30bd869d78ea7d67904e6fa46c205e3a8697c6fc (diff)
more plain & less crazy implementation of IJabberInterface
git-svn-id: http://svn.miranda-ng.org/main/trunk@6257 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r--include/m_jabber.h96
1 files changed, 37 insertions, 59 deletions
diff --git a/include/m_jabber.h b/include/m_jabber.h
index 0e1fe707eb..05a94e5de9 100644
--- a/include/m_jabber.h
+++ b/include/m_jabber.h
@@ -29,32 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_xml.h>
-struct IJabberInterface;
-
-struct IJabberSysInterface
-{
- // Returns version of IJabberSysInterface.
- virtual int STDMETHODCALLTYPE GetVersion() const = 0;
-
- // Compares JIDs by their node@domain part (without resource name).
- virtual int STDMETHODCALLTYPE CompareJIDs(LPCTSTR jid1, LPCTSTR jid2) = 0;
-
- // Returns contact handle for given JID, or NULL on error.
- virtual HANDLE STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid) = 0;
-
- // Returns JID of hContact, or NULL on error. You must free the result using mir_free().
- virtual LPTSTR STDMETHODCALLTYPE ContactToJID(HANDLE hContact) = 0;
-
- // Returns best resource name for given JID, or NULL on error. You must free the result using mir_free().
- virtual LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid) = 0;
-
- // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters), or NULL on error. You must free returned string using mir_free().
- virtual LPTSTR STDMETHODCALLTYPE GetResourceList(LPCTSTR jid) = 0;
-
- // Returns Jabber module name. DO NOT free the returned string.
- virtual char* STDMETHODCALLTYPE GetModuleName() const = 0;
-};
-
// Iq type flags
enum
{
@@ -100,15 +74,46 @@ enum
typedef void* HJHANDLER;
-typedef BOOL (*JABBER_HANDLER_FUNC)(IJabberInterface *ji, HXML node, void *pUserData);
+typedef BOOL (*JABBER_HANDLER_FUNC)(struct IJabberInterface *ji, HXML node, void *pUserData);
+
+// IJabberInterface::dwFlags values
+enum
+{
+ JIF_UNICODE = 1
+};
-struct IJabberNetInterface
+// Overall Jabber interface
+struct IJabberInterface
{
- // Returns version of IJabberNetInterface.
+ // Set of JIF_* flags.
+ virtual DWORD STDMETHODCALLTYPE GetFlags() const = 0;
+
+ // Returns version of IJabberInterface.
virtual int STDMETHODCALLTYPE GetVersion() const = 0;
+ // Returns Jabber plugin version.
+ virtual DWORD STDMETHODCALLTYPE GetJabberVersion() const = 0;
+
+ // Compares JIDs by their node@domain part (without resource name).
+ virtual int STDMETHODCALLTYPE CompareJIDs(LPCTSTR jid1, LPCTSTR jid2) = 0;
+
+ // Returns contact handle for given JID, or NULL on error.
+ virtual HANDLE STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid) = 0;
+
+ // Returns JID of hContact, or NULL on error. You must free the result using mir_free().
+ virtual LPTSTR STDMETHODCALLTYPE ContactToJID(HANDLE hContact) = 0;
+
+ // Returns best resource name for given JID, or NULL on error. You must free the result using mir_free().
+ virtual LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid) = 0;
+
+ // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters), or NULL on error. You must free returned string using mir_free().
+ virtual LPTSTR STDMETHODCALLTYPE GetResourceList(LPCTSTR jid) = 0;
+
+ // Returns Jabber module name. DO NOT free the returned string.
+ virtual char* STDMETHODCALLTYPE GetModuleName() const = 0;
+
// Returns id that can be used for next message sent through SendXmlNode().
- virtual unsigned int STDMETHODCALLTYPE SerialNext() = 0;
+ virtual int STDMETHODCALLTYPE SerialNext() = 0;
// Sends XML node.
virtual int STDMETHODCALLTYPE SendXmlNode(HXML node) = 0;
@@ -134,7 +139,6 @@ struct IJabberNetInterface
// Unregisters handler by its handle.
virtual int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler) = 0;
-
// Entity capabilities support (see xep-0115)
// Registers feature so that it's displayed with proper description in other users' details. Call this function in your ME_SYSTEM_MODULESLOADED handler. Returns TRUE on success or FALSE on error.
virtual int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) = 0;
@@ -152,31 +156,6 @@ struct IJabberNetInterface
virtual HANDLE STDMETHODCALLTYPE GetHandle(void) = 0;
};
-// IJabberInterface::dwFlags values
-enum
-{
- JIF_UNICODE = 1
-};
-
-// Overall Jabber interface
-struct IJabberInterface
-{
- // Set of JIF_* flags.
- virtual DWORD STDMETHODCALLTYPE GetFlags() const = 0;
-
- // Returns version of IJabberInterface.
- virtual int STDMETHODCALLTYPE GetVersion() const = 0;
-
- // Returns Jabber plugin version.
- virtual DWORD STDMETHODCALLTYPE GetJabberVersion() const = 0;
-
- // Jabber system utilities.
- virtual IJabberSysInterface* STDMETHODCALLTYPE Sys() const = 0;
-
- // Jabber network interface.
- virtual IJabberNetInterface* STDMETHODCALLTYPE Net() const = 0;
-};
-
/*
A service to obtain Jabber API for a given account.
If you store the pointer to the interface for later use, you must also hook ME_PROTO_ACCLISTCHANGED and update the pointer to prevent calling API for a removed account.
@@ -186,15 +165,14 @@ lParam = (LPARAM)(IJabberInterface**).
Returns FALSE if all is Ok, and TRUE otherwise.
*/
-#define JS_GETJABBERAPI "/GetJabberApi"
+#define JS_GETJABBERAPI "/GetJabberApi"
__forceinline IJabberInterface *getJabberApi(const char *szAccount)
{
IJabberInterface *ji;
if (!CallProtoService(szAccount, JS_GETJABBERAPI, 0, (LPARAM)&ji))
- {
return ji;
- }
+
return NULL;
}