From 1ce3da1cca093143d9629bc46e221dd8be962e12 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 31 May 2015 11:46:05 +0000 Subject: - 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 --- protocols/Tlen/src/tlen_iqid.cpp | 45 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'protocols/Tlen/src/tlen_iqid.cpp') diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 95f9e4d745..fc8f9f26ac 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -424,64 +424,55 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", jid, dbv.pszVal); } jsr.jid[sizeof(jsr.jid)-1] = '\0'; - jsr.hdr.id = mir_a2t(jid); + jsr.hdr.id.t = mir_a2t(jid); if ((n=TlenXmlGetChild(itemNode, "nick")) != NULL && n->text != NULL){ char* buf = TlenTextDecode(n->text); - jsr.hdr.nick = mir_a2t(buf); + jsr.hdr.nick.t = mir_a2t(buf); mir_free(buf); } else { - jsr.hdr.nick = mir_tstrdup(TEXT("")); + jsr.hdr.nick.t = mir_tstrdup(TEXT("")); } if ((n=TlenXmlGetChild(itemNode, "first")) != NULL && n->text != NULL){ char* buf = TlenTextDecode(n->text); - jsr.hdr.firstName = mir_a2t(buf); + jsr.hdr.firstName.t = mir_a2t(buf); mir_free(buf); } else { - jsr.hdr.firstName = mir_tstrdup(TEXT("")); + jsr.hdr.firstName.t = mir_tstrdup(TEXT("")); } if ((n=TlenXmlGetChild(itemNode, "last")) != NULL && n->text != NULL){ char* buf = TlenTextDecode(n->text); - jsr.hdr.lastName = mir_a2t(buf); + jsr.hdr.lastName.t = mir_a2t(buf); mir_free(buf); } else { - jsr.hdr.lastName = mir_tstrdup(TEXT("")); + jsr.hdr.lastName.t = mir_tstrdup(TEXT("")); } if ((n=TlenXmlGetChild(itemNode, "email"))!=NULL && n->text!=NULL){ char* buf = TlenTextDecode(n->text); - jsr.hdr.email = mir_a2t(buf); + jsr.hdr.email.t = mir_a2t(buf); mir_free(buf); } else { - jsr.hdr.email = mir_tstrdup(TEXT("")); + jsr.hdr.email.t = mir_tstrdup(TEXT("")); } ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr); found = 1; - mir_free(jsr.hdr.id); - mir_free(jsr.hdr.nick); - mir_free(jsr.hdr.firstName); - mir_free(jsr.hdr.lastName); - mir_free(jsr.hdr.email); + mir_free(jsr.hdr.id.t); + mir_free(jsr.hdr.nick.t); + mir_free(jsr.hdr.firstName.t); + mir_free(jsr.hdr.lastName.t); + mir_free(jsr.hdr.email.t); } } } if (proto->searchJID != NULL) { if (!found) { - if (strchr(proto->searchJID, '@') != NULL) { + if (strchr(proto->searchJID, '@') != NULL) strncpy_s(jsr.jid, proto->searchJID, _TRUNCATE); - } else { + else mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal); - } - jsr.jid[sizeof(jsr.jid)-1] = '\0'; - jsr.hdr.nick = mir_tstrdup(TEXT("")); - jsr.hdr.firstName = mir_tstrdup(TEXT("")); - jsr.hdr.lastName = mir_tstrdup(TEXT("")); - jsr.hdr.email = mir_tstrdup(TEXT("")); - jsr.hdr.id = mir_tstrdup(TEXT("")); + + jsr.hdr.nick.t = jsr.hdr.firstName.t = jsr.hdr.lastName.t = jsr.hdr.email.t = jsr.hdr.id.t = TEXT(""); ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr); - mir_free(jsr.hdr.nick); - mir_free(jsr.hdr.firstName); - mir_free(jsr.hdr.lastName); - mir_free(jsr.hdr.email); } mir_free(proto->searchJID); proto->searchJID = NULL; -- cgit v1.2.3