diff options
Diffstat (limited to 'protocols/JabberG/src')
| -rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 19 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 5 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 2 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 6 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 36 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_proxy.cpp | 158 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_proxy.h | 30 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 4 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 2 | ||||
| -rw-r--r-- | protocols/JabberG/src/jabber_ws.cpp | 10 | 
10 files changed, 33 insertions, 239 deletions
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index d88ef968c6..7af86a90a7 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -467,20 +467,19 @@ filetransfer::~filetransfer()  	if (hWaitEvent != INVALID_HANDLE_VALUE)
  		CloseHandle(hWaitEvent);
 -	if (jid) mir_free(jid);
 -	if (sid) mir_free(sid);
 -	if (fileSize) mir_free(fileSize);
 -	if (httpHostName) mir_free(httpHostName);
 -	if (httpPath) mir_free(httpPath);
 -	if (szDescription) mir_free(szDescription);
 +	mir_free(jid);
 +	mir_free(sid);
 +	mir_free(fileSize);
 +	mir_free(httpHostName);
 +	mir_free(httpPath);
 +	mir_free(szDescription);
 -	if (std.tszWorkingDir) mir_free(std.tszWorkingDir);
 -	if (std.tszCurrentFile) mir_free(std.tszCurrentFile);
 +	mir_free(std.tszWorkingDir);
 +	mir_free(std.tszCurrentFile);
  	if (std.ptszFiles) {
  		for (int i=0; i < std.totalFiles; i++)
 -			if (std.ptszFiles[i]) mir_free(std.ptszFiles[i]);
 -
 +			mir_free(std.ptszFiles[i]);
  		mir_free(std.ptszFiles);
  }	}
 diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 7e14ae7c32..9d4c57674a 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -556,10 +556,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)  			break;
  		RoomInfo *info = (RoomInfo *)lpdis->itemData;
 -		if (info->line1) mir_free(info->line1);
 -		if (info->line2) mir_free(info->line2);
 +		mir_free(info->line1);
 +		mir_free(info->line2);
  		mir_free(info);
 -
  		break;
  	}
 diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 7addbc3138..070f0dca4b 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -91,7 +91,7 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInf  	}
  	// global fuckup
 -	if ( !m_ThreadInfo)
 +	if (m_ThreadInfo == NULL)
  		return;
  	// is our default delimiter?
 diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index e8d3901e6a..73548d9705 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1080,9 +1080,9 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*)  						db_free(&dbvtemp);
  					}
  					_RosterInsertListItem(hList, jid, name, group, NULL, FALSE);
 -					if (jid) mir_free(jid);
 -					if (name) mir_free(name);
 -					if (group) mir_free(group);
 +					mir_free(jid);
 +					mir_free(name);
 +					mir_free(group);
  				}
  				db_free(&dbv);
  			}
 diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index bb70bc2ecd..414d1df358 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -214,8 +214,7 @@ CJabberProto::~CJabberProto()  	for (i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
  		mir_free(m_lstJabberFeatCapPairsDynamic[i]->szExt);
  		mir_free(m_lstJabberFeatCapPairsDynamic[i]->szFeature);
 -		if (m_lstJabberFeatCapPairsDynamic[i]->szDescription)
 -			mir_free(m_lstJabberFeatCapPairsDynamic[i]->szDescription);
 +		mir_free(m_lstJabberFeatCapPairsDynamic[i]->szDescription);
  		delete m_lstJabberFeatCapPairsDynamic[i];
  	}
  	m_lstJabberFeatCapPairsDynamic.destroy();
 @@ -353,7 +352,7 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)  		setTString(hContact, "jid", jid);
  		if ((nick=JabberNickFromJID(newJid)) == NULL)
  			nick = mir_tstrdup(newJid);
 -//		setTString(hContact, "Nick", nick);
 +
  		mir_free(nick);
  		mir_free(jid);
 @@ -487,20 +486,19 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)  	DBEVENTINFO dbei = { sizeof(dbei) };
  	if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
  		return 1;
 -	if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
 +
 +	mir_ptr<BYTE> pBlob((PBYTE) mir_alloc(dbei.cbBlob));
 +	if ((dbei.pBlob = pBlob) == NULL)
  		return 1;
 -	if (db_event_get(hDbEvent, &dbei)) {
 -		mir_free(dbei.pBlob);
 +
 +	if (db_event_get(hDbEvent, &dbei))
  		return 1;
 -	}
 -	if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
 -		mir_free(dbei.pBlob);
 +
 +	if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
  		return 1;
 -	}
 -	if (strcmp(dbei.szModule, m_szModuleName)) {
 -		mir_free(dbei.pBlob);
 +
 +	if (strcmp(dbei.szModule, m_szModuleName))
  		return 1;
 -	}
  	char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
  	char *firstName = nick + strlen(nick) + 1;
 @@ -509,12 +507,8 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)  	Log("Send 'authorization denied' to %s", jid);
 -	TCHAR *newJid = dbei.flags & DBEF_UTF ? mir_utf8decodeT(jid) : mir_a2t(jid);
 -
 -	m_ThreadInfo->send(XmlNode(_T("presence")) << XATTR(_T("to"), newJid) << XATTR(_T("type"), _T("unsubscribed")));
 -
 -	mir_free(newJid);
 -	mir_free(dbei.pBlob);
 +	ptrT newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeT(jid) : mir_a2t(jid));
 +	m_ThreadInfo->send( XmlNode(_T("presence")) << XATTR(_T("to"), newJid) << XATTR(_T("type"), _T("unsubscribed")));
  	return 0;
  }
 @@ -1388,9 +1382,7 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg)  	}
  	else {
  		// Update with the new mode message
 -		if (*szMsg != NULL)
 -			mir_free(*szMsg);
 -		*szMsg = newModeMsg;
 +		replaceStrT(*szMsg, newModeMsg);
  		// Send a presence update if needed
  		lck.unlock();
  		if (status == m_iStatus)
 diff --git a/protocols/JabberG/src/jabber_proxy.cpp b/protocols/JabberG/src/jabber_proxy.cpp deleted file mode 100644 index 46c3163abb..0000000000 --- a/protocols/JabberG/src/jabber_proxy.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/*
 -
 -Jabber Protocol Plugin for Miranda IM
 -Copyright (C) 2002-04  Santithorn Bunchua
 -Copyright (C) 2005-12  George Hazan
 -Copyright (C) 2012-13  Miranda NG Project
 -
 -This program is free software; you can redistribute it and/or
 -modify it under the terms of the GNU General Public License
 -as published by the Free Software Foundation; either version 2
 -of the License, or (at your option) any later version.
 -
 -This program is distributed in the hope that it will be useful,
 -but WITHOUT ANY WARRANTY; without even the implied warranty of
 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 -GNU General Public License for more details.
 -
 -You should have received a copy of the GNU General Public License
 -along with this program; if not, write to the Free Software
 -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 -*/
 -
 -#include "jabber.h"
 -
 -int JabberHttpGatewayInit(HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NETLIBHTTPREQUEST* /*nlhr*/)
 -{
 -#ifdef NNNN
 -	WORD wLen, wVersion, wType;
 -	WORD wIpLen;
 -	DWORD dwSid1, dwSid2, dwSid3, dwSid4;
 -	BYTE response[300], *buf;
 -	int responseBytes, recvResult;
 -	char szSid[33], szHttpServer[256], szHttpGetUrl[300], szHttpPostUrl[300];
 -	NETLIBHTTPPROXYINFO nlhpi = {0};
 -
 -	for (responseBytes = 0; ;) {
 -		recvResult = Netlib_Recv(hConn, response + responseBytes, sizeof(response) - responseBytes, MSG_DUMPPROXY);
 -		if (recvResult<=0) break;
 -		responseBytes += recvResult;
 -		if (responseBytes == sizeof(response))
 -			break;
 -	}
 -	if (responseBytes < 31)
 -	{
 -		SetLastError(ERROR_INVALID_DATA);
 -		return 0;
 -	}
 -	buf = response;
 -	unpackWord(&buf, &wLen);
 -	unpackWord(&buf, &wVersion);	  /* always 0x0443 */
 -	unpackWord(&buf, &wType);
 -	buf += 6;  /* dunno */
 -	unpackDWord(&buf, &dwSid1);
 -	unpackDWord(&buf, &dwSid2);
 -	unpackDWord(&buf, &dwSid3);
 -	unpackDWord(&buf, &dwSid4);
 -	mir_snprintf(szSid, SIZEOF(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
 -	unpackWord(&buf, &wIpLen);
 -	if (responseBytes < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
 -	{
 -		SetLastError(ERROR_INVALID_DATA);
 -		return 0;
 -	}
 -	memcpy(szHttpServer, buf, wIpLen);
 -	szHttpServer[wIpLen] = '\0';
 -
 -	nlhpi.cbSize = sizeof(nlhpi);
 -	nlhpi.flags = NLHPIF_USEPOSTSEQUENCE;
 -	nlhpi.szHttpGetUrl = szHttpGetUrl;
 -	nlhpi.szHttpPostUrl = szHttpPostUrl;
 -	nlhpi.firstPostSequence = 1;
 -	mir_snprintf(szHttpGetUrl, SIZEOF(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
 -	mir_snprintf(szHttpPostUrl, SIZEOF(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
 -	return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
 -#endif
 -	return 1;
 -}
 -
 -int JabberHttpGatewayBegin(HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/)
 -{
 -	/*
 -	icq_packet packet;
 -	int serverNameLen;
 -
 -	serverNameLen = strlen(nloc->szHost);
 -
 -	packet.wLen = (WORD)(serverNameLen + 4);
 -	write_httphdr(&packet, HTTP_PACKETTYPE_LOGIN);
 -	packWord(&packet, (WORD)serverNameLen);
 -	packString(&packet, nloc->szHost, (WORD)serverNameLen);
 -	packWord(&packet, nloc->wPort);
 -	Netlib_Send(hConn, packet.pData, packet.wLen, MSG_DUMPPROXY|MSG_NOHTTPGATEWAYWRAP);
 -	mir_free(packet.pData);
 -	return 1;
 -	*/
 -	return 1;
 -}
 -
 -int JabberHttpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
 -{
 -	TCHAR *strb = mir_utf8decodeW((char*)buf);
 -
 -	TCHAR sid[25] = _T("");
 -	unsigned __int64 rid = 0;
 -
 -	XmlNode hPayLoad(strb);
 -	XmlNode body(_T("body"));
 -	HXML hBody = body << XATTRI64(_T("rid"), rid++) << XATTR(_T("sid"), sid) <<
 -		XATTR(_T("xmlns"), _T("http://jabber.org/protocol/httpbind"));
 -	xmlAddChild(hBody, hPayLoad);
 -
 -	TCHAR *str = xi.toString(hBody, NULL);
 -
 -	mir_free(strb);
 -	char* utfStr = mir_utf8encodeT(str);
 -	NETLIBBUFFER nlb = { utfStr, (int)strlen(utfStr), flags };
 -	int result = pfnNetlibSend((WPARAM)hConn, (LPARAM)&nlb);
 -	mir_free(utfStr);
 -	xi.freeMem(str);
 -
 -	return result;
 -}
 -
 -#if 0
 -PBYTE JabberHttpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void *, size_t))
 -{
 -	WORD wLen, wType;
 -	PBYTE tbuf;
 -	int i, copyBytes;
 -
 -	tbuf = buf;
 -	for (i=0;;)
 -	{
 -		if (tbuf - buf + 2 > len) break;
 -		unpackWord(&tbuf, &wLen);
 -		if (wLen < 12) break;
 -		if (tbuf - buf + wLen > len) break;
 -		tbuf += 2;	  /* version */
 -		unpackWord(&tbuf, &wType);
 -		tbuf += 8;   /* flags & subtype */
 -		if (wType == HTTP_PACKETTYPE_FLAP)
 -		{
 -			copyBytes = wLen - 12;
 -			if (copyBytes > len - i)
 -			{
 -				/* invalid data - do our best to get something out of it */
 -				copyBytes = len - i;
 -			}
 -			memcpy(buf + i, tbuf, copyBytes);
 -			i += copyBytes;
 -		}
 -		tbuf += wLen - 12;
 -	}
 -	*outBufLen = i;
 -	return buf;
 -}
 -#endif
 diff --git a/protocols/JabberG/src/jabber_proxy.h b/protocols/JabberG/src/jabber_proxy.h deleted file mode 100644 index 8f2b05646b..0000000000 --- a/protocols/JabberG/src/jabber_proxy.h +++ /dev/null @@ -1,30 +0,0 @@ -/*
 -
 -Jabber Protocol Plugin for Miranda IM
 -Copyright (C) 2002-04  Santithorn Bunchua
 -Copyright (C) 2005-12  George Hazan
 -Copyright (C) 2012-13  Miranda NG Project
 -
 -This program is free software; you can redistribute it and/or
 -modify it under the terms of the GNU General Public License
 -as published by the Free Software Foundation; either version 2
 -of the License, or (at your option) any later version.
 -
 -This program is distributed in the hope that it will be useful,
 -but WITHOUT ANY WARRANTY; without even the implied warranty of
 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 -GNU General Public License for more details.
 -
 -You should have received a copy of the GNU General Public License
 -along with this program; if not, write to the Free Software
 -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 -*/
 -
 -#ifndef _JABBER_PROXY_H_
 -#define _JABBER_PROXY_H_
 -
 -int JabberHttpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
 -int JabberHttpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION *nloc);
 -
 -#endif
 diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 7c826345e5..c0b990b17e 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -597,8 +597,8 @@ recvRest:  	Log("Thread ended: type=%d server='%s'", info->type, info->server);
 -	if (info->type==JABBER_SESSION_NORMAL && m_ThreadInfo==info) {
 -		if (m_szStreamId) mir_free(m_szStreamId);
 +	if (info->type == JABBER_SESSION_NORMAL && m_ThreadInfo == info) {
 +		mir_free(m_szStreamId);
  		m_szStreamId = NULL;
  		m_ThreadInfo = NULL;
  	}
 diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 84765938a2..9b56bf9c5b 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -1273,7 +1273,7 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime)  BOOL CJabberProto::IsMyOwnJID(LPCTSTR szJID)
  {
 -	if ( !m_ThreadInfo)
 +	if (m_ThreadInfo == NULL)
  		return FALSE;
  	TCHAR *szFrom = JabberPrepareJid(szJID);
 diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index f7519dd7e6..eecaeab5f9 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -30,19 +30,11 @@ BOOL CJabberProto::WsInit(void)  	TCHAR name[128];
  	mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
 -	NETLIBUSER nlu = {0};
 -	nlu.cbSize = sizeof(nlu);
 +	NETLIBUSER nlu = { sizeof(nlu) };
  	nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;	// | NUF_HTTPGATEWAY;
  	nlu.ptszDescriptiveName = name;
  	nlu.szSettingsModule = m_szModuleName;
 -	//nlu.szHttpGatewayHello = "http://http.proxy.icq.com/hello";
 -	//nlu.szHttpGatewayUserAgent = "Mozilla/4.08 [en] (WinNT; U ;Nav)";
 -	//nlu.pfnHttpGatewayInit = JabberHttpGatewayInit;
 -	//nlu.pfnHttpGatewayBegin = JabberHttpGatewayBegin;
 -	//nlu.pfnHttpGatewayWrapSend = JabberHttpGatewayWrapSend;
 -	//nlu.pfnHttpGatewayUnwrapRecv = JabberHttpGatewayUnwrapRecv;
  	m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
 -
  	return m_hNetlibUser != NULL;
  }
  | 
