summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
commit2f261839b60692e33d0e160344d0d636d49c90ba (patch)
tree187921722698b681d29df3f6e60fb18394a5e9d5 /protocols/WhatsApp
parent2e931a0b2780587d85f3902468c935f5adba70c8 (diff)
less TCHARs
git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/avatars.cpp4
-rw-r--r--protocols/WhatsApp/src/chat.cpp42
-rw-r--r--protocols/WhatsApp/src/contacts.cpp6
-rw-r--r--protocols/WhatsApp/src/dialogs.cpp4
-rw-r--r--protocols/WhatsApp/src/main.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp14
-rw-r--r--protocols/WhatsApp/src/proto.h4
-rw-r--r--protocols/WhatsApp/src/utils.cpp4
-rw-r--r--protocols/WhatsApp/src/utils.h2
9 files changed, 41 insertions, 41 deletions
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp
index e1839586e6..536602bcb2 100644
--- a/protocols/WhatsApp/src/avatars.cpp
+++ b/protocols/WhatsApp/src/avatars.cpp
@@ -102,8 +102,8 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const
wchar_t tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
if (hContact == NULL) {
- mir_sntprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
- mir_sntprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
+ mir_snwprintf(tszMyFile, L"%s\\myavatar.jpg", m_tszAvatarFolder.c_str());
+ mir_snwprintf(tszTempFile, L"%s\\myavatar.preview.jpg", m_tszAvatarFolder.c_str());
}
else {
std::wstring tszContactAva = GetAvatarFileName(hContact);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index f33a628461..26a46bec48 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -146,7 +146,7 @@ void WhatsAppProto::ChatLogMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch)
void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo)
{
CMString title(FORMAT, TranslateT("Set new subject for %s"), pInfo->tszNick);
- ptrT tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ ptrW tszOldValue(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
ENTER_STRING es = { 0 };
es.cbSize = sizeof(es);
@@ -207,7 +207,7 @@ void WhatsAppProto::NickListMenuHook(WAChatInfo *pInfo, struct GCHOOK *gch)
break;
case IDM_CPY_NICK:
- utils::copyText(pcli->hwndContactList, ptrT(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
+ utils::copyText(pcli->hwndContactList, ptrW(GetChatUserNick(std::string((char*)_T2A(gch->ptszUID)))));
break;
case IDM_CPY_RJID:
@@ -253,7 +253,7 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const wchar_t *ptszJid)
int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM)
{
if (isChatRoom(hContact) && isOnline()) {
- ptrT tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
+ ptrW tszID(getTStringA(hContact, WHATSAPP_KEY_ID));
if (tszID)
m_pConnection->sendJoinLeaveGroup(_T2A(tszID), false);
}
@@ -333,12 +333,12 @@ wchar_t* WhatsAppProto::GetChatUserNick(const std::string &jid)
wchar_t* tszNick;
if (m_szJid != jid) {
MCONTACT hContact = ContactIDToHContact(jid);
- tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_tstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
+ tszNick = (hContact == 0) ? utils::removeA(str2t(jid)) : mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
}
else tszNick = str2t(m_szNick);
if (tszNick == NULL)
- tszNick = mir_tstrdup(TranslateT("Unknown user"));
+ tszNick = mir_wstrdup(TranslateT("Unknown user"));
return tszNick;
}
@@ -393,9 +393,9 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg)
msg += pMsg.media_url;
}
- ptrT tszText(str2t(msg));
- ptrT tszUID(str2t(pMsg.remote_resource));
- ptrT tszNick(GetChatUserNick(pMsg.remote_resource));
+ ptrW tszText(str2t(msg));
+ ptrW tszUID(str2t(pMsg.remote_resource));
+ ptrW tszNick(GetChatUserNick(pMsg.remote_resource));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
@@ -418,13 +418,13 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string
if (pInfo == NULL)
return;
- ptrT tszText(str2t(newSubject));
- ptrT tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
- if (!mir_tstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
+ ptrW tszText(str2t(newSubject));
+ ptrW tszTextDb(getTStringA(pInfo->hContact, WHATSAPP_KEY_NICK));
+ if (!mir_wstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
return;
- ptrT tszUID(str2t(author));
- ptrT tszNick(GetChatUserNick(author));
+ ptrW tszUID(str2t(author));
+ ptrW tszNick(GetChatUserNick(author));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
@@ -445,8 +445,8 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u
if (pInfo == NULL || !pInfo->bActive)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -464,8 +464,8 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string
if (pInfo == NULL)
return;
- ptrT tszUID(str2t(ujid));
- ptrT tszNick(GetChatUserNick(ujid));
+ ptrW tszUID(str2t(ujid));
+ ptrW tszNick(GetChatUserNick(ujid));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
@@ -505,8 +505,8 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector
for (size_t i = 0; i < participants.size(); i++) {
std::string curr = participants[i];
- ptrT ujid(str2t(curr)), nick(GetChatUserNick(curr));
- bool bIsOwner = !mir_tstrcmp(ujid, pInfo->tszOwner);
+ ptrW ujid(str2t(curr)), nick(GetChatUserNick(curr));
+ bool bIsOwner = !mir_wstrcmp(ujid, pInfo->tszOwner);
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
@@ -538,8 +538,8 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg)
if (p == pInfo->m_unsentMsgs.end())
return;
- ptrT tszUID(str2t(m_szJid));
- ptrT tszNick(str2t(m_szNick));
+ ptrW tszUID(str2t(m_szJid));
+ ptrW tszNick(str2t(m_szNick));
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index 2c9f0c17e9..8026cc0912 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -21,7 +21,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new
if (oldName.compare(string(new_name)) != 0) {
db_set_utf(hContact, m_szModuleName, WHATSAPP_KEY_NICK, new_name);
- CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrT(mir_utf8decodeT(new_name)));
+ CMString tmp(FORMAT, TranslateT("is now known as '%s'"), ptrW(mir_utf8decodeW(new_name)));
this->NotifyEvent(_A2T(oldName.c_str()), tmp, hContact, WHATSAPP_EVENT_OTHER);
}
}
@@ -74,8 +74,8 @@ void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client)
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (reset_client) {
- ptrT tszMirVer(getTStringA(hContact, "MirVer"));
- if (mir_tstrcmp(tszMirVer, L"WhatsApp"))
+ ptrW tszMirVer(getTStringA(hContact, "MirVer"));
+ if (mir_wstrcmp(tszMirVer, L"WhatsApp"))
setTString(hContact, "MirVer", L"WhatsApp");
db_set_ws(hContact, "CList", "StatusMsg", L"");
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp
index 501a09151a..6a86685895 100644
--- a/protocols/WhatsApp/src/dialogs.cpp
+++ b/protocols/WhatsApp/src/dialogs.cpp
@@ -113,8 +113,8 @@ public:
virtual void OnApply()
{
- ptrT tszGroup(m_group.GetText());
- if (mir_tstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
+ ptrW tszGroup(m_group.GetText());
+ if (mir_wstrcmp(m_proto->m_tszDefaultGroup, tszGroup))
m_proto->m_tszDefaultGroup = tszGroup.detach();
if (m_proto->isOnline())
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp
index f3e7513339..7cc94409ea 100644
--- a/protocols/WhatsApp/src/main.cpp
+++ b/protocols/WhatsApp/src/main.cpp
@@ -26,7 +26,7 @@ PLUGININFOEX pluginInfo = {
static int compare_protos(const WhatsAppProto *p1, const WhatsAppProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<WhatsAppProto> g_Instances(1, compare_protos);
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 56c0d3571e..e40588f0cc 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -33,7 +33,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username)
// Create standard network connection
wchar_t descr[512];
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -42,7 +42,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username)
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
wchar_t error[200];
- mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
+ mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -54,7 +54,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username)
CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
if (m_tszDefaultGroup == NULL)
- m_tszDefaultGroup = mir_tstrdup(L"WhatsApp");
+ m_tszDefaultGroup = mir_wstrdup(L"WhatsApp");
Clist_GroupCreate(0, m_tszDefaultGroup);
SetAllContactStatuses(ID_STATUS_OFFLINE, true);
@@ -368,8 +368,8 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, wchar_t* url)
{
- wchar_t *rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
- wchar_t *rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
+ wchar_t *rawTitle = mir_a2u_cp(title.c_str(), CP_UTF8);
+ wchar_t *rawInfo = mir_a2u_cp(info.c_str(), CP_UTF8);
NotifyEvent(rawTitle, rawInfo, contact, flags, url);
mir_free(rawTitle);
mir_free(rawInfo);
@@ -415,8 +415,8 @@ void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONT
pd.lchIcon = IcoLib_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = PopupDlgProc;
- mir_tstrcpy(pd.lptzContactName, title);
- mir_tstrcpy(pd.lptzText, info);
+ mir_wstrcpy(pd.lptzContactName, title);
+ mir_wstrcpy(pd.lptzText, info);
ret = PUAddPopupT(&pd);
if (ret == 0)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 04a557f893..f885369ddf 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -14,7 +14,7 @@ struct WAChatInfo
}
map<std::string, std::wstring> m_unsentMsgs;
- ptrT tszJid, tszNick, tszOwner;
+ ptrW tszJid, tszNick, tszOwner;
bool bActive;
MCONTACT hContact;
@@ -93,7 +93,7 @@ public:
std::vector<string> m_szInviteJids;
map<std::string, WAChatInfo*> m_chats;
mir_cs m_csChats;
- ptrT m_tszDefaultGroup;
+ ptrW m_tszDefaultGroup;
void ChatLogMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
void NickListMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index 71a33dc2fd..c131dda0f8 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -18,8 +18,8 @@ void utils::copyText(HWND hwnd, const wchar_t *text)
return;
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1));
- mir_tstrcpy((wchar_t*)GlobalLock(hMem), text);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_wstrlen(text) + 1));
+ mir_wstrcpy((wchar_t*)GlobalLock(hMem), text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h
index 333860c1dd..eddd9fab45 100644
--- a/protocols/WhatsApp/src/utils.h
+++ b/protocols/WhatsApp/src/utils.h
@@ -28,7 +28,7 @@ public:
std::string getLastErrorMsg();
__forceinline wchar_t* str2t(const std::string &str)
-{ return mir_utf8decodeT(str.c_str());
+{ return mir_utf8decodeW(str.c_str());
}
std::vector<std::string> split(const std::string &s, char delim);