diff options
Diffstat (limited to 'protocols/Steam')
-rw-r--r-- | protocols/Steam/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/Steam/src/steam_avatars.cpp | 12 | ||||
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 24 | ||||
-rw-r--r-- | protocols/Steam/src/steam_events.cpp | 8 | ||||
-rw-r--r-- | protocols/Steam/src/steam_history.cpp | 10 | ||||
-rw-r--r-- | protocols/Steam/src/steam_login.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_menus.cpp | 8 | ||||
-rw-r--r-- | protocols/Steam/src/steam_options.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_polling.cpp | 4 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 26 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.h | 16 | ||||
-rw-r--r-- | protocols/Steam/src/steam_utils.cpp | 6 |
12 files changed, 60 insertions, 59 deletions
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index 44e3dfc893..2ebe847089 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -41,6 +41,7 @@ #include "version.h"
#define MODULE "Steam"
+#define MODULEW L"Steam"
#define STEAM_API_TIMEOUT 30
#define STEAM_API_IDLEOUT_AWAY 600
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index ad2348463d..8b852a8fed 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -1,8 +1,8 @@ #include "stdafx.h"
-TCHAR* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
+wchar_t* CSteamProto::GetAvatarFilePath(MCONTACT hContact)
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
@@ -24,7 +24,7 @@ bool CSteamProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai) if (!path)
return false;
- _tcsncpy_s(pai.filename, path, _TRUNCATE);
+ wcsncpy_s(pai.filename, path, _TRUNCATE);
pai.format = PA_FORMAT_JPEG;
return true;
@@ -68,7 +68,7 @@ INT_PTR CSteamProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (GetDbAvatarInfo(*pai))
{
- bool fileExist = _taccess(pai->filename, 0) == 0;
+ bool fileExist = _waccess(pai->filename, 0) == 0;
bool needLoad;
if (pai->hContact)
@@ -141,13 +141,13 @@ INT_PTR CSteamProto::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/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index de1253ad2e..3cbdb66c21 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -110,11 +110,11 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) node = json_get(data, "realname"); if (node != NULL) { - std::tstring realname = (TCHAR*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(L' ', 1); - if (pos != std::tstring::npos) + if (pos != std::wstring::npos) { setTString(hContact, "FirstName", realname.substr(0, pos).c_str()); setTString(hContact, "LastName", realname.substr(pos + 1).c_str()); @@ -265,7 +265,7 @@ void CSteamProto::ContactIsRemoved(MCONTACT hContact) SetContactStatus(hContact, ID_STATUS_OFFLINE); ptrT nick(getTStringA(hContact, "Nick")); - TCHAR message[MAX_PATH]; + wchar_t message[MAX_PATH]; mir_sntprintf(message, MAX_PATH, TranslateT("%s has been removed from your contact list"), nick); ShowNotification(L"Steam", message); @@ -283,7 +283,7 @@ void CSteamProto::ContactIsFriend(MCONTACT hContact) delSetting(hContact, "Grant"); ptrT nick(getTStringA(hContact, "Nick")); - TCHAR message[MAX_PATH]; + wchar_t message[MAX_PATH]; mir_sntprintf(message, MAX_PATH, TranslateT("%s is back in your contact list"), nick); ShowNotification(L"Steam", message); @@ -602,7 +602,7 @@ void CSteamProto::OnGotAvatar(const HttpResponse *response, void *arg) return; } - FILE *fp = _tfopen(ai.filename, L"wb"); + FILE *fp = _wfopen(ai.filename, L"wb"); if (fp) { fwrite(response->pData, sizeof(char), response->dataLength, fp); @@ -763,25 +763,25 @@ void CSteamProto::OnSearchResults(const HttpResponse *response, void *arg) ssr.hdr.flags = PSR_TCHAR; node = json_get(child, "steamid"); - ssr.hdr.id.t = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.id.w = mir_tstrdup(ptrT(json_as_string(node))); node = json_get(child, "personaname"); - ssr.hdr.nick.t = mir_tstrdup(ptrT(json_as_string(node))); + ssr.hdr.nick.w = mir_tstrdup(ptrT(json_as_string(node))); node = json_get(child, "realname"); if (node != NULL) { - std::tstring realname = (TCHAR*)ptrT(json_as_string(node)); + std::wstring realname = (wchar_t*)ptrT(json_as_string(node)); if (!realname.empty()) { size_t pos = realname.find(' ', 1); - if (pos != std::tstring::npos) + if (pos != std::wstring::npos) { - ssr.hdr.firstName.t = mir_tstrdup(realname.substr(0, pos).c_str()); - ssr.hdr.lastName.t = mir_tstrdup(realname.substr(pos + 1).c_str()); + ssr.hdr.firstName.w = mir_tstrdup(realname.substr(0, pos).c_str()); + ssr.hdr.lastName.w = mir_tstrdup(realname.substr(pos + 1).c_str()); } else - ssr.hdr.firstName.t = mir_tstrdup(realname.c_str()); + ssr.hdr.firstName.w = mir_tstrdup(realname.c_str()); } } diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp index c416cbd957..9caa7091b9 100644 --- a/protocols/Steam/src/steam_events.cpp +++ b/protocols/Steam/src/steam_events.cpp @@ -34,15 +34,15 @@ int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszGroup = LPGENT("Network"); + odp.pwszGroup = LPGENW("Network"); - odp.ptszTab = LPGENT("Account"); + odp.pwszTab = LPGENW("Account"); odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Blocked contacts"); + odp.pwszTab = LPGENW("Blocked contacts"); odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this); Options_AddPage(wParam, &odp); return 0; diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index 75e40a5674..8a16ee5bf3 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -28,13 +28,13 @@ void CSteamProto::OnGotConversations(const HttpResponse *response) JSONNode *session = json_at(nsessions, i); node = json_get(session, "accountid_friend"); - const char *who = AccountIdToSteamId(_ttoi64(ptrT(json_as_string(node)))); + const char *who = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); node = json_get(session, "last_message"); - time_t lastMessageTS = _ttoi64(ptrT(json_as_string(node))); + time_t lastMessageTS = _wtoi64(ptrT(json_as_string(node))); /*node = json_get(session, "last_view"); - time_t last_view = _ttoi64(ptrT(json_as_string(node))); + time_t last_view = _wtoi64(ptrT(json_as_string(node))); node = json_get(session, "unread_message_count"); long unread_count = json_as_int(node);*/ @@ -79,14 +79,14 @@ void CSteamProto::OnGotHistoryMessages(const HttpResponse *response, void *arg) JSONNode *message = json_at(nmessages, i - 1); node = json_get(message, "accountid"); - const char *authorSteamId = AccountIdToSteamId(_ttoi64(ptrT(json_as_string(node)))); + const char *authorSteamId = AccountIdToSteamId(_wtoi64(ptrT(json_as_string(node)))); node = json_get(message, "message"); ptrT text(json_as_string(node)); T2Utf szMessage(text); node = json_get(message, "timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); // Ignore already existing messages if (timestamp <= m_lastMessageTS) diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index fd8d7399f7..15fb3d6483 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -383,7 +383,7 @@ void CSteamProto::OnLoggedOn(const HttpResponse *response) if (m_lastMessageTS <= 0) { node = json_get(root, "utc_timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); setDword("LastMessageTS", timestamp); } diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index e2c4fcd5b7..c6252dc81b 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -103,7 +103,7 @@ void CSteamProto::OnInitStatusMenu() // Show block list
mi.pszService = "/BlockList";
CreateProtoService(mi.pszService, &CSteamProto::OpenBlockListCommand);
- mi.name.t = LPGENT("Blocked contacts");
+ mi.name.w = LPGENW("Blocked contacts");
mi.position = 200000 + SMI_BLOCKED_LIST;
Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
@@ -120,7 +120,7 @@ void CSteamProto::InitMenus() // "Request authorization"
SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
mi.pszService = MODULE "/AuthRequest";
- mi.name.t = LPGENT("Request authorization");
+ mi.name.w = LPGENW("Request authorization");
mi.position = -201001000 + CMI_AUTH_REQUEST;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
contactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
@@ -129,7 +129,7 @@ void CSteamProto::InitMenus() // "Block"
SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
mi.pszService = MODULE "/Block";
- mi.name.t = LPGENT("Block");
+ mi.name.w = LPGENW("Block");
mi.position = -201001001 + CMI_BLOCK;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
contactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
@@ -140,7 +140,7 @@ void CSteamProto::InitMenus() // "Join to game"
SET_UID(mi, 0x1a6aaab7, 0xba31, 0x4b47, 0x8e, 0xce, 0xf8, 0x8e, 0xf4, 0x62, 0x4f, 0xd7);
mi.pszService = MODULE "/JoinToGame";
- mi.name.t = LPGENT("Join to game");
+ mi.name.w = LPGENW("Join to game");
mi.position = -200001000 + CMI_JOIN_GAME;
mi.hIcolibItem = NULL;
contactMenuItems[CMI_JOIN_GAME] = Menu_AddContactMenuItem(&mi);
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp index 66bc247ea8..00f933a804 100644 --- a/protocols/Steam/src/steam_options.cpp +++ b/protocols/Steam/src/steam_options.cpp @@ -25,7 +25,7 @@ void CSteamOptionsMain::OnInitDialog() void CSteamOptionsMain::OnApply()
{
- TCHAR *group = m_group.GetText();
+ wchar_t *group = m_group.GetText();
if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
Clist_GroupCreate(0, group);
diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 9958bd334c..22896647d8 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -35,7 +35,7 @@ void CSteamProto::ParsePollData(JSONNode *data) PROTORECVEVENT recv = { 0 }; recv.timestamp = timestamp; recv.szMessage = szMessage; - if (_tcsstr(type, L"my_") == NULL) + if (wcsstr(type, L"my_") == NULL) { ProtoChainRecvMsg(hContact, &recv); } @@ -223,7 +223,7 @@ void CSteamProto::PollingThread(void*) { // Remember last message timestamp node = json_get(root, "utc_timestamp"); - time_t timestamp = _ttoi64(ptrT(json_as_string(node))); + time_t timestamp = _wtoi64(ptrT(json_as_string(node))); if (timestamp > getDword("LastMessageTS", 0)) setDword("LastMessageTS", timestamp); diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index a6aacedd65..9eadb0fb42 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) +CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) : PROTO<CSteamProto>(protoName, userName), hAuthProcess(1), hMessageProcess(1) { @@ -18,22 +18,22 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) GetModuleFileName(g_hInstance, filePath, MAX_PATH); wchar_t sectionName[100]; - mir_sntprintf(sectionName, L"%s/%s", LPGENT("Protocols"), LPGENT(MODULE)); + mir_sntprintf(sectionName, L"%s/%s", LPGENW("Protocols"), MODULEW); char settingName[100]; mir_snprintf(settingName, "%s_%s", MODULE, "main"); SKINICONDESC sid = { 0 }; sid.flags = SIDF_ALL_TCHAR; - sid.defaultFile.t = filePath; + sid.defaultFile.w = filePath; sid.pszName = settingName; - sid.section.t = sectionName; - sid.description.t = LPGENT("Protocol icon"); + sid.section.w = sectionName; + sid.description.w = LPGENW("Protocol icon"); sid.iDefaultIndex = -IDI_STEAM; IcoLib_AddIcon(&sid); mir_snprintf(settingName, "%s_%s", MODULE, "gaming"); - sid.description.t = LPGENT("Gaming icon"); + sid.description.w = LPGENW("Gaming icon"); sid.iDefaultIndex = -IDI_GAMING; IcoLib_AddIcon(&sid); @@ -65,7 +65,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) CreateProtoService(STEAM_DB_GETEVENTTEXT_CHATSTATES, &CSteamProto::OnGetEventTextChatStates); // netlib support - TCHAR name[128]; + wchar_t name[128]; mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; @@ -85,7 +85,7 @@ CSteamProto::~CSteamProto() MCONTACT CSteamProto::AddToList(int, PROTOSEARCHRESULT* psr) { MCONTACT hContact = NULL; - ptrA steamId(mir_u2a(psr->id.t)); + ptrA steamId(mir_u2a(psr->id.w)); if (psr->cbSize == sizeof(PROTOSEARCHRESULT)) { if (!FindContact(steamId)) @@ -136,7 +136,7 @@ int CSteamProto::Authorize(MEVENT hDbEvent) return 1; } -int CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CSteamProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { if (IsOnline() && hDbEvent) { @@ -162,7 +162,7 @@ int CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) return 1; } -int CSteamProto::AuthRequest(MCONTACT hContact, const TCHAR*) +int CSteamProto::AuthRequest(MCONTACT hContact, const wchar_t*) { if (IsOnline() && hContact) { @@ -222,7 +222,7 @@ DWORD_PTR CSteamProto:: GetCaps(int type, MCONTACT) } } -HANDLE CSteamProto::SearchBasic(const TCHAR* id) +HANDLE CSteamProto::SearchBasic(const wchar_t* id) { if (!this->IsOnline()) return 0; @@ -238,13 +238,13 @@ HANDLE CSteamProto::SearchBasic(const TCHAR* id) return (HANDLE)STEAM_SEARCH_BYID; } -HANDLE CSteamProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) +HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) { if (!this->IsOnline()) return 0; // Combine all fields to single text - TCHAR keywordsT[200]; + wchar_t keywordsT[200]; mir_sntprintf(keywordsT, L"%s %s %s", nick, firstName, lastName); ptrA token(getStringA("TokenSecret")); diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 672f500451..812f88051e 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -46,13 +46,13 @@ 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 HANDLE __cdecl SearchBasic(const TCHAR *id);
- virtual HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName);
+ virtual HANDLE __cdecl SearchBasic(const wchar_t *id);
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName);
virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
@@ -74,7 +74,7 @@ public: static void UninitMenus();
protected:
- TCHAR *password;
+ wchar_t *password;
bool isLoginAgain;
time_t m_idleTS;
HANDLE m_evRequestsQueue, m_hQueueThread;
@@ -192,7 +192,7 @@ protected: void OnInitStatusMenu();
// avatars
- TCHAR* GetAvatarFilePath(MCONTACT hContact);
+ wchar_t* GetAvatarFilePath(MCONTACT hContact);
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai);
void CheckAvatarChange(MCONTACT hContact, std::string avatarUrl);
@@ -223,8 +223,8 @@ protected: static int RsaEncrypt(const char *pszModulus, const char *data, BYTE *encrypted, DWORD &encryptedSize);
- static void CSteamProto::ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
- static void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static void CSteamProto::ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
INT_PTR __cdecl OnGetEventTextChatStates(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index c45440cb10..264afff378 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -159,7 +159,7 @@ exit: return 0;
}
-void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, int flags, MCONTACT hContact)
+void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact)
{
if (Miranda_Terminated())
return;
@@ -179,9 +179,9 @@ void CSteamProto::ShowNotification(const TCHAR *caption, const wchar_t *message, MessageBox(NULL, message, caption, MB_OK | flags);
}
-void CSteamProto::ShowNotification(const TCHAR *message, int flags, MCONTACT hContact)
+void CSteamProto::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact)
{
- ShowNotification(TranslateT(MODULE), message, flags, hContact);
+ ShowNotification(MODULEW, message, flags, hContact);
}
INT_PTR __cdecl CSteamProto::OnGetEventTextChatStates(WPARAM, LPARAM lParam)
|