diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-06 12:19:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-06 12:19:24 +0000 |
commit | eb61560d6fa9ab5e7bf895805dcedfd7870f482d (patch) | |
tree | 60fd612a969d560fe7e9613bd45f2b8ce56f02eb /protocols/JabberG/src/jabber_send_manager.cpp | |
parent | e157bfe1e82eb3c6086fdd92d6c7604347d18d3f (diff) |
Jabber: manual lists partially removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@10382 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_send_manager.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_send_manager.cpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/protocols/JabberG/src/jabber_send_manager.cpp b/protocols/JabberG/src/jabber_send_manager.cpp index 0ada2e018a..174ec38784 100644 --- a/protocols/JabberG/src/jabber_send_manager.cpp +++ b/protocols/JabberG/src/jabber_send_manager.cpp @@ -25,20 +25,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "jabber.h"
-#include "jabber_send_manager.h"
-BOOL CJabberSendManager::FillPermanentHandlers()
+static int CompareItems(const CJabberSendPermanentInfo *p1, const CJabberSendPermanentInfo *p2)
{
- return TRUE;
+ return p1->getPriority() - p2->getPriority();
}
-BOOL CJabberSendManager::HandleSendPermanent(HXML node, ThreadData *pThreadData)
+CJabberSendManager::CJabberSendManager(CJabberProto* proto) :
+ m_arHandlers(1, CompareItems)
{
+ ppro = proto;
+}
+
+CJabberSendManager::~CJabberSendManager()
+{
+}
+
+CJabberSendPermanentInfo* CJabberSendManager::AddPermanentHandler(JABBER_SEND_HANDLER pHandler, void *pUserData, SEND_USER_DATA_FREE_FUNC pUserDataFree, int iPriority)
+{
+ CJabberSendPermanentInfo *pInfo = new CJabberSendPermanentInfo();
+ pInfo->m_pHandler = pHandler;
+ pInfo->m_pUserData = pUserData;
+ pInfo->m_pUserDataFree = pUserDataFree;
+ pInfo->m_iPriority = iPriority;
+
mir_cslock lck(m_cs);
- for (CJabberSendPermanentInfo *pInfo = m_pPermanentHandlers; pInfo; pInfo = pInfo->m_pNext) {
+ m_arHandlers.insert(pInfo);
+ return pInfo;
+}
+
+bool CJabberSendManager::DeletePermanentHandler(CJabberSendPermanentInfo *pInfo)
+{
+ mir_cslock lck(m_cs);
+ return m_arHandlers.remove(pInfo) == 1;
+}
+
+bool CJabberSendManager::HandleSendPermanent(HXML node, ThreadData *pThreadData)
+{
+ for (int i = 0; i < m_arHandlers.getCount(); i++) {
+ CJabberSendPermanentInfo &pInfo = m_arHandlers[i];
+
CJabberSendInfo sendInfo;
- sendInfo.m_pUserData = pInfo->m_pUserData;
- if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &sendInfo))
+ sendInfo.m_pUserData = pInfo.m_pUserData;
+ if ((ppro->*(pInfo.m_pHandler))(node, pThreadData, &sendInfo))
return true;
}
|