summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-02 16:46:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-02 16:46:22 +0000
commit0e130d1a06db358ed90d0ad30d633c4fad839d6e (patch)
tree0b7052aafb152385823b5ec7d876e58e6e1f2708 /protocols/JabberG
parent6069deebf16c166dec9432853ce32dfaa6cc4f98 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6309 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_api.cpp2
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp6
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp8
-rw-r--r--protocols/JabberG/src/jabber_caps.h2
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp20
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp4
-rw-r--r--protocols/JabberG/src/jabber_ibb.cpp6
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp403
-rw-r--r--protocols/JabberG/src/jabber_iq.h439
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp135
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp16
-rw-r--r--protocols/JabberG/src/jabber_message_manager.cpp130
-rw-r--r--protocols/JabberG/src/jabber_message_manager.h171
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp10
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_proto.h78
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp22
-rw-r--r--protocols/JabberG/src/jabber_rc.h10
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp9
-rw-r--r--protocols/JabberG/src/jabber_xml.cpp4
-rw-r--r--protocols/JabberG/src/jabber_xml.h4
21 files changed, 690 insertions, 791 deletions
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 03dbf8b276..015c76fb58 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -179,7 +179,7 @@ HJHANDLER CJabberProto::AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqT
sHandlerData *d = (sHandlerData*)malloc(sizeof(sHandlerData));
d->Func = Func;
d->pUserData = pUserData;
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::ExternalTempIqHandler, iIqTypes, NULL, 0, iIqId, d, iPriority);
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::ExternalTempIqHandler, iIqTypes, NULL, 0, iIqId, d, iPriority);
if (pInfo && dwTimeout > 0)
pInfo->SetTimeout(dwTimeout);
return (HJHANDLER)pInfo;
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index aa4a38f9ad..4bcec43ab7 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -52,7 +52,7 @@ JABBER_BYTE_TRANSFER::~JABBER_BYTE_TRANSFER()
mir_free(szStreamhostUsed);
}
-void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
{
JABBER_BYTE_TRANSFER *jbt = (JABBER_BYTE_TRANSFER *)pInfo->GetUserData();
@@ -146,7 +146,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
TCHAR szPort[8];
HANDLE hEvent = NULL;
TCHAR *proxyJid;
- CJabberIqInfo* pInfo = NULL;
+ CJabberIqInfo *pInfo = NULL;
int nIqId = 0;
Log("Thread started: type=bytestream_send");
@@ -302,7 +302,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
Log("Thread ended: type=bytestream_send");
}
-void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo)
{
JABBER_BYTE_TRANSFER *jbt = (JABBER_BYTE_TRANSFER *)pInfo->GetUserData();
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 4f85a28641..0ffffb207b 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -92,7 +92,7 @@ const JabberFeatCapPair g_JabberFeatCapPairsExt[] = {
{ NULL, 0 }
};
-void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo)
{
pResourceStatus r( ResourceInfoFromJID(pInfo->GetFrom()));
if (r == NULL)
@@ -130,7 +130,7 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo* pInfo)
}
}
-void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
{
pResourceStatus r( ResourceInfoFromJID(pInfo->GetFrom()));
@@ -261,7 +261,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
{
// send disco#info query
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
pInfo->SetTimeout(JABBER_RESOURCE_CAPS_QUERY_TIMEOUT);
m_clientCapsManager.SetClientCaps(r->m_tszCapsNode, token, JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId());
@@ -606,7 +606,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
return bOk;
}
-BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo* pInfo, const TCHAR *szNode)
+BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
int i;
JabberCapsBits jcb = 0;
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index 570463396b..e5e8c4e6da 100644
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -281,7 +281,7 @@ public:
BOOL SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId = -1);
BOOL SetClientCaps(int nIqId, JabberCapsBits jcbCaps);
- BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo* pInfo, const TCHAR *szNode);
+ BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
};
struct JabberFeatCapPair
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index c96dc4fdad..efca9cac98 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -165,7 +165,7 @@ static struct
static void sttApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode);
-void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pInfo)
{
m_SDManager.Lock();
CJabberSDNode *pNode = m_SDManager.FindByIqId(pInfo->GetIqId(), TRUE);
@@ -211,7 +211,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo* pI
}
}
-void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *pInfo)
{
m_SDManager.Lock();
CJabberSDNode *pNode = m_SDManager.FindByIqId(pInfo->GetIqId(), FALSE);
@@ -255,7 +255,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo* p
}
}
-void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->m_pUserData) return;
m_SDManager.Lock();
@@ -275,7 +275,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_REFRESH);
}
-void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->m_pUserData)
return;
@@ -289,7 +289,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf
for (int i = 1; (item = xmlGetNthChild(query, _T("item"), i)) != NULL; i++) {
const TCHAR *szJid = xmlGetAttrValue(item, _T("jid"));
const TCHAR *szNode = xmlGetAttrValue(item, _T("node"));
- CJabberIqInfo* pNewInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid);
+ CJabberIqInfo *pNewInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid);
pNewInfo->m_pUserData = pInfo->m_pUserData;
pNewInfo->SetTimeout(30000);
@@ -310,7 +310,7 @@ BOOL CJabberProto::SendInfoRequest(CJabberSDNode *pNode, HXML parent)
// disco#info
if ( !pNode->GetInfoRequestId()) {
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetInfoRequestId(pInfo->GetIqId());
@@ -340,7 +340,7 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent)
// disco#info
if ( !pNode->GetInfoRequestId()) {
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetInfoRequestId(pInfo->GetIqId());
@@ -357,7 +357,7 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent)
// disco#items
if ( !pNode->GetItemsRequestId()) {
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryItems, JABBER_IQ_TYPE_GET, pNode->GetJid());
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryItems, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetItemsRequestId(pInfo->GetIqId());
@@ -419,7 +419,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
else if ( !lstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
TCHAR *szServerJid = mir_a2t(m_ThreadInfo->server);
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)JABBER_FEAT_MUC;
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
@@ -430,7 +430,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
else if ( !lstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
sttBrowseMode = SD_BROWSE_AGENTS;
TCHAR *szServerJid = mir_a2t(m_ThreadInfo->server);
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
pInfo->m_pUserData = (void*)_T("jabber:iq:gateway");
pInfo->SetTimeout(30000);
XmlNodeIq iq(pInfo);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index d94d944caf..ae863c6b5d 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -122,7 +122,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft)
m_ThreadInfo->send(iq);
}
-void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
{
HXML siNode, featureNode, xNode, fieldNode, valueNode;
filetransfer *ft = (filetransfer *)pInfo->GetUserData();
@@ -422,7 +422,7 @@ void CJabberProto::FtAcceptIbbRequest(filetransfer *ft)
<< XCHILD(_T("value"), JABBER_FEAT_IBB));
} }
-BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo* pInfo)
+BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
HXML queryNode = pInfo->GetChildNode();
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp
index 55f3ba1851..24f54a21c3 100644
--- a/protocols/JabberG/src/jabber_ibb.cpp
+++ b/protocols/JabberG/src/jabber_ibb.cpp
@@ -43,7 +43,7 @@ void JabberIbbFreeJibb(JABBER_IBB_TRANSFER *jibb)
mir_free(jibb);
} }
-BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !_tcscmp(pInfo->GetChildNodeName(), _T("open")))
FtHandleIbbRequest(iqNode, TRUE);
@@ -67,7 +67,7 @@ BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo* pInfo)
return TRUE;
}
-void CJabberProto::OnIbbInitiateResult(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnIbbInitiateResult(HXML, CJabberIqInfo *pInfo)
{
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)pInfo->GetUserData();
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT)
@@ -76,7 +76,7 @@ void CJabberProto::OnIbbInitiateResult(HXML, CJabberIqInfo* pInfo)
SetEvent(jibb->hEvent);
}
-void CJabberProto::OnIbbCloseResult(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnIbbCloseResult(HXML, CJabberIqInfo *pInfo)
{
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *)pInfo->GetUserData();
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT)
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index 868a293881..64cfafb85c 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -46,10 +46,36 @@ void CJabberProto::IqUninit()
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_ppIqList[i].procId != procId; i++);
+
+ if (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) {
+ if (index >= 0 && index < m_nIqCount) {
memmove(m_ppIqList+index, m_ppIqList+index+1, sizeof(JABBER_IQ_FUNC)*(m_nIqCount-index-1));
m_nIqCount--;
}
@@ -74,7 +100,7 @@ JABBER_IQ_PFUNC CJabberProto::JabberIqFetchFunc(int iqId)
IqExpire();
int i;
- for (i=0; i<m_nIqCount && m_ppIqList[i].iqId!=iqId; 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);
@@ -83,30 +109,59 @@ JABBER_IQ_PFUNC CJabberProto::JabberIqFetchFunc(int iqId)
return NULL;
}
-void CJabberProto::IqAdd(unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_PFUNC func)
-{
- int i;
+/////////////////////////////////////////////////////////////////////////////////////////
+// CJabberIqManager class
- 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_ppIqList[i].procId!=procId; i++);
+CJabberIqManager::CJabberIqManager(CJabberProto* proto)
+{
+ InitializeCriticalSection(&m_cs);
+ m_dwLastUsedHandle = 0;
+ m_pIqs = NULL;
+ m_hExpirerThread = NULL;
+ m_pPermanentHandlers = NULL;
+ ppro = proto;
+}
- if (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);
+CJabberIqManager::~CJabberIqManager()
+{
+ ExpireAll();
+ {
+ mir_cslock lck(m_cs);
+ CJabberIqPermanentInfo *pInfo = m_pPermanentHandlers;
+ while (pInfo) {
+ CJabberIqPermanentInfo *pTmp = pInfo->m_pNext;
+ delete pInfo;
+ pInfo = pTmp;
+ }
+ m_pPermanentHandlers = NULL;
}
+ DeleteCriticalSection(&m_cs);
+}
- 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++;
- }
+BOOL CJabberIqManager::Start()
+{
+ if (m_hExpirerThread || m_bExpirerThreadShutdownRequest)
+ return FALSE;
+
+ m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, 0);
+ if ( !m_hExpirerThread)
+ return FALSE;
+
+ return TRUE;
+}
+
+BOOL CJabberIqManager::Shutdown()
+{
+ if (m_bExpirerThreadShutdownRequest || !m_hExpirerThread)
+ return TRUE;
+
+ m_bExpirerThreadShutdownRequest = TRUE;
+
+ WaitForSingleObject(m_hExpirerThread, INFINITE);
+ CloseHandle(m_hExpirerThread);
+ m_hExpirerThread = NULL;
+
+ return TRUE;
}
BOOL CJabberIqManager::FillPermanentHandlers()
@@ -162,18 +217,6 @@ BOOL CJabberIqManager::FillPermanentHandlers()
return TRUE;
}
-BOOL CJabberIqManager::Start()
-{
- if (m_hExpirerThread || m_bExpirerThreadShutdownRequest)
- return FALSE;
-
- m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, 0);
- if ( !m_hExpirerThread)
- return FALSE;
-
- return TRUE;
-}
-
void __cdecl CJabberProto::ExpirerThread(void* pParam)
{
CJabberIqManager *pManager = (CJabberIqManager *)pParam;
@@ -182,13 +225,9 @@ void __cdecl CJabberProto::ExpirerThread(void* pParam)
void CJabberIqManager::ExpirerThread()
{
- while (!m_bExpirerThreadShutdownRequest)
- {
- Lock();
- CJabberIqInfo* pInfo = DetachExpired();
- Unlock();
- if ( !pInfo)
- {
+ while (!m_bExpirerThreadShutdownRequest) {
+ CJabberIqInfo *pInfo = DetachExpired();
+ if (!pInfo) {
for (int i=0; !m_bExpirerThreadShutdownRequest && (i < 10); i++)
Sleep(50);
@@ -206,7 +245,7 @@ void CJabberIqManager::ExpirerThread()
}
}
-void CJabberIqManager::ExpireInfo(CJabberIqInfo* pInfo, void*)
+void CJabberIqManager::ExpireInfo(CJabberIqInfo *pInfo, void*)
{
if ( !pInfo)
return;
@@ -222,10 +261,53 @@ void CJabberIqManager::ExpireInfo(CJabberIqInfo* pInfo, void*)
(ppro->*(pInfo->m_pHandler))(NULL, pInfo);
}
+BOOL CJabberIqManager::ExpireIq(int nIqId)
+{
+ CJabberIqInfo *pInfo = DetachInfo(nIqId);
+ if (pInfo) {
+ ExpireInfo(pInfo);
+ delete pInfo;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL CJabberIqManager::ExpireByUserData(void *pUserData)
+{
+ while (true) {
+ CJabberIqInfo *pInfo = DetachInfo(pUserData);
+ if (!pInfo)
+ return FALSE;
+
+ ExpireInfo(pInfo, NULL);
+ delete pInfo;
+ return TRUE;
+ }
+}
+
+BOOL CJabberIqManager::ExpireAll(void *pUserData)
+{
+ while (true) {
+ CJabberIqInfo *pInfo;
+ {
+ mir_cslock lck(m_cs);
+ pInfo = m_pIqs;
+ if (pInfo)
+ m_pIqs = m_pIqs->m_pNext;
+ }
+ if (!pInfo)
+ break;
+ pInfo->m_pNext = NULL;
+ ExpireInfo(pInfo, pUserData);
+ delete pInfo;
+ }
+ return TRUE;
+}
+
CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const TCHAR *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority)
{
- CJabberIqInfo* pInfo = new CJabberIqInfo();
- if ( !pInfo)
+ CJabberIqInfo *pInfo = new CJabberIqInfo();
+ if (!pInfo)
return NULL;
pInfo->m_pHandler = pHandler;
@@ -239,9 +321,7 @@ CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqT
pInfo->m_dwTimeout = JABBER_DEFAULT_IQ_REQUEST_TIMEOUT;
pInfo->m_iPriority = iPriority;
pInfo->SetReceiver(szReceiver);
-
InsertIq(pInfo);
-
return pInfo;
}
@@ -262,11 +342,8 @@ BOOL CJabberIqManager::HandleIq(int nIqId, HXML pNode)
else
return FALSE;
- Lock();
- CJabberIqInfo* pInfo = DetachInfo(nIqId);
- Unlock();
- if (pInfo)
- {
+ CJabberIqInfo *pInfo = DetachInfo(nIqId);
+ if (pInfo) {
pInfo->m_nIqType = nIqType;
if (nIqType == JABBER_IQ_TYPE_RESULT) {
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_NODE)
@@ -298,30 +375,27 @@ BOOL CJabberIqManager::HandleIq(int nIqId, HXML pNode)
BOOL CJabberIqManager::HandleIqPermanent(HXML pNode)
{
- BOOL bStopHandling = FALSE;
- Lock();
+ mir_cslock lck(m_cs);
CJabberIqPermanentInfo *pInfo = m_pPermanentHandlers;
while (pInfo) {
// have to get all data here, in the loop, because there's always possibility that previous handler modified it
const TCHAR *szType = xmlGetAttrValue(pNode, _T("type"));
- if ( !szType)
- break;
+ if (!szType)
+ return FALSE;
CJabberIqInfo iqInfo;
-
iqInfo.m_nIqType = JABBER_IQ_TYPE_FAIL;
- if ( !_tcsicmp(szType, _T("get")))
+ if (!_tcsicmp(szType, _T("get")))
iqInfo.m_nIqType = JABBER_IQ_TYPE_GET;
else if ( !_tcsicmp(szType, _T("set")))
iqInfo.m_nIqType = JABBER_IQ_TYPE_SET;
else
- break;
+ return FALSE;
- if (pInfo->m_nIqTypes & iqInfo.m_nIqType)
- {
+ if (pInfo->m_nIqTypes & iqInfo.m_nIqType) {
HXML pFirstChild = xmlGetChild(pNode , 0);
if ( !pFirstChild || !xmlGetName(pFirstChild))
- break;
+ return FALSE;
const TCHAR *szTagName = xmlGetName(pFirstChild);
const TCHAR *szXmlns = xmlGetAttrValue(pFirstChild, _T("xmlns"));
@@ -345,16 +419,211 @@ BOOL CJabberIqManager::HandleIqPermanent(HXML pNode)
iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom, 3);
ppro->Log("Handling iq id %S, type %S, from %S", iqInfo.m_szId, szType, iqInfo.m_szFrom);
- if ((ppro->*(pInfo->m_pHandler))(pNode, &iqInfo)) {
- bStopHandling = TRUE;
- break;
- }
+ if ((ppro->*(pInfo->m_pHandler))(pNode, &iqInfo))
+ return TRUE;
}
}
pInfo = pInfo->m_pNext;
}
- Unlock();
- return bStopHandling;
+ return FALSE;
+}
+
+CJabberIqInfo* CJabberIqManager::DetachInfo(int nIqId)
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pIqs)
+ return NULL;
+
+ CJabberIqInfo *pInfo = m_pIqs;
+ if (m_pIqs->m_nIqId == nIqId) {
+ m_pIqs = pInfo->m_pNext;
+ pInfo->m_pNext = NULL;
+ return pInfo;
+ }
+
+ while (pInfo->m_pNext) {
+ if (pInfo->m_pNext->m_nIqId == nIqId) {
+ CJabberIqInfo *pRetVal = pInfo->m_pNext;
+ pInfo->m_pNext = pInfo->m_pNext->m_pNext;
+ pRetVal->m_pNext = NULL;
+ return pRetVal;
+ }
+ pInfo = pInfo->m_pNext;
+ }
+ return NULL;
+}
+
+CJabberIqInfo* CJabberIqManager::DetachInfo(void *pUserData)
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pIqs)
+ return NULL;
+
+ CJabberIqInfo *pInfo = m_pIqs;
+ if (m_pIqs->m_pUserData == pUserData) {
+ m_pIqs = pInfo->m_pNext;
+ pInfo->m_pNext = NULL;
+ return pInfo;
+ }
+
+ while (pInfo->m_pNext) {
+ if (pInfo->m_pNext->m_pUserData == pUserData) {
+ CJabberIqInfo *pRetVal = pInfo->m_pNext;
+ pInfo->m_pNext = pInfo->m_pNext->m_pNext;
+ pRetVal->m_pNext = NULL;
+ return pRetVal;
+ }
+ pInfo = pInfo->m_pNext;
+ }
+ return NULL;
+}
+
+CJabberIqInfo* CJabberIqManager::DetachExpired()
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pIqs)
+ return NULL;
+
+ DWORD dwCurrentTime = GetTickCount();
+
+ CJabberIqInfo *pInfo = m_pIqs;
+ if (dwCurrentTime - pInfo->m_dwRequestTime > pInfo->m_dwTimeout) {
+ m_pIqs = pInfo->m_pNext;
+ pInfo->m_pNext = NULL;
+ return pInfo;
+ }
+
+ while (pInfo->m_pNext) {
+ if (dwCurrentTime - pInfo->m_pNext->m_dwRequestTime > pInfo->m_pNext->m_dwTimeout) {
+ CJabberIqInfo *pRetVal = pInfo->m_pNext;
+ pInfo->m_pNext = pInfo->m_pNext->m_pNext;
+ pRetVal->m_pNext = NULL;
+ return pRetVal;
+ }
+ pInfo = pInfo->m_pNext;
+ }
+ return NULL;
+}
+
+// inserts pInfo at a place determined by pInfo->m_iPriority
+BOOL CJabberIqManager::InsertIq(CJabberIqInfo *pInfo)
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pIqs)
+ m_pIqs = pInfo;
+ else {
+ if (m_pIqs->m_iPriority > pInfo->m_iPriority) {
+ pInfo->m_pNext = m_pIqs;
+ m_pIqs = pInfo;
+ }
+ else {
+ CJabberIqInfo *pTmp = m_pIqs;
+ while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
+ pTmp = pTmp->m_pNext;
+ pInfo->m_pNext = pTmp->m_pNext;
+ pTmp->m_pNext = pInfo;
+ }
+ }
+ return TRUE;
+}
+
+// fucking params, maybe just return CJabberIqRequestInfo pointer ?
+CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler(
+ JABBER_PERMANENT_IQ_HANDLER pHandler,
+ int nIqTypes,
+ DWORD dwParamsToParse,
+ const TCHAR *szXmlns,
+ BOOL bAllowPartialNs,
+ const TCHAR *szTag,
+ void *pUserData,
+ IQ_USER_DATA_FREE_FUNC pUserDataFree,
+ int iPriority)
+{
+ CJabberIqPermanentInfo *pInfo = new CJabberIqPermanentInfo();
+ if ( !pInfo)
+ return NULL;
+
+ pInfo->m_pHandler = pHandler;
+ pInfo->m_nIqTypes = nIqTypes ? nIqTypes : JABBER_IQ_TYPE_ANY;
+ replaceStrT(pInfo->m_szXmlns, szXmlns);
+ pInfo->m_bAllowPartialNs = bAllowPartialNs;
+ replaceStrT(pInfo->m_szTag, szTag);
+ pInfo->m_dwParamsToParse = dwParamsToParse;
+ pInfo->m_pUserData = pUserData;
+ pInfo->m_pUserDataFree = pUserDataFree;
+ pInfo->m_iPriority = iPriority;
+
+ mir_cslock lck(m_cs);
+ if ( !m_pPermanentHandlers)
+ m_pPermanentHandlers = pInfo;
+ else {
+ if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
+ pInfo->m_pNext = m_pPermanentHandlers;
+ m_pPermanentHandlers = pInfo;
+ }
+ else {
+ CJabberIqPermanentInfo* pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
+ pTmp = pTmp->m_pNext;
+ pInfo->m_pNext = pTmp->m_pNext;
+ pTmp->m_pNext = pInfo;
+ }
+ }
+ return pInfo;
+}
+
+// returns TRUE when pInfo found, or FALSE otherwise
+BOOL CJabberIqManager::DeletePermanentHandler(CJabberIqPermanentInfo *pInfo)
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pPermanentHandlers)
+ return FALSE;
+
+ if (m_pPermanentHandlers == pInfo) { // check first item
+ m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
+ delete pInfo;
+ return TRUE;
+ }
+
+ CJabberIqPermanentInfo* pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext) {
+ if (pTmp->m_pNext == pInfo) {
+ pTmp->m_pNext = pTmp->m_pNext->m_pNext;
+ delete pInfo;
+ return TRUE;
+ }
+ pTmp = pTmp->m_pNext;
+ }
+ return FALSE;
+}
+
+BOOL CJabberIqManager::DeleteHandler(CJabberIqInfo *pInfo)
+{
+ // returns TRUE when pInfo found, or FALSE otherwise
+ mir_cslockfull lck(m_cs);
+ if ( !m_pIqs)
+ return FALSE;
+
+ if (m_pIqs == pInfo) { // check first item
+ m_pIqs = m_pIqs->m_pNext;
+ lck.unlock();
+ ExpireInfo(pInfo); // must expire it to allow the handler to free m_pUserData if necessary
+ delete pInfo;
+ return TRUE;
+ }
+
+ CJabberIqInfo *pTmp = m_pIqs;
+ while (pTmp->m_pNext) {
+ if (pTmp->m_pNext == pInfo) {
+ pTmp->m_pNext = pTmp->m_pNext->m_pNext;
+ lck.unlock();
+ ExpireInfo(pInfo); // must expire it to allow the handler to free m_pUserData if necessary
+ delete pInfo;
+ return TRUE;
+ }
+ pTmp = pTmp->m_pNext;
+ }
+ return FALSE;
}
diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h
index 0042a9a006..02d4fdf38e 100644
--- a/protocols/JabberG/src/jabber_iq.h
+++ b/protocols/JabberG/src/jabber_iq.h
@@ -60,25 +60,25 @@ typedef struct {
// 2 minutes, milliseconds
#define JABBER_DEFAULT_IQ_REQUEST_TIMEOUT 120000
-typedef void (CJabberProto::*JABBER_IQ_HANDLER)(HXML iqNode, CJabberIqInfo* pInfo);
-typedef BOOL (CJabberProto::*JABBER_PERMANENT_IQ_HANDLER)(HXML iqNode, CJabberIqInfo* pInfo);
+typedef void (CJabberProto::*JABBER_IQ_HANDLER)(HXML iqNode, CJabberIqInfo *pInfo);
+typedef BOOL (CJabberProto::*JABBER_PERMANENT_IQ_HANDLER)(HXML iqNode, CJabberIqInfo *pInfo);
-#define JABBER_IQ_PARSE_CHILD_TAG_NODE (1)
-#define JABBER_IQ_PARSE_CHILD_TAG_NAME ((1<<1)|JABBER_IQ_PARSE_CHILD_TAG_NODE)
-#define JABBER_IQ_PARSE_CHILD_TAG_XMLNS ((1<<2)|JABBER_IQ_PARSE_CHILD_TAG_NODE)
-#define JABBER_IQ_PARSE_FROM (1<<3)
-#define JABBER_IQ_PARSE_HCONTACT ((1<<4)|JABBER_IQ_PARSE_FROM)
-#define JABBER_IQ_PARSE_TO (1<<5)
-#define JABBER_IQ_PARSE_ID_STR (1<<6)
+#define JABBER_IQ_PARSE_CHILD_TAG_NODE (1)
+#define JABBER_IQ_PARSE_CHILD_TAG_NAME ((1<<1)|JABBER_IQ_PARSE_CHILD_TAG_NODE)
+#define JABBER_IQ_PARSE_CHILD_TAG_XMLNS ((1<<2)|JABBER_IQ_PARSE_CHILD_TAG_NODE)
+#define JABBER_IQ_PARSE_FROM (1<<3)
+#define JABBER_IQ_PARSE_HCONTACT ((1<<4)|JABBER_IQ_PARSE_FROM)
+#define JABBER_IQ_PARSE_TO (1<<5)
+#define JABBER_IQ_PARSE_ID_STR (1<<6)
-#define JABBER_IQ_PARSE_DEFAULT (JABBER_IQ_PARSE_CHILD_TAG_NODE|JABBER_IQ_PARSE_CHILD_TAG_NAME|JABBER_IQ_PARSE_CHILD_TAG_XMLNS)
+#define JABBER_IQ_PARSE_DEFAULT (JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_CHILD_TAG_NAME | JABBER_IQ_PARSE_CHILD_TAG_XMLNS)
-class CJabberIqInfo
+class CJabberIqInfo : public MZeroedObject
{
protected:
friend class CJabberIqManager;
JABBER_IQ_HANDLER m_pHandler;
- CJabberIqInfo* m_pNext;
+ CJabberIqInfo *m_pNext;
int m_nIqId;
DWORD m_dwParamsToParse;
@@ -97,89 +97,68 @@ public:// parsed data
HANDLE m_hContact;
TCHAR *m_szTo;
TCHAR *m_szId;
+
public:
- CJabberIqInfo()
- {
- ZeroMemory(this, sizeof(CJabberIqInfo));
+ __forceinline void SetReceiver(const TCHAR *szReceiver)
+ { replaceStrT(m_szReceiver, szReceiver);
}
- ~CJabberIqInfo()
- {
- mir_free(m_szReceiver);
+ __forceinline TCHAR* GetReceiver()
+ { return m_szReceiver;
}
- void SetReceiver(const TCHAR *szReceiver)
- {
- replaceStrT(m_szReceiver, szReceiver);
+ __forceinline void SetParamsToParse(DWORD dwParamsToParse)
+ { m_dwParamsToParse = dwParamsToParse;
}
- TCHAR* GetReceiver()
- {
- return m_szReceiver;
+ __forceinline void SetTimeout(DWORD dwTimeout)
+ { m_dwTimeout = dwTimeout;
}
- void SetParamsToParse(DWORD dwParamsToParse)
- {
- m_dwParamsToParse = dwParamsToParse;
+ __forceinline int GetIqId()
+ { return m_nIqId;
}
- void SetTimeout(DWORD dwTimeout)
- {
- m_dwTimeout = dwTimeout;
+ __forceinline DWORD GetRequestTime()
+ { return m_dwRequestTime;
}
- int GetIqId()
- {
- return m_nIqId;
+ __forceinline int GetIqType()
+ { return m_nIqType;
}
- DWORD GetRequestTime()
- {
- return m_dwRequestTime;
+ __forceinline void* GetUserData()
+ { return m_pUserData;
}
- int GetIqType()
- {
- return m_nIqType;
+ __forceinline TCHAR* GetFrom()
+ { return m_szFrom;
}
- void* GetUserData()
- {
- return m_pUserData;
+ __forceinline TCHAR* GetTo()
+ { return m_szTo;
}
- TCHAR* GetFrom()
- {
- return m_szFrom;
+ __forceinline TCHAR* GetIdStr()
+ { return m_szId;
}
- TCHAR* GetTo()
- {
- return m_szTo;
+ __forceinline HANDLE GetHContact()
+ { return m_hContact;
}
- TCHAR* GetIdStr()
- {
- return m_szId;
+ __forceinline HXML GetChildNode()
+ { return m_pChildNode;
}
- HANDLE GetHContact()
- {
- return m_hContact;
- }
- HXML GetChildNode()
- {
- return m_pChildNode;
- }
- TCHAR* GetChildNodeName()
- {
- return m_szChildTagName;
+ __forceinline TCHAR* GetChildNodeName()
+ { return m_szChildTagName;
}
+
char* GetCharIqType()
{
- switch (m_nIqType)
- {
- case JABBER_IQ_TYPE_SET: return "set";
- case JABBER_IQ_TYPE_GET: return "get";
- case JABBER_IQ_TYPE_ERROR: return "error";
- case JABBER_IQ_TYPE_RESULT: return "result";
+ switch (m_nIqType) {
+ case JABBER_IQ_TYPE_SET: return "set";
+ case JABBER_IQ_TYPE_GET: return "get";
+ case JABBER_IQ_TYPE_ERROR: return "error";
+ case JABBER_IQ_TYPE_RESULT: return "result";
}
return NULL;
}
};
-class CJabberIqPermanentInfo
+class CJabberIqPermanentInfo : public MZeroedObject
{
friend class CJabberIqManager;
- CJabberIqPermanentInfo* m_pNext;
+ CJabberIqPermanentInfo *m_pNext;
JABBER_PERMANENT_IQ_HANDLER m_pHandler;
DWORD m_dwParamsToParse;
@@ -190,11 +169,8 @@ class CJabberIqPermanentInfo
void *m_pUserData;
IQ_USER_DATA_FREE_FUNC m_pUserDataFree;
int m_iPriority;
+
public:
- CJabberIqPermanentInfo()
- {
- ZeroMemory(this, sizeof(CJabberIqPermanentInfo));
- }
~CJabberIqPermanentInfo()
{
if (m_pUserDataFree)
@@ -210,316 +186,43 @@ protected:
CJabberProto *ppro;
CRITICAL_SECTION m_cs;
DWORD m_dwLastUsedHandle;
- CJabberIqInfo* m_pIqs; // list of iqs ordered by priority
+ CJabberIqInfo *m_pIqs; // list of iqs ordered by priority
HANDLE m_hExpirerThread;
BOOL m_bExpirerThreadShutdownRequest;
CJabberIqPermanentInfo* m_pPermanentHandlers;
- CJabberIqInfo* DetachInfo(int nIqId)
- {
- if ( !m_pIqs)
- return NULL;
-
- CJabberIqInfo* pInfo = m_pIqs;
- if (m_pIqs->m_nIqId == nIqId)
- {
- m_pIqs = pInfo->m_pNext;
- pInfo->m_pNext = NULL;
- return pInfo;
- }
+ CJabberIqInfo* DetachInfo(int nIqId);
+ CJabberIqInfo* DetachInfo(void *pUserData);
+ CJabberIqInfo* DetachExpired();
- while (pInfo->m_pNext)
- {
- if (pInfo->m_pNext->m_nIqId == nIqId)
- {
- CJabberIqInfo* pRetVal = pInfo->m_pNext;
- pInfo->m_pNext = pInfo->m_pNext->m_pNext;
- pRetVal->m_pNext = NULL;
- return pRetVal;
- }
- pInfo = pInfo->m_pNext;
- }
- return NULL;
- }
- CJabberIqInfo* DetachInfo(void *pUserData)
- {
- if ( !m_pIqs)
- return NULL;
-
- CJabberIqInfo* pInfo = m_pIqs;
- if (m_pIqs->m_pUserData == pUserData)
- {
- m_pIqs = pInfo->m_pNext;
- pInfo->m_pNext = NULL;
- return pInfo;
- }
+ void ExpireInfo(CJabberIqInfo *pInfo, void *pUserData = NULL);
+
+ // inserts pInfo at a place determined by pInfo->m_iPriority
+ BOOL InsertIq(CJabberIqInfo *pInfo);
- while (pInfo->m_pNext)
- {
- if (pInfo->m_pNext->m_pUserData == pUserData)
- {
- CJabberIqInfo* pRetVal = pInfo->m_pNext;
- pInfo->m_pNext = pInfo->m_pNext->m_pNext;
- pRetVal->m_pNext = NULL;
- return pRetVal;
- }
- pInfo = pInfo->m_pNext;
- }
- return NULL;
- }
- CJabberIqInfo* DetachExpired()
- {
- if ( !m_pIqs)
- return NULL;
-
- DWORD dwCurrentTime = GetTickCount();
-
- CJabberIqInfo* pInfo = m_pIqs;
- if (dwCurrentTime - pInfo->m_dwRequestTime > pInfo->m_dwTimeout)
- {
- m_pIqs = pInfo->m_pNext;
- pInfo->m_pNext = NULL;
- return pInfo;
- }
-
- while (pInfo->m_pNext)
- {
- if (dwCurrentTime - pInfo->m_pNext->m_dwRequestTime > pInfo->m_pNext->m_dwTimeout)
- {
- CJabberIqInfo* pRetVal = pInfo->m_pNext;
- pInfo->m_pNext = pInfo->m_pNext->m_pNext;
- pRetVal->m_pNext = NULL;
- return pRetVal;
- }
- pInfo = pInfo->m_pNext;
- }
- return NULL;
- }
- void ExpireInfo(CJabberIqInfo* pInfo, void *pUserData = NULL);
- BOOL InsertIq(CJabberIqInfo* pInfo)
- { // inserts pInfo at a place determined by pInfo->m_iPriority
- Lock();
- if ( !m_pIqs)
- m_pIqs = pInfo;
- else
- {
- if (m_pIqs->m_iPriority > pInfo->m_iPriority) {
- pInfo->m_pNext = m_pIqs;
- m_pIqs = pInfo;
- } else
- {
- CJabberIqInfo* pTmp = m_pIqs;
- while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
- pTmp = pTmp->m_pNext;
- pInfo->m_pNext = pTmp->m_pNext;
- pTmp->m_pNext = pInfo;
- }
- }
- Unlock();
- return TRUE;
- }
public:
- CJabberIqManager(CJabberProto* proto)
- {
- InitializeCriticalSection(&m_cs);
- m_dwLastUsedHandle = 0;
- m_pIqs = NULL;
- m_hExpirerThread = NULL;
- m_pPermanentHandlers = NULL;
- ppro = proto;
- }
- ~CJabberIqManager()
- {
- ExpireAll();
- Lock();
- CJabberIqPermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo)
- {
- CJabberIqPermanentInfo *pTmp = pInfo->m_pNext;
- delete pInfo;
- pInfo = pTmp;
- }
- m_pPermanentHandlers = NULL;
- Unlock();
- DeleteCriticalSection(&m_cs);
- }
- BOOL Start();
- BOOL Shutdown()
- {
- if (m_bExpirerThreadShutdownRequest || !m_hExpirerThread)
- return TRUE;
-
- m_bExpirerThreadShutdownRequest = TRUE;
+ CJabberIqManager(CJabberProto* proto);
+ ~CJabberIqManager();
- WaitForSingleObject(m_hExpirerThread, INFINITE);
- CloseHandle(m_hExpirerThread);
- m_hExpirerThread = NULL;
+ BOOL Start();
+ BOOL Shutdown();
- return TRUE;
- }
- void Lock()
- {
- EnterCriticalSection(&m_cs);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_cs);
- }
// fucking params, maybe just return CJabberIqRequestInfo pointer ?
CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const TCHAR *szReceiver = NULL, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT);
- CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT)
- {
- CJabberIqPermanentInfo* pInfo = new CJabberIqPermanentInfo();
- if ( !pInfo)
- return NULL;
-
- pInfo->m_pHandler = pHandler;
- pInfo->m_nIqTypes = nIqTypes ? nIqTypes : JABBER_IQ_TYPE_ANY;
- replaceStrT(pInfo->m_szXmlns, szXmlns);
- pInfo->m_bAllowPartialNs = bAllowPartialNs;
- replaceStrT(pInfo->m_szTag, szTag);
- pInfo->m_dwParamsToParse = dwParamsToParse;
- pInfo->m_pUserData = pUserData;
- pInfo->m_pUserDataFree = pUserDataFree;
- pInfo->m_iPriority = iPriority;
-
- Lock();
- if ( !m_pPermanentHandlers)
- m_pPermanentHandlers = pInfo;
- else
- {
- if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
- pInfo->m_pNext = m_pPermanentHandlers;
- m_pPermanentHandlers = pInfo;
- } else
- {
- CJabberIqPermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
- pTmp = pTmp->m_pNext;
- pInfo->m_pNext = pTmp->m_pNext;
- pTmp->m_pNext = pInfo;
- }
- }
- Unlock();
+ CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
+
+ // returns TRUE when pInfo found, or FALSE otherwise
+ BOOL DeletePermanentHandler(CJabberIqPermanentInfo *pInfo);
+ BOOL DeleteHandler(CJabberIqInfo *pInfo);
- return pInfo;
- }
- BOOL DeletePermanentHandler(CJabberIqPermanentInfo *pInfo)
- { // returns TRUE when pInfo found, or FALSE otherwise
- Lock();
- if ( !m_pPermanentHandlers)
- {
- Unlock();
- return FALSE;
- }
- if (m_pPermanentHandlers == pInfo) // check first item
- {
- m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- } else
- {
- CJabberIqPermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext)
- {
- if (pTmp->m_pNext == pInfo)
- {
- pTmp->m_pNext = pTmp->m_pNext->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- }
- pTmp = pTmp->m_pNext;
- }
- }
- Unlock();
- return FALSE;
- }
- BOOL DeleteHandler(CJabberIqInfo *pInfo)
- { // returns TRUE when pInfo found, or FALSE otherwise
- Lock();
- if ( !m_pIqs)
- {
- Unlock();
- return FALSE;
- }
- if (m_pIqs == pInfo) // check first item
- {
- m_pIqs = m_pIqs->m_pNext;
- Unlock();
- ExpireInfo(pInfo); // must expire it to allow the handler to free m_pUserData if necessary
- delete pInfo;
- return TRUE;
- } else
- {
- CJabberIqInfo* pTmp = m_pIqs;
- while (pTmp->m_pNext)
- {
- if (pTmp->m_pNext == pInfo)
- {
- pTmp->m_pNext = pTmp->m_pNext->m_pNext;
- Unlock();
- ExpireInfo(pInfo); // must expire it to allow the handler to free m_pUserData if necessary
- delete pInfo;
- return TRUE;
- }
- pTmp = pTmp->m_pNext;
- }
- }
- Unlock();
- return FALSE;
- }
BOOL HandleIq(int nIqId, HXML pNode);
BOOL HandleIqPermanent(HXML pNode);
- BOOL ExpireIq(int nIqId)
- {
- Lock();
- CJabberIqInfo* pInfo = DetachInfo(nIqId);
- Unlock();
- if (pInfo)
- {
- ExpireInfo(pInfo);
- delete pInfo;
- return TRUE;
- }
- return FALSE;
- }
+
+ BOOL ExpireIq(int nIqId);
void ExpirerThread(void);
- BOOL ExpireByUserData(void *pUserData)
- {
- BOOL bRetVal = FALSE;
- while (1)
- {
- Lock();
- CJabberIqInfo* pInfo = DetachInfo(pUserData);
- Unlock();
- if ( !pInfo)
- break;
- ExpireInfo(pInfo, NULL);
- delete pInfo;
- bRetVal = TRUE;
- }
- return bRetVal;
- }
- BOOL ExpireAll(void *pUserData = NULL)
- {
- while (1)
- {
- Lock();
- CJabberIqInfo* pInfo = m_pIqs;
- if (pInfo)
- m_pIqs = m_pIqs->m_pNext;
- Unlock();
- if ( !pInfo)
- break;
- pInfo->m_pNext = NULL;
- ExpireInfo(pInfo, pUserData);
- delete pInfo;
- }
- return TRUE;
- }
+ BOOL ExpireByUserData(void *pUserData);
+ BOOL ExpireAll(void *pUserData = NULL);
BOOL FillPermanentHandlers();
};
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index d0acf58696..36e6ee9381 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -121,37 +121,25 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
// slightly modified sample from MSDN
BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
{
- OSVERSIONINFOEX osvi;
- SYSTEM_INFO si;
- PGPI pGPI;
-
- DWORD dwType;
-
- ZeroMemory(&si, sizeof(SYSTEM_INFO));
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
-
+ OSVERSIONINFOEX osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi);
- if ( !bOsVersionInfoEx)
- {
+ if ( !bOsVersionInfoEx) {
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( !GetVersionEx((OSVERSIONINFO*)&osvi))
return FALSE;
}
+ SYSTEM_INFO si = { 0 };
GetNativeSystemInfo(&si);
// Some code from Crash Dumper Plugin :-)
- if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4)
- {
+ if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4) {
StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft "));
// Test for the specific product.
- if (osvi.dwMajorVersion == 6)
- {
- switch (osvi.dwMinorVersion)
- {
+ if (osvi.dwMajorVersion == 6) {
+ switch (osvi.dwMinorVersion) {
case 0:
if (osvi.wProductType == VER_NT_WORKSTATION)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista "));
@@ -174,13 +162,13 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
break;
}
+ DWORD dwType = 0;
HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
- pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo");
+ PGPI pGPI = (PGPI) GetProcAddress(hKernel, "GetProductInfo");
if (pGPI != NULL)
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
- switch(dwType)
- {
+ switch(dwType) {
case PRODUCT_ULTIMATE:
StringCchCat(pszOS, BUFSIZE, TEXT("Ultimate Edition"));
break;
@@ -239,49 +227,40 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
StringCchCat(pszOS, BUFSIZE, TEXT("Web Server Edition"));
break;
}
- if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
+ if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
StringCchCat(pszOS, BUFSIZE, TEXT(", 64-bit"));
- else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL)
+ else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
StringCchCat(pszOS, BUFSIZE, TEXT(", 32-bit"));
}
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
- {
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) {
if (GetSystemMetrics(SM_SERVERR2))
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003 R2, "));
else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Storage Server 2003"));
else if (osvi.wSuiteMask==VER_SUITE_WH_SERVER)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Home Server"));
- else if (osvi.wProductType == VER_NT_WORKSTATION &&
- si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
- {
+ else if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP Professional x64 Edition"));
- }
- else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003, "));
+ else
+ StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003, "));
// Test for the server type.
- if (osvi.wProductType != VER_NT_WORKSTATION)
- {
- if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64)
- {
+ if (osvi.wProductType != VER_NT_WORKSTATION) {
+ if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) {
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition for Itanium-based Systems"));
else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition for Itanium-based Systems"));
}
-
- else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
- {
+ else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter x64 Edition"));
else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise x64 Edition"));
else StringCchCat(pszOS, BUFSIZE, TEXT("Standard x64 Edition"));
}
-
- else
- {
+ else {
if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER)
StringCchCat(pszOS, BUFSIZE, TEXT("Compute Cluster Edition"));
else if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
@@ -295,24 +274,19 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
}
}
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
- {
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) {
StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP "));
if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
StringCchCat(pszOS, BUFSIZE, TEXT("Home Edition"));
else StringCchCat(pszOS, BUFSIZE, TEXT("Professional"));
}
- if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
- {
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) {
StringCchCat(pszOS, BUFSIZE, TEXT("Windows 2000 "));
if (osvi.wProductType == VER_NT_WORKSTATION)
- {
StringCchCat(pszOS, BUFSIZE, TEXT("Professional"));
- }
- else
- {
+ else {
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Server"));
else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
@@ -323,27 +297,22 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
// Include service pack (if any) and build number.
- if (_tcslen(osvi.szCSDVersion) > 0)
- {
+ if ( _tcslen(osvi.szCSDVersion) > 0) {
StringCchCat(pszOS, BUFSIZE, TEXT(" "));
StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion);
}
TCHAR buf[80];
-
mir_sntprintf(buf, 80, TEXT(" (build %d)"), osvi.dwBuildNumber);
StringCchCat(pszOS, BUFSIZE, buf);
-
return TRUE;
}
- else
- {
- return FALSE;
- }
+
+ return FALSE;
}
-BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
{
if ( !pInfo->GetFrom())
return TRUE;
@@ -356,8 +325,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo* pInfo)
query << XCHILD(_T("name"), _T("Miranda NG Jabber"));
query << XCHILD(_T("version"), szCoreVersion);
- if (m_options.ShowOSVersion)
- {
+ if (m_options.ShowOSVersion) {
TCHAR os[256] = {0};
if ( !GetOSDisplayString(os, SIZEOF(os)))
lstrcpyn(os, _T("Microsoft Windows"), SIZEOF(os));
@@ -610,7 +578,8 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
}
}
mir_free(nick);
- } }
+ }
+ }
if ((item=ListGetItemPtr(LIST_ROSTER, jid)) != NULL) {
if ( !_tcscmp(str, _T("both"))) item->subscription = SUB_BOTH;
@@ -625,12 +594,14 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
if ((hContact=HContactFromJID(jid)) != NULL) {
SetContactOfflineStatus(hContact);
ListRemove(LIST_ROSTER, jid);
- } }
+ }
+ }
else if ( isChatRoom(hContact))
db_unset(hContact, "CList", "Hidden");
else
UpdateSubscriptionInfo(hContact, item);
- } }
+ }
+ }
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
RebuildInfoFrame();
@@ -654,10 +625,6 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
return TRUE;
}
- TCHAR text[ 1024 ];
- TCHAR *str, *p, *q;
-
- str = (TCHAR*)xmlGetText(n); // URL of the file to get
filetransfer *ft = new filetransfer(this);
ft->std.totalFiles = 1;
ft->jid = mir_tstrdup(pInfo->GetFrom());
@@ -668,9 +635,11 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
ft->httpPath = NULL;
// Parse the URL
+ TCHAR *str = (TCHAR*)xmlGetText(n); // URL of the file to get
if ( !_tcsnicmp(str, _T("http://"), 7)) {
- p = str + 7;
+ TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
+ TCHAR text[1024];
if (q-p < SIZEOF(text)) {
_tcsncpy(text, p, q-p);
text[q-p] = '\0';
@@ -679,7 +648,9 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
*p = '\0';
}
ft->httpHostName = mir_t2a(text);
- } } }
+ }
+ }
+ }
if (pInfo->GetIdStr())
ft->iqId = mir_tstrdup(pInfo->GetIdStr());
@@ -720,7 +691,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
return TRUE;
}
-BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->GetChildNode())
return TRUE;
@@ -742,7 +713,7 @@ BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo* pInfo)
return TRUE;
}
-BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->GetChildNode())
return TRUE;
@@ -783,7 +754,7 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams)
return TRUE;
}
-BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo)
{
if ( !m_options.AcceptHttpAuth)
return TRUE;
@@ -798,21 +769,17 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo* pInfo)
const TCHAR *szId = xmlGetAttrValue(pConfirm, _T("id"));
const TCHAR *szMethod = xmlGetAttrValue(pConfirm, _T("method"));
const TCHAR *szUrl = xmlGetAttrValue(pConfirm, _T("url"));
-
if ( !szId || !szMethod || !szUrl)
return TRUE;
- CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams *)mir_alloc(sizeof(CJabberHttpAuthParams));
- if ( !pParams)
- return TRUE;
- ZeroMemory(pParams, sizeof(CJabberHttpAuthParams));
- pParams->m_nType = CJabberHttpAuthParams::IQ;
- pParams->m_szFrom = mir_tstrdup(pInfo->GetFrom());
- pParams->m_szId = mir_tstrdup(szId);
- pParams->m_szMethod = mir_tstrdup(szMethod);
- pParams->m_szUrl = mir_tstrdup(szUrl);
-
- AddClistHttpAuthEvent(pParams);
-
+ CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams*)mir_calloc(sizeof(CJabberHttpAuthParams));
+ if (pParams) {
+ pParams->m_nType = CJabberHttpAuthParams::IQ;
+ pParams->m_szFrom = mir_tstrdup(pInfo->GetFrom());
+ pParams->m_szId = mir_tstrdup(szId);
+ pParams->m_szMethod = mir_tstrdup(szMethod);
+ pParams->m_szUrl = mir_tstrdup(szUrl);
+ AddClistHttpAuthEvent(pParams);
+ }
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 5ef126bcbd..54f83a0ed7 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -78,7 +78,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode)
OnProcessLoginRq(m_ThreadInfo, JABBER_LOGIN_SERVERINFO);
}
-void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInfo)
{
const TCHAR *szGroupDelimeter = NULL;
BOOL bPrivateStorageSupport = FALSE;
@@ -107,7 +107,7 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo* pInf
<< XCHILDNS(_T("query"), JABBER_FEAT_IQ_ROSTER));
}
-void CJabberProto::OnIqResultNotes(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultNotes(HXML iqNode, CJabberIqInfo *pInfo)
{
if (iqNode && pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
HXML hXmlData = XPathFmt(iqNode, _T("query[@xmlns='%s']/storage[@xmlns='%s']"),
@@ -170,7 +170,7 @@ void CJabberProto::OnLoggedIn()
// XEP-0083 support
{
- CJabberIqInfo* pIqInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultNestedRosterGroups, JABBER_IQ_TYPE_GET);
+ CJabberIqInfo *pIqInfo = m_iqManager.AddHandler(&CJabberProto::OnIqResultNestedRosterGroups, JABBER_IQ_TYPE_GET);
// ugly hack to prevent hangup during login process
pIqInfo->SetTimeout(30000);
m_ThreadInfo->send(
@@ -289,7 +289,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode)
m_ThreadInfo = NULL; // To disallow auto reconnect
} }
-void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !m_ThreadInfo || !iqNode)
return;
@@ -317,7 +317,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo* pInfo)
}
}
-void CJabberProto::OnIqResultSession(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultSession(HXML iqNode, CJabberIqInfo *pInfo)
{
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT)
OnLoggedIn();
@@ -349,7 +349,7 @@ void CJabberProto::GroupchatJoinByHContact(HANDLE hContact, bool autojoin)
/////////////////////////////////////////////////////////////////////////////////////////
// JabberIqResultGetRoster - populates LIST_ROSTER and creates contact for any new rosters
-void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
{
Log("<iq/> iqIdGetRoster");
TCHAR *szGroupDelimeter = (TCHAR *)pInfo->GetUserData();
@@ -1604,7 +1604,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode)
} }
// last activity (XEP-0012) support
-void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo)
{
pResourceStatus r( ResourceInfoFromJID(pInfo->m_szFrom));
if (r == NULL)
@@ -1630,7 +1630,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo* pInfo)
}
// entity time (XEP-0202) support
-void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->m_hContact)
return;
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp
index 910c76a0be..ed33c1ccf3 100644
--- a/protocols/JabberG/src/jabber_message_manager.cpp
+++ b/protocols/JabberG/src/jabber_message_manager.cpp
@@ -26,27 +26,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber.h"
#include "jabber_message_manager.h"
-BOOL CJabberMessageManager::FillPermanentHandlers()
+CJabberMessageManager::CJabberMessageManager(CJabberProto *proto)
+{
+ InitializeCriticalSection(&m_cs);
+ m_pPermanentHandlers = NULL;
+ ppro = proto;
+}
+CJabberMessageManager::~CJabberMessageManager()
+{
+ CJabberMessagePermanentInfo *pInfo = m_pPermanentHandlers;
+ while (pInfo) {
+ CJabberMessagePermanentInfo *pTmp = pInfo->m_pNext;
+ delete pInfo;
+ pInfo = pTmp;
+ }
+ m_pPermanentHandlers = NULL;
+
+ DeleteCriticalSection(&m_cs);
+}
+
+void CJabberMessageManager::FillPermanentHandlers()
{
AddPermanentHandler(&CJabberProto::OnMessageError, JABBER_MESSAGE_TYPE_ERROR, JABBER_MESSAGE_PARSE_FROM | JABBER_MESSAGE_PARSE_HCONTACT, NULL, FALSE, _T("error"));
AddPermanentHandler(&CJabberProto::OnMessageIbb, 0, 0, JABBER_FEAT_IBB, FALSE, _T("data"));
AddPermanentHandler(&CJabberProto::OnMessagePubsubEvent, 0, 0, JABBER_FEAT_PUBSUB_EVENT, FALSE, _T("event"));
AddPermanentHandler(&CJabberProto::OnMessageGroupchat, JABBER_MESSAGE_TYPE_GROUPCHAT, JABBER_MESSAGE_PARSE_FROM, NULL, FALSE, NULL);
- return TRUE;
}
-BOOL CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThreadData)
+bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThreadData)
{
- BOOL bStopHandling = FALSE;
- Lock();
+ mir_cslock lck(m_cs);
+
CJabberMessagePermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo && !bStopHandling) {
- // have to get all data here, in the loop, because there's always possibility that previous handler modified it
+ while (pInfo) {
+ // have to get all data here, in the loop, because there's always possibility that previous handler modified it
CJabberMessageInfo messageInfo;
LPCTSTR szType = xmlGetAttrValue(node, _T("type"));
- if (szType)
- {
+ if (szType) {
if ( !_tcsicmp(szType, _T("normal")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
else if ( !_tcsicmp(szType, _T("error")))
@@ -58,24 +75,20 @@ BOOL CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea
else if ( !_tcsicmp(szType, _T("headline")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_HEADLINE;
else
- break; // m_nMessageType = JABBER_MESSAGE_TYPE_FAIL;
- }
- else {
- messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
+ return FALSE;
}
+ else messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
- if ((pInfo->m_nMessageTypes & messageInfo.m_nMessageType)) {
- int i;
- for (i = xmlGetChildCount(node) - 1; i >= 0; i--) {
- // enumerate all children and see whether this node suits handler criteria
+ if (pInfo->m_nMessageTypes & messageInfo.m_nMessageType) {
+ for (int i = xmlGetChildCount(node) - 1; i >= 0; i--) {
+ // enumerate all children and see whether this node suits handler criteria
HXML child = xmlGetChild(node, i);
LPCTSTR szTagName = xmlGetName(child);
LPCTSTR szXmlns = xmlGetAttrValue(child, _T("xmlns"));
- if ((!pInfo->m_szXmlns || (szXmlns && !_tcscmp(pInfo->m_szXmlns, szXmlns))) &&
- (!pInfo->m_szTag || !_tcscmp(pInfo->m_szTag, szTagName))) {
- // node suits handler criteria, call the handler
+ if ((!pInfo->m_szXmlns || (szXmlns && !_tcscmp(pInfo->m_szXmlns, szXmlns))) && (!pInfo->m_szTag || !_tcscmp(pInfo->m_szTag, szTagName))) {
+ // node suits handler criteria, call the handler
messageInfo.m_hChildNode = child;
messageInfo.m_szChildTagName = szTagName;
messageInfo.m_szChildTagXmlns = szXmlns;
@@ -93,16 +106,81 @@ BOOL CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea
if (messageInfo.m_szFrom)
ppro->Log("Handling message from %S", messageInfo.m_szFrom);
- if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &messageInfo)) {
- bStopHandling = TRUE;
- break;
- }
+ if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &messageInfo))
+ return TRUE;
}
}
}
pInfo = pInfo->m_pNext;
}
- Unlock();
- return bStopHandling;
+ return FALSE;
+}
+
+CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler(
+ JABBER_PERMANENT_MESSAGE_HANDLER pHandler,
+ int nMessageTypes,
+ DWORD dwParamsToParse,
+ const TCHAR *szXmlns,
+ BOOL bAllowPartialNs,
+ const TCHAR *szTag,
+ void *pUserData,
+ MESSAGE_USER_DATA_FREE_FUNC pUserDataFree,
+ int iPriority)
+{
+ CJabberMessagePermanentInfo* pInfo = new CJabberMessagePermanentInfo();
+ if (pInfo == NULL)
+ return NULL;
+
+ pInfo->m_pHandler = pHandler;
+ pInfo->m_nMessageTypes = nMessageTypes ? nMessageTypes : JABBER_MESSAGE_TYPE_ANY;
+ replaceStrT(pInfo->m_szXmlns, szXmlns);
+ pInfo->m_bAllowPartialNs = bAllowPartialNs;
+ replaceStrT(pInfo->m_szTag, szTag);
+ pInfo->m_dwParamsToParse = dwParamsToParse;
+ pInfo->m_pUserData = pUserData;
+ pInfo->m_pUserDataFree = pUserDataFree;
+ pInfo->m_iPriority = iPriority;
+
+ mir_cslock lck(m_cs);
+ if ( !m_pPermanentHandlers)
+ m_pPermanentHandlers = pInfo;
+ else {
+ if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
+ pInfo->m_pNext = m_pPermanentHandlers;
+ m_pPermanentHandlers = pInfo;
+ }
+ else {
+ CJabberMessagePermanentInfo *pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
+ pTmp = pTmp->m_pNext;
+ pInfo->m_pNext = pTmp->m_pNext;
+ pTmp->m_pNext = pInfo;
+ }
+ }
+ return pInfo;
+}
+
+bool CJabberMessageManager::DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo)
+{
+ mir_cslock lck(m_cs);
+ if ( !m_pPermanentHandlers)
+ return FALSE;
+
+ if (m_pPermanentHandlers == pInfo) { // check first item
+ m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
+ delete pInfo;
+ return TRUE;
+ }
+
+ CJabberMessagePermanentInfo *pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext) {
+ if (pTmp->m_pNext == pInfo) {
+ pTmp->m_pNext = pTmp->m_pNext->m_pNext;
+ delete pInfo;
+ return TRUE;
+ }
+ pTmp = pTmp->m_pNext;
+ }
+ return FALSE;
}
diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h
index 3af7fe9af3..ac655b547c 100644
--- a/protocols/JabberG/src/jabber_message_manager.h
+++ b/protocols/JabberG/src/jabber_message_manager.h
@@ -41,7 +41,7 @@ typedef BOOL (CJabberProto::*JABBER_PERMANENT_MESSAGE_HANDLER)(HXML messageNode,
#define JABBER_MESSAGE_PARSE_TO (1<<5)
#define JABBER_MESSAGE_PARSE_ID_STR (1<<6)
-class CJabberMessageInfo
+class CJabberMessageInfo : public MZeroedObject
{
protected:
friend class CJabberMessageManager;
@@ -61,48 +61,33 @@ public:
LPCTSTR m_szId;
public:
- CJabberMessageInfo()
- {
- ZeroMemory(this, sizeof(*this));
- }
- ~CJabberMessageInfo()
- {
- }
- int GetMessageType()
- {
- return m_nMessageType;
+ __forceinline int GetMessageType()
+ { return m_nMessageType;
}
- void* GetUserData()
- {
- return m_pUserData;
+ __forceinline void* GetUserData()
+ { return m_pUserData;
}
- LPCTSTR GetFrom()
- {
- return m_szFrom;
+ __forceinline LPCTSTR GetFrom()
+ { return m_szFrom;
}
- LPCTSTR GetTo()
- {
- return m_szTo;
+ __forceinline LPCTSTR GetTo()
+ { return m_szTo;
}
- LPCTSTR GetIdStr()
- {
- return m_szId;
+ __forceinline LPCTSTR GetIdStr()
+ { return m_szId;
}
- HANDLE GetHContact()
- {
- return m_hContact;
+ __forceinline HANDLE GetHContact()
+ { return m_hContact;
}
- HXML GetChildNode()
- {
- return m_hChildNode;
+ __forceinline HXML GetChildNode()
+ { return m_hChildNode;
}
- LPCTSTR GetChildNodeName()
- {
- return m_szChildTagName;
+ __forceinline LPCTSTR GetChildNodeName()
+ { return m_szChildTagName;
}
};
-class CJabberMessagePermanentInfo
+class CJabberMessagePermanentInfo : public MZeroedObject
{
friend class CJabberMessageManager;
@@ -117,11 +102,8 @@ class CJabberMessagePermanentInfo
void *m_pUserData;
MESSAGE_USER_DATA_FREE_FUNC m_pUserDataFree;
int m_iPriority;
+
public:
- CJabberMessagePermanentInfo()
- {
- ZeroMemory(this, sizeof(CJabberMessagePermanentInfo));
- }
~CJabberMessagePermanentInfo()
{
if (m_pUserDataFree)
@@ -139,113 +121,14 @@ protected:
CJabberMessagePermanentInfo* m_pPermanentHandlers;
public:
- CJabberMessageManager(CJabberProto* proto)
- {
- InitializeCriticalSection(&m_cs);
- m_pPermanentHandlers = NULL;
- ppro = proto;
- }
- ~CJabberMessageManager()
- {
- Lock();
- CJabberMessagePermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo)
- {
- CJabberMessagePermanentInfo *pTmp = pInfo->m_pNext;
- delete pInfo;
- pInfo = pTmp;
- }
- m_pPermanentHandlers = NULL;
- Unlock();
- DeleteCriticalSection(&m_cs);
- }
- BOOL Start()
- {
- return TRUE;
- }
- BOOL Shutdown()
- {
- return TRUE;
- }
- void Lock()
- {
- EnterCriticalSection(&m_cs);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_cs);
- }
- CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT)
- {
- CJabberMessagePermanentInfo* pInfo = new CJabberMessagePermanentInfo();
- if ( !pInfo)
- return NULL;
-
- pInfo->m_pHandler = pHandler;
- pInfo->m_nMessageTypes = nMessageTypes ? nMessageTypes : JABBER_MESSAGE_TYPE_ANY;
- replaceStrT(pInfo->m_szXmlns, szXmlns);
- pInfo->m_bAllowPartialNs = bAllowPartialNs;
- replaceStrT(pInfo->m_szTag, szTag);
- pInfo->m_dwParamsToParse = dwParamsToParse;
- pInfo->m_pUserData = pUserData;
- pInfo->m_pUserDataFree = pUserDataFree;
- pInfo->m_iPriority = iPriority;
-
- Lock();
- if ( !m_pPermanentHandlers)
- m_pPermanentHandlers = pInfo;
- else
- {
- if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
- pInfo->m_pNext = m_pPermanentHandlers;
- m_pPermanentHandlers = pInfo;
- } else
- {
- CJabberMessagePermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
- pTmp = pTmp->m_pNext;
- pInfo->m_pNext = pTmp->m_pNext;
- pTmp->m_pNext = pInfo;
- }
- }
- Unlock();
-
- return pInfo;
- }
- BOOL DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo)
- { // returns TRUE when pInfo found, or FALSE otherwise
- Lock();
- if ( !m_pPermanentHandlers)
- {
- Unlock();
- return FALSE;
- }
- if (m_pPermanentHandlers == pInfo) // check first item
- {
- m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- } else
- {
- CJabberMessagePermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext)
- {
- if (pTmp->m_pNext == pInfo)
- {
- pTmp->m_pNext = pTmp->m_pNext->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- }
- pTmp = pTmp->m_pNext;
- }
- }
- Unlock();
- return FALSE;
- }
- BOOL HandleMessagePermanent(HXML node, ThreadData *pThreadData);
- BOOL FillPermanentHandlers();
+ CJabberMessageManager(CJabberProto* proto);
+ ~CJabberMessageManager();
+
+ CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT);
+ bool DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo);
+
+ bool HandleMessagePermanent(HXML node, ThreadData *pThreadData);
+ void FillPermanentHandlers();
};
#endif
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 62ea484a56..eef6276e4f 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define JABBER_PL_BUSY_MSG LPGEN("Sending request, please wait...")
-BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo* pInfo)
+BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo *pInfo)
{
if (pInfo->GetIqType() == JABBER_IQ_TYPE_SET) {
if ( !m_pDlgPrivacyLists)
@@ -45,7 +45,7 @@ BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo* pInfo)
return TRUE;
}
-void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo)
{
if ( !pInfo->m_pUserData)
return;
@@ -169,7 +169,7 @@ CPrivacyListRule* GetSelectedRule(HWND hDlg)
return (CPrivacyListRule*)nItemData;
}
-void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo)
{
CPrivacyList *pList = (CPrivacyList *)pInfo->GetUserData();
@@ -209,7 +209,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo* pInfo
BuildPrivacyListsMenu(true);
}
-void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInfo)
{
CPrivacyList *pList = (CPrivacyList *)pInfo->GetUserData();
@@ -248,7 +248,7 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo* pInf
}
}
-void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo* pInfo)
+void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo)
{
if (pInfo->m_nIqType != JABBER_IQ_TYPE_RESULT)
return;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 47b84f1117..15a640f50a 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -129,7 +129,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) :
m_iqManager.FillPermanentHandlers();
m_iqManager.Start();
m_messageManager.FillPermanentHandlers();
- m_messageManager.Start();
m_presenceManager.FillPermanentHandlers();
m_presenceManager.Start();
m_sendManager.Start();
@@ -327,7 +326,6 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM)
m_iqManager.ExpireAll();
m_iqManager.Shutdown();
- m_messageManager.Shutdown();
m_presenceManager.Shutdown();
m_sendManager.Shutdown();
ConsoleUninit();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index a9a994ec6f..2a5dea1b34 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -286,15 +286,15 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int __cdecl ContactMenuRunCommands(WPARAM wParam, LPARAM lParam);
HWND GetWindowFromIq(HXML iqNode);
- BOOL HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo* pInfo);
- BOOL IsRcRequestAllowedByACL(CJabberIqInfo* pInfo);
+ BOOL HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo);
+ BOOL IsRcRequestAllowedByACL(CJabberIqInfo *pInfo);
- int AdhocSetStatusHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
- int AdhocOptionsHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
- int AdhocForwardHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
- int AdhocLockWSHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
- int AdhocQuitMirandaHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
- int AdhocLeaveGroupchatsHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
+ int AdhocSetStatusHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
+ int AdhocOptionsHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
+ int AdhocForwardHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
+ int AdhocLockWSHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
+ int AdhocQuitMirandaHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
+ int AdhocLeaveGroupchatsHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
void OnIqResult_ListOfCommands(HXML iqNode);
void OnIqResult_CommandExecution(HXML iqNode);
@@ -337,8 +337,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void __cdecl ByteSendThread(JABBER_BYTE_TRANSFER *jbt);
void __cdecl ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt);
- void IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo* pInfo);
- void ByteInitiateResult(HXML iqNode, CJabberIqInfo* pInfo);
+ void IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo);
+ void ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo);
void ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt);
int ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
void IqResultStreamActivate(HXML iqNode);
@@ -393,11 +393,11 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnMenuHandleServiceDiscoveryConferences(WPARAM wParam, LPARAM lParam);
- void OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultServiceDiscoveryRoot(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultServiceDiscoveryRoot(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo *pInfo);
BOOL SendInfoRequest(CJabberSDNode *pNode, HXML parent);
BOOL SendBothRequests(CJabberSDNode *pNode, HXML parent);
void PerformBrowse(HWND hwndDlg);
@@ -408,8 +408,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
int SetupServiceDiscoveryDlg(TCHAR* jid);
- void OnIqResultCapsDiscoInfo(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultCapsDiscoInfoSI(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultCapsDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultCapsDiscoInfoSI(HXML iqNode, CJabberIqInfo *pInfo);
void RegisterAgent(HWND hwndDlg, TCHAR* jid);
@@ -439,7 +439,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void FtHandleSiRequest(HXML iqNode);
void FtAcceptSiRequest(filetransfer *ft);
void FtAcceptIbbRequest(filetransfer *ft);
- BOOL FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo* pInfo);
+ BOOL FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo);
BOOL FtHandleIbbRequest(HXML iqNode, BOOL bOpen);
//---- jabber_groupchat.c ------------------------------------------------------------
@@ -483,9 +483,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void IqRemove(int index);
void IqExpire();
- void OnIqResultBind(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultDiscoBookmarks(HXML iqNode);
- void OnIqResultEntityTime(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultEntityTime(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultExtSearch(HXML iqNode);
void OnIqResultGetAuth(HXML iqNode);
void OnIqResultGetVCardAvatar(HXML iqNode);
@@ -494,18 +494,18 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mimeType);
void OnIqResultGetMuc(HXML iqNode);
void OnIqResultGetRegister(HXML iqNode);
- void OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetVcard(HXML iqNode);
- void OnIqResultLastActivity(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultMucGetAdminList(HXML iqNode);
void OnIqResultMucGetBanList(HXML iqNode);
void OnIqResultMucGetMemberList(HXML iqNode);
void OnIqResultMucGetModeratorList(HXML iqNode);
void OnIqResultMucGetOwnerList(HXML iqNode);
void OnIqResultMucGetVoiceList(HXML iqNode);
- void OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultNotes(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultSession(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultNotes(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultSession(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultSetAuth(HXML iqNode);
void OnIqResultSetBookmarks(HXML iqNode);
void OnIqResultSetPassword(HXML iqNode);
@@ -518,7 +518,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
//---- jabber_iq_handlers.cpp -------------------------------------------------------
- BOOL OnIqRequestVersion(HXML node, CJabberIqInfo* pInfo);
+ BOOL OnIqRequestVersion(HXML node, CJabberIqInfo *pInfo);
BOOL OnIqRequestLastActivity(HXML node, CJabberIqInfo *pInfo);
BOOL OnIqRequestPing(HXML node, CJabberIqInfo *pInfo);
BOOL OnIqRequestTime(HXML node, CJabberIqInfo *pInfo);
@@ -527,18 +527,18 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
BOOL OnSiRequest(HXML node, CJabberIqInfo *pInfo);
BOOL OnRosterPushRequest(HXML node, CJabberIqInfo *pInfo);
BOOL OnIqRequestOOB(HXML node, CJabberIqInfo *pInfo);
- BOOL OnIqHttpAuth(HXML node, CJabberIqInfo* pInfo);
+ BOOL OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo);
BOOL AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams);
void __cdecl IbbSendThread(JABBER_IBB_TRANSFER *jibb);
void __cdecl IbbReceiveThread(JABBER_IBB_TRANSFER *jibb);
- void OnIbbInitiateResult(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIbbCloseResult(HXML iqNode, CJabberIqInfo* pInfo);
- BOOL OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIbbInitiateResult(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIbbCloseResult(HXML iqNode, CJabberIqInfo *pInfo);
+ BOOL OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo);
BOOL OnIbbRecvdData(const TCHAR *data, const TCHAR *sid, const TCHAR *seq);
- void OnFtSiResult(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo);
BOOL FtIbbSend(int blocksize, filetransfer *ft);
BOOL FtSend(HANDLE hConn, filetransfer *ft);
void FtSendFinal(BOOL success, filetransfer *ft);
@@ -660,12 +660,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void QueryPrivacyLists(ThreadData *pThreadInfo = NULL);
- BOOL OnIqRequestPrivacyLists(HXML iqNode, CJabberIqInfo* pInfo);
+ BOOL OnIqRequestPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultPrivacyList(HXML iqNode);
- void OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo* pInfo);
- void OnIqResultPrivacyListModify(HXML iqNode, CJabberIqInfo* pInfo);
+ void OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInfo);
+ void OnIqResultPrivacyListModify(HXML iqNode, CJabberIqInfo *pInfo);
//---- jabber_proto.cpp --------------------------------------------------------------
@@ -774,7 +774,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
BOOL OnProcessJingle(HXML node);
void OnProcessIq(HXML node);
void OnProcessRegIq(HXML node, ThreadData* info);
- void OnPingReply(HXML node, CJabberIqInfo* pInfo);
+ void OnPingReply(HXML node, CJabberIqInfo *pInfo);
bool ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info);
@@ -829,8 +829,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
//---- jabber_xmlns.c ----------------------------------------------------------------
- BOOL OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo* pInfo);
- BOOL OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo* pInfo);
+ BOOL OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo);
+ BOOL OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo);
//---- jabber_xstatus.c --------------------------------------------------------------
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index d1a9cdc90f..e09a0cf5d0 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -39,7 +39,7 @@ CJabberAdhocSession::CJabberAdhocSession(CJabberProto* global)
m_dwStartTime = GetTickCount();
}
-BOOL CJabberProto::IsRcRequestAllowedByACL(CJabberIqInfo* pInfo)
+BOOL CJabberProto::IsRcRequestAllowedByACL(CJabberIqInfo *pInfo)
{
if ( !pInfo || !pInfo->GetFrom())
return FALSE;
@@ -47,7 +47,7 @@ BOOL CJabberProto::IsRcRequestAllowedByACL(CJabberIqInfo* pInfo)
return IsMyOwnJID(pInfo->GetFrom());
}
-BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo* pInfo)
+BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
if ( !pInfo->GetChildNode())
return TRUE;
@@ -65,7 +65,7 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo* pInfo)
return TRUE;
}
-BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo* pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
if ( !szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
@@ -94,7 +94,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo* pInfo, const T
return FALSE;
}
-BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo* pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
if ( !szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
@@ -135,7 +135,7 @@ BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo* pInfo, const TC
return FALSE;
}
-BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo* pInfo, const TCHAR *szNode)
+BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
// ATTN: ACL and db settings checked in calling function
@@ -251,7 +251,7 @@ static char *StatusModeToDbSetting(int status,const char *suffix)
return str;
}
-int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
if (pSession->GetStage() == 0) {
// first form
@@ -395,7 +395,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhoc
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
}
-int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
if (pSession->GetStage() == 0) {
// first form
@@ -492,7 +492,7 @@ int CJabberProto::RcGetUnreadEventsCount()
return nEventsSent;
}
-int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
TCHAR szMsg[ 1024 ];
if (pSession->GetStage() == 0) {
@@ -624,7 +624,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
}
-int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
BOOL bOk = LockWorkStation();
@@ -648,7 +648,7 @@ static void __stdcall JabberQuitMirandaIMThread(void*)
CallService("CloseAction", 0, 0);
}
-int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
if (pSession->GetStage() == 0) {
// first form
@@ -694,7 +694,7 @@ int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo* pInfo, CJabberAdh
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
}
-int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
int i = 0;
if (pSession->GetStage() == 0) {
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h
index fae38a0bf0..27c26f3ab9 100644
--- a/protocols/JabberG/src/jabber_rc.h
+++ b/protocols/JabberG/src/jabber_rc.h
@@ -33,7 +33,7 @@ class CJabberAdhocSession;
#define JABBER_ADHOC_HANDLER_STATUS_COMPLETED 2
#define JABBER_ADHOC_HANDLER_STATUS_CANCEL 3
#define JABBER_ADHOC_HANDLER_STATUS_REMOVE_SESSION 4
-typedef int (CJabberProto::*JABBER_ADHOC_HANDLER)(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession);
+typedef int (CJabberProto::*JABBER_ADHOC_HANDLER)(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession);
// 5 minutes to fill out form :)
#define JABBER_ADHOC_SESSION_EXPIRE_TIME 300000
@@ -148,7 +148,7 @@ public:
{
return m_szName;
}
- BOOL CallHandler(HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession)
+ BOOL CallHandler(HXML iqNode, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession)
{
if (m_pHandler == NULL)
return FALSE;
@@ -296,9 +296,9 @@ public:
{
return m_pNodes;
}
- BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo* pInfo, const TCHAR *szNode);
- BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo* pInfo, const TCHAR *szNode);
- BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo* pInfo, const TCHAR *szNode);
+ BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
+ BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
+ BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode);
BOOL ExpireSessions()
{
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 62d73180bb..03b2b81669 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -133,7 +133,7 @@ static VOID CALLBACK JabberOfflineChatWindows(void* param)
/////////////////////////////////////////////////////////////////////////////////////////
// Jabber keep-alive thread
-void CJabberProto::OnPingReply(HXML, CJabberIqInfo* pInfo)
+void CJabberProto::OnPingReply(HXML, CJabberIqInfo *pInfo)
{
if ( !pInfo)
return;
@@ -470,7 +470,7 @@ LBL_FatalError:
break;
else if (nSelRes == 0 && m_bSendKeepAlive) {
if (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PING) {
- CJabberIqInfo* pInfo = m_iqManager.AddHandler(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, NULL, 0, -1, this);
+ CJabberIqInfo *pInfo = m_iqManager.AddHandler(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, NULL, 0, -1, this);
pInfo->SetTimeout(m_options.ConnectionKeepAliveTimeout);
info->send( XmlNodeIq(pInfo) << XATTR(_T("from"), m_ThreadInfo->fullJID) << XCHILDNS(_T("ping"), JABBER_FEAT_PING));
}
@@ -1891,7 +1891,7 @@ void CJabberProto::OnProcessIq(HXML node)
return;
}
// RECVED: <iq type='error'> ...
- else if ( !_tcscmp(type, _T("error"))) {
+ if ( !_tcscmp(type, _T("error"))) {
Log("XXX on entry");
// Check for file transfer deny by comparing idStr with ft->iqId
LISTFOREACH(i, this, LIST_FILE)
@@ -1903,7 +1903,8 @@ void CJabberProto::OnProcessIq(HXML node)
if (item->ft->hFileEvent != NULL)
SetEvent(item->ft->hFileEvent); // Simulate the termination of file server connection
}
- } }
+ }
+ }
else if ((!_tcscmp(type, _T("get")) || !_tcscmp(type, _T("set")))) {
XmlNodeIq iq(_T("error"), idStr, xmlGetAttrValue(node, _T("from")));
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp
index 7ff95e1948..07e1dae2a1 100644
--- a/protocols/JabberG/src/jabber_xml.cpp
+++ b/protocols/JabberG/src/jabber_xml.cpp
@@ -59,7 +59,7 @@ XmlNodeIq::XmlNodeIq(const TCHAR *type, HXML node, LPCTSTR to) :
}
}
-XmlNodeIq::XmlNodeIq(CJabberIqInfo* pInfo) :
+XmlNodeIq::XmlNodeIq(CJabberIqInfo *pInfo) :
XmlNode(_T("iq"))
{
if (pInfo) {
@@ -69,7 +69,7 @@ XmlNodeIq::XmlNodeIq(CJabberIqInfo* pInfo) :
}
}
-XmlNodeIq::XmlNodeIq(const TCHAR *type, CJabberIqInfo* pInfo) :
+XmlNodeIq::XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo) :
XmlNode(_T("iq"))
{
if (type != NULL) *this << XATTR(_T("type"), type);
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h
index e591e5d852..c9a9c041fc 100644
--- a/protocols/JabberG/src/jabber_xml.h
+++ b/protocols/JabberG/src/jabber_xml.h
@@ -86,9 +86,9 @@ struct XmlNodeIq : public XmlNode
XmlNodeIq(const TCHAR *type, const TCHAR *idStr, const TCHAR *to);
XmlNodeIq(const TCHAR *type, HXML node, const TCHAR *to);
// new request
- XmlNodeIq(CJabberIqInfo* pInfo);
+ XmlNodeIq(CJabberIqInfo *pInfo);
// answer to request
- XmlNodeIq(const TCHAR *type, CJabberIqInfo* pInfo);
+ XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo);
};
typedef void (*JABBER_XML_CALLBACK)(HXML, void*);