summaryrefslogtreecommitdiff
path: root/protocols/MSN
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-31 11:46:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-31 11:46:05 +0000
commit1ce3da1cca093143d9629bc46e221dd8be962e12 (patch)
treeb99d12d635a65f8c78499137137df2bd591b50be /protocols/MSN
parent03512ff2ed0f3d1ed6857ee85b0eb7268931ec3f (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/MSN')
-rw-r--r--protocols/MSN/src/msn_commands.cpp39
-rw-r--r--protocols/MSN/src/msn_links.cpp4
-rw-r--r--protocols/MSN/src/msn_proto.cpp31
3 files changed, 36 insertions, 38 deletions
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 7401d5f7d4..ddbf398deb 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -226,10 +226,10 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
if (!mir_strcmp(xmli->name, "contacts")) {
ezxml_t c;
int cnt;
- PROTOSEARCHRESULT **isr;
+ PROTOSEARCHRESULT **psr;
for (c = ezxml_child(xmli, "c"), cnt=0; c; c = c->next) cnt++;
- if (isr = (PROTOSEARCHRESULT**)mir_calloc(sizeof(PROTOSEARCHRESULT*) * cnt)) {
+ if (psr = (PROTOSEARCHRESULT**)mir_calloc(sizeof(PROTOSEARCHRESULT*) * cnt)) {
cnt=0;
for (c = ezxml_child(xmli, "c"); c; c = c->next) {
const char *t = ezxml_attr(c, "t"), *wlid;
@@ -238,10 +238,10 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
{
case 's':
case 'p':
- isr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
- isr[cnt]->cbSize = sizeof(isr);
- isr[cnt]->flags = PSR_TCHAR;
- isr[cnt]->id = isr[cnt]->nick = isr[cnt]->email = mir_a2t(wlid);
+ psr[cnt] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
+ psr[cnt]->cbSize = sizeof(psr);
+ psr[cnt]->flags = PSR_TCHAR;
+ psr[cnt]->id.t = psr[cnt]->nick.t = psr[cnt]->email.t = mir_a2t(wlid);
cnt++;
}
}
@@ -249,15 +249,15 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
if (cnt) {
PROTORECVEVENT pre = { 0 };
pre.timestamp = (DWORD)time(NULL);
- pre.szMessage = (char *)isr;
+ pre.szMessage = (char *)psr;
pre.lParam = cnt;
ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
for (cnt=0; cnt<pre.lParam; cnt++) {
- mir_free(isr[cnt]->email);
- mir_free(isr[cnt]);
+ mir_free(psr[cnt]->email.t);
+ mir_free(psr[cnt]);
}
}
- mir_free(isr);
+ mir_free(psr);
}
}
ezxml_free(xmli);
@@ -527,16 +527,15 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len)
const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
if (szNetId != NULL) {
- TCHAR* szEmailT = mir_utf8decodeT(szEmail);
- PROTOSEARCHRESULT isr = { 0 };
- isr.cbSize = sizeof(isr);
- isr.flags = PSR_TCHAR;
- isr.id = szEmailT;
- isr.nick = szEmailT;
- isr.email = szEmailT;
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, msnSearchId, (LPARAM)&isr);
- mir_free(szEmailT);
+ ptrT szEmailT(mir_utf8decodeT(szEmail));
+
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.id.t = szEmailT;
+ psr.nick.t = szEmailT;
+ psr.email.t = szEmailT;
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, msnSearchId, (LPARAM)&psr);
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, msnSearchId, 0);
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp
index 8c735d050c..066b8795ca 100644
--- a/protocols/MSN/src/msn_links.cpp
+++ b/protocols/MSN/src/msn_links.cpp
@@ -96,8 +96,8 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam)
if (hContact == NULL) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = email;
- psr.email = email;
+ psr.nick.t = email;
+ psr.email.t = email;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index cc8cf98566..8fd47fa748 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -252,10 +252,10 @@ MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD
MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- TCHAR *id = psr->id ? psr->id : psr->email;
+ TCHAR *id = psr->id.t ? psr->id.t : psr->email.t;
return AddToListByEmail(
psr->flags & PSR_UNICODE ? UTF8((wchar_t*)id) : UTF8((char*)id),
- psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick) : UTF8((char*)psr->nick),
+ psr->flags & PSR_UNICODE ? UTF8((wchar_t*)psr->nick.t) : UTF8((char*)psr->nick.t),
flags);
}
@@ -411,18 +411,17 @@ void __cdecl CMsnProto::MsnSearchAckThread(void* arg)
case 0:
case 2:
case 3:
- {
- PROTOSEARCHRESULT isr = { 0 };
- isr.cbSize = sizeof(isr);
- isr.flags = PSR_TCHAR;
- isr.id = (TCHAR*)emailT;
- isr.nick = (TCHAR*)emailT;
- isr.email = (TCHAR*)emailT;
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&isr);
+ {
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.id.t = (TCHAR*)emailT;
+ psr.nick.t = (TCHAR*)emailT;
+ psr.email.t = (TCHAR*)emailT;
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&psr);
+ }
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
- }
- break;
+ break;
case 1:
if (strstr(email, "@yahoo.com") == NULL)
@@ -826,12 +825,12 @@ int CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT* pre)
int i;
for (i = 0; i < pre->lParam; i++)
- dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick) + 2 + mir_tstrlen(isrList[i]->id));
+ dbei.cbBlob += int(mir_tstrlen(isrList[i]->nick.t) + 2 + mir_tstrlen(isrList[i]->id.t));
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob);
for (i = 0, pCurBlob = dbei.pBlob; i < pre->lParam; i++) {
- mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick));
+ mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->nick.t));
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
- mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id));
+ mir_strcpy((char*)pCurBlob, _T2A(isrList[i]->id.t));
pCurBlob += mir_strlen((char*)pCurBlob) + 1;
}