summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/avatars.cpp2
-rw-r--r--protocols/FacebookRM/src/chat.cpp42
-rw-r--r--protocols/FacebookRM/src/communication.cpp8
-rw-r--r--protocols/FacebookRM/src/contacts.cpp4
-rw-r--r--protocols/FacebookRM/src/definitions.h2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp6
-rw-r--r--protocols/FacebookRM/src/json.cpp28
-rw-r--r--protocols/FacebookRM/src/main.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/FacebookRM/src/process.cpp32
-rw-r--r--protocols/FacebookRM/src/proto.cpp54
-rw-r--r--protocols/FacebookRM/src/proto.h2
12 files changed, 92 insertions, 92 deletions
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index c41c7026d5..55c7f046e6 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *)
std::wstring FacebookProto::GetAvatarFolder()
{
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(path, L"%s\\%s", VARST(L"%miranda_avatarcache%"), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index c3a02a8a22..eeb44b4c59 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -30,10 +30,10 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
std::string smessage = message;
utils::text::replace_all(&smessage, "%", "%%");
- ptrT tid(mir_a2t(id));
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
- ptrT ttext(mir_a2t_cp(smessage.c_str(), CP_UTF8));
- ptrT tchat_id(mir_a2t(chat_id));
+ ptrW tid(mir_a2u(id));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
+ ptrW ttext(mir_a2u_cp(smessage.c_str(), CP_UTF8));
+ ptrW tchat_id(mir_a2u(chat_id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -55,8 +55,8 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
void FacebookProto::RenameChat(const char *chat_id, const char *name)
{
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tname(mir_a2t_cp(name, CP_UTF8));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -72,7 +72,7 @@ int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam)
return 0;
// Ignore for special chatrooms
- if (!mir_tstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)))
+ if (!mir_wstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)))
return 0;
switch (hook->pDest->iType)
@@ -169,9 +169,9 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
if (IsChatContact(chat_id, user.user_id.c_str()))
return;
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tnick(mir_a2t_cp(user.nick.c_str(), CP_UTF8));
- ptrT tid(mir_a2t(user.user_id.c_str()));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tnick(mir_a2u_cp(user.nick.c_str(), CP_UTF8));
+ ptrW tid(mir_a2u(user.user_id.c_str()));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -208,9 +208,9 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
if (!mir_strcmp(id, facy.self_.user_id.c_str()))
return;
- ptrT tchat_id(mir_a2t(chat_id));
- ptrT tnick(mir_a2t_cp(name, CP_UTF8));
- ptrT tid(mir_a2t(id));
+ ptrW tchat_id(mir_a2u(chat_id));
+ ptrW tnick(mir_a2u_cp(name, CP_UTF8));
+ ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -226,7 +226,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
/** Caller must free result */
char *FacebookProto::GetChatUsers(const char *chat_id)
{
- ptrT ptszChatID(mir_a2t(chat_id));
+ ptrW ptszChatID(mir_a2u(chat_id));
GC_INFO gci = { 0 };
gci.Flags = GCF_USERS;
@@ -246,7 +246,7 @@ bool FacebookProto::IsChatContact(const char *chat_id, const char *id)
void FacebookProto::AddChat(const char *id, const wchar_t *tname)
{
- ptrT tid(mir_a2t(id));
+ ptrW tid(mir_a2u(id));
// Create the group chat session
GCSESSION gcw = { sizeof(gcw) };
@@ -285,8 +285,8 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM)
if (!m_enableChat || IsSpecialChatRoom(hContact))
return 0;
- ptrT idT(getTStringA(hContact, "ChatRoomID"));
- ptrT nameT(getTStringA(hContact, "Nick"));
+ ptrW idT(getTStringA(hContact, "ChatRoomID"));
+ ptrW nameT(getTStringA(hContact, "Nick"));
ptrA threadId(getStringA(hContact, FACEBOOK_KEY_TID));
if (!idT || !nameT || !threadId)
@@ -338,7 +338,7 @@ INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM)
INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM)
{
- ptrT idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL);
+ ptrW idT(wParam ? getTStringA(wParam, "ChatRoomID") : NULL);
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
gcd.ptszID = idT;
@@ -430,7 +430,7 @@ void FacebookProto::PrepareNotificationsChatRoom() {
MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM);
if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) {
wchar_t nameT[200];
- mir_sntprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications"));
+ mir_snwprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications"));
// Create the group chat session
GCSESSION gcw = { sizeof(gcw) };
@@ -460,8 +460,8 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
std::string message = text.str();
utils::text::replace_all(&message, "%", "%%");
- ptrT idT(mir_tstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)));
- ptrT messageT(mir_a2t_cp(message.c_str(), CP_UTF8));
+ ptrW idT(mir_wstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)));
+ ptrW messageT(mir_a2u_cp(message.c_str(), CP_UTF8));
GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index cfbae1cbc9..63bdec6d32 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -727,7 +727,7 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const s
std::wstring treaders;
// Load old readers
- ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
+ ptrW told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
if (told)
treaders = std::wstring(told) + L", ";
@@ -772,8 +772,8 @@ void loginError(FacebookProto *proto, std::string error_str) {
proto->debugLogA("!!! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error");
wchar_t buf[200];
- mir_sntprintf(buf, TranslateT("Login error: %s"),
- (error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str())));
+ mir_snwprintf(buf, TranslateT("Login error: %s"),
+ (error_str.empty()) ? TranslateT("Unknown error") : ptrW(mir_utf8decodeW(error_str.c_str())));
proto->facy.client_notify(buf);
}
@@ -932,7 +932,7 @@ bool facebook_client::login(const char *username, const char *password)
std::string activity = utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "<body", "</strong></div>", "</div>"));
activity = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(activity)));
if (!activity.empty()) {
- tszMessage.AppendFormat(L"\n\n%s", ptrT(mir_utf8decodeT(activity.c_str())));
+ tszMessage.AppendFormat(L"\n\n%s", ptrW(mir_utf8decodeW(activity.c_str())));
}
if (MessageBox(0, tszMessage, tszTitle, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1) == IDYES) {
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 028c2a918f..ad82b665be 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -409,7 +409,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc)
if (fbc->participants.size() > namesUsed) {
wchar_t more[200];
- mir_sntprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed);
+ mir_snwprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed);
fbc->chat_name = more;
}
@@ -734,7 +734,7 @@ void FacebookProto::SendPokeWorker(void *p)
message = utils::text::html_entities_decode(
utils::text::remove_html(message));
- ptrT tmessage(mir_utf8decodeT(message.c_str()));
+ ptrW tmessage(mir_utf8decodeW(message.c_str()));
NotifyEvent(m_tszUserName, tmessage, NULL, FACEBOOK_EVENT_OTHER);
}
diff --git a/protocols/FacebookRM/src/definitions.h b/protocols/FacebookRM/src/definitions.h
index 97c8025833..1fd4102920 100644
--- a/protocols/FacebookRM/src/definitions.h
+++ b/protocols/FacebookRM/src/definitions.h
@@ -39,5 +39,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define NIIF_INTERN_TCHAR NIIF_INTERN_UNICODE // m_clist.h
-#define mir_tstrdup mir_wstrdup // m_system.h
+#define mir_wstrdup mir_wstrdup // m_system.h
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 75aa98da3b..8574cf9431 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -159,7 +159,7 @@ void GetSelectedContacts(FacebookProto *proto, MCONTACT hItem, HWND hwndList, st
if (userId)
fu->user_id = userId;
- ptrT realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK));
+ ptrW realName(proto->getTStringA(hItem, FACEBOOK_KEY_NICK));
if (realName)
fu->real_name = _T2A(realName);
@@ -201,7 +201,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0);
SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0);
- ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE));
+ ptrW place(data->proto->getTStringA(FACEBOOK_KEY_PLACE));
SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : L"Miranda NG");
bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0;
@@ -405,7 +405,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr));
if (tstr[0] != '\0')
{
- proto->m_tszDefaultGroup = mir_tstrdup(tstr);
+ proto->m_tszDefaultGroup = mir_wstrdup(tstr);
proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr);
Clist_GroupCreate(0, tstr);
}
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 2ab26361da..cd17067e89 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -328,7 +328,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO
newText = _A2T(type.c_str());
wchar_t title[200];
- mir_sntprintf(title, TranslateT("User sent %s:"), newText.c_str());
+ mir_snwprintf(title, TranslateT("User sent %s:"), newText.c_str());
*message_text += T2Utf(title);
*message_text += attachments_text;
@@ -615,7 +615,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
// Notify it, if user wants to be notified
if (proto->getByte(FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE)) {
- proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id);
+ proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), NULL, FACEBOOK_EVENT_FRIENDSHIP, &url, alert_id.empty() ? NULL : &alert_id);
}
}
}
@@ -671,13 +671,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
participant = participants.find(from_id);
if (participant != participants.end()) {
MCONTACT hChatContact = proto->ChatIDToHContact(tid);
- ptrT name(mir_utf8decodeT(participant->second.nick.c_str()));
+ ptrW name(mir_utf8decodeW(participant->second.nick.c_str()));
if (st_.as_int() == 1) {
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
- mir_sntprintf(st.tszText, TranslateT("%s is typing a message..."), name);
+ mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), name);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
}
@@ -775,8 +775,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
client = FACEBOOK_CLIENT_OTHER;
}
- ptrT oldClient(proto->getTStringA(hContact, "MirVer"));
- if (!oldClient || mir_tstrcmp(oldClient, client))
+ ptrW oldClient(proto->getTStringA(hContact, "MirVer"));
+ if (!oldClient || mir_wstrcmp(oldClient, client))
proto->setTString(hContact, "MirVer", client);
}
}
@@ -813,13 +813,13 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
std::string contactname = getContactName(this, fbu->handle, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str());
- ptrT szTitle(mir_utf8decodeT(contactname.c_str()));
+ ptrW szTitle(mir_utf8decodeW(contactname.c_str()));
NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), fbu->handle, FACEBOOK_EVENT_FRIENDSHIP, &url);
} */
- /* ptrT client(getTStringA(fbu->handle, "MirVer"));
- if (!client || mir_tstrcmp(client, fbu->getMirVer()))
+ /* ptrW client(getTStringA(fbu->handle, "MirVer"));
+ if (!client || mir_wstrcmp(client, fbu->getMirVer()))
setTString(fbu->handle, "MirVer", fbu->getMirVer());
*/
@@ -894,8 +894,8 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
client = FACEBOOK_CLIENT_OTHER;
}*/
- ptrT oldClient(proto->getTStringA(hContact, "MirVer"));
- if (!oldClient || mir_tstrcmp(oldClient, client))
+ ptrW oldClient(proto->getTStringA(hContact, "MirVer"));
+ if (!oldClient || mir_wstrcmp(oldClient, client))
proto->setTString(hContact, "MirVer", client);
}
}
@@ -922,7 +922,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
proto->debugLogA("+++ Got ticker type='%s' class='%s'", story_type.c_str(), story_class.c_str());
if (!text.empty())
- proto->NotifyEvent(proto->m_tszUserName, ptrT(mir_utf8decodeT(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url);
+ proto->NotifyEvent(proto->m_tszUserName, ptrW(mir_utf8decodeW(text.c_str())), hContact, FACEBOOK_EVENT_TICKER, &url);
}
else if (t == "mercury") {
// rename multi user chat, video call, ...
@@ -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::wstring(ptrT(mir_utf8decodeT(name.as_string().c_str()))); // TODO: create name from users if there is no name...
+ iter->second->chat_name = std::wstring(ptrW(mir_utf8decodeW(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::wstring(ptrT(mir_utf8decodeT(name_.as_string().c_str())));
+ fbc->chat_name = std::wstring(ptrW(mir_utf8decodeW(name_.as_string().c_str())));
}
return EXIT_SUCCESS;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index bf63f1f8a7..35f9477192 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -49,7 +49,7 @@ PLUGININFOEX pluginInfo = {
// Protocol instances
static int compare_protos(const FacebookProto *p1, const FacebookProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
OBJLIST<FacebookProto> g_Instances(1, compare_protos);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index e5777e6f29..5076730817 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -218,7 +218,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url,
b64 = utils::url::encode(b64);
std::wstring filename = GetAvatarFolder() + L"\\stickers\\";
- ptrT dir(mir_tstrdup(filename.c_str()));
+ ptrW dir(mir_wstrdup(filename.c_str()));
filename += (wchar_t*)_A2T(b64.c_str());
filename += L".png";
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 6be6c3f539..3a3e00905c 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -134,7 +134,7 @@ void FacebookProto::ProcessFriendList(void*)
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
std::string contactname = getContactName(this, hContact, !fbu->real_name.empty() ? fbu->real_name.c_str() : fbu->user_id.c_str());
- ptrT szTitle(mir_utf8decodeT(contactname.c_str()));
+ ptrW szTitle(mir_utf8decodeW(contactname.c_str()));
NotifyEvent(szTitle, TranslateT("Contact is back on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url);
}
}
@@ -158,7 +158,7 @@ void FacebookProto::ProcessFriendList(void*)
std::string url = FACEBOOK_URL_PROFILE + std::string(id);
std::string contactname = getContactName(this, hContact, id);
- ptrT szTitle(mir_utf8decodeT(contactname.c_str()));
+ ptrW szTitle(mir_utf8decodeW(contactname.c_str()));
NotifyEvent(szTitle, TranslateT("Contact is no longer on server-list."), hContact, FACEBOOK_EVENT_FRIENDSHIP, &url);
}
}
@@ -518,7 +518,7 @@ 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 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::wstring ttext = ptrT(mir_utf8decodeT(text.c_str()));
+ std::wstring ttext = ptrW(mir_utf8decodeW(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));
@@ -703,8 +703,8 @@ void FacebookProto::ProcessMemories(void*)
for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++)
{
- ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str()));
- ptrT tszText(mir_utf8decodeT(news[i]->text.c_str()));
+ ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str()));
+ ptrW tszText(mir_utf8decodeW(news[i]->text.c_str()));
NotifyEvent(TranslateT("On this day"), tszText, NULL, FACEBOOK_EVENT_ON_THIS_DAY, &news[i]->link);
delete news[i];
@@ -952,7 +952,7 @@ void FacebookProto::ShowNotifications() {
facebook_notification *notification = it->second;
if (notification != NULL && !notification->seen) {
debugLogA(" Showing popup for notification ID: %s", notification->id.c_str());
- ptrT szText(mir_utf8decodeT(notification->text.c_str()));
+ ptrW szText(mir_utf8decodeW(notification->text.c_str()));
MCONTACT hContact = (notification->user_id.empty() ? NULL : ContactIDToHContact(notification->user_id));
notification->hWndPopup = NotifyEvent(m_tszUserName, szText, hContact, FACEBOOK_EVENT_NOTIFICATION, &notification->link, &notification->id, notification->icon);
notification->seen = true;
@@ -1124,8 +1124,8 @@ void FacebookProto::ProcessFeeds(void*)
for (std::vector<facebook_newsfeed*>::size_type i = 0; i < news.size(); i++)
{
- ptrT tszTitle(mir_utf8decodeT(news[i]->title.c_str()));
- ptrT tszText(mir_utf8decodeT(news[i]->text.c_str()));
+ ptrW tszTitle(mir_utf8decodeW(news[i]->title.c_str()));
+ ptrW tszText(mir_utf8decodeW(news[i]->text.c_str()));
MCONTACT hContact = ContactIDToHContact(news[i]->user_id);
NotifyEvent(tszTitle, tszText, hContact, FACEBOOK_EVENT_NEWSFEED, &news[i]->link);
@@ -1237,11 +1237,11 @@ void FacebookProto::SearchAckThread(void *targ)
if (id.empty() || id == facy.self_.user_id)
continue;
- ptrT tid(mir_utf8decodeT(id.c_str()));
- ptrT tname(mir_utf8decodeT(utils::text::html_entities_decode(name).c_str()));
- ptrT tsurname(mir_utf8decodeT(utils::text::html_entities_decode(surname).c_str()));
- ptrT tnick(mir_utf8decodeT(utils::text::html_entities_decode(nick).c_str()));
- ptrT tcommon(mir_utf8decodeT(utils::text::html_entities_decode(common).c_str()));
+ ptrW tid(mir_utf8decodeW(id.c_str()));
+ ptrW tname(mir_utf8decodeW(utils::text::html_entities_decode(name).c_str()));
+ ptrW tsurname(mir_utf8decodeW(utils::text::html_entities_decode(surname).c_str()));
+ ptrW tnick(mir_utf8decodeW(utils::text::html_entities_decode(nick).c_str()));
+ ptrW tcommon(mir_utf8decodeW(utils::text::html_entities_decode(common).c_str()));
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
@@ -1300,9 +1300,9 @@ void FacebookProto::SearchIdAckThread(void *targ)
// ignore self contact and empty ids
if (!id.empty() && id != facy.self_.user_id){
- ptrT tid(mir_utf8decodeT(id.c_str()));
- ptrT tname(mir_utf8decodeT(name.c_str()));
- ptrT tsurname(mir_utf8decodeT(surname.c_str()));
+ ptrW tid(mir_utf8decodeW(id.c_str()));
+ ptrW tname(mir_utf8decodeW(name.c_str()));
+ ptrW tsurname(mir_utf8decodeW(surname.c_str()));
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index a0fdcf6c52..667738556f 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -48,11 +48,11 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
m_locale = locale;
// Load custom page prefix, if set
- ptrT pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX));
+ ptrW pagePrefix(getTStringA(FACEBOOK_KEY_PAGE_PREFIX));
m_pagePrefix = (pagePrefix != NULL) ? _T2A(pagePrefix, CP_UTF8) : TEXT_EMOJI_PAGE;
if (m_tszDefaultGroup == NULL)
- m_tszDefaultGroup = mir_tstrdup(L"Facebook");
+ m_tszDefaultGroup = mir_wstrdup(L"Facebook");
CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg);
@@ -86,12 +86,12 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr, TranslateT("%s server connection"), m_tszUserName);
+ mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
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);
}
@@ -253,7 +253,7 @@ HANDLE FacebookProto::SearchBasic(const wchar_t* id)
if (isOffline())
return 0;
- wchar_t *tid = mir_tstrdup(id);
+ wchar_t *tid = mir_wstrdup(id);
ForkThread(&FacebookProto::SearchIdAckThread, tid);
return tid;
}
@@ -263,7 +263,7 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email)
if (isOffline())
return 0;
- wchar_t *temail = mir_tstrdup(email);
+ wchar_t *temail = mir_wstrdup(email);
ForkThread(&FacebookProto::SearchAckThread, temail);
return temail;
}
@@ -271,15 +271,15 @@ HANDLE FacebookProto::SearchByEmail(const wchar_t* email)
HANDLE FacebookProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
{
wchar_t arg[200];
- mir_sntprintf(arg, L"%s %s %s", nick, firstName, lastName);
+ mir_snwprintf(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.w, CP_UTF8));
- ptrA name(mir_t2a_cp(psr->firstName.w, CP_UTF8));
- ptrA surname(mir_t2a_cp(psr->lastName.w, CP_UTF8));
+ ptrA id(mir_u2a_cp(psr->id.w, CP_UTF8));
+ ptrA name(mir_u2a_cp(psr->firstName.w, CP_UTF8));
+ ptrA surname(mir_u2a_cp(psr->lastName.w, CP_UTF8));
if (id == NULL)
return NULL;
@@ -380,11 +380,11 @@ int FacebookProto::GetInfo(MCONTACT hContact, int)
INT_PTR FacebookProto::GetMyAwayMsg(WPARAM, LPARAM lParam)
{
- ptrT statusMsg(getTStringA("StatusMsg"));
+ ptrW statusMsg(getTStringA("StatusMsg"));
if (statusMsg == NULL || statusMsg[0] == '\0')
return 0;
- return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(statusMsg) : (INT_PTR)mir_t2a(statusMsg);
+ return (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(statusMsg) : (INT_PTR)mir_u2a(statusMsg);
}
int FacebookProto::OnIdleChanged(WPARAM, LPARAM lParam)
@@ -570,7 +570,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM)
if (wall->user_id == facy.self_.user_id) {
for (std::map<std::string, std::string>::iterator iter = facy.pages.begin(); iter != facy.pages.end(); ++iter) {
- data->walls.push_back(new wall_data(iter->first, mir_utf8decodeT(iter->second.c_str()), true));
+ data->walls.push_back(new wall_data(iter->first, mir_utf8decodeW(iter->second.c_str()), true));
}
}
@@ -782,7 +782,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam)
if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE) != CONTACT_FRIEND))
return 0;
- ptrT tname(getTStringA(hContact, FACEBOOK_KEY_NICK));
+ ptrW tname(getTStringA(hContact, FACEBOOK_KEY_NICK));
if (tname == NULL)
tname = getTStringA(hContact, FACEBOOK_KEY_ID);
@@ -790,7 +790,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam)
return 1;
wchar_t tstr[256];
- mir_sntprintf(tstr, TranslateT("Do you want to cancel your friendship with '%s'?"), tname);
+ mir_snwprintf(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) {
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
@@ -923,10 +923,10 @@ std::string FacebookProto::PrepareUrl(std::string url) {
void FacebookProto::OpenUrl(std::string url)
{
url = PrepareUrl(url);
- ptrT data(mir_utf8decodeT(url.c_str()));
+ ptrW data(mir_utf8decodeW(url.c_str()));
// Check if there is user defined browser for opening links
- ptrT browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER));
+ ptrW browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER));
if (browser != NULL)
// If so, use it to open this link
ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data));
@@ -1009,7 +1009,7 @@ void FacebookProto::InitPopups()
char name[256];
// Client
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Client errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Client");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1020,7 +1020,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// Newsfeeds
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Wall posts"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Newsfeed");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1031,7 +1031,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// Notifications
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1042,7 +1042,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// Others
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Other events"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Other");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1053,7 +1053,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// Friendship changes
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Friendship events"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Friendship");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1064,7 +1064,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// Ticker
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Real-time friends activity"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Ticker");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1075,7 +1075,7 @@ void FacebookProto::InitPopups()
popupClasses.push_back(Popup_RegisterClass(&ppc));
// On this day (memories)
- mir_sntprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories"));
+ mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Memories"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Memories");
ppc.ptszDescription = desc;
ppc.pszName = name;
@@ -1151,11 +1151,11 @@ void FacebookProto::MessageRead(MCONTACT hContact)
if (isChatRoom(hContact)) {
// Load readers names
- ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
- mir_sntprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???");
+ ptrW treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
+ mir_snwprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???");
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
} else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){
- mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime);
+ mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
}
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index d7792aa029..cb1b8febe3 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -250,7 +250,7 @@ public:
HANDLE log_lock_;
HANDLE update_loop_lock_;
- ptrT m_tszDefaultGroup;
+ ptrW m_tszDefaultGroup;
std::vector<HANDLE> popupClasses;