summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-31 11:46:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-31 11:46:05 +0000
commit1ce3da1cca093143d9629bc46e221dd8be962e12 (patch)
treeb99d12d635a65f8c78499137137df2bd591b50be /protocols/WhatsApp/src
parent03512ff2ed0f3d1ed6857ee85b0eb7268931ec3f (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/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/chat.cpp38
-rw-r--r--protocols/WhatsApp/src/proto.cpp22
2 files changed, 29 insertions, 31 deletions
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;