summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_list.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-21 13:40:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-21 13:40:52 +0000
commitc69a9c892f52056d452ad8520e6c09b6956f30e3 (patch)
treecf26cee03ae18c38486515e94ec18068b38cbd41 /protocols/JabberG/src/jabber_list.h
parent8b6824e3ec3ed7340db33bcbe592321b6afb0a00 (diff)
smart pointers for Jabber resources
git-svn-id: http://svn.miranda-ng.org/main/trunk@6155 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_list.h')
-rw-r--r--protocols/JabberG/src/jabber_list.h48
1 files changed, 44 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h
index 16f1c8aad3..88b646c1c0 100644
--- a/protocols/JabberG/src/jabber_list.h
+++ b/protocols/JabberG/src/jabber_list.h
@@ -73,10 +73,17 @@ struct JABBER_XEP0232_SOFTWARE_INFO : public MZeroedObject
ptrT tszOs, tszOsVersion, tszSoftware, tszSoftwareVersion, tszXMirandaCoreVersion;
};
-struct JABBER_RESOURCE_STATUS : public MZeroedObject
+class JABBER_RESOURCE_STATUS : public MZeroedObject
{
+ LONG m_refCount;
+
+public:
+ JABBER_RESOURCE_STATUS();
~JABBER_RESOURCE_STATUS();
+ void AddRef();
+ void Release();
+
int status;
TCHAR* resourceName;
TCHAR* nick;
@@ -105,6 +112,37 @@ struct JABBER_RESOURCE_STATUS : public MZeroedObject
JABBER_XEP0232_SOFTWARE_INFO* pSoftwareInfo;
};
+class pResourceStatus
+{
+ JABBER_RESOURCE_STATUS *m_pStatus;
+
+public:
+ __forceinline pResourceStatus(JABBER_RESOURCE_STATUS *pStatus) :
+ m_pStatus(pStatus)
+ { pStatus->AddRef();
+ }
+
+ __forceinline pResourceStatus(const pResourceStatus &r)
+ { m_pStatus = r.m_pStatus;
+ m_pStatus->AddRef();
+ }
+
+ __forceinline ~pResourceStatus()
+ { m_pStatus->Release();
+ }
+
+ __forceinline operator JABBER_RESOURCE_STATUS*() const { return m_pStatus; }
+ __forceinline JABBER_RESOURCE_STATUS* operator->() const { return m_pStatus; }
+
+ __forceinline void operator=(const pResourceStatus &r) {
+ m_pStatus->Release();
+ m_pStatus = r.m_pStatus;
+ m_pStatus->AddRef();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+
struct JABBER_LIST_ITEM : public MZeroedObject
{
JABBER_LIST_ITEM();
@@ -117,14 +155,14 @@ struct JABBER_LIST_ITEM : public MZeroedObject
// jid = jid of the contact
TCHAR* nick;
- JABBER_RESOURCE_STATUS* findResource(const TCHAR *resourceName) const;
- JABBER_RESOURCE_STATUS* getBestResource() const;
+ pResourceStatus findResource(const TCHAR *resourceName) const;
+ pResourceStatus getBestResource() const;
JABBER_RESOURCE_MODE resourceMode;
LIST<JABBER_RESOURCE_STATUS> arResources; // array of resources
JABBER_RESOURCE_STATUS
*pLastSeenResource, // resource which was last seen active
*pManualResource, // manually set resource
- *m_pItemResource; // resource for jids without /resource node
+ *m_pItemResource; // resource for jids without /resource node
JABBER_SUBSCRIPTION subscription;
TCHAR* group;
@@ -172,6 +210,8 @@ struct JABBER_LIST_ITEM : public MZeroedObject
BOOL bHistoryRead;
};
+/////////////////////////////////////////////////////////////////////////////////////////////
+
struct JABBER_HTTP_AVATARS
{
char * Url;