diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-04 18:05:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-04 18:05:38 +0300 |
commit | c4c1ce437199d554133859c635c3b986f1b353a9 (patch) | |
tree | 3a42f02723d5cb8d578bd7a21e1fc672cb700fdb /protocols | |
parent | 98786d882525db4b506eddb011901c60d51857ac (diff) |
fixes #3333 (Tox: search in Find/Add contacts tries to search any random input)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 10 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 36 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_search.cpp | 4 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime_proto.h | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 6 | ||||
-rw-r--r-- | protocols/Tox/src/tox_search.cpp | 12 |
11 files changed, 41 insertions, 41 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index cf5bd0671f..6f0ff667bb 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -301,13 +301,13 @@ void CDiscordProto::SearchThread(void *param) psr.firstName.w = L"";
psr.lastName.w = L"";
psr.id.w = L"";
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, this, (LPARAM)&psr);
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, this, 0);
mir_free(param);
}
-HWND CDiscordProto::SearchAdvanced(HWND hwndDlg)
+HANDLE CDiscordProto::SearchAdvanced(HWND hwndDlg)
{
if (!m_bOnline || !IsWindow(hwndDlg))
return nullptr;
@@ -322,7 +322,7 @@ HWND CDiscordProto::SearchAdvanced(HWND hwndDlg) return nullptr;
ForkThread(&CDiscordProto::SearchThread, mir_wstrdup(wszNick));
- return (HWND)1;
+ return this;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -332,7 +332,7 @@ void CDiscordProto::OnReceiveUserinfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques {
JsonReply root(pReply);
if (!root) {
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
+ ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_FAILED, this);
return;
}
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index dd69f60e20..bf13191c49 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -353,7 +353,7 @@ public: INT_PTR GetCaps(int, MCONTACT = 0) override;
HWND CreateExtendedSearchUI(HWND owner) override;
- HWND SearchAdvanced(HWND owner) override;
+ HANDLE SearchAdvanced(HWND owner) override;
HANDLE SearchBasic(const wchar_t *id) override;
MCONTACT AddToList(int flags, PROTOSEARCHRESULT *psr) override;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index b2ed4ed067..e407fa0672 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -253,8 +253,8 @@ HANDLE GaduProto::SearchBasic(const wchar_t *id) #ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 10 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1, 0);
- return (HANDLE)1;
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this, 0);
+ return this;
}
// Add uin and search it
@@ -267,13 +267,13 @@ HANDLE GaduProto::SearchBasic(const wchar_t *id) #ifdef DEBUGMODE
debugLogA("SearchBasic(): ForkThread 11 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1, 0);
- return (HANDLE)1;
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this, 0);
+ return this;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1);
debugLogA("SearchBasic(): Seq %d.", req->seq);
gg_pubdir50_free(req);
- return (HANDLE)1;
+ return this;
}
//////////////////////////////////////////////////////////
@@ -293,8 +293,8 @@ HANDLE GaduProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, co #ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 12 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
- return (HANDLE)1;
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this);
+ return this;
}
// Add nick,firstName,lastName and search it
@@ -334,7 +334,7 @@ HANDLE GaduProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, co #ifdef DEBUGMODE
debugLogA("SearchByName(): ForkThread 13 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this);
}
else
{
@@ -343,13 +343,13 @@ HANDLE GaduProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, co }
gg_pubdir50_free(req);
- return (HANDLE)1;
+ return this;
}
//////////////////////////////////////////////////////////
// search by advanced
-//
-HWND GaduProto::SearchAdvanced(HWND hwndDlg)
+
+HANDLE GaduProto::SearchAdvanced(HWND hwndDlg)
{
// Check if connected
if (!isonline())
@@ -360,8 +360,8 @@ HWND GaduProto::SearchAdvanced(HWND hwndDlg) #ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 14 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
- return (HWND)1;
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this);
+ return this;
}
CMStringA szQuery;
@@ -470,15 +470,15 @@ HWND GaduProto::SearchAdvanced(HWND hwndDlg) #ifdef DEBUGMODE
debugLogA("SearchAdvanced(): ForkThread 15 GaduProto::searchthread");
#endif
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
- return (HWND)1;
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this);
+ return this;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 2, "sess_mutex", 1);
}
debugLogA("SearchAdvanced(): Seq %d.", req->seq);
gg_pubdir50_free(req);
- return (HWND)1;
+ return this;
}
//////////////////////////////////////////////////////////
@@ -567,7 +567,7 @@ void __cdecl GaduProto::getawaymsgthread(void *arg) gg_sleep(100, FALSE, "getawaymsgthread", 106, 1);
ptrW wszMsg(db_get_wsa(hContact, "CList", "StatusMsg"));
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, wszMsg);
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, this, wszMsg);
}
HANDLE GaduProto::GetAwayMsg(MCONTACT hContact)
@@ -576,7 +576,7 @@ HANDLE GaduProto::GetAwayMsg(MCONTACT hContact) debugLogA("GetAwayMsg(): ForkThread 17 GaduProto::getawaymsgthread");
#endif
ForkThread(&GaduProto::getawaymsgthread, (void*)hContact);
- return (HANDLE)1;
+ return this;
}
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 7a49e3901a..526d0edf07 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -42,7 +42,7 @@ struct GaduProto : public PROTO<GaduProto> HANDLE SearchBasic(const wchar_t* id) override;
HANDLE SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) override;
- HWND SearchAdvanced(HWND owner) override;
+ HANDLE SearchAdvanced(HWND owner) override;
HWND CreateExtendedSearchUI(HWND owner) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles) override;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 50415aef70..7d0496040a 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -132,7 +132,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE SearchBasic(const wchar_t *id) override;
HANDLE SearchByEmail(const wchar_t *email) override;
HANDLE SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) override;
- HWND SearchAdvanced(HWND owner) override;
+ HANDLE SearchAdvanced(HWND owner) override;
HWND CreateExtendedSearchUI(HWND owner) override;
int SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) override;
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 5102211399..98d418a548 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -712,7 +712,7 @@ HWND CJabberProto::CreateExtendedSearchUI(HWND parent) //////////////////////////////////////////////////////////////////////////
// The function formats request to server
-HWND CJabberProto::SearchAdvanced(HWND hwndDlg)
+HANDLE CJabberProto::SearchAdvanced(HWND hwndDlg)
{
if (!m_bJabberOnline || !hwndDlg)
return nullptr; //error
@@ -759,7 +759,7 @@ HWND CJabberProto::SearchAdvanced(HWND hwndDlg) if (fRequestNotEmpty) {
m_ThreadInfo->send(iq);
- return (HWND)pInfo->GetIqId();
+ return (HANDLE)pInfo->GetIqId();
}
return nullptr;
}
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 3cdd972398..1ca043c75a 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -145,12 +145,12 @@ HANDLE CSametimeProto::SearchBasic(const wchar_t* id) ///TODO - add timeout (like at GGPROTO::searchthread)
}
-HWND CSametimeProto::SearchAdvanced(HWND owner)
+HANDLE CSametimeProto::SearchAdvanced(HWND owner)
{
wchar_t buf[512];
if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
debugLogW(L"CSametimeProto::SearchAdvanced() buf:len=[%d]", mir_wstrlen(buf));
- return (HWND)SearchForUser(T2Utf(buf), TRUE);
+ return (HANDLE)SearchForUser(T2Utf(buf), TRUE);
}
return nullptr;
}
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 0105d33a39..036ca4d2c0 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -21,7 +21,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> int GetInfo(MCONTACT hContact, int infoType) override;
HANDLE SearchBasic(const wchar_t* id) override;
- HWND SearchAdvanced(HWND owner) override;
+ HANDLE SearchAdvanced(HWND owner) override;
HWND CreateExtendedSearchUI(HWND owner) override;
int RecvFile(MCONTACT hContact, PROTORECVFILE*) override;
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 4d29655855..d2e236cbd8 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -134,7 +134,7 @@ int CToxProto::FileResume(HANDLE hTransfer, int action, const wchar_t *szFilenam return OnFileResume(m_tox, hTransfer, action, szFilename);
}
-HWND CToxProto::SearchAdvanced(HWND owner)
+HANDLE CToxProto::SearchAdvanced(HWND owner)
{
return OnSearchAdvanced(owner);
}
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 2a6e485932..944675a71b 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -32,7 +32,7 @@ public: INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
- HWND SearchAdvanced(HWND owner) override;
+ HANDLE SearchAdvanced(HWND owner) override;
HWND CreateExtendedSearchUI(HWND owner) override;
int SendMsg(MCONTACT hContact, int flags, const char *msg) override;
@@ -169,8 +169,8 @@ private: static INT_PTR CALLBACK SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- HWND __cdecl OnSearchAdvanced(HWND owner);
- HWND __cdecl OnCreateExtendedSearchUI(HWND owner);
+ HANDLE OnSearchAdvanced(HWND owner);
+ HWND OnCreateExtendedSearchUI(HWND owner);
// messages
std::map<uint64_t, UINT> messages;
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 0748c0be8f..96f3de2dc6 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -45,10 +45,10 @@ void CToxProto::SearchByNameAsync(void *arg) mir_snprintf(email, "%s@toxme.io", name);
psr.email.a = mir_strdup(email);
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, this, (LPARAM)&psr);
}
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
+ ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, this, 0);
mir_free(arg);
}
@@ -73,7 +73,7 @@ INT_PTR CToxProto::SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM, LPARAM lParam) return FALSE;
}
-HWND CToxProto::OnSearchAdvanced(HWND owner)
+HANDLE CToxProto::OnSearchAdvanced(HWND owner)
{
if (!IsOnline()) {
// we cannot add someone to friend list while tox is offline
@@ -93,16 +93,16 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) psr.id.a = mir_strdup(query.c_str());
Contact::AddBySearch(m_szModuleName, &psr, owner);
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, this);
}
else {
regex = "^\\s*(([^ @/:;()\"']+)(@[A-Za-z]+.[A-Za-z]{2,6})?)\\s*$";
if (std::regex_search(query, match, regex))
ForkThread(&CToxProto::SearchByNameAsync, mir_strdup(query.c_str()));
else
- ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1);
+ ProtoBroadcastAsync(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, this, (LPARAM)TranslateT("Invalid search string"));
}
- return (HWND)1;
+ return (HWND)this;
}
HWND CToxProto::OnCreateExtendedSearchUI(HWND owner)
|