diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-18 14:40:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-18 14:40:43 +0000 |
commit | cdbdcef6d92500b3b156ea6e304440e82621aa00 (patch) | |
tree | 6c6673df2824ae7e83dfa8c2c9b2859388c574b7 /protocols | |
parent | 08c2fa14c7ee65003e8e9b59567bb4525d17c28c (diff) |
fixes 584
git-svn-id: http://svn.miranda-ng.org/main/trunk@8163 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/JabberG/src/jabber.h | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_form.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 90 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 9 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 13 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_xml.cpp | 4 |
9 files changed, 74 insertions, 63 deletions
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index 04634dce2c..92db509934 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -430,7 +430,8 @@ struct filetransfer JABBER_SOCKET s;
JABBER_FILE_STATE state;
TCHAR *jid;
- int fileId, iqId;
+ int fileId;
+ TCHAR* szId;
TCHAR *sid;
int bCompleted;
HANDLE hWaitEvent;
@@ -740,6 +741,7 @@ void __stdcall JabberUtfToTchar(const char* str, size_t cbLen, LPTSTR& time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp);
TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR* dest, size_t destLen);
int __stdcall JabberGetPacketID(HXML n);
+TCHAR* __stdcall JabberId2string(int id);
LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 1975b126a7..92d9019b32 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -285,7 +285,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) char *pFileName = mir_urlEncode( ptrA( mir_utf8encodeT(p)));
if (pFileName != NULL) {
- ft->iqId = SerialNext();
+ ft->szId = JabberId2string(SerialNext());
ptrA myAddr;
if (m_options.BsDirect && m_options.BsDirectManual)
@@ -302,7 +302,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource);
- XmlNodeIq iq(_T("set"), ft->iqId, fulljid);
+ XmlNodeIq iq(_T("set"), ft->szId, fulljid);
HXML query = iq << XQUERY(JABBER_FEAT_OOB);
query << XCHILD(_T("url"), _A2T(szAddr));
query << XCHILD(_T("desc"), ft->szDescription);
@@ -468,6 +468,7 @@ filetransfer::~filetransfer() if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
+ mir_free(szId);
mir_free(jid);
mir_free(sid);
mir_free(fileSize);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index d3d5d58d4e..21ef373827 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -625,14 +625,14 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) id++;
}
else if (!_tcscmp(type, _T("boolean"))) {
- TCHAR buf[ 10 ];
+ TCHAR buf[10];
_itot(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10);
field << XCHILD(_T("value"), buf);
id++;
}
else if (!_tcscmp(type, _T("list-single"))) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
- str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1));
+ str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1));
GetDlgItemText(hFrame, id, str, len+1);
v = NULL;
for (j=0; ; j++) {
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 2d34b62a5b..bd22179228 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -354,7 +354,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) ft->jid = mir_tstrdup(from);
ft->std.hContact = HContactFromJID(from);
ft->sid = mir_tstrdup(sid);
- ft->iqId = _ttoi(szId+4);
+ ft->szId = mir_tstrdup(szId);
ft->type = ftType;
ft->std.totalFiles = 1;
ft->std.tszCurrentFile = mir_tstrdup(filename);
@@ -399,7 +399,7 @@ void CJabberProto::FtAcceptSiRequest(filetransfer *ft) item->ft = ft;
m_ThreadInfo->send(
- XmlNodeIq(_T("result"), ft->iqId, ft->jid)
+ XmlNodeIq(_T("result"), ft->szId, ft->jid)
<< XCHILDNS(_T("si"), JABBER_FEAT_SI)
<< XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
<< XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
@@ -416,7 +416,7 @@ void CJabberProto::FtAcceptIbbRequest(filetransfer *ft) item->ft = ft;
m_ThreadInfo->send(
- XmlNodeIq(_T("result"), ft->iqId, ft->jid)
+ XmlNodeIq(_T("result"), ft->szId, ft->jid)
<< XCHILDNS(_T("si"), JABBER_FEAT_SI)
<< XCHILDNS(_T("feature"), JABBER_FEAT_FEATURE_NEG)
<< XCHILDNS(_T("x"), JABBER_FEAT_DATA_FORMS) << XATTR(_T("type"), _T("submit"))
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index d783fb189c..da5e389234 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -659,7 +659,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) }
if (pInfo->GetIdStr())
- ft->iqId = pInfo->GetIqId();
+ ft->szId = JabberId2string(pInfo->GetIqId());
if (ft->httpHostName && ft->httpPath) {
TCHAR *desc = NULL;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index d333351ebd..87c6f2a8ee 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -573,13 +573,13 @@ int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *) switch (ft->type) {
case FT_OOB:
- m_ThreadInfo->send( XmlNodeIq(_T("error"), ft->iqId, ft->jid) << XCHILD(_T("error"), _T("File transfer refused")) << XATTRI(_T("code"), 406));
+ m_ThreadInfo->send(XmlNodeIq(_T("error"), ft->szId, ft->jid) << XCHILD(_T("error"), _T("File transfer refused")) << XATTRI(_T("code"), 406));
break;
case FT_BYTESTREAM:
case FT_IBB:
m_ThreadInfo->send(
- XmlNodeIq(_T("error"), ft->iqId, ft->jid)
+ XmlNodeIq(_T("error"), ft->szId, ft->jid)
<< XCHILD(_T("error"), _T("File transfer refused")) << XATTRI(_T("code"), 403) << XATTR(_T("type"), _T("cancel"))
<< XCHILDNS(_T("forbidden"), _T("urn:ietf:params:xml:ns:xmpp-stanzas"))
<< XCHILD(_T("text"), _T("File transfer refused")) << XATTR(_T("xmlns"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
@@ -610,7 +610,7 @@ int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const TCHAR DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact)
{
- switch(type) {
+ switch (type) {
case PFLAGNUM_1:
return PF1_IM | PF1_AUTHREQ | PF1_CHAT | PF1_SERVERCLIST | PF1_MODEMSG | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_FILE | PF1_CONTACT;
case PFLAGNUM_2:
@@ -625,7 +625,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if ( GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
}
@@ -647,11 +647,11 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) if (m_ThreadInfo) {
m_ThreadInfo->send(
- XmlNodeIq( AddIQ(&CJabberProto::OnIqResultEntityTime, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_HCONTACT))
- << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME));
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResultEntityTime, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_HCONTACT))
+ << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME));
// XEP-0012, last logoff time
- XmlNodeIq iq2( AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_FROM));
+ XmlNodeIq iq2(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, jid, JABBER_IQ_PARSE_FROM));
iq2 << XQUERY(JABBER_FEAT_LAST_ACTIVITY);
m_ThreadInfo->send(iq2);
@@ -671,8 +671,8 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) pDelimiter = NULL;
}
JABBER_LIST_ITEM *tmpItem = NULL;
- if (pDelimiter && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
- pResourceStatus him( tmpItem->findResource(pDelimiter));
+ if (pDelimiter && (tmpItem = ListGetItemPtr(LIST_CHATROOM, szBareJid))) {
+ pResourceStatus him(tmpItem->findResource(pDelimiter));
if (him) {
item = ListAdd(LIST_VCARD_TEMP, jid);
ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
@@ -689,25 +689,25 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) JabberStripJid(jid, szp1, SIZEOF(szp1));
mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szp1, r->m_tszResourceName);
- XmlNodeIq iq3( AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM));
+ XmlNodeIq iq3(AddIQ(&CJabberProto::OnIqResultLastActivity, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM));
iq3 << XQUERY(JABBER_FEAT_LAST_ACTIVITY);
m_ThreadInfo->send(iq3);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
- XmlNodeIq iq5( AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
+ XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
iq5 << XQUERY(JABBER_FEAT_DISCO_INFO);
m_ThreadInfo->send(iq5);
}
if (r->m_dwVersionRequestTime == 0) {
- XmlNodeIq iq4( AddIQ(&CJabberProto::OnIqResultVersion, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_HCONTACT | JABBER_IQ_PARSE_CHILD_TAG_NODE));
+ XmlNodeIq iq4(AddIQ(&CJabberProto::OnIqResultVersion, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_HCONTACT | JABBER_IQ_PARSE_CHILD_TAG_NODE));
iq4 << XQUERY(JABBER_FEAT_VERSION);
m_ThreadInfo->send(iq4);
}
}
}
else if (item->getTemp()->m_dwVersionRequestTime == 0) {
- XmlNodeIq iq4( AddIQ(&CJabberProto::OnIqResultVersion, JABBER_IQ_TYPE_GET, item->jid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_HCONTACT | JABBER_IQ_PARSE_CHILD_TAG_NODE));
+ XmlNodeIq iq4(AddIQ(&CJabberProto::OnIqResultVersion, JABBER_IQ_TYPE_GET, item->jid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_HCONTACT | JABBER_IQ_PARSE_CHILD_TAG_NODE));
iq4 << XQUERY(JABBER_FEAT_VERSION);
m_ThreadInfo->send(iq4);
}
@@ -752,7 +752,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) debugLogA("JabberBasicSearch called with lParam = '%s'", szJid);
JABBER_SEARCH_BASIC *jsb;
- if (!m_bJabberOnline || (jsb=(JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
+ if (!m_bJabberOnline || (jsb = (JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
return 0;
if (_tcschr(szJid, '@') == NULL) {
@@ -792,11 +792,11 @@ HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email) if (!m_bJabberOnline || email == NULL)
return 0;
- ptrA szServerName( getStringA("Jud"));
+ ptrA szServerName(getStringA("Jud"));
LPCSTR jid = szServerName == 0 ? "users.jabber.org" : szServerName;
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultSetSearch, JABBER_IQ_TYPE_SET, _A2T(jid));
- m_ThreadInfo->send( XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search")) << XCHILD(_T("email"), email));
+ m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(_T("jabber:iq:search")) << XCHILD(_T("email"), email));
return (HANDLE)pInfo->GetIqId();
}
@@ -810,13 +810,13 @@ HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstN BOOL bIsExtFormat = m_options.ExtendedSearch;
- ptrA szServerName( getStringA("Jud"));
+ ptrA szServerName(getStringA("Jud"));
CJabberIqInfo *pInfo = AddIQ(
(bIsExtFormat) ? &CJabberProto::OnIqResultExtSearch : &CJabberProto::OnIqResultSetSearch,
JABBER_IQ_TYPE_SET, _A2T(szServerName == 0 ? "users.jabber.org" : szServerName));
XmlNodeIq iq(pInfo);
- HXML query = iq << XQUERY( _T("jabber:iq:search"));
+ HXML query = iq << XQUERY(_T("jabber:iq:search"));
if (bIsExtFormat) {
if (m_tszSelectedLang)
@@ -868,7 +868,7 @@ int __cdecl CJabberProto::RecvFile(MCONTACT hContact, PROTORECVFILET *evt) int __cdecl CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
{
- ptrA szResUtf( mir_utf8encodeT((LPCTSTR)evt->lParam));
+ ptrA szResUtf(mir_utf8encodeT((LPCTSTR)evt->lParam));
evt->pCustomData = szResUtf;
evt->cbCustomDataSize = lstrlenA(szResUtf);
Proto_RecvMessage(hContact, evt);
@@ -902,13 +902,13 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int flags, int nContac XmlNode m(_T("message"));
HXML x = m << XCHILDNS(_T("x"), JABBER_FEAT_ROSTER_EXCHANGE);
- for (int i=0; i < nContacts; i++) {
- ptrT jid( getTStringA(hContactsList[i], "jid"));
+ for (int i = 0; i < nContacts; i++) {
+ ptrT jid(getTStringA(hContactsList[i], "jid"));
if (jid != NULL)
x << XCHILD(_T("item")) << XATTR(_T("action"), _T("add")) << XATTR(_T("jid"), jid);
}
- m << XATTR(_T("to"), szClientJid) << XATTRID( SerialNext());
+ m << XATTR(_T("to"), szClientJid) << XATTRID(SerialNext());
m_ThreadInfo->send(m);
return 1;
}
@@ -923,7 +923,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return 0;
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -959,20 +959,19 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript // caps not already received
|| (jcb == JABBER_RESOURCE_CAPS_NONE)
// XEP-0096 and OOB not supported?
- || !(jcb & (JABBER_CAPS_SI_FT | JABBER_CAPS_OOB)))
- {
+ || !(jcb & (JABBER_CAPS_SI_FT | JABBER_CAPS_OOB))) {
MsgPopup(hContact, TranslateT("No compatible file transfer machanism exist"), item->jid);
return 0;
}
filetransfer *ft = new filetransfer(this);
ft->std.hContact = hContact;
- while(ppszFiles[ ft->std.totalFiles ] != NULL)
+ while (ppszFiles[ft->std.totalFiles] != NULL)
ft->std.totalFiles++;
- ft->std.ptszFiles = (TCHAR**) mir_calloc(sizeof(TCHAR*)* ft->std.totalFiles);
- ft->fileSize = (unsigned __int64*) mir_calloc(sizeof(unsigned __int64) * ft->std.totalFiles);
- for (i=j=0; i < ft->std.totalFiles; i++) {
+ ft->std.ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)* ft->std.totalFiles);
+ ft->fileSize = (unsigned __int64*)mir_calloc(sizeof(unsigned __int64)* ft->std.totalFiles);
+ for (i = j = 0; i < ft->std.totalFiles; i++) {
if (_tstati64(ppszFiles[i], &statbuf))
debugLogA("'%s' is an invalid filename", ppszFiles[i]);
else {
@@ -980,7 +979,8 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript ft->fileSize[j] = statbuf.st_size;
j++;
ft->std.totalBytes += statbuf.st_size;
- } }
+ }
+ }
if (j == 0) {
delete ft;
return NULL;
@@ -1004,7 +1004,8 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript struct TFakeAckParams
{
inline TFakeAckParams(MCONTACT _hContact, const char* _msg, int _msgid = 0)
- : hContact(_hContact), msg(_msg), msgid(_msgid) {}
+ : hContact(_hContact), msg(_msg), msgid(_msgid)
+ {}
MCONTACT hContact;
const char *msg;
@@ -1017,8 +1018,8 @@ void __cdecl CJabberProto::SendMessageAckThread(void* param) Sleep(100);
debugLogA("Broadcast ACK");
ProtoBroadcastAck(par->hContact, ACKTYPE_MESSAGE,
- par->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
- (HANDLE)par->msgid, (LPARAM) par->msg);
+ par->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
+ (HANDLE)par->msgid, (LPARAM)par->msg);
debugLogA("Returning from thread");
delete par;
}
@@ -1043,7 +1044,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int flags, const char* pszS char* tempstring = (char*)alloca(strlen(pszSrc) + 1);
size_t nStrippedLength = strlen(pszSrc) - strlen(PGP_PROLOG) - (szEnd ? strlen(szEnd) : 0);
strncpy(tempstring, pszSrc + strlen(PGP_PROLOG), nStrippedLength);
- tempstring[ nStrippedLength ] = 0;
+ tempstring[nStrippedLength] = 0;
pszSrc = tempstring;
isEncrypted = 1;
flags &= ~PREF_UNICODE;
@@ -1053,7 +1054,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int flags, const char* pszS if (flags & PREF_UTF)
mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &msg);
else if (flags & PREF_UNICODE)
- msg = mir_u2t((wchar_t*)&pszSrc[ strlen(pszSrc)+1 ]);
+ msg = mir_u2t((wchar_t*)&pszSrc[strlen(pszSrc) + 1]);
else
msg = mir_a2t(pszSrc);
@@ -1075,7 +1076,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int flags, const char* pszS }
mir_free(msg);
- pResourceStatus r( ResourceInfoFromJID(szClientJid));
+ pResourceStatus r(ResourceInfoFromJID(szClientJid));
if (r)
r->m_bMessageSessionActive = TRUE;
@@ -1095,8 +1096,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int flags, const char* pszS // if message sent to groupchat
!lstrcmp(msgType, _T("groupchat")) ||
// if message delivery check disabled in settings
- !m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE))
- {
+ !m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE)) {
if (!lstrcmp(msgType, _T("groupchat")))
xmlAddAttr(m, _T("to"), szClientJid);
else {
@@ -1147,7 +1147,7 @@ int __cdecl CJabberProto::SetApparentMode(MCONTACT hContact, int mode) if (!m_bJabberOnline)
return 0;
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -1185,7 +1185,7 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus) debugLogA("PS_SETSTATUS(%d)", iNewStatus);
m_iDesiredStatus = iNewStatus;
- if (iNewStatus == ID_STATUS_OFFLINE) {
+ if (iNewStatus == ID_STATUS_OFFLINE) {
if (m_ThreadInfo) {
m_ThreadInfo->send("</stream:stream>");
m_ThreadInfo->shutdown();
@@ -1218,7 +1218,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) {
MCONTACT hContact = (MCONTACT)param;
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid != NULL) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
@@ -1226,7 +1226,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) debugLogA("arResources.getCount() > 0");
int msgCount = 0;
size_t len = 0;
- for (int i=0; i < item->arResources.getCount(); i++) {
+ for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
msgCount++;
@@ -1234,9 +1234,9 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) }
}
- TCHAR *str = (TCHAR*)alloca(sizeof(TCHAR)*(len+1));
+ TCHAR *str = (TCHAR*)alloca(sizeof(TCHAR)*(len + 1));
str[0] = str[len] = '\0';
- for (int i=0; i < item->arResources.getCount(); i++) {
+ for (int i = 0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = item->arResources[i];
if (r->m_tszStatusMessage) {
if (str[0] != '\0') _tcscat(str, _T("\r\n"));
@@ -1432,7 +1432,7 @@ void CJabberProto::InfoFrame_OnTransport(CJabberInfoFrame_Event *evt) int __cdecl CJabberProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
{
- switch(eventType) {
+ switch (eventType) {
case EV_PROTO_ONLOAD: return OnModulesLoadedEx(0, 0);
case EV_PROTO_ONEXIT: return OnPreShutdown(0, 0);
case EV_PROTO_ONOPTIONS: return OnOptionsInit(wParam, lParam);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 1eb7a05e0a..6bb48491c3 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1282,8 +1282,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) if (xmlGetChild(xNode, "delivered") != NULL || xmlGetChild(xNode, "offline") != NULL) {
int id = -1;
if (idNode != NULL && xmlGetText(idNode) != NULL)
- if (!_tcsncmp(xmlGetText(idNode), _T(JABBER_IQID), strlen(JABBER_IQID)))
- id = _ttoi((xmlGetText(idNode)) + strlen(JABBER_IQID));
+ if (!_tcsncmp(xmlGetText(idNode), _T(JABBER_IQID), strlen(JABBER_IQID)))
+ id = _ttoi((xmlGetText(idNode)) + strlen(JABBER_IQID));
if (id != -1)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0);
@@ -1860,12 +1860,15 @@ void CJabberProto::OnProcessIq(HXML node) // RECVED: <iq type='error'> ...
if (!_tcscmp(type, _T("error"))) {
+ TCHAR tszBuf[20];
+ _itot(id, tszBuf, 10);
+
debugLogA("XXX on entry");
// Check for file transfer deny by comparing idStr with ft->iqId
LISTFOREACH(i, this, LIST_FILE)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
- if (item->ft != NULL && item->ft->state == FT_CONNECTING && id == item->ft->iqId) {
+ if (item->ft != NULL && item->ft->state == FT_CONNECTING && !lstrcmp(tszBuf, item->ft->szId)) {
debugLogA("Denying file sending request");
item->ft->state = FT_DENIED;
if (item->ft->hFileEvent != NULL)
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index a93186ee14..60a575f011 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -714,14 +714,19 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) int __stdcall JabberGetPacketID(HXML n)
{
- int result = -1;
-
const TCHAR *str = xmlGetAttrValue(n, _T("id"));
if (str)
if (!_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID)-1))
- result = _ttoi(str + SIZEOF(JABBER_IQID)-1);
+ return _ttoi(str + SIZEOF(JABBER_IQID)-1);
- return result;
+ return -1;
+}
+
+TCHAR* __stdcall JabberId2string(int id)
+{
+ TCHAR text[100];
+ mir_sntprintf(text, SIZEOF(text), _T(JABBER_IQID) _T("%d"), id);
+ return mir_tstrdup(text);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 8596609b47..33dc3eba4a 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -153,8 +153,8 @@ void __fastcall xmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) void __fastcall xmlAddAttrID(HXML hXml, int id)
{
- TCHAR text[ 100 ];
- mir_sntprintf(text, SIZEOF(text), _T("mir_%d"), id);
+ TCHAR text[100];
+ mir_sntprintf(text, SIZEOF(text), _T(JABBER_IQID) _T("%d"), id);
xmlAddAttr(hXml, _T("id"), text);
}
|