summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-30 21:32:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-30 21:32:23 +0000
commit44d6b953f94d5c34a2d50e12c7416aa9a2e19b70 (patch)
treec8e1c28234b52079e90e1569288b9c38a3ce2dce
parentaf10723abafc00db6a77edd299cea1fc7c6822ab (diff)
end of major perversion in Jabber: JABBER_SEARCH_RESULT
git-svn-id: http://svn.miranda-ng.org/main/trunk@13916 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp39
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp9
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp64
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp23
-rw-r--r--protocols/JabberG/src/jabber_search.cpp64
-rw-r--r--protocols/JabberG/src/jabber_search.h2
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp13
-rw-r--r--protocols/JabberG/src/stdafx.h6
8 files changed, 95 insertions, 125 deletions
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index e4ef7d7a01..349853f05a 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1030,15 +1030,12 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
case IDM_VCARD:
{
- JABBER_SEARCH_RESULT jsr = { 0 };
- mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s/%s"), item->jid, him->m_tszResourceName);
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
+ CMString jid(FORMAT, _T("%s/%s"), item->jid, him->m_tszResourceName);
- ppro->ListAdd(LIST_VCARD_TEMP, jsr.jid);
- ppro->ListAddResource(LIST_VCARD_TEMP, jsr.jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
+ ppro->ListAdd(LIST_VCARD_TEMP, jid);
+ ppro->ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
- MCONTACT hContact = (MCONTACT)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr);
- CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ CallService(MS_USERINFO_SHOWDIALOG, ppro->AddToListByJID(jid, PALF_TEMPORARY), 0);
}
break;
@@ -1198,35 +1195,31 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
case IDM_RJID_VCARD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
- MCONTACT hContact;
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- _tcsncpy_s(jsr.jid, him->m_tszRealJid, _TRUNCATE);
- if (TCHAR *tmp = _tcschr(jsr.jid, _T('/')))
+ TCHAR *jid = NEWTSTR_ALLOCA(him->m_tszRealJid);
+ if (TCHAR *tmp = _tcschr(jid, _T('/')))
*tmp = 0;
- ppro->ListAdd(LIST_VCARD_TEMP, jsr.jid);
- ppro->ListAddResource(LIST_VCARD_TEMP, jsr.jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
+ ppro->ListAdd(LIST_VCARD_TEMP, jid);
+ ppro->ListAddResource(LIST_VCARD_TEMP, jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority);
- hContact = (MCONTACT)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr);
- CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ CallService(MS_USERINFO_SHOWDIALOG, ppro->AddToListByJID(jid, PALF_TEMPORARY), 0);
}
break;
case IDM_RJID_ADD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- jsr.hdr.flags = PSR_TCHAR;
- _tcsncpy_s(jsr.jid, him->m_tszRealJid, _TRUNCATE);
- if (TCHAR *tmp = _tcschr(jsr.jid, _T('/')))
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
+ jsr.flags = PSR_TCHAR;
+ jsr.id = NEWTSTR_ALLOCA(him->m_tszRealJid);
+ if (TCHAR *tmp = _tcschr(jsr.id, _T('/')))
*tmp = 0;
- jsr.hdr.nick = jsr.jid;
+ jsr.nick = jsr.id;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = ppro->m_szModuleName;
- acs.psr = (PROTOSEARCHRESULT *)&jsr;
+ acs.psr = &jsr;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)CallService(MS_CLUI_GETHWND, 0, 0), (LPARAM)&acs);
}
break;
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index c156b2b0dc..4e1a452f77 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -1403,12 +1403,9 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
{
TCHAR *jid = pNode->GetJid();
MCONTACT hContact = HContactFromJID(pNode->GetJid());
- if (!hContact) {
- JABBER_SEARCH_RESULT jsr={0};
- _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- hContact = (MCONTACT)CallProtoService(m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr);
- }
+ if (!hContact)
+ hContact = AddToListByJID(jid, PALF_TEMPORARY);
+
if (ListGetItemPtr(LIST_VCARD_TEMP, pNode->GetJid()) == NULL) {
JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid());
item->bUseResource = TRUE;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index afd307fdba..53b84ba56e 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -661,15 +661,14 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
if ((vCardNode = xmlGetChild(iqNode , "vCard")) != NULL) {
if (!mir_tstrcmp(type, _T("result"))) {
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- jsr.hdr.flags = PSR_TCHAR;
- jsr.hdr.nick = sttGetText(vCardNode, "NICKNAME");
- jsr.hdr.firstName = sttGetText(vCardNode, "FN");
- jsr.hdr.lastName = _T("");
- jsr.hdr.email = sttGetText(vCardNode, "EMAIL");
- _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
- jsr.jid[ SIZEOF(jsr.jid)-1 ] = '\0';
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
+ jsr.flags = PSR_TCHAR;
+ jsr.nick = sttGetText(vCardNode, "NICKNAME");
+ jsr.firstName = sttGetText(vCardNode, "FN");
+ jsr.lastName = _T("");
+ jsr.email = sttGetText(vCardNode, "EMAIL");
+ jsr.id = NEWTSTR_ALLOCA(jid);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1137,8 +1136,8 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*)
if ((queryNode = xmlGetChild(iqNode, "query")) == NULL)
return;
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
for (int i = 0;; i++) {
HXML itemNode = xmlGetChild(queryNode, i);
if (!itemNode)
@@ -1146,27 +1145,25 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*)
if (!mir_tstrcmp(xmlGetName(itemNode), _T("item"))) {
if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
- _tcsncpy_s(jsr.jid, jid, _TRUNCATE);
- jsr.jid[SIZEOF(jsr.jid) - 1] = '\0';
- jsr.hdr.id = (TCHAR*)jid;
+ jsr.id = (TCHAR*)jid;
debugLog(_T("Result jid = %s"), jid);
if ((n = xmlGetChild(itemNode, "nick")) != NULL && xmlGetText(n) != NULL)
- jsr.hdr.nick = (TCHAR*)xmlGetText(n);
+ jsr.nick = (TCHAR*)xmlGetText(n);
else
- jsr.hdr.nick = _T("");
+ jsr.nick = _T("");
if ((n = xmlGetChild(itemNode, "first")) != NULL && xmlGetText(n) != NULL)
- jsr.hdr.firstName = (TCHAR*)xmlGetText(n);
+ jsr.firstName = (TCHAR*)xmlGetText(n);
else
- jsr.hdr.firstName = _T("");
+ jsr.firstName = _T("");
if ((n = xmlGetChild(itemNode, "last")) != NULL && xmlGetText(n) != NULL)
- jsr.hdr.lastName = (TCHAR*)xmlGetText(n);
+ jsr.lastName = (TCHAR*)xmlGetText(n);
else
- jsr.hdr.lastName = _T("");
+ jsr.lastName = _T("");
if ((n = xmlGetChild(itemNode, "email")) != NULL && xmlGetText(n) != NULL)
- jsr.hdr.email = (TCHAR*)xmlGetText(n);
+ jsr.email = (TCHAR*)xmlGetText(n);
else
- jsr.hdr.email = _T("");
- jsr.hdr.flags = PSR_TCHAR;
+ jsr.email = _T("");
+ jsr.flags = PSR_TCHAR;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
}
}
@@ -1201,9 +1198,9 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
if (mir_tstrcmp(xmlGetName(itemNode), _T("item")))
continue;
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- jsr.hdr.flags = PSR_TCHAR;
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
+ jsr.flags = PSR_TCHAR;
for (int j=0; ; j++) {
HXML fieldNode = xmlGetChild(itemNode ,j);
@@ -1222,20 +1219,19 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
continue;
if (!mir_tstrcmp(fieldName, _T("jid"))) {
- _tcsncpy_s(jsr.jid, xmlGetText(n), _TRUNCATE);
- jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
- debugLog(_T("Result jid = %s"), jsr.jid);
+ jsr.id = (TCHAR*)xmlGetText(n);
+ debugLog(_T("Result jid = %s"), jsr.id);
}
else if (!mir_tstrcmp(fieldName, _T("nickname")))
- jsr.hdr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ jsr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("fn")))
- jsr.hdr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ jsr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("given")))
- jsr.hdr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ jsr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("family")))
- jsr.hdr.lastName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ jsr.lastName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("email")))
- jsr.hdr.email = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ jsr.email = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 1ae734e4ba..6fcc49e023 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -332,12 +332,10 @@ MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
MCONTACT CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- if (psr->cbSize != sizeof(JABBER_SEARCH_RESULT) && psr->id == NULL)
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id == NULL)
return NULL;
- JABBER_SEARCH_RESULT *jsr = (JABBER_SEARCH_RESULT*)psr;
- TCHAR *jid = psr->id ? psr->id : jsr->jid;
- return AddToListByJID(jid, flags);
+ return AddToListByJID(psr->id, flags);
}
MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbEvent)
@@ -683,17 +681,14 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb)
{
Sleep(100);
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- jsr.hdr.flags = PSR_TCHAR;
- jsr.hdr.nick = jsb->jid;
- jsr.hdr.firstName = _T("");
- jsr.hdr.lastName = _T("");
- jsr.hdr.id = jsb->jid;
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
+ jsr.flags = PSR_TCHAR;
+ jsr.nick = jsb->jid;
+ jsr.firstName = _T("");
+ jsr.lastName = _T("");
+ jsr.id = jsb->jid;
- _tcsncpy_s(jsr.jid, jsb->jid, _TRUNCATE);
-
- jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&jsr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)jsb->hSearch, 0);
mir_free(jsb);
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index 38d53438e5..292ecaeb97 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -203,6 +203,8 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*)
// The pmFields is the pointer to map of <field Name, field Label> Not unical but ordered
// This can help to made result parser routines more simple
+static TCHAR *nickfields[] = { _T("nick"), _T("nickname"), _T("fullname"), _T("name"), _T("given"), _T("first"), _T("jid"), NULL };
+
void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields)
{
LIST<TCHAR> ListOfNonEmptyFields(20,(LIST<TCHAR>::FTSortFunc)TCharKeyCmp);
@@ -222,8 +224,8 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
// now fill the ListOfFields but order is from pmAllFields
int nAllCount = pmAllFields->getCount();
- for (i=0; i < nAllCount; i++) {
- TCHAR * var=pmAllFields->getUnOrderedKeyName(i);
+ for (i = 0; i < nAllCount; i++) {
+ TCHAR *var = pmAllFields->getUnOrderedKeyName(i);
if (var && ListOfNonEmptyFields.getIndex(var) < 0)
continue;
ListOfFields.insert(var);
@@ -232,10 +234,10 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
// now lets transfer field names
int nFieldCount = ListOfFields.getCount();
- JABBER_CUSTOMSEARCHRESULTS Results={0};
- Results.nSize=sizeof(Results);
- Results.pszFields=(TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount);
- Results.nFieldCount=nFieldCount;
+ JABBER_CUSTOMSEARCHRESULTS Results = { 0 };
+ Results.nSize = sizeof(Results);
+ Results.pszFields = (TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount);
+ Results.nFieldCount = nFieldCount;
/* Sending Columns Titles */
for (i=0; i < nFieldCount; i++) {
@@ -244,47 +246,41 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
Results.pszFields[i] = pmAllFields->operator [](var);
}
- Results.jsr.hdr.cbSize = 0; // sending column names
+ Results.jsr.cbSize = 0; // sending column names
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
/* Sending Users Data */
- Results.jsr.hdr.cbSize = sizeof(Results.jsr); // sending user data
+ Results.jsr.cbSize = sizeof(Results.jsr); // sending user data
for (i=0; i < nUsersFound; i++) {
TCHAR buff[200];
buff[0] = 0;
- Results.jsr.jid[0] = 0;
- U_TCHAR_MAP * pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
+ U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
for (int j=0; j < nFieldCount; j++) {
- TCHAR* var = ListOfFields[j];
- TCHAR* value = pmUserData->operator [](var);
+ TCHAR *var = ListOfFields[j];
+ TCHAR *value = pmUserData->operator [](var);
Results.pszFields[j] = value ? value : (TCHAR *)_T(" ");
if (!mir_tstrcmpi(var,_T("jid")) && value)
- _tcsncpy_s(Results.jsr.jid, value, _TRUNCATE);
+ Results.jsr.id = value;
}
- {
- TCHAR * nickfields[]={ _T("nick"), _T("nickname"),
- _T("fullname"), _T("name"),
- _T("given"), _T("first"),
- _T("jid"), NULL };
- TCHAR * nick = NULL;
- int k = 0;
- while (nickfields[k] && !nick) {
- nick = pmUserData->operator [](nickfields[k++]);
- }
- if (nick) {
- if (mir_tstrcmpi(nick, Results.jsr.jid)) {
- mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.jsr.jid);
- } else {
- _tcsncpy_s(buff, nick, _TRUNCATE);
- }
- nick = buff;
- }
- Results.jsr.hdr.nick = nick;
- Results.jsr.hdr.flags = PSR_TCHAR;
+
+ TCHAR *nick = NULL;
+ for (int k = 0; k < _countof(nickfields) && !nick; k++)
+ nick = pmUserData->operator [](nickfields[k]);
+
+ if (nick) {
+ if (mir_tstrcmpi(nick, Results.jsr.id))
+ mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.jsr.id);
+ else
+ _tcsncpy_s(buff, nick, _TRUNCATE);
+
+ nick = buff;
}
+ Results.jsr.nick = nick;
+ Results.jsr.flags = PSR_TCHAR;
+
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results);
- Results.jsr.hdr.nick=NULL;
+ Results.jsr.nick=NULL;
}
mir_free(Results.pszFields);
}
diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h
index 6526ac939d..dc7a442aca 100644
--- a/protocols/JabberG/src/jabber_search.h
+++ b/protocols/JabberG/src/jabber_search.h
@@ -66,7 +66,7 @@ typedef struct tagJABBER_CUSTOMSEARCHRESULTS
size_t nSize;
int nFieldCount;
TCHAR ** pszFields;
- JABBER_SEARCH_RESULT jsr;
+ PROTOSEARCHRESULT jsr;
}JABBER_CUSTOMSEARCHRESULTS;
static HWND searchHandleDlg=NULL;
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index c8a1181ca1..669871a203 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -464,17 +464,16 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
if (!mir_tstrcmpi(szCommand, _T("roster"))) {
if (!HContactFromJID(szJid)) {
- JABBER_SEARCH_RESULT jsr = { 0 };
- jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
- jsr.hdr.flags = PSR_TCHAR;
- jsr.hdr.nick = szJid;
- jsr.hdr.id = szJid;
- _tcsncpy_s(jsr.jid, szJid, _TRUNCATE);
+ PROTOSEARCHRESULT jsr = { 0 };
+ jsr.cbSize = sizeof(jsr);
+ jsr.flags = PSR_TCHAR;
+ jsr.nick = szJid;
+ jsr.id = szJid;
ADDCONTACTSTRUCT acs;
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = m_szModuleName;
- acs.psr = &jsr.hdr;
+ acs.psr = &jsr;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 2cb3572586..ee466f79df 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -468,12 +468,6 @@ struct filetransfer
CJabberProto *ppro;
};
-struct JABBER_SEARCH_RESULT
-{
- PROTOSEARCHRESULT hdr;
- TCHAR jid[JABBER_MAX_JID_LEN];
-};
-
struct JABBER_GCLOG_FONT
{
char face[LF_FACESIZE]; // LF_FACESIZE is from LOGFONT struct