diff options
60 files changed, 539 insertions, 575 deletions
diff --git a/include/m_core.h b/include/m_core.h index e29dc0f100..9ed2a86a9d 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -483,6 +483,12 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); }; ///////////////////////////////////////////////////////////////////////////////
// text conversion functions
+typedef union {
+ char *a; // utf8 or ansi strings
+ TCHAR *t; // strings of TCHARs
+ wchar_t w; // strings of WCHARs
+} MAllStrings;
+
#ifdef _UNICODE
#define mir_t2a(s) mir_u2a(s)
#define mir_a2t(s) mir_a2u(s)
diff --git a/include/m_protocols.h b/include/m_protocols.h index 15da03bc01..fb26cb58c0 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -105,8 +105,6 @@ typedef struct { // when type == ACKTYPE_FILE && (result == ACKRESULT_DATA || result == ACKRESULT_FILERESUME),
// lParam points to this
-#define FNAMECHAR TCHAR
-
#define PFTS_RECEIVING 0
#define PFTS_SENDING 1
#define PFTS_UNICODE 2
diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 82a5291be2..9c9518b95f 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -323,23 +323,14 @@ will pick this up and everything will be good. #define PSR_TCHAR 0
#endif
-
typedef struct {
int cbSize;
- FNAMECHAR *nick;
- FNAMECHAR *firstName;
- FNAMECHAR *lastName;
- FNAMECHAR *email;
- FNAMECHAR *id;
+ MAllStrings nick;
+ MAllStrings firstName;
+ MAllStrings lastName;
+ MAllStrings email;
+ MAllStrings id;
int flags;
- char reserved[8*sizeof(HANDLE)/sizeof(DWORD)];
- //Protocols may extend this structure with extra members at will and supply
- //a larger cbSize to reflect the new information, but they must not change
- //any elements above this comment
- //The 'reserved' field is part of the basic structure, not space to
- //overwrite with protocol-specific information.
- //If modules do this, they should take steps to ensure that information
- //they put there will be retained by anyone trying to save this structure.
} PROTOSEARCHRESULT;
#define PS_BASICSEARCH "/BasicSearch"
#define PS_BASICSEARCHW "/BasicSearchW"
@@ -395,7 +386,7 @@ typedef struct { typedef struct {
size_t nSize;
int nFieldCount;
- TCHAR ** pszFields;
+ TCHAR **pszFields;
PROTOSEARCHRESULT psr;
} CUSTOMSEARCHRESULTS;
@@ -446,7 +437,7 @@ typedef struct { #define FILERESUME_SKIP 4
typedef struct {
int action; //a FILERESUME_ flag
- const FNAMECHAR *szFilename; //full path. Only valid if action == FILERESUME_RENAME
+ const TCHAR *szFilename; // full path. Only valid if action == FILERESUME_RENAME
} PROTOFILERESUME;
#define PS_FILERESUME "/FileResume"
#define PS_FILERESUMEW "/FileResumeW"
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index 97a255cd99..723c308338 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -264,7 +264,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) }
psr->flags = PSR_TCHAR;
- psr->id = mir_tstrdup(szUserId);
+ psr->id.t = mir_tstrdup(szUserId);
acs->psr = psr;
MCONTACT hContact = (MCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr);
@@ -340,10 +340,10 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM) if (acs) {
db_set_s(NULL, "AddContact", "LastProto", acs->proto);
if (acs->psr) {
- mir_free(acs->psr->nick);
- mir_free(acs->psr->firstName);
- mir_free(acs->psr->lastName);
- mir_free(acs->psr->email);
+ mir_free(acs->psr->nick.t);
+ mir_free(acs->psr->firstName.t);
+ mir_free(acs->psr->lastName.t);
+ mir_free(acs->psr->email.t);
mir_free(acs->psr);
}
delete acs;
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 5640a5ce18..8b3593e89d 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -117,7 +117,7 @@ static int ServiceParseAimLink(WPARAM,LPARAM lParam) acs.psr=&psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize=sizeof(PROTOSEARCHRESULT);
- psr.nick=sn;
+ psr.nick.t=sn;
CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs);
}
return 0;
@@ -436,7 +436,7 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) acs.psr=&psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize=sizeof(PROTOSEARCHRESULT);
- psr.nick=id;
+ psr.nick.t=id;
CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs);
}
return 0;
@@ -551,8 +551,8 @@ static int ServiceParseMsnimLink(WPARAM wParam,LPARAM lParam) acs.psr=&psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize=sizeof(PROTOSEARCHRESULT);
- psr.nick=email;
- psr.email=email;
+ psr.nick.t=email;
+ psr.email.t=email;
CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs);
}
return 0;
@@ -746,7 +746,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) acs.psr=&psr;
memset(&psr, 0, sizeof(PROTOSEARCHRESULT));
psr.cbSize=sizeof(PROTOSEARCHRESULT);
- psr.nick=jid;
+ psr.nick.t=jid;
CallService(MS_ADDCONTACT_SHOW,0,(LPARAM)&acs);
}
return 0;
diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 73fcba99e9..10aa4e70c5 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -437,10 +437,10 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara fi.psz = wndData->haUin;
int iLPos = ListView_FindItem(hLV, -1, &fi);
if (iLPos == -1) iLPos = 0;
- if (mir_tstrcmp(psr->nick, _T("")) && psr->nick)
- ListView_SetItemText(hLV, iLPos, 1, psr->nick);
- ListView_SetItemText(hLV, iLPos, 2, psr->firstName);
- ListView_SetItemText(hLV, iLPos, 3, psr->lastName);
+ if (mir_tstrcmp(psr->nick.t, _T("")) && psr->nick.t)
+ ListView_SetItemText(hLV, iLPos, 1, psr->nick.t);
+ ListView_SetItemText(hLV, iLPos, 2, psr->firstName.t);
+ ListView_SetItemText(hLV, iLPos, 3, psr->lastName.t);
break;
}
mir_free(wndData->haUin);
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index b8f426da7f..76f2584973 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -80,7 +80,7 @@ void NotifyUser(Account *curAcc) resultLink *prst = curAcc->results.next;
for (int i = 0; i < newMails; i++) {
- dbei.cbBlob = mir_strlen(prst->content) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(prst->content) + 1;
dbei.pBlob = (PBYTE)prst->content;
db_event_add(curAcc->hContact, &dbei);
prst = prst->next;
@@ -177,7 +177,7 @@ void __cdecl Login_ThreadFunc(void *lpParam) mir_strcat(buffer, "><input type=hidden name=password value=");
mir_strcat(buffer, curAcc->pass);
mir_strcat(buffer, "></form></body>");
- WriteFile(hTempFile, buffer, mir_strlen(buffer), &dwBytesWritten, NULL);
+ WriteFile(hTempFile, buffer, (DWORD)mir_strlen(buffer), &dwBytesWritten, NULL);
CloseHandle(hTempFile);
mir_strcat(lpPathBuffer, szTempName);
}
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index b2adfc3878..090d93f6a5 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -233,15 +233,15 @@ void CSend::svcSendMsgExit(const char* szMessage) { Exit(res); return; }else{ mir_freeAndNil(m_szEventMsg); - m_cbEventMsg=mir_strlen(szMessage)+1; - m_szEventMsg=(char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); + m_cbEventMsg = (DWORD)mir_strlen(szMessage)+1; + m_szEventMsg = (char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg,szMessage); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char *temp = mir_t2a(m_pszFileDesc); mir_stradd(m_szEventMsg, "\r\n"); mir_stradd(m_szEventMsg, temp); - m_cbEventMsg = mir_strlen(m_szEventMsg)+1; + m_cbEventMsg = (DWORD)mir_strlen(m_szEventMsg)+1; mir_free(temp); } //create a HookEventObj on ME_PROTO_ACK @@ -272,13 +272,13 @@ void CSend::svcSendFileExit() { } mir_freeAndNil(m_szEventMsg); char* szFile = mir_t2a(m_pszFile); - m_cbEventMsg=mir_strlen(szFile)+2; + m_cbEventMsg = (DWORD)mir_strlen(szFile)+2; m_szEventMsg=(char*)mir_realloc(m_szEventMsg, (sizeof(char) * m_cbEventMsg)); memset(m_szEventMsg, 0, (sizeof(char) * m_cbEventMsg)); mir_strcpy(m_szEventMsg,szFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char* temp = mir_t2a(m_pszFileDesc); - m_cbEventMsg += mir_strlen(temp); + m_cbEventMsg += (DWORD)mir_strlen(temp); m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); mir_strcpy(m_szEventMsg+mir_strlen(szFile)+1,temp); m_szEventMsg[m_cbEventMsg-1] = 0; @@ -611,7 +611,7 @@ static void HTTPFormAppendData(NETLIBHTTPREQUEST* nlhr, size_t* dataMax, char** } if(data){ memcpy(*dataPos,data,sizeof(char)*len); *dataPos+=len; - nlhr->dataLength+=len; // not necessary + nlhr->dataLength += (int)len; // not necessary } } void CSend::HTTPFormDestroy(NETLIBHTTPREQUEST* nlhr) diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 5f2fd10f6b..ea5f444fdc 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -35,8 +35,7 @@ static TCHAR name1[256]; INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
{
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
-
- if(!psr || !psr->email)
+ if(!psr || !psr->email.t)
return 0;
// search for existing contact
@@ -46,7 +45,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
// check ID to see if the contact already exist in the database
if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) {
- if ( !mir_tstrcmpi(psr->email, dbv.ptszVal)) {
+ if ( !mir_tstrcmpi(psr->email.t, dbv.ptszVal)) {
// remove the flag for not on list and hidden, thus make the contact visible
// and add them on the list
if (db_get_b(hContact, "CList", "NotOnList", 1)) {
@@ -71,10 +70,10 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) // set contact info and settings
TCHAR svc[256];
- _tcsncpy(svc, psr->email, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0;
+ _tcsncpy(svc, psr->email.t, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0;
GetSvc(svc);
// set settings by obtaining the default for the service
- if (psr->lastName[0] != 0) {
+ if (psr->lastName.t[0] != 0) {
WIDATA *sData = GetWIData(svc);
db_set_ts(hContact, WEATHERPROTONAME, "MapURL", sData->DefaultMap);
db_set_s(hContact, WEATHERPROTONAME, "InfoURL", sData->DefaultURL);
@@ -84,14 +83,14 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) db_set_s(hContact, WEATHERPROTONAME, "InfoURL", "");
}
// write the other info and settings to the database
- db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email);
- db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick);
+ db_set_ts(hContact, WEATHERPROTONAME, "ID", psr->email.t);
+ db_set_ts(hContact, WEATHERPROTONAME, "Nick", psr->nick.t);
db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
AvatarDownloaded(hContact);
TCHAR str[256];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Current weather information for %s."), psr->nick);
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Current weather information for %s."), psr->nick.t);
db_set_ts(hContact, WEATHERPROTONAME, "About", str);
// make the last update tags to something invalid
@@ -256,10 +255,10 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, // set the search result and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = str;
- psr.firstName = _T(" ");
- psr.lastName = svcname;
- psr.email = newID;
+ psr.nick.t = str;
+ psr.firstName.t = _T(" ");
+ psr.lastName.t = svcname;
+ psr.email.t = newID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
return 0;
@@ -287,10 +286,10 @@ int IDSearch(TCHAR *sID, const int searchId) // return an empty contact on "#"
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = TranslateT("<Enter station name here>"); // to be entered
- psr.firstName = _T(" ");
- psr.lastName = _T("");
- psr.email = TranslateT("<Enter station ID here>"); // to be entered
+ psr.nick.t = TranslateT("<Enter station name here>"); // to be entered
+ psr.firstName.t = _T(" ");
+ psr.lastName.t = _T("");
+ psr.email.t = TranslateT("<Enter station ID here>"); // to be entered
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
@@ -349,11 +348,11 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // set the data and broadcast it
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = Name;
- psr.firstName = _T(" ");
- psr.lastName = svcname;
- psr.email = sID;
- psr.id = sID;
+ psr.nick.t = Name;
+ psr.firstName.t = _T(" ");
+ psr.lastName.t = svcname;
+ psr.email.t = sID;
+ psr.id.t = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
mir_free(szData);
return 0;
@@ -387,11 +386,11 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = Name;
- psr.firstName = _T("");
- psr.lastName = svcname;
- psr.email = sID;
- psr.id = sID;
+ psr.nick.t = Name;
+ psr.firstName.t = _T("");
+ psr.lastName.t = svcname;
+ psr.email.t = sID;
+ psr.id.t = sID;
ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)searchId, (LPARAM)&psr);
}
}
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 77438d6ccc..7f6c29897c 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -304,7 +304,7 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM lParam) static void __cdecl BasicSearchTimerProc(void *pszNick) { PROTOSEARCHRESULT psr = { sizeof(psr) }; - psr.nick = (TCHAR*) pszNick; + psr.nick.t = (TCHAR*) pszNick; // broadcast the search result ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); @@ -343,7 +343,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) if (psr == NULL) return 0; - if (psr->nick == NULL) { + if (psr->nick.t == NULL) { WErrorPopup((MCONTACT)"ERROR", TranslateT("Please select site in Find/Add contacts...")); return 0; } @@ -355,7 +355,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) // check ID to see if the contact already exist in the database if (db_get_ts(hContact, MODULENAME, "URL", &dbv)) continue; - if (!mir_tstrcmpi(psr->nick, dbv.ptszVal)) { + if (!mir_tstrcmpi(psr->nick.t, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the // contact visible // and add them on the list @@ -379,8 +379,8 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) //Convert url into a name for contact TCHAR Cnick[255]; - if (psr->nick != NULL) - _tcsncpy(Cnick, psr->nick, SIZEOF(Cnick)); + if (psr->nick.t != NULL) + _tcsncpy(Cnick, psr->nick.t, SIZEOF(Cnick)); else Cnick[0] = 0; @@ -436,8 +436,8 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) db_set_ts(hContact, MODULENAME, "Nick", Newnick); db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 1); db_set_s(hContact, MODULENAME, START_STRING_KEY, ""); - db_set_ts(hContact, MODULENAME, URL_KEY, psr->nick); - db_set_ts(hContact, MODULENAME, "Homepage", psr->nick); + db_set_ts(hContact, MODULENAME, URL_KEY, psr->nick.t); + db_set_ts(hContact, MODULENAME, "Homepage", psr->nick.t); db_set_b(hContact, MODULENAME, U_ALLSITE_KEY, 1); db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index fef79cf78c..c6f52f054a 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -123,7 +123,7 @@ int CAimProto::OnModulesLoaded(WPARAM, LPARAM) MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
if (state != 1) return 0;
- TCHAR *id = psr->id ? psr->id : psr->nick;
+ TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t;
char *sn = psr->flags & PSR_UNICODE ? mir_u2a((wchar_t*)id) : mir_strdup((char*)id);
MCONTACT hContact = contact_from_sn(sn, true, (flags & PALF_TEMPORARY) != 0);
mir_free(sn);
@@ -313,7 +313,7 @@ void __cdecl CAimProto::basic_search_ack_success(void* p) {
PROTOSEARCHRESULT psr = {0};
psr.cbSize = sizeof(psr);
- psr.id = (TCHAR*)sn;
+ psr.id.t = (TCHAR*)sn;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 2548838fa8..62d671ee71 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1889,10 +1889,10 @@ void CAimProto::snac_email_search_results(SNAC &snac)//family 0x000A {
TLV tlv(snac.val(offset));
offset+=TLV_HEADER_SIZE;
- psr.id = (TCHAR*)tlv.dup();
+ psr.id.t = (TCHAR*)tlv.dup();
offset+=tlv.len();
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
- mir_free(psr.nick);
+ mir_free(psr.nick.t);
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index e0cfd7962c..9ac8e81bd7 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -418,11 +418,11 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs) dbei.cbSize = sizeof(dbei); dbei.szModule = PROTONAME; dbei.timestamp = pre->timestamp; - dbei.flags = pre->flags&PREF_CREATEREAD ? DBEF_READ : 0; - dbei.cbBlob = mir_tstrlen(pre->szMessage) + 1; + dbei.flags = pre->flags & PREF_CREATEREAD ? DBEF_READ : 0; + dbei.cbBlob = (DWORD)mir_tstrlen(pre->szMessage) + 1; if (!mir_strcmp(ccs->szProtoService, PSR_URL)) { - dbei.cbBlob += 2 + mir_tstrlen(pre->szMessage + dbei.cbBlob + 1); + dbei.cbBlob += 2 + (DWORD)mir_tstrlen(pre->szMessage + dbei.cbBlob + 1); } dbei.pBlob = (PBYTE)pre->szMessage; @@ -431,9 +431,9 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs) db_event_add(ccs->hContact, &dbei); } -INT_PTR CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr) +INT_PTR CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT *psr) { - if (psr->hdr.cbSize != sizeof(EMPSEARCHRESULT)) + if (psr->cbSize != sizeof(EMPSEARCHRESULT)) return 0; in_addr addr; @@ -441,7 +441,7 @@ INT_PTR CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr) bool TempAdd = flags&PALF_TEMPORARY; - MCONTACT contact = FindContact(addr, psr->hdr.nick, true, !TempAdd, !TempAdd, psr->stat); + MCONTACT contact = FindContact(addr, psr->nick.t, true, !TempAdd, !TempAdd, psr->stat); if (contact != NULL) { db_set_w(contact, PROTONAME, "Status", psr->stat); db_set_w(contact, PROTONAME, "RemoteVersion", psr->ver); @@ -453,7 +453,7 @@ INT_PTR CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr) int CMLan::SendMessageUrl(CCSDATA* ccs, bool isUrl) { int cid = GetRandomProcId(); - int len; + size_t len; if (isUrl) { len = mir_tstrlen((char*)ccs->lParam); @@ -515,7 +515,7 @@ void CMLan::SearchExt(TDataHolder* hold) Sleep(0); EMPSEARCHRESULT psr; memset(&psr, 0, sizeof(psr)); - psr.hdr.cbSize = sizeof(psr); + psr.cbSize = sizeof(psr); TContact* cont = m_pRootContact; while (cont) @@ -524,13 +524,13 @@ void CMLan::SearchExt(TDataHolder* hold) { char buf[MAX_HOSTNAME_LEN]; mir_tstrcpy(buf, cont->m_nick); - int len = mir_tstrlen(buf); + size_t len = mir_tstrlen(buf); buf[len] = '@'; mir_tstrcpy(buf + len + 1, inet_ntoa(cont->m_addr)); - psr.hdr.nick = cont->m_nick; - psr.hdr.firstName = ""; - psr.hdr.lastName = ""; - psr.hdr.email = buf; + psr.nick.t = cont->m_nick; + psr.firstName.t = ""; + psr.lastName.t = ""; + psr.email.t = buf; psr.ipaddr = cont->m_addr.S_un.S_addr; psr.stat = cont->m_status; psr.ver = cont->m_ver; @@ -617,7 +617,7 @@ int CMLan::SetAwayMsg(u_int status, char* msg) u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) { - int len = 1; + size_t len = 1; if (pak.idVersion != -1) pak.idVersion = __FILEVERSION_DWORD; @@ -636,7 +636,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.idStatus) len += 1 + 1 + 2; - int nameLen; + size_t nameLen; if (pak.strName) { nameLen = mir_tstrlen(pak.strName); @@ -646,7 +646,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.flReqStatus) len += 1 + 1; - int mesLen = 0; + size_t mesLen = 0; if (pak.strMessage) { mesLen = mir_tstrlen(pak.strMessage); @@ -661,7 +661,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.idReqAwayMessage) len += 1 + 1 + 4; - int awayLen = 0; + size_t awayLen = 0; if (pak.strAwayMessage) { awayLen = mir_tstrlen(pak.strAwayMessage); @@ -691,7 +691,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.strName) { - *pb++ = 1 + nameLen + 1; + *pb++ = 1 + (BYTE)nameLen + 1; *pb++ = MCODE_SND_NAME; memcpy(pb, pak.strName, nameLen); pb += nameLen; @@ -707,7 +707,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.strMessage) { *pb++ = 255; - *((u_short*)pb) = 1 + 4 + mesLen + 1; + *((u_short*)pb) = 1 + 4 + (BYTE)mesLen + 1; pb += sizeof(u_short); if (pak.flIsUrl) *pb++ = MCODE_SND_URL; @@ -743,7 +743,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) if (pak.strAwayMessage) { *pb++ = 255; - *((u_short*)pb) = 1 + 4 + awayLen + 1; + *((u_short*)pb) = 1 + 4 + (BYTE)awayLen + 1; pb += sizeof(u_short); *pb++ = MCODE_SND_AWAYMSG; *((u_int*)pb) = pak.idAckAwayMessage; @@ -757,7 +757,7 @@ u_char* CMLan::CreatePacket(TPacket& pak, int* pBufLen) *pb++ = 0; if (pBufLen) - *pBufLen = len; + *pBufLen = (int)len; return buf; } @@ -842,7 +842,7 @@ void CMLan::LoadSettings() dbv.pszVal = "EmLan_User"; mir_tstrcpy(m_name, dbv.pszVal); } - m_nameLen = mir_tstrlen(m_name); + m_nameLen = (int)mir_tstrlen(m_name); if (GetStatus() != LM_LISTEN) { diff --git a/protocols/EmLanProto/src/mlan.h b/protocols/EmLanProto/src/mlan.h index 315189131d..3eb65620d1 100644 --- a/protocols/EmLanProto/src/mlan.h +++ b/protocols/EmLanProto/src/mlan.h @@ -16,13 +16,12 @@ class CMLan;
-typedef struct
+struct EMPSEARCHRESULT : public PROTOSEARCHRESULT
{
- PROTOSEARCHRESULT hdr;
u_long ipaddr;
WORD stat;
u_long ver;
-} EMPSEARCHRESULT;
+};
struct TDataHolder
{
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index cd76503b21..e798d007d2 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -1287,16 +1287,15 @@ void FacebookProto::SearchAckThread(void *targ) ptrT tnick(mir_utf8decodeT(utils::text::html_entities_decode(nick).c_str())); ptrT tcommon(mir_utf8decodeT(utils::text::html_entities_decode(common).c_str())); - PROTOSEARCHRESULT isr = { 0 }; - isr.cbSize = sizeof(isr); - isr.flags = PSR_TCHAR; - isr.id = tid; - isr.nick = tnick; - isr.firstName = tname; - isr.lastName = tsurname; - isr.email = tcommon; - - ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&isr); + PROTOSEARCHRESULT psr = { 0 }; + psr.cbSize = sizeof(psr); + psr.flags = PSR_TCHAR; + psr.id.t = tid; + psr.nick.t = tnick; + psr.firstName.t = tname; + psr.lastName.t = tsurname; + psr.email.t = tcommon; + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); } ssid = utils::text::source_get_value(&items, 3, "id=\"more_objects\"", "ssid=", "&"); @@ -1349,14 +1348,13 @@ void FacebookProto::SearchIdAckThread(void *targ) ptrT tname(mir_utf8decodeT(name.c_str())); ptrT tsurname(mir_utf8decodeT(surname.c_str())); - PROTOSEARCHRESULT isr = { 0 }; - isr.cbSize = sizeof(isr); - isr.flags = PSR_TCHAR; - isr.id = tid; - isr.firstName = tname; - isr.lastName = tsurname; - - ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&isr); + PROTOSEARCHRESULT psr = { 0 }; + psr.cbSize = sizeof(psr); + psr.flags = PSR_TCHAR; + psr.id.t = tid; + psr.firstName.t = tname; + psr.lastName.t = tsurname; + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr); } } } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index c1181c307c..6f3e29b71c 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -284,9 +284,9 @@ HANDLE FacebookProto::SearchByName(const PROTOCHAR* nick, const PROTOCHAR* first MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - ptrA id(mir_t2a_cp(psr->id, CP_UTF8)); - ptrA name(mir_t2a_cp(psr->firstName, CP_UTF8)); - ptrA surname(mir_t2a_cp(psr->lastName, CP_UTF8)); + ptrA id(mir_t2a_cp(psr->id.t, CP_UTF8)); + ptrA name(mir_t2a_cp(psr->firstName.t, CP_UTF8)); + ptrA surname(mir_t2a_cp(psr->lastName.t, CP_UTF8)); if (id == NULL) return NULL; diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 2bf2907cf4..c4bc303fa9 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -651,17 +651,17 @@ retry: }
}
- GGSEARCHRESULT sr;
- memset(&sr, 0, sizeof(sr));
- sr.cbSize = sizeof(sr);
- sr.flags = PSR_TCHAR;
- sr.nick = __nickname;
- sr.firstName = __firstname;
- sr.lastName = __lastname;
- sr.email = strFmt2;
- sr.id = _ultot(uin, strFmt1, 10);
- sr.uin = uin;
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM)&sr);
+ GGSEARCHRESULT psr;
+ memset(&psr, 0, sizeof(psr));
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.nick.t = __nickname;
+ psr.firstName.t = __firstname;
+ psr.lastName.t = __lastname;
+ psr.email.t = strFmt2;
+ psr.id.t = _ultot(uin, strFmt1, 10);
+ psr.uin = uin;
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM)&psr);
}
if (((res->seq == GG_SEQ_INFO || res->seq == GG_SEQ_GETNICK) && hContact != NULL)
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index a61ec36c60..f4ec6475b2 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -124,20 +124,20 @@ GGPROTO::~GGPROTO() //////////////////////////////////////////////////////////
// when contact is added to list
-MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *psr)
+MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr)
{
#ifdef DEBUGMODE
debugLogA("AddToList(): id=%s");
#endif
- GGSEARCHRESULT *sr = (GGSEARCHRESULT *)psr;
+ GGSEARCHRESULT *psr = (GGSEARCHRESULT *)pmsr;
uin_t uin;
if (psr->cbSize == sizeof(GGSEARCHRESULT))
- uin = sr->uin;
+ uin = psr->uin;
else
- uin = _ttoi(psr->id);
+ uin = _ttoi(psr->id.t);
- return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, sr->nick);
+ return getcontact(uin, 1, flags & PALF_TEMPORARY ? 0 : 1, psr->nick.t);
}
//////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 162876aeca..74af25ec59 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -302,7 +302,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
- TCHAR *id = psr->id ? psr->id : psr->nick;
+ TCHAR *id = psr->id.t ? psr->id.t : psr->nick.t;
id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)id) : mir_a2t((char*)id);
CONTACT user = { id, NULL, NULL, true, false, false };
@@ -487,8 +487,8 @@ void __cdecl CIrcProto::AckBasicSearch(void* param) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = ((AckBasicSearchParam*)param)->buf;
- psr.nick = ((AckBasicSearchParam*)param)->buf;
+ psr.id.t = ((AckBasicSearchParam*)param)->buf;
+ psr.nick.t = ((AckBasicSearchParam*)param)->buf;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
delete param;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 4dcfef8772..2d77ee5f17 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -744,8 +744,8 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id = gch->ptszUID;
- psr.nick = gch->ptszUID;
+ psr.id.t = gch->ptszUID;
+ psr.nick.t = gch->ptszUID;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
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;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 349853f05a..4ac3010bea 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1208,18 +1208,18 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_ADD:
if (him->m_tszRealJid && *him->m_tszRealJid) {
- 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('/')))
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.id.t = NEWTSTR_ALLOCA(him->m_tszRealJid);
+ if (TCHAR *tmp = _tcschr(psr.id.t, _T('/')))
*tmp = 0;
- jsr.nick = jsr.id;
+ psr.nick.t = psr.id.t;
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = ppro->m_szModuleName;
- acs.psr = &jsr;
+ acs.psr = &psr;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)CallService(MS_CLUI_GETHWND, 0, 0), (LPARAM)&acs);
}
break;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 53b84ba56e..dfe3246216 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -661,15 +661,15 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if ((vCardNode = xmlGetChild(iqNode , "vCard")) != NULL) {
if (!mir_tstrcmp(type, _T("result"))) {
- 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);
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.nick.t = sttGetText(vCardNode, "NICKNAME");
+ psr.firstName.t = sttGetText(vCardNode, "FN");
+ psr.lastName.t = _T("");
+ psr.email.t = sttGetText(vCardNode, "EMAIL");
+ psr.id.t = NEWTSTR_ALLOCA(jid);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
else if (!mir_tstrcmp(type, _T("error")))
@@ -1136,8 +1136,8 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if ((queryNode = xmlGetChild(iqNode, "query")) == NULL)
return;
- PROTOSEARCHRESULT jsr = { 0 };
- jsr.cbSize = sizeof(jsr);
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
for (int i = 0;; i++) {
HXML itemNode = xmlGetChild(queryNode, i);
if (!itemNode)
@@ -1145,26 +1145,26 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(xmlGetName(itemNode), _T("item"))) {
if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
- jsr.id = (TCHAR*)jid;
+ psr.id.t = (TCHAR*)jid;
debugLog(_T("Result jid = %s"), jid);
if ((n = xmlGetChild(itemNode, "nick")) != NULL && xmlGetText(n) != NULL)
- jsr.nick = (TCHAR*)xmlGetText(n);
+ psr.nick.t = (TCHAR*)xmlGetText(n);
else
- jsr.nick = _T("");
+ psr.nick.t = _T("");
if ((n = xmlGetChild(itemNode, "first")) != NULL && xmlGetText(n) != NULL)
- jsr.firstName = (TCHAR*)xmlGetText(n);
+ psr.firstName.t = (TCHAR*)xmlGetText(n);
else
- jsr.firstName = _T("");
+ psr.firstName.t = _T("");
if ((n = xmlGetChild(itemNode, "last")) != NULL && xmlGetText(n) != NULL)
- jsr.lastName = (TCHAR*)xmlGetText(n);
+ psr.lastName.t = (TCHAR*)xmlGetText(n);
else
- jsr.lastName = _T("");
+ psr.lastName.t = _T("");
if ((n = xmlGetChild(itemNode, "email")) != NULL && xmlGetText(n) != NULL)
- jsr.email = (TCHAR*)xmlGetText(n);
+ psr.email.t = (TCHAR*)xmlGetText(n);
else
- jsr.email = _T("");
- jsr.flags = PSR_TCHAR;
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
+ psr.email.t = _T("");
+ psr.flags = PSR_TCHAR;
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
}
}
}
@@ -1198,9 +1198,9 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (mir_tstrcmp(xmlGetName(itemNode), _T("item")))
continue;
- PROTOSEARCHRESULT jsr = { 0 };
- jsr.cbSize = sizeof(jsr);
- jsr.flags = PSR_TCHAR;
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
for (int j=0; ; j++) {
HXML fieldNode = xmlGetChild(itemNode ,j);
@@ -1219,22 +1219,22 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) continue;
if (!mir_tstrcmp(fieldName, _T("jid"))) {
- jsr.id = (TCHAR*)xmlGetText(n);
- debugLog(_T("Result jid = %s"), jsr.id);
+ psr.id.t = (TCHAR*)xmlGetText(n);
+ debugLog(_T("Result jid = %s"), psr.id.t);
}
else if (!mir_tstrcmp(fieldName, _T("nickname")))
- jsr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ psr.nick.t = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("fn")))
- jsr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ psr.firstName.t = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("given")))
- jsr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ psr.firstName.t = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("family")))
- jsr.lastName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ psr.lastName.t = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
else if (!mir_tstrcmp(fieldName, _T("email")))
- jsr.email = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
+ psr.email.t = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
}
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr);
}
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 6fcc49e023..ee87d26b89 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -332,10 +332,10 @@ MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) MCONTACT CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id == NULL)
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id.t == NULL)
return NULL;
- return AddToListByJID(psr->id, flags);
+ return AddToListByJID(psr->id.t, flags);
}
MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbEvent)
@@ -681,15 +681,15 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) {
Sleep(100);
- 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;
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.nick.t = jsb->jid;
+ psr.firstName.t = _T("");
+ psr.lastName.t = _T("");
+ psr.id.t = jsb->jid;
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&jsr);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&psr);
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 292ecaeb97..8cca0b3109 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////// // Subclassing of IDC_FRAME to implement more user-friendly fields scrolling -// + static int JabberSearchFrameProc(HWND hwnd, int msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_COMMAND && lParam != 0) { @@ -84,7 +84,7 @@ static int JabberSearchFrameProc(HWND hwnd, int msg, WPARAM wParam, LPARAM lPara /////////////////////////////////////////////////////////////////////////////// // Add Search field to form -// + static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) { if (!FieldDat || !FieldDat->Label || !FieldDat->Var) @@ -234,7 +234,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M // now lets transfer field names int nFieldCount = ListOfFields.getCount(); - JABBER_CUSTOMSEARCHRESULTS Results = { 0 }; + CUSTOMSEARCHRESULTS Results = { 0 }; Results.nSize = sizeof(Results); Results.pszFields = (TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount); Results.nFieldCount = nFieldCount; @@ -246,11 +246,11 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.pszFields[i] = pmAllFields->operator [](var); } - Results.jsr.cbSize = 0; // sending column names + Results.psr.cbSize = 0; // sending column names ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results); /* Sending Users Data */ - Results.jsr.cbSize = sizeof(Results.jsr); // sending user data + Results.psr.cbSize = sizeof(Results.psr); // sending user data for (i=0; i < nUsersFound; i++) { TCHAR buff[200]; @@ -261,7 +261,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M TCHAR *value = pmUserData->operator [](var); Results.pszFields[j] = value ? value : (TCHAR *)_T(" "); if (!mir_tstrcmpi(var,_T("jid")) && value) - Results.jsr.id = value; + Results.psr.id.t = value; } TCHAR *nick = NULL; @@ -269,18 +269,18 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M 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); + if (mir_tstrcmpi(nick, Results.psr.id.t)) + mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.psr.id.t); else _tcsncpy_s(buff, nick, _TRUNCATE); nick = buff; } - Results.jsr.nick = nick; - Results.jsr.flags = PSR_TCHAR; + Results.psr.nick.t = nick; + Results.psr.flags = PSR_TCHAR; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM) &Results); - Results.jsr.nick=NULL; + Results.psr.nick.t = NULL; } mir_free(Results.pszFields); } diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h index dc7a442aca..3af25191e4 100644 --- a/protocols/JabberG/src/jabber_search.h +++ b/protocols/JabberG/src/jabber_search.h @@ -60,15 +60,6 @@ typedef struct tag_Data } Data;
-
-typedef struct tagJABBER_CUSTOMSEARCHRESULTS
-{
- size_t nSize;
- int nFieldCount;
- TCHAR ** pszFields;
- PROTOSEARCHRESULT jsr;
-}JABBER_CUSTOMSEARCHRESULTS;
-
static HWND searchHandleDlg=NULL;
//local functions declarations
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 669871a203..b175f9c426 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -464,16 +464,16 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) if (!mir_tstrcmpi(szCommand, _T("roster"))) {
if (!HContactFromJID(szJid)) {
- PROTOSEARCHRESULT jsr = { 0 };
- jsr.cbSize = sizeof(jsr);
- jsr.flags = PSR_TCHAR;
- jsr.nick = szJid;
- jsr.id = szJid;
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.nick.t = szJid;
+ psr.id.t = szJid;
ADDCONTACTSTRUCT acs;
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = m_szModuleName;
- acs.psr = &jsr;
+ acs.psr = &psr;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index ec6f7f229f..74d587d25a 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -156,7 +156,7 @@ MCONTACT CMraProto::AddToList(int flags, PROTOSEARCHRESULT *psr) if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
return 0;
- return AddToListByEmail(psr->email, psr->nick, psr->firstName, psr->lastName, flags);
+ return AddToListByEmail(psr->email.t, psr->nick.t, psr->firstName.t, psr->lastName.t, flags);
}
MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent)
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 80eed2e2a7..f1060c459e 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -943,11 +943,11 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) psr.cbSize = sizeof(psr);
psr.flags = PSR_UNICODE;
- psr.nick = szNick;
- psr.firstName = szFirstName;
- psr.lastName = szLastName;
- psr.email = szEmail;
- psr.id = szEmail;
+ psr.nick.t = szNick;
+ psr.firstName.t = szFirstName;
+ psr.lastName.t = szLastName;
+ psr.email.t = szEmail;
+ psr.id.t = szEmail;
for (DWORD i = 0; i < dwFieldsNum; i++) {
CMStringA &fld = pmralpsFields[i];
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;
}
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h index d1a6f96a1a..22d07668e8 100644 --- a/protocols/Sametime/src/sametime.h +++ b/protocols/Sametime/src/sametime.h @@ -70,24 +70,19 @@ typedef struct Options_tag { bool idle_as_away;
} SametimeOptions;
-typedef struct {
- int cbSize;
- char* nick;
- char* firstName;
- char* lastName;
- char* email;
- char reserved[16];
+struct MYPROTOSEARCHRESULT : public PROTOSEARCHRESULT
+{
char name[256];
char stid[256];
bool group;
-} MYPROTOSEARCHRESULT;
-
-typedef struct {
- size_t nSize;
- int nFieldCount;
- TCHAR** pszFields;
- MYPROTOSEARCHRESULT psr;
-} MYCUSTOMSEARCHRESULTS;
+};
+
+struct MYCUSTOMSEARCHRESULTS : public CUSTOMSEARCHRESULTS
+{
+ char name[256];
+ char stid[256];
+ bool group;
+};
typedef struct FileTransferClientData_tag {
char* save_path;
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index debe054ec3..6d631fc2ce 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -655,11 +655,10 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code CSametimeProto* proto = getProtoFromMwServiceResolve(srvc);
BOOL advanced = (BOOL)data;
- MYCUSTOMSEARCHRESULTS mcsr = { 0 };
+ MYCUSTOMSEARCHRESULTS mcsr;
+ memset(&mcsr, 0, sizeof(mcsr));
mcsr.nSize = sizeof(MYCUSTOMSEARCHRESULTS);
- //MYPROTOSEARCHRESULT mpsr = {0};
- //mpsr.cbSize = sizeof(MYPROTOSEARCHRESULT);
- mcsr.psr.nick = mcsr.psr.name;
+ mcsr.psr.nick.a = mcsr.name;
mcsr.nFieldCount = 4;
TCHAR fields[4][512];
@@ -687,22 +686,19 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code for (; ri; ri = ri->next) {
mri = ((mwResolveResult *)ri->data)->matches;
for (; mri; mri = mri->next) {
- strncpy(mcsr.psr.stid, ((mwResolveMatch *)mri->data)->id, 256);
- mcsr.psr.stid[255] = 0;
- MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.stid, -1, mcsr.pszFields[0], 512);
+ strncpy_s(mcsr.stid, ((mwResolveMatch *)mri->data)->id, _TRUNCATE);
+ MultiByteToWideChar(CP_UTF8, 0, mcsr.stid, -1, mcsr.pszFields[0], 512);
- strncpy(mcsr.psr.name, ((mwResolveMatch *)mri->data)->name, 256);
- mcsr.psr.name[255] = 0;
- MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.name, -1, mcsr.pszFields[1], 512);
+ strncpy(mcsr.name, ((mwResolveMatch *)mri->data)->name, _TRUNCATE);
+ MultiByteToWideChar(CP_UTF8, 0, mcsr.name, -1, mcsr.pszFields[1], 512);
if (((mwResolveMatch *)mri->data)->desc)
MultiByteToWideChar(CP_UTF8, 0, ((mwResolveMatch *)mri->data)->desc, -1, mcsr.pszFields[2], 512);
else
mcsr.pszFields[2][0] = 0;
- mcsr.psr.group = (((mwResolveMatch *)mri->data)->type == mwResolveMatch_GROUP);
- //MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.name, -1, mcsr.pszFields[1], 512);
- _tcsncpy(mcsr.pszFields[3], mcsr.psr.group ? TranslateT("True") : TranslateT("False"), 512);
+ mcsr.group = (((mwResolveMatch *)mri->data)->type == mwResolveMatch_GROUP);
+ _tcsncpy_s(mcsr.pszFields[3], 512, mcsr.group ? TranslateT("True") : TranslateT("False"), _TRUNCATE);
if (advanced == TRUE)
proto->ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, (HANDLE)id, (LPARAM)&mcsr);
@@ -718,9 +714,10 @@ void mwResolve_handler_details_callback(mwServiceResolve* srvc, guint32 id, guin {
CSametimeProto* proto = getProtoFromMwServiceResolve(srvc);
- MYPROTOSEARCHRESULT mpsr = { 0 };
+ MYPROTOSEARCHRESULT mpsr;
+ memset(&mpsr, 0, sizeof(mpsr));
mpsr.cbSize = sizeof(mpsr);
- mpsr.nick = mpsr.name;
+ mpsr.nick.a = mpsr.name;
if (code == mwResolveCode_SUCCESS) {
GList *ri = results, *mri;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index e0bf3fe270..411fdbb0a4 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -377,21 +377,21 @@ void BasicSearchThread(char *nick) { psr.cbSize = sizeof(psr);
char *nextoken = 0;
for (token = strtok_r(cmd + 5, ", ", &nextoken); token; token = strtok_r(NULL, ", ", &nextoken)) {
- psr.nick = psr.id = _A2T(token);
- psr.lastName = NULL;
- psr.firstName = NULL;
- psr.email = NULL;
+ psr.nick.t = psr.id.t = _A2T(token);
+ psr.lastName.t = NULL;
+ psr.firstName.t = NULL;
+ psr.email.t = NULL;
if (ptr = SkypeGet("USER", token, "FULLNAME")) {
// We cannot use strtok() to seperate first & last name here,
// because we already use it for parsing the user list
// So we use our own function
- if (psr.lastName = _A2T(strchr(ptr, ' '))) {
- *psr.lastName = 0;
- psr.lastName++;
- LOG(("BasicSearchThread: lastName=%s", psr.lastName));
+ if (psr.lastName.t = _A2T(strchr(ptr, ' '))) {
+ *psr.lastName.t = 0;
+ psr.lastName.t++;
+ LOG(("BasicSearchThread: lastName=%s", psr.lastName.t));
}
- psr.firstName = _A2T(ptr);
- LOG(("BasicSearchThread: firstName=%s", psr.firstName));
+ psr.firstName.t = _A2T(ptr);
+ LOG(("BasicSearchThread: firstName=%s", psr.firstName.t));
}
ProtoBroadcastAck(SKYPE_PROTONAME, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)hSearchThread, (LPARAM)(PROTOSEARCHRESULT*)&psr);
if (ptr) free(ptr);
@@ -2608,9 +2608,9 @@ INT_PTR SkypeGetInfo(WPARAM, LPARAM lParam) { INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam) {
LOG(("SkypeAddToList Adding API function called"));
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (psr->cbSize != sizeof(PROTOSEARCHRESULT) || !psr->nick) return 0;
+ if (psr->cbSize != sizeof(PROTOSEARCHRESULT) || !psr->nick.t) return 0;
LOG(("SkypeAddToList OK"));
- return (INT_PTR)add_contact(_T2A(psr->nick), (DWORD)wParam);
+ return (INT_PTR)add_contact(_T2A(psr->nick.t), (DWORD)wParam);
}
INT_PTR SkypeBasicSearch(WPARAM, LPARAM lParam) {
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index bbe1dbdcf4..13b57a8ccd 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -99,7 +99,7 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) debugLogA("CSkypeProto::AddToList");
- ptrA skypeName(mir_t2a(ptrT(psr->id)));
+ ptrA skypeName(mir_t2a(ptrT(psr->id.t)));
if (skypeName == NULL)
return NULL;
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 1b77576d66..c149e45477 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -66,8 +66,8 @@ void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = tszDisplayName.GetBuffer();
- psr.nick = tszNick.GetBuffer();
+ psr.id.t = tszDisplayName.GetBuffer();
+ psr.nick.t = tszNick.GetBuffer();
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index d07dabf45f..fe55c22841 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -623,8 +623,8 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) if (hContact == NULL)
{
PROTOSEARCHRESULT psr = { 0 };
- psr.id = mir_tstrdup(szJid);
- psr.nick = mir_tstrdup(szJid);
+ psr.id.t = mir_tstrdup(szJid);
+ psr.nick.t = mir_tstrdup(szJid);
psr.flags = PSR_TCHAR;
ADDCONTACTSTRUCT acs;
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 655c0814f2..85537b886a 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -716,10 +716,10 @@ void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg ssr.hdr.cbSize = sizeof(STEAM_SEARCH_RESULT); ssr.hdr.flags = PSR_TCHAR; - ssr.hdr.id = (TCHAR*)arg; + ssr.hdr.id.t = (TCHAR*)arg; node = json_get(nroot, "personaname"); - ssr.hdr.nick = mir_wstrdup(ptrT(json_as_string(node))); + ssr.hdr.nick.t = mir_wstrdup(ptrT(json_as_string(node))); node = json_get(nroot, "realname"); if (node != NULL) @@ -730,11 +730,11 @@ void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg size_t pos = realname.find(' ', 1); if (pos != std::string::npos) { - ssr.hdr.firstName = mir_wstrdup(realname.substr(0, pos).c_str()); - ssr.hdr.lastName = mir_wstrdup(realname.substr(pos + 1).c_str()); + ssr.hdr.firstName.t = mir_wstrdup(realname.substr(0, pos).c_str()); + ssr.hdr.lastName.t = mir_wstrdup(realname.substr(pos + 1).c_str()); } else - ssr.hdr.firstName = mir_wstrdup(realname.c_str()); + ssr.hdr.firstName.t = mir_wstrdup(realname.c_str()); } } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index f4fbfb8d65..577a896979 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -70,7 +70,7 @@ CSteamProto::~CSteamProto() MCONTACT CSteamProto::AddToList(int, PROTOSEARCHRESULT* psr) { MCONTACT hContact = NULL; - ptrA steamId(mir_u2a(psr->id)); + ptrA steamId(mir_u2a(psr->id.t)); if (psr->cbSize == sizeof(PROTOSEARCHRESULT)) { if (!FindContact(steamId)) @@ -230,10 +230,10 @@ HANDLE CSteamProto::SearchBasic(const TCHAR* id) int CSteamProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) { - return (INT_PTR)AddDBEvent(hContact, EVENTTYPE_MESSAGE, pre->timestamp, DBEF_UTF, mir_strlen(pre->szMessage), (BYTE*)pre->szMessage); + return (INT_PTR)AddDBEvent(hContact, EVENTTYPE_MESSAGE, pre->timestamp, DBEF_UTF, (DWORD)mir_strlen(pre->szMessage), (BYTE*)pre->szMessage); } -int CSteamProto::SendMsg(MCONTACT hContact, int flags, const char *message) +int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message) { if (!IsOnline()) { @@ -312,26 +312,26 @@ int CSteamProto::SetStatus(int new_status) requestQueue->Start(); - ptrA token(getStringA("TokenSecret"));
- if (mir_strlen(token) > 0)
- {
- PushRequest(
- new LogonRequest(token),
- &CSteamProto::OnLoggedOn);
- }
- else
- {
- ptrA username(mir_urlEncode(ptrA(mir_utf8encodeT(getTStringA("Username")))));
- if (username == NULL || username[0] == '\0')
- {
+ ptrA token(getStringA("TokenSecret")); + if (mir_strlen(token) > 0) + { + PushRequest( + new LogonRequest(token), + &CSteamProto::OnLoggedOn); + } + else + { + ptrA username(mir_urlEncode(ptrA(mir_utf8encodeT(getTStringA("Username"))))); + if (username == NULL || username[0] == '\0') + { m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
- return 0;
- }
-
- PushRequest(
- new GetRsaKeyRequest(username),
- &CSteamProto::OnGotRsaKey);
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus); + return 0; + } + + PushRequest( + new GetRsaKeyRequest(username), + &CSteamProto::OnGotRsaKey); } } else 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;
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index c9762e2360..7ec780634d 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -63,7 +63,7 @@ DWORD_PTR CToxProto::GetCaps(int type, MCONTACT) MCONTACT CToxProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- ptrA address(mir_t2a(psr->id));
+ ptrA address(mir_t2a(psr->id.t));
ptrA myAddress(getStringA(NULL, TOX_SETTINGS_ID));
if (strnicmp(address, myAddress, TOX_PUBLIC_KEY_SIZE) == 0)
{
@@ -75,8 +75,8 @@ MCONTACT CToxProto::AddToList(int flags, PROTOSEARCHRESULT *psr) ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact);
return NULL;
}
- ptrT nick(mir_tstrdup(psr->nick));
- ptrT dnsId(mir_tstrdup(psr->email));
+ ptrT nick(mir_tstrdup(psr->nick.t));
+ ptrT dnsId(mir_tstrdup(psr->email.t));
return AddContact(address, nick, dnsId, flags & PALF_TEMPORARY);
}
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 10f2fc68f5..96581e4d8d 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -88,12 +88,12 @@ void CToxProto::SearchByNameAsync(void *arg) {
PROTOSEARCHRESULT psr = { sizeof(PROTOSEARCHRESULT) };
psr.flags = PSR_TCHAR;
- psr.id = mir_a2t(address);
- psr.nick = mir_utf8decodeT(name);
+ psr.id.t = mir_a2t(address);
+ psr.nick.t = mir_utf8decodeT(name);
TCHAR email[MAX_PATH];
- mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), psr.nick, _A2T(dnsDomain));
- psr.email = mir_tstrdup(email);
+ mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), psr.nick.t, _A2T(dnsDomain));
+ psr.email.t = mir_tstrdup(email);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
@@ -129,12 +129,12 @@ void CToxProto::SearchByNameAsync(void *arg) {
PROTOSEARCHRESULT psr = { sizeof(PROTOSEARCHRESULT) };
psr.flags = PSR_TCHAR;
- psr.id = mir_utf8decodeT(address);
- psr.nick = mir_utf8decodeT(name);
+ psr.id.t = mir_utf8decodeT(address);
+ psr.nick.t = mir_utf8decodeT(name);
TCHAR email[MAX_PATH];
- mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), psr.nick, _A2T(domain));
- psr.email = mir_tstrdup(email);
+ mir_sntprintf(email, SIZEOF(email), _T("%s@%s"), psr.nick.t, _A2T(domain));
+ psr.email.t = mir_tstrdup(email);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
break;
@@ -197,7 +197,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.id = mir_a2t(query.c_str());
+ psr.id.t = mir_a2t(query.c_str());
ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
acs.szProto = m_szModuleName;
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index e58c6ee01f..99e954b5f2 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -44,13 +44,13 @@ void TwitterProto::AddToListWorker(void *p) mir_free(name);
}
-MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *result)
+MCONTACT TwitterProto::AddToList(int, PROTOSEARCHRESULT *psr)
{
if (m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(result->nick));
- return AddToClientList(_T2A(result->nick), "");
+ ForkThread(&TwitterProto::AddToListWorker, mir_utf8encodeT(psr->nick.t));
+ return AddToClientList(_T2A(psr->nick.t), "");
}
// *************************
@@ -124,14 +124,14 @@ void TwitterProto::DoSearch(void *p) if (found) {
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
- psr.nick = mir_a2t(info.username.c_str());
- psr.firstName = mir_a2t(info.real_name.c_str());
+ psr.nick.t = mir_a2t(info.username.c_str());
+ psr.firstName.t = mir_a2t(info.real_name.c_str());
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- mir_free(psr.nick);
- mir_free(psr.firstName);
+ mir_free(psr.nick.t);
+ mir_free(psr.firstName.t);
}
else ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index ae7bb7e818..62cbf1bf7b 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -502,7 +502,7 @@ MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT* psr) {
debugLogA("CVkProto::AddToList");
- int uid = _ttoi(psr->id);
+ int uid = _ttoi(psr->id.t);
if (!uid)
return NULL;
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 2ba9be838b..1a07b0e28c 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -69,8 +69,8 @@ void CVkProto::SearchByMailThread(void* email) void __cdecl CVkProto::SearchThread(void* p)
{
PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
- - TCHAR arg[200]; +
+ TCHAR arg[200];
mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(_T("CVkProto::SearchThread %s"), arg);
if (!IsOnline())
@@ -129,19 +129,19 @@ void CVkProto::OnSearch(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Nick(jnRecord["nickname"].as_mstring());
CMString Domain(jnRecord["domain"].as_mstring());
- psr.id = mir_tstrdup(Id);
- psr.firstName = mir_tstrdup(FirstName);
- psr.lastName = mir_tstrdup(LastName);
- psr.nick = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
+ psr.id.t = mir_tstrdup(Id);
+ psr.firstName.t = mir_tstrdup(FirstName);
+ psr.lastName.t = mir_tstrdup(LastName);
+ psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Domain) : mir_tstrdup(Nick);
bool filter = true;
if (pParam) {
- if (psr.firstName && pParam->pszFirstName)
- filter = tlstrstr(psr.firstName, pParam->pszFirstName) && filter;
- if (psr.lastName && pParam->pszLastName)
- filter = tlstrstr(psr.lastName, pParam->pszLastName) && filter;
- if (psr.nick && pParam->pszNick)
- filter = tlstrstr(psr.nick, pParam->pszNick) && filter;
+ if (psr.firstName.t && pParam->pszFirstName)
+ filter = tlstrstr(psr.firstName.t, pParam->pszFirstName) && filter;
+ if (psr.lastName.t && pParam->pszLastName)
+ filter = tlstrstr(psr.lastName.t, pParam->pszLastName) && filter;
+ if (psr.nick.t && pParam->pszNick)
+ filter = tlstrstr(psr.nick.t, pParam->pszNick) && filter;
}
if (filter)
@@ -194,11 +194,11 @@ void CVkProto::OnSearchByMail(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) CMString Email(jnRecord["contact"].as_mstring());
- psr.id = mir_tstrdup(Id);
- psr.firstName = mir_tstrdup(FirstName);
- psr.lastName = mir_tstrdup(LastName);
- psr.nick = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
- psr.email = mir_tstrdup(Email);
+ psr.id.t = mir_tstrdup(Id);
+ psr.firstName.t = mir_tstrdup(FirstName);
+ psr.lastName.t = mir_tstrdup(LastName);
+ psr.nick.t = Nick.IsEmpty() ? mir_tstrdup(Email) : mir_tstrdup(Nick);
+ psr.email.t = mir_tstrdup(Email);
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
}
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index e768dde43c..1910128775 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -165,20 +165,20 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
{
- TCHAR tszFileName[MAX_PATH], filter[256]; + TCHAR tszFileName[MAX_PATH], filter[256];
BmpFilterGetStrings(filter, SIZEOF(filter));
- - OPENFILENAME ofn = { 0 }; - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - ofn.lpstrFilter = filter; - ofn.hwndOwner = 0; - ofn.lpstrFile = tszFileName; - ofn.nMaxFile = ofn.nMaxFileTitle = SIZEOF(tszFileName); - ofn.Flags = OFN_HIDEREADONLY; - ofn.lpstrInitialDir = _T("."); - ofn.lpstrDefExt = _T(""); - if (GetOpenFileName(&ofn)) - if (_taccess(tszFileName, 4) != -1) +
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.lpstrFilter = filter;
+ ofn.hwndOwner = 0;
+ ofn.lpstrFile = tszFileName;
+ ofn.nMaxFile = ofn.nMaxFileTitle = SIZEOF(tszFileName);
+ ofn.Flags = OFN_HIDEREADONLY;
+ ofn.lpstrInitialDir = _T(".");
+ ofn.lpstrDefExt = _T("");
+ if (GetOpenFileName(&ofn))
+ if (_taccess(tszFileName, 4) != -1)
InternalSetAvatar(pInfo->hContact, _T2A(pInfo->tszJid), tszFileName);
}
@@ -223,16 +223,16 @@ void WhatsAppProto::AddChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid) if (hContact && !db_get_b(hContact, "CList", "NotInList", 0))
return;
- PROTOSEARCHRESULT sr = { 0 };
- sr.cbSize = sizeof(sr);
- sr.flags = PSR_TCHAR;
- sr.id = (TCHAR*)ptszJid;
- sr.nick = GetChatUserNick(jid);
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.id.t = (TCHAR*)ptszJid;
+ psr.nick.t = GetChatUserNick(jid);
ADDCONTACTSTRUCT acs = { 0 };
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = m_szModuleName;
- acs.psr = (PROTOSEARCHRESULT*)&sr;
+ acs.psr = &psr;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)CallService(MS_CLUI_GETHWND, 0, 0), (LPARAM)&acs);
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index acf47543cd..2afe107f22 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -166,12 +166,12 @@ int WhatsAppProto::SetStatus(int new_status) return 0;
}
-MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
+MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- if (psr->id == NULL)
+ if (psr->id.t == NULL)
return NULL;
- std::string phone(T2Utf(psr->id));
+ std::string phone(T2Utf(psr->id.t));
std::string jid(phone + "@s.whatsapp.net");
MCONTACT hContact = AddToContactList(jid, phone.c_str());
@@ -190,15 +190,13 @@ void WhatsAppProto::SearchAckThread(void *targ) Sleep(100);
SearchParam *param = (SearchParam*)targ;
- PROTOSEARCHRESULT sr = { 0 };
- sr.cbSize = sizeof(sr);
- sr.flags = PSR_TCHAR;
- sr.nick = _T("");
- sr.firstName = _T("");
- sr.lastName = _T("");
- sr.id = (TCHAR*)param->jid.c_str();
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)param->id, (LPARAM)&sr);
+ PROTOSEARCHRESULT psr = { 0 };
+ psr.cbSize = sizeof(psr);
+ psr.flags = PSR_TCHAR;
+ psr.nick.t = psr.firstName.t = psr.lastName.t = _T("");
+ psr.id.t = (TCHAR*)param->jid.c_str();
+
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)param->id, (LPARAM)&psr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)param->id, 0);
delete param;
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 0978600aaf..189439fa4a 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -388,11 +388,11 @@ void XFireClient::receivedPacket(XFirePacket *packet) { XFireFoundBuddys *fb = (XFireFoundBuddys*)content;
for (uint i = 0; i < fb->usernames->size(); i++) {
if ((char*)fb->usernames->at(i).c_str() != NULL)
- psr.nick = _A2T((char*)fb->usernames->at(i).c_str());
+ psr.nick.t = _A2T((char*)fb->usernames->at(i).c_str());
if ((char*)fb->fname->at(i).c_str() != NULL)
- psr.firstName = _A2T((char*)fb->fname->at(i).c_str());
+ psr.firstName.t = _A2T((char*)fb->fname->at(i).c_str());
if ((char*)fb->lname->at(i).c_str() != NULL)
- psr.lastName = _A2T((char*)fb->lname->at(i).c_str());
+ psr.lastName.t = _A2T((char*)fb->lname->at(i).c_str());
ProtoBroadcastAck(protocolname, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)& psr);
}
@@ -3057,7 +3057,7 @@ INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam) if (myClient->client->connected)
{
InviteBuddyPacket invite;
- invite.addInviteName(std::string(_T2A(psr->nick)), Translate("Add me to your friend list."));
+ invite.addInviteName(std::string(_T2A(psr->nick.t)), Translate("Add me to your friend list."));
myClient->client->send(&invite);
}
diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index b455b61e5c..ae7ef3f0aa 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -118,7 +118,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM wParam, LPARAM lParam) acs.psr = &psr;
psr.cbSize = sizeof(PROTOSEARCHRESULT);
- psr.id = (TCHAR*)id;
+ psr.id.t = (TCHAR*)id;
CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index c757fa6fe7..f144d89c9b 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -99,7 +99,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) ////////////////////////////////////////////////////////////////////////////////////////
// AddToList - adds a contact to the contact list
-MCONTACT CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr )
+MCONTACT CYahooProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
debugLogA("[YahooAddToList] Flags: %d", flags);
@@ -108,12 +108,13 @@ MCONTACT CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) return 0;
}
- if (psr == NULL || psr->cbSize != sizeof( PROTOSEARCHRESULT )) {
+ YAHOO_SEARCH_RESULT *ysr = (YAHOO_SEARCH_RESULT*)psr;
+ if (ysr == NULL || ysr->cbSize != sizeof(YAHOO_SEARCH_RESULT)) {
debugLogA("[YahooAddToList] Empty data passed?");
return 0;
}
- char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id) : mir_utf8encode((char*)psr->id);
+ char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id.t) : mir_utf8encode((char*)psr->id.t);
MCONTACT hContact = getbuddyH(id);
if (hContact != NULL) {
if (db_get_b(hContact, "CList", "NotOnList", 0)) {
@@ -130,7 +131,7 @@ MCONTACT CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) debugLogA("[YahooAddToList] Adding Temporary Buddy:%s ", id);
}
- int protocol = psr->reserved[0];
+ int protocol = ysr->protocol;
debugLogA("Adding buddy:%s", id);
hContact = add_buddy(id, id, protocol, flags);
mir_free(id);
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 020c9c34b3..2d25f978e6 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -33,11 +33,12 @@ void __cdecl CYahooProto::search_simplethread(void *snsearch) TCHAR *c = _tcschr(id, '@');
if (c) *c = 0;
- PROTOSEARCHRESULT psr = { 0 };
+ YAHOO_SEARCH_RESULT psr;
+ memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id = (TCHAR*)_tcslwr(id);
- psr.reserved[0] = YAHOO_IM_YAHOO;
+ psr.id.t = (TCHAR*)_tcslwr(id);
+ psr.protocol = YAHOO_IM_YAHOO;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
@@ -72,10 +73,11 @@ void CYahooProto::ext_got_search_result(int found, int start, int total, YList * LOG(("Start: %d", start));
LOG(("Total: %d", total));
- PROTOSEARCHRESULT psr = { 0 };
+ YAHOO_SEARCH_RESULT psr;
+ memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.reserved[0] = YAHOO_IM_YAHOO;
+ psr.protocol = YAHOO_IM_YAHOO;
while (en) {
yct = ( yahoo_found_contact* )en->data;
@@ -84,34 +86,34 @@ void CYahooProto::ext_got_search_result(int found, int start, int total, YList * LOG(("[%d] Empty record?",i++));
} else {
LOG(("[%d] id: '%s', online: %d, age: %d, sex: '%s', location: '%s'", i++, yct->id, yct->online, yct->age, yct->gender, yct->location));
- psr.id = mir_utf8decodeT( yct->id );
+ psr.id.t = mir_utf8decodeT( yct->id );
if (yct->gender[0] != 5)
- psr.firstName = mir_utf8decodeT( yct->gender );
+ psr.firstName.t = mir_utf8decodeT( yct->gender );
else
- psr.firstName = NULL;
+ psr.firstName.t = NULL;
TCHAR c[10];
if (yct->age > 0) {
_itot(yct->age, c,10);
- psr.lastName = ( TCHAR* )c;
+ psr.lastName.t = ( TCHAR* )c;
}
else
- psr.lastName = NULL;
+ psr.lastName.t = NULL;
if (yct->location[0] != 5)
- psr.email = mir_utf8decodeT( yct->location );
+ psr.email.t = mir_utf8decodeT( yct->location );
else
- psr.email = NULL;
+ psr.email.t = NULL;
//void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
// int photo, int yahoo_only)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
- mir_free(psr.id);
- mir_free(psr.firstName);
- mir_free(psr.email);
+ mir_free(psr.id.t);
+ mir_free(psr.firstName.t);
+ mir_free(psr.email.t);
}
en = y_list_next(en);
}
@@ -173,20 +175,18 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) return;
}
- PROTOSEARCHRESULT psr = { 0 };
+ YAHOO_SEARCH_RESULT psr;
+ memset(&psr, 0, sizeof(psr));
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id = _tcslwr(searchid);
-
- int pid = SendDlgItemMessage(hwndDlg , IDC_SEARCH_PROTOCOL, CB_GETCURSEL, 0, 0);
- switch (pid) {
- case 0: psr.firstName = _T("<Yahoo >"); pid = YAHOO_IM_YAHOO; break;
- case 1: psr.firstName = _T("<Lotus Sametime>"); pid = YAHOO_IM_SAMETIME;break;
- case 2: psr.firstName = _T("<LCS>"); pid = YAHOO_IM_LCS; break;
- case 3: psr.firstName = _T("<Windows Live (MSN)>"); pid = YAHOO_IM_MSN; break;
- }
+ psr.id.t = _tcslwr(searchid);
- psr.reserved[0] = pid;
+ switch (SendDlgItemMessage(hwndDlg, IDC_SEARCH_PROTOCOL, CB_GETCURSEL, 0, 0)) {
+ case 0: psr.firstName.t = _T("<Yahoo >"); psr.protocol = YAHOO_IM_YAHOO; break;
+ case 1: psr.firstName.t = _T("<Lotus Sametime>"); psr.protocol = YAHOO_IM_SAMETIME; break;
+ case 2: psr.firstName.t = _T("<LCS>"); psr.protocol = YAHOO_IM_LCS; break;
+ case 3: psr.firstName.t = _T("<Windows Live (MSN)>"); psr.protocol = YAHOO_IM_MSN; break;
+ }
/*
* Show this in results
diff --git a/protocols/Yahoo/src/yahoo.h b/protocols/Yahoo/src/yahoo.h index 214c77fb43..758918768f 100644 --- a/protocols/Yahoo/src/yahoo.h +++ b/protocols/Yahoo/src/yahoo.h @@ -105,6 +105,11 @@ extern HINSTANCE hInstance; extern int iHTTPGateway;
#endif
+struct YAHOO_SEARCH_RESULT : public PROTOSEARCHRESULT
+{
+ yahoo_im_protocols protocol;
+};
+
#define YAHOO_hasnotification() ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)
int YAHOO_util_dbsettingchanged(WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index d0028ee77f..0c905b1c52 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -52,11 +52,11 @@ public: if (m_acs.psr) {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)mir_alloc(m_acs.psr->cbSize);
memcpy(psr, m_acs.psr, m_acs.psr->cbSize);
- psr->nick = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick);
- psr->firstName = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName);
- psr->lastName = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName);
- psr->email = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email);
- psr->id = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id);
+ psr->nick.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t);
+ psr->firstName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t);
+ psr->lastName.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t);
+ psr->email.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t);
+ psr->id.t = (psr->flags & PSR_UNICODE) ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t);
psr->flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR;
m_acs.psr = psr;
}
@@ -98,7 +98,7 @@ public: }
if (!isSet) {
szName = (m_acs.handleType == HANDLE_EVENT) ? (tmpStr = mir_a2t(szUin)) :
- (m_acs.psr->id ? m_acs.psr->id : m_acs.psr->nick);
+ (m_acs.psr->id.t ? m_acs.psr->id.t : m_acs.psr->nick.t);
}
}
@@ -152,10 +152,10 @@ public: Window_FreeIcon_IcoLib(m_hwnd);
if (m_acs.psr) {
- mir_free(m_acs.psr->nick);
- mir_free(m_acs.psr->firstName);
- mir_free(m_acs.psr->lastName);
- mir_free(m_acs.psr->email);
+ mir_free(m_acs.psr->nick.t);
+ mir_free(m_acs.psr->firstName.t);
+ mir_free(m_acs.psr->lastName.t);
+ mir_free(m_acs.psr->email.t);
mir_free(m_acs.psr);
}
}
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index f031259d37..82820806e6 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -772,7 +772,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id = str; + psr.id.t = str; acs.psr = &psr; acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, @@ -801,7 +801,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_CONTEXTMENU: { - POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; LVHITTESTINFO lvhti; lvhti.pt = pt; @@ -872,19 +872,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP /* Next block is not needed but behavior will be kept */ bool isUnicode = (psr->flags & PSR_UNICODE) != 0; - if (psr->id) { - BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id, 25) : IsBadStringPtrA((char*)psr->id, 25); + if (psr->id.t) { + BOOL validPtr = isUnicode ? IsBadStringPtrW((wchar_t*)psr->id.t, 25) : IsBadStringPtrA((char*)psr->id.t, 25); if (!validPtr) { isUnicode = false; - lsr->psr.id = NULL; + lsr->psr.id.t = NULL; } - else lsr->psr.id = isUnicode ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id); + else lsr->psr.id.t = isUnicode ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t); } - lsr->psr.nick = isUnicode ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); - lsr->psr.firstName = isUnicode ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); - lsr->psr.lastName = isUnicode ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); - lsr->psr.email = isUnicode ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email); + lsr->psr.nick.t = isUnicode ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t); + lsr->psr.firstName.t = isUnicode ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t); + lsr->psr.lastName.t = isUnicode ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t); + lsr->psr.email.t = isUnicode ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t); lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR; LVITEM lvi = { 0 }; @@ -920,11 +920,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->bFlexSearchResult = FALSE; memcpy(&lsr->psr, psr, psr->cbSize); - lsr->psr.nick = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick) : mir_a2t((char*)psr->nick); - lsr->psr.firstName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName) : mir_a2t((char*)psr->firstName); - lsr->psr.lastName = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName) : mir_a2t((char*)psr->lastName); - lsr->psr.email = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->email) : mir_a2t((char*)psr->email); - lsr->psr.id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->id) : mir_a2t((char*)psr->id); + lsr->psr.nick.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->nick.t) : mir_a2t((char*)psr->nick.t); + lsr->psr.firstName.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->firstName.t) : mir_a2t((char*)psr->firstName.t); + lsr->psr.lastName.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->lastName.t) : mir_a2t((char*)psr->lastName.t); + lsr->psr.email.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->email.t) : mir_a2t((char*)psr->email.t); + lsr->psr.id.t = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)psr->id.t) : mir_a2t((char*)psr->id.t); lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR; LVITEM lvi = { 0 }; @@ -944,11 +944,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP } int iItem = ListView_InsertItem(hwndList, &lvi); int col = 1; - SetListItemText(hwndList, iItem, col++, lsr->psr.id); - SetListItemText(hwndList, iItem, col++, lsr->psr.nick); - SetListItemText(hwndList, iItem, col++, lsr->psr.firstName); - SetListItemText(hwndList, iItem, col++, lsr->psr.lastName); - SetListItemText(hwndList, iItem, col++, lsr->psr.email); + SetListItemText(hwndList, iItem, col++, lsr->psr.id.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.nick.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.firstName.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.lastName.t); + SetListItemText(hwndList, iItem, col++, lsr->psr.email.t); SetStatusBarResultInfo(hwndDlg); } } diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 20b9cc344c..9ab089c02b 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -136,15 +136,15 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa case COLUMNID_PROTO:
return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier;
case COLUMNID_HANDLE:
- return mir_tstrcmpi(lsr1->psr.id, lsr2->psr.id)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.id.t, lsr2->psr.id.t)*sortMultiplier;
case COLUMNID_NICK:
- return mir_tstrcmpi(lsr1->psr.nick, lsr2->psr.nick)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.nick.t, lsr2->psr.nick.t)*sortMultiplier;
case COLUMNID_FIRST:
- return mir_tstrcmpi(lsr1->psr.firstName, lsr2->psr.firstName)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.firstName.t, lsr2->psr.firstName.t)*sortMultiplier;
case COLUMNID_LAST:
- return mir_tstrcmpi(lsr1->psr.lastName, lsr2->psr.lastName)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.lastName.t, lsr2->psr.lastName.t)*sortMultiplier;
case COLUMNID_EMAIL:
- return mir_tstrcmpi(lsr1->psr.email, lsr2->psr.email)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.email.t, lsr2->psr.email.t)*sortMultiplier;
}
}
else {
@@ -165,11 +165,11 @@ void FreeSearchResults(HWND hwndResults) ListView_GetItem(hwndResults, &lvi);
struct ListSearchResult *lsr = (struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
- mir_free(lsr->psr.id);
- mir_free(lsr->psr.email);
- mir_free(lsr->psr.nick);
- mir_free(lsr->psr.firstName);
- mir_free(lsr->psr.lastName);
+ mir_free(lsr->psr.id.t);
+ mir_free(lsr->psr.email.t);
+ mir_free(lsr->psr.nick.t);
+ mir_free(lsr->psr.firstName.t);
+ mir_free(lsr->psr.lastName.t);
mir_free(lsr);
}
ListView_DeleteAllItems(hwndResults);
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index a3108365bf..b209ce9d38 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -356,21 +356,19 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
else {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
memcpy(psra, psr, psr->cbSize);
- psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
- psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
- psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
- psra->email = (PROTOCHAR*)mir_u2a(psr->email);
+ psra->nick.a = mir_u2a(psr->nick.t);
+ psra->firstName.a = mir_u2a(psr->firstName.t);
+ psra->lastName.a = mir_u2a(psr->lastName.t);
+ psra->email.a = mir_u2a(psr->email.t);
INT_PTR res = (INT_PTR)ppi->AddToList(wParam, psra);
- mir_free(psra->nick);
- mir_free(psra->firstName);
- mir_free(psra->lastName);
- mir_free(psra->email);
- mir_free(psra);
-
+ mir_free(psra->nick.a);
+ mir_free(psra->firstName.a);
+ mir_free(psra->lastName.a);
+ mir_free(psra->email.a);
return res;
}
@@ -516,20 +514,19 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char if (!mir_strcmp(szService, PS_ADDTOLIST)) {
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
if (!(psr->flags & PSR_UNICODE)) {
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)mir_alloc(psr->cbSize);
+ PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
memcpy(psra, psr, psr->cbSize);
- psra->nick = (PROTOCHAR*)mir_u2a(psr->nick);
- psra->firstName = (PROTOCHAR*)mir_u2a(psr->firstName);
- psra->lastName = (PROTOCHAR*)mir_u2a(psr->lastName);
- psra->email = (PROTOCHAR*)mir_u2a(psr->email);
+ psra->nick.a = mir_u2a(psr->nick.t);
+ psra->firstName.a = mir_u2a(psr->firstName.t);
+ psra->lastName.a = mir_u2a(psr->lastName.t);
+ psra->email.a = mir_u2a(psr->email.t);
INT_PTR res = ProtoCallService(szModule, szService, wParam, (LPARAM)psra);
- mir_free(psra->nick);
- mir_free(psra->firstName);
- mir_free(psra->lastName);
- mir_free(psra->email);
- mir_free(psra);
+ mir_free(psra->nick.a);
+ mir_free(psra->firstName.a);
+ mir_free(psra->lastName.a);
+ mir_free(psra->email.a);
return res;
}
}
|