summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
authorAlexander Gluzsky <sss123next@list.ru>2012-07-29 18:49:17 +0000
committerAlexander Gluzsky <sss123next@list.ru>2012-07-29 18:49:17 +0000
commit66357371399956ad19ab667d3c2d49bfc7ea0095 (patch)
tree51dfe6236911663542bc1acd4e106b3a736ca3ab /protocols/IcqOscarJ
parent6eb6a545a869d91578dfa31844783f1f062129d0 (diff)
ICQ: ported icq custom capabilities api from icq plus mod
NEW_GPG: many memmory corruption fixes NEW_GPG: improoved auto key exchange git-svn-id: http://svn.miranda-ng.org/main/trunk@1243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/fam_01service.cpp8
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/fam_02location.cpp18
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/icq_proto.cpp8
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/icq_proto.h4
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/icqosc_svcs.cpp35
-rwxr-xr-x[-rw-r--r--]protocols/IcqOscarJ/icqoscar.h5
6 files changed, 78 insertions, 0 deletions
diff --git a/protocols/IcqOscarJ/fam_01service.cpp b/protocols/IcqOscarJ/fam_01service.cpp
index cba344a195..58860481ca 100644..100755
--- a/protocols/IcqOscarJ/fam_01service.cpp
+++ b/protocols/IcqOscarJ/fam_01service.cpp
@@ -683,6 +683,8 @@ void CIcqProto::setUserInfo()
wAdditionalData += 16;
#endif
+ wAdditionalData += CustomCapList.size() * 16;
+
//MIM/PackName
bool bHasPackName = false;
DBVARIANT dbv;
@@ -771,6 +773,12 @@ void CIcqProto::setUserInfo()
ICQFreeVariant(&dbv);
}
+ if(!CustomCapList.empty())
+ {
+ for(std::list<ICQ_CUSTOMCAP*>::iterator it = CustomCapList.begin(), end = CustomCapList.end(); it != end; ++it)
+ packBuffer(&packet, (BYTE*)(*it)->caps, 0x10);
+ }
+
sendServPacket(&packet);
}
diff --git a/protocols/IcqOscarJ/fam_02location.cpp b/protocols/IcqOscarJ/fam_02location.cpp
index b7f0163917..2398cf18c6 100644..100755
--- a/protocols/IcqOscarJ/fam_02location.cpp
+++ b/protocols/IcqOscarJ/fam_02location.cpp
@@ -182,6 +182,24 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
char *szEncoding = NULL;
// Get Profile encoding TLV
+
+ pTLV = pChain->getTLV(0x05, 1);
+ if (pTLV && (pTLV->wLen > 0))
+ {
+ // store client capabilities
+ BYTE* capBuf = pTLV->pData;
+ WORD capLen = pTLV->wLen;
+ DBCONTACTWRITESETTING dbcws;
+ dbcws.value.type = DBVT_BLOB;
+ dbcws.value.cpbVal = capLen;
+ dbcws.value.pbVal = capBuf;
+ dbcws.szModule = m_szModuleName;
+ dbcws.szSetting = "CapBuf";
+ CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&dbcws);
+ }
+ else
+ deleteSetting(hContact, "CapBuf");
+
pTLV = pChain->getTLV(0x01, 1);
if (pTLV && (pTLV->wLen >= 1))
{
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp
index 69b8ed8e61..7df3c037d3 100644..100755
--- a/protocols/IcqOscarJ/icq_proto.cpp
+++ b/protocols/IcqOscarJ/icq_proto.cpp
@@ -126,6 +126,7 @@ cheekySearchId( -1 )
CreateResidentSetting("AwayTS");
CreateResidentSetting("LogonTS");
CreateResidentSetting("DCStatus");
+ CreateResidentSetting("CapBuf"); //capabilities bufer
CreateResidentSetting(DBSETTING_STATUS_NOTE_TIME);
CreateResidentSetting(DBSETTING_STATUS_MOOD);
@@ -164,6 +165,11 @@ cheekySearchId( -1 )
CreateProtoService(MS_REVOKE_AUTH, &CIcqProto::RevokeAuthorization);
CreateProtoService(MS_XSTATUS_SHOWDETAILS, &CIcqProto::ShowXStatusDetails);
+
+ // Custom caps
+ CreateProtoService(PS_ICQ_ADDCAPABILITY, &CIcqProto::IcqAddCapability);
+ CreateProtoService(PS_ICQ_CHECKCAPABILITY, &CIcqProto::IcqCheckCapability);
+
HookProtoEvent(ME_SKIN2_ICONSCHANGED, &CIcqProto::OnReloadIcons);
@@ -270,6 +276,8 @@ CIcqProto::~CIcqProto()
UninitContactsCache();
+ CustomCapList.clear();
+
SAFE_DELETE(&m_ratesMutex);
SAFE_DELETE(&servlistMutex);
diff --git a/protocols/IcqOscarJ/icq_proto.h b/protocols/IcqOscarJ/icq_proto.h
index 7293763d65..ec1eabb338 100644..100755
--- a/protocols/IcqOscarJ/icq_proto.h
+++ b/protocols/IcqOscarJ/icq_proto.h
@@ -805,6 +805,10 @@ struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject
HANDLE AddToListByUID(const char *szUID, DWORD dwFlags);
void ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre, DWORD cbBlob, PBYTE pBlob, DWORD flags);
+ INT_PTR __cdecl IcqAddCapability(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl IcqCheckCapability(WPARAM wParam, LPARAM lParam);
+
+ std::list<ICQ_CUSTOMCAP*> CustomCapList;
//----| icq_uploadui.cpp |------------------------------------------------------------
void ShowUploadContactsDialog(void);
diff --git a/protocols/IcqOscarJ/icqosc_svcs.cpp b/protocols/IcqOscarJ/icqosc_svcs.cpp
index 15a8b17013..ee6dd1731c 100644..100755
--- a/protocols/IcqOscarJ/icqosc_svcs.cpp
+++ b/protocols/IcqOscarJ/icqosc_svcs.cpp
@@ -727,6 +727,41 @@ void CIcqProto::ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre
AddEvent(hContact, wType, pre->timestamp, flags, cbBlob, pBlob);
}
+INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM wParam, LPARAM lParam)
+{
+ ICQ_CUSTOMCAP *icqCustomCapIn = (ICQ_CUSTOMCAP *)lParam;
+ ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)malloc(sizeof(ICQ_CUSTOMCAP));
+ memcpy(icqCustomCap, icqCustomCapIn, sizeof(ICQ_CUSTOMCAP));
+ CustomCapList.push_back(icqCustomCap);
+// MessageBoxA(NULL, ((ICQ_CUSTOMCAP *)(lstCustomCaps->items[lstCustomCaps->realCount-1]))->name, "custom cap", MB_OK);
+ return 0;
+}
+
+
+INT_PTR __cdecl CIcqProto::IcqCheckCapability(WPARAM wParam, LPARAM lParam)
+{
+ int res = 0;
+ DBCONTACTGETSETTING dbcgs;
+ DBVARIANT dbvariant;
+ HANDLE hContact = (HANDLE)wParam;
+ ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)lParam;
+ dbcgs.pValue = &dbvariant;
+ dbcgs.szModule = m_szModuleName;
+ dbcgs.szSetting = "CapBuf";
+
+ CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs);
+
+ if (dbvariant.type == DBVT_BLOB)
+ {
+ res = MatchCapability(dbvariant.pbVal, dbvariant.cpbVal, (const capstr*)&icqCustomCap->caps, 0x10)?1:0; // FIXME: Why icqCustomCap->caps is not capstr?
+ }
+
+ CallService(MS_DB_CONTACT_FREEVARIANT,0,(LPARAM)(DBVARIANT*)&dbvariant);
+
+ return res;
+}
+
+
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IcqOscarJ/icqoscar.h b/protocols/IcqOscarJ/icqoscar.h
index a004e6793f..ef0e32a6fd 100644..100755
--- a/protocols/IcqOscarJ/icqoscar.h
+++ b/protocols/IcqOscarJ/icqoscar.h
@@ -48,6 +48,10 @@
#include <direct.h>
#include <fcntl.h>
#include <process.h>
+
+//C++
+#include <list>
+
#ifndef _DEBUG
#ifdef _MSC_VER
#include <crtdbg.h>
@@ -115,6 +119,7 @@
#include "channels.h"
#include "families.h"
#include "m_icq.h"
+#include "m_icqplus.h"
#include "icq_advsearch.h"
#include "log.h"