summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-26 09:20:25 +0000
commit6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch)
tree2e8bb660c908b54914abd562af8aafa4a486c846 /protocols/FacebookRM
parenta61c8728b379057fe7f0a0d86fe0b037598229dd (diff)
less TCHARs:
- TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/avatars.cpp20
-rw-r--r--protocols/FacebookRM/src/chat.cpp18
-rw-r--r--protocols/FacebookRM/src/client.h4
-rw-r--r--protocols/FacebookRM/src/communication.cpp20
-rw-r--r--protocols/FacebookRM/src/contacts.cpp6
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp8
-rw-r--r--protocols/FacebookRM/src/entities.h14
-rw-r--r--protocols/FacebookRM/src/events.cpp6
-rw-r--r--protocols/FacebookRM/src/json.cpp12
-rw-r--r--protocols/FacebookRM/src/main.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp4
-rw-r--r--protocols/FacebookRM/src/process.cpp24
-rw-r--r--protocols/FacebookRM/src/proto.cpp70
-rw-r--r--protocols/FacebookRM/src/proto.h20
14 files changed, 114 insertions, 114 deletions
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index b85699b520..c41c7026d5 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -33,19 +33,19 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai, std::string *
utils::text::replace_first(url, "%s", std::string(id));
}
- std::tstring filename = GetAvatarFolder() + _T('\\') + std::tstring(_A2T(id)) + L".jpg";
+ std::wstring filename = GetAvatarFolder() + L'\\' + std::wstring(_A2T(id)) + L".jpg";
- _tcsncpy_s(pai.filename, filename.c_str(), _TRUNCATE);
+ wcsncpy_s(pai.filename, filename.c_str(), _TRUNCATE);
pai.format = ProtoGetAvatarFormat(pai.filename);
return true;
}
void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &image_url)
{
- std::tstring::size_type pos = image_url.rfind("/");
+ std::wstring::size_type pos = image_url.rfind("/");
// Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts)
- if (image_url.empty() || pos == std::tstring::npos)
+ if (image_url.empty() || pos == std::wstring::npos)
return;
// Get name of image
@@ -53,7 +53,7 @@ void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &imag
// Remove eventual parameters from name
pos = image_name.rfind("?");
- if (pos != std::tstring::npos)
+ if (pos != std::wstring::npos)
image_name = image_name.substr(0, pos);
// Append our parameters to allow comparing for avatar/settings change
@@ -123,9 +123,9 @@ void FacebookProto::UpdateAvatarWorker(void *)
Netlib_CloseHandle(nlc);
}
-std::tstring FacebookProto::GetAvatarFolder()
+std::wstring FacebookProto::GetAvatarFolder()
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
@@ -180,7 +180,7 @@ INT_PTR FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
if (GetDbAvatarInfo(*pai, NULL))
{
- bool fileExist = _taccess(pai->filename, 0) == 0;
+ bool fileExist = _waccess(pai->filename, 0) == 0;
bool needLoad;
if (pai->hContact)
@@ -216,13 +216,13 @@ INT_PTR FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
if (!wParam || !lParam)
return -3;
- TCHAR* buf = (TCHAR*)wParam;
+ wchar_t* buf = (wchar_t*)wParam;
int size = (int)lParam;
PROTO_AVATAR_INFORMATION ai = { 0 };
switch (GetAvatarInfo(0, (LPARAM)&ai)) {
case GAIR_SUCCESS:
- _tcsncpy(buf, ai.filename, size);
+ wcsncpy(buf, ai.filename, size);
buf[size - 1] = 0;
return 0;
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index a5a94c2d06..9901e6896e 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -244,7 +244,7 @@ bool FacebookProto::IsChatContact(const char *chat_id, const char *id)
return (users != NULL && strstr(users, id) != NULL);
}
-void FacebookProto::AddChat(const char *id, const TCHAR *tname)
+void FacebookProto::AddChat(const char *id, const wchar_t *tname)
{
ptrT tid(mir_a2t(id));
@@ -377,8 +377,8 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{
static const struct gc_item Items[] =
{
- { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
- { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
+ { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE },
+ { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
@@ -389,10 +389,10 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{
/*static const struct gc_item Items[] =
{
- { LPGENT("User &details"), 10, MENU_ITEM, FALSE },
- { LPGENT("User &history"), 20, MENU_ITEM, FALSE },
+ { LPGENW("User &details"), 10, MENU_ITEM, FALSE },
+ { LPGENW("User &history"), 20, MENU_ITEM, FALSE },
{ L"", 100, MENU_SEPARATOR, FALSE },
- { LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
+ { LPGENW("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;*/
@@ -403,8 +403,8 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{
static const struct gc_item Items[] =
{
- { LPGENT("User &details"), 10, MENU_ITEM, FALSE },
- { LPGENT("User &history"), 20, MENU_ITEM, FALSE }
+ { LPGENW("User &details"), 10, MENU_ITEM, FALSE },
+ { LPGENW("User &history"), 20, MENU_ITEM, FALSE }
};
gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
@@ -429,7 +429,7 @@ void FacebookProto::PrepareNotificationsChatRoom() {
// Prepare notifications chatroom if not exists
MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM);
if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) {
- TCHAR nameT[200];
+ wchar_t nameT[200];
mir_sntprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications"));
// Create the group chat session
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index f065893af7..7df4d7a4d3 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -93,7 +93,7 @@ public:
// Client vs protocol communication
- void client_notify(TCHAR* message);
+ void client_notify(wchar_t* message);
////////////////////////////////////////////////////////////
@@ -209,7 +209,7 @@ public:
// HTTP communication
http::response flap(RequestType request_type, std::string *post_data = NULL, std::string *get_data = NULL);
- bool save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc);
+ bool save_url(const std::string &url,const std::wstring &filename, HANDLE &nlc);
bool notify_errors(RequestType);
std::string choose_server(RequestType);
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 486bc08696..cfbae1cbc9 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-void facebook_client::client_notify(TCHAR* message)
+void facebook_client::client_notify(wchar_t* message)
{
parent->NotifyEvent(parent->m_tszUserName, message, NULL, FACEBOOK_EVENT_CLIENT);
}
@@ -723,13 +723,13 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s
}
}
- std::tstring treaderName = _A2T(name.c_str(), CP_UTF8);
- std::tstring treaders;
+ std::wstring treaderName = _A2T(name.c_str(), CP_UTF8);
+ std::wstring treaders;
// Load old readers
ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
if (told)
- treaders = std::tstring(told) + L", ";
+ treaders = std::wstring(told) + L", ";
// Append new reader name and remember them
treaders += utils::text::prepare_name(treaderName, true);
@@ -771,7 +771,7 @@ void loginError(FacebookProto *proto, std::string error_str) {
proto->debugLogA("!!! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error");
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, TranslateT("Login error: %s"),
(error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str())));
proto->facy.client_notify(buf);
@@ -1664,7 +1664,7 @@ bool facebook_client::post_status(status_data *status)
//////////////////////////////////////////////////////////////////////////////
-bool facebook_client::save_url(const std::string &url, const std::tstring &filename, HANDLE &nlc)
+bool facebook_client::save_url(const std::string &url, const std::wstring &filename, HANDLE &nlc)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
NETLIBHTTPREQUEST *resp;
@@ -1683,17 +1683,17 @@ bool facebook_client::save_url(const std::string &url, const std::tstring &filen
parent->debugLogA("@@@ Saving URL %s to file %s", url.c_str(), _T2A(filename.c_str()));
// Create folder if necessary
- std::tstring dir = filename.substr(0, filename.rfind('\\'));
- if (_taccess(dir.c_str(), 0))
+ std::wstring dir = filename.substr(0, filename.rfind('\\'));
+ if (_waccess(dir.c_str(), 0))
CreateDirectoryTreeT(dir.c_str());
// Write to file
- FILE *f = _tfopen(filename.c_str(), L"wb");
+ FILE *f = _wfopen(filename.c_str(), L"wb");
if (f != NULL) {
fwrite(resp->pData, 1, resp->dataLength, f);
fclose(f);
- ret = _taccess(filename.c_str(), 0) == 0;
+ ret = _waccess(filename.c_str(), 0) == 0;
}
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 92e547a4a4..028c2a918f 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -400,7 +400,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc)
if (namesUsed > 0)
fbc->chat_name += L", ";
- std::tstring tname = _A2T(participant.c_str(), CP_UTF8);
+ std::wstring tname = _A2T(participant.c_str(), CP_UTF8);
fbc->chat_name += utils::text::prepare_name(tname, false);
if (++namesUsed >= FACEBOOK_CHATROOM_NAMES_COUNT)
@@ -408,14 +408,14 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc)
}
if (fbc->participants.size() > namesUsed) {
- TCHAR more[200];
+ wchar_t more[200];
mir_sntprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed);
fbc->chat_name = more;
}
// If there are no participants to create a name from, use just thread_id
if (fbc->chat_name.empty())
- fbc->chat_name = std::tstring(_A2T(fbc->thread_id.c_str())); // TODO: is this needed? Isn't it showed automatically as id if there is no name?
+ fbc->chat_name = std::wstring(_A2T(fbc->thread_id.c_str())); // TODO: is this needed? Isn't it showed automatically as id if there is no name?
}
debugLogA("*** Chat thread info processed");
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 2f349531ff..75aa98da3b 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -272,9 +272,9 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
{
data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
- TCHAR mindMessageT[FACEBOOK_MIND_LIMIT + 1];
- TCHAR urlT[1024];
- TCHAR placeT[100];
+ wchar_t mindMessageT[FACEBOOK_MIND_LIMIT + 1];
+ wchar_t urlT[1024];
+ wchar_t placeT[100];
GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT));
GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT));
@@ -394,7 +394,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
case WM_NOTIFY:
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
- char str[128]; TCHAR tstr[128];
+ char str[128]; wchar_t tstr[128];
GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str));
db_set_s(0, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str);
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h
index a70757e1c3..43c8f18f86 100644
--- a/protocols/FacebookRM/src/entities.h
+++ b/protocols/FacebookRM/src/entities.h
@@ -55,7 +55,7 @@ struct facebook_user
this->type = CONTACT_NONE;
}
- TCHAR *getMirVer()
+ wchar_t *getMirVer()
{
switch (this->client) {
case CLIENT_APP:
@@ -87,7 +87,7 @@ struct chatroom_participant
struct facebook_chatroom
{
std::string thread_id;
- std::tstring chat_name;
+ std::wstring chat_name;
std::map<std::string, chatroom_participant> participants;
bool can_reply;
bool is_archived;
@@ -219,9 +219,9 @@ struct wall_data
this->title = NULL;
this->isPage = false;
}
- wall_data(std::string user_id, TCHAR *title, bool isPage = false) : user_id(user_id), title(title), isPage(isPage) {}
+ wall_data(std::string user_id, wchar_t *title, bool isPage = false) : user_id(user_id), title(title), isPage(isPage) {}
std::string user_id;
- TCHAR *title;
+ wchar_t *title;
bool isPage;
};
@@ -236,7 +236,7 @@ struct post_status_data {
struct open_url
{
- open_url(TCHAR *browser, TCHAR *url) : browser(browser), url(url) {}
- TCHAR *browser;
- TCHAR *url;
+ open_url(wchar_t *browser, wchar_t *url) : browser(browser), url(url) {}
+ wchar_t *browser;
+ wchar_t *url;
};
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index 0fc052b563..660b2424f5 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, std::string *url, std::string *notification_id, const char *icon)
+HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, DWORD flags, std::string *url, std::string *notification_id, const char *icon)
{
if (title == NULL || info == NULL)
return NULL;
@@ -83,8 +83,8 @@ HWND FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWO
}*/
POPUPDATACLASS pd = { sizeof(pd) };
- pd.ptszTitle = title;
- pd.ptszText = info;
+ pd.pwszTitle = title;
+ pd.pwszText = info;
pd.pszClassName = name;
pd.hContact = contact;
if (icon != NULL) {
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 9be06826d7..68d3934e0f 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -311,7 +311,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO
*message_text += "\n\n";
if (!attachments_text.empty()) {
- std::tstring newText;
+ std::wstring newText;
if (type == "sticker")
newText = TranslateT("a sticker");
else if (type == "share")
@@ -327,7 +327,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO
else
newText = _A2T(type.c_str());
- TCHAR title[200];
+ wchar_t title[200];
mir_sntprintf(title, TranslateT("User sent %s:"), newText.c_str());
*message_text += T2Utf(title);
@@ -760,7 +760,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
// Probably means client: guess 0 = web, 8 = messenger, 10 = something else?
if (vc_) {
int vc = vc_.as_int();
- TCHAR *client;
+ wchar_t *client;
if (vc == 0) {
client = _T(FACEBOOK_CLIENT_WEB);
@@ -877,7 +877,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
}
// Probably means client: guess 0 = web, 8 = messenger, 10 = something else?
if (vc_) {
- TCHAR *client = _T(FACEBOOK_CLIENT_WEB);
+ wchar_t *client = _T(FACEBOOK_CLIENT_WEB);
/*if (vc == 0) {
// means active some time ago? (on messenger or also on web)
@@ -1073,7 +1073,7 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
chatrooms->erase(iter); // this is not chatroom
}
else {
- iter->second->chat_name = std::tstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name...
+ iter->second->chat_name = std::wstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name...
const JSONNode &participants = (*it)["participants"];
for (auto jt = participants.begin(); jt != participants.end(); ++jt) {
@@ -1275,7 +1275,7 @@ int facebook_json_parser::parse_chat_info(std::string *data, facebook_chatroom*
fbc->is_archived = (*it)["is_archived"].as_bool();
fbc->is_subscribed = (*it)["is_subscribed"].as_bool();
fbc->read_only = (*it)["read_only"].as_bool();
- fbc->chat_name = std::tstring(ptrT(mir_utf8decodeT(name_.as_string().c_str())));
+ fbc->chat_name = std::wstring(ptrT(mir_utf8decodeT(name_.as_string().c_str())));
}
return EXIT_SUCCESS;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index 8c50a507ba..bf63f1f8a7 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -74,7 +74,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static PROTO_INTERFACE* protoInit(const char *proto_name, const TCHAR *username)
+static PROTO_INTERFACE* protoInit(const char *proto_name, const wchar_t *username)
{
FacebookProto *proto = new FacebookProto(proto_name, username);
g_Instances.insert(proto);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index bfb4dd24d4..e5777e6f29 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -217,10 +217,10 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url,
std::string b64 = ptrA(mir_base64_encode((PBYTE)sticker.c_str(), (unsigned)sticker.length()));
b64 = utils::url::encode(b64);
- std::tstring filename = GetAvatarFolder() + L"\\stickers\\";
+ std::wstring filename = GetAvatarFolder() + L"\\stickers\\";
ptrT dir(mir_tstrdup(filename.c_str()));
- filename += (TCHAR*)_A2T(b64.c_str());
+ filename += (wchar_t*)_A2T(b64.c_str());
filename += L".png";
// Check if we have this sticker already and download it it not
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 1a169b684c..6be6c3f539 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -516,9 +516,9 @@ void FacebookProto::SyncThreads(void*)
}
std::string truncateUtf8(std::string &text, size_t maxLength) {
- // To not split some unicode character we need to transform it to TCHAR first, then split it, and then convert it back, because we want std::string as result
+ // To not split some unicode character we need to transform it to wchar_t first, then split it, and then convert it back, because we want std::string as result
// TODO: Probably there is much simpler and nicer way
- std::tstring ttext = ptrT(mir_utf8decodeT(text.c_str()));
+ std::wstring ttext = ptrT(mir_utf8decodeT(text.c_str()));
if (ttext.length() > maxLength) {
ttext = ttext.substr(0, maxLength) + L"\x2026"; // unicode ellipsis
return std::string(_T2A(ttext.c_str(), CP_UTF8));
@@ -1192,7 +1192,7 @@ void FacebookProto::SearchAckThread(void *targ)
int count = 0;
- std::string search = utils::url::encode(T2Utf((TCHAR *)targ).str());
+ std::string search = utils::url::encode(T2Utf((wchar_t *)targ).str());
std::string ssid;
while (count < 50 && !isOffline())
@@ -1246,11 +1246,11 @@ void FacebookProto::SearchAckThread(void *targ)
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;
+ psr.id.w = tid;
+ psr.nick.w = tnick;
+ psr.firstName.w = tname;
+ psr.lastName.w = tsurname;
+ psr.email.w = tcommon;
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&psr);
}
@@ -1271,7 +1271,7 @@ void FacebookProto::SearchIdAckThread(void *targ)
{
facy.handle_entry("searchIdAckThread");
- std::string search = utils::url::encode(T2Utf((TCHAR*)targ).str()) + "?";
+ std::string search = utils::url::encode(T2Utf((wchar_t*)targ).str()) + "?";
if (!isOffline())
{
@@ -1307,9 +1307,9 @@ void FacebookProto::SearchIdAckThread(void *targ)
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = tid;
- psr.firstName.t = tname;
- psr.lastName.t = tsurname;
+ psr.id.w = tid;
+ psr.firstName.w = tname;
+ psr.lastName.w = 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 0795f2ba16..a0fdcf6c52 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) :
+FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
PROTO<FacebookProto>(proto_name, username),
m_tszDefaultGroup(getTStringA(FACEBOOK_KEY_DEF_GROUP))
{
@@ -82,7 +82,7 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) :
InitSounds();
// Create standard network connection
- TCHAR descr[512];
+ wchar_t descr[512];
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
@@ -90,7 +90,7 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) :
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
- TCHAR error[200];
+ wchar_t error[200];
mir_sntprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName);
MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR);
}
@@ -216,7 +216,7 @@ int FacebookProto::SetStatus(int new_status)
return 0;
}
-int FacebookProto::SetAwayMsg(int, const TCHAR *msg)
+int FacebookProto::SetAwayMsg(int, const wchar_t *msg)
{
if (!msg) {
last_status_msg_.clear();
@@ -248,38 +248,38 @@ void FacebookProto::SetAwayMsgWorker(void *p)
}
}
-HANDLE FacebookProto::SearchBasic(const TCHAR* id)
+HANDLE FacebookProto::SearchBasic(const wchar_t* id)
{
if (isOffline())
return 0;
- TCHAR *tid = mir_tstrdup(id);
+ wchar_t *tid = mir_tstrdup(id);
ForkThread(&FacebookProto::SearchIdAckThread, tid);
return tid;
}
-HANDLE FacebookProto::SearchByEmail(const TCHAR* email)
+HANDLE FacebookProto::SearchByEmail(const wchar_t* email)
{
if (isOffline())
return 0;
- TCHAR *temail = mir_tstrdup(email);
+ wchar_t *temail = mir_tstrdup(email);
ForkThread(&FacebookProto::SearchAckThread, temail);
return temail;
}
-HANDLE FacebookProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
+HANDLE FacebookProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
{
- TCHAR arg[200];
+ wchar_t arg[200];
mir_sntprintf(arg, L"%s %s %s", nick, firstName, lastName);
return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs)
}
MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
- 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));
+ ptrA id(mir_t2a_cp(psr->id.w, CP_UTF8));
+ ptrA name(mir_t2a_cp(psr->firstName.w, CP_UTF8));
+ ptrA surname(mir_t2a_cp(psr->lastName.w, CP_UTF8));
if (id == NULL)
return NULL;
@@ -310,7 +310,7 @@ MCONTACT FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
return hContact;
}
-int FacebookProto::AuthRequest(MCONTACT hContact, const TCHAR *)
+int FacebookProto::AuthRequest(MCONTACT hContact, const wchar_t *)
{
return RequestFriendship(hContact, NULL);
}
@@ -327,7 +327,7 @@ int FacebookProto::Authorize(MEVENT hDbEvent)
return ApproveFriendship(hContact, NULL);
}
-int FacebookProto::AuthDeny(MEVENT hDbEvent, const TCHAR *)
+int FacebookProto::AuthDeny(MEVENT hDbEvent, const wchar_t *)
{
if (!hDbEvent || isOffline())
return 1;
@@ -499,31 +499,31 @@ int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInstance;
- odp.ptszTitle = m_tszUserName;
+ odp.pwszTitle = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE;
odp.position = 271828;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTab = LPGENT("Account");
+ odp.pwszGroup = LPGENW("Network");
+ odp.pwszTab = LPGENW("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = FBOptionsProc;
Options_AddPage(wParam, &odp);
odp.position = 271829;
- odp.ptszTab = LPGENT("Events");
+ odp.pwszTab = LPGENW("Events");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_EVENTS);
odp.pfnDlgProc = FBOptionsEventsProc;
Options_AddPage(wParam, &odp);
odp.position = 271830;
- odp.ptszTab = LPGENT("Statuses");
+ odp.pwszTab = LPGENW("Statuses");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_STATUSES);
odp.pfnDlgProc = FBOptionsStatusesProc;
Options_AddPage(wParam, &odp);
odp.position = 271831;
- odp.ptszTab = LPGENT("Messaging");
+ odp.pwszTab = LPGENW("Messaging");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MESSAGING);
odp.pfnDlgProc = FBOptionsMessagingProc;
Options_AddPage(wParam, &odp);
@@ -561,7 +561,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM)
wall->user_id = id;
wall->isPage = false;
if (wall->user_id == facy.self_.user_id) {
- wall->title = _tcsdup(TranslateT("Own wall"));
+ wall->title = wcsdup(TranslateT("Own wall"));
}
else
wall->title = getTStringA(hContact, FACEBOOK_KEY_NICK);
@@ -789,7 +789,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam)
if (tname == NULL)
return 1;
- TCHAR tstr[256];
+ wchar_t tstr[256];
mir_sntprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname);
if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) {
@@ -1005,7 +1005,7 @@ void FacebookProto::InitPopups()
ppc.PluginWindowProc = PopupDlgProc;
ppc.lParam = APF_RETURN_HWND;
- TCHAR desc[256];
+ wchar_t desc[256];
char name[256];
// Client
@@ -1102,15 +1102,15 @@ void FacebookProto::InitHotkeys()
hkd.dwFlags = HKD_TCHAR;
mir_strcpy(tDest, "/VisitProfile");
- hkd.ptszDescription = LPGENT("Visit profile");
+ hkd.ptszDescription = LPGENW("Visit profile");
Hotkey_Register(&hkd);
mir_strcpy(tDest, "/VisitNotifications");
- hkd.ptszDescription = LPGENT("Visit notifications");
+ hkd.ptszDescription = LPGENW("Visit notifications");
Hotkey_Register(&hkd);
mir_strcpy(tDest, "/Mind");
- hkd.ptszDescription = LPGENT("Show 'Share status' window");
+ hkd.ptszDescription = LPGENW("Show 'Share status' window");
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_EXT, 'F');
Hotkey_Register(&hkd);
}
@@ -1120,12 +1120,12 @@ void FacebookProto::InitHotkeys()
*/
void FacebookProto::InitSounds()
{
- SkinAddNewSoundExT("Notification", m_tszUserName, LPGENT("Notification"));
- SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENT("Newsfeed event"));
- SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENT("Other event"));
- SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENT("Friendship event"));
- SkinAddNewSoundExT("Ticker", m_tszUserName, LPGENT("Ticker event"));
- SkinAddNewSoundExT("Memories", m_tszUserName, LPGENT("Memories"));
+ SkinAddNewSoundExT("Notification", m_tszUserName, LPGENW("Notification"));
+ SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENW("Newsfeed event"));
+ SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENW("Other event"));
+ SkinAddNewSoundExT("Friendship", m_tszUserName, LPGENW("Friendship event"));
+ SkinAddNewSoundExT("Ticker", m_tszUserName, LPGENW("Ticker event"));
+ SkinAddNewSoundExT("Memories", m_tszUserName, LPGENW("Memories"));
}
/**
@@ -1142,8 +1142,8 @@ void FacebookProto::MessageRead(MCONTACT hContact)
if (!time)
return;
- TCHAR ttime[64];
- _tcsftime(ttime, _countof(ttime), L"%X", localtime(&time));
+ wchar_t ttime[64];
+ wcsftime(ttime, _countof(ttime), L"%X", localtime(&time));
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 92a2799b88..d7792aa029 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class FacebookProto : public PROTO<FacebookProto>
{
public:
- FacebookProto(const char *proto_name, const TCHAR *username);
+ FacebookProto(const char *proto_name, const wchar_t *username);
~FacebookProto();
inline const char* ModuleName() const
@@ -83,15 +83,15 @@ public:
virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
- virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason);
- virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t* szMessage);
virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual int __cdecl GetInfo(MCONTACT hContact, int infoType);
- virtual HANDLE __cdecl SearchBasic(const TCHAR* id);
- virtual HANDLE __cdecl SearchByEmail(const TCHAR* email);
- virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t* email);
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
@@ -99,7 +99,7 @@ public:
virtual int __cdecl SetStatus(int iNewStatus);
virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact);
- virtual int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg);
+ virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t* msg);
virtual int __cdecl UserIsTyping(MCONTACT hContact, int type);
@@ -208,7 +208,7 @@ public:
void StopTyping(MCONTACT hContact);
// Chats handling
- void AddChat(const char *chat_id, const TCHAR *name);
+ void AddChat(const char *chat_id, const wchar_t *name);
void UpdateChat(const char *chat_id, const char *id, const char *name, const char *message, DWORD timestamp = 0, bool is_old = false);
void RenameChat(const char *chat_id, const char *name);
bool IsChatContact(const char *chat_id, const char *id);
@@ -228,7 +228,7 @@ public:
facebook_client facy; // TODO: Refactor to "client" and make dynamic
// Helpers
- std::tstring GetAvatarFolder();
+ std::wstring GetAvatarFolder();
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url);
void CheckAvatarChange(MCONTACT hContact, const std::string &image_url);
void ToggleStatusMenuItems(bool bEnable);
@@ -260,6 +260,6 @@ public:
static void CALLBACK APC_callback(ULONG_PTR p);
// Information providing
- HWND NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL);
+ HWND NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL, const char *icon = NULL);
void ShowNotifications();
};