From 8fecb411c56387ef6db40abe96b8c935fddc6083 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 2 Oct 2013 19:38:44 +0000 Subject: atavism extincted: old nasty IQ handler mechanism git-svn-id: http://svn.miranda-ng.org/main/trunk@6312 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_iq.cpp | 80 ------------------------------------- 1 file changed, 80 deletions(-) (limited to 'protocols/JabberG/src/jabber_iq.cpp') diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index 64cfafb85c..6af37f07a3 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -29,86 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_ibb.h" #include "jabber_rc.h" -void CJabberProto::IqInit() -{ - InitializeCriticalSection(&m_csIqList); - m_ppIqList = NULL; - m_nIqCount = 0; - m_nIqAlloced = 0; -} - -void CJabberProto::IqUninit() -{ - if (m_ppIqList) mir_free(m_ppIqList); - m_ppIqList = NULL; - m_nIqCount = 0; - m_nIqAlloced = 0; - DeleteCriticalSection(&m_csIqList); -} - -void CJabberProto::IqAdd(unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_PFUNC func) -{ - int i; - - mir_cslock lck(m_csIqList); - Log("IqAdd id=%d, proc=%d, func=0x%x", iqId, procId, func); - if (procId == IQ_PROC_NONE) - i = m_nIqCount; - else - for (i=0; i= m_nIqCount && m_nIqCount >= m_nIqAlloced) { - m_nIqAlloced = m_nIqCount + 8; - m_ppIqList = (JABBER_IQ_FUNC*)mir_realloc(m_ppIqList, sizeof(JABBER_IQ_FUNC)*m_nIqAlloced); - } - - if (m_ppIqList != NULL) { - m_ppIqList[i].iqId = iqId; - m_ppIqList[i].procId = procId; - m_ppIqList[i].func = func; - m_ppIqList[i].requestTime = time(NULL); - if (i == m_nIqCount) - m_nIqCount++; - } -} - -void CJabberProto::IqRemove(int index) -{ - mir_cslock lck(m_csIqList); - if (index >= 0 && index < m_nIqCount) { - memmove(m_ppIqList+index, m_ppIqList+index+1, sizeof(JABBER_IQ_FUNC)*(m_nIqCount-index-1)); - m_nIqCount--; - } -} - -void CJabberProto::IqExpire() -{ - time_t expire = time(NULL) - 120; // 2 minute - - mir_cslock lck(m_csIqList); - for (int i=0; i < m_nIqCount; ) { - if (m_ppIqList[i].requestTime < expire) - IqRemove(i); - else - i++; - } -} - -JABBER_IQ_PFUNC CJabberProto::JabberIqFetchFunc(int iqId) -{ - mir_cslock lck(m_csIqList); - IqExpire(); - - int i; - for (i=0; i < m_nIqCount && m_ppIqList[i].iqId != iqId; i++); - if (i < m_nIqCount) { - JABBER_IQ_PFUNC res = m_ppIqList[i].func; - IqRemove(i); - return res; - } - return NULL; -} - ///////////////////////////////////////////////////////////////////////////////////////// // CJabberIqManager class -- cgit v1.2.3