diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-31 11:46:05 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-31 11:46:05 +0000 |
commit | 1ce3da1cca093143d9629bc46e221dd8be962e12 (patch) | |
tree | b99d12d635a65f8c78499137137df2bd591b50be /protocols/Yahoo/src | |
parent | 03512ff2ed0f3d1ed6857ee85b0eb7268931ec3f (diff) |
- MAllStrings: a handy union to hold an incoming string parameter of any type;
- FNAMECHAR: atavism extincted;
- PROTOSEARCHRESULT: structure prepared to use results of any type, including utf
git-svn-id: http://svn.miranda-ng.org/main/trunk@13932 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Yahoo/src')
-rw-r--r-- | protocols/Yahoo/src/links.cpp | 2 | ||||
-rw-r--r-- | protocols/Yahoo/src/proto.cpp | 9 | ||||
-rw-r--r-- | protocols/Yahoo/src/search.cpp | 52 | ||||
-rw-r--r-- | protocols/Yahoo/src/yahoo.h | 5 |
4 files changed, 37 insertions, 31 deletions
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);
|