diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-31 11:46:05 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-31 11:46:05 +0000 |
commit | 1ce3da1cca093143d9629bc46e221dd8be962e12 (patch) | |
tree | b99d12d635a65f8c78499137137df2bd591b50be /protocols/IcqOscarJ/src | |
parent | 03512ff2ed0f3d1ed6857ee85b0eb7268931ec3f (diff) |
- MAllStrings: a handy union to hold an incoming string parameter of any type;
- FNAMECHAR: atavism extincted;
- PROTOSEARCHRESULT: structure prepared to use results of any type, including utf
git-svn-id: http://svn.miranda-ng.org/main/trunk@13932 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src')
-rw-r--r-- | protocols/IcqOscarJ/src/fam_04message.cpp | 24 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_0alookup.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_15icqserver.cpp | 38 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.cpp | 20 |
4 files changed, 46 insertions, 46 deletions
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index 5ceaf78eae..9715065269 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -950,8 +950,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c contacts[iContact] = (ICQSEARCHRESULT*)SAFE_MALLOC(sizeof(ICQSEARCHRESULT));
contacts[iContact]->hdr.cbSize = sizeof(ICQSEARCHRESULT);
contacts[iContact]->hdr.flags = PSR_TCHAR;
- contacts[iContact]->hdr.nick = null_strdup(_T(""));
- contacts[iContact]->hdr.id = ansi_to_tchar(szUid);
+ contacts[iContact]->hdr.nick.t = null_strdup(_T(""));
+ contacts[iContact]->hdr.id.t = ansi_to_tchar(szUid);
if (IsStringUIN(szUid)) { // icq contact
contacts[iContact]->uin = atoi(szUid);
@@ -978,8 +978,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c debugLogA("Malformed '%s' message", "contacts");
disposeChain(&chain);
for (int i = 0; i < iContact; i++) {
- SAFE_FREE(&contacts[i]->hdr.id);
- SAFE_FREE(&contacts[i]->hdr.nick);
+ SAFE_FREE(&contacts[i]->hdr.id.t);
+ SAFE_FREE(&contacts[i]->hdr.nick.t);
SAFE_FREE((void**)&contacts[i]);
}
SAFE_FREE((void**)&contacts);
@@ -1017,8 +1017,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c unpackTypedTLV(pBuffer, wNickLen, 0x01, &wNickTLV, &wNickTLVLen, (LPBYTE*)&pNick);
if (wNickTLV == 0x01) {
- SAFE_FREE(&contacts[iContact]->hdr.nick);
- contacts[iContact]->hdr.nick = utf8_to_tchar(pNick);
+ SAFE_FREE(&contacts[iContact]->hdr.nick.t);
+ contacts[iContact]->hdr.nick.t = utf8_to_tchar(pNick);
}
else
SAFE_FREE(&pNick);
@@ -1053,8 +1053,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, c }
for (int i = 0; i < iContact; i++) {
- SAFE_FREE(&contacts[i]->hdr.id);
- SAFE_FREE(&contacts[i]->hdr.nick);
+ SAFE_FREE(&contacts[i]->hdr.id.t);
+ SAFE_FREE(&contacts[i]->hdr.nick.t);
SAFE_FREE((void**)&contacts[i]);
}
SAFE_FREE((void**)&contacts);
@@ -1694,8 +1694,8 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if (!mir_strlen(pszMsgField[1 + i * 2]))
valid = 0;
}
- isrList[i]->hdr.id = ansi_to_tchar(pszMsgField[1 + i * 2]);
- isrList[i]->hdr.nick = ansi_to_tchar(pszMsgField[2 + i * 2]);
+ isrList[i]->hdr.id.t = ansi_to_tchar(pszMsgField[1 + i * 2]);
+ isrList[i]->hdr.nick.t = ansi_to_tchar(pszMsgField[2 + i * 2]);
}
if (!valid)
@@ -1712,8 +1712,8 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, }
for (int i = 0; i < nContacts; i++) {
- SAFE_FREE(&isrList[i]->hdr.id);
- SAFE_FREE(&isrList[i]->hdr.nick);
+ SAFE_FREE(&isrList[i]->hdr.id.t);
+ SAFE_FREE(&isrList[i]->hdr.nick.t);
SAFE_FREE((void**)&isrList[i]);
}
}
diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index 44b529486b..49a18401a1 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -93,26 +93,26 @@ void CIcqProto::handleLookupEmailReply(BYTE* buf, size_t wLen, DWORD dwCookie) sr.hdr.cbSize = sizeof(sr);
sr.hdr.flags = PSR_TCHAR;
- sr.hdr.email = ansi_to_tchar(pCookie->szObject);
+ sr.hdr.email.t = ansi_to_tchar(pCookie->szObject);
// Syntax check, read chain
if (wLen >= 4 && (pChain = readIntoTLVChain(&buf, wLen, 0))) {
for (WORD i = 1; TRUE; i++) { // collect the results
char *szUid = pChain->getString(0x01, i);
if (!szUid) break;
- sr.hdr.id = ansi_to_tchar(szUid);
- sr.hdr.nick = sr.hdr.id;
+ sr.hdr.id.t = ansi_to_tchar(szUid);
+ sr.hdr.nick.t = sr.hdr.id.t;
// broadcast the result
if (pCookie->dwMainId)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)pCookie->dwMainId, (LPARAM)&sr);
else
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)dwCookie, (LPARAM)&sr);
- SAFE_FREE(&sr.hdr.id);
+ SAFE_FREE(&sr.hdr.id.t);
SAFE_FREE(&szUid);
}
disposeChain(&pChain);
}
- SAFE_FREE(&sr.hdr.email);
+ SAFE_FREE(&sr.hdr.email.t);
ReleaseLookupCookie(dwCookie, pCookie);
}
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index dfb2f43602..0ca11c39e7 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -340,7 +340,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO wPacketLen -= 4;
sr.uin = dwUin;
_itoa(dwUin, szUin, 10);
- sr.hdr.id = (FNAMECHAR*)szUin;
+ sr.hdr.id.t = (TCHAR*)szUin;
// Nick
if (wPacketLen < 2)
@@ -350,11 +350,11 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.nick = (FNAMECHAR*)databuf;
+ sr.hdr.nick.t = (TCHAR*)databuf;
databuf += wLen;
}
else {
- sr.hdr.nick = NULL;
+ sr.hdr.nick.t = NULL;
}
// First name
@@ -365,10 +365,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.firstName = (FNAMECHAR*)databuf;
+ sr.hdr.firstName.t = (TCHAR*)databuf;
databuf += wLen;
}
- else sr.hdr.firstName = NULL;
+ else sr.hdr.firstName.t = NULL;
// Last name
if (wPacketLen < 2)
@@ -378,10 +378,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.lastName = (FNAMECHAR*)databuf;
+ sr.hdr.lastName.t = (TCHAR*)databuf;
databuf += wLen;
}
- else sr.hdr.lastName = NULL;
+ else sr.hdr.lastName.t = NULL;
// E-mail name
if (wPacketLen < 2)
@@ -391,10 +391,10 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO if (wLen > 0) {
if (wPacketLen < wLen || (databuf[wLen - 1] != 0))
break;
- sr.hdr.email = (FNAMECHAR*)databuf;
+ sr.hdr.email.t = (TCHAR*)databuf;
databuf += wLen;
}
- else sr.hdr.email = NULL;
+ else sr.hdr.email.t = NULL;
// Authentication needed flag
if (wPacketLen < 1)
@@ -933,7 +933,7 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook ICQSEARCHRESULT isr = { 0 };
isr.hdr.cbSize = sizeof(ICQSEARCHRESULT);
isr.hdr.flags = PSR_TCHAR;
- isr.hdr.id = ansi_to_tchar(szUid);
+ isr.hdr.id.t = ansi_to_tchar(szUid);
if (IsStringUIN(szUid))
isr.uin = atoi(szUid);
@@ -950,22 +950,22 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook else
szData = cDetails->getString(0x55, 1); // Pending e-mail
if (mir_strlen(szData))
- isr.hdr.email = ansi_to_tchar(szData);
+ isr.hdr.email.t = ansi_to_tchar(szData);
SAFE_FREE(&szData);
szData = cDetails->getString(0x64, 1); // First Name
if (mir_strlen(szData))
- isr.hdr.firstName = utf8_to_tchar(szData);
+ isr.hdr.firstName.t = utf8_to_tchar(szData);
SAFE_FREE(&szData);
szData = cDetails->getString(0x6E, 1); // Last Name
if (mir_strlen(szData))
- isr.hdr.lastName = utf8_to_tchar(szData);
+ isr.hdr.lastName.t = utf8_to_tchar(szData);
SAFE_FREE(&szData);
szData = cDetails->getString(0x78, 1); // Nick
if (mir_strlen(szData))
- isr.hdr.nick = utf8_to_tchar(szData);
+ isr.hdr.nick.t = utf8_to_tchar(szData);
SAFE_FREE(&szData);
switch (cDetails->getNumber(0x82, 1)) // Gender
@@ -997,11 +997,11 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)dwCookie, (LPARAM)&isr);
// Release memory
- SAFE_FREE(&isr.hdr.id);
- SAFE_FREE(&isr.hdr.nick);
- SAFE_FREE(&isr.hdr.firstName);
- SAFE_FREE(&isr.hdr.lastName);
- SAFE_FREE(&isr.hdr.email);
+ SAFE_FREE(&isr.hdr.id.t);
+ SAFE_FREE(&isr.hdr.nick.t);
+ SAFE_FREE(&isr.hdr.firstName.t);
+ SAFE_FREE(&isr.hdr.lastName.t);
+ SAFE_FREE(&isr.hdr.email.t);
// Search is over, broadcast final ack
if (wReplySubType == META_DIRECTORY_RESPONSE)
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 93ad99c91e..6a8ec15019 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -293,17 +293,17 @@ MCONTACT CIcqProto::AddToList(int flags, PROTOSEARCHRESULT *psr) // aim contact
if (isr->hdr.flags & PSR_UNICODE)
- unicode_to_ansi_static((WCHAR*)isr->hdr.id, szUid, MAX_PATH);
+ unicode_to_ansi_static((WCHAR*)isr->hdr.id.t, szUid, MAX_PATH);
else
- null_strcpy(szUid, (char*)isr->hdr.id, MAX_PATH);
+ null_strcpy(szUid, (char*)isr->hdr.id.t, MAX_PATH);
return (szUid[0] == 0) ? 0 : AddToListByUID(szUid, flags);
}
if (psr->flags & PSR_UNICODE)
- unicode_to_ansi_static((WCHAR*)psr->id, szUid, MAX_PATH);
+ unicode_to_ansi_static((WCHAR*)psr->id.t, szUid, MAX_PATH);
else
- null_strcpy(szUid, (char*)psr->id, MAX_PATH);
+ null_strcpy(szUid, (char*)psr->id.t, MAX_PATH);
if (szUid[0] == 0)
return 0;
@@ -719,10 +719,10 @@ void CIcqProto::CheekySearchThread(void*) if (cheekySearchUin) {
_itoa(cheekySearchUin, szUin, 10);
- isr.hdr.id = (FNAMECHAR*)szUin;
+ isr.hdr.id.t = (TCHAR*)szUin;
}
else {
- isr.hdr.id = (FNAMECHAR*)cheekySearchUid;
+ isr.hdr.id.t = (TCHAR*)cheekySearchUid;
}
isr.uin = cheekySearchUin;
@@ -872,15 +872,15 @@ int __cdecl CIcqProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) DWORD flags = DBEF_UTF;
for (i = 0; i < pre->lParam; i++) {
- cbBlob += mir_strlen((char*)isrList[i]->hdr.nick) + 2; // both trailing zeros
+ cbBlob += mir_strlen((char*)isrList[i]->hdr.nick.t) + 2; // both trailing zeros
if (isrList[i]->uin)
cbBlob += getUINLen(isrList[i]->uin);
else
- cbBlob += mir_strlen((char*)isrList[i]->hdr.id);
+ cbBlob += mir_strlen((char*)isrList[i]->hdr.id.t);
}
PBYTE pBlob = (PBYTE)_alloca(cbBlob), pCurBlob;
for (i = 0, pCurBlob = pBlob; i < pre->lParam; i++) {
- mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.nick);
+ mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.nick.t);
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
if (isrList[i]->uin) {
char szUin[UINMAXLEN];
@@ -888,7 +888,7 @@ int __cdecl CIcqProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre) mir_strcpy((char*)pCurBlob, szUin);
}
else // aim contact
- mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.id);
+ mir_strcpy((char*)pCurBlob, (char*)isrList[i]->hdr.id.t);
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
}
|