From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: 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 --- protocols/JabberG/src/jabber.cpp | 20 +- protocols/JabberG/src/jabber_adhoc.cpp | 48 +- protocols/JabberG/src/jabber_agent.cpp | 14 +- protocols/JabberG/src/jabber_api.cpp | 6 +- protocols/JabberG/src/jabber_archive.cpp | 20 +- protocols/JabberG/src/jabber_bookmarks.cpp | 18 +- protocols/JabberG/src/jabber_byte.cpp | 42 +- protocols/JabberG/src/jabber_byte.h | 18 +- protocols/JabberG/src/jabber_caps.cpp | 148 +++--- protocols/JabberG/src/jabber_caps.h | 32 +- protocols/JabberG/src/jabber_captcha.cpp | 4 +- protocols/JabberG/src/jabber_chat.cpp | 222 ++++----- protocols/JabberG/src/jabber_console.cpp | 16 +- protocols/JabberG/src/jabber_disco.cpp | 84 ++-- protocols/JabberG/src/jabber_disco.h | 58 +-- protocols/JabberG/src/jabber_events.cpp | 12 +- protocols/JabberG/src/jabber_file.cpp | 26 +- protocols/JabberG/src/jabber_filterlist.cpp | 16 +- protocols/JabberG/src/jabber_form.cpp | 58 +-- protocols/JabberG/src/jabber_frame.cpp | 18 +- protocols/JabberG/src/jabber_ft.cpp | 38 +- protocols/JabberG/src/jabber_groupchat.cpp | 134 +++--- protocols/JabberG/src/jabber_ibb.cpp | 8 +- protocols/JabberG/src/jabber_ibb.h | 6 +- protocols/JabberG/src/jabber_icolib.cpp | 44 +- protocols/JabberG/src/jabber_icolib.h | 2 +- protocols/JabberG/src/jabber_iq.cpp | 34 +- protocols/JabberG/src/jabber_iq.h | 32 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 68 +-- protocols/JabberG/src/jabber_iqid.cpp | 192 ++++---- protocols/JabberG/src/jabber_iqid_muc.cpp | 22 +- protocols/JabberG/src/jabber_libstr.cpp | 2 +- protocols/JabberG/src/jabber_list.cpp | 44 +- protocols/JabberG/src/jabber_list.h | 22 +- protocols/JabberG/src/jabber_menu.cpp | 26 +- protocols/JabberG/src/jabber_message_handlers.cpp | 12 +- protocols/JabberG/src/jabber_message_manager.cpp | 4 +- protocols/JabberG/src/jabber_message_manager.h | 2 +- protocols/JabberG/src/jabber_misc.cpp | 64 +-- protocols/JabberG/src/jabber_notes.cpp | 74 +-- protocols/JabberG/src/jabber_notes.h | 28 +- protocols/JabberG/src/jabber_opt.cpp | 562 +++++++++++----------- protocols/JabberG/src/jabber_opttree.cpp | 12 +- protocols/JabberG/src/jabber_opttree.h | 6 +- protocols/JabberG/src/jabber_password.cpp | 4 +- protocols/JabberG/src/jabber_privacy.cpp | 110 ++--- protocols/JabberG/src/jabber_privacy.h | 32 +- protocols/JabberG/src/jabber_proto.cpp | 86 ++-- protocols/JabberG/src/jabber_proto.h | 154 +++--- protocols/JabberG/src/jabber_rc.cpp | 50 +- protocols/JabberG/src/jabber_rc.h | 26 +- protocols/JabberG/src/jabber_search.cpp | 94 ++-- protocols/JabberG/src/jabber_search.h | 30 +- protocols/JabberG/src/jabber_secur.cpp | 30 +- protocols/JabberG/src/jabber_secur.h | 18 +- protocols/JabberG/src/jabber_svc.cpp | 90 ++-- protocols/JabberG/src/jabber_thread.cpp | 170 +++---- protocols/JabberG/src/jabber_treelist.cpp | 12 +- protocols/JabberG/src/jabber_userinfo.cpp | 54 +-- protocols/JabberG/src/jabber_util.cpp | 194 ++++---- protocols/JabberG/src/jabber_vcard.cpp | 46 +- protocols/JabberG/src/jabber_ws.cpp | 2 +- protocols/JabberG/src/jabber_xml.cpp | 56 +-- protocols/JabberG/src/jabber_xml.h | 36 +- protocols/JabberG/src/jabber_xstatus.cpp | 470 +++++++++--------- protocols/JabberG/src/jabber_xstatus.h | 28 +- protocols/JabberG/src/stdafx.h | 106 ++-- 67 files changed, 2108 insertions(+), 2108 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 3c5f4e165a..75c4f3dfab 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -44,7 +44,7 @@ CHAT_MANAGER *pci; int g_cbCountries; CountryListEntry *g_countries; -TCHAR szCoreVersion[100]; +wchar_t szCoreVersion[100]; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -126,10 +126,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) // init fontservice for info frame FontIDT fontid = { 0 }; fontid.cbSize = sizeof(fontid); - _tcsncpy_s(fontid.group, LPGENT("Jabber"), _TRUNCATE); + wcsncpy_s(fontid.group, LPGENW("Jabber"), _TRUNCATE); strncpy_s(fontid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE); - _tcsncpy_s(fontid.backgroundGroup, L"Jabber", _TRUNCATE); - _tcsncpy_s(fontid.backgroundName, L"Background", _TRUNCATE); + wcsncpy_s(fontid.backgroundGroup, L"Jabber", _TRUNCATE); + wcsncpy_s(fontid.backgroundName, L"Background", _TRUNCATE); fontid.flags = FIDF_DEFAULTVALID; fontid.deffontsettings.charset = DEFAULT_CHARSET; @@ -138,22 +138,22 @@ static int OnModulesLoaded(WPARAM, LPARAM) mir_tstrncpy(fontid.deffontsettings.szFace, L"MS Shell Dlg", _countof(fontid.deffontsettings.szFace)); fontid.deffontsettings.style = 0; - _tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE); + wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameTitle", _TRUNCATE); fontid.deffontsettings.style = DBFONTF_BOLD; FontRegisterT(&fontid); - _tcsncpy_s(fontid.name, LPGENT("Frame text"), _TRUNCATE); + wcsncpy_s(fontid.name, LPGENW("Frame text"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameClock", _TRUNCATE); fontid.deffontsettings.style = 0; FontRegisterT(&fontid); ColourIDT colourid = {0}; colourid.cbSize = sizeof(colourid); - _tcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); + wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); strncpy_s(colourid.dbSettingsGroup, GLOBAL_SETTING_MODULE, _TRUNCATE); - _tcsncpy_s(colourid.name, L"Background", _TRUNCATE); + wcsncpy_s(colourid.name, L"Background", _TRUNCATE); strncpy_s(colourid.setting, "clFrameBack", _TRUNCATE); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); @@ -164,7 +164,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////// // OnLoad - initialize the plugin instance -static CJabberProto* jabberProtoInit(const char* pszProtoName, const TCHAR *tszUserName) +static CJabberProto* jabberProtoInit(const char* pszProtoName, const wchar_t *tszUserName) { CJabberProto *ppro = new CJabberProto(pszProtoName, tszUserName); g_Instances.insert(ppro); @@ -233,7 +233,7 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyHookableEvent(hDiscoInfoResult); if (g_nTempFileId != 0) { - TCHAR tszTempPath[MAX_PATH], tszFilePath[MAX_PATH]; + wchar_t tszTempPath[MAX_PATH], tszFilePath[MAX_PATH]; GetTempPath(_countof(tszTempPath), tszTempPath); mir_sntprintf(tszFilePath, L"%sjab*.tmp.*", tszTempPath); diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 045c72c092..ea2d3c6748 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -106,13 +106,13 @@ void CJabberProto::OnIqResult_CommandExecution(HXML iqNode, CJabberIqInfo *pInfo SendMessage(GetWindowFromIq(pInfo), JAHM_PROCESSRESULT, (WPARAM)xmlCopyNode(iqNode), 0); } -void CJabberProto::AdHoc_RequestListOfCommands(TCHAR * szResponder, HWND hwndDlg) +void CJabberProto::AdHoc_RequestListOfCommands(wchar_t * szResponder, HWND hwndDlg) { m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_ListOfCommands, JABBER_IQ_TYPE_GET, szResponder, 0, -1, hwndDlg)) << XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(L"node", JABBER_FEAT_COMMANDS)); } -int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* dat) +int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, wchar_t*, JabberAdHocData* dat) { for (int i = 1;; i++) { HXML itemNode = XmlGetNthChild(dat->CommandsNode, L"item", i); @@ -122,9 +122,9 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* da if (BST_UNCHECKED == IsDlgButtonChecked(GetDlgItem(hwndDlg, IDC_FRAME), i)) continue; - const TCHAR *node = XmlGetAttrValue(itemNode, L"node"); + const wchar_t *node = XmlGetAttrValue(itemNode, L"node"); if (node) { - const TCHAR *jid2 = XmlGetAttrValue(itemNode, L"jid"); + const wchar_t *jid2 = XmlGetAttrValue(itemNode, L"jid"); m_ThreadInfo->send( XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg)) << XCHILDNS(L"command", JABBER_FEAT_COMMANDS) << XATTR(L"node", node) << XATTR(L"action", L"execute")); @@ -142,12 +142,12 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* da int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat) { int nodeIdx = 0; - const TCHAR * type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t * type = XmlGetAttrValue(iqNode, L"type"); if (!type || !mir_tstrcmp(type, L"error")) { // error occurred here - TCHAR buff[255]; - const TCHAR *code = NULL; - const TCHAR *description = NULL; + wchar_t buff[255]; + const wchar_t *code = NULL; + const wchar_t *description = NULL; HXML errorNode = XmlGetChild(iqNode, "error"); if (errorNode) { @@ -165,8 +165,8 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE); HXML queryNode = XmlGetChild(iqNode, "query"); if (queryNode) { - const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); - const TCHAR *node = XmlGetAttrValue(queryNode, L"node"); + const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); + const wchar_t *node = XmlGetAttrValue(queryNode, L"node"); if (xmlns && node && !mir_tstrcmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !mir_tstrcmp(node, JABBER_FEAT_COMMANDS)) validResponse = TRUE; } @@ -179,7 +179,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe if (!itemNode) break; - const TCHAR *name = XmlGetAttrValue(itemNode, L"name"); + const wchar_t *name = XmlGetAttrValue(itemNode, L"name"); if (!name) name = XmlGetAttrValue(itemNode, L"node"); ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), TranslateTS(name), nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0); dat->CurrentHeight = ypos; @@ -211,7 +211,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA dat->AdHocNode = xmlCopyNode(workNode); - const TCHAR *type; + const wchar_t *type; if ((type = XmlGetAttrValue(workNode, L"type")) == NULL) return TRUE; if (!mir_tstrcmp(type, L"result")) { // wParam = node from responder as a result of command execution @@ -219,7 +219,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA if ((commandNode = XmlGetChild(dat->AdHocNode, L"command")) == NULL) return TRUE; - const TCHAR *status = XmlGetAttrValue(commandNode, L"status"); + const wchar_t *status = XmlGetAttrValue(commandNode, L"status"); if (!status) status = L"completed"; @@ -274,9 +274,9 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0}; sttShowControls(hwndDlg, FALSE, toHide); - const TCHAR *code=NULL; - const TCHAR *description=NULL; - TCHAR buff[255]; + const wchar_t *code=NULL; + const wchar_t *description=NULL; + wchar_t buff[255]; HXML errorNode = XmlGetChild(workNode , "error"); if (errorNode) { code = XmlGetAttrValue(errorNode, L"code"); @@ -289,7 +289,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA return TRUE; } -int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TCHAR* action) +int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, wchar_t* action) { HXML commandNode = XmlGetChild(dat->AdHocNode, "command"); HXML xNode = XmlGetChild(commandNode, "x"); @@ -299,11 +299,11 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TC XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg)); HXML command = iq << XCHILDNS(L"command", JABBER_FEAT_COMMANDS); - const TCHAR *sessionId = XmlGetAttrValue(commandNode, L"sessionid"); + const wchar_t *sessionId = XmlGetAttrValue(commandNode, L"sessionid"); if (sessionId) command << XATTR(L"sessionid", sessionId); - const TCHAR *node = XmlGetAttrValue(commandNode, L"node"); + const wchar_t *node = XmlGetAttrValue(commandNode, L"node"); if (node) command << XATTR(L"node", node); @@ -322,7 +322,7 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TC return TRUE; } -int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, int ypos, int value) +int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, wchar_t * labelStr, int id, int ypos, int value) { RECT strRect = { 0 }; int verticalStep = 4; @@ -384,7 +384,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA if (!pStartupParams->m_szNode) { dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg); - TCHAR Caption[512]; + wchar_t Caption[512]; mir_sntprintf(Caption, TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID); SetWindowText(hwndDlg, Caption); } @@ -397,7 +397,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE); SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK")); - TCHAR Caption[512]; + wchar_t Caption[512]; mir_sntprintf(Caption, TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID); SetWindowText(hwndDlg, Caption); } @@ -517,8 +517,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (hContact && szJid != NULL) { JABBER_LIST_ITEM *item = NULL; int selected = 0; - TCHAR jid[JABBER_MAX_JID_LEN]; - _tcsncpy_s(jid, szJid, _TRUNCATE); + wchar_t jid[JABBER_MAX_JID_LEN]; + wcsncpy_s(jid, szJid, _TRUNCATE); { mir_cslock lck(m_csLists); item = ListGetItemPtr(LIST_ROSTER, jid); diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index f7c2b64a45..a09ad50983 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -52,10 +52,10 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_JABBER_REGDLG_UPDATE) { - if ((TCHAR*)lParam == NULL) + if ((wchar_t*)lParam == NULL) SetDlgItemText(m_hwnd, IDC_REG_STATUS, TranslateT("No message")); else - SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam); + SetDlgItemText(m_hwnd, IDC_REG_STATUS, (wchar_t*)lParam); SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0); @@ -82,12 +82,12 @@ class CAgentRegDlg : public CJabberDlgBase int m_formHeight, m_frameHeight; RECT m_frameRect; HXML m_agentRegIqNode; - TCHAR *m_jid; + wchar_t *m_jid; CCtrlButton m_submit; public: - CAgentRegDlg(CJabberProto *_ppro, TCHAR *_jid) : + CAgentRegDlg(CJabberProto *_ppro, wchar_t *_jid) : CJabberDlgBase(_ppro, IDD_FORM, false), m_submit(this, IDC_SUBMIT), m_jid(_jid), @@ -226,14 +226,14 @@ public: void OnSubmit(CCtrlButton*) { HXML queryNode, xNode; - const TCHAR *from; + const wchar_t *from; if (m_agentRegIqNode == NULL) return; if ((from = XmlGetAttrValue(m_agentRegIqNode, L"from")) == NULL) return; if ((queryNode = XmlGetChild(m_agentRegIqNode , "query")) == NULL) return; HWND hFrame = GetDlgItem(m_hwnd, IDC_FRAME); - TCHAR *str2 = (TCHAR*)alloca(sizeof(TCHAR) * 128); + wchar_t *str2 = (wchar_t*)alloca(sizeof(wchar_t) * 128); int id = 0; XmlNodeIq iq( m_proto->AddIQ(&CJabberProto::OnIqResultSetRegister, JABBER_IQ_TYPE_SET, from)); @@ -277,7 +277,7 @@ public: } }; -void CJabberProto::RegisterAgent(HWND /*hwndDlg*/, TCHAR* jid) +void CJabberProto::RegisterAgent(HWND /*hwndDlg*/, wchar_t* jid) { (new CAgentRegDlg(this, jid))->Show(); } diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 97850e9336..a144c1324d 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -64,7 +64,7 @@ LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) { if (jid == NULL) return NULL; - LPCTSTR p = _tcschr(jid, '/'); + LPCTSTR p = wcschr(jid, '/'); if (p == NULL) { mir_cslock lck(m_csLists); return mir_tstrdup(ListGetBestClientResourceNamePtr(jid)); @@ -240,7 +240,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) LPTSTR szExt = mir_tstrdup(szFeature); LPTSTR pSrc, pDst; for (pSrc = szExt, pDst = szExt; *pSrc; pSrc++) - if (_tcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc)) + if (wcschr(L"bcdfghjklmnpqrstvwxz0123456789", *pSrc)) *pDst++ = *pSrc; *pDst = 0; m_clientCapsManager.SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szExt, jcb); @@ -335,7 +335,7 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) iLen += mir_tstrlen(m_lstJabberFeatCapPairsDynamic[i]->szFeature) + 1; // allocate memory and fill it - LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(TCHAR)); + LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(wchar_t)); LPTSTR p = str; for (i=0; g_JabberFeatCapPairs[i].szFeature; i++) if (jcb & g_JabberFeatCapPairs[i].jcbCap) { diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 5d9d101ee6..d0718ab3ca 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -49,7 +49,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p time_t tmLast = getDword(hContact, "LastCollection", 0); if (tmLast) { - TCHAR buf[40]; + wchar_t buf[40]; list << XATTR(L"start", time2str(tmLast, buf, _countof(buf))); } m_ThreadInfo->send(iq); @@ -57,7 +57,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) { - const TCHAR *to = XmlGetAttrValue(iqNode, L"to"); + const wchar_t *to = XmlGetAttrValue(iqNode, L"to"); if (to == NULL || mir_tstrcmp(XmlGetAttrValue(iqNode, L"type"), L"result")) return; @@ -70,8 +70,8 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) if (!itemNode) break; - const TCHAR* start = XmlGetAttrValue(itemNode, L"start"); - const TCHAR* with = XmlGetAttrValue(itemNode, L"with"); + const wchar_t* start = XmlGetAttrValue(itemNode, L"start"); + const wchar_t* with = XmlGetAttrValue(itemNode, L"with"); if (!start || !with) continue; @@ -228,8 +228,8 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) if (!chatNode || mir_tstrcmp(XmlGetAttrValue(chatNode, L"xmlns"), JABBER_FEAT_ARCHIVE)) return; - const TCHAR* start = XmlGetAttrValue(chatNode, L"start"); - const TCHAR* with = XmlGetAttrValue(chatNode, L"with"); + const wchar_t* start = XmlGetAttrValue(chatNode, L"start"); + const wchar_t* with = XmlGetAttrValue(chatNode, L"with"); if (!start || !with) return; @@ -248,7 +248,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) break; int from; - const TCHAR *itemName = XmlGetName(itemNode); + const wchar_t *itemName = XmlGetName(itemNode); if (!mir_tstrcmp(itemName, L"to")) from = DBEF_SENT; else if (!mir_tstrcmp(itemName, L"from")) @@ -260,8 +260,8 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) if (!body) continue; - const TCHAR *tszBody = XmlGetText(body); - const TCHAR *tszSecs = XmlGetAttrValue(itemNode, L"secs"); + const wchar_t *tszBody = XmlGetText(body); + const wchar_t *tszSecs = XmlGetAttrValue(itemNode, L"secs"); if (!tszBody || !tszSecs) continue; @@ -273,7 +273,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) dbei.cbBlob = (DWORD)mir_strlen(szEventText)+1; dbei.flags = DBEF_READ + DBEF_UTF + from; dbei.pBlob = szEventText; - dbei.timestamp = tmStart + _ttol(tszSecs); + dbei.timestamp = tmStart + _wtol(tszSecs); if (!IsDuplicateEvent(hContact, dbei)) db_event_add(hContact, &dbei); diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 362e300e89..f7915fe86b 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -36,7 +36,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM { JabberAddBookmarkDlgParam* param = (JabberAddBookmarkDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - TCHAR text[512]; + wchar_t text[512]; JABBER_LIST_ITEM *item; switch (msg) { @@ -48,7 +48,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM TranslateDialogDefault(hwndDlg); if (item = param->m_item) { if (!mir_tstrcmp(item->type, L"conference")) { - if (!_tcschr(item->jid, _T('@'))) { //no room name - consider it is transport + if (!wcschr(item->jid, '@')) { //no room name - consider it is transport CheckDlgButton(hwndDlg, IDC_AGENT_RADIO, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE); @@ -110,7 +110,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM case IDOK: { GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)); - TCHAR *roomJID = NEWTSTR_ALLOCA(text); + wchar_t *roomJID = NEWWSTR_ALLOCA(text); if (param->m_item) param->ppro->ListRemove(LIST_BOOKMARK, param->m_item->jid); @@ -207,7 +207,7 @@ private: int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED); if (iItem < 0) return; - TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem); + wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem); if (address == NULL) return; JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address); @@ -226,7 +226,7 @@ private: int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED); if (iItem < 0) return; - TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem); + wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem); if (address == NULL) return; JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address); @@ -323,7 +323,7 @@ void CJabberDlgBookmarks::OpenBookmark() int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED); if (iItem < 0) return; - TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem); + wchar_t *address = (wchar_t *)m_lvBookmarks.GetItemData(iItem); if (address == NULL) return; JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address); @@ -333,12 +333,12 @@ void CJabberDlgBookmarks::OpenBookmark() m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item /* some hack for using bookmark to transport not under XEP-0048 */ - if (!_tcschr(item->jid, _T('@'))) + if (!wcschr(item->jid, '@')) //the room name is not provided let consider that it is transport and send request to registration m_proto->RegisterAgent(NULL, item->jid); else { - TCHAR *room = NEWTSTR_ALLOCA(item->jid); - TCHAR *server = _tcschr(room, _T('@')); + wchar_t *room = NEWWSTR_ALLOCA(item->jid); + wchar_t *server = wcschr(room, '@'); *(server++) = 0; if (item->nick && *item->nick) diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 8059f3a1bd..c889f7099f 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -60,13 +60,13 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) { HXML queryNode = XmlGetChild(iqNode , "query"); if (queryNode) { - const TCHAR *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns"); + const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns"); if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) { HXML streamHostNode = XmlGetChild(queryNode , "streamhost"); if (streamHostNode) { - const TCHAR *streamJid = XmlGetAttrValue(streamHostNode, L"jid"); - const TCHAR *streamHost = XmlGetAttrValue(streamHostNode, L"host"); - const TCHAR *streamPort = XmlGetAttrValue(streamHostNode, L"port"); + const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid"); + const wchar_t *streamHost = XmlGetAttrValue(streamHostNode, L"host"); + const wchar_t *streamPort = XmlGetAttrValue(streamHostNode, L"port"); if (streamJid && streamHost && streamPort) { jbt->szProxyHost = mir_tstrdup(streamHost); jbt->szProxyJid = mir_tstrdup(streamJid); @@ -83,7 +83,7 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo) void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) { CJabberProto *ppro = (CJabberProto*)extra; - TCHAR szPort[8]; + wchar_t szPort[8]; JABBER_BYTE_TRANSFER *jbt; int recvResult, bytesParsed; HANDLE hListen; @@ -142,7 +142,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) { - TCHAR szPort[8]; + wchar_t szPort[8]; HANDLE hEvent = NULL; CJabberIqInfo *pInfo = NULL; int nIqId = 0; @@ -299,11 +299,11 @@ void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) { HXML queryNode = XmlGetChild(iqNode , "query"); if (queryNode) { - const TCHAR *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns"); + const wchar_t *queryXmlns = XmlGetAttrValue(queryNode, L"xmlns"); if (queryXmlns && !mir_tstrcmp(queryXmlns, JABBER_FEAT_BYTESTREAMS)) { HXML streamHostNode = XmlGetChild(queryNode , "streamhost-used"); if (streamHostNode) { - const TCHAR *streamJid = XmlGetAttrValue(streamHostNode, L"jid"); + const wchar_t *streamJid = XmlGetAttrValue(streamHostNode, L"jid"); if (streamJid) jbt->szStreamhostUsed = mir_tstrdup(streamJid); } } } } @@ -360,10 +360,10 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b // 04-07 bnd.addr server bound address // 08-09 bnd.port server bound port if (datalen == 47 && *((DWORD*)buffer)==0x03000105 && buffer[4]==40 && *((WORD*)(buffer+45))==0) { - TCHAR text[256]; + wchar_t text[256]; - TCHAR *szInitiatorJid = JabberPrepareJid(jbt->srcJID); - TCHAR *szTargetJid = JabberPrepareJid(jbt->dstJID); + wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID); + wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID); mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid); mir_free(szInitiatorJid); mir_free(szTargetJid); @@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) { int id = JabberGetPacketID(iqNode); - TCHAR listJid[JABBER_MAX_JID_LEN]; + wchar_t listJid[JABBER_MAX_JID_LEN]; mir_sntprintf(listJid, L"ftproxy_%d", id); JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid); @@ -423,7 +423,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) { - TCHAR *szHost, *szPort; + wchar_t *szHost, *szPort; WORD port; HANDLE hConn; char data[3]; @@ -444,7 +444,7 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) szPort = jbt->szProxyPort; szHost = jbt->szProxyHost; - port = (WORD)_ttoi(szPort); + port = (WORD)_wtoi(szPort); replaceStrT(jbt->streamhostJID, jbt->szProxyJid); NETLIBOPENCONNECTION nloc = { 0 }; @@ -509,10 +509,10 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch *((DWORD*)data) = 0x03000105; data[4] = 40; - TCHAR text[256]; + wchar_t text[256]; - TCHAR *szInitiatorJid = JabberPrepareJid(jbt->srcJID); - TCHAR *szTargetJid = JabberPrepareJid(jbt->dstJID); + wchar_t *szInitiatorJid = JabberPrepareJid(jbt->srcJID); + wchar_t *szTargetJid = JabberPrepareJid(jbt->dstJID); mir_sntprintf(text, L"%s%s%s", jbt->sid, szInitiatorJid, szTargetJid); mir_free(szInitiatorJid); mir_free(szTargetJid); @@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext(); - TCHAR listJid[256]; + wchar_t listJid[256]; mir_sntprintf(listJid, L"ftproxy_%d", iqId); JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid); @@ -587,7 +587,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) { HXML iqNode, queryNode = NULL, n; - const TCHAR *sid = NULL, *from = NULL, *to = NULL, *szId = NULL, *szHost, *szPort, *str; + const wchar_t *sid = NULL, *from = NULL, *to = NULL, *szId = NULL, *szHost, *szPort, *str; int i; WORD port; HANDLE hConn; @@ -623,7 +623,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) (szPort = XmlGetAttrValue(n, L"port")) != NULL && (str = XmlGetAttrValue(n, L"jid")) != NULL) { - port = (WORD)_ttoi(szPort); + port = (WORD)_wtoi(szPort); replaceStrT(jbt->streamhostJID, str); debugLog(L"bytestream_recv connecting to %s:%d", szHost, port); @@ -705,7 +705,7 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char *((DWORD*)data) = 0x03000105; data[4] = 40; - TCHAR text[JABBER_MAX_JID_LEN * 2]; + wchar_t text[JABBER_MAX_JID_LEN * 2]; { ptrT szInitiatorJid(JabberPrepareJid(jbt->srcJID)); ptrT szTargetJid(JabberPrepareJid(jbt->dstJID)); diff --git a/protocols/JabberG/src/jabber_byte.h b/protocols/JabberG/src/jabber_byte.h index 604f9702f9..3c705533f8 100644 --- a/protocols/JabberG/src/jabber_byte.h +++ b/protocols/JabberG/src/jabber_byte.h @@ -35,11 +35,11 @@ struct JABBER_BYTE_TRANSFER { ~JABBER_BYTE_TRANSFER(); - TCHAR *sid; - TCHAR *srcJID; - TCHAR *dstJID; - TCHAR *streamhostJID; - TCHAR *iqId; + wchar_t *sid; + wchar_t *srcJID; + wchar_t *dstJID; + wchar_t *streamhostJID; + wchar_t *iqId; JABBER_BYTE_STATE state; HANDLE hConn; HANDLE hEvent; @@ -52,10 +52,10 @@ struct JABBER_BYTE_TRANSFER // XEP-0065 proxy support BOOL bProxyDiscovered; HANDLE hProxyEvent; - TCHAR *szProxyHost; - TCHAR *szProxyPort; - TCHAR *szProxyJid; - TCHAR *szStreamhostUsed; + wchar_t *szProxyHost; + wchar_t *szProxyPort; + wchar_t *szProxyJid; + wchar_t *szStreamhostUsed; BOOL bStreamActivated; HANDLE hSendEvent; }; diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index eb859e524b..275e869901 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -29,52 +29,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "version.h" const JabberFeatCapPair g_JabberFeatCapPairs[] = { - { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENT("Supports Service Discovery info") }, - { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENT("Supports Service Discovery items list") }, - { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENT("Can inform about its Jabber capabilities") }, - { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENT("Supports stream initiation (e.g., for filetransfers)") }, - { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENT("Supports stream initiation for file transfers") }, - { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENT("Supports file transfers via SOCKS5 Bytestreams") }, - { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENT("Supports file transfers via In-Band Bytestreams") }, - { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") }, - { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENT("Supports file transfers via Out-of-Band Bytestreams") }, - { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENT("Supports execution of Ad-Hoc commands") }, - { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENT("Supports in-band registration") }, - { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENT("Supports multi-user chat") }, - { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENT("Can report chat state in a chat session") }, - { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENT("Can report information about the last activity of the user") }, - { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENT("Can report own version information") }, - { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENT("Can report local time of the user") }, - { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENT("Can send and receive ping requests") }, - { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENT("Supports data forms") }, - { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENT("Can request and respond to events relating to the delivery, display, and composition of messages") }, - { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENT("Supports vCard") }, - { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENT("Supports iq-based avatars") }, - { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENT("Supports XHTML formatting of chat messages") }, - { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENT("Supports Jabber Browsing") }, - { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENT("Supports Jabber Browsing") }, - { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENT("Can negotiate options for specific features") }, - { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENT("Can request advanced processing of message stanzas") }, - { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENT("Can report information about user moods") }, - { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENT("Receives information about user moods") }, - { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENT("Supports generic publish-subscribe functionality") }, - { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENT("Supports SecureIM plugin for Miranda NG") }, - { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENT("Supports OTR (Off-the-Record Messaging)") }, - { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENT("Supports New_GPG plugin for Miranda NG") }, - { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENT("Blocks packets from other users/group chats using Privacy lists") }, - { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENT("Supports Message Receipts") }, - { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENT("Can report information about the music to which a user is listening") }, - { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENT("Receives information about the music to which a user is listening") }, - { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENT("Supports private XML Storage (for bookmarks and other)") }, - { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENT("Supports attention requests ('nudge')") }, - { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENT("Supports chat history retrieving") }, - { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENT("Supports chat history management") }, - { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENT("Can report information about user activity") }, - { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENT("Receives information about user activity") }, - { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENT("Supports Miranda NG notes extension") }, - { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENT("Supports Jingle") }, - { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENT("Supports Roster Exchange") }, - { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENT("Supports direct chat invitations (XEP-0249)") }, + { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENW("Supports Service Discovery info") }, + { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENW("Supports Service Discovery items list") }, + { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENW("Can inform about its Jabber capabilities") }, + { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENW("Supports stream initiation (e.g., for filetransfers)") }, + { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENW("Supports stream initiation for file transfers") }, + { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENW("Supports file transfers via SOCKS5 Bytestreams") }, + { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENW("Supports file transfers via In-Band Bytestreams") }, + { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") }, + { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") }, + { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENW("Supports execution of Ad-Hoc commands") }, + { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENW("Supports in-band registration") }, + { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENW("Supports multi-user chat") }, + { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENW("Can report chat state in a chat session") }, + { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENW("Can report information about the last activity of the user") }, + { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENW("Can report own version information") }, + { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENW("Can report local time of the user") }, + { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENW("Can send and receive ping requests") }, + { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENW("Supports data forms") }, + { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENW("Can request and respond to events relating to the delivery, display, and composition of messages") }, + { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENW("Supports vCard") }, + { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENW("Supports iq-based avatars") }, + { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENW("Supports XHTML formatting of chat messages") }, + { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENW("Supports Jabber Browsing") }, + { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENW("Supports Jabber Browsing") }, + { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENW("Can negotiate options for specific features") }, + { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENW("Can request advanced processing of message stanzas") }, + { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENW("Can report information about user moods") }, + { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENW("Receives information about user moods") }, + { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENW("Supports generic publish-subscribe functionality") }, + { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENW("Supports SecureIM plugin for Miranda NG") }, + { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENW("Supports OTR (Off-the-Record Messaging)") }, + { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENW("Supports New_GPG plugin for Miranda NG") }, + { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENW("Blocks packets from other users/group chats using Privacy lists") }, + { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENW("Supports Message Receipts") }, + { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENW("Can report information about the music to which a user is listening") }, + { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENW("Receives information about the music to which a user is listening") }, + { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENW("Supports private XML Storage (for bookmarks and other)") }, + { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENW("Supports attention requests ('nudge')") }, + { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENW("Supports chat history retrieving") }, + { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENW("Supports chat history management") }, + { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENW("Can report information about user activity") }, + { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENW("Receives information about user activity") }, + { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENW("Supports Miranda NG notes extension") }, + { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") }, + { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") }, + { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") }, { NULL } }; @@ -110,9 +110,9 @@ void CJabberProto::OnIqResultCapsDiscoInfoSI(HXML, CJabberIqInfo *pInfo) // XEP-0232 support HXML xform; for (int i = 1; (xform = XmlGetNthChild(query, L"x", i)) != NULL; i++) { - TCHAR *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value"); + wchar_t *szFormTypeValue = XPath(xform, L"field[@var='FORM_TYPE']/value"); if (szFormTypeValue && !mir_tstrcmp(szFormTypeValue, L"urn:xmpp:dataforms:softwareinfo")) { - TCHAR *szTmp = XPath(xform, L"field[@var='os']/value"); + wchar_t *szTmp = XPath(xform, L"field[@var='os']/value"); if (szTmp) r->m_tszOs = mir_tstrdup(szTmp); szTmp = XPath(xform, L"field[@var='os_version']/value"); @@ -143,7 +143,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) JabberCapsBits jcbCaps = 0; HXML feature; for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) { - const TCHAR *featureName = XmlGetAttrValue(feature, L"var"); + const wchar_t *featureName = XmlGetAttrValue(feature, L"var"); if (!featureName) continue; @@ -177,12 +177,12 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo) } } -JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) +JabberCapsBits CJabberProto::GetTotalJidCapabilites(const wchar_t *jid) { if (jid == NULL) return JABBER_RESOURCE_CAPS_NONE; - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(jid, szBareJid, _countof(szBareJid)); JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szBareJid); @@ -200,7 +200,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) if (item) { for (int i = 0; i < item->arResources.getCount(); i++) { - TCHAR szFullJid[JABBER_MAX_JID_LEN]; + wchar_t szFullJid[JABBER_MAX_JID_LEN]; mir_sntprintf(szFullJid, L"%s/%s", szBareJid, item->arResources[i]->m_tszResourceName); JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE); if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) @@ -210,13 +210,13 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) return jcbToReturn; } -JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appendBestResource) +JabberCapsBits CJabberProto::GetResourceCapabilites(const wchar_t *jid, BOOL appendBestResource) { - TCHAR fullJid[JABBER_MAX_JID_LEN]; + wchar_t fullJid[JABBER_MAX_JID_LEN]; if (appendBestResource) GetClientJID(jid, fullJid, _countof(fullJid)); else - _tcsncpy_s(fullJid, jid, _TRUNCATE); + wcsncpy_s(fullJid, jid, _TRUNCATE); pResourceStatus r(ResourceInfoFromJID(fullJid)); if (r == NULL) @@ -239,7 +239,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen m_clientCapsManager.SetClientCaps(r->m_tszCapsNode, r->m_tszCapsVer, JABBER_RESOURCE_CAPS_IN_PROGRESS, pInfo->GetIqId()); r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime(); - TCHAR queryNode[512]; + wchar_t queryNode[512]; mir_sntprintf(queryNode, L"%s#%s", r->m_tszCapsNode, r->m_tszCapsVer); m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(L"node", queryNode)); @@ -251,9 +251,9 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen jcbCaps |= jcbMainCaps; if (jcbMainCaps != JABBER_RESOURCE_CAPS_TIMEOUT && r->m_tszCapsExt) { - TCHAR *caps = mir_tstrdup(r->m_tszCapsExt); + wchar_t *caps = mir_tstrdup(r->m_tszCapsExt); - TCHAR *token = _tcstok(caps, L" "); + wchar_t *token = wcstok(caps, L" "); while (token) { switch (jcbExtCaps = m_clientCapsManager.GetClientCaps(r->m_tszCapsNode, token)) { case JABBER_RESOURCE_CAPS_ERROR: @@ -282,7 +282,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen jcbCaps |= jcbExtCaps; } - token = _tcstok(NULL, L" "); + token = wcstok(NULL, L" "); } mir_free(caps); @@ -388,7 +388,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen ///////////////////////////////////////////////////////////////////////////////////////// // CJabberClientPartialCaps class -CJabberClientPartialCaps::CJabberClientPartialCaps(const TCHAR *szVer) +CJabberClientPartialCaps::CJabberClientPartialCaps(const wchar_t *szVer) { m_szVer = mir_tstrdup(szVer); m_jcbCaps = JABBER_RESOURCE_CAPS_UNINIT; @@ -430,7 +430,7 @@ JabberCapsBits CJabberClientPartialCaps::GetCaps() return m_jcbCaps; } -CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const TCHAR *szVer) +CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const wchar_t *szVer) { if (!m_pCaps || !szVer) return NULL; @@ -461,7 +461,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindById(int nIqId) ///////////////////////////////////////////////////////////////////////////////////////// // CJabberClientCaps class -CJabberClientCaps::CJabberClientCaps(const TCHAR *szNode) +CJabberClientCaps::CJabberClientCaps(const wchar_t *szNode) { m_szNode = mir_tstrdup(szNode); m_pCaps = NULL; @@ -483,13 +483,13 @@ CJabberClientCaps* CJabberClientCaps::SetNext(CJabberClientCaps *pClient) return pRetVal; } -JabberCapsBits CJabberClientCaps::GetPartialCaps(TCHAR *szVer) +JabberCapsBits CJabberClientCaps::GetPartialCaps(wchar_t *szVer) { CJabberClientPartialCaps *pCaps = FindByVersion(szVer); return (pCaps) ? pCaps->GetCaps() : JABBER_RESOURCE_CAPS_UNINIT; } -BOOL CJabberClientCaps::SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/) +BOOL CJabberClientCaps::SetPartialCaps(const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/) { CJabberClientPartialCaps *pCaps = FindByVersion(szVer); if (!pCaps) { @@ -529,7 +529,7 @@ CJabberClientCapsManager::~CJabberClientCapsManager() delete m_pClients; } -CJabberClientCaps * CJabberClientCapsManager::FindClient(const TCHAR *szNode) +CJabberClientCaps * CJabberClientCapsManager::FindClient(const wchar_t *szNode) { if (!m_pClients || !szNode) return NULL; @@ -552,7 +552,7 @@ void CJabberClientCapsManager::AddDefaultCaps() SetClientCaps(JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature, g_JabberFeatCapPairsExt[i].jcbCap); } -JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szVer) +JabberCapsBits CJabberClientCapsManager::GetClientCaps(wchar_t *szNode, wchar_t *szVer) { mir_cslockfull lck(m_cs); CJabberClientCaps *pClient = FindClient(szNode); @@ -567,7 +567,7 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szV return jcbCaps; } -BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/) +BOOL CJabberClientCapsManager::SetClientCaps(const wchar_t *szNode, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/) { mir_cslockfull lck(m_cs); CJabberClientCaps *pClient = FindClient(szNode); @@ -604,7 +604,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps) return bOk; } -BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode) +BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode) { int i; JabberCapsBits jcb = 0; @@ -614,7 +614,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con if (!g_JabberFeatCapPairsExt[i].Valid()) continue; - TCHAR szExtCap[ 512 ]; + wchar_t szExtCap[ 512 ]; mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature); if (!mir_tstrcmp(szNode, szExtCap)) { jcb = g_JabberFeatCapPairsExt[i].jcbCap; @@ -624,7 +624,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con // check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures() for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) { - TCHAR szExtCap[ 512 ]; + wchar_t szExtCap[ 512 ]; mir_sntprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt); if (!mir_tstrcmp(szNode, szExtCap)) { jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap; @@ -663,16 +663,16 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con query << XCHILD(L"feature") << XATTR(L"var", ppro->m_lstJabberFeatCapPairsDynamic[i]->szFeature); if (ppro->m_options.AllowVersionRequests && !szNode) { - TCHAR szOsBuffer[256] = {0}; - TCHAR *os = szOsBuffer; + wchar_t szOsBuffer[256] = {0}; + wchar_t *os = szOsBuffer; if (ppro->m_options.ShowOSVersion) { if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer))) mir_tstrncpy(szOsBuffer, L"", _countof(szOsBuffer)); else { - TCHAR *szOsWindows = L"Microsoft Windows"; + wchar_t *szOsWindows = L"Microsoft Windows"; size_t nOsWindowsLength = mir_tstrlen(szOsWindows); - if (!_tcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength)) + if (!wcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength)) os += nOsWindowsLength + 1; } } diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index d9ed0422c4..b4b9e78ec2 100644 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -207,14 +207,14 @@ class CJabberClientPartialCaps { protected: - TCHAR *m_szVer; + wchar_t *m_szVer; JabberCapsBits m_jcbCaps; CJabberClientPartialCaps *m_pNext; int m_nIqId; DWORD m_dwRequestTime; public: - CJabberClientPartialCaps(const TCHAR *szVer); + CJabberClientPartialCaps(const wchar_t *szVer); ~CJabberClientPartialCaps(); CJabberClientPartialCaps* SetNext(CJabberClientPartialCaps *pCaps); @@ -225,7 +225,7 @@ public: void SetCaps(JabberCapsBits jcbCaps, int nIqId = -1); JabberCapsBits GetCaps(); - __inline TCHAR* GetVersion() + __inline wchar_t* GetVersion() { return m_szVer; } @@ -238,16 +238,16 @@ class CJabberClientCaps { protected: - TCHAR *m_szNode; + wchar_t *m_szNode; CJabberClientPartialCaps *m_pCaps; CJabberClientCaps *m_pNext; protected: - CJabberClientPartialCaps* FindByVersion(const TCHAR *szVer); + CJabberClientPartialCaps* FindByVersion(const wchar_t *szVer); CJabberClientPartialCaps* FindById(int nIqId); public: - CJabberClientCaps(const TCHAR *szNode); + CJabberClientCaps(const wchar_t *szNode); ~CJabberClientCaps(); CJabberClientCaps* SetNext(CJabberClientCaps *pClient); @@ -255,11 +255,11 @@ public: { return m_pNext; } - JabberCapsBits GetPartialCaps(TCHAR *szVer); - BOOL SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId = -1); + JabberCapsBits GetPartialCaps(wchar_t *szVer); + BOOL SetPartialCaps(const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1); BOOL SetPartialCaps(int nIqId, JabberCapsBits jcbCaps); - __inline TCHAR* GetNode() + __inline wchar_t* GetNode() { return m_szNode; } }; @@ -273,7 +273,7 @@ protected: CJabberProto *ppro; protected: - CJabberClientCaps *FindClient(const TCHAR *szNode); + CJabberClientCaps *FindClient(const wchar_t *szNode); public: CJabberClientCapsManager(CJabberProto *proto); @@ -281,11 +281,11 @@ public: void AddDefaultCaps(); - JabberCapsBits GetClientCaps(TCHAR *szNode, TCHAR *szVer); - BOOL SetClientCaps(const TCHAR *szNode, const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId = -1); + JabberCapsBits GetClientCaps(wchar_t *szNode, wchar_t *szVer); + BOOL SetClientCaps(const wchar_t *szNode, const wchar_t *szVer, JabberCapsBits jcbCaps, int nIqId = -1); BOOL SetClientCaps(int nIqId, JabberCapsBits jcbCaps); - BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode); + BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode); }; struct JabberFeatCapPair @@ -308,10 +308,10 @@ struct JabberFeatCapPairExt struct JabberFeatCapPairDynamic { - TCHAR *szExt; - TCHAR *szFeature; + wchar_t *szExt; + wchar_t *szFeature; JabberCapsBits jcbCap; - TCHAR *szDescription; + wchar_t *szDescription; }; extern const JabberFeatCapPair g_JabberFeatCapPairs[]; diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 53edb29bbf..159b9c15a0 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -35,7 +35,7 @@ struct CAPTCHA_FORM_PARAMS LPCTSTR hint; HBITMAP bmp; int w,h; - TCHAR Result[MAX_PATH]; + wchar_t Result[MAX_PATH]; }; INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -165,7 +165,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) return true; } -void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid) +void CJabberProto::sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid) { XmlNodeIq iq(L"set", SerialNext()); HXML query= iq <pfnGetStatusModeDescription(user->m_iStatus, 0); + wchar_t *ptszDescr = pcli->pfnGetStatusModeDescription(user->m_iStatus, 0); if (user->m_tszStatusMessage) buf.Format(TranslateT("User %s changed status to %s with message: %s"), user->m_tszResourceName, ptszDescr, user->m_tszStatusMessage); @@ -210,7 +210,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case INFO_AFFILIATION: if (m_options.GcLogAffiliations) { - TCHAR *name = NULL; + wchar_t *name = NULL; switch (user->m_affiliation) { case AFFILIATION_NONE: name = TranslateT("None"); break; case AFFILIATION_MEMBER: name = TranslateT("Member"); break; @@ -225,7 +225,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus case INFO_ROLE: if (m_options.GcLogRoles) { - TCHAR *name = NULL; + wchar_t *name = NULL; switch (user->m_role) { case ROLE_NONE: name = TranslateT("None"); break; case ROLE_VISITOR: name = TranslateT("Visitor"); break; @@ -253,11 +253,11 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus } } -void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode) +void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t *resource, const wchar_t *nick, const wchar_t *jid, int action, HXML reason, int nStatusCode) { int statusToSet = 0; - const TCHAR *szReason = XmlGetText(reason); + const wchar_t *szReason = XmlGetText(reason); if (szReason == NULL) { if (nStatusCode == 322) szReason = TranslateT("because room is now members-only"); @@ -328,12 +328,12 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR * void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) { - TCHAR *szMessage = NULL; + wchar_t *szMessage = NULL; if (code != 307 && code != 301) { ptrT tszMessage(getTStringA("GcMsgQuit")); if (tszMessage != NULL) - szMessage = NEWTSTR_ALLOCA(tszMessage); + szMessage = NEWWSTR_ALLOCA(tszMessage); else szMessage = TranslateTS(JABBER_GC_MSG_QUIT); } @@ -352,7 +352,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) item->bChatActive = false; if (m_bJabberOnline) { - TCHAR szPresenceTo[JABBER_MAX_JID_LEN]; + wchar_t szPresenceTo[JABBER_MAX_JID_LEN]; mir_sntprintf(szPresenceTo, L"%s/%s", item->jid, item->nick); m_ThreadInfo->send( @@ -402,30 +402,30 @@ static void sttShowGcMenuItems(GCMENUITEMS *items, DWORD *ids, int type) static gc_item sttLogListItems[] = { - { LPGENT("Change &nickname"), IDM_NICK, MENU_ITEM }, - { LPGENT("&Invite a user"), IDM_INVITE, MENU_ITEM }, + { LPGENW("Change &nickname"), IDM_NICK, MENU_ITEM }, + { LPGENW("&Invite a user"), IDM_INVITE, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("&Roles"), IDM_ROLE, MENU_NEWPOPUP }, - { LPGENT("&Participant list"), IDM_LST_PARTICIPANT, MENU_POPUPITEM }, - { LPGENT("&Moderator list"), IDM_LST_MODERATOR, MENU_POPUPITEM }, + { LPGENW("&Roles"), IDM_ROLE, MENU_NEWPOPUP }, + { LPGENW("&Participant list"), IDM_LST_PARTICIPANT, MENU_POPUPITEM }, + { LPGENW("&Moderator list"), IDM_LST_MODERATOR, MENU_POPUPITEM }, - { LPGENT("&Affiliations"), IDM_AFFLTN, MENU_NEWPOPUP }, - { LPGENT("&Member list"), IDM_LST_MEMBER, MENU_POPUPITEM }, - { LPGENT("&Admin list"), IDM_LST_ADMIN, MENU_POPUPITEM }, - { LPGENT("&Owner list"), IDM_LST_OWNER, MENU_POPUPITEM }, + { LPGENW("&Affiliations"), IDM_AFFLTN, MENU_NEWPOPUP }, + { LPGENW("&Member list"), IDM_LST_MEMBER, MENU_POPUPITEM }, + { LPGENW("&Admin list"), IDM_LST_ADMIN, MENU_POPUPITEM }, + { LPGENW("&Owner list"), IDM_LST_OWNER, MENU_POPUPITEM }, { NULL, 0, MENU_POPUPSEPARATOR }, - { LPGENT("Outcast list (&ban)"), IDM_LST_BAN, MENU_POPUPITEM }, + { LPGENW("Outcast list (&ban)"), IDM_LST_BAN, MENU_POPUPITEM }, - { LPGENT("&Room options"), 0, MENU_NEWPOPUP }, - { LPGENT("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM }, - { LPGENT("Add to &bookmarks"), IDM_BOOKMARKS, MENU_POPUPITEM }, - { LPGENT("&Configure..."), IDM_CONFIG, MENU_POPUPITEM }, - { LPGENT("&Destroy room"), IDM_DESTROY, MENU_POPUPITEM }, + { LPGENW("&Room options"), 0, MENU_NEWPOPUP }, + { LPGENW("View/change &topic"), IDM_TOPIC, MENU_POPUPITEM }, + { LPGENW("Add to &bookmarks"), IDM_BOOKMARKS, MENU_POPUPITEM }, + { LPGENW("&Configure..."), IDM_CONFIG, MENU_POPUPITEM }, + { LPGENW("&Destroy room"), IDM_DESTROY, MENU_POPUPITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("Lin&ks"), 0, MENU_NEWPOPUP }, + { LPGENW("Lin&ks"), 0, MENU_NEWPOPUP }, { NULL, IDM_LINK0, 0 }, { NULL, IDM_LINK1, 0 }, { NULL, IDM_LINK2, 0 }, @@ -437,33 +437,33 @@ static gc_item sttLogListItems[] = { NULL, IDM_LINK8, 0 }, { NULL, IDM_LINK9, 0 }, - { LPGENT("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM }, - { LPGENT("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM }, + { LPGENW("Copy room &JID"), IDM_CPY_RJID, MENU_ITEM }, + { LPGENW("Copy room topic"), IDM_CPY_TOPIC, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("&Send presence"), 0, MENU_NEWPOPUP }, - { LPGENT("Online"), IDM_PRESENCE_ONLINE, MENU_POPUPITEM }, - { LPGENT("Away"), IDM_PRESENCE_AWAY, MENU_POPUPITEM }, - { LPGENT("Not available"), IDM_PRESENCE_NA, MENU_POPUPITEM }, - { LPGENT("Do not disturb"), IDM_PRESENCE_DND, MENU_POPUPITEM }, - { LPGENT("Free for chat"), IDM_PRESENCE_FREE4CHAT, MENU_POPUPITEM }, + { LPGENW("&Send presence"), 0, MENU_NEWPOPUP }, + { LPGENW("Online"), IDM_PRESENCE_ONLINE, MENU_POPUPITEM }, + { LPGENW("Away"), IDM_PRESENCE_AWAY, MENU_POPUPITEM }, + { LPGENW("Not available"), IDM_PRESENCE_NA, MENU_POPUPITEM }, + { LPGENW("Do not disturb"), IDM_PRESENCE_DND, MENU_POPUPITEM }, + { LPGENW("Free for chat"), IDM_PRESENCE_FREE4CHAT, MENU_POPUPITEM }, - { LPGENT("&Leave chat session"), IDM_LEAVE, MENU_ITEM } + { LPGENW("&Leave chat session"), IDM_LEAVE, MENU_ITEM } }; -static TCHAR sttRJidBuf[JABBER_MAX_JID_LEN] = { 0 }; +static wchar_t sttRJidBuf[JABBER_MAX_JID_LEN] = { 0 }; static gc_item sttListItems[] = { - { LPGENT("&Slap"), IDM_SLAP, MENU_ITEM }, // 0 - { LPGENT("&User details"), IDM_VCARD, MENU_ITEM }, // 1 - { LPGENT("Member &info"), IDM_INFO, MENU_ITEM }, // 2 + { LPGENW("&Slap"), IDM_SLAP, MENU_ITEM }, // 0 + { LPGENW("&User details"), IDM_VCARD, MENU_ITEM }, // 1 + { LPGENW("Member &info"), IDM_INFO, MENU_ITEM }, // 2 { sttRJidBuf, 0, MENU_NEWPOPUP }, // 3 -> accessed explicitly by index!!! - { LPGENT("User &details"), IDM_RJID_VCARD, MENU_POPUPITEM }, - { LPGENT("&Add to roster"), IDM_RJID_ADD, MENU_POPUPITEM }, - { LPGENT("&Copy to clipboard"), IDM_RJID_COPY, MENU_POPUPITEM }, + { LPGENW("User &details"), IDM_RJID_VCARD, MENU_POPUPITEM }, + { LPGENW("&Add to roster"), IDM_RJID_ADD, MENU_POPUPITEM }, + { LPGENW("&Copy to clipboard"), IDM_RJID_COPY, MENU_POPUPITEM }, - { LPGENT("Invite to room"), 0, MENU_NEWPOPUP }, + { LPGENW("Invite to room"), 0, MENU_NEWPOPUP }, { NULL, IDM_LINK0, 0 }, { NULL, IDM_LINK1, 0 }, { NULL, IDM_LINK2, 0 }, @@ -477,24 +477,24 @@ static gc_item sttListItems[] = { NULL, 0, MENU_SEPARATOR }, - { LPGENT("Set &role"), IDM_ROLE, MENU_NEWPOPUP }, - { LPGENT("&Visitor"), IDM_SET_VISITOR, MENU_POPUPITEM }, - { LPGENT("&Participant"), IDM_SET_PARTICIPANT, MENU_POPUPITEM }, - { LPGENT("&Moderator"), IDM_SET_MODERATOR, MENU_POPUPITEM }, + { LPGENW("Set &role"), IDM_ROLE, MENU_NEWPOPUP }, + { LPGENW("&Visitor"), IDM_SET_VISITOR, MENU_POPUPITEM }, + { LPGENW("&Participant"), IDM_SET_PARTICIPANT, MENU_POPUPITEM }, + { LPGENW("&Moderator"), IDM_SET_MODERATOR, MENU_POPUPITEM }, - { LPGENT("Set &affiliation"), IDM_AFFLTN, MENU_NEWPOPUP }, - { LPGENT("&None"), IDM_SET_NONE, MENU_POPUPITEM }, - { LPGENT("&Member"), IDM_SET_MEMBER, MENU_POPUPITEM }, - { LPGENT("&Admin"), IDM_SET_ADMIN, MENU_POPUPITEM }, - { LPGENT("&Owner"), IDM_SET_OWNER, MENU_POPUPITEM }, + { LPGENW("Set &affiliation"), IDM_AFFLTN, MENU_NEWPOPUP }, + { LPGENW("&None"), IDM_SET_NONE, MENU_POPUPITEM }, + { LPGENW("&Member"), IDM_SET_MEMBER, MENU_POPUPITEM }, + { LPGENW("&Admin"), IDM_SET_ADMIN, MENU_POPUPITEM }, + { LPGENW("&Owner"), IDM_SET_OWNER, MENU_POPUPITEM }, { NULL, 0, MENU_POPUPSEPARATOR }, - { LPGENT("Outcast (&ban)"), IDM_SET_BAN, MENU_POPUPITEM }, + { LPGENW("Outcast (&ban)"), IDM_SET_BAN, MENU_POPUPITEM }, - { LPGENT("&Kick"), IDM_KICK, MENU_ITEM }, + { LPGENW("&Kick"), IDM_KICK, MENU_ITEM }, { NULL, 0, MENU_SEPARATOR }, - { LPGENT("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM }, - { LPGENT("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM }, - { LPGENT("Copy in-room JID"), IDM_CPY_INROOMJID, MENU_ITEM } + { LPGENW("Copy &nickname"), IDM_CPY_NICK, MENU_ITEM }, + { LPGENW("Copy real &JID"), IDM_CPY_RJID, MENU_ITEM }, + { LPGENW("Copy in-room JID"), IDM_CPY_INROOMJID, MENU_ITEM } }; int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) @@ -520,7 +520,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) } if (gcmi->Type == MENU_ON_LOG) { - static TCHAR url_buf[1024] = { 0 }; + static wchar_t url_buf[1024] = { 0 }; gcmi->nItems = _countof(sttLogListItems); gcmi->Item = sttLogListItems; @@ -532,16 +532,16 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) sttSetupGcMenuItem(gcmi, 0, FALSE); int idx = IDM_LINK0; - TCHAR *ptszStatusMsg = item->getTemp()->m_tszStatusMessage; + wchar_t *ptszStatusMsg = item->getTemp()->m_tszStatusMessage; if (ptszStatusMsg && *ptszStatusMsg) { - TCHAR *bufPtr = url_buf; - for (TCHAR *p = _tcsstr(ptszStatusMsg, L"http"); p && *p; p = _tcsstr(p + 1, L"http")) { - if (!_tcsncmp(p, L"http://", 7) || !_tcsncmp(p, L"https://", 8)) { + wchar_t *bufPtr = url_buf; + for (wchar_t *p = wcsstr(ptszStatusMsg, L"http"); p && *p; p = wcsstr(p + 1, L"http")) { + if (!wcsncmp(p, L"http://", 7) || !wcsncmp(p, L"https://", 8)) { mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf)); gc_item *pItem = sttFindGcMenuItem(gcmi, idx); pItem->pszDesc = bufPtr; pItem->uType = MENU_POPUPITEM; - for (; *bufPtr && !_istspace(*bufPtr); ++bufPtr); + for (; *bufPtr && !iswspace(*bufPtr); ++bufPtr); *bufPtr++ = 0; if (++idx > IDM_LINK9) @@ -603,7 +603,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) if (him->m_tszRealJid && *him->m_tszRealJid) { mir_sntprintf(sttRJidBuf, TranslateT("Real &JID: %s"), him->m_tszRealJid); - if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0; + if (wchar_t *tmp = wcschr(sttRJidBuf, '/')) *tmp = 0; if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) { gcmi->Item[3].uType = MENU_HMENU; @@ -653,11 +653,11 @@ class CGroupchatInviteDlg : public CJabberDlgBase struct JabberGcLogInviteDlgJidData { int hItem; - TCHAR jid[JABBER_MAX_JID_LEN]; + wchar_t jid[JABBER_MAX_JID_LEN]; }; LIST m_newJids; - TCHAR *m_room; + wchar_t *m_room; CCtrlButton m_btnInvite; CCtrlEdit m_txtNewJid; @@ -688,7 +688,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase m_clc.SetTextColor(i, GetSysColor(COLOR_WINDOWTEXT)); } - void InviteUser(TCHAR *pUser, TCHAR *text) + void InviteUser(wchar_t *pUser, wchar_t *text) { XmlNode msg(L"message"); HXML invite = msg << XATTR(L"to", m_room) << XATTRID(m_proto->SerialNext()) @@ -701,7 +701,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase } public: - CGroupchatInviteDlg(CJabberProto *ppro, const TCHAR *room) : + CGroupchatInviteDlg(CJabberProto *ppro, const wchar_t *room) : CSuper(ppro, IDD_GROUPCHAT_INVITE, NULL), m_newJids(1), m_btnInvite(this, IDC_INVITE), @@ -741,7 +741,7 @@ public: void OnCommand_AddJid(CCtrlButton*) { - TCHAR buf[JABBER_MAX_JID_LEN]; + wchar_t buf[JABBER_MAX_JID_LEN]; m_txtNewJid.GetText(buf, _countof(buf)); m_txtNewJid.SetTextA(""); @@ -805,17 +805,17 @@ public: ///////////////////////////////////////////////////////////////////////////////////////// // Context menu processing -void CJabberProto::AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal) +void CJabberProto::AdminSet(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal) { m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), to) << XQUERY(ns) << XCHILD(L"item") << XATTR(szItem, itemVal) << XATTR(var, varVal)); } -void CJabberProto::AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn) +void CJabberProto::AdminSetReason(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal, const wchar_t *rsn) { m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), to) << XQUERY(ns) << XCHILD(L"item") << XATTR(szItem, itemVal) << XATTR(var, varVal) << XCHILD(L"reason", rsn)); } -void CJabberProto::AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo) +void CJabberProto::AdminGet(const wchar_t *to, const wchar_t *ns, const wchar_t *var, const wchar_t *varVal, JABBER_IQ_HANDLER foo) { m_ThreadInfo->send(XmlNodeIq(AddIQ(foo, JABBER_IQ_TYPE_GET, to)) << XQUERY(ns) << XCHILD(L"item") << XATTR(var, varVal)); @@ -859,7 +859,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)Skin_LoadProtoIcon(dat->ppro->m_szModuleName, dat->him->m_iStatus), 0); - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("%s from\n%s"), dat->him->m_tszResourceName, dat->item->jid); SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf); @@ -913,7 +913,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam if (dat->him->m_affiliation == value) break; - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(dat->him->m_tszRealJid, szBareJid, _countof(szBareJid)); switch (value) { @@ -1014,9 +1014,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (szMessage == NULL) szMessage = mir_tstrdup(TranslateTS(JABBER_GC_MSG_SLAP)); - TCHAR buf[256]; + wchar_t buf[256]; // do not use snprintf to avoid possible problems with % symbol - if (TCHAR *p = _tcsstr(szMessage, L"%s")) { + if (wchar_t *p = wcsstr(szMessage, L"%s")) { *p = 0; mir_sntprintf(buf, L"%s%s%s", szMessage, him->m_tszResourceName, p + 2); } @@ -1060,7 +1060,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* dwLastBanKickTime = GetTickCount(); szBuffer.Format(L"%s: ", me->m_tszResourceName); szTitle.Format(TranslateT("Reason to kick %s"), him->m_tszResourceName); - TCHAR *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds + wchar_t *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_")) ppro->m_ThreadInfo->send( XmlNodeIq(L"set", ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN) @@ -1090,7 +1090,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_NONE: if (him->m_affiliation != AFFILIATION_NONE) { if (him->m_tszRealJid) { - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid)); ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"none"); } @@ -1101,7 +1101,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_MEMBER: if (him->m_affiliation != AFFILIATION_MEMBER) { if (him->m_tszRealJid) { - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid)); ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"member"); } @@ -1112,7 +1112,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_ADMIN: if (him->m_affiliation != AFFILIATION_ADMIN) { if (him->m_tszRealJid) { - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid)); ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"admin"); } @@ -1123,7 +1123,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_OWNER: if (him->m_affiliation != AFFILIATION_OWNER) { if (him->m_tszRealJid) { - TCHAR szBareJid[JABBER_MAX_JID_LEN]; + wchar_t szBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid)); ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, L"jid", szBareJid, L"affiliation", L"owner"); } @@ -1134,7 +1134,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_SET_BAN: if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) { if (him->m_tszRealJid && *him->m_tszRealJid) { - TCHAR szVictimBareJid[JABBER_MAX_JID_LEN]; + wchar_t szVictimBareJid[JABBER_MAX_JID_LEN]; JabberStripJid(him->m_tszRealJid, szVictimBareJid, _countof(szVictimBareJid)); szBuffer.Format(L"%s: ", me->m_tszResourceName); @@ -1153,9 +1153,9 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_LINK0: case IDM_LINK1: case IDM_LINK2: case IDM_LINK3: case IDM_LINK4: case IDM_LINK5: case IDM_LINK6: case IDM_LINK7: case IDM_LINK8: case IDM_LINK9: if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) { - TCHAR *resourceName_copy = NEWTSTR_ALLOCA(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds + wchar_t *resourceName_copy = NEWWSTR_ALLOCA(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds - TCHAR *szInviteTo = 0; + wchar_t *szInviteTo = 0; int idx = gch->dwData - IDM_LINK0; LISTFOREACH(i, ppro, LIST_CHATROOM) { @@ -1201,8 +1201,8 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_VCARD: if (him->m_tszRealJid && *him->m_tszRealJid) { - TCHAR *jid = NEWTSTR_ALLOCA(him->m_tszRealJid); - if (TCHAR *tmp = _tcschr(jid, _T('/'))) + wchar_t *jid = NEWWSTR_ALLOCA(him->m_tszRealJid); + if (wchar_t *tmp = wcschr(jid, '/')) *tmp = 0; MCONTACT hContact = ppro->AddToListByJID(jid, PALF_TEMPORARY); @@ -1218,10 +1218,10 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.id.t = NEWTSTR_ALLOCA(him->m_tszRealJid); - if (TCHAR *tmp = _tcschr(psr.id.t, _T('/'))) + psr.id.w = NEWWSTR_ALLOCA(him->m_tszRealJid); + if (wchar_t *tmp = wcschr(psr.id.w, '/')) *tmp = 0; - psr.nick.t = psr.id.t; + psr.nick.w = psr.id.w; ADDCONTACTSTRUCT acs = { 0 }; acs.handleType = HANDLE_SEARCHRESULT; @@ -1278,7 +1278,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g szBuffer = item->nick; if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) { if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != NULL) { - TCHAR text[1024]; + wchar_t text[1024]; mir_sntprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer); ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, NULL); } @@ -1333,7 +1333,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_LINK5: case IDM_LINK6: case IDM_LINK7: case IDM_LINK8: case IDM_LINK9: { int idx = IDM_LINK0; - for (TCHAR *p = _tcsstr(item->getTemp()->m_tszStatusMessage, L"http://"); p && *p; p = _tcsstr(p + 1, L"http://")) { + for (wchar_t *p = wcsstr(item->getTemp()->m_tszStatusMessage, L"http://"); p && *p; p = wcsstr(p + 1, L"http://")) { if (idx == gch->dwData) { char *bufPtr, *url = mir_t2a(p); for (bufPtr = url; *bufPtr && !isspace(*bufPtr); ++bufPtr); @@ -1361,9 +1361,9 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g ///////////////////////////////////////////////////////////////////////////////////////// // Sends a private message to a chat user -static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick) +static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const wchar_t *nick) { - TCHAR szFullJid[JABBER_MAX_JID_LEN]; + wchar_t szFullJid[JABBER_MAX_JID_LEN]; mir_sntprintf(szFullJid, L"%s/%s", item->jid, nick); MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, true, false); if (hContact != NULL) { @@ -1400,10 +1400,10 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) rtrimt(gch->ptszText); if (m_bJabberOnline) { - TCHAR tszID[100]; + wchar_t tszID[100]; int64_t id = (_time64(0) << 16) + (GetTickCount() & 0xFFFF); - TCHAR *buf = NEWTSTR_ALLOCA(gch->ptszText); + wchar_t *buf = NEWWSTR_ALLOCA(gch->ptszText); UnEscapeChatTags(buf); m_ThreadInfo->send( XmlNode(L"message") << XATTR(L"id", _i64tot(id, tszID, 36)) << XATTR(L"to", item->jid) << XATTR(L"type", L"groupchat") @@ -1436,20 +1436,20 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////////////// -void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn) +void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str, const wchar_t* rsn) { - const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? L"jid" : L"nick"; - TCHAR *roomJid = jidListInfo->roomJid; + const wchar_t *field = (jidListInfo->type == MUC_BANLIST || wcschr(str, '@')) ? L"jid" : L"nick"; + wchar_t *roomJid = jidListInfo->roomJid; if (jidListInfo->type == MUC_BANLIST) { AdminSetReason(roomJid, JABBER_FEAT_MUC_ADMIN, field, str, L"affiliation", L"outcast", rsn); AdminGet(roomJid, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList); } } -void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str) +void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str) { - const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? L"jid" : L"nick"; - TCHAR *roomJid = jidListInfo->roomJid; + const wchar_t *field = (jidListInfo->type == MUC_BANLIST || wcschr(str, '@')) ? L"jid" : L"nick"; + wchar_t *roomJid = jidListInfo->roomJid; switch (jidListInfo->type) { case MUC_VOICELIST: @@ -1479,9 +1479,9 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TC } } -void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO *jidListInfo, const TCHAR *jid) +void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO *jidListInfo, const wchar_t *jid) { - TCHAR *roomJid = jidListInfo->roomJid; + wchar_t *roomJid = jidListInfo->roomJid; switch (jidListInfo->type) { case MUC_VOICELIST: // change role to visitor (from participant) diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 2d1250eb88..3070d0b223 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -123,7 +123,7 @@ bool CJabberProto::FilterXml(HXML node, DWORD flags) mir_cslock lck(m_filterInfo.csPatternLock); - const TCHAR *attrValue; + const wchar_t *attrValue; switch (m_filterInfo.type) { case TFilterInfo::T_JID: attrValue = XmlGetAttrValue(node, (flags & JCPF_OUT) ? L"to" : L"from"); @@ -202,18 +202,18 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) if (flags&JCPF_OUT) sttAppendBufRaw(buf, "\\highlight4 "); sttAppendBufRaw(buf, "<"); sttAppendBufRaw(buf, RTF_BEGINTAGNAME); - sttAppendBufW(buf, (TCHAR*)XmlGetName(node)); + sttAppendBufW(buf, (wchar_t*)XmlGetName(node)); sttAppendBufRaw(buf, RTF_ENDTAGNAME); for (int i = 0; i < XmlGetAttrCount(node); i++) { - TCHAR *attr = (TCHAR*)xmlGetAttrName(node, i); + wchar_t *attr = (wchar_t*)xmlGetAttrName(node, i); sttAppendBufRaw(buf, " "); sttAppendBufRaw(buf, RTF_BEGINATTRNAME); sttAppendBufW(buf, attr); sttAppendBufRaw(buf, RTF_ENDATTRNAME); sttAppendBufRaw(buf, "=\""); sttAppendBufRaw(buf, RTF_BEGINATTRVAL); - sttAppendBufT(buf, (TCHAR*)XmlGetAttr(node, i)); + sttAppendBufT(buf, (wchar_t*)XmlGetAttr(node, i)); sttAppendBufRaw(buf, "\""); sttAppendBufRaw(buf, RTF_ENDATTRVAL); } @@ -274,7 +274,7 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) JABBER_LIST_ITEM *item = NULL; int len = GetWindowTextLength(hwndCombo) + 1; - TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR)); + wchar_t *buf = (wchar_t *)_alloca(len * sizeof(wchar_t)); GetWindowText(hwndCombo, buf, len); SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0); @@ -300,7 +300,7 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) struct { int type; - TCHAR *title; + wchar_t *title; char *icon; } static filter_modes[] = @@ -501,7 +501,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) MessageBox(m_hwnd, TranslateT("Can't send data while you are offline."), TranslateT("Jabber Error"), MB_ICONSTOP | MB_OK); else { int length = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_CONSOLEIN)) + 1; - TCHAR *textToSend = (TCHAR *)mir_alloc(length * sizeof(TCHAR)); + wchar_t *textToSend = (wchar_t *)mir_alloc(length * sizeof(wchar_t)); GetDlgItemText(m_hwnd, IDC_CONSOLEIN, textToSend, length); int bytesProcessed = 0; @@ -550,7 +550,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) mir_cslock lck(m_proto->m_filterInfo.csPatternLock); if (len > _countof(m_proto->m_filterInfo.pattern)) { - TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR)); + wchar_t *buf = (wchar_t *)_alloca(len * sizeof(wchar_t)); SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf); mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern)); } diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 7d49935abc..e93545ca06 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -54,9 +54,9 @@ enum { SD_OVERLAY_NONE, SD_OVERLAY_FAIL, SD_OVERLAY_PROGRESS, SD_OVERLAY_REGISTE static struct { - TCHAR *feature; - TCHAR *category; - TCHAR *type; + wchar_t *feature; + wchar_t *category; + wchar_t *type; char *iconName; int iconIndex; int listIndex; @@ -194,7 +194,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pI else { if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); pNode->SetInfoRequestErrorText(str); mir_free(str); } @@ -234,7 +234,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p else { if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); pNode->SetItemsRequestErrorText(str); mir_free(str); } @@ -262,7 +262,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo if (query) { HXML feature; for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) { - if (!mir_tstrcmp(XmlGetAttrValue(feature, L"var"), (TCHAR *)pInfo->m_pUserData)) { + if (!mir_tstrcmp(XmlGetAttrValue(feature, L"var"), (wchar_t *)pInfo->m_pUserData)) { CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), XmlGetAttrValue(iqNode, L"node"), NULL); SendBothRequests(pNode, NULL); break; @@ -287,8 +287,8 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf if (query) { HXML item; for (int i = 1; (item = XmlGetNthChild(query, L"item", i)) != NULL; i++) { - const TCHAR *szJid = XmlGetAttrValue(item, L"jid"); - const TCHAR *szNode = XmlGetAttrValue(item, L"node"); + const wchar_t *szJid = XmlGetAttrValue(item, L"jid"); + const wchar_t *szNode = XmlGetAttrValue(item, L"node"); CJabberIqInfo *pNewInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootInfo, JABBER_IQ_TYPE_GET, szJid); pNewInfo->m_pUserData = pInfo->m_pUserData; pNewInfo->SetTimeout(30000); @@ -384,8 +384,8 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent) void CJabberProto::PerformBrowse(HWND hwndDlg) { - TCHAR szJid[JABBER_MAX_JID_LEN]; - TCHAR szNode[512]; + wchar_t szJid[JABBER_MAX_JID_LEN]; + wchar_t szNode[512]; if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid))) szJid[0] = 0; if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode))) @@ -408,7 +408,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) LISTFOREACH(i, this, LIST_ROSTER) { if ((item = ListGetItemPtrFromIndex(i)) != NULL) { - if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) { + if (wcschr(item->jid, '@') == NULL && wcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) { MCONTACT hContact = HContactFromJID(item->jid); if (hContact != NULL) setByte(hContact, "IsTransport", TRUE); @@ -424,7 +424,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) } else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) { sttBrowseMode = SD_BROWSE_CONFERENCES; - TCHAR *szServerJid = mir_a2t(m_ThreadInfo->conn.server); + wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server); CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid); pInfo->m_pUserData = (void*)JABBER_FEAT_MUC; pInfo->SetTimeout(30000); @@ -435,7 +435,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) } else if (!mir_tstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) { sttBrowseMode = SD_BROWSE_AGENTS; - TCHAR *szServerJid = mir_a2t(m_ThreadInfo->conn.server); + wchar_t *szServerJid = mir_a2t(m_ThreadInfo->conn.server); CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid); pInfo->m_pUserData = (void*)L"jabber:iq:gateway"; pInfo->SetTimeout(30000); @@ -577,7 +577,7 @@ class CJabberDlgDiscovery : public CJabberDlgBase typedef CJabberDlgBase CSuper; public: - CJabberDlgDiscovery(CJabberProto *proto, TCHAR *jid); + CJabberDlgDiscovery(CJabberProto *proto, wchar_t *jid); protected: void OnInitDialog(); @@ -587,7 +587,7 @@ protected: int Resizer(UTILRESIZECONTROL *urc); private: - TCHAR *m_jid; + wchar_t *m_jid; bool m_focusEditAfterBrowse; CCtrlMButton m_btnViewAsTree; @@ -607,7 +607,7 @@ private: void lstDiscoTree_OnFilter(CCtrlFilterListView *); }; -CJabberDlgDiscovery::CJabberDlgDiscovery(CJabberProto *proto, TCHAR *jid) : +CJabberDlgDiscovery::CJabberDlgDiscovery(CJabberProto *proto, wchar_t *jid) : CJabberDlgBase(proto, IDD_SERVICE_DISCOVERY, NULL), m_jid(jid), m_btnViewAsTree(this, IDC_BTN_VIEWTREE, proto->LoadIconEx("sd_view_tree"), "View as tree"), @@ -1139,7 +1139,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } // extern references to used functions: -void SearchAddToRecent(TCHAR* szAddr, HWND hwndDialog = NULL); +void SearchAddToRecent(wchar_t* szAddr, HWND hwndDialog = NULL); void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM hItem, POINT pt) { @@ -1172,36 +1172,36 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM struct { - TCHAR *feature; - TCHAR *title; + wchar_t *feature; + wchar_t *title; int action; DWORD flags; } static items[] = { - { NULL, LPGENT("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE}, - { NULL, LPGENT("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE}, - { JABBER_FEAT_MUC, LPGENT("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE}, + { NULL, LPGENW("Contact Menu..."), SD_ACT_USERMENU, SD_FLG_NONODE}, + { NULL, LPGENW("View vCard"), SD_ACT_VCARD, SD_FLG_NONODE}, + { JABBER_FEAT_MUC, LPGENW("Join chatroom"), SD_ACT_JOIN, SD_FLG_NORESOURCE}, {0}, - { NULL, LPGENT("Refresh Info"), SD_ACT_REFRESH}, - { NULL, LPGENT("Refresh Children"), SD_ACT_REFRESHCHILDREN}, + { NULL, LPGENW("Refresh Info"), SD_ACT_REFRESH}, + { NULL, LPGENW("Refresh Children"), SD_ACT_REFRESHCHILDREN}, {0}, - { NULL, LPGENT("Add to favorites"), SD_ACT_FAVORITE}, - { NULL, LPGENT("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER}, - { JABBER_FEAT_MUC, LPGENT("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER}, - { L"jabber:iq:search", LPGENT("Add search directory"), SD_ACT_ADDDIRECTORY}, - { JABBER_FEAT_BYTESTREAMS, LPGENT("Use this proxy"), SD_ACT_PROXY}, + { NULL, LPGENW("Add to favorites"), SD_ACT_FAVORITE}, + { NULL, LPGENW("Add to roster"), SD_ACT_ROSTER, SD_FLG_NONODE | SD_FLG_NOTONROSTER}, + { JABBER_FEAT_MUC, LPGENW("Bookmark chatroom"), SD_ACT_BOOKMARK, SD_FLG_NORESOURCE | SD_FLG_HASUSER}, + { L"jabber:iq:search", LPGENW("Add search directory"), SD_ACT_ADDDIRECTORY}, + { JABBER_FEAT_BYTESTREAMS, LPGENW("Use this proxy"), SD_ACT_PROXY}, {0}, - { JABBER_FEAT_REGISTER, LPGENT("Register"), SD_ACT_REGISTER}, - { L"jabber:iq:gateway", LPGENT("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED}, - { JABBER_FEAT_COMMANDS, LPGENT("Commands..."), SD_ACT_ADHOC}, + { JABBER_FEAT_REGISTER, LPGENW("Register"), SD_ACT_REGISTER}, + { L"jabber:iq:gateway", LPGENW("Unregister"), SD_ACT_UNREGISTER, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED}, + { JABBER_FEAT_COMMANDS, LPGENW("Commands..."), SD_ACT_ADHOC}, {0}, - { L"jabber:iq:gateway", LPGENT("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE}, - { L"jabber:iq:gateway", LPGENT("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE}, + { L"jabber:iq:gateway", LPGENW("Logon"), SD_ACT_LOGON, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_ONLINE}, + { L"jabber:iq:gateway", LPGENW("Logoff"), SD_ACT_LOGOFF, SD_FLG_ONROSTER | SD_FLG_SUBSCRIBED | SD_FLG_NOTONLINE}, {0}, - { NULL, LPGENT("Copy JID"), SD_ACT_COPYJID}, - { NULL, LPGENT("Copy node name"), SD_ACT_COPYNODE}, - { NULL, LPGENT("Copy node information"), SD_ACT_COPYINFO}, + { NULL, LPGENW("Copy JID"), SD_ACT_COPYJID}, + { NULL, LPGENW("Copy node name"), SD_ACT_COPYNODE}, + { NULL, LPGENW("Copy node information"), SD_ACT_COPYINFO}, }; HMENU hMenu = CreatePopupMenu(); @@ -1224,9 +1224,9 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM continue; if ((items[i].flags & SD_FLG_NOTONLINE) && rosterItem && (rosterItem->getTemp()->m_iStatus == ID_STATUS_OFFLINE)) continue; - if ((items[i].flags & SD_FLG_NORESOURCE) && _tcschr(pNode->GetJid(), _T('/'))) + if ((items[i].flags & SD_FLG_NORESOURCE) && wcschr(pNode->GetJid(), '/')) continue; - if ((items[i].flags & SD_FLG_HASUSER) && !_tcschr(pNode->GetJid(), _T('@'))) + if ((items[i].flags & SD_FLG_HASUSER) && !wcschr(pNode->GetJid(), '@')) continue; } @@ -1330,7 +1330,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_COPYINFO: { - TCHAR buf[8192]; + wchar_t buf[8192]; pNode->GetTooltipText(buf, _countof(buf)); JabberCopyText(m_pDlgServiceDiscovery->GetHwnd(), buf); } @@ -1407,7 +1407,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_VCARD: { - TCHAR *jid = pNode->GetJid(); + wchar_t *jid = pNode->GetJid(); MCONTACT hContact = HContactFromJID(pNode->GetJid()); if (!hContact) hContact = AddToListByJID(jid, PALF_TEMPORARY); @@ -1453,7 +1453,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM } } -void CJabberProto::LaunchServiceDiscovery(TCHAR *jid) +void CJabberProto::LaunchServiceDiscovery(wchar_t *jid) { if (m_pDlgServiceDiscovery) { SetForegroundWindow(m_pDlgServiceDiscovery->GetHwnd()); diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h index 9c327a60f4..486d4c7289 100644 --- a/protocols/JabberG/src/jabber_disco.h +++ b/protocols/JabberG/src/jabber_disco.h @@ -36,12 +36,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CJabberSDIdentity { protected: - TCHAR *m_szCategory; - TCHAR *m_szType; - TCHAR *m_szName; + wchar_t *m_szCategory; + wchar_t *m_szType; + wchar_t *m_szName; CJabberSDIdentity *m_pNext; public: - CJabberSDIdentity(const TCHAR *szCategory, const TCHAR *szType, const TCHAR *szName) + CJabberSDIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName) { m_szCategory = mir_tstrdup(szCategory); m_szType = mir_tstrdup(szType); @@ -56,15 +56,15 @@ public: if (m_pNext) delete m_pNext; } - TCHAR *GetCategory() + wchar_t *GetCategory() { return m_szCategory; } - TCHAR *GetType() + wchar_t *GetType() { return m_szType; } - TCHAR *GetName() + wchar_t *GetName() { return m_szName; } @@ -84,10 +84,10 @@ class CJabberSDFeature; class CJabberSDFeature { protected: - TCHAR *m_szVar; + wchar_t *m_szVar; CJabberSDFeature *m_pNext; public: - CJabberSDFeature(const TCHAR *szVar) + CJabberSDFeature(const wchar_t *szVar) { m_szVar = szVar ? mir_tstrdup(szVar) : NULL; m_pNext = NULL; @@ -98,7 +98,7 @@ public: if (m_pNext) delete m_pNext; } - TCHAR *GetVar() + wchar_t *GetVar() { return m_szVar; } @@ -117,9 +117,9 @@ public: class CJabberSDNode { protected: - TCHAR *m_szJid; - TCHAR *m_szNode; - TCHAR *m_szName; + wchar_t *m_szJid; + wchar_t *m_szNode; + wchar_t *m_szName; CJabberSDIdentity *m_pIdentities; CJabberSDFeature *m_pFeatures; CJabberSDNode *m_pNext; @@ -129,10 +129,10 @@ protected: int m_nInfoRequestId; int m_nItemsRequestId; HTREELISTITEM m_hTreeItem; - TCHAR *m_szInfoError; - TCHAR *m_szItemsError; + wchar_t *m_szInfoError; + wchar_t *m_szItemsError; public: - CJabberSDNode(const TCHAR *szJid = NULL, const TCHAR *szNode = NULL, const TCHAR *szName = NULL) + CJabberSDNode(const wchar_t *szJid = NULL, const wchar_t *szNode = NULL, const wchar_t *szName = NULL) { m_szJid = mir_tstrdup(szJid); m_szNode = mir_tstrdup(szNode); @@ -227,25 +227,25 @@ public: { return m_nItemsRequestId; } - BOOL SetJid(TCHAR *szJid) + BOOL SetJid(wchar_t *szJid) { replaceStrT(m_szJid, szJid); return TRUE; } - TCHAR *GetJid() + wchar_t *GetJid() { return m_szJid; } - BOOL SetNode(TCHAR *szNode) + BOOL SetNode(wchar_t *szNode) { replaceStrT(m_szNode, szNode); return TRUE; } - TCHAR *GetNode() + wchar_t *GetNode() { return m_szNode; } - TCHAR *GetName() + wchar_t *GetName() { return m_szName; } @@ -291,7 +291,7 @@ public: } return NULL; } - BOOL AddFeature(const TCHAR *szFeature) + BOOL AddFeature(const wchar_t *szFeature) { if (!szFeature) return FALSE; @@ -305,7 +305,7 @@ public: return TRUE; } - BOOL AddIdentity(const TCHAR *szCategory, const TCHAR *szType, const TCHAR *szName) + BOOL AddIdentity(const wchar_t *szCategory, const wchar_t *szType, const wchar_t *szName) { if (!szCategory || !szType) return FALSE; @@ -319,7 +319,7 @@ public: return TRUE; } - BOOL AddChildNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName) + BOOL AddChildNode(const wchar_t *szJid, const wchar_t *szNode, const wchar_t *szName) { if (!szJid) return FALSE; @@ -333,19 +333,19 @@ public: return TRUE; } - BOOL SetItemsRequestErrorText(TCHAR *szError) + BOOL SetItemsRequestErrorText(wchar_t *szError) { replaceStrT(m_szItemsError, szError); return TRUE; } - BOOL SetInfoRequestErrorText(TCHAR *szError) + BOOL SetInfoRequestErrorText(wchar_t *szError) { replaceStrT(m_szInfoError, szError); return TRUE; } - BOOL GetTooltipText(TCHAR *szText, int nMaxLength) + BOOL GetTooltipText(wchar_t *szText, int nMaxLength) { CMString tszTmp; @@ -388,7 +388,7 @@ public: tszTmp.AppendFormat(L"\r\n%s: %s\r\n", TranslateT("Items request error"), m_szItemsError); tszTmp.TrimRight(); - _tcsncpy_s(szText, nMaxLength, tszTmp, _TRUNCATE); + wcsncpy_s(szText, nMaxLength, tszTmp, _TRUNCATE); return TRUE; } }; @@ -423,7 +423,7 @@ public: return m_pPrimaryNodes; } - CJabberSDNode* AddPrimaryNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName) + CJabberSDNode* AddPrimaryNode(const wchar_t *szJid, const wchar_t *szNode, const wchar_t *szName) { if (!szJid) return NULL; diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index b78c31f4c0..24580a5207 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -41,10 +41,10 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) return 0; if (ListGetItemPtr(LIST_ROSTER, jid)) { - if (!_tcschr(jid, _T('@'))) { - TCHAR szStrippedJid[JABBER_MAX_JID_LEN]; + if (!wcschr(jid, '@')) { + wchar_t szStrippedJid[JABBER_MAX_JID_LEN]; JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid)); - TCHAR *szDog = _tcschr(szStrippedJid, _T('@')); + wchar_t *szDog = wcschr(szStrippedJid, '@'); if (szDog && mir_tstrcmpi(szDog + 1, jid)) m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(L"remove")); } @@ -59,7 +59,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // JabberDbSettingChanged - process database changes -static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING *cws) +static wchar_t* sttSettingToTchar(DBCONTACTWRITESETTING *cws) { switch (cws->value.type) { case DBVT_ASCIIZ: @@ -95,7 +95,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC } } else { - TCHAR *p = sttSettingToTchar(cws); + wchar_t *p = sttSettingToTchar(cws); if (cws->value.pszVal != NULL && mir_tstrcmp(p, item->group)) { debugLog(L"Group set to %s", p); if (p) @@ -112,7 +112,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT return; if (cws->value.type == DBVT_DELETED) { - TCHAR *nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE); + wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, GCDNF_NOMYHANDLE); AddContactToRoster(item->jid, nick, item->group); mir_free(nick); return; diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index aef5167c73..a3e2c0776f 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -113,8 +113,8 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) } else { // FT_INITIALIZING if (str[0] == '\0') { - TCHAR *s; - if ((s = _tcsrchr(ft->httpPath, '/')) != NULL) + wchar_t *s; + if ((s = wcsrchr(ft->httpPath, '/')) != NULL) s++; else s = ft->httpPath; @@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, NETLIBCONNINFO connInfo = { sizeof(connInfo) }; CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo); - TCHAR szPort[10]; + wchar_t szPort[10]; mir_sntprintf(szPort, L"%d", connInfo.wPort); ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort); @@ -259,12 +259,12 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ft->hFileEvent = hEvent; - TCHAR szPort[20]; + wchar_t szPort[20]; mir_sntprintf(szPort, L"%d", nlb.wPort); JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort); item->ft = ft; - TCHAR *ptszResource = ListGetBestClientResourceNamePtr(ft->jid); + wchar_t *ptszResource = ListGetBestClientResourceNamePtr(ft->jid); if (ptszResource != NULL) { ft->state = FT_CONNECTING; for (int i = 0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) { @@ -273,8 +273,8 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) if (ft->httpPath) mir_free(ft->httpPath); ft->httpPath = NULL; - TCHAR *p; - if ((p = _tcschr(ft->std.ptszFiles[i], '\\')) != NULL) + wchar_t *p; + if ((p = wcschr(ft->std.ptszFiles[i], '\\')) != NULL) p++; else p = ft->std.ptszFiles[i]; @@ -293,7 +293,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) mir_snprintf(szAddr, "http://%s:%d/%s", myAddr, nlb.wPort, pFileName); size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2; - TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len); + wchar_t *fulljid = (wchar_t *)alloca(sizeof(wchar_t) * len); mir_sntprintf(fulljid, len, L"%s/%s", ft->jid, ptszResource); XmlNodeIq iq(L"set", ft->szId, fulljid); @@ -380,7 +380,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, num += 2; currentFile = ft->std.currentFileNumber; - TCHAR *t = _tcsrchr(ft->std.ptszFiles[currentFile], '\\'); + wchar_t *t = wcsrchr(ft->std.ptszFiles[currentFile], '\\'); if (t != NULL) t++; else @@ -395,8 +395,8 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, break; } debugLog(L"Sending [%s]", ft->std.ptszFiles[currentFile]); - _tstati64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size - if ((fileId = _topen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) { + _wstat64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size + if ((fileId = _wopen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) { debugLogA("File cannot be opened"); ft->state = FT_ERROR; mir_free(ft->httpPath); @@ -500,7 +500,7 @@ int filetransfer::create() if (fileId != -1) return fileId; - TCHAR filefull[MAX_PATH]; + wchar_t filefull[MAX_PATH]; mir_sntprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile); replaceStrT(std.tszCurrentFile, filefull); @@ -513,7 +513,7 @@ int filetransfer::create() if (fileId == -1) { ppro->debugLog(L"Saving to [%s]", std.tszCurrentFile); - fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); + fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); } if (fileId == -1) diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp index f03bf49ee1..1f86f9705f 100644 --- a/protocols/JabberG/src/jabber_filterlist.cpp +++ b/protocols/JabberG/src/jabber_filterlist.cpp @@ -35,7 +35,7 @@ struct CFilterData : public MZeroedObject HFONT m_hfntNormal; HFONT m_hfntEmpty; COLORREF m_clGray; - TCHAR *m_filterText; + wchar_t *m_filterText; RECT m_rcButtonClear; RECT m_rcEditBox; @@ -69,7 +69,7 @@ CCtrlFilterListView::~CCtrlFilterListView() delete fdat; } -TCHAR *CCtrlFilterListView::GetFilterText() +wchar_t *CCtrlFilterListView::GetFilterText() { return fdat->m_filterText; } @@ -100,7 +100,7 @@ static LRESULT CALLBACK sttEditBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (length == 1) fdat->m_filterText = 0; else { - fdat->m_filterText = (TCHAR *)mir_alloc(sizeof(TCHAR) * length); + fdat->m_filterText = (wchar_t *)mir_alloc(sizeof(wchar_t) * length); GetWindowText(hwnd, fdat->m_filterText, length); } @@ -127,9 +127,9 @@ static LRESULT CALLBACK sttEditBoxSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return CallWindowProc(fdat->m_oldWndProc, hwnd, msg, wParam, lParam); } -void CCtrlFilterListView::FilterHighlight(TCHAR *str) +void CCtrlFilterListView::FilterHighlight(wchar_t *str) { - TCHAR buf[256]; + wchar_t buf[256]; int count = GetItemCount(); for (int i=0; i < count; i++) { bool found = false; @@ -139,7 +139,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str) if (!*buf) break; - if (_tcsstr(buf, str)) { + if (wcsstr(buf, str)) { found = true; break; } @@ -165,12 +165,12 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara case 1: if (m_trackFilter && fdat->m_hwndEditBox) { - TCHAR *str = 0; + wchar_t *str = 0; int length = GetWindowTextLength(fdat->m_hwndEditBox) + 1; if (length == 1) str = 0; else { - str = (TCHAR *)mir_alloc(sizeof(TCHAR) * length); + str = (wchar_t *)mir_alloc(sizeof(wchar_t) * length); GetWindowText(fdat->m_hwndEditBox, str, length); } FilterHighlight(str); diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 6965e989da..a74abfae40 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -73,7 +73,7 @@ void JabberFormCenterContent(HWND hwndStatic) if ((style & SS_RIGHT) && !(style & WS_TABSTOP)) { RECT calcRect = rc; int len = GetWindowTextLength(hWndChild); - TCHAR *text = (TCHAR*)_alloca(sizeof(TCHAR)*(len + 1)); + wchar_t *text = (wchar_t*)_alloca(sizeof(wchar_t)*(len + 1)); GetWindowText(hWndChild, text, len + 1); HDC hdc = GetDC(hWndChild); HFONT hfntSave = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hWndChild, WM_GETFONT, 0, 0)); @@ -106,25 +106,25 @@ void JabberFormCenterContent(HWND hwndStatic) } } -void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) +void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text) { if (!text) text = L""; size_t len = mir_tstrlen(text); size_t fixedLen = len; for (int i = 1; i < len; i++) - if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r'))) + if ((text[i - 1] == '\n') && (text[i] != '\r')) ++fixedLen; - TCHAR *fixedText = NULL; + wchar_t *fixedText = NULL; if (fixedLen != len) { - fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen + 1)); - TCHAR *p = fixedText; + fixedText = (wchar_t *)mir_alloc(sizeof(wchar_t) * (fixedLen + 1)); + wchar_t *p = fixedText; for (int i = 0; i < len; i++) { *p = text[i]; - if (i && (text[i] == _T('\n')) && (text[i] != _T('\r'))) { - *p++ = _T('\r'); - *p = _T('\n'); + if (i && (text[i] == '\n') && (text[i] != '\r')) { + *p++ = '\r'; + *p = '\n'; } ++p; } @@ -142,7 +142,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) SetRect(&rcText, 0, 0, rcText.right - rcText.left, 0); HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION)); HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0)); - DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL); + DrawTextEx(hdcEdit, (wchar_t *)text, (int)mir_tstrlen(text), &rcText, DT_CALCRECT | DT_EDITCONTROL | DT_TOP | DT_WORDBREAK, NULL); SelectObject(hdcEdit, hfntSave); ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit); @@ -203,7 +203,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) if (fixedText) mir_free(fixedText); } -static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type) +static TJabberFormControlType JabberFormTypeNameToId(const wchar_t *type) { if (!mir_tstrcmp(type, L"text-private")) return JFORM_CTYPE_TEXT_PRIVATE; @@ -223,7 +223,7 @@ static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type) return JFORM_CTYPE_TEXT_SINGLE; } -void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayoutInfo *layout_info, const TCHAR *labelStr, const TCHAR *valueStr) +void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayoutInfo *layout_info, const wchar_t *labelStr, const wchar_t *valueStr) { RECT rcLabel = { 0 }, rcCtrl = { 0 }; if (item->hLabel) { @@ -286,7 +286,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo CreateWindow(L"static", labelStr, WS_CHILD|WS_VISIBLE|SS_CENTERIMAGE, \ 0, 0, 0, 0, hwndStatic, (HMENU)-1, hInst, NULL) -TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr) +TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const wchar_t *labelStr, const wchar_t *valueStr) { TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA); if (!controls) { @@ -376,7 +376,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo return item; } -static void JabberFormAddListItem(TJabberFormControlInfo *item, const TCHAR *text, bool selected) +static void JabberFormAddListItem(TJabberFormControlInfo *item, const wchar_t *text, bool selected) { DWORD dwIndex; switch (item->type) { @@ -436,8 +436,8 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp HXML v, vs; - const TCHAR *label, *typeName, *varStr, *str, *valueText; - TCHAR *labelStr, *valueStr; + const wchar_t *label, *typeName, *varStr, *str, *valueText; + wchar_t *labelStr, *valueStr; RECT frameRect; if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL) @@ -487,7 +487,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp if (XmlGetName(v) && !mir_tstrcmp(XmlGetName(v), L"value") && XmlGetText(v)) size += mir_tstrlen(XmlGetText(v)) + 2; } - valueStr = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); + valueStr = (wchar_t*)mir_alloc(sizeof(wchar_t)*size); valueStr[0] = '\0'; for (int j = 0;; j++) { v = XmlGetChild(n, j); @@ -576,8 +576,8 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) HWND hFrame, hCtrl; HXML n, v, o; int id, j, k, len; - const TCHAR *varName, *type, *fieldStr, *labelText, *str2; - TCHAR *p, *q, *str; + const wchar_t *varName, *type, *fieldStr, *labelText, *str2; + wchar_t *p, *q, *str; if (xNode == NULL || XmlGetName(xNode) == NULL || mir_tstrcmp(XmlGetName(xNode), L"x") || hwndStatic == NULL) return NULL; @@ -604,11 +604,11 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (!mir_tstrcmp(type, L"text-multi") || !mir_tstrcmp(type, L"jid-multi")) { len = GetWindowTextLength(GetDlgItem(hFrame, id)); - str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); + str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1)); GetDlgItemText(hFrame, id, str, len + 1); p = str; while (p != NULL) { - if ((q = _tcsstr(p, L"\r\n")) != NULL) + if ((q = wcsstr(p, L"\r\n")) != NULL) *q = '\0'; field << XCHILD(L"value", p); p = q ? q + 2 : NULL; @@ -617,14 +617,14 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) id++; } else if (!mir_tstrcmp(type, L"boolean")) { - TCHAR buf[10]; - _itot(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10); + wchar_t buf[10]; + _itow(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10); field << XCHILD(L"value", buf); id++; } else if (!mir_tstrcmp(type, L"list-single")) { len = GetWindowTextLength(GetDlgItem(hFrame, id)); - str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); + str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1)); GetDlgItemText(hFrame, id, str, len + 1); v = NULL; for (j = 0;; j++) { @@ -654,7 +654,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) { // an entry is selected len = SendMessage(hCtrl, LB_GETTEXTLEN, j, 0); - if ((str = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR))) != NULL) { + if ((str = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t))) != NULL) { SendMessage(hCtrl, LB_GETTEXT, j, (LPARAM)str); for (k = 0;; k++) { o = XmlGetChild(n, k); @@ -684,7 +684,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode) } else { // everything else is considered "text-single" or "text-private" len = GetWindowTextLength(GetDlgItem(hFrame, id)); - str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); + str = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1)); GetDlgItemText(hFrame, id, str, len + 1); field << XCHILD(L"value", str); mir_free(str); @@ -701,7 +701,7 @@ struct JABBER_FORM_INFO CJabberProto *ppro; HXML xNode; - TCHAR defTitle[128]; // Default title if no in xNode + wchar_t defTitle[128]; // Default title if no <title/> in xNode RECT frameRect; // Clipping region of the frame to scroll int frameHeight; // Height of the frame (can be eliminated, redundant to frameRect) int formHeight; // Actual height of the form @@ -854,14 +854,14 @@ static VOID CALLBACK JabberFormCreateDialogApcProc(void* param) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FORM), NULL, JabberFormDlgProc, (LPARAM)param); } -void CJabberProto::FormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata) +void CJabberProto::FormCreateDialog(HXML xNode, wchar_t* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata) { JABBER_FORM_INFO *jfi = new JABBER_FORM_INFO; memset(jfi, 0, sizeof(JABBER_FORM_INFO)); jfi->ppro = this; jfi->xNode = xmlCopyNode(xNode); if (defTitle) - _tcsncpy_s(jfi->defTitle, defTitle, _TRUNCATE); + wcsncpy_s(jfi->defTitle, defTitle, _TRUNCATE); jfi->pfnSubmit = pfnSubmit; jfi->userdata = userdata; diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 86faff30b5..c41f958c7b 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -34,7 +34,7 @@ class CJabberInfoFrameItem : public MZeroedObject public: char *m_pszName; HANDLE m_hIcolibIcon; - TCHAR *m_pszText; + wchar_t *m_pszText; LPARAM m_pUserData; bool m_bCompact; bool m_bShow; @@ -56,7 +56,7 @@ public: mir_free(m_pszText); } - void SetInfo(HANDLE hIcolibIcon, TCHAR *pszText) + void SetInfo(HANDLE hIcolibIcon, wchar_t *pszText) { mir_free(m_pszText); m_pszText = pszText ? mir_tstrdup(pszText) : NULL; @@ -242,21 +242,21 @@ void CJabberInfoFrame::ReloadFonts() FontIDT fontid = {0}; fontid.cbSize = sizeof(fontid); - _tcsncpy_s(fontid.group, L"Jabber", _TRUNCATE); - _tcsncpy_s(fontid.name, L"Frame title", _TRUNCATE); + wcsncpy_s(fontid.group, L"Jabber", _TRUNCATE); + wcsncpy_s(fontid.name, L"Frame title", _TRUNCATE); m_clTitle = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont); DeleteObject(m_hfntTitle); m_hfntTitle = CreateFontIndirect(&lfFont); - _tcsncpy_s(fontid.name, L"Frame text", _TRUNCATE); + wcsncpy_s(fontid.name, L"Frame text", _TRUNCATE); m_clText = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lfFont); DeleteObject(m_hfntText); m_hfntText = CreateFontIndirect(&lfFont); ColourIDT colourid = {0}; colourid.cbSize = sizeof(colourid); - _tcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); - _tcsncpy_s(colourid.name, L"Background", _TRUNCATE); + wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); + wcsncpy_s(colourid.name, L"Background", _TRUNCATE); m_clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, 0); UpdateSize(); @@ -295,7 +295,7 @@ void CJabberInfoFrame::RemoveTooltip(int id) SendMessage(m_hwndToolTip, TTM_DELTOOLW, 0, (LPARAM)&ti); } -void CJabberInfoFrame::SetToolTip(int id, RECT *rc, TCHAR *pszText) +void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText) { TOOLINFO ti = {0}; ti.cbSize = sizeof(TOOLINFO); @@ -459,7 +459,7 @@ void CJabberInfoFrame::SetInfoItemCallback(char *pszName, void (CJabberProto::*o pItem->m_onEvent = onEvent; } -void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, TCHAR *pszText) +void CJabberInfoFrame::UpdateInfoItem(char *pszName, HANDLE hIcolibIcon, wchar_t *pszText) { if (CJabberInfoFrameItem *pItem = m_pItems.find((CJabberInfoFrameItem*)&pszName)) pItem->SetInfo(hIcolibIcon, pszText); diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 0666d4d96c..a7142148d4 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -75,12 +75,12 @@ void CJabberProto::FtCancel(filetransfer *ft) ///////////////// File sending using stream initiation ///////////////////////// -void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) +void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft) { - TCHAR *rs; - TCHAR *filename, *p; + wchar_t *rs; + wchar_t *filename, *p; int i; - TCHAR sid[9]; + wchar_t sid[9]; if (jid == NULL || ft == NULL || !m_bJabberOnline || (rs = ListGetBestClientResourceNamePtr(jid)) == NULL) { if (ft) { @@ -96,10 +96,10 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) if (ft->sid != NULL) mir_free(ft->sid); ft->sid = mir_tstrdup(sid); filename = ft->std.ptszFiles[ft->std.currentFileNumber]; - if ((p = _tcsrchr(filename, '\\')) != NULL) + if ((p = wcsrchr(filename, '\\')) != NULL) filename = p + 1; - TCHAR tszJid[512]; + wchar_t tszJid[512]; mir_sntprintf(tszJid, L"%s/%s", jid, rs); XmlNodeIq iq(AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft)); @@ -188,8 +188,8 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft) int numRead; debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); - _tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size - if ((fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) { + _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size + if ((fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) { debugLog(L"File cannot be opened"); return FALSE; } @@ -220,9 +220,9 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft) debugLog(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]); struct _stati64 statbuf; - _tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size + _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size - int fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY); + int fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY); if (fd < 0) { debugLogA("File cannot be opened"); return FALSE; @@ -300,7 +300,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft) void CJabberProto::FtHandleSiRequest(HXML iqNode) { - const TCHAR *from, *sid, *str, *szId, *filename; + const wchar_t *from, *sid, *str, *szId, *filename; HXML siNode, fileNode, featureNode, xNode, fieldNode, n; int i; unsigned __int64 filesize; @@ -317,7 +317,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) (filename = XmlGetAttrValue(fileNode, L"name")) != NULL && (str = XmlGetAttrValue(fileNode, L"size")) != NULL) { - filesize = _ttoi64(str); + filesize = _wtoi64(str); if ((featureNode = XmlGetChildByTag(siNode, "feature", "xmlns", JABBER_FEAT_FEATURE_NEG)) != NULL && (xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != NULL && (fieldNode = XmlGetChildByTag(xNode, "field", "var", L"stream-method")) != NULL) { @@ -378,10 +378,10 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) pre.dwFlags = PRFF_TCHAR; pre.fileCount = 1; pre.timestamp = time(NULL); - pre.files.t = (TCHAR**)&filename; + pre.files.w = (wchar_t**)&filename; pre.lParam = (LPARAM)ft; if ((n = XmlGetChild(fileNode, "desc")) != NULL) - pre.descr.t = (TCHAR*)XmlGetText(n); + pre.descr.w = (wchar_t*)XmlGetText(n); ProtoChainRecvFile(ft->std.hContact, &pre); return; @@ -446,7 +446,7 @@ BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo) { HXML queryNode = pInfo->GetChildNode(); - const TCHAR *sid; + const wchar_t *sid; JABBER_LIST_ITEM *item; if ((sid = XmlGetAttrValue(queryNode, L"sid")) != NULL && (item = ListGetItemPtr(LIST_FTRECV, sid)) != NULL) { @@ -471,15 +471,15 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen) { if (iqNode == NULL) return FALSE; - const TCHAR *id = XmlGetAttrValue(iqNode, L"id"); - const TCHAR *from = XmlGetAttrValue(iqNode, L"from"); - const TCHAR *to = XmlGetAttrValue(iqNode, L"to"); + const wchar_t *id = XmlGetAttrValue(iqNode, L"id"); + const wchar_t *from = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *to = XmlGetAttrValue(iqNode, L"to"); if (!id || !from || !to) return FALSE; HXML ibbNode = XmlGetChildByTag(iqNode, bOpen ? "open" : "close", "xmlns", JABBER_FEAT_IBB); if (!ibbNode) return FALSE; - const TCHAR *sid = XmlGetAttrValue(ibbNode, L"sid"); + const wchar_t *sid = XmlGetAttrValue(ibbNode, L"sid"); if (!sid) return FALSE; // already closed? diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 6394f8a022..9188846f5e 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -40,12 +40,12 @@ struct JabberGcRecentInfo { ppro = proto; } - JabberGcRecentInfo(CJabberProto *proto, const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL) + JabberGcRecentInfo(CJabberProto *proto, const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL) { ppro = proto; fillData(room, server, nick, password); } - JabberGcRecentInfo(CJabberProto *proto, const TCHAR *jid) + JabberGcRecentInfo(CJabberProto *proto, const wchar_t *jid) { ppro = proto; fillData(jid); @@ -65,7 +65,7 @@ struct JabberGcRecentInfo m_room = m_server = m_nick = m_password = NULL; } - BOOL equals(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL) + BOOL equals(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL) { return null_strequals(m_room, room) && @@ -74,7 +74,7 @@ struct JabberGcRecentInfo null_strequals(m_password, password); } - BOOL equalsnp(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL) + BOOL equalsnp(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL) { return null_strequals(m_room, room) && @@ -90,7 +90,7 @@ struct JabberGcRecentInfo SetDlgItemText(hwndDlg, IDC_PASSWORD, m_password ? m_password : L""); } - void fillData(const TCHAR *room, const TCHAR *server, const TCHAR *nick = NULL, const TCHAR *password = NULL) + void fillData(const wchar_t *room, const wchar_t *server, const wchar_t *nick = NULL, const wchar_t *password = NULL) { m_room = mir_tstrdup(room); m_server = mir_tstrdup(server); @@ -98,14 +98,14 @@ struct JabberGcRecentInfo m_password = mir_tstrdup(password); } - void fillData(const TCHAR *jid) + void fillData(const wchar_t *jid) { - TCHAR *room, *server, *nick = NULL; - room = NEWTSTR_ALLOCA(jid); - server = _tcschr(room, _T('@')); + wchar_t *room, *server, *nick = NULL; + room = NEWWSTR_ALLOCA(jid); + server = wcschr(room, '@'); if (server) { *server++ = 0; - nick = _tcschr(server, _T('/')); + nick = wcschr(server, '/'); if (nick) *nick++ = 0; } else { @@ -164,7 +164,7 @@ struct JabberGcRecentInfo } private: - BOOL null_strequals(const TCHAR *str1, const TCHAR *str2) + BOOL null_strequals(const wchar_t *str1, const wchar_t *str2) { if (!str1 && !str2) return TRUE; if (!str1 && str2 && !*str2) return TRUE; @@ -197,7 +197,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM hContact, LPARAM) ptrT password(getTStringA(hContact, "Password")); if (getWord(hContact, "Status", 0) != ID_STATUS_ONLINE) { - TCHAR *p = _tcschr(jid, '@'); + wchar_t *p = wcschr(jid, '@'); if (p != NULL) { *p++ = 0; GroupchatJoinRoom(p, jid, nick, password); @@ -220,7 +220,7 @@ INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM hContact, LPARAM) return 0; } -void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, const TCHAR *nick, const TCHAR *password, bool autojoin) +void CJabberProto::GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, const wchar_t *nick, const wchar_t *password, bool autojoin) { JabberGcRecentInfo info(this); @@ -245,7 +245,7 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con info.saveRecent(0); } - TCHAR text[JABBER_MAX_JID_LEN + 1]; + wchar_t text[JABBER_MAX_JID_LEN + 1]; mir_sntprintf(text, L"%s@%s/%s", room, server, nick); JABBER_LIST_ITEM *item = ListAdd(LIST_CHATROOM, text); @@ -270,10 +270,10 @@ struct RoomInfo { enum Overlay { ROOM_WAIT, ROOM_FAIL, ROOM_BOOKMARK, ROOM_DEFAULT }; Overlay overlay; - TCHAR *line1, *line2; + wchar_t *line1, *line2; }; -static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const TCHAR *line1, const TCHAR *line2, const TCHAR *name) +static int sttRoomListAppend(HWND hwndList, RoomInfo::Overlay overlay, const wchar_t *line1, const wchar_t *line2, const wchar_t *name) { RoomInfo *info = (RoomInfo *)mir_alloc(sizeof(RoomInfo)); info->overlay = overlay; @@ -307,10 +307,10 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) bool found = false; HXML item; for (int i = 1; item = XmlGetNthChild(query, L"item", i); i++) { - const TCHAR *jid = XmlGetAttrValue(item, L"jid"); - TCHAR *name = NEWTSTR_ALLOCA(jid); + const wchar_t *jid = XmlGetAttrValue(item, L"jid"); + wchar_t *name = NEWWSTR_ALLOCA(jid); if (name) { - if (TCHAR *p = _tcschr(name, _T('@'))) + if (wchar_t *p = wcschr(name, '@')) *p = 0; } else name = L""; @@ -333,7 +333,7 @@ void CJabberProto::OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo) } else if (pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); sttRoomListAppend(hwndList, RoomInfo::ROOM_FAIL, TranslateT("Jabber Error"), str, @@ -386,11 +386,11 @@ class CJabberDlgGcJoin : public CJabberDlgBase CCtrlButton btnOk; public: - CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid); + CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid); ~CJabberDlgGcJoin(); protected: - TCHAR *m_jid; + wchar_t *m_jid; void OnInitDialog(); void OnDestroy(); @@ -400,7 +400,7 @@ protected: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam); }; -CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, TCHAR *jid) : +CJabberDlgGcJoin::CJabberDlgGcJoin(CJabberProto *proto, wchar_t *jid) : CSuper(proto, IDD_GROUPCHAT_JOIN, NULL), btnOk(this, IDOK), m_jid(mir_tstrdup(jid)) @@ -426,8 +426,8 @@ void CJabberDlgGcJoin::OnInitDialog() HANDLE hData = GetClipboardData(CF_UNICODETEXT); if (hData) { - TCHAR *buf = (TCHAR *)GlobalLock(hData); - if (buf && _tcschr(buf, _T('@')) && !_tcschr(buf, _T(' '))) + wchar_t *buf = (wchar_t *)GlobalLock(hData); + if (buf && wcschr(buf, '@') && !wcschr(buf, ' ')) pInfo = new JabberGcRecentInfo(m_proto, buf); GlobalUnlock(hData); } @@ -466,7 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog() int i; for (i = 0; i < 5; i++) { - TCHAR jid[JABBER_MAX_JID_LEN]; + wchar_t jid[JABBER_MAX_JID_LEN]; JabberGcRecentInfo info(m_proto); if (!info.loadRecent(i)) break; @@ -490,20 +490,20 @@ void CJabberDlgGcJoin::OnDestroy() void CJabberDlgGcJoin::OnBtnOk(CCtrlButton*) { - TCHAR text[128]; + wchar_t text[128]; GetDlgItemText(m_hwnd, IDC_SERVER, text, _countof(text)); - TCHAR *server = NEWTSTR_ALLOCA(text), *room; + wchar_t *server = NEWWSTR_ALLOCA(text), *room; m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server); GetDlgItemText(m_hwnd, IDC_ROOM, text, _countof(text)); - room = NEWTSTR_ALLOCA(text); + room = NEWWSTR_ALLOCA(text); GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text)); - TCHAR *nick = NEWTSTR_ALLOCA(text); + wchar_t *nick = NEWWSTR_ALLOCA(text); GetDlgItemText(m_hwnd, IDC_PASSWORD, text, _countof(text)); - TCHAR *password = NEWTSTR_ALLOCA(text); + wchar_t *password = NEWWSTR_ALLOCA(text); m_proto->GroupchatJoinRoom(server, room, nick, password); } @@ -620,7 +620,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_RESETCONTENT, 0, 0); int len = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_SERVER)) + 1; - TCHAR *server = (TCHAR*)_alloca(len * sizeof(TCHAR)); + wchar_t *server = (wchar_t*)_alloca(len * sizeof(wchar_t)); GetDlgItemText(m_hwnd, IDC_SERVER, server, len); if (*server) { @@ -669,9 +669,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_proto->OnMenuHandleBookmarks(0, 0); else if (res) { JABBER_LIST_ITEM *item = (JABBER_LIST_ITEM *)res; - TCHAR *room = NEWTSTR_ALLOCA(item->jid); + wchar_t *room = NEWWSTR_ALLOCA(item->jid); if (room) { - TCHAR *server = _tcschr(room, _T('@')); + wchar_t *server = wcschr(room, '@'); if (server) { *server++ = 0; @@ -711,7 +711,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return CSuper::DlgProc(msg, wParam, lParam); } -void CJabberProto::GroupchatJoinRoomByJid(HWND, TCHAR *jid) +void CJabberProto::GroupchatJoinRoomByJid(HWND, wchar_t *jid) { if (m_pDlgJabberJoinGroupchat) SetForegroundWindow(m_pDlgJabberJoinGroupchat->GetHwnd()); @@ -726,7 +726,7 @@ void CJabberProto::GroupchatJoinRoomByJid(HWND, TCHAR *jid) struct JabberGroupchatChangeNicknameParam { - JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const TCHAR *jid_) : + JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const wchar_t *jid_) : ppro(ppro_), jid(mir_tstrdup(jid_)) {} @@ -736,7 +736,7 @@ struct JabberGroupchatChangeNicknameParam } CJabberProto *ppro; - TCHAR *jid; + wchar_t *jid; }; static VOID CALLBACK JabberGroupchatChangeNickname(void* arg) @@ -767,17 +767,17 @@ static int sttGetStatusCode(HXML node) if (statusNode == NULL) return -1; - const TCHAR *statusCode = XmlGetAttrValue(statusNode, L"code"); + const wchar_t *statusCode = XmlGetAttrValue(statusNode, L"code"); if (statusCode == NULL) return -1; - return _ttol(statusCode); + return _wtol(statusCode); } -void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *oldNick, HXML itemNode) +void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *oldNick, HXML itemNode) { - const TCHAR *jid = XmlGetAttrValue(itemNode, L"jid"); - const TCHAR *newNick = XmlGetAttrValue(itemNode, L"nick"); + const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid"); + const wchar_t *newNick = XmlGetAttrValue(itemNode, L"nick"); if (newNick == NULL) return; @@ -813,12 +813,12 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *ol void CJabberProto::GroupchatProcessPresence(HXML node) { - const TCHAR *from; + const wchar_t *from; if (!node || !XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"presence")) return; if ((from = XmlGetAttrValue(node, L"from")) == NULL) return; - const TCHAR *resource = _tcschr(from, '/'); + const wchar_t *resource = wcschr(from, '/'); if (resource == NULL || *++resource == '\0') return; @@ -829,8 +829,8 @@ void CJabberProto::GroupchatProcessPresence(HXML node) pResourceStatus r(item->findResource(resource)); HXML nNode = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK); - const TCHAR *cnick = XmlGetText(nNode); - const TCHAR *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource); + const wchar_t *cnick = XmlGetText(nNode); + const wchar_t *nick = cnick ? cnick : (r && r->m_tszNick ? r->m_tszNick : resource); // process custom nick change if (cnick && r && r->m_tszNick && mir_tstrcmp(cnick, r->m_tszNick)) @@ -839,7 +839,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) HXML xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER); HXML itemNode = XmlGetChild(xNode, "item"); - const TCHAR *type = XmlGetAttrValue(node, L"type"); + const wchar_t *type = XmlGetAttrValue(node, L"type"); // entering room or a usual room presence if (type == NULL || !mir_tstrcmp(type, L"available")) { @@ -863,7 +863,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) char priority = 0; if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority"))) - priority = (char)_ttoi(ptszPriority); + priority = (char)_wtoi(ptszPriority); bool bStatusChanged = false, bRoomCreated = false, bAffiliationChanged = false, bRoleChanged = false; int newRes = ListAddResource(LIST_CHATROOM, from, status, str, priority, cnick) ? GC_EVENT_JOIN : 0; @@ -947,7 +947,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // leaving room else if (!mir_tstrcmp(type, L"unavailable")) { - const TCHAR *str = 0; + const wchar_t *str = 0; if (xNode != NULL && item->nick != NULL) { HXML reasonNode = XmlGetChild(itemNode, "reason"); str = XmlGetAttrValue(itemNode, L"jid"); @@ -1003,7 +1003,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) ptrT newNick(getTStringA("GcAltNick")); if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) { replaceStrT(item->nick, newNick); - TCHAR text[1024] = { 0 }; + wchar_t text[1024] = { 0 }; mir_sntprintf(text, L"%s/%s", item->jid, newNick); SendPresenceTo(m_iStatus, text, NULL); } @@ -1024,7 +1024,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) void CJabberProto::GroupchatProcessMessage(HXML node) { HXML n, m; - const TCHAR *from, *type, *p, *nick, *resource; + const wchar_t *from, *type, *p, *nick, *resource; JABBER_LIST_ITEM *item; CMString imgLink; @@ -1038,9 +1038,9 @@ void CJabberProto::GroupchatProcessMessage(HXML node) GCDEST gcd = { m_szModuleName, item->jid, 0 }; - const TCHAR *msgText = NULL; + const wchar_t *msgText = NULL; - resource = _tcschr(from, '/'); + resource = wcschr(from, '/'); if (resource != NULL && *++resource == '\0') resource = NULL; @@ -1052,15 +1052,15 @@ void CJabberProto::GroupchatProcessMessage(HXML node) gcd.iType = GC_EVENT_TOPIC; if (resource == NULL && (m = XmlGetChild(node, "body")) != NULL) { - const TCHAR *tmpnick = XmlGetText(m); + const wchar_t *tmpnick = XmlGetText(m); if (tmpnick == NULL || *tmpnick == 0) return; - const TCHAR *tmptr = _tcsstr(tmpnick, L"has set the subject to:"); //ejabberd + const wchar_t *tmptr = wcsstr(tmpnick, L"has set the subject to:"); //ejabberd if (tmptr == NULL) - tmptr = _tcsstr(tmpnick, TranslateT("has set the subject to:")); //ejabberd + tmptr = wcsstr(tmpnick, TranslateT("has set the subject to:")); //ejabberd if (tmptr != NULL && *tmptr != 0) { - *(TCHAR*)(--tmptr) = 0; + *(wchar_t*)(--tmptr) = 0; resource = tmpnick; } } @@ -1079,7 +1079,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (resource == NULL) gcd.iType = GC_EVENT_INFORMATION; - else if (_tcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) { + else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_tstrlen(msgText) > 4) { msgText += 4; gcd.iType = GC_EVENT_ACTION; } @@ -1144,7 +1144,7 @@ class CGroupchatInviteAcceptDlg : public CJabberDlgBase CMString m_roomJid, m_from, m_reason, m_password; public: - CGroupchatInviteAcceptDlg(CJabberProto *ppro, const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password) : + CGroupchatInviteAcceptDlg(CJabberProto *ppro, const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password) : CSuper(ppro, IDD_GROUPCHAT_INVITE_ACCEPT, NULL), m_roomJid(roomJid), m_from(from), m_reason(reason), m_password(password), m_accept(this, IDC_ACCEPT) @@ -1156,7 +1156,7 @@ public: { CSuper::OnInitDialog(); - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("Group chat invitation to\n%s"), m_roomJid); SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf); @@ -1171,7 +1171,7 @@ public: void OnCommand_Accept(CCtrlButton*) { - TCHAR text[128]; + wchar_t text[128]; GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text)); m_proto->AcceptGroupchatInvite(m_roomJid, text, m_password); EndDialog(m_hwnd, 0); @@ -1184,7 +1184,7 @@ static void __stdcall sttShowDialog(void *pArg) pDlg->Show(); } -void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *from, const TCHAR *reason, const TCHAR *password) +void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password) { if (roomJid == NULL) return; @@ -1203,11 +1203,11 @@ void CJabberProto::GroupchatProcessInvite(const TCHAR *roomJid, const TCHAR *fro else CallFunctionAsync(sttShowDialog, new CGroupchatInviteAcceptDlg(this, roomJid, from, reason, password)); } -void CJabberProto::AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password) +void CJabberProto::AcceptGroupchatInvite(const wchar_t *roomJid, const wchar_t *reason, const wchar_t *password) { - TCHAR room[256], *server, *p; - _tcsncpy_s(room, roomJid, _TRUNCATE); - p = _tcstok(room, L"@"); - server = _tcstok(NULL, L"@"); + wchar_t room[256], *server, *p; + wcsncpy_s(room, roomJid, _TRUNCATE); + p = wcstok(room, L"@"); + server = wcstok(NULL, L"@"); GroupchatJoinRoom(server, p, reason, password); } diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index bec32266dd..f15b3f4776 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -52,8 +52,8 @@ BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo) FtHandleIbbRequest(iqNode, FALSE); else if (!mir_tstrcmp(pInfo->GetChildNodeName(), L"data")) { BOOL bOk = FALSE; - const TCHAR *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid"); - const TCHAR *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq"); + const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid"); + const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq"); if (sid && seq && XmlGetText(pInfo->GetChildNode())) bOk = OnIbbRecvdData(XmlGetText(pInfo->GetChildNode()), sid, seq); @@ -164,12 +164,12 @@ void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb) JabberIbbFreeJibb(jibb); } -BOOL CJabberProto::OnIbbRecvdData(const TCHAR *data, const TCHAR *sid, const TCHAR *seq) +BOOL CJabberProto::OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const wchar_t *seq) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTRECV, sid); if (item == NULL) return FALSE; - WORD wSeq = (WORD)_ttoi(seq); + WORD wSeq = (WORD)_wtoi(seq); if (wSeq != item->jibb->wPacketId) { if (item->jibb->hEvent) SetEvent(item->jibb->hEvent); diff --git a/protocols/JabberG/src/jabber_ibb.h b/protocols/JabberG/src/jabber_ibb.h index 097c14083a..803eff2bbc 100644 --- a/protocols/JabberG/src/jabber_ibb.h +++ b/protocols/JabberG/src/jabber_ibb.h @@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { JIBB_INIT, JIBB_CONNECT, JIBB_SENDING, JIBB_RECVING, JIBB_DONE, JIBB_ERROR } JABBER_IBB_STATE; typedef struct { - TCHAR *sid; - TCHAR *srcJID; - TCHAR *dstJID; + wchar_t *sid; + wchar_t *srcJID; + wchar_t *dstJID; unsigned __int64 dwTransferredSize; JABBER_IBB_STATE state; HANDLE hEvent; diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index f3739cdece..6d85d38886 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -41,7 +41,7 @@ HIMAGELIST hAdvancedStatusIcon = NULL; struct CTransportProtoTableItem { - TCHAR *mask; + wchar_t *mask; char* proto; }; @@ -110,7 +110,7 @@ CIconPool::~CIconPool() { } -void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription) +void CIconPool::RegisterIcon(const char *name, wchar_t *filename, int iconid, wchar_t *szSection, wchar_t *szDescription) { char szSettingName[128]; mir_snprintf(szSettingName, "jabber_%s", name); @@ -120,10 +120,10 @@ void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHA item->m_szIcolibName = mir_strdup(szSettingName); SKINICONDESC sid = { 0 }; - sid.defaultFile.t = filename; + sid.defaultFile.w = filename; sid.pszName = szSettingName; - sid.section.t = szSection; - sid.description.t = szDescription; + sid.section.w = szSection; + sid.description.w = szDescription; sid.flags = SIDF_ALL_TCHAR; sid.iDefaultIndex = iconid; item->m_hIcolibItem = IcoLib_AddIcon(&sid); @@ -194,14 +194,14 @@ HICON CJabberProto::LoadIconEx(const char* name, bool big) ///////////////////////////////////////////////////////////////////////////////////////// // internal functions -static inline TCHAR qtoupper(TCHAR c) +static inline wchar_t qtoupper(wchar_t c) { return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c; } -static BOOL WildComparei(const TCHAR *name, const TCHAR *mask) +static BOOL WildComparei(const wchar_t *name, const wchar_t *mask) { - const TCHAR *last = '\0'; + const wchar_t *last = '\0'; for (;; mask++, name++) { if (*mask != '?' && qtoupper(*mask) != qtoupper(*name)) break; @@ -226,7 +226,7 @@ static BOOL WildComparei(const TCHAR *name, const TCHAR *mask) } } -static BOOL MatchMask(const TCHAR *name, const TCHAR *mask) +static BOOL MatchMask(const wchar_t *name, const wchar_t *mask) { if (!mask || !name) return mask == name; @@ -234,7 +234,7 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask) if (*mask != '|') return WildComparei(name, mask); - TCHAR *temp = NEWTSTR_ALLOCA(mask); + wchar_t *temp = NEWWSTR_ALLOCA(mask); for (int e = 1; mask[e] != '\0'; e++) { int s = e; while (mask[e] != '\0' && mask[e] != '|') @@ -270,7 +270,7 @@ static HICON ExtractIconFromPath(const char *path, BOOL * needFree) return hIcon; } -static HICON LoadTransportIcon(char *filename, int i, char *IconName, TCHAR *SectName, TCHAR *Description, int internalidx, BOOL *needFree) +static HICON LoadTransportIcon(char *filename, int i, char *IconName, wchar_t *SectName, wchar_t *Description, int internalidx, BOOL *needFree) { char szPath[MAX_PATH], szMyPath[MAX_PATH], szFullPath[MAX_PATH], *str; BOOL has_proto_icon = FALSE; @@ -287,9 +287,9 @@ static HICON LoadTransportIcon(char *filename, int i, char *IconName, TCHAR *Sec if (IconName != NULL && SectName != NULL) { SKINICONDESC sid = { 0 }; sid.hDefaultIcon = (has_proto_icon) ? NULL : Skin_LoadProtoIcon(0, -internalidx); - sid.section.t = SectName; + sid.section.w = SectName; sid.pszName = IconName; - sid.description.t = Description; + sid.description.w = Description; sid.defaultFile.a = szMyPath; sid.iDefaultIndex = i; sid.flags = SIDF_TCHAR; @@ -302,12 +302,12 @@ int CJabberProto::LoadAdvancedIcons(int iID) { char *proto = TransportProtoTable[iID].proto; char defFile[MAX_PATH] = { 0 }; - TCHAR Group[255]; + wchar_t Group[255]; char Uname[255]; int first = -1; HICON empty = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); - mir_sntprintf(Group, LPGENT("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport")); + mir_sntprintf(Group, LPGENW("Status icons")L"/%s/%S %s", m_tszUserName, proto, TranslateT("transport")); mir_snprintf(defFile, "proto_%s.dll", proto); if (!hAdvancedStatusIcon) hAdvancedStatusIcon = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); @@ -316,7 +316,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) for (int i = 0; i < ID_STATUS_ONTHEPHONE - ID_STATUS_OFFLINE; i++) { BOOL needFree; int n = skinStatusToJabberStatus[i]; - TCHAR *descr = pcli->pfnGetStatusModeDescription(n + ID_STATUS_OFFLINE, 0); + wchar_t *descr = pcli->pfnGetStatusModeDescription(n + ID_STATUS_OFFLINE, 0); mir_snprintf(Uname, "%s_Transport_%s_%d", m_szModuleName, proto, n); HICON hicon = LoadTransportIcon(defFile, -skinIconStatusToResourceId[i], Uname, Group, descr, -(n + ID_STATUS_OFFLINE), &needFree); int index = (m_transportProtoTableStartIndex[iID] == -1) ? -1 : m_transportProtoTableStartIndex[iID] + n; @@ -332,7 +332,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) return 0; } -int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain) +int CJabberProto::GetTransportProtoID(wchar_t* TransportDomain) { for (int i = 0; i < _countof(TransportProtoTable); i++) if (MatchMask(TransportDomain, TransportProtoTable[i].mask)) @@ -404,22 +404,22 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // Transport check functions -BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hContact) +BOOL CJabberProto::DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hContact) { // check if transport is already set if (!jid || !hContact) return FALSE; // strip domain part from jid - TCHAR *domain = _tcschr((TCHAR*)jid, '@'); + wchar_t *domain = wcschr((wchar_t*)jid, '@'); BOOL isAgent = (domain == NULL) ? TRUE : FALSE; BOOL isTransported = FALSE; if (domain != NULL) - domain = NEWTSTR_ALLOCA(domain + 1); + domain = NEWWSTR_ALLOCA(domain + 1); else - domain = NEWTSTR_ALLOCA(jid); + domain = NEWWSTR_ALLOCA(jid); - TCHAR *resourcepos = _tcschr(domain, '/'); + wchar_t *resourcepos = wcschr(domain, '/'); if (resourcepos != NULL) *resourcepos = '\0'; diff --git a/protocols/JabberG/src/jabber_icolib.h b/protocols/JabberG/src/jabber_icolib.h index a512a71677..e91d393eb0 100644 --- a/protocols/JabberG/src/jabber_icolib.h +++ b/protocols/JabberG/src/jabber_icolib.h @@ -35,7 +35,7 @@ public: CIconPool(); ~CIconPool(); - void RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription); + void RegisterIcon(const char *name, wchar_t *filename, int iconid, wchar_t *szSection, wchar_t *szDescription); HANDLE GetIcolibHandle(const char *name); char *GetIcolibName(const char *name); diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp index ca7020a25e..60040145af 100644 --- a/protocols/JabberG/src/jabber_iq.cpp +++ b/protocols/JabberG/src/jabber_iq.cpp @@ -201,7 +201,7 @@ void CJabberIqManager::ExpireAll() ExpireInfo(pInfo); } -CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const TCHAR *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority) +CJabberIqInfo* CJabberIqManager::AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const wchar_t *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority) { CJabberIqInfo *pInfo = new CJabberIqInfo(); pInfo->m_pHandler = pHandler; @@ -243,7 +243,7 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) if (nIqId == -1 || pNode == NULL) return false; - const TCHAR *szType = XmlGetAttrValue(pNode, L"type"); + const wchar_t *szType = XmlGetAttrValue(pNode, L"type"); if (!szType) return false; @@ -266,21 +266,21 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode) pInfo->m_pChildNode = XmlGetChild(pNode , 0); if (pInfo->m_pChildNode && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_NAME)) - pInfo->m_szChildTagName = (TCHAR*)XmlGetName(pInfo->m_pChildNode); + pInfo->m_szChildTagName = (wchar_t*)XmlGetName(pInfo->m_pChildNode); if (pInfo->m_pChildNode && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_XMLNS)) - pInfo->m_szChildTagXmlns = (TCHAR*)XmlGetAttrValue(pNode, L"xmlns"); + pInfo->m_szChildTagXmlns = (wchar_t*)XmlGetAttrValue(pNode, L"xmlns"); } if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_TO) - pInfo->m_szTo = (TCHAR*)XmlGetAttrValue(pNode, L"to"); + pInfo->m_szTo = (wchar_t*)XmlGetAttrValue(pNode, L"to"); if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_FROM) - pInfo->m_szFrom = (TCHAR*)XmlGetAttrValue(pNode, L"from"); + pInfo->m_szFrom = (wchar_t*)XmlGetAttrValue(pNode, L"from"); if (pInfo->m_szFrom && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT)) pInfo->m_hContact = ppro->HContactFromJID(pInfo->m_szFrom); if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_ID_STR) - pInfo->m_szId = (TCHAR*)XmlGetAttrValue(pNode, L"id"); + pInfo->m_szId = (wchar_t*)XmlGetAttrValue(pNode, L"id"); (ppro->*(pInfo->m_pHandler))(pNode, pInfo); delete pInfo; @@ -294,7 +294,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) for (int i = 0; i < m_arHandlers.getCount(); i++) { CJabberIqPermanentInfo &pInfo = m_arHandlers[i]; // have to get all data here, in the loop, because there's always possibility that previous handler modified it - const TCHAR *szType = XmlGetAttrValue(pNode, L"type"); + const wchar_t *szType = XmlGetAttrValue(pNode, L"type"); if (!szType) return FALSE; @@ -314,24 +314,24 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode) if (!pFirstChild || !XmlGetName(pFirstChild)) return FALSE; - const TCHAR *szTagName = XmlGetName(pFirstChild); - const TCHAR *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns"); + const wchar_t *szTagName = XmlGetName(pFirstChild); + const wchar_t *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns"); if ((!pInfo.m_szXmlns || (szXmlns && !mir_tstrcmp(pInfo.m_szXmlns, szXmlns))) && (!pInfo.m_szTag || !mir_tstrcmp(pInfo.m_szTag, szTagName))) { // node suits handler criteria, call the handler iqInfo.m_pChildNode = pFirstChild; - iqInfo.m_szChildTagName = (TCHAR*)szTagName; - iqInfo.m_szChildTagXmlns = (TCHAR*)szXmlns; - iqInfo.m_szId = (TCHAR*)XmlGetAttrValue(pNode, L"id"); + iqInfo.m_szChildTagName = (wchar_t*)szTagName; + iqInfo.m_szChildTagXmlns = (wchar_t*)szXmlns; + iqInfo.m_szId = (wchar_t*)XmlGetAttrValue(pNode, L"id"); iqInfo.m_pUserData = pInfo.m_pUserData; if (pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_TO) - iqInfo.m_szTo = (TCHAR*)XmlGetAttrValue(pNode, L"to"); + iqInfo.m_szTo = (wchar_t*)XmlGetAttrValue(pNode, L"to"); if (pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_FROM) - iqInfo.m_szFrom = (TCHAR*)XmlGetAttrValue(pNode, L"from"); + iqInfo.m_szFrom = (wchar_t*)XmlGetAttrValue(pNode, L"from"); if ((pInfo.m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (iqInfo.m_szFrom)) iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom); @@ -406,9 +406,9 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler( JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, - const TCHAR *szXmlns, + const wchar_t *szXmlns, BOOL bAllowPartialNs, - const TCHAR *szTag, + const wchar_t *szTag, void *pUserData, IQ_USER_DATA_FREE_FUNC pUserDataFree, int iPriority) diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index a985701c30..6d5b75d68a 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -59,19 +59,19 @@ protected: DWORD m_dwParamsToParse; DWORD m_dwRequestTime; DWORD m_dwTimeout; - TCHAR *m_szReceiver; + wchar_t *m_szReceiver; int m_iPriority; public: void *m_pUserData; int m_nIqType; - TCHAR *m_szFrom; - TCHAR *m_szChildTagXmlns; - TCHAR *m_szChildTagName; + wchar_t *m_szFrom; + wchar_t *m_szChildTagXmlns; + wchar_t *m_szChildTagName; HXML m_pChildNode; MCONTACT m_hContact; - TCHAR *m_szTo; - TCHAR *m_szId; + wchar_t *m_szTo; + wchar_t *m_szId; public: __forceinline CJabberIqInfo() @@ -81,7 +81,7 @@ public: { mir_free(m_szReceiver); } - __forceinline void SetReceiver(const TCHAR *szReceiver) { replaceStrT(m_szReceiver, szReceiver); } + __forceinline void SetReceiver(const wchar_t *szReceiver) { replaceStrT(m_szReceiver, szReceiver); } __forceinline void SetParamsToParse(DWORD dwParamsToParse) { m_dwParamsToParse = dwParamsToParse; } __forceinline void SetTimeout(DWORD dwTimeout) { m_dwTimeout = dwTimeout; } @@ -89,13 +89,13 @@ public: __forceinline DWORD GetRequestTime() const { return m_dwRequestTime; } __forceinline int GetIqType() const { return m_nIqType; } __forceinline void* GetUserData() const { return m_pUserData; } - __forceinline TCHAR* GetFrom() const { return m_szFrom; } - __forceinline TCHAR* GetTo() const { return m_szTo; } - __forceinline TCHAR* GetIdStr() const { return m_szId; } + __forceinline wchar_t* GetFrom() const { return m_szFrom; } + __forceinline wchar_t* GetTo() const { return m_szTo; } + __forceinline wchar_t* GetIdStr() const { return m_szId; } __forceinline MCONTACT GetHContact() const { return m_hContact; } __forceinline HXML GetChildNode() const { return m_pChildNode; } - __forceinline TCHAR* GetChildNodeName() const { return m_szChildTagName; } - __forceinline TCHAR* GetReceiver() const { return m_szReceiver; } + __forceinline wchar_t* GetChildNodeName() const { return m_szChildTagName; } + __forceinline wchar_t* GetReceiver() const { return m_szReceiver; } __forceinline int GetPriority() const { return m_iPriority; } char* GetCharIqType() @@ -117,8 +117,8 @@ class CJabberIqPermanentInfo : public MZeroedObject JABBER_PERMANENT_IQ_HANDLER m_pHandler; DWORD m_dwParamsToParse; int m_nIqTypes; - TCHAR *m_szXmlns; - TCHAR *m_szTag; + wchar_t *m_szXmlns; + wchar_t *m_szTag; BOOL m_bAllowPartialNs; void *m_pUserData; IQ_USER_DATA_FREE_FUNC m_pUserDataFree; @@ -165,8 +165,8 @@ public: void Shutdown(); // fucking params, maybe just return CJabberIqRequestInfo pointer ? - CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const TCHAR *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority); - CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT); + CJabberIqInfo* AddHandler(JABBER_IQ_HANDLER pHandler, int nIqType, const wchar_t *szReceiver, DWORD dwParamsToParse, int nIqId, void *pUserData, int iPriority); + CJabberIqPermanentInfo* AddPermanentHandler(JABBER_PERMANENT_IQ_HANDLER pHandler, int nIqTypes, DWORD dwParamsToParse, const wchar_t *szXmlns, BOOL bAllowPartialNs, const wchar_t *szTag, void *pUserData = NULL, IQ_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT); // returns TRUE when pInfo found, or FALSE otherwise bool DeletePermanentHandler(CJabberIqPermanentInfo *pInfo); diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index a8f4f31e8f..9a87819646 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -42,7 +42,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) query << XCHILD(L"version", szCoreVersion); if (m_options.ShowOSVersion) { - TCHAR os[256] = { 0 }; + wchar_t os[256] = { 0 }; if (!GetOSDisplayString(os, _countof(os))) mir_tstrncpy(os, L"Microsoft Windows", _countof(os)); query << XCHILD(L"os", os); @@ -98,8 +98,8 @@ int GetGMTOffset(void) // entity time (XEP-0202) support BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) { - TCHAR stime[100]; - TCHAR szTZ[10]; + wchar_t stime[100]; + wchar_t szTZ[10]; TimeZone_PrintDateTime(UTC_TIME_HANDLE, L"I", stime, _countof(stime), 0); @@ -120,7 +120,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) { struct tm *gmt; time_t ltime; - TCHAR stime[100], *dtime; + wchar_t stime[100], *dtime; _tzset(); time(<ime); @@ -128,7 +128,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) mir_sntprintf(stime, L"%.4i%.2i%.2iT%.2i:%.2i:%.2i", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); - dtime = _tctime(<ime); + dtime = _wctime(<ime); dtime[24] = 0; XmlNodeIq iq(L"result", pInfo); @@ -151,7 +151,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) if (pictureType == PA_FORMAT_UNKNOWN) return TRUE; - TCHAR *szMimeType; + wchar_t *szMimeType; switch (pictureType) { case PA_FORMAT_JPEG: szMimeType = L"image/jpeg"; break; case PA_FORMAT_GIF: szMimeType = L"image/gif"; break; @@ -160,10 +160,10 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) default: return TRUE; } - TCHAR szFileName[MAX_PATH]; + wchar_t szFileName[MAX_PATH]; GetAvatarFileName(NULL, szFileName, _countof(szFileName)); - FILE* in = _tfopen(szFileName, L"rb"); + FILE* in = _wfopen(szFileName, L"rb"); if (in == NULL) return TRUE; @@ -184,7 +184,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) BOOL CJabberProto::OnSiRequest(HXML node, CJabberIqInfo *pInfo) { - const TCHAR *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile"); + const wchar_t *szProfile = XmlGetAttrValue(pInfo->GetChildNode(), L"profile"); if (szProfile && !mir_tstrcmp(szProfile, JABBER_FEAT_SI_FT)) FtHandleSiRequest(node); @@ -204,20 +204,20 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // RFC 3921 #7.2 Business Rules if (pInfo->GetFrom()) { - TCHAR *szFrom = JabberPrepareJid(pInfo->GetFrom()); + wchar_t *szFrom = JabberPrepareJid(pInfo->GetFrom()); if (!szFrom) return TRUE; - TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID); + wchar_t *szTo = JabberPrepareJid(m_ThreadInfo->fullJID); if (!szTo) { mir_free(szFrom); return TRUE; } - TCHAR *pDelimiter = _tcschr(szFrom, _T('/')); + wchar_t *pDelimiter = wcschr(szFrom, '/'); if (pDelimiter) *pDelimiter = 0; - pDelimiter = _tcschr(szTo, _T('/')); + pDelimiter = wcschr(szTo, '/'); if (pDelimiter) *pDelimiter = 0; BOOL bRetVal = mir_tstrcmp(szFrom, szTo) == 0; @@ -232,7 +232,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) } } - const TCHAR *jid, *str; + const wchar_t *jid, *str; debugLogA("<iq/> Got roster push, query has %d children", XmlGetChildCount(queryNode)); for (int i = 0;; i++) { @@ -249,7 +249,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) // we will not add new account when subscription=remove if (!mir_tstrcmp(str, L"to") || !mir_tstrcmp(str, L"both") || !mir_tstrcmp(str, L"from") || !mir_tstrcmp(str, L"none")) { - const TCHAR *name = XmlGetAttrValue(itemNode, L"name"); + const wchar_t *name = XmlGetAttrValue(itemNode, L"name"); ptrT nick((name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid)); if (nick != NULL) { MCONTACT hContact = HContactFromJID(jid, false); @@ -343,16 +343,16 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->httpPath = NULL; // Parse the URL - TCHAR *str = (TCHAR*)XmlGetText(n); // URL of the file to get - if (!_tcsnicmp(str, L"http://", 7)) { - TCHAR *p = str + 7, *q; - if ((q = _tcschr(p, '/')) != NULL) { - TCHAR text[1024]; + wchar_t *str = (wchar_t*)XmlGetText(n); // URL of the file to get + if (!wcsnicmp(str, L"http://", 7)) { + wchar_t *p = str + 7, *q; + if ((q = wcschr(p, '/')) != NULL) { + wchar_t text[1024]; if (q - p < _countof(text)) { - _tcsncpy_s(text, p, q - p); + wcsncpy_s(text, p, q - p); text[q - p] = '\0'; - if ((p = _tcschr(text, ':')) != NULL) { - ft->httpPort = (WORD)_ttoi(p + 1); + if ((p = wcschr(text, ':')) != NULL) { + ft->httpPort = (WORD)_wtoi(p + 1); *p = '\0'; } ft->httpHostName = mir_t2a(text); @@ -364,15 +364,15 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) ft->szId = JabberId2string(pInfo->GetIqId()); if (ft->httpHostName && ft->httpPath) { - TCHAR *desc = NULL; + wchar_t *desc = NULL; debugLogA("Host=%s Port=%d Path=%s", ft->httpHostName, ft->httpPort, ft->httpPath); if ((n = XmlGetChild(pInfo->GetChildNode(), "desc")) != NULL) - desc = (TCHAR*)XmlGetText(n); + desc = (wchar_t*)XmlGetText(n); - TCHAR *str2; + wchar_t *str2; debugLog(L"description = %s", desc); - if ((str2 = _tcsrchr(ft->httpPath, '/')) != NULL) + if ((str2 = wcsrchr(ft->httpPath, '/')) != NULL) str2++; else str2 = ft->httpPath; @@ -382,8 +382,8 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) PROTORECVFILET pre; pre.dwFlags = PRFF_TCHAR; pre.timestamp = time(NULL); - pre.descr.t = desc; - pre.files.t = &str2; + pre.descr.w = desc; + pre.files.w = &str2; pre.fileCount = 1; pre.lParam = (LPARAM)ft; ProtoChainRecvFile(ft->std.hContact, &pre); @@ -404,7 +404,7 @@ BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo) if (!pInfo->GetChildNode()) return TRUE; - const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); + const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); // caps hack if (m_clientCapsManager.HandleInfoRequest(iqNode, pInfo, szNode)) return TRUE; @@ -427,7 +427,7 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo) return TRUE; // ad-hoc commands check: - const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); + const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); if (szNode && m_adhocManager.HandleItemsRequest(iqNode, pInfo, szNode)) return TRUE; @@ -473,9 +473,9 @@ BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo) if (!pConfirm) return TRUE; - const TCHAR *szId = XmlGetAttrValue(pConfirm, L"id"); - const TCHAR *szMethod = XmlGetAttrValue(pConfirm, L"method"); - const TCHAR *szUrl = XmlGetAttrValue(pConfirm, L"url"); + const wchar_t *szId = XmlGetAttrValue(pConfirm, L"id"); + const wchar_t *szMethod = XmlGetAttrValue(pConfirm, L"method"); + const wchar_t *szUrl = XmlGetAttrValue(pConfirm, L"url"); if (!szId || !szMethod || !szUrl) return TRUE; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 61fe3f353d..de177c797d 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -34,7 +34,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (iqNode == NULL) return; - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (mir_tstrcmp(type, L"result")) return; @@ -63,7 +63,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (m_ThreadInfo) { HXML feature; for (int i = 1; (feature = XmlGetNthChild(query, L"feature", i)) != NULL; i++) { - const TCHAR *featureName = XmlGetAttrValue(feature, L"var"); + const wchar_t *featureName = XmlGetAttrValue(feature, L"var"); if (!featureName) continue; @@ -81,7 +81,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInfo) { - const TCHAR *szGroupDelimeter = NULL; + const wchar_t *szGroupDelimeter = NULL; bool bPrivateStorageSupport = false; if (iqNode && pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) { @@ -102,7 +102,7 @@ void CJabberProto::OnIqResultNestedRosterGroups(HXML iqNode, CJabberIqInfo *pInf << XCHILD(L"roster", L"\\") << XATTR(L"xmlns", JABBER_FEAT_NESTED_ROSTER_GROUPS)); // roster request - TCHAR *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\"); + wchar_t *szUserData = mir_tstrdup(szGroupDelimeter ? szGroupDelimeter : L"\\"); m_ThreadInfo->send( XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetRoster, JABBER_IQ_TYPE_GET, NULL, 0, -1, (void*)szUserData)) << XCHILDNS(L"query", JABBER_FEAT_IQ_ROSTER)); @@ -141,11 +141,11 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) for (int j=0; j < ll.getCount(); j++) { JABBER_LIST_ITEM *item = ll[j]; - TCHAR room[256], text[128]; - _tcsncpy_s(text, item->jid, _TRUNCATE); - _tcsncpy_s(room, text, _TRUNCATE); - TCHAR *p = _tcstok(room, L"@"); - TCHAR *server = _tcstok(NULL, L"@"); + wchar_t room[256], text[128]; + wcsncpy_s(text, item->jid, _TRUNCATE); + wcsncpy_s(room, text, _TRUNCATE); + wchar_t *p = wcstok(room, L"@"); + wchar_t *server = wcstok(NULL, L"@"); if (item->nick && item->nick[0]) GroupchatJoinRoom(server, p, item->nick, item->password, true); else { @@ -215,7 +215,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdGetAuth"); HXML queryNode; - const TCHAR *type; + const wchar_t *type; if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return; if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return; @@ -246,7 +246,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) { m_ThreadInfo->send("</stream:stream>"); - TCHAR text[128]; + wchar_t text[128]; mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username); MsgPopup(NULL, text, TranslateT("Jabber Authentication")); JLoginFailed(LOGINERR_WRONGPASSWORD); @@ -256,7 +256,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) { - const TCHAR *type; + const wchar_t *type; // RECVED: authentication result // ACTION: if successfully logged in, continue by requesting roster list and set my initial status @@ -272,7 +272,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo*) } // What to do if password error? etc... else if (!mir_tstrcmp(type, L"error")) { - TCHAR text[128]; + wchar_t text[128]; m_ThreadInfo->send("</stream:stream>"); mir_sntprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username); @@ -289,11 +289,11 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) { LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid"); if (szJid) { - if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID))) + if (!wcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID))) debugLog(L"Result Bind: %s confirmed ", m_ThreadInfo->fullJID); else { debugLog(L"Result Bind: %s changed to %s", m_ThreadInfo->fullJID, szJid); - _tcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE); + wcsncpy_s(m_ThreadInfo->fullJID, szJid, _TRUNCATE); } } if (m_ThreadInfo->bIsSessionAvailable) @@ -322,8 +322,8 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) if (roomjid == NULL) return; - TCHAR *room = roomjid; - TCHAR *server = _tcschr(roomjid, '@'); + wchar_t *room = roomjid; + wchar_t *server = wcschr(roomjid, '@'); if (!server) return; @@ -345,7 +345,7 @@ void CJabberProto::GroupchatJoinByHContact(MCONTACT hContact, bool autojoin) void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) { debugLogA("<iq/> iqIdGetRoster"); - TCHAR *szGroupDelimeter = (TCHAR *)pInfo->GetUserData(); + wchar_t *szGroupDelimeter = (wchar_t *)pInfo->GetUserData(); if (pInfo->GetIqType() != JABBER_IQ_TYPE_RESULT) { mir_free(szGroupDelimeter); return; @@ -380,7 +380,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (mir_tstrcmp(XmlGetName(itemNode), L"item")) continue; - const TCHAR *str = XmlGetAttrValue(itemNode, L"subscription"); + const wchar_t *str = XmlGetAttrValue(itemNode, L"subscription"); JABBER_SUBSCRIPTION sub; if (str == NULL) sub = SUB_NONE; @@ -389,14 +389,14 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) else if (!mir_tstrcmp(str, L"from")) sub = SUB_FROM; else sub = SUB_NONE; - const TCHAR *jid = XmlGetAttrValue(itemNode, L"jid"); + const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid"); if (jid == NULL) continue; - if (_tcschr(jid, '@') == NULL) + if (wcschr(jid, '@') == NULL) bIsTransport = true; - const TCHAR *name = XmlGetAttrValue(itemNode, L"name"); - TCHAR *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid); + const wchar_t *name = XmlGetAttrValue(itemNode, L"name"); + wchar_t *nick = (name != NULL) ? mir_tstrdup(name) : JabberNickFromJID(jid); if (nick == NULL) continue; @@ -414,10 +414,10 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) // check group delimiters: if (item->group && szGroupDelimeter) { - while (TCHAR *szPos = _tcsstr(item->group, szGroupDelimeter)) { + while (wchar_t *szPos = wcsstr(item->group, szGroupDelimeter)) { *szPos = 0; szPos += mir_tstrlen(szGroupDelimeter); - TCHAR *szNewGroup = (TCHAR *)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2)); + wchar_t *szNewGroup = (wchar_t *)mir_alloc(sizeof(wchar_t) * (mir_tstrlen(item->group) + mir_tstrlen(szPos) + 2)); mir_tstrcpy(szNewGroup, item->group); mir_tstrcat(szNewGroup, L"\\"); mir_tstrcat(szNewGroup, szPos); @@ -443,9 +443,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) gcw.iType = GCW_CHATROOM; gcw.pszModule = m_szModuleName; gcw.ptszID = jid; - gcw.ptszName = NEWTSTR_ALLOCA(jid); + gcw.ptszName = NEWWSTR_ALLOCA(jid); - TCHAR *p = (TCHAR*)_tcschr(gcw.ptszName, '@'); + wchar_t *p = (wchar_t*)wcschr(gcw.ptszName, '@'); if (p) *p = 0; @@ -478,7 +478,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) setByte(hContact, "IsTransport", false); } - const TCHAR *imagepath = XmlGetAttrValue(itemNode, L"vz:img"); + const wchar_t *imagepath = XmlGetAttrValue(itemNode, L"vz:img"); if (imagepath) httpavatars->insert(new JABBER_HTTP_AVATARS(imagepath, hContact)); } @@ -529,7 +529,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdGetRegister"); HXML queryNode; - const TCHAR *type; + const wchar_t *type; if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return; if ((queryNode = XmlGetChild(iqNode, "query")) == NULL) return; @@ -540,7 +540,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) { if (m_hwndAgentRegInput) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 0 /*error*/, (LPARAM)str); mir_free(str); } @@ -553,7 +553,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) // ACTION: notify of successful agent registration debugLogA("<iq/> iqIdSetRegister"); - const TCHAR *type, *from; + const wchar_t *type, *from; if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return; if ((from = XmlGetAttrValue(iqNode, L"from")) == NULL) return; @@ -568,7 +568,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(type, L"error")) { if (m_hwndRegProgress) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str); mir_free(str); } @@ -594,11 +594,11 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP if (buffer == NULL) return; - const TCHAR *szPicType = JabberGetPictureType(n, buffer); + const wchar_t *szPicType = JabberGetPictureType(n, buffer); if (szPicType == NULL) return; - TCHAR szAvatarFileName[MAX_PATH]; + wchar_t szAvatarFileName[MAX_PATH]; GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName)); debugLog(L"Picture file name set to %s", szAvatarFileName); @@ -644,19 +644,19 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP DeleteFile(szAvatarFileName); } -static TCHAR* sttGetText(HXML node, char* tag) +static wchar_t* sttGetText(HXML node, char* tag) { HXML n = XmlGetChild(node, tag); if (n == NULL) return NULL; - return (TCHAR*)XmlGetText(n); + return (wchar_t*)XmlGetText(n); } void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) { HXML vCardNode, m, n, o; - const TCHAR *type, *jid; + const wchar_t *type, *jid; MCONTACT hContact; DBVARIANT dbv; @@ -673,11 +673,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.nick.t = sttGetText(vCardNode, "NICKNAME"); - psr.firstName.t = sttGetText(vCardNode, "FN"); - psr.lastName.t = L""; - psr.email.t = sttGetText(vCardNode, "EMAIL"); - psr.id.t = NEWTSTR_ALLOCA(jid); + psr.nick.w = sttGetText(vCardNode, "NICKNAME"); + psr.firstName.w = sttGetText(vCardNode, "FN"); + psr.lastName.w = L""; + psr.email.w = sttGetText(vCardNode, "EMAIL"); + psr.id.w = NEWWSTR_ALLOCA(jid); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0); } @@ -689,7 +689,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } size_t len = mir_tstrlen(m_szJabberJID); - if (!_tcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) { + if (!wcsnicmp(jid, m_szJabberJID, len) && (jid[len] == '/' || jid[len] == '\0')) { hContact = NULL; debugLogA("Vcard for myself"); } @@ -783,7 +783,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) // Birthday if (!hasBday && XmlGetText(n) != NULL) { if (hContact != NULL) { - if (_stscanf(XmlGetText(n), L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) { + if (swscanf(XmlGetText(n), L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) { hasBday = true; setWord(hContact, "BirthYear", (WORD)nYear); setByte(hContact, "BirthMonth", (BYTE)nMonth); @@ -822,7 +822,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if (!mir_tstrcmp(XmlGetName(n), L"ADR")) { if (!hasHome && XmlGetChild(n, "HOME") != NULL) { // Home address - TCHAR text[128]; + wchar_t text[128]; hasHome = true; if ((m = XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) { hasHomeStreet = true; @@ -832,7 +832,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL) mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o)); else - _tcsncpy_s(text, XmlGetText(m), _TRUNCATE); + wcsncpy_s(text, XmlGetText(m), _TRUNCATE); text[_countof(text) - 1] = '\0'; setTString(hContact, "Street", text); } @@ -871,7 +871,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) // Work address hasWork = true; if ((m = XmlGetChild(n, "STREET")) != NULL && XmlGetText(m) != NULL) { - TCHAR text[128]; + wchar_t text[128]; hasWorkStreet = true; if (hContact != NULL) { if ((o = XmlGetChild(n, "EXTADR")) != NULL && XmlGetText(o) != NULL) @@ -879,7 +879,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else if ((o = XmlGetChild(n, "EXTADD")) != NULL && XmlGetText(o) != NULL) mir_sntprintf(text, L"%s\r\n%s", XmlGetText(m), XmlGetText(o)); else - _tcsncpy_s(text, XmlGetText(m), _TRUNCATE); + wcsncpy_s(text, XmlGetText(m), _TRUNCATE); text[_countof(text) - 1] = '\0'; setTString(hContact, "CompanyStreet", text); } @@ -1132,7 +1132,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) } if (id == m_ThreadInfo->resolveID) { - const TCHAR *p = _tcschr(jid, '@'); + const wchar_t *p = wcschr(jid, '@'); ResolveTransportNicks((p != NULL) ? p + 1 : jid); } else { @@ -1152,7 +1152,7 @@ void CJabberProto::OnIqResultSetVcard(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) { HXML queryNode, n; - const TCHAR *type, *jid; + const wchar_t *type, *jid; int id; debugLogA("<iq/> iqIdGetSearch"); @@ -1172,24 +1172,24 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*) if (!mir_tstrcmp(XmlGetName(itemNode), L"item")) { if ((jid = XmlGetAttrValue(itemNode, L"jid")) != NULL) { - psr.id.t = (TCHAR*)jid; + psr.id.w = (wchar_t*)jid; debugLog(L"Result jid = %s", jid); if ((n = XmlGetChild(itemNode, "nick")) != NULL && XmlGetText(n) != NULL) - psr.nick.t = (TCHAR*)XmlGetText(n); + psr.nick.w = (wchar_t*)XmlGetText(n); else - psr.nick.t = L""; + psr.nick.w = L""; if ((n = XmlGetChild(itemNode, "first")) != NULL && XmlGetText(n) != NULL) - psr.firstName.t = (TCHAR*)XmlGetText(n); + psr.firstName.w = (wchar_t*)XmlGetText(n); else - psr.firstName.t = L""; + psr.firstName.w = L""; if ((n = XmlGetChild(itemNode, "last")) != NULL && XmlGetText(n) != NULL) - psr.lastName.t = (TCHAR*)XmlGetText(n); + psr.lastName.w = (wchar_t*)XmlGetText(n); else - psr.lastName.t = L""; + psr.lastName.w = L""; if ((n = XmlGetChild(itemNode, "email")) != NULL && XmlGetText(n) != NULL) - psr.email.t = (TCHAR*)XmlGetText(n); + psr.email.w = (wchar_t*)XmlGetText(n); else - psr.email.t = L""; + psr.email.w = L""; psr.flags = PSR_TCHAR; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr); } @@ -1207,7 +1207,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) HXML queryNode; debugLogA("<iq/> iqIdGetExtSearch"); - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; @@ -1237,7 +1237,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) if (mir_tstrcmp(XmlGetName(fieldNode), L"field")) continue; - const TCHAR *fieldName = XmlGetAttrValue(fieldNode, L"var"); + const wchar_t *fieldName = XmlGetAttrValue(fieldNode, L"var"); if (fieldName == NULL) continue; @@ -1246,19 +1246,19 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*) continue; if (!mir_tstrcmp(fieldName, L"jid")) { - psr.id.t = (TCHAR*)XmlGetText(n); - debugLog(L"Result jid = %s", psr.id.t); + psr.id.w = (wchar_t*)XmlGetText(n); + debugLog(L"Result jid = %s", psr.id.w); } else if (!mir_tstrcmp(fieldName, L"nickname")) - psr.nick.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L""; + psr.nick.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; else if (!mir_tstrcmp(fieldName, L"fn")) - psr.firstName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L""; + psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; else if (!mir_tstrcmp(fieldName, L"given")) - psr.firstName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L""; + psr.firstName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; else if (!mir_tstrcmp(fieldName, L"family")) - psr.lastName.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L""; + psr.lastName.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; else if (!mir_tstrcmp(fieldName, L"email")) - psr.email.t = (XmlGetText(n) != NULL) ? (TCHAR*)XmlGetText(n) : L""; + psr.email.w = (XmlGetText(n) != NULL) ? (wchar_t*)XmlGetText(n) : L""; } ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&psr); @@ -1274,12 +1274,12 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo*) { debugLogA("<iq/> iqIdSetPassword"); - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; if (!mir_tstrcmp(type, L"result")) { - _tcsncpy_s(m_ThreadInfo->conn.password, m_ThreadInfo->tszNewPassword, _TRUNCATE); + wcsncpy_s(m_ThreadInfo->conn.password, m_ThreadInfo->tszNewPassword, _TRUNCATE); MessageBox(NULL, TranslateT("Password is successfully changed. Don't forget to update your password in the Jabber protocol option."), TranslateT("Change Password"), MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND); } else if (!mir_tstrcmp(type, L"error")) @@ -1290,7 +1290,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) { debugLogA("<iq/> OnIqResultGetVCardAvatar"); - const TCHAR *from = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *from = XmlGetAttrValue(iqNode, L"from"); if (from == NULL) return; @@ -1298,7 +1298,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (hContact == NULL) return; - const TCHAR *type; + const wchar_t *type; if ((type = XmlGetAttrValue(iqNode, L"type")) == NULL) return; if (mir_tstrcmp(type, L"result")) return; @@ -1316,7 +1316,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) return; } - const TCHAR *mimeType = XmlGetText(XmlGetChild(vCard, "TYPE")); + const wchar_t *mimeType = XmlGetText(XmlGetChild(vCard, "TYPE")); HXML n = XmlGetChild(vCard, "BINVAL"); if (n == NULL) return; @@ -1327,11 +1327,11 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) { - const TCHAR *type; + const wchar_t *type; debugLogA("<iq/> iqIdResultGetClientAvatar"); - const TCHAR *from = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *from = XmlGetAttrValue(iqNode, L"from"); if (from == NULL) return; MCONTACT hContact = HContactFromJID(from); @@ -1342,7 +1342,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) if ((type = XmlGetAttrValue(iqNode, L"type")) != NULL && !mir_tstrcmp(type, L"result")) { HXML queryNode = XmlGetChild(iqNode, "query"); if (queryNode != NULL) { - const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); + const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); if (!mir_tstrcmp(xmlns, JABBER_FEAT_AVATAR)) n = XmlGetChild(queryNode, "data"); } @@ -1353,9 +1353,9 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) return; } - TCHAR szJid[JABBER_MAX_JID_LEN]; + wchar_t szJid[JABBER_MAX_JID_LEN]; mir_tstrncpy(szJid, from, _countof(szJid)); - TCHAR *res = _tcschr(szJid, _T('/')); + wchar_t *res = wcschr(szJid, '/'); if (res != NULL) *res = 0; @@ -1369,7 +1369,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) { debugLogA("<iq/> iqIdResultGetServerAvatar"); - const TCHAR *from = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *from = XmlGetAttrValue(iqNode, L"from"); if (from == NULL) return; @@ -1378,11 +1378,11 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) return; HXML n = NULL; - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (!mir_tstrcmp(type, L"result")) { HXML queryNode = XmlGetChild(iqNode, "query"); if (queryNode != NULL) { - const TCHAR *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); + const wchar_t *xmlns = XmlGetAttrValue(queryNode, L"xmlns"); if (!mir_tstrcmp(xmlns, JABBER_FEAT_SERVER_AVATAR)) n = XmlGetChild(queryNode, "data"); } @@ -1393,9 +1393,9 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) return; } - TCHAR szJid[JABBER_MAX_JID_LEN]; + wchar_t szJid[JABBER_MAX_JID_LEN]; mir_tstrncpy(szJid, from, _countof(szJid)); - TCHAR *res = _tcschr(szJid, _T('/')); + wchar_t *res = wcschr(szJid, '/'); if (res != NULL) *res = 0; @@ -1405,7 +1405,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) } -void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const TCHAR *mimeType) +void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t *mimeType) { unsigned resultLen; ptrA body((char*)mir_base64_decode(_T2A(XmlGetText(n)), &resultLen)); @@ -1431,7 +1431,7 @@ LBL_ErrFormat: ai.format = pictureType; ai.hContact = hContact; - TCHAR tszFileName[MAX_PATH]; + wchar_t tszFileName[MAX_PATH]; if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { GetAvatarFileName(hContact, tszFileName, _countof(tszFileName)); DeleteFile(tszFileName); @@ -1446,9 +1446,9 @@ LBL_ErrFormat: mir_sha1_finish(&sha, digest); GetAvatarFileName(hContact, tszFileName, _countof(tszFileName)); - _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE); + wcsncpy_s(ai.filename, tszFileName, _TRUNCATE); - FILE *out = _tfopen(tszFileName, L"wb"); + FILE *out = _wfopen(tszFileName, L"wb"); if (out != NULL) { fwrite(body, resultLen, 1, out); fclose(out); @@ -1469,11 +1469,11 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) // RECVED: list of bookmarks // ACTION: refresh bookmarks dialog debugLogA("<iq/> iqIdGetBookmarks"); - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; - const TCHAR *jid; + const wchar_t *jid; if (!mir_tstrcmp(type, L"result")) { if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) { m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE; @@ -1494,7 +1494,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) item->nick = mir_tstrdup(XPathT(itemNode, "nick")); item->password = mir_tstrdup(XPathT(itemNode, "password")); - const TCHAR *autoJ = XmlGetAttrValue(itemNode, L"autojoin"); + const wchar_t *autoJ = XmlGetAttrValue(itemNode, L"autojoin"); if (autoJ != NULL) item->bAutoJoin = !mir_tstrcmp(autoJ, L"true") || !mir_tstrcmp(autoJ, L"1"); } @@ -1559,7 +1559,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) debugLogA("<iq/> iqIdSetBookmarks"); - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; @@ -1568,7 +1568,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo*) } else if (!mir_tstrcmp(type, L"error")) { HXML errorNode = XmlGetChild(iqNode, "error"); - TCHAR *str = JabberErrorMsg(errorNode); + wchar_t *str = JabberErrorMsg(errorNode); MessageBox(NULL, str, TranslateT("Jabber Bookmarks Error"), MB_OK | MB_SETFOREGROUND); mir_free(str); UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_ACTIVATE); @@ -1586,7 +1586,7 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) { LPCTSTR szSeconds = XPathT(iqNode, "query[@xmlns='jabber:iq:last']/@seconds"); if (szSeconds) { - int nSeconds = _ttoi(szSeconds); + int nSeconds = _wtoi(szSeconds); if (nSeconds > 0) lastActivity = time(0) - nSeconds; } @@ -1610,9 +1610,9 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo) if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) { LPCTSTR szTzo = XPathFmt(pIqNode, L"time[@xmlns='%s']/tzo", JABBER_FEAT_ENTITY_TIME); if (szTzo && szTzo[0]) { - LPCTSTR szMin = _tcschr(szTzo, ':'); - int nTz = _ttoi(szTzo) * -2; - nTz += (nTz < 0 ? -1 : 1) * (szMin ? _ttoi(szMin + 1) / 30 : 0); + LPCTSTR szMin = wcschr(szTzo, ':'); + int nTz = _wtoi(szTzo) * -2; + nTz += (nTz < 0 ? -1 : 1) * (szMin ? _wtoi(szMin + 1) / 30 : 0); TIME_ZONE_INFORMATION tzinfo; if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT) diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 576080d884..1795ccbcfb 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void CJabberProto::SetMucConfig(HXML node, void *from) { if (m_ThreadInfo && from) { - XmlNodeIq iq(L"set", SerialNext(), (TCHAR*)from); + XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from); HXML query = iq << XQUERY(JABBER_FEAT_MUC_OWNER); XmlAddChild(query, node); m_ThreadInfo->send(iq); @@ -68,10 +68,10 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo*) static void sttFillJidList(HWND hwndDlg) { - TCHAR *filter = NULL; + wchar_t *filter = NULL; if (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA)) { int filterLength = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILTER)) + 1; - filter = (TCHAR *)_alloca(filterLength * sizeof(TCHAR)); + filter = (wchar_t *)_alloca(filterLength * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_FILTER, filter, filterLength); } @@ -95,7 +95,7 @@ static void sttFillJidList(HWND hwndDlg) ListView_DeleteAllItems(hwndList); // Populate displayed list from iqNode - TCHAR tszItemText[JABBER_MAX_JID_LEN + 256]; + wchar_t tszItemText[JABBER_MAX_JID_LEN + 256]; HXML iqNode = jidListInfo->iqNode; if (iqNode != NULL) { LPCTSTR from = XmlGetAttrValue(iqNode, L"from"); @@ -112,7 +112,7 @@ static void sttFillJidList(HWND hwndDlg) LPCTSTR jid = XmlGetAttrValue(itemNode, L"jid"); if (jid != NULL) { - lvi.pszText = (TCHAR*)jid; + lvi.pszText = (wchar_t*)jid; if (jidListInfo->type == MUC_BANLIST) { LPCTSTR reason = XmlGetText(XmlGetChild(itemNode, L"reason")); if (reason != NULL) { @@ -180,7 +180,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w { JABBER_MUC_JIDLIST_INFO *dat = (JABBER_MUC_JIDLIST_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); - TCHAR title[256]; + wchar_t title[256]; switch (msg) { case WM_INITDIALOG: @@ -244,7 +244,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w dat->roomJid = mir_tstrdup(from); HXML queryNode = XmlGetChild(iqNode, L"query"); if (queryNode != NULL) { - TCHAR *localFrom = mir_tstrdup(from); + wchar_t *localFrom = mir_tstrdup(from); mir_sntprintf(title, TranslateT("%s, %d items (%s)"), (dat->type == MUC_VOICELIST) ? TranslateT("Voice List") : (dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") : @@ -301,7 +301,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w NMLISTVIEW *nm = (NMLISTVIEW *)lParam; LVITEM lvi; LVHITTESTINFO hti; - TCHAR text[128]; + wchar_t text[128]; if (nm->iSubItem < 1) break; @@ -343,11 +343,11 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w } else { //delete - TCHAR msgText[128]; + wchar_t msgText[128]; mir_sntprintf(msgText, TranslateT("Removing %s?"), text); if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO | MB_SETFOREGROUND) == IDYES) { - dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam); + dat->ppro->DeleteMucListItem(dat, (wchar_t*)lvi.lParam); mir_free((void *)lvi.lParam); ListView_DeleteItem(nm->hdr.hwndFrom, hti.iItem); } @@ -542,7 +542,7 @@ JABBER_MUC_JIDLIST_INFO::~JABBER_MUC_JIDLIST_INFO() mir_free(roomJid); } -TCHAR* JABBER_MUC_JIDLIST_INFO::type2str() const +wchar_t* JABBER_MUC_JIDLIST_INFO::type2str() const { switch (type) { case MUC_VOICELIST: return TranslateT("Voice List"); diff --git a/protocols/JabberG/src/jabber_libstr.cpp b/protocols/JabberG/src/jabber_libstr.cpp index 3b85b3e4c0..24b13f8478 100644 --- a/protocols/JabberG/src/jabber_libstr.cpp +++ b/protocols/JabberG/src/jabber_libstr.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -int lstrcmp_null(const TCHAR *s1, const TCHAR *s2) +int lstrcmp_null(const wchar_t *s1, const wchar_t *s2) { if (!s1 && !s2) return 0; if (!s1) return -1; diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index b12aeef4d4..434bdd1028 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -115,7 +115,7 @@ void CJabberProto::ListWipe(void) ///////////////////////////////////////////////////////////////////////////////////////// // Adding & removing items -JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCONTACT hContact) +JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const wchar_t *jid, MCONTACT hContact) { bool bUseResource = false; mir_cslockfull lck(m_csLists); @@ -127,15 +127,15 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCON return item; } - TCHAR *s = mir_tstrdup(jid); - TCHAR *q = NULL; + wchar_t *s = mir_tstrdup(jid); + wchar_t *q = NULL; // strip resource name if any //fyr if (!((list == LIST_ROSTER) && ListGetItemPtr(LIST_CHATROOM, jid))) { // but only if it is not chat room contact if (list != LIST_VCARD_TEMP) { - TCHAR *p; - if ((p = _tcschr(s, '@')) != NULL) - if ((q = _tcschr(p, '/')) != NULL) + wchar_t *p; + if ((p = wcschr(s, '@')) != NULL) + if ((q = wcschr(p, '/')) != NULL) *q = '\0'; } } @@ -163,7 +163,7 @@ JABBER_LIST_ITEM* CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid, MCON return item; } -void CJabberProto::ListRemove(JABBER_LIST list, const TCHAR *jid) +void CJabberProto::ListRemove(JABBER_LIST list, const wchar_t *jid) { mir_cslock lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid); @@ -192,14 +192,14 @@ void CJabberProto::ListRemoveByIndex(int index) ///////////////////////////////////////////////////////////////////////////////////////// // Getting & finding items -JABBER_LIST_ITEM* CJabberProto::ListGetItemPtr(JABBER_LIST list, const TCHAR *jid) +JABBER_LIST_ITEM* CJabberProto::ListGetItemPtr(JABBER_LIST list, const wchar_t *jid) { if (jid == NULL) return NULL; JABBER_LIST_ITEM *tmp = (JABBER_LIST_ITEM*)_alloca(sizeof(JABBER_LIST_ITEM)); tmp->list = list; - tmp->jid = (TCHAR*)jid; + tmp->jid = (wchar_t*)jid; tmp->bUseResource = false; mir_cslock lck(m_csLists); @@ -237,7 +237,7 @@ int CJabberProto::ListFindNext(JABBER_LIST list, int fromOffset) ///////////////////////////////////////////////////////////////////////////////////////// // Resource related code -pResourceStatus JABBER_LIST_ITEM::findResource(const TCHAR *resourceName) const +pResourceStatus JABBER_LIST_ITEM::findResource(const wchar_t *resourceName) const { if (arResources.getCount() == 0 || resourceName == NULL || *resourceName == 0) return NULL; @@ -251,19 +251,19 @@ pResourceStatus JABBER_LIST_ITEM::findResource(const TCHAR *resourceName) const return NULL; } -pResourceStatus CJabberProto::ListFindResource(JABBER_LIST list, const TCHAR *jid) +pResourceStatus CJabberProto::ListFindResource(JABBER_LIST list, const wchar_t *jid) { mir_cslock lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid); if (LI == NULL) return NULL; - const TCHAR *p = _tcschr(jid, '@'); - const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/'); + const wchar_t *p = wcschr(jid, '@'); + const wchar_t *q = wcschr((p == NULL) ? jid : p, '/'); return (q == NULL) ? NULL : LI->findResource(q + 1); } -bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int status, const TCHAR *statusMessage, char priority, const TCHAR *nick) +bool CJabberProto::ListAddResource(JABBER_LIST list, const wchar_t *jid, int status, const wchar_t *statusMessage, char priority, const wchar_t *nick) { mir_cslockfull lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid); @@ -272,10 +272,10 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int statu bool bIsNewResource = false; - const TCHAR *p = _tcschr(jid, '@'); - const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/'); + const wchar_t *p = wcschr(jid, '@'); + const wchar_t *q = wcschr((p == NULL) ? jid : p, '/'); if (q) { - const TCHAR *resource = q + 1; + const wchar_t *resource = q + 1; if (*resource == 0) return 0; @@ -312,15 +312,15 @@ bool CJabberProto::ListAddResource(JABBER_LIST list, const TCHAR *jid, int statu return bIsNewResource; } -void CJabberProto::ListRemoveResource(JABBER_LIST list, const TCHAR *jid) +void CJabberProto::ListRemoveResource(JABBER_LIST list, const wchar_t *jid) { mir_cslockfull lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(list, jid); if (LI == NULL) return; - const TCHAR *p = _tcschr(jid, '@'); - const TCHAR *q = _tcschr((p == NULL) ? jid : p, '/'); + const wchar_t *p = wcschr(jid, '@'); + const wchar_t *q = wcschr((p == NULL) ? jid : p, '/'); if (q == NULL) return; @@ -382,7 +382,7 @@ JABBER_RESOURCE_STATUS* JABBER_LIST_ITEM::getTemp() return m_pItemResource; } -TCHAR* CJabberProto::ListGetBestClientResourceNamePtr(const TCHAR *jid) +wchar_t* CJabberProto::ListGetBestClientResourceNamePtr(const wchar_t *jid) { mir_cslock lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid); @@ -394,7 +394,7 @@ TCHAR* CJabberProto::ListGetBestClientResourceNamePtr(const TCHAR *jid) return r->m_tszResourceName; int status = ID_STATUS_OFFLINE; - TCHAR *res = NULL; + wchar_t *res = NULL; for (int i = 0; i < LI->arResources.getCount(); i++) { r = LI->arResources[i]; bool foundBetter = false; diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 6537179c50..29f145422c 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -150,14 +150,14 @@ struct JABBER_LIST_ITEM : public MZeroedObject ~JABBER_LIST_ITEM(); JABBER_LIST list; - TCHAR* jid; + wchar_t* jid; MCONTACT hContact; // LIST_ROSTER // jid = jid of the contact - TCHAR* nick; + wchar_t* nick; - pResourceStatus findResource(const TCHAR *resourceName) const; + pResourceStatus findResource(const wchar_t *resourceName) const; pResourceStatus getBestResource() const; JABBER_RESOURCE_MODE resourceMode; LIST<JABBER_RESOURCE_STATUS> arResources; // array of resources @@ -168,18 +168,18 @@ struct JABBER_LIST_ITEM : public MZeroedObject *getTemp(); // allocates m_pItemResource if needed JABBER_SUBSCRIPTION subscription; - TCHAR* group; - TCHAR* photoFileName; - TCHAR* messageEventIdStr; + wchar_t* group; + wchar_t* photoFileName; + wchar_t* messageEventIdStr; // LIST_AGENT // jid = jid of the agent - TCHAR* name; - TCHAR* service; + wchar_t* name; + wchar_t* service; // LIST_ROOM // jid = room JID - TCHAR* type; // room type + wchar_t* type; // room type // LIST_CHATROOM // jid = room JID @@ -206,7 +206,7 @@ struct JABBER_LIST_ITEM : public MZeroedObject //LIST_BOOKMARK // jid = room JID - TCHAR* password; // password for room + wchar_t* password; // password for room bool bAutoJoin; bool bUseResource; @@ -220,7 +220,7 @@ struct JABBER_HTTP_AVATARS char * Url; MCONTACT hContact; - JABBER_HTTP_AVATARS(const TCHAR *tUrl, MCONTACT thContact) + JABBER_HTTP_AVATARS(const wchar_t *tUrl, MCONTACT thContact) : Url(mir_t2a(tUrl)), hContact(thContact) {} ~JABBER_HTTP_AVATARS() { mir_free(Url); } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index c82c57eedd..3df1e3989d 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -309,7 +309,7 @@ void g_MenuInit(void) char buf[] = "Jabber/DirectPresenceX"; buf[_countof(buf) - 2] = '0' + i; mi.pszService = buf; - mi.name.t = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0); + mi.name.w = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0); mi.position = -1999901000; mi.hIcolibItem = Skin_LoadIcon(PresenceModeArray[i].icon); g_hMenuDirectPresence[i + 1] = Menu_AddContactMenuItem(&mi); @@ -376,7 +376,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) { if (ptrT(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) { Menu_ShowItem(g_hMenuConvert, TRUE); - Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENT("&Convert to Contact") : LPGENT("&Convert to Chat Room")); + Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENW("&Convert to Contact") : LPGENW("&Convert to Chat Room")); } } @@ -701,10 +701,10 @@ void CJabberProto::MenuInit() mi.flags = CMIF_UNMOVABLE | CMIF_HIDDEN; m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi); - TCHAR szName[128]; + wchar_t szName[128]; char srvFce[MAX_PATH + 64]; mi.pszService = srvFce; - mi.name.t = szName; + mi.name.w = szName; mi.position = 2000040000; mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.root = m_hMenuPriorityRoot; @@ -770,7 +770,7 @@ void CJabberProto::UpdatePriorityMenu(int priority) if (!m_hMenuPriorityRoot || (m_priorityMenuValSet && priority == m_priorityMenuVal)) return; - TCHAR szName[128]; + wchar_t szName[128]; mir_sntprintf(szName, TranslateT("Resource priority [%d]"), (int)priority); Menu_ModifyItem(m_hMenuPriorityRoot, szName); @@ -788,7 +788,7 @@ void CJabberProto::GlobalMenuInit() CMenuItem mi; mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.position = iChooserMenuPos++; - mi.name.t = m_tszUserName; + mi.name.w = m_tszUserName; m_hChooseMenuItem = Menu_AddItem(hChooserMenu, &mi, this); ////////////////////////////////////////////////////////////////////////////////////// @@ -805,19 +805,19 @@ void CJabberProto::GlobalMenuInit() hkd.dwFlags = HKD_TCHAR; mir_strcpy(tDest, "/Groupchat"); - hkd.ptszDescription = LPGENT("Join conference"); + hkd.ptszDescription = LPGENW("Join conference"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/Bookmarks"); - hkd.ptszDescription = LPGENT("Open bookmarks"); + hkd.ptszDescription = LPGENW("Open bookmarks"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/PrivacyLists"); - hkd.ptszDescription = LPGENT("Privacy lists"); + hkd.ptszDescription = LPGENW("Privacy lists"); Hotkey_Register(&hkd); mir_strcpy(tDest, "/ServiceDiscovery"); - hkd.ptszDescription = LPGENT("Service discovery"); + hkd.ptszDescription = LPGENW("Service discovery"); Hotkey_Register(&hkd); } @@ -965,7 +965,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) if (!bSupportTyping || !m_bJabberOnline) return 0; - TCHAR jid[JABBER_MAX_JID_LEN]; + wchar_t jid[JABBER_MAX_JID_LEN]; if (GetClientJID(event->hContact, jid, _countof(jid))) { pResourceStatus r(ResourceInfoFromJID(jid)); if (r && r->m_bMessageSessionActive) { @@ -996,7 +996,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) return 0; HMENU hMenu = CreatePopupMenu(); - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("Last active (%s)"), LI->m_pLastSeenResource ? LI->m_pLastSeenResource->m_tszResourceName : TranslateT("No activity yet, use server's choice")); @@ -1072,7 +1072,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM hContact, LPARAM if (!m_bJabberOnline || !hContact) return 0; - TCHAR *jid, text[1024]; + wchar_t *jid, text[1024]; ptrT tszJid(getTStringA(hContact, "jid")); if (tszJid == NULL) { ptrT roomid(getTStringA(hContact, "ChatRoomID")); diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index dc7e7f6026..cb17a7fa13 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -34,14 +34,14 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI if (item == NULL) item = ListGetItemPtr(LIST_CHATROOM, pInfo->GetFrom()); if (item != NULL) { // yes, it is - TCHAR *szErrText = JabberErrorMsg(pInfo->GetChildNode()); + wchar_t *szErrText = JabberErrorMsg(pInfo->GetChildNode()); if (id != -1) { char *errText = mir_t2a(szErrText); ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText); mir_free(errText); } else { - TCHAR buf[512]; + wchar_t buf[512]; HXML bodyNode = XmlGetChild(node, "body"); if (bodyNode) mir_sntprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), XmlGetText(bodyNode), szErrText); @@ -58,8 +58,8 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI BOOL CJabberProto::OnMessageIbb(HXML, ThreadData*, CJabberMessageInfo* pInfo) { BOOL bOk = FALSE; - const TCHAR *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid"); - const TCHAR *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq"); + const wchar_t *sid = XmlGetAttrValue(pInfo->GetChildNode(), L"sid"); + const wchar_t *seq = XmlGetAttrValue(pInfo->GetChildNode(), L"seq"); if (sid && seq && XmlGetText(pInfo->GetChildNode())) bOk = OnIbbRecvdData(XmlGetText(pInfo->GetChildNode()), sid, seq); @@ -80,8 +80,8 @@ BOOL CJabberProto::OnMessageGroupchat(HXML node, ThreadData*, CJabberMessageInfo // got message from unknown conference... let's leave it :) else { -// TCHAR *conference = NEWTSTR_ALLOCA(from); -// if (TCHAR *s = _tcschr(conference, _T('/'))) *s = 0; +// wchar_t *conference = NEWWSTR_ALLOCA(from); +// if (wchar_t *s = wcschr(conference, '/')) *s = 0; // XmlNode p("presence"); XmlAddAttr(p, "to", conference); XmlAddAttr(p, "type", "unavailable"); // info->send(p); } diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index 47a683a23e..c6253582ae 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -115,9 +115,9 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler( JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, - const TCHAR *szXmlns, + const wchar_t *szXmlns, BOOL bAllowPartialNs, - const TCHAR *szTag, + const wchar_t *szTag, void *pUserData, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree, int iPriority) diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h index 17d5e3ded6..48db4c2c83 100644 --- a/protocols/JabberG/src/jabber_message_manager.h +++ b/protocols/JabberG/src/jabber_message_manager.h @@ -125,7 +125,7 @@ public: CJabberMessageManager(CJabberProto *proto); ~CJabberMessageManager(); - CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const TCHAR *szXmlns, BOOL bAllowPartialNs, const TCHAR *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT); + CJabberMessagePermanentInfo* AddPermanentHandler(JABBER_PERMANENT_MESSAGE_HANDLER pHandler, int nMessageTypes, DWORD dwParamsToParse, const wchar_t *szXmlns, BOOL bAllowPartialNs, const wchar_t *szTag, void *pUserData = NULL, MESSAGE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT); bool DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo); bool HandleMessagePermanent(HXML node, ThreadData *pThreadData); diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index de15d1102b..36d7eda517 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////// // JabberAddContactToRoster() - adds a contact to the roster -void CJabberProto::AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName) +void CJabberProto::AddContactToRoster(const wchar_t *jid, const wchar_t *nick, const wchar_t *grpName) { XmlNodeIq iq(L"set", SerialNext()); HXML query = iq << XQUERY(JABBER_FEAT_IQ_ROSTER) @@ -53,7 +53,7 @@ void JabberChatDllError() /////////////////////////////////////////////////////////////////////////////// // JabberDBAddAuthRequest() -void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) +void CJabberProto::DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick) { MCONTACT hContact = DBCreateContact(jid, nick, true, true); delSetting(hContact, "Hidden"); @@ -85,7 +85,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) /////////////////////////////////////////////////////////////////////////////// // JabberDBCreateContact() -MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool temporary, bool stripResource) +MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, bool temporary, bool stripResource) { if (jid == NULL || jid[0] == '\0') return NULL; @@ -95,11 +95,11 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool return hContact; // strip resource if present - TCHAR szJid[JABBER_MAX_JID_LEN]; + wchar_t szJid[JABBER_MAX_JID_LEN]; if (stripResource) JabberStripJid(jid, szJid, _countof(szJid)); else - _tcsncpy_s(szJid, jid, _TRUNCATE); + wcsncpy_s(szJid, jid, _TRUNCATE); MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); Proto_AddToContact(hNewContact, m_szModuleName); @@ -112,7 +112,7 @@ MCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool SendGetVcard(szJid); if (JABBER_LIST_ITEM *pItem = ListAdd(LIST_ROSTER, jid, hNewContact)) - pItem->bUseResource = _tcschr(szJid, '/') != 0; + pItem->bUseResource = wcschr(szJid, '/') != 0; debugLog(L"Create Jabber contact jid=%s, nick=%s", szJid, nick); DBCheckIsTransportedContact(szJid, hNewContact); @@ -154,7 +154,7 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) /////////////////////////////////////////////////////////////////////////////// // JabberGetAvatarFileName() - gets a file name for the avatar image -void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen) +void CJabberProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName); @@ -164,7 +164,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c pszDest[tPathLen++] = '\\'; - const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_PNG)); + const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_PNG)); if (hContact != NULL) { char str[256]; @@ -192,7 +192,7 @@ void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t c /////////////////////////////////////////////////////////////////////////////// // JabberResolveTransportNicks - massive vcard update -void CJabberProto::ResolveTransportNicks(const TCHAR *jid) +void CJabberProto::ResolveTransportNicks(const wchar_t *jid) { // Set all contacts to offline MCONTACT hContact = m_ThreadInfo->resolveContact; @@ -206,7 +206,7 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid) ptrT dbJid(getTStringA(hContact, "jid")); if (dbJid == NULL) continue; ptrT dbNick(getTStringA(hContact, "Nick")); if (dbNick == NULL) continue; - TCHAR *p = _tcschr(dbJid, '@'); + wchar_t *p = wcschr(dbJid, '@'); if (p == NULL) continue; @@ -264,9 +264,9 @@ void CJabberProto::SetServerStatus(int iNewStatus) // Process a string, and double all % characters, according to chat.dll's restrictions // Returns a pointer to the new string (old one is not freed) -TCHAR* UnEscapeChatTags(TCHAR* str_in) +wchar_t* UnEscapeChatTags(wchar_t* str_in) { - TCHAR *s = str_in, *d = str_in; + wchar_t *s = str_in, *d = str_in; while (*s) { if (*s == '%' && s[1] == '%') s++; @@ -281,8 +281,8 @@ TCHAR* UnEscapeChatTags(TCHAR* str_in) struct { - TCHAR *node; - TCHAR *name; + wchar_t *node; + wchar_t *name; } static sttCapsNodeToName_Map[] = { @@ -321,7 +321,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) // jabber:iq:version info requested and exists? if (resource->m_dwVersionRequestTime && resource->m_tszSoftware) { debugLog(L"JabberUpdateMirVer: for iq:version rc %s: %s", resource->m_tszResourceName, resource->m_tszSoftware); - if (!resource->m_tszSoftwareVersion || _tcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion)) + if (!resource->m_tszSoftwareVersion || wcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion)) res = resource->m_tszSoftware; else res.Format(L"%s %s", resource->m_tszSoftware, resource->m_tszSoftwareVersion); @@ -340,7 +340,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) // search through known software list for (i = 0; i < _countof(sttCapsNodeToName_Map); i++) - if (_tcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) { + if (wcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) { res.Format(L"%s %s", sttCapsNodeToName_Map[i].name, resource->m_tszCapsVer); break; } @@ -351,23 +351,23 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) } // attach additional info for fingerprint plguin - if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX86) && !_tcsstr(res, L"x86")) + if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX86) && !wcsstr(res, L"x86")) res.Append(L" x86"); - if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX64) && !_tcsstr(res, L"x64")) + if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_PLATFORMX64) && !wcsstr(res, L"x64")) res.Append(L" x64"); - if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_SECUREIM) && !_tcsstr(res, L"(SecureIM)")) + if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_SECUREIM) && !wcsstr(res, L"(SecureIM)")) res.Append(L" (SecureIM)"); - if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_MIROTR) && !_tcsstr(res, L"(MirOTR)")) + if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_MIROTR) && !wcsstr(res, L"(MirOTR)")) res.Append(L" (MirOTR)"); - if (resource->m_tszCapsExt && _tcsstr(resource->m_tszCapsExt, JABBER_EXT_NEWGPG) && !_tcsstr(res, L"(New_GPG)")) + if (resource->m_tszCapsExt && wcsstr(resource->m_tszCapsExt, JABBER_EXT_NEWGPG) && !wcsstr(res, L"(New_GPG)")) res.Append(L" (New_GPG)"); - if (resource->m_tszResourceName && !_tcsstr(res, resource->m_tszResourceName)) - if (_tcsstr(res, L"Miranda IM") || _tcsstr(res, L"Miranda NG") || m_options.ShowForeignResourceInMirVer) + if (resource->m_tszResourceName && !wcsstr(res, resource->m_tszResourceName)) + if (wcsstr(res, L"Miranda IM") || wcsstr(res, L"Miranda NG") || m_options.ShowForeignResourceInMirVer) res.AppendFormat(L" [%s]", resource->m_tszResourceName); } @@ -383,8 +383,8 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) if (jid == NULL) return; - TCHAR szFullJid[JABBER_MAX_JID_LEN]; - if (resource->m_tszResourceName && !_tcschr(jid, '/')) + wchar_t szFullJid[JABBER_MAX_JID_LEN]; + if (resource->m_tszResourceName && !wcschr(jid, '/')) mir_sntprintf(szFullJid, L"%s/%s", jid, resource->m_tszResourceName); else mir_tstrncpy(szFullJid, jid, _countof(szFullJid)); @@ -437,7 +437,7 @@ void CJabberProto::SetContactOfflineStatus(MCONTACT hContact) void CJabberProto::InitPopups(void) { - TCHAR desc[256]; + wchar_t desc[256]; mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Errors")); char name[256]; @@ -456,14 +456,14 @@ void CJabberProto::InitPopups(void) IcoLib_ReleaseIcon(ppc.hIcon); } -void CJabberProto::MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle) +void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle) { if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { char name[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.ptszTitle = szTitle; - ppd.ptszText = szMsg; + ppd.pwszTitle = szTitle; + ppd.pwszText = szMsg; ppd.pszClassName = name; ppd.hContact = hContact; mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); @@ -499,11 +499,11 @@ CMString CJabberProto::ExtractImage(HXML node) image.Replace(L"%2F", L"/"); image.Replace(L"%3D", L"="); - TCHAR tszTempPath[MAX_PATH], tszTempFile[MAX_PATH]; + wchar_t tszTempPath[MAX_PATH], tszTempFile[MAX_PATH]; GetTempPath(_countof(tszTempPath), tszTempPath); GetTempFileName(tszTempPath, L"jab", InterlockedIncrement(&g_nTempFileId), tszTempFile); - _tcsncat_s(tszTempFile, L".", 1); - _tcsncat_s(tszTempFile, ext, ext.GetLength()); + wcsncat_s(tszTempFile, L".", 1); + wcsncat_s(tszTempFile, ext, ext.GetLength()); HANDLE h = CreateFile(tszTempFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index aa46e14e58..3c2aa50911 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -31,15 +31,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_privacy.h" #include "jabber_notes.h" -static TCHAR* StrTrimCopy(TCHAR *str) +static wchar_t* StrTrimCopy(wchar_t *str) { if (!str) return 0; - while (*str && _istspace(*str)) ++str; + while (*str && iswspace(*str)) ++str; if (!*str) return mir_tstrdup(str); - TCHAR *res = mir_tstrdup(str); - for (TCHAR *p = res + mir_tstrlen(res) - 1; p >= res; --p) { - if (_istspace(*p)) + wchar_t *res = mir_tstrdup(str); + for (wchar_t *p = res + mir_tstrlen(res) - 1; p >= res; --p) { + if (iswspace(*p)) *p = 0; else break; @@ -53,7 +53,7 @@ CNoteItem::CNoteItem() m_szTitle = m_szFrom = m_szText = m_szTags = m_szTagsStr = NULL; } -CNoteItem::CNoteItem(HXML hXml, TCHAR *szFrom) +CNoteItem::CNoteItem(HXML hXml, wchar_t *szFrom) { m_szTitle = m_szFrom = m_szText = m_szTags = m_szTagsStr = NULL; SetData( @@ -72,7 +72,7 @@ CNoteItem::~CNoteItem() mir_free(m_szTagsStr); } -void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags) +void CNoteItem::SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *tags) { mir_free(m_szTitle); mir_free(m_szFrom); @@ -84,15 +84,15 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags) m_szText = JabberStrFixLines(text); m_szFrom = StrTrimCopy(from); - const TCHAR *szTags = tags; - TCHAR *p = m_szTags = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(TCHAR)); - TCHAR *q = m_szTagsStr = (TCHAR *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(TCHAR)); + const wchar_t *szTags = tags; + wchar_t *p = m_szTags = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 2 /*for double zero*/) * sizeof(wchar_t)); + wchar_t *q = m_szTagsStr = (wchar_t *)mir_alloc((mir_tstrlen(szTags) + 1) * sizeof(wchar_t)); for (; szTags && *szTags; ++szTags) { - if (_istspace(*szTags)) + if (iswspace(*szTags)) continue; - if (*szTags == _T(',')) { - *q++ = _T(','); + if (*szTags == ',') { + *q++ = ','; *p++ = 0; continue; } @@ -103,12 +103,12 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags) q[0] = p[0] = p[1] = 0; } -bool CNoteItem::HasTag(const TCHAR *szTag) +bool CNoteItem::HasTag(const wchar_t *szTag) { if (!szTag || !*szTag) return true; - for (TCHAR *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1) + for (wchar_t *p = m_szTags; p && *p; p = p + mir_tstrlen(p) + 1) if (!mir_tstrcmp(p, szTag)) return true; @@ -126,7 +126,7 @@ int CNoteItem::cmp(const CNoteItem *p1, const CNoteItem *p2) return 0; } -void CNoteList::AddNote(HXML hXml, TCHAR *szFrom) +void CNoteList::AddNote(HXML hXml, wchar_t *szFrom) { m_bIsModified = true; insert(new CNoteItem(hXml, szFrom)); @@ -187,10 +187,10 @@ private: void btnOk_OnClick(CCtrlButton *) { - TCHAR *szTitle = m_txtTitle.GetText(); - TCHAR *szText = m_txtText.GetText(); - TCHAR *szTags = m_txtTags.GetText(); - TCHAR *szFrom = mir_tstrdup(m_pNote->GetFrom()); + wchar_t *szTitle = m_txtTitle.GetText(); + wchar_t *szText = m_txtText.GetText(); + wchar_t *szTags = m_txtTags.GetText(); + wchar_t *szFrom = mir_tstrdup(m_pNote->GetFrom()); m_pNote->SetData(szTitle, szFrom, szText, szTags); mir_free(szTitle); mir_free(szText); @@ -297,7 +297,7 @@ public: m_hfntBold = hfntBold; } - int AddString(TCHAR *text, LPARAM data = 0) + int AddString(wchar_t *text, LPARAM data = 0) { m_adding = true; int idx = CCtrlListBox::AddString(text, data); @@ -374,7 +374,7 @@ public: rc.top += DrawText(hdc, pNote->GetTitle(), -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS); SelectObject(hdc, m_hfntNormal); if (pNote->GetFrom()) { - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom()); rc.top += DrawText(hdc, buf, -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS); } @@ -409,7 +409,7 @@ public: lps->itemHeight += rcTmp.bottom; SelectObject(hdc, m_hfntNormal); if (pNote->GetFrom()) { - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("From: %s"), pNote->GetFrom()); rcTmp = rc; DrawText(hdc, buf, -1, &rcTmp, DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT); @@ -466,24 +466,24 @@ private: m_btnRemove.Enable(m_lstNotes.GetCurSel() != LB_ERR); } - void InsertTag(HTREEITEM htiRoot, const TCHAR *tag, bool bSelect) + void InsertTag(HTREEITEM htiRoot, const wchar_t *tag, bool bSelect) { TVINSERTSTRUCT tvi = { 0 }; tvi.hParent = htiRoot; tvi.hInsertAfter = TVI_LAST; tvi.itemex.mask = TVIF_TEXT | TVIF_PARAM; - tvi.itemex.pszText = (TCHAR *)tag; + tvi.itemex.pszText = (wchar_t *)tag; tvi.itemex.lParam = (LPARAM)mir_tstrdup(tag); HTREEITEM hti = m_tvFilter.InsertItem(&tvi); if (bSelect) m_tvFilter.SelectItem(hti); } - void PopulateTags(HTREEITEM htiRoot, TCHAR *szActiveTag) + void PopulateTags(HTREEITEM htiRoot, wchar_t *szActiveTag) { - LIST<TCHAR> tagSet(5, _tcscmp); + LIST<wchar_t> tagSet(5, _tcscmp); for (int i = 0; i < m_proto->m_notes.getCount(); i++) { - TCHAR *tags = m_proto->m_notes[i].GetTags(); - for (TCHAR *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1) + wchar_t *tags = m_proto->m_notes[i].GetTags(); + for (wchar_t *tag = tags; tag && *tag; tag = tag + mir_tstrlen(tag) + 1) if (!tagSet.find(tag)) tagSet.insert(tag); } @@ -505,7 +505,7 @@ private: tvi.mask = TVIF_HANDLE | TVIF_PARAM; tvi.hItem = m_tvFilter.GetSelection(); m_tvFilter.GetItem(&tvi); - TCHAR *szActiveTag = mir_tstrdup((TCHAR *)tvi.lParam); + wchar_t *szActiveTag = mir_tstrdup((wchar_t *)tvi.lParam); m_tvFilter.DeleteAllItems(); @@ -521,11 +521,11 @@ private: void InsertItem(CNoteItem &item) { - m_lstNotes.AddString((TCHAR *)item.GetTitle(), (LPARAM)&item); + m_lstNotes.AddString((wchar_t *)item.GetTitle(), (LPARAM)&item); EnableControls(); } - void ListItems(const TCHAR *tag) + void ListItems(const wchar_t *tag) { m_lstNotes.ResetContent(); for (int i = 0; i < m_proto->m_notes.getCount(); i++) @@ -587,14 +587,14 @@ private: void tvFilter_OnDeleteItem(CCtrlTreeView::TEventInfo *e) { - TCHAR *szText = (TCHAR *)e->nmtv->itemOld.lParam; + wchar_t *szText = (wchar_t *)e->nmtv->itemOld.lParam; mir_free(szText); EnableControls(); } void tvFilter_OnSelChanged(CCtrlTreeView::TEventInfo *e) { - TCHAR *szText = (TCHAR *)e->nmtv->itemNew.lParam; + wchar_t *szText = (wchar_t *)e->nmtv->itemNew.lParam; ListItems(szText); EnableControls(); } @@ -726,7 +726,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) return; } - TCHAR buf[1024]; + wchar_t buf[1024]; mir_sntprintf(buf, L"Incoming note: %s\n\n%s\nTags: %s", pNote->GetTitle(), pNote->GetText(), pNote->GetTagsStr()); @@ -759,13 +759,13 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) delete pNote; } -bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml) +bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml) { if (!m_options.AcceptNotes) return false; if (!szFrom || !hXml) return true; - CNoteItem *pItem = new CNoteItem(hXml, (TCHAR *)szFrom); + CNoteItem *pItem = new CNoteItem(hXml, (wchar_t *)szFrom); if (!pItem->IsNotEmpty()) { delete pItem; return true; diff --git a/protocols/JabberG/src/jabber_notes.h b/protocols/JabberG/src/jabber_notes.h index f8541d4aef..8c55e7ad0b 100644 --- a/protocols/JabberG/src/jabber_notes.h +++ b/protocols/JabberG/src/jabber_notes.h @@ -30,26 +30,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CNoteItem { private: - TCHAR *m_szTitle; - TCHAR *m_szFrom; - TCHAR *m_szText; - TCHAR *m_szTags; - TCHAR *m_szTagsStr; + wchar_t *m_szTitle; + wchar_t *m_szFrom; + wchar_t *m_szText; + wchar_t *m_szTags; + wchar_t *m_szTagsStr; public: CNoteItem(); - CNoteItem(HXML hXml, TCHAR *szFrom = 0); + CNoteItem(HXML hXml, wchar_t *szFrom = 0); ~CNoteItem(); - void SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags); + void SetData(wchar_t *title, wchar_t *from, wchar_t *text, wchar_t *tags); - TCHAR *GetTitle() const { return m_szTitle; } - TCHAR *GetFrom() const { return m_szFrom; } - TCHAR *GetText() const { return m_szText; } - TCHAR *GetTags() const { return m_szTags; } - TCHAR *GetTagsStr() const { return m_szTagsStr; } + wchar_t *GetTitle() const { return m_szTitle; } + wchar_t *GetFrom() const { return m_szFrom; } + wchar_t *GetText() const { return m_szText; } + wchar_t *GetTags() const { return m_szTags; } + wchar_t *GetTagsStr() const { return m_szTagsStr; } - bool HasTag(const TCHAR *szTag); + bool HasTag(const wchar_t *szTag); bool IsNotEmpty() { @@ -76,7 +76,7 @@ public: OBJLIST<CNoteItem>::remove(p); } - void AddNote(HXML hXml, TCHAR *szFrom = 0); + void AddNote(HXML hXml, wchar_t *szFrom = 0); void LoadXml(HXML hXml); void SaveXml(HXML hXmlParent); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 9c165d1ce8..828b0a9648 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -35,192 +35,192 @@ static BOOL(WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0; #define STR_FORMAT L"%s %s@%S:%d?" -struct { TCHAR *szCode; TCHAR *szDescription; } g_LanguageCodes[] = { - { L"aa", LPGENT("Afar") }, - { L"ab", LPGENT("Abkhazian") }, - { L"af", LPGENT("Afrikaans") }, - { L"ak", LPGENT("Akan") }, - { L"sq", LPGENT("Albanian") }, - { L"am", LPGENT("Amharic") }, - { L"ar", LPGENT("Arabic") }, - { L"an", LPGENT("Aragonese") }, - { L"hy", LPGENT("Armenian") }, - { L"as", LPGENT("Assamese") }, - { L"av", LPGENT("Avaric") }, - { L"ae", LPGENT("Avestan") }, - { L"ay", LPGENT("Aymara") }, - { L"az", LPGENT("Azerbaijani") }, - { L"ba", LPGENT("Bashkir") }, - { L"bm", LPGENT("Bambara") }, - { L"eu", LPGENT("Basque") }, - { L"be", LPGENT("Belarusian") }, - { L"bn", LPGENT("Bengali") }, - { L"bh", LPGENT("Bihari") }, - { L"bi", LPGENT("Bislama") }, - { L"bs", LPGENT("Bosnian") }, - { L"br", LPGENT("Breton") }, - { L"bg", LPGENT("Bulgarian") }, - { L"my", LPGENT("Burmese") }, - { L"ca", LPGENT("Catalan; Valencian") }, - { L"ch", LPGENT("Chamorro") }, - { L"ce", LPGENT("Chechen") }, - { L"zh", LPGENT("Chinese") }, - { L"cu", LPGENT("Church Slavic; Old Slavonic") }, - { L"cv", LPGENT("Chuvash") }, - { L"kw", LPGENT("Cornish") }, - { L"co", LPGENT("Corsican") }, - { L"cr", LPGENT("Cree") }, - { L"cs", LPGENT("Czech") }, - { L"da", LPGENT("Danish") }, - { L"dv", LPGENT("Divehi; Dhivehi; Maldivian") }, - { L"nl", LPGENT("Dutch; Flemish") }, - { L"dz", LPGENT("Dzongkha") }, - { L"en", LPGENT("English") }, - { L"eo", LPGENT("Esperanto") }, - { L"et", LPGENT("Estonian") }, - { L"ee", LPGENT("Ewe") }, - { L"fo", LPGENT("Faroese") }, - { L"fj", LPGENT("Fijian") }, - { L"fi", LPGENT("Finnish") }, - { L"fr", LPGENT("French") }, - { L"fy", LPGENT("Western Frisian") }, - { L"ff", LPGENT("Fulah") }, - { L"ka", LPGENT("Georgian") }, - { L"de", LPGENT("German") }, - { L"gd", LPGENT("Gaelic; Scottish Gaelic") }, - { L"ga", LPGENT("Irish") }, - { L"gl", LPGENT("Galician") }, - { L"gv", LPGENT("Manx") }, - { L"el", LPGENT("Greek, Modern (1453-)") }, - { L"gn", LPGENT("Guarani") }, - { L"gu", LPGENT("Gujarati") }, - { L"ht", LPGENT("Haitian; Haitian Creole") }, - { L"ha", LPGENT("Hausa") }, - { L"he", LPGENT("Hebrew") }, - { L"hz", LPGENT("Herero") }, - { L"hi", LPGENT("Hindi") }, - { L"ho", LPGENT("Hiri Motu") }, - { L"hu", LPGENT("Hungarian") }, - { L"ig", LPGENT("Igbo") }, - { L"is", LPGENT("Icelandic") }, - { L"io", LPGENT("Ido") }, - { L"ii", LPGENT("Sichuan Yi") }, - { L"iu", LPGENT("Inuktitut") }, - { L"ie", LPGENT("Interlingue") }, - { L"ia", LPGENT("Interlingua (International Auxiliary Language Association)") }, - { L"id", LPGENT("Indonesian") }, - { L"ik", LPGENT("Inupiaq") }, - { L"it", LPGENT("Italian") }, - { L"jv", LPGENT("Javanese") }, - { L"ja", LPGENT("Japanese") }, - { L"kl", LPGENT("Kalaallisut; Greenlandic") }, - { L"kn", LPGENT("Kannada") }, - { L"ks", LPGENT("Kashmiri") }, - { L"kr", LPGENT("Kanuri") }, - { L"kk", LPGENT("Kazakh") }, - { L"km", LPGENT("Central Khmer") }, - { L"ki", LPGENT("Kikuyu; Gikuyu") }, - { L"rw", LPGENT("Kinyarwanda") }, - { L"ky", LPGENT("Kirghiz; Kyrgyz") }, - { L"kv", LPGENT("Komi") }, - { L"kg", LPGENT("Kongo") }, - { L"ko", LPGENT("Korean") }, - { L"kj", LPGENT("Kuanyama; Kwanyama") }, - { L"ku", LPGENT("Kurdish") }, - { L"lo", LPGENT("Lao") }, - { L"la", LPGENT("Latin") }, - { L"lv", LPGENT("Latvian") }, - { L"li", LPGENT("Limburgan; Limburger; Limburgish") }, - { L"ln", LPGENT("Lingala") }, - { L"lt", LPGENT("Lithuanian") }, - { L"lb", LPGENT("Luxembourgish; Letzeburgesch") }, - { L"lu", LPGENT("Luba-Katanga") }, - { L"lg", LPGENT("Ganda") }, - { L"mk", LPGENT("Macedonian") }, - { L"mh", LPGENT("Marshallese") }, - { L"ml", LPGENT("Malayalam") }, - { L"mi", LPGENT("Maori") }, - { L"mr", LPGENT("Marathi") }, - { L"ms", LPGENT("Malay") }, - { L"mg", LPGENT("Malagasy") }, - { L"mt", LPGENT("Maltese") }, - { L"mo", LPGENT("Moldavian") }, - { L"mn", LPGENT("Mongolian") }, - { L"na", LPGENT("Nauru") }, - { L"nv", LPGENT("Navajo; Navaho") }, - { L"nr", LPGENT("Ndebele, South; South Ndebele") }, - { L"nd", LPGENT("Ndebele, North; North Ndebele") }, - { L"ng", LPGENT("Ndonga") }, - { L"ne", LPGENT("Nepali") }, - { L"nn", LPGENT("Norwegian Nynorsk; Nynorsk, Norwegian") }, - { L"nb", LPGENT("Bokmaal, Norwegian; Norwegian Bokmaal") }, - { L"no", LPGENT("Norwegian") }, - { L"ny", LPGENT("Chichewa; Chewa; Nyanja") }, - { L"oc", LPGENT("Occitan (post 1500); Provencal") }, - { L"oj", LPGENT("Ojibwa") }, - { L"or", LPGENT("Oriya") }, - { L"om", LPGENT("Oromo") }, - { L"os", LPGENT("Ossetian; Ossetic") }, - { L"pa", LPGENT("Panjabi; Punjabi") }, - { L"fa", LPGENT("Persian") }, - { L"pi", LPGENT("Pali") }, - { L"pl", LPGENT("Polish") }, - { L"pt", LPGENT("Portuguese") }, - { L"ps", LPGENT("Pushto") }, - { L"qu", LPGENT("Quechua") }, - { L"rm", LPGENT("Romansh") }, - { L"ro", LPGENT("Romanian") }, - { L"rn", LPGENT("Rundi") }, - { L"ru", LPGENT("Russian") }, - { L"sg", LPGENT("Sango") }, - { L"sa", LPGENT("Sanskrit") }, - { L"sr", LPGENT("Serbian") }, - { L"hr", LPGENT("Croatian") }, - { L"si", LPGENT("Sinhala; Sinhalese") }, - { L"sk", LPGENT("Slovak") }, - { L"sl", LPGENT("Slovenian") }, - { L"se", LPGENT("Northern Sami") }, - { L"sm", LPGENT("Samoan") }, - { L"sn", LPGENT("Shona") }, - { L"sd", LPGENT("Sindhi") }, - { L"so", LPGENT("Somali") }, - { L"st", LPGENT("Sotho, Southern") }, - { L"es", LPGENT("Spanish; Castilian") }, - { L"sc", LPGENT("Sardinian") }, - { L"ss", LPGENT("Swati") }, - { L"su", LPGENT("Sundanese") }, - { L"sw", LPGENT("Swahili") }, - { L"sv", LPGENT("Swedish") }, - { L"ty", LPGENT("Tahitian") }, - { L"ta", LPGENT("Tamil") }, - { L"tt", LPGENT("Tatar") }, - { L"te", LPGENT("Telugu") }, - { L"tg", LPGENT("Tajik") }, - { L"tl", LPGENT("Tagalog") }, - { L"th", LPGENT("Thai") }, - { L"bo", LPGENT("Tibetan") }, - { L"ti", LPGENT("Tigrinya") }, - { L"to", LPGENT("Tonga (Tonga Islands)") }, - { L"tn", LPGENT("Tswana") }, - { L"ts", LPGENT("Tsonga") }, - { L"tk", LPGENT("Turkmen") }, - { L"tr", LPGENT("Turkish") }, - { L"tw", LPGENT("Twi") }, - { L"ug", LPGENT("Uighur; Uyghur") }, - { L"uk", LPGENT("Ukrainian") }, - { L"ur", LPGENT("Urdu") }, - { L"uz", LPGENT("Uzbek") }, - { L"ve", LPGENT("Venda") }, - { L"vi", LPGENT("Vietnamese") }, - { L"vo", LPGENT("Volapuk") }, - { L"cy", LPGENT("Welsh") }, - { L"wa", LPGENT("Walloon") }, - { L"wo", LPGENT("Wolof") }, - { L"xh", LPGENT("Xhosa") }, - { L"yi", LPGENT("Yiddish") }, - { L"yo", LPGENT("Yoruba") }, - { L"za", LPGENT("Zhuang; Chuang") }, - { L"zu", LPGENT("Zulu") }, +struct { wchar_t *szCode; wchar_t *szDescription; } g_LanguageCodes[] = { + { L"aa", LPGENW("Afar") }, + { L"ab", LPGENW("Abkhazian") }, + { L"af", LPGENW("Afrikaans") }, + { L"ak", LPGENW("Akan") }, + { L"sq", LPGENW("Albanian") }, + { L"am", LPGENW("Amharic") }, + { L"ar", LPGENW("Arabic") }, + { L"an", LPGENW("Aragonese") }, + { L"hy", LPGENW("Armenian") }, + { L"as", LPGENW("Assamese") }, + { L"av", LPGENW("Avaric") }, + { L"ae", LPGENW("Avestan") }, + { L"ay", LPGENW("Aymara") }, + { L"az", LPGENW("Azerbaijani") }, + { L"ba", LPGENW("Bashkir") }, + { L"bm", LPGENW("Bambara") }, + { L"eu", LPGENW("Basque") }, + { L"be", LPGENW("Belarusian") }, + { L"bn", LPGENW("Bengali") }, + { L"bh", LPGENW("Bihari") }, + { L"bi", LPGENW("Bislama") }, + { L"bs", LPGENW("Bosnian") }, + { L"br", LPGENW("Breton") }, + { L"bg", LPGENW("Bulgarian") }, + { L"my", LPGENW("Burmese") }, + { L"ca", LPGENW("Catalan; Valencian") }, + { L"ch", LPGENW("Chamorro") }, + { L"ce", LPGENW("Chechen") }, + { L"zh", LPGENW("Chinese") }, + { L"cu", LPGENW("Church Slavic; Old Slavonic") }, + { L"cv", LPGENW("Chuvash") }, + { L"kw", LPGENW("Cornish") }, + { L"co", LPGENW("Corsican") }, + { L"cr", LPGENW("Cree") }, + { L"cs", LPGENW("Czech") }, + { L"da", LPGENW("Danish") }, + { L"dv", LPGENW("Divehi; Dhivehi; Maldivian") }, + { L"nl", LPGENW("Dutch; Flemish") }, + { L"dz", LPGENW("Dzongkha") }, + { L"en", LPGENW("English") }, + { L"eo", LPGENW("Esperanto") }, + { L"et", LPGENW("Estonian") }, + { L"ee", LPGENW("Ewe") }, + { L"fo", LPGENW("Faroese") }, + { L"fj", LPGENW("Fijian") }, + { L"fi", LPGENW("Finnish") }, + { L"fr", LPGENW("French") }, + { L"fy", LPGENW("Western Frisian") }, + { L"ff", LPGENW("Fulah") }, + { L"ka", LPGENW("Georgian") }, + { L"de", LPGENW("German") }, + { L"gd", LPGENW("Gaelic; Scottish Gaelic") }, + { L"ga", LPGENW("Irish") }, + { L"gl", LPGENW("Galician") }, + { L"gv", LPGENW("Manx") }, + { L"el", LPGENW("Greek, Modern (1453-)") }, + { L"gn", LPGENW("Guarani") }, + { L"gu", LPGENW("Gujarati") }, + { L"ht", LPGENW("Haitian; Haitian Creole") }, + { L"ha", LPGENW("Hausa") }, + { L"he", LPGENW("Hebrew") }, + { L"hz", LPGENW("Herero") }, + { L"hi", LPGENW("Hindi") }, + { L"ho", LPGENW("Hiri Motu") }, + { L"hu", LPGENW("Hungarian") }, + { L"ig", LPGENW("Igbo") }, + { L"is", LPGENW("Icelandic") }, + { L"io", LPGENW("Ido") }, + { L"ii", LPGENW("Sichuan Yi") }, + { L"iu", LPGENW("Inuktitut") }, + { L"ie", LPGENW("Interlingue") }, + { L"ia", LPGENW("Interlingua (International Auxiliary Language Association)") }, + { L"id", LPGENW("Indonesian") }, + { L"ik", LPGENW("Inupiaq") }, + { L"it", LPGENW("Italian") }, + { L"jv", LPGENW("Javanese") }, + { L"ja", LPGENW("Japanese") }, + { L"kl", LPGENW("Kalaallisut; Greenlandic") }, + { L"kn", LPGENW("Kannada") }, + { L"ks", LPGENW("Kashmiri") }, + { L"kr", LPGENW("Kanuri") }, + { L"kk", LPGENW("Kazakh") }, + { L"km", LPGENW("Central Khmer") }, + { L"ki", LPGENW("Kikuyu; Gikuyu") }, + { L"rw", LPGENW("Kinyarwanda") }, + { L"ky", LPGENW("Kirghiz; Kyrgyz") }, + { L"kv", LPGENW("Komi") }, + { L"kg", LPGENW("Kongo") }, + { L"ko", LPGENW("Korean") }, + { L"kj", LPGENW("Kuanyama; Kwanyama") }, + { L"ku", LPGENW("Kurdish") }, + { L"lo", LPGENW("Lao") }, + { L"la", LPGENW("Latin") }, + { L"lv", LPGENW("Latvian") }, + { L"li", LPGENW("Limburgan; Limburger; Limburgish") }, + { L"ln", LPGENW("Lingala") }, + { L"lt", LPGENW("Lithuanian") }, + { L"lb", LPGENW("Luxembourgish; Letzeburgesch") }, + { L"lu", LPGENW("Luba-Katanga") }, + { L"lg", LPGENW("Ganda") }, + { L"mk", LPGENW("Macedonian") }, + { L"mh", LPGENW("Marshallese") }, + { L"ml", LPGENW("Malayalam") }, + { L"mi", LPGENW("Maori") }, + { L"mr", LPGENW("Marathi") }, + { L"ms", LPGENW("Malay") }, + { L"mg", LPGENW("Malagasy") }, + { L"mt", LPGENW("Maltese") }, + { L"mo", LPGENW("Moldavian") }, + { L"mn", LPGENW("Mongolian") }, + { L"na", LPGENW("Nauru") }, + { L"nv", LPGENW("Navajo; Navaho") }, + { L"nr", LPGENW("Ndebele, South; South Ndebele") }, + { L"nd", LPGENW("Ndebele, North; North Ndebele") }, + { L"ng", LPGENW("Ndonga") }, + { L"ne", LPGENW("Nepali") }, + { L"nn", LPGENW("Norwegian Nynorsk; Nynorsk, Norwegian") }, + { L"nb", LPGENW("Bokmaal, Norwegian; Norwegian Bokmaal") }, + { L"no", LPGENW("Norwegian") }, + { L"ny", LPGENW("Chichewa; Chewa; Nyanja") }, + { L"oc", LPGENW("Occitan (post 1500); Provencal") }, + { L"oj", LPGENW("Ojibwa") }, + { L"or", LPGENW("Oriya") }, + { L"om", LPGENW("Oromo") }, + { L"os", LPGENW("Ossetian; Ossetic") }, + { L"pa", LPGENW("Panjabi; Punjabi") }, + { L"fa", LPGENW("Persian") }, + { L"pi", LPGENW("Pali") }, + { L"pl", LPGENW("Polish") }, + { L"pt", LPGENW("Portuguese") }, + { L"ps", LPGENW("Pushto") }, + { L"qu", LPGENW("Quechua") }, + { L"rm", LPGENW("Romansh") }, + { L"ro", LPGENW("Romanian") }, + { L"rn", LPGENW("Rundi") }, + { L"ru", LPGENW("Russian") }, + { L"sg", LPGENW("Sango") }, + { L"sa", LPGENW("Sanskrit") }, + { L"sr", LPGENW("Serbian") }, + { L"hr", LPGENW("Croatian") }, + { L"si", LPGENW("Sinhala; Sinhalese") }, + { L"sk", LPGENW("Slovak") }, + { L"sl", LPGENW("Slovenian") }, + { L"se", LPGENW("Northern Sami") }, + { L"sm", LPGENW("Samoan") }, + { L"sn", LPGENW("Shona") }, + { L"sd", LPGENW("Sindhi") }, + { L"so", LPGENW("Somali") }, + { L"st", LPGENW("Sotho, Southern") }, + { L"es", LPGENW("Spanish; Castilian") }, + { L"sc", LPGENW("Sardinian") }, + { L"ss", LPGENW("Swati") }, + { L"su", LPGENW("Sundanese") }, + { L"sw", LPGENW("Swahili") }, + { L"sv", LPGENW("Swedish") }, + { L"ty", LPGENW("Tahitian") }, + { L"ta", LPGENW("Tamil") }, + { L"tt", LPGENW("Tatar") }, + { L"te", LPGENW("Telugu") }, + { L"tg", LPGENW("Tajik") }, + { L"tl", LPGENW("Tagalog") }, + { L"th", LPGENW("Thai") }, + { L"bo", LPGENW("Tibetan") }, + { L"ti", LPGENW("Tigrinya") }, + { L"to", LPGENW("Tonga (Tonga Islands)") }, + { L"tn", LPGENW("Tswana") }, + { L"ts", LPGENW("Tsonga") }, + { L"tk", LPGENW("Turkmen") }, + { L"tr", LPGENW("Turkish") }, + { L"tw", LPGENW("Twi") }, + { L"ug", LPGENW("Uighur; Uyghur") }, + { L"uk", LPGENW("Ukrainian") }, + { L"ur", LPGENW("Urdu") }, + { L"uz", LPGENW("Uzbek") }, + { L"ve", LPGENW("Venda") }, + { L"vi", LPGENW("Vietnamese") }, + { L"vo", LPGENW("Volapuk") }, + { L"cy", LPGENW("Welsh") }, + { L"wa", LPGENW("Walloon") }, + { L"wo", LPGENW("Wolof") }, + { L"xh", LPGENW("Xhosa") }, + { L"yi", LPGENW("Yiddish") }, + { L"yo", LPGENW("Yoruba") }, + { L"za", LPGENW("Zhuang; Chuang") }, + { L"zu", LPGENW("Zulu") }, { NULL, NULL } }; @@ -242,7 +242,7 @@ public: protected: void OnInitDialog() { - TCHAR text[256]; + wchar_t text[256]; mir_sntprintf(text, STR_FORMAT, TranslateT("Register"), m_regInfo->username, m_regInfo->server, m_regInfo->port); SetDlgItemText(m_hwnd, IDC_REG_STATUS, text); } @@ -251,10 +251,10 @@ protected: { switch (msg) { case WM_JABBER_REGDLG_UPDATE: // wParam=progress (0-100), lparam=status string - if ((TCHAR*)lParam == NULL) + if ((wchar_t*)lParam == NULL) SetDlgItemText(m_hwnd, IDC_REG_STATUS, TranslateT("No message")); else - SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam); + SetDlgItemText(m_hwnd, IDC_REG_STATUS, (wchar_t*)lParam); SendDlgItemMessage(m_hwnd, IDC_PROGRESS_REG, PBM_SETPOS, wParam, 0); if (wParam >= 100) @@ -425,7 +425,7 @@ protected: SendDlgItemMessage(m_hwnd, IDC_PRIORITY_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(127, -128)); - TCHAR *passw = m_proto->getTStringA(NULL, "Password"); + wchar_t *passw = m_proto->getTStringA(NULL, "Password"); if (passw) { m_txtPassword.SetText(passw); mir_free(passw); @@ -434,12 +434,12 @@ protected: m_cbServer.AddString(TranslateT("Loading...")); // fill predefined resources - TCHAR *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" }; + wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" }; for (int i = 0; i < _countof(szResources); i++) m_cbResource.AddString(szResources[i]); // append computer name to the resource list - TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1]; + wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH; if (GetComputerName(szCompName, &dwCompNameLength)) m_cbResource.AddString(szCompName); @@ -489,7 +489,7 @@ protected: int index = m_cbLocale.GetCurSel(); if (index >= 0) { - TCHAR *szLanguageCode = (TCHAR *)m_cbLocale.GetItemData(index); + wchar_t *szLanguageCode = (wchar_t *)m_cbLocale.GetItemData(index); if (szLanguageCode) { m_proto->setTString("XmlLang", szLanguageCode); @@ -615,7 +615,7 @@ private: m_cbResource.Enable(chk->GetState() != BST_CHECKED); if (chk->GetState() == BST_CHECKED) { - TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1]; + wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH; if (GetComputerName(szCompName, &dwCompNameLength)) m_cbResource.SetText(szCompName); @@ -686,7 +686,7 @@ private: { m_gotservers = node != NULL; - TCHAR *server = m_cbServer.GetText(); + wchar_t *server = m_cbServer.GetText(); bool bDropdown = m_cbServer.GetDroppedState(); if (bDropdown) m_cbServer.ShowDropdown(false); @@ -698,7 +698,7 @@ private: break; if (!mir_tstrcmp(XmlGetName(n), L"item")) - if (const TCHAR *jid = XmlGetAttrValue(n, L"jid")) + if (const wchar_t *jid = XmlGetAttrValue(n, L"jid")) if (m_cbServer.FindString(jid, -1, true) == CB_ERR) m_cbServer.AddString(jid); } @@ -729,7 +729,7 @@ private: NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request); if (result) { if (result->resultCode == 200 && result->dataLength && result->pData) { - TCHAR *buf = mir_a2t(result->pData); + wchar_t *buf = mir_a2t(result->pData); XmlNode node(buf, NULL, NULL); if (node) { HXML queryNode = XmlGetChild(node, L"query"); @@ -783,34 +783,34 @@ public: m_chkDirectManual.OnChange = Callback(this, &CDlgOptAdvanced::chkDirect_OnChange); m_chkProxy.OnChange = Callback(this, &CDlgOptAdvanced::chkProxy_OnChange); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Send messages slower, but with full acknowledgment"), m_proto->m_options.MsgAck); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable avatars"), m_proto->m_options.EnableAvatars); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log chat state changes"), m_proto->m_options.LogChatstates); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log presence subscription state changes"), m_proto->m_options.LogPresence); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Log presence errors"), m_proto->m_options.LogPresenceErrors); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user moods receiving"), m_proto->m_options.EnableUserMood); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user tunes receiving"), m_proto->m_options.EnableUserTune); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable user activity receiving"), m_proto->m_options.EnableUserActivity); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Receive notes"), m_proto->m_options.AcceptNotes); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Automatically save received notes"), m_proto->m_options.AutosaveNotes); - m_otvOptions.AddOption(LPGENT("Messaging") L"/" LPGENT("Enable server-side history"), m_proto->m_options.EnableMsgArchive); - - m_otvOptions.AddOption(LPGENT("Server options") L"/" LPGENT("Disable SASL authentication (for old servers)"), m_proto->m_options.Disable3920auth); - m_otvOptions.AddOption(LPGENT("Server options") L"/" LPGENT("Enable stream compression (if possible)"), m_proto->m_options.EnableZlib); - - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Enable remote controlling (from another resource of same JID only)"), m_proto->m_options.EnableRemoteControl); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Show transport agents on contact list"), m_proto->m_options.ShowTransport); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Automatically add contact when accept authorization"), m_proto->m_options.AutoAdd); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Automatically accept authorization requests"), m_proto->m_options.AutoAcceptAuthorization); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Fix incorrect timestamps in incoming messages"), m_proto->m_options.FixIncorrectTimestamps); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Disable frame"), m_proto->m_options.DisableFrame); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_options.ProcessXMPPLinks); - m_otvOptions.AddOption(LPGENT("Other") L"/" LPGENT("Keep contacts assigned to local groups (ignore roster group)"), m_proto->m_options.IgnoreRosterGroups); - - m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Allow servers to request version (XEP-0092)"), m_proto->m_options.AllowVersionRequests); - m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Show information about operating system in version replies"), m_proto->m_options.ShowOSVersion); - m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_options.BsOnlyIBB); - m_otvOptions.AddOption(LPGENT("Security") L"/" LPGENT("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_options.AcceptHttpAuth); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Send messages slower, but with full acknowledgment"), m_proto->m_options.MsgAck); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable avatars"), m_proto->m_options.EnableAvatars); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log chat state changes"), m_proto->m_options.LogChatstates); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence subscription state changes"), m_proto->m_options.LogPresence); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence errors"), m_proto->m_options.LogPresenceErrors); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user moods receiving"), m_proto->m_options.EnableUserMood); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user tunes receiving"), m_proto->m_options.EnableUserTune); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user activity receiving"), m_proto->m_options.EnableUserActivity); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_options.AcceptNotes); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_options.AutosaveNotes); + m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history"), m_proto->m_options.EnableMsgArchive); + + m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_options.Disable3920auth); + m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Enable stream compression (if possible)"), m_proto->m_options.EnableZlib); + + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable remote controlling (from another resource of same JID only)"), m_proto->m_options.EnableRemoteControl); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Show transport agents on contact list"), m_proto->m_options.ShowTransport); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically add contact when accept authorization"), m_proto->m_options.AutoAdd); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically accept authorization requests"), m_proto->m_options.AutoAcceptAuthorization); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_options.FixIncorrectTimestamps); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Disable frame"), m_proto->m_options.DisableFrame); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_options.ProcessXMPPLinks); + m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Keep contacts assigned to local groups (ignore roster group)"), m_proto->m_options.IgnoreRosterGroups); + + m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Allow servers to request version (XEP-0092)"), m_proto->m_options.AllowVersionRequests); + m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Show information about operating system in version replies"), m_proto->m_options.ShowOSVersion); + m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_options.BsOnlyIBB); + m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_options.AcceptHttpAuth); } void OnInitDialog() @@ -833,7 +833,7 @@ public: { JABBER_LIST_ITEM *item = m_proto->ListGetItemPtrFromIndex(index); if (item != NULL) { - if (_tcschr(item->jid, '@') == NULL) { + if (wcschr(item->jid, '@') == NULL) { MCONTACT hContact = m_proto->HContactFromJID(item->jid); if (hContact != NULL) { if (bChecked) { @@ -900,17 +900,17 @@ public: CreateLink(m_txtSlap, "GcMsgSlap", TranslateTS(JABBER_GC_MSG_SLAP)); CreateLink(m_txtQuit, "GcMsgQuit", TranslateTS(JABBER_GC_MSG_QUIT)); - m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Autoaccept multiuser chat invitations"), m_proto->m_options.AutoAcceptMUC); - m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Automatically join bookmarks on login"), m_proto->m_options.AutoJoinBookmarks); - m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Automatically join conferences on login"), m_proto->m_options.AutoJoinConferences); - m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Hide conference windows at startup"), m_proto->m_options.AutoJoinHidden); - m_otvOptions.AddOption(LPGENT("General") L"/" LPGENT("Do not show multiuser chat invitations"), m_proto->m_options.IgnoreMUCInvites); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Ban notifications"), m_proto->m_options.GcLogBans); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Room configuration changes"), m_proto->m_options.GcLogConfig); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Affiliation changes"), m_proto->m_options.GcLogAffiliations); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Role changes"), m_proto->m_options.GcLogRoles); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Status changes"), m_proto->m_options.GcLogStatuses); - m_otvOptions.AddOption(LPGENT("Log events") L"/" LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory); + m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_options.AutoAcceptMUC); + m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join bookmarks on login"), m_proto->m_options.AutoJoinBookmarks); + m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join conferences on login"), m_proto->m_options.AutoJoinConferences); + m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Hide conference windows at startup"), m_proto->m_options.AutoJoinHidden); + m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Do not show multiuser chat invitations"), m_proto->m_options.IgnoreMUCInvites); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Ban notifications"), m_proto->m_options.GcLogBans); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Room configuration changes"), m_proto->m_options.GcLogConfig); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Affiliation changes"), m_proto->m_options.GcLogAffiliations); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Role changes"), m_proto->m_options.GcLogRoles); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Status changes"), m_proto->m_options.GcLogStatuses); + m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Don't notify history messages"), m_proto->m_options.GcLogChatHistory); } }; @@ -936,12 +936,12 @@ struct ROSTEREDITDAT int subindex; }; -static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * nick, const TCHAR * group, const TCHAR * subscr, BOOL bChecked) +static int _RosterInsertListItem(HWND hList, const wchar_t * jid, const wchar_t * nick, const wchar_t * group, const wchar_t * subscr, BOOL bChecked) { LVITEM item = { 0 }; item.mask = LVIF_TEXT | LVIF_STATE; item.iItem = ListView_GetItemCount(hList); - item.pszText = (TCHAR*)jid; + item.pszText = (wchar_t*)jid; int index = ListView_InsertItem(hList, &item); if (index < 0) @@ -949,9 +949,9 @@ static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * ni ListView_SetCheckState(hList, index, bChecked); - ListView_SetItemText(hList, index, 0, (TCHAR*)jid); - ListView_SetItemText(hList, index, 1, (TCHAR*)nick); - ListView_SetItemText(hList, index, 2, (TCHAR*)group); + ListView_SetItemText(hList, index, 0, (wchar_t*)jid); + ListView_SetItemText(hList, index, 1, (wchar_t*)nick); + ListView_SetItemText(hList, index, 2, (wchar_t*)group); ListView_SetItemText(hList, index, 3, TranslateTS(subscr)); return index; } @@ -1004,13 +1004,13 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) if (item == NULL) break; - const TCHAR *jid = XmlGetAttrValue(item, L"jid"); + const wchar_t *jid = XmlGetAttrValue(item, L"jid"); if (jid == NULL) continue; - const TCHAR *name = XmlGetAttrValue(item, L"name"); - const TCHAR *subscription = XmlGetAttrValue(item, L"subscription"); - const TCHAR *group = XmlGetText(XmlGetChild(item, "group")); + const wchar_t *name = XmlGetAttrValue(item, L"name"); + const wchar_t *subscription = XmlGetAttrValue(item, L"subscription"); + const wchar_t *group = XmlGetText(XmlGetChild(item, "group")); _RosterInsertListItem(hList, jid, name, group, subscription, TRUE); } @@ -1023,9 +1023,9 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) LVFINDINFO lvfi = { 0 }; lvfi.flags = LVFI_STRING; lvfi.psz = tszJid; - TCHAR *p = _tcschr(tszJid, _T('@')); + wchar_t *p = wcschr(tszJid, '@'); if (p) { - p = _tcschr(tszJid, _T('/')); + p = wcschr(tszJid, '/'); if (p) *p = 0; } if (ListView_FindItem(hList, -1, &lvfi) == -1) { @@ -1055,10 +1055,10 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) int itemCount = 0; int ListItemCount = ListView_GetItemCount(hList); for (int index = 0; index < ListItemCount; index++) { - TCHAR jid[JABBER_MAX_JID_LEN] = L""; - TCHAR name[260] = L""; - TCHAR group[260] = L""; - TCHAR subscr[260] = L""; + wchar_t jid[JABBER_MAX_JID_LEN] = L""; + wchar_t name[260] = L""; + wchar_t group[260] = L""; + wchar_t subscr[260] = L""; ListView_GetItemText(hList, index, 0, jid, _countof(jid)); ListView_GetItemText(hList, index, 1, name, _countof(name)); ListView_GetItemText(hList, index, 2, group, _countof(group)); @@ -1073,7 +1073,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) else if (!bRemove) { BOOL bPushed = itemRoster ? TRUE : FALSE; if (!bPushed) { - const TCHAR *rosterName = XmlGetAttrValue(itemRoster, L"name"); + const wchar_t *rosterName = XmlGetAttrValue(itemRoster, L"name"); if ((rosterName != NULL || name[0] != 0) && mir_tstrcmpi(rosterName, name)) bPushed = TRUE; if (!bPushed) { @@ -1082,7 +1082,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) bPushed = TRUE; } if (!bPushed) { - const TCHAR *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group")); + const wchar_t *rosterGroup = XmlGetText(XmlGetChild(itemRoster, "group")); if ((rosterGroup != NULL || group[0] != 0) && mir_tstrcmpi(rosterGroup, group)) bPushed = TRUE; } @@ -1127,7 +1127,7 @@ static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel) { if (!bCancel) { int len = GetWindowTextLength(hEditor) + 1; - TCHAR *buff = (TCHAR*)mir_alloc(len*sizeof(TCHAR)); + wchar_t *buff = (wchar_t*)mir_alloc(len*sizeof(wchar_t)); if (buff) { GetWindowText(hEditor, buff, len); ListView_SetItemText(edat->hList, edat->index, edat->subindex, buff); @@ -1176,9 +1176,9 @@ static LRESULT CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wP void CJabberProto::_RosterExportToFile(HWND hwndDlg) { - TCHAR filename[MAX_PATH] = { 0 }; + wchar_t filename[MAX_PATH] = { 0 }; - TCHAR filter[MAX_PATH]; + wchar_t filter[MAX_PATH]; mir_sntprintf(filter, L"%s (*.xml)%c*.xml%c%c", TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0); OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; @@ -1209,10 +1209,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) << XCHILD(L"Table"); for (int index = 0; index < ListItemCount; index++) { - TCHAR jid[JABBER_MAX_JID_LEN] = L""; - TCHAR name[260] = L""; - TCHAR group[260] = L""; - TCHAR subscr[260] = L""; + wchar_t jid[JABBER_MAX_JID_LEN] = L""; + wchar_t name[260] = L""; + wchar_t group[260] = L""; + wchar_t subscr[260] = L""; ListView_GetItemText(hList, index, 0, jid, _countof(jid)); ListView_GetItemText(hList, index, 1, name, _countof(name)); ListView_GetItemText(hList, index, 2, group, _countof(group)); @@ -1230,7 +1230,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) char header[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?mso-application progid=\"Excel.Sheet\"?>\n"; fwrite(header, 1, sizeof(header) - 1 /* for zero terminator */, fp); - TCHAR *xtmp = xmlToString(root, NULL); + wchar_t *xtmp = xmlToString(root, NULL); fputs(T2Utf(xtmp), fp); xmlFree(xtmp); fclose(fp); @@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) fclose(fp); _RosterListClear(hwndDlg); - TCHAR *newBuf = mir_utf8decodeT(buffer); + wchar_t *newBuf = mir_utf8decodeT(buffer); mir_free(buffer); int nBytesProcessed = 0; @@ -1288,10 +1288,10 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) break; BOOL bAdd = FALSE; - const TCHAR *jid = NULL; - const TCHAR *name = NULL; - const TCHAR *group = NULL; - const TCHAR *subscr = NULL; + const wchar_t *jid = NULL; + const wchar_t *name = NULL; + const wchar_t *group = NULL; + const wchar_t *subscr = NULL; HXML Cell = XmlGetNthChild(Row, L"Cell", 1); HXML Data = (Cell) ? XmlGetChild(Cell, "Data") : XmlNode(); if (Data) { @@ -1347,7 +1347,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, ListView_SubItemHitTest(hList, &lvhti); if (lvhti.flags&LVHT_ONITEM && lvhti.iSubItem != 0) { RECT rc; - TCHAR buff[260]; + wchar_t buff[260]; ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS, &rc); ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff)); HWND hEditor = CreateWindow(TEXT("EDIT"), buff, WS_CHILD | ES_AUTOHSCROLL, rc.left + 3, rc.top + 2, rc.right - rc.left - 3, rc.bottom - rc.top - 3, hList, NULL, hInst, NULL); @@ -1490,19 +1490,19 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRosterControl(WPARAM, LPARAM) int CJabberProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.ptszGroup = LPGENT("Network"); - odp.ptszTitle = m_tszUserName; + odp.pwszGroup = LPGENW("Network"); + odp.pwszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_DONTTRANSLATE; - odp.ptszTab = LPGENT("Account"); + odp.pwszTab = LPGENW("Account"); odp.pDialog = new CDlgOptAccount(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Conferences"); + odp.pwszTab = LPGENW("Conferences"); odp.pDialog = new CDlgOptGc(this); Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.pwszTab = LPGENW("Advanced"); odp.pDialog = new CDlgOptAdvanced(this); Options_AddPage(wParam, &odp); return 0; @@ -1569,7 +1569,7 @@ protected: m_gotservers = false; - TCHAR *passw = m_proto->getTStringA(NULL, "Password"); + wchar_t *passw = m_proto->getTStringA(NULL, "Password"); if (passw) { m_txtPassword.SetText(passw); mir_free(passw); @@ -1578,12 +1578,12 @@ protected: m_cbServer.AddString(TranslateT("Loading...")); // fill predefined resources - TCHAR *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" }; + wchar_t *szResources[] = { L"Home", L"Work", L"Office", L"Miranda" }; for (int i = 0; i < _countof(szResources); i++) m_cbResource.AddString(szResources[i]); // append computer name to the resource list - TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1]; + wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH; if (GetComputerName(szCompName, &dwCompNameLength)) m_cbResource.AddString(szCompName); @@ -1704,7 +1704,7 @@ protected: m_proto->m_savedPassword = NULL; BOOL bUseHostnameAsResource = FALSE; - TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1]; + wchar_t szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1]; DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH; if (GetComputerName(szCompName, &dwCompNameLength)) { m_cbResource.GetText(szResource, _countof(szResource)); @@ -1714,7 +1714,7 @@ protected: m_proto->m_options.HostNameAsResource = bUseHostnameAsResource; if (m_chkSavePassword.GetState() == BST_CHECKED) { - TCHAR *text = m_txtPassword.GetText(); + wchar_t *text = m_txtPassword.GetText(); m_proto->setTString("Password", text); mir_free(text); } @@ -2160,7 +2160,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) { m_gotservers = node != NULL; - TCHAR *server = m_cbServer.GetText(); + wchar_t *server = m_cbServer.GetText(); bool bDropdown = m_cbServer.GetDroppedState(); if (bDropdown) m_cbServer.ShowDropdown(false); @@ -2172,7 +2172,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) break; if (!mir_tstrcmp(XmlGetName(n), L"item")) - if (const TCHAR *jid = XmlGetAttrValue(n, L"jid")) + if (const wchar_t *jid = XmlGetAttrValue(n, L"jid")) if (m_cbServer.FindString(jid, -1, true) == CB_ERR) m_cbServer.AddString(jid); } @@ -2199,7 +2199,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request); if (result && IsWindow(hwnd)) { if ((result->resultCode == 200) && result->dataLength && result->pData) { - TCHAR *ptszText = mir_a2t(result->pData); + wchar_t *ptszText = mir_a2t(result->pData); XmlNode node(ptszText, NULL, NULL); if (node) { HXML queryNode = XmlGetChild(node, L"query"); diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index bf3e791698..e1b800afa2 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -41,7 +41,7 @@ CCtrlTreeOpts::~CCtrlTreeOpts() delete m_options[i]; } -void CCtrlTreeOpts::AddOption(TCHAR *szOption, CMOption<BYTE> &option) +void CCtrlTreeOpts::AddOption(wchar_t *szOption, CMOption<BYTE> &option) { m_options.insert(new COptionsItem(szOption, option), m_options.getCount()); } @@ -90,7 +90,7 @@ void CCtrlTreeOpts::OnInit() { CCtrlTreeView::OnInit(); - TCHAR itemName[1024]; + wchar_t itemName[1024]; HIMAGELIST hImgLst; SelectItem(NULL); @@ -108,7 +108,7 @@ void CCtrlTreeOpts::OnInit() /* build options tree. based on code from IcoLib */ for (int i = 0; i < m_options.getCount(); i++) { - TCHAR *sectionName; + wchar_t *sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL; @@ -117,10 +117,10 @@ void CCtrlTreeOpts::OnInit() while (sectionName) { // allow multi-level tree - TCHAR *pItemName = sectionName; + wchar_t *pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) { + if (sectionName = wcschr(sectionName, '/')) { // one level deeper *sectionName = 0; sectionName++; @@ -225,7 +225,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) SetItem(&tvi); } -CCtrlTreeOpts::COptionsItem::COptionsItem(TCHAR *szOption, CMOption<BYTE> &option) : +CCtrlTreeOpts::COptionsItem::COptionsItem(wchar_t *szOption, CMOption<BYTE> &option) : m_option(&option), m_groupId(OPTTREE_CHECK), m_hItem(NULL) { m_szOptionName = mir_tstrdup(szOption); diff --git a/protocols/JabberG/src/jabber_opttree.h b/protocols/JabberG/src/jabber_opttree.h index 5949b8acc5..66e33b4a3d 100644 --- a/protocols/JabberG/src/jabber_opttree.h +++ b/protocols/JabberG/src/jabber_opttree.h @@ -37,7 +37,7 @@ public: CCtrlTreeOpts(CDlgBase* dlg, int ctrlId); ~CCtrlTreeOpts(); - void AddOption(TCHAR *szOption, CMOption<BYTE> &option); + void AddOption(wchar_t *szOption, CMOption<BYTE> &option); BOOL OnNotify(int idCtrl, NMHDR *pnmh); void OnDestroy(); @@ -47,14 +47,14 @@ public: protected: struct COptionsItem { - TCHAR *m_szOptionName; + wchar_t *m_szOptionName; int m_groupId; CMOption<BYTE> *m_option; HTREEITEM m_hItem; - COptionsItem(TCHAR *szOption, CMOption<BYTE> &option); + COptionsItem(wchar_t *szOption, CMOption<BYTE> &option); ~COptionsItem(); }; diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index f81d00a074..54d1b74bdd 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -49,7 +49,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR Window_SetIcon_IcoLib(hwndDlg, g_GetIconHandle(IDI_KEYS)); TranslateDialogDefault(hwndDlg); if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) { - TCHAR text[1024]; + wchar_t text[1024]; mir_sntprintf(text, TranslateT("Set New Password for %s@%S"), ppro->m_ThreadInfo->conn.username, ppro->m_ThreadInfo->conn.server); SetWindowText(hwndDlg, text); } @@ -58,7 +58,7 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR switch (LOWORD(wParam)) { case IDOK: if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) { - TCHAR newPasswd[512], text[512]; + wchar_t newPasswd[512], text[512]; GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd)); GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text)); if (mir_tstrcmp(newPasswd, text)) { diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 4e0fac80ed..ba3df4a5b0 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_iq.h" #include "jabber_privacy.h" -#define JABBER_PL_BUSY_MSG LPGEN("Sending request, please wait...") +const wchar_t JABBER_PL_BUSY_MSG[] = LPGENW("Sending request, please wait..."); BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo *pInfo) { @@ -56,7 +56,7 @@ void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo) InterlockedDecrement(&pParam->m_dwCount); if (!pParam->m_dwCount) { - TCHAR szText[ 512 ]; + wchar_t szText[ 512 ]; if (!pParam->m_bAllOk) mir_sntprintf(szText, TranslateT("Error occurred while applying changes")); else @@ -73,7 +73,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) if (iqNode == NULL) return; - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; @@ -86,7 +86,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) HXML list = XmlGetChild(query, "list"); if (list == NULL) return; - TCHAR *szListName = (TCHAR*)XmlGetAttrValue(list, L"name"); + wchar_t *szListName = (wchar_t*)XmlGetAttrValue(list, L"name"); if (!szListName) return; @@ -101,7 +101,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) HXML item; for (int i = 1; (item = XmlGetNthChild(list, L"item", i)) != NULL; i++) { - const TCHAR *itemType = XmlGetAttrValue(item, L"type"); + const wchar_t *itemType = XmlGetAttrValue(item, L"type"); PrivacyListRuleType nItemType = Else; if (itemType) { if (!mir_tstrcmpi(itemType, L"jid")) @@ -112,17 +112,17 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*) nItemType = Subscription; } - const TCHAR *itemValue = XmlGetAttrValue(item, L"value"); + const wchar_t *itemValue = XmlGetAttrValue(item, L"value"); - const TCHAR *itemAction = XmlGetAttrValue(item, L"action"); + const wchar_t *itemAction = XmlGetAttrValue(item, L"action"); BOOL bAllow = TRUE; if (itemAction && !mir_tstrcmpi(itemAction, L"deny")) bAllow = FALSE; - const TCHAR *itemOrder = XmlGetAttrValue(item, L"order"); + const wchar_t *itemOrder = XmlGetAttrValue(item, L"order"); DWORD dwOrder = 0; if (itemOrder) - dwOrder = _ttoi(itemOrder); + dwOrder = _wtoi(itemOrder); DWORD dwPackets = 0; if (XmlGetChild(item , "message")) @@ -179,7 +179,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo if (iqNode == NULL) return; - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; @@ -214,11 +214,11 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInf if (iqNode == NULL) return; - const TCHAR *type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == NULL) return; - TCHAR szText[ 512 ]; + wchar_t szText[ 512 ]; szText[0] = 0; { mir_cslock lck(m_privacyListManager.m_cs); @@ -262,9 +262,9 @@ void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo) if (list == NULL) break; - const TCHAR *listName = XmlGetAttrValue(list, L"name"); + const wchar_t *listName = XmlGetAttrValue(list, L"name"); if (listName) { - m_privacyListManager.AddList((TCHAR*)listName); + m_privacyListManager.AddList((wchar_t*)listName); // Query contents only if list editior is visible! if (m_pDlgPrivacyLists) @@ -274,7 +274,7 @@ void CJabberProto::OnIqResultPrivacyLists(HXML iqNode, CJabberIqInfo *pInfo) } } - const TCHAR *szName = NULL; + const wchar_t *szName = NULL; HXML node = XmlGetChild(query , "active"); if (node) szName = XmlGetAttrValue(node, L"name"); @@ -298,7 +298,7 @@ class CJabberDlgPrivacyAddList: public CJabberDlgBase typedef CJabberDlgBase CSuper; public: - TCHAR szLine[512]; + wchar_t szLine[512]; CJabberDlgPrivacyAddList(CJabberProto *proto, HWND hwndParent): CJabberDlgBase(proto, IDD_PRIVACY_ADD_LIST, false), @@ -367,7 +367,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEIN, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prin_allow"), 0); SendDlgItemMessage(m_hwnd, IDC_ICO_PRESENCEOUT, STM_SETICON, (WPARAM)m_proto->LoadIconEx("pl_prout_allow"), 0); - TCHAR *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" }; + wchar_t *szTypes[] = { L"JID", L"Group", L"Subscription", L"Any" }; int i, nTypes[] = { Jid, Group, Subscription, Else }; for (i=0; i < _countof(szTypes); i++) { LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i])); @@ -377,7 +377,7 @@ public: } SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0); - TCHAR *szSubscriptions[] = { L"none", L"from", L"to", L"both" }; + wchar_t *szSubscriptions[] = { L"none", L"from", L"to", L"both" }; for (i=0; i < _countof(szSubscriptions); i++) { LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i])); SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]); @@ -452,7 +452,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0); { - TCHAR *grpName; + wchar_t *grpName; for (int i=1; (grpName = Clist_GroupGetName(i, NULL)) != NULL; i++) SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)grpName); } @@ -496,7 +496,7 @@ public: case Jid: case Group: { - TCHAR szText[ 512 ]; + wchar_t szText[ 512 ]; GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, _countof(szText)); m_pRule->SetValue(szText); } @@ -505,7 +505,7 @@ public: case Subscription: nCurSel = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETCURSEL, 0, 0); if (nCurSel != CB_ERR) - m_pRule->SetValue((TCHAR*)SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETITEMDATA, nCurSel, 0)); + m_pRule->SetValue((wchar_t*)SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_GETITEMDATA, nCurSel, 0)); else m_pRule->SetValue(L"none"); break; @@ -606,7 +606,7 @@ protected: void OnCommand_Close(HWND hwndCtrl, WORD idCtrl, WORD idCode); void ShowAdvancedList(CPrivacyList *pList); - void DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc); + void DrawNextRulePart(HDC hdc, COLORREF color, const wchar_t *text, RECT *rc); void DrawRuleAction(HDC hdc, COLORREF clLine1, COLORREF clLine2, CPrivacyListRule *pRule, RECT *rc); void DrawRulesList(LPDRAWITEMSTRUCT lpdis); void DrawLists(LPDRAWITEMSTRUCT lpdis); @@ -615,7 +615,7 @@ protected: void CListFilter(HWND hwndList); void CListResetIcons(HWND hwndList, HANDLE hItem, bool hide=false); void CListSetupIcons(HWND hwndList, HANDLE hItem, int iSlot, DWORD dwProcess, BOOL bAction); - HANDLE CListAddContact(HWND hwndList, TCHAR *jid); + HANDLE CListAddContact(HWND hwndList, wchar_t *jid); void CListApplyList(HWND hwndList, CPrivacyList *pList = NULL); DWORD CListGetPackets(HWND hwndList, HANDLE hItem, bool bAction); void CListBuildList(HWND hwndList, CPrivacyList *pList); @@ -631,7 +631,7 @@ protected: struct TJidData { HANDLE hItem; - TCHAR *jid; + wchar_t *jid; static int cmp(const TJidData *p1, const TJidData *p2) { return mir_tstrcmp(p1->jid, p2->jid); } }; @@ -657,7 +657,7 @@ protected: } } - void addJid(HANDLE hItem, TCHAR *jid) + void addJid(HANDLE hItem, wchar_t *jid) { TJidData *data = (TJidData *)mir_alloc(sizeof(TJidData)); data->hItem = hItem; @@ -665,7 +665,7 @@ protected: newJids.insert(data); } - HANDLE findJid(TCHAR *jid) + HANDLE findJid(wchar_t *jid) { TJidData data = {0}; data.jid = jid; @@ -866,10 +866,10 @@ void CJabberDlgPrivacyLists::OnDestroy() void CJabberDlgPrivacyLists::OnProtoRefresh(WPARAM, LPARAM) { LRESULT sel = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETCURSEL, 0, 0); - TCHAR *szCurrentSelectedList = NULL; + wchar_t *szCurrentSelectedList = NULL; if (sel != LB_ERR) { LRESULT len = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETTEXTLEN, sel, 0) + 1; - szCurrentSelectedList = (TCHAR *)mir_alloc(len * sizeof(TCHAR)); + szCurrentSelectedList = (wchar_t *)mir_alloc(len * sizeof(wchar_t)); SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_GETTEXT, sel, (LPARAM)szCurrentSelectedList); } @@ -924,16 +924,16 @@ BOOL CJabberDlgPrivacyLists::OnWmMeasureItem(UINT, WPARAM, LPARAM lParam) struct { - TCHAR *textEng; + wchar_t *textEng; char *icon; - TCHAR *text; + wchar_t *text; } static drawItems[] = { - { LPGENT("Message"), "pl_msg_allow" }, - { LPGENT("Presence (in)"), "pl_prin_allow" }, - { LPGENT("Presence (out)"), "pl_prout_allow" }, - { LPGENT("Query"), "pl_iq_allow" } + { LPGENW("Message"), "pl_msg_allow" }, + { LPGENW("Presence (in)"), "pl_prin_allow" }, + { LPGENW("Presence (out)"), "pl_prout_allow" }, + { LPGENW("Query"), "pl_iq_allow" } }; BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) @@ -988,7 +988,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) CPrivacyListRule* pRule = pList->GetFirstRule(); while (pRule) { bListEmpty = FALSE; - TCHAR szTypeValue[ 512 ]; + wchar_t szTypeValue[ 512 ]; switch (pRule->GetType()) { case Jid: mir_sntprintf(szTypeValue, L"If Jabber ID is '%s' then", pRule->GetValue()); @@ -1004,7 +1004,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) break; } - TCHAR szPackets[ 512 ]; + wchar_t szPackets[ 512 ]; szPackets[ 0 ] = '\0'; DWORD dwPackets = pRule->GetPackets(); @@ -1032,7 +1032,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) } } - TCHAR szListItem[ 512 ]; + wchar_t szListItem[ 512 ]; mir_sntprintf(szListItem, L"%s %s %s", szTypeValue, pRule->GetAction() ? L"allow" : L"deny", szPackets); LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem); @@ -1050,7 +1050,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_PL_RULES_LIST, LBN_SELCHANGE), 0); } -void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc) +void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const wchar_t *text, RECT *rc) { SetTextColor(hdc, color); DrawText(hdc, text, -1, rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS); @@ -1134,7 +1134,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis) rc.left += 25; int len = SendDlgItemMessage(m_hwnd, lpdis->CtlID, LB_GETTEXTLEN, lpdis->itemID, 0) + 1; - TCHAR *str = (TCHAR *)_alloca(len * sizeof(TCHAR)); + wchar_t *str = (wchar_t *)_alloca(len * sizeof(wchar_t)); SendDlgItemMessage(m_hwnd, lpdis->CtlID, LB_GETTEXT, lpdis->itemID, (LPARAM)str); DrawNextRulePart(lpdis->hDC, clLine1, str, &rc); } @@ -1158,7 +1158,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis) DrawNextRulePart(lpdis->hDC, clLine2, TranslateT("'"), &rc); if (MCONTACT hContact = m_proto->HContactFromJID(pRule->GetValue())) { - TCHAR *szName = pcli->pfnGetContactDisplayName(hContact, 0); + wchar_t *szName = pcli->pfnGetContactDisplayName(hContact, 0); if (szName) { DrawNextRulePart(lpdis->hDC, clLine2, TranslateT(" (nickname: "), &rc); DrawNextRulePart(lpdis->hDC, clLine1, szName, &rc); @@ -1228,10 +1228,10 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) SetBkMode(lpdis->hDC, TRANSPARENT); - TCHAR *szDefault, *szActive; + wchar_t *szDefault, *szActive; { mir_cslock lck(m_proto->m_privacyListManager.m_cs); - szDefault = NEWTSTR_ALLOCA(m_proto->m_privacyListManager.GetDefaultListName()); - szActive = NEWTSTR_ALLOCA(m_proto->m_privacyListManager.GetActiveListName()); + szDefault = NEWWSTR_ALLOCA(m_proto->m_privacyListManager.GetDefaultListName()); + szActive = NEWWSTR_ALLOCA(m_proto->m_privacyListManager.GetActiveListName()); } RECT rc; @@ -1240,7 +1240,7 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis) bool bActive = false; bool bDefault = false; - TCHAR *szName; + wchar_t *szName; if (!pList) { if (!szActive) bActive = true; @@ -1324,7 +1324,7 @@ void CJabberDlgPrivacyLists::CListSetupIcons(HWND, HANDLE hItem, int iSlot, DWOR m_clcClist.SetExtraImage(hItem, iSlot, iSlot*2 + (bAction?1:2)); } -HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, TCHAR *jid) +HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, wchar_t *jid) { MCONTACT hContact = m_proto->HContactFromJID(jid); if (hContact) @@ -1445,7 +1445,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) DWORD dwPackets = 0; HANDLE hItem; - TCHAR *szJid = NULL; + wchar_t *szJid = NULL; pList->RemoveAllRules(); @@ -1474,7 +1474,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) } // group handles start with 1 (0 is "root") - TCHAR *grpName; + wchar_t *grpName; for (MGROUP iGroup = 1; (grpName = Clist_GroupGetName(iGroup, NULL)) != NULL; iGroup++) { hItem = m_clcClist.FindGroup(iGroup); if (dwPackets = CListGetPackets(hwndList, hItem, true)) @@ -1635,7 +1635,7 @@ void CJabberDlgPrivacyLists::btnAdvanced_OnClick(CCtrlButton *) void CJabberDlgPrivacyLists::btnAddJid_OnClick(CCtrlButton *) { int len = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_NEWJID))+1; - TCHAR *buf = (TCHAR *)_alloca(sizeof(TCHAR) * len); + wchar_t *buf = (wchar_t *)_alloca(sizeof(wchar_t) * len); GetDlgItemText(m_hwnd, IDC_NEWJID, buf, len); SetDlgItemText(m_hwnd, IDC_NEWJID, L""); CListAddContact(GetDlgItem(m_hwnd, IDC_CLIST), buf); @@ -1663,7 +1663,7 @@ void CJabberDlgPrivacyLists::btnActivate_OnClick(CCtrlButton *) active << XATTR(L"name", pList->GetListName()); lck.unlock(); - SetStatusText(TranslateT(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); m_proto->m_ThreadInfo->send(iq); } @@ -1690,7 +1690,7 @@ void CJabberDlgPrivacyLists::btnSetDefault_OnClick(CCtrlButton *) XmlAddAttr(defaultTag, L"name", pList->GetListName()); lck.unlock(); - SetStatusText(TranslateT(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); m_proto->m_ThreadInfo->send(iq); } @@ -1869,7 +1869,7 @@ void CJabberDlgPrivacyLists::btnRemoveList_OnClick(CCtrlButton *) CPrivacyList *pList = GetSelectedList(m_hwnd); if (pList) { - TCHAR *szListName = pList->GetListName(); + wchar_t *szListName = pList->GetListName(); if ((m_proto->m_privacyListManager.GetActiveListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetActiveListName())) || (m_proto->m_privacyListManager.GetDefaultListName() && !mir_tstrcmp(szListName, m_proto->m_privacyListManager.GetDefaultListName()))) { @@ -1958,7 +1958,7 @@ void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *) pList = pList->GetNext(); } } - SetStatusText(TranslateT(JABBER_PL_BUSY_MSG)); + SetStatusText(TranslateTS(JABBER_PL_BUSY_MSG)); PostMessage(m_hwnd, WM_JABBER_REFRESH, 0, 0); } @@ -2103,7 +2103,7 @@ void CJabberProto::BuildPrivacyMenu() mi.position = 3000040000; mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR; mi.hIcolibItem = GetIconHandle(IDI_PRIVACY_LISTS); - mi.name.t = LPGENT("List Editor..."); + mi.name.w = LPGENW("List Editor..."); mi.root = m_hPrivacyMenuRoot; Menu_AddProtoMenuItem(&mi, m_szModuleName); } @@ -2134,7 +2134,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) } mi.position++; mi.hIcolibItem = Skin_GetIconHandle(m_privacyListManager.GetActiveListName() ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB); - mi.name.t = LPGENT("<none>"); + mi.name.w = LPGENW("<none>"); m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName)); for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) { @@ -2149,7 +2149,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.position++; mi.hIcolibItem = Skin_GetIconHandle( mir_tstrcmp(m_privacyListManager.GetActiveListName(), pList->GetListName()) ? SKINICON_OTHER_SMALLDOT : SKINICON_OTHER_EMPTYBLOB); - mi.name.t = pList->GetListName(); + mi.name.w = pList->GetListName(); m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi, m_szModuleName)); } } diff --git a/protocols/JabberG/src/jabber_privacy.h b/protocols/JabberG/src/jabber_privacy.h index 6f48cebd11..67b8ce7e33 100644 --- a/protocols/JabberG/src/jabber_privacy.h +++ b/protocols/JabberG/src/jabber_privacy.h @@ -58,7 +58,7 @@ class CPrivacyListRule protected: friend class CPrivacyList; public: - CPrivacyListRule(CJabberProto *ppro, PrivacyListRuleType type = Else, const TCHAR *szValue = L"", BOOL bAction = TRUE, DWORD dwOrder = 90, DWORD dwPackets = 0) + CPrivacyListRule(CJabberProto *ppro, PrivacyListRuleType type = Else, const wchar_t *szValue = L"", BOOL bAction = TRUE, DWORD dwOrder = 90, DWORD dwPackets = 0) { m_proto = ppro; m_szValue = mir_tstrdup(szValue); @@ -103,11 +103,11 @@ public: m_nType = type; return TRUE; } - __inline TCHAR* GetValue() + __inline wchar_t* GetValue() { return m_szValue; } - __inline BOOL SetValue(TCHAR *szValue) + __inline BOOL SetValue(wchar_t *szValue) { replaceStrT(m_szValue, szValue); return TRUE; @@ -133,7 +133,7 @@ public: CJabberProto* m_proto; protected: PrivacyListRuleType m_nType; - TCHAR *m_szValue; + wchar_t *m_szValue; BOOL m_bAction; DWORD m_dwOrder; DWORD m_dwPackets; @@ -145,7 +145,7 @@ class CPrivacyList { protected: CPrivacyListRule *m_pRules; - TCHAR *m_szListName; + wchar_t *m_szListName; CPrivacyList *m_pNext; BOOL m_bLoaded; BOOL m_bModified; @@ -153,7 +153,7 @@ protected: public: CJabberProto* m_proto; - CPrivacyList(CJabberProto *ppro, TCHAR *szListName) + CPrivacyList(CJabberProto *ppro, wchar_t *szListName) { m_proto = ppro; m_szListName = mir_tstrdup(szListName); @@ -177,7 +177,7 @@ public: m_pRules = NULL; return TRUE; } - __inline TCHAR* GetListName() + __inline wchar_t* GetListName() { return m_szListName; } @@ -195,7 +195,7 @@ public: m_pNext = pNext; return pRetVal; } - BOOL AddRule(PrivacyListRuleType type, const TCHAR *szValue, BOOL bAction, DWORD dwOrder, DWORD dwPackets) + BOOL AddRule(PrivacyListRuleType type, const wchar_t *szValue, BOOL bAction, DWORD dwOrder, DWORD dwPackets) { CPrivacyListRule *pRule = new CPrivacyListRule(m_proto, type, szValue, bAction, dwOrder, dwPackets); if (!pRule) @@ -319,8 +319,8 @@ public: class CPrivacyListManager { protected: - TCHAR *m_szActiveListName; - TCHAR *m_szDefaultListName; + wchar_t *m_szActiveListName; + wchar_t *m_szDefaultListName; CPrivacyList *m_pLists; BOOL m_bModified; @@ -342,19 +342,19 @@ public: mir_free(m_szDefaultListName); RemoveAllLists(); }; - void SetActiveListName(const TCHAR *szListName) + void SetActiveListName(const wchar_t *szListName) { replaceStrT(m_szActiveListName, szListName); } - void SetDefaultListName(const TCHAR *szListName) + void SetDefaultListName(const wchar_t *szListName) { replaceStrT(m_szDefaultListName, szListName); } - TCHAR* GetDefaultListName() + wchar_t* GetDefaultListName() { return m_szDefaultListName; } - TCHAR* GetActiveListName() + wchar_t* GetActiveListName() { return m_szActiveListName; } @@ -365,7 +365,7 @@ public: m_pLists = NULL; return TRUE; } - CPrivacyList* FindList(const TCHAR *szListName) + CPrivacyList* FindList(const wchar_t *szListName) { CPrivacyList *pList = m_pLists; while (pList) { @@ -379,7 +379,7 @@ public: { return m_pLists; } - BOOL AddList(TCHAR *szListName) + BOOL AddList(wchar_t *szListName) { if (FindList(szListName)) return FALSE; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 96bbe0c424..2f847dd408 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(disable:4355) -static int compareTransports(const TCHAR *p1, const TCHAR *p2) +static int compareTransports(const wchar_t *p1, const wchar_t *p2) { return mir_tstrcmpi(p1, p2); } @@ -46,13 +46,13 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * || (p1->list == LIST_BOOKMARK) || (p1->list == LIST_VCARD_TEMP)) return mir_tstrcmpi(p1->jid, p2->jid); - TCHAR szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN]; + wchar_t szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN]; JabberStripJid(p1->jid, szp1, _countof(szp1)); JabberStripJid(p2->jid, szp2, _countof(szp2)); return mir_tstrcmpi(szp1, szp2); } -CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) : +CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : PROTO<CJabberProto>(aProtoName, aUserName), m_options(this), m_lstTransports(50, compareTransports), @@ -246,7 +246,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) if (jid == NULL) continue; - TCHAR *resourcepos = _tcschr(jid, '/'); + wchar_t *resourcepos = wcschr(jid, '/'); if (resourcepos != NULL) *resourcepos = '\0'; @@ -295,7 +295,7 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) //////////////////////////////////////////////////////////////////////////////////////// // JabberAddToList - adds a contact to the contact list -MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) +MCONTACT CJabberProto::AddToListByJID(const wchar_t *newJid, DWORD flags) { debugLog(L"AddToListByJID jid = %s", newJid); @@ -308,10 +308,10 @@ MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) MCONTACT CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr) { - if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id.t == NULL) + if (psr->cbSize != sizeof(PROTOSEARCHRESULT) && psr->id.w == NULL) return NULL; - return AddToListByJID(psr->id.t, flags); + return AddToListByJID(psr->id.w, flags); } MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbEvent) @@ -340,7 +340,7 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEV char *lastName = firstName + mir_strlen(firstName) + 1; char *jid = lastName + mir_strlen(lastName) + 1; - TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); + wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); MCONTACT hContact = (MCONTACT)AddToListByJID(newJid, flags); mir_free(newJid); return hContact; @@ -373,7 +373,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) debugLog(L"Send 'authorization allowed' to %s", jid); - TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); + wchar_t *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed")); @@ -398,7 +398,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) //////////////////////////////////////////////////////////////////////////////////////// // JabberAuthDeny - handles the unsuccessful authorization -int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) +int CJabberProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) { if (!m_bJabberOnline) return 1; @@ -437,7 +437,7 @@ int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) //////////////////////////////////////////////////////////////////////////////////////// // JabberFileAllow - starts a file transfer -HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, const TCHAR *szPath) +HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, const wchar_t *szPath) { if (!m_bJabberOnline) return 0; @@ -493,7 +493,7 @@ int __cdecl CJabberProto::FileCancel(MCONTACT, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // JabberFileDeny - denies a file transfer -int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *) +int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const wchar_t *) { if (!m_bJabberOnline) return 1; @@ -521,7 +521,7 @@ int __cdecl CJabberProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *) //////////////////////////////////////////////////////////////////////////////////////// // JabberFileResume - processes file renaming etc -int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename) +int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename) { filetransfer *ft = (filetransfer*)hTransfer; if (!m_bJabberOnline || ft == NULL) @@ -553,7 +553,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) case PFLAG_UNIQUEIDSETTING: return (DWORD_PTR)"jid"; case PFLAG_MAXCONTACTSPERPACKET: - TCHAR szClientJid[JABBER_MAX_JID_LEN]; + wchar_t szClientJid[JABBER_MAX_JID_LEN]; if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) { JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE); return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50); @@ -570,7 +570,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) if (!m_bJabberOnline || isChatRoom(hContact)) return 1; - TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN]; + wchar_t jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN]; if (!GetClientJID(hContact, jid, _countof(jid))) return 1; @@ -609,7 +609,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) if (item->arResources.getCount()) { for (int i = 0; i < item->arResources.getCount(); i++) { pResourceStatus r(item->arResources[i]); - TCHAR tmp[JABBER_MAX_JID_LEN]; + wchar_t tmp[JABBER_MAX_JID_LEN]; mir_sntprintf(tmp, L"%s/%s", szBareJid, r->m_tszResourceName); if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) { @@ -649,7 +649,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) struct JABBER_SEARCH_BASIC { int hSearch; - TCHAR jid[128]; + wchar_t jid[128]; }; void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) @@ -660,17 +660,17 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.nick.t = jsb->jid; - psr.firstName.t = L""; - psr.lastName.t = L""; - psr.id.t = jsb->jid; + psr.nick.w = jsb->jid; + psr.firstName.w = L""; + psr.lastName.w = L""; + psr.id.w = jsb->jid; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)jsb->hSearch, (LPARAM)&psr); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)jsb->hSearch, 0); mir_free(jsb); } -HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) +HANDLE __cdecl CJabberProto::SearchBasic(const wchar_t *szJid) { debugLog(L"JabberBasicSearch called with lParam = '%s'", szJid); @@ -678,12 +678,12 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) if (!m_bJabberOnline || (jsb = (JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL) return 0; - if (_tcschr(szJid, '@') == NULL) { - TCHAR *szServer = mir_a2t(m_ThreadInfo->conn.server); - const TCHAR *p = _tcsstr(szJid, szServer); + if (wcschr(szJid, '@') == NULL) { + wchar_t *szServer = mir_a2t(m_ThreadInfo->conn.server); + const wchar_t *p = wcsstr(szJid, szServer); if (p == NULL) { bool numericjid = true; - for (const TCHAR *i = szJid; *i && numericjid; i++) + for (const wchar_t *i = szJid; *i && numericjid; i++) numericjid = (*i >= '0') && (*i <= '9'); mir_free(szServer); @@ -696,10 +696,10 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) } mir_sntprintf(jsb->jid, L"%s@%s", szJid, szServer); } - else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE); + else wcsncpy_s(jsb->jid, szJid, _TRUNCATE); mir_free(szServer); } - else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE); + else wcsncpy_s(jsb->jid, szJid, _TRUNCATE); debugLog(L"Adding '%s' without validation", jsb->jid); jsb->hSearch = SerialNext(); @@ -710,7 +710,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) //////////////////////////////////////////////////////////////////////////////////////// // SearchByEmail - searches the contact by its e-mail -HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email) +HANDLE __cdecl CJabberProto::SearchByEmail(const wchar_t *email) { if (!m_bJabberOnline || email == NULL) return 0; @@ -726,7 +726,7 @@ HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email) //////////////////////////////////////////////////////////////////////////////////////// // JabberSearchByName - searches the contact by its first or last name, or by a nickname -HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName) +HANDLE __cdecl CJabberProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) { if (!m_bJabberOnline) return NULL; @@ -790,7 +790,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC if (!m_bJabberOnline) return 0; - TCHAR szClientJid[JABBER_MAX_JID_LEN]; + wchar_t szClientJid[JABBER_MAX_JID_LEN]; if (!GetClientJID(hContact, szClientJid, _countof(szClientJid))) return 0; @@ -815,7 +815,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR** ppszFiles) +HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t** ppszFiles) { if (!m_bJabberOnline) return 0; @@ -867,12 +867,12 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const TCHAR *szDescript while (ppszFiles[ft->std.totalFiles] != NULL) ft->std.totalFiles++; - ft->std.ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)* ft->std.totalFiles); + ft->std.ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)* ft->std.totalFiles); ft->fileSize = (unsigned __int64*)mir_calloc(sizeof(unsigned __int64)* ft->std.totalFiles); int i, j; for (i = j = 0; i < ft->std.totalFiles; i++) { - if (_tstati64(ppszFiles[i], &statbuf)) + if (_wstat64(ppszFiles[i], &statbuf)) debugLog(L"'%s' is an invalid filename", ppszFiles[i]); else { ft->std.ptszFiles[j] = mir_tstrdup(ppszFiles[i]); @@ -928,7 +928,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) { - TCHAR szClientJid[JABBER_MAX_JID_LEN]; + wchar_t szClientJid[JABBER_MAX_JID_LEN]; if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) { TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID")); ForkThread(&CJabberProto::SendMessageAckThread, param); @@ -947,13 +947,13 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc) } else isEncrypted = 0; - TCHAR *msg; + wchar_t *msg; mir_utf8decode(NEWSTR_ALLOCA(pszSrc), &msg); if (msg == NULL) return 0; - TCHAR *msgType; - if (ListGetItemPtr(LIST_CHATROOM, szClientJid) && _tcschr(szClientJid, '/') == NULL) + wchar_t *msgType; + if (ListGetItemPtr(LIST_CHATROOM, szClientJid) && wcschr(szClientJid, '/') == NULL) msgType = L"groupchat"; else msgType = L"chat"; @@ -1119,7 +1119,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) } } - TCHAR *str = (TCHAR*)alloca(sizeof(TCHAR)*(len + 1)); + wchar_t *str = (wchar_t*)alloca(sizeof(wchar_t)*(len + 1)); str[0] = str[len] = '\0'; for (int i = 0; i < item->arResources.getCount(); i++) { JABBER_RESOURCE_STATUS *r = item->arResources[i]; @@ -1138,7 +1138,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void *param) return; } - TCHAR *tszStatusMsg = item->getTemp()->m_tszStatusMessage; + wchar_t *tszStatusMsg = item->getTemp()->m_tszStatusMessage; if (tszStatusMsg != NULL) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)tszStatusMsg); return; @@ -1160,11 +1160,11 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(MCONTACT hContact) //////////////////////////////////////////////////////////////////////////////////////// // JabberSetAwayMsg - sets the away status message -int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg) +int __cdecl CJabberProto::SetAwayMsg(int status, const wchar_t *msg) { debugLog(L"SetAwayMsg called, wParam=%d lParam=%s", status, msg); - TCHAR **szMsg; + wchar_t **szMsg; mir_cslockfull lck(m_csModeMsgMutex); switch (status) { @@ -1217,7 +1217,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type) { if (!m_bJabberOnline) return 0; - TCHAR szClientJid[JABBER_MAX_JID_LEN]; + wchar_t szClientJid[JABBER_MAX_JID_LEN]; if (!GetClientJID(hContact, szClientJid, _countof(szClientJid))) return 0; diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index a594a451a4..d1ee6abe76 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -42,7 +42,7 @@ struct CJabberProto; enum TJabberGcLogInfoType { INFO_BAN, INFO_STATUS, INFO_CONFIG, INFO_AFFILIATION, INFO_ROLE }; -typedef UNIQUE_MAP<TCHAR,TCharKeyCmp> U_TCHAR_MAP; +typedef UNIQUE_MAP<wchar_t,TCharKeyCmp> U_TCHAR_MAP; #define JABBER_DEFAULT_RECENT_COUNT 10 @@ -62,12 +62,12 @@ struct TFilterInfo volatile Type type; mir_cs csPatternLock; - TCHAR pattern[256]; + wchar_t pattern[256]; }; struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface { - CJabberProto(const char*, const TCHAR*); + CJabberProto(const char*, const wchar_t*); ~CJabberProto(); //==================================================================================== @@ -78,33 +78,33 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); virtual int __cdecl Authorize(MEVENT hDbEvent); - virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason); - virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath); virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); - virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename); + virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason); + virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename); 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 HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList); - virtual HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char *msg); virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact); - virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); + virtual int __cdecl SetAwayMsg(int m_iStatus, const wchar_t *msg); virtual int __cdecl UserIsTyping(MCONTACT hContact, int type); @@ -144,12 +144,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE m_hThreadHandle; - TCHAR *m_szJabberJID; + wchar_t *m_szJabberJID; int m_nJabberSearchID; time_t m_tmJabberLoggedInTime; time_t m_tmJabberIdleStartTime; UINT m_nJabberCodePage; - TCHAR *m_tszSelectedLang; + wchar_t *m_tszSelectedLang; mir_cs m_csModeMsgMutex; JABBER_MODEMSGS m_modeMsgs; @@ -183,7 +183,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE m_hEventXStatusChanged; // Transports list - LIST<TCHAR> m_lstTransports; + LIST<wchar_t> m_lstTransports; CJabberIqManager m_iqManager; CJabberMessageManager m_messageManager; @@ -261,10 +261,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResult_ListOfCommands(HXML iqNode, CJabberIqInfo*); void OnIqResult_CommandExecution(HXML iqNode, CJabberIqInfo*); - void AdHoc_RequestListOfCommands(TCHAR * szResponder, HWND hwndDlg); - int AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR * jid, struct JabberAdHocData* dat); - int AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData * dat, TCHAR* action); - int AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, int ypos, int value); + void AdHoc_RequestListOfCommands(wchar_t * szResponder, HWND hwndDlg); + int AdHoc_ExecuteCommand(HWND hwndDlg, wchar_t * jid, struct JabberAdHocData* dat); + int AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData * dat, wchar_t* action); + int AdHoc_AddCommandRadio(HWND hFrame, wchar_t * labelStr, int id, int ypos, int value); int AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat); int AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberAdHocData* dat); @@ -289,7 +289,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void CJabberProto::ProcessIncomingNote(CNoteItem *pNote, bool ok); void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok); - bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml); + bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml); INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM, LPARAM); INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM); @@ -310,31 +310,31 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_caps.cpp --------------------------------------------------------------- - JabberCapsBits GetTotalJidCapabilites(const TCHAR *jid); - JabberCapsBits GetResourceCapabilites(const TCHAR *jid, BOOL appendBestResource); + JabberCapsBits GetTotalJidCapabilites(const wchar_t *jid); + JabberCapsBits GetResourceCapabilites(const wchar_t *jid, BOOL appendBestResource); //---- jabber_captcha.cpp ------------------------------------------------------------ - void sendCaptchaResult(TCHAR* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid); + void sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid); void sendCaptchaError(ThreadData *info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge); //---- jabber_chat.cpp --------------------------------------------------------------- int GcInit(JABBER_LIST_ITEM *item); - void GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const TCHAR *resource, const TCHAR *nick, const TCHAR *jid, int action, HXML reason, int nStatusCode = -1); + void GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t *resource, const wchar_t *nick, const wchar_t *jid, int action, HXML reason, int nStatusCode = -1); void GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus &user, TJabberGcLogInfoType type); void GcQuit(JABBER_LIST_ITEM* jid, int code, HXML reason); void FilterList(HWND hwndList); void ResetListOptions(HWND hwndList); - void InviteUser(TCHAR *room, TCHAR *pUser, TCHAR *text); + void InviteUser(wchar_t *room, wchar_t *pUser, wchar_t *text); - void AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal); - void AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo); - void AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn); - void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str); - void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn); - void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* jid); + void AdminSet(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal); + void AdminGet(const wchar_t *to, const wchar_t *ns, const wchar_t *var, const wchar_t *varVal, JABBER_IQ_HANDLER foo); + void AdminSetReason(const wchar_t *to, const wchar_t *ns, const wchar_t *szItem, const wchar_t *itemVal, const wchar_t *var, const wchar_t *varVal, const wchar_t *rsn); + void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str); + void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str, const wchar_t* rsn); + void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* jid); //---- jabber_console.cpp ------------------------------------------------------------ @@ -349,7 +349,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_disco.cpp -------------------------------------------------------------- - void LaunchServiceDiscovery(TCHAR *jid); + void LaunchServiceDiscovery(wchar_t *jid); INT_PTR __cdecl OnMenuHandleServiceDiscovery(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl OnMenuHandleServiceDiscoveryMyTransports(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam); @@ -368,12 +368,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface BOOL SyncTree(HTREELISTITEM hIndex, CJabberSDNode *pNode); void ServiceDiscoveryShowMenu(CJabberSDNode *node, HTREELISTITEM hItem, POINT pt); - int SetupServiceDiscoveryDlg(TCHAR* jid); + int SetupServiceDiscoveryDlg(wchar_t* jid); void OnIqResultCapsDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultCapsDiscoInfoSI(HXML iqNode, CJabberIqInfo *pInfo); - void RegisterAgent(HWND hwndDlg, TCHAR* jid); + void RegisterAgent(HWND hwndDlg, wchar_t* jid); //---- jabber_file.cpp --------------------------------------------------------------- @@ -382,14 +382,14 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void UpdateChatUserStatus(wchar_t* chat_jid, wchar_t* jid, wchar_t* nick, int role, int affil, int status, BOOL update_nick); - void GroupchatJoinRoomByJid(HWND hwndParent, TCHAR *jid); + void GroupchatJoinRoomByJid(HWND hwndParent, wchar_t *jid); - void RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *oldNick, HXML itemNode); - void AcceptGroupchatInvite(const TCHAR *roomJid, const TCHAR *reason, const TCHAR *password); + void RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *oldNick, HXML itemNode); + void AcceptGroupchatInvite(const wchar_t *roomJid, const wchar_t *reason, const wchar_t *password); //---- jabber_form.c ----------------------------------------------------------------- - void FormCreateDialog(HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata); + void FormCreateDialog(HXML xNode, wchar_t* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata); //---- jabber_ft.c ------------------------------------------------------------------- @@ -397,7 +397,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void __cdecl FileServerThread(filetransfer *ft); void FtCancel(filetransfer *ft); - void FtInitiate(TCHAR* jid, filetransfer *ft); + void FtInitiate(wchar_t* jid, filetransfer *ft); void FtHandleSiRequest(HXML iqNode); void FtAcceptSiRequest(filetransfer *ft); void FtAcceptIbbRequest(filetransfer *ft); @@ -415,7 +415,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void GroupchatProcessPresence(HXML node); void GroupchatProcessMessage(HXML node); void GroupchatProcessInvite(LPCTSTR roomJid, LPCTSTR from, LPCTSTR reason, LPCTSTR password); - void GroupchatJoinDlg(TCHAR* roomJid); + void GroupchatJoinDlg(wchar_t* roomJid); void OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo); //---- jabber_icolib.cpp ------------------------------------------------------------- @@ -426,15 +426,15 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface HANDLE GetIconHandle(int iconId); HICON LoadIconEx(const char* name, bool big = false); int LoadAdvancedIcons(int iID); - int GetTransportProtoID(TCHAR* TransportDomain); + int GetTransportProtoID(wchar_t* TransportDomain); int GetTransportStatusIconIndex(int iID, int Status); - BOOL DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hContact); + BOOL DBCheckIsTransportedContact(const wchar_t *jid, MCONTACT hContact); void CheckAllContactsAreTransported(void); INT_PTR __cdecl JGetAdvancedStatusIcon(WPARAM wParam, LPARAM lParam); //---- jabber_iq.c ------------------------------------------------------------------- - __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const TCHAR *szReceiver = NULL, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) + __forceinline CJabberIqInfo* AddIQ(JABBER_IQ_HANDLER pHandler, int nIqType = JABBER_IQ_TYPE_GET, const wchar_t *szReceiver = NULL, DWORD dwParamsToParse = 0, int nIqId = -1, void *pUserData = NULL, int iPriority = JH_PRIORITY_DEFAULT) { return m_iqManager.AddHandler(pHandler, nIqType, szReceiver, dwParamsToParse, nIqId, pUserData, iPriority); } @@ -449,7 +449,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo); - void OnIqResultGotAvatar(MCONTACT hContact, HXML n, const TCHAR *mimeType); + void OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t *mimeType); void OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetRegister(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo); @@ -494,7 +494,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIbbInitiateResult(HXML iqNode, CJabberIqInfo *pInfo); void OnIbbCloseResult(HXML iqNode, CJabberIqInfo *pInfo); BOOL OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo); - BOOL OnIbbRecvdData(const TCHAR *data, const TCHAR *sid, const TCHAR *seq); + BOOL OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const wchar_t *seq); void OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo); BOOL FtIbbSend(int blocksize, filetransfer *ft); @@ -516,23 +516,23 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_list.cpp --------------------------------------------------------------- - JABBER_LIST_ITEM* ListAdd(JABBER_LIST list, const TCHAR *jid, MCONTACT hContact = 0); - JABBER_LIST_ITEM* ListGetItemPtr(JABBER_LIST list, const TCHAR *jid); + JABBER_LIST_ITEM* ListAdd(JABBER_LIST list, const wchar_t *jid, MCONTACT hContact = 0); + JABBER_LIST_ITEM* ListGetItemPtr(JABBER_LIST list, const wchar_t *jid); JABBER_LIST_ITEM* ListGetItemPtrFromIndex(int index); void ListInit(void); void ListWipe(void); - void ListRemove(JABBER_LIST list, const TCHAR *jid); + void ListRemove(JABBER_LIST list, const wchar_t *jid); void ListRemoveList(JABBER_LIST list); void ListRemoveByIndex(int index); int ListFindNext(JABBER_LIST list, int fromOffset); - pResourceStatus ListFindResource(JABBER_LIST list, const TCHAR *jid); + pResourceStatus ListFindResource(JABBER_LIST list, const wchar_t *jid); - bool ListAddResource(JABBER_LIST list, const TCHAR *jid, int status, const TCHAR *statusMessage, char priority = 0, const TCHAR *nick = NULL); - void ListRemoveResource(JABBER_LIST list, const TCHAR *jid); - TCHAR* ListGetBestClientResourceNamePtr(const TCHAR *jid); + bool ListAddResource(JABBER_LIST list, const wchar_t *jid, int status, const wchar_t *statusMessage, char priority = 0, const wchar_t *nick = NULL); + void ListRemoveResource(JABBER_LIST list, const wchar_t *jid); + wchar_t* ListGetBestClientResourceNamePtr(const wchar_t *jid); void SetMucConfig(HXML node, void *from); void OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType); @@ -575,12 +575,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface INT_PTR __cdecl OnGetEventTextChatStates(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl OnGetEventTextPresence(WPARAM wParam, LPARAM lParam); - void AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName); - void DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick); + void AddContactToRoster(const wchar_t *jid, const wchar_t *nick, const wchar_t *grpName); + void DBAddAuthRequest(const wchar_t *jid, const wchar_t *nick); BOOL AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType); - MCONTACT DBCreateContact(const TCHAR *jid, const TCHAR *nick, bool temporary, bool stripResource); - void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen); - void ResolveTransportNicks(const TCHAR *jid); + MCONTACT DBCreateContact(const wchar_t *jid, const wchar_t *nick, bool temporary, bool stripResource); + void GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen); + void ResolveTransportNicks(const wchar_t *jid); void SetServerStatus(int iNewStatus); void FormatMirVer(pResourceStatus &resource, CMString&); void UpdateMirVer(JABBER_LIST_ITEM *item); @@ -588,7 +588,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void UpdateSubscriptionInfo(MCONTACT hContact, JABBER_LIST_ITEM *item); void SetContactOfflineStatus(MCONTACT hContact); void InitPopups(void); - void MsgPopup(MCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle); + void MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle); CMString ExtractImage(HXML node); //---- jabber_opt.cpp ---------------------------------------------------------------- @@ -627,7 +627,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void __cdecl GetAwayMsgThread(void* hContact); void __cdecl SendMessageAckThread(void* hContact); - MCONTACT AddToListByJID(const TCHAR *newJid, DWORD flags); + MCONTACT AddToListByJID(const wchar_t *newJid, DWORD flags); void InfoFrame_OnSetup(CJabberInfoFrame_Event *evt); void InfoFrame_OnTransport(CJabberInfoFrame_Event *evt); @@ -642,8 +642,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo); int SearchRenewFields(HWND hwndDlg, JabberSearchData * dat); - void SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB); - void SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog = NULL); + void SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLastFromDB); + void SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog = NULL); //---- jabber_std.cpp ---------------------------------------------- void JLoginFailed(int errorCode); @@ -687,7 +687,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface bool isKerberosAvailable; bool isAuthAvailable; bool isSessionAvailable; - TCHAR *m_gssapiHostName; + wchar_t *m_gssapiHostName; } AUTHMECHS; AUTHMECHS m_AuthMechs; @@ -708,8 +708,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnProcessStreamOpening(HXML node, ThreadData *info); void OnProcessProtocol(HXML node, ThreadData *info); - void UpdateJidDbSettings(const TCHAR *jid); - MCONTACT CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem); + void UpdateJidDbSettings(const wchar_t *jid); + MCONTACT CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem); void PerformRegistration(ThreadData *info); void PerformIqAuth(ThreadData *info); @@ -728,12 +728,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface bool ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info); //---- jabber_util.c ----------------------------------------------------------------- - pResourceStatus ResourceInfoFromJID(const TCHAR *jid); + pResourceStatus ResourceInfoFromJID(const wchar_t *jid); - MCONTACT HContactFromJID(const TCHAR *jid, bool bStripResource = true); - MCONTACT ChatRoomHContactFromJID(const TCHAR *jid); + MCONTACT HContactFromJID(const wchar_t *jid, bool bStripResource = true); + MCONTACT ChatRoomHContactFromJID(const wchar_t *jid); void SendVisibleInvisiblePresence(BOOL invisible); - void SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg = NULL); + void SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg = NULL); void SendPresence(int m_iStatus, bool bSendToAll); void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...); @@ -741,11 +741,11 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void InitInfoFrame(void); // returns buf or NULL on error - TCHAR* GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen); - TCHAR* GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen); + wchar_t* GetClientJID(MCONTACT hContact, wchar_t *dest, size_t destLen); + wchar_t* GetClientJID(const wchar_t *jid, wchar_t *dest, size_t destLen); void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT); - void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT); + void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT); BOOL EnterString(CMString &result, LPCTSTR caption, int type, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0); bool IsMyOwnJID(LPCTSTR szJID); @@ -755,12 +755,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface int m_vCardUpdates; bool m_bPhotoChanged; - TCHAR m_szPhotoFileName[MAX_PATH]; + wchar_t m_szPhotoFileName[MAX_PATH]; void OnUserInfoInit_VCard(WPARAM, LPARAM); - int SendGetVcard(const TCHAR *jid); + int SendGetVcard(const wchar_t *jid); void AppendVcardFromDB(HXML n, char* tag, char* key); - void SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName); + void SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName); void SaveVcardToDB(HWND hwndPage, int iPage); //---- jabber_ws.c ------------------------------------------------- @@ -793,11 +793,11 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void RegisterAdvStatusSlot(const char *pszSlot); void ResetAdvStatus(MCONTACT hContact, const char *pszSlot); - void WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText); + void WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const wchar_t *pszMode, const char *pszIcon, const wchar_t *pszTitle, const wchar_t *pszText); char* ReadAdvStatusA(MCONTACT hContact, const char *pszSlot, const char *pszValue); - TCHAR* ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue); + wchar_t* ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue); - BOOL SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri); + BOOL SendPepTune(wchar_t* szArtist, wchar_t* szLength, wchar_t* szSource, wchar_t* szTitle, wchar_t* szTrack, wchar_t* szUri); void XStatusInit(void); diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index c851f55959..c4bd0161b9 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -58,15 +58,15 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo) return TRUE; } - const TCHAR *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); + const wchar_t *szNode = XmlGetAttrValue(pInfo->GetChildNode(), L"node"); if (!szNode) return TRUE; - m_adhocManager.HandleCommandRequest(iqNode, pInfo, (TCHAR*)szNode); + m_adhocManager.HandleCommandRequest(iqNode, pInfo, (wchar_t*)szNode); return TRUE; } -BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode) +BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode) { if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo)) return FALSE; @@ -79,7 +79,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T CJabberAdhocNode* pNode = GetFirstNode(); while (pNode) { - TCHAR *szJid = pNode->GetJid(); + wchar_t *szJid = pNode->GetJid(); if (!szJid) szJid = m_pProto->m_ThreadInfo->fullJID; @@ -96,7 +96,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T return FALSE; } -BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode) +BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode) { if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo)) return FALSE; @@ -135,7 +135,7 @@ BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TC return TRUE; } -BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode) +BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode) { // ATTN: ACL and db settings checked in calling function @@ -154,7 +154,7 @@ BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo return FALSE; } - const TCHAR *szSessionId = XmlGetAttrValue(commandNode, L"sessionid"); + const wchar_t *szSessionId = XmlGetAttrValue(commandNode, L"sessionid"); CJabberAdhocSession* pSession = NULL; if (szSessionId) { @@ -309,7 +309,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode << XCHILD(L"option") << XATTR(L"label", TranslateT("Offline")) << XCHILD(L"value", L"offline"); // priority - TCHAR szPriority[ 256 ]; + wchar_t szPriority[ 256 ]; mir_sntprintf(szPriority, L"%d", (int)getDword("Priority", 5)); xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Priority")) << XATTR(L"type", L"text-single") << XATTR(L"var", L"status-priority") << XCHILD(L"value", szPriority); @@ -322,7 +322,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Change global status")) << XATTR(L"type", L"boolean") << XATTR(L"var", L"status-global"); - ptrT tszStatusMsg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0)); + ptrT tszStatusMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, 0)); if (tszStatusMsg) fieldNode << XCHILD(L"value", tszStatusMsg); @@ -361,12 +361,12 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-priority"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) if (ptszValue = XmlGetText(valueNode)) - priority = _ttoi(ptszValue); + priority = _wtoi(ptszValue); if (priority >= -128 && priority <= 127) setDword("Priority", priority); - const TCHAR *szStatusMessage = NULL; + const wchar_t *szStatusMessage = NULL; fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-message"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) szStatusMessage = XmlGetText(valueNode); @@ -379,7 +379,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc fieldNode = XmlGetChildByTag(xNode, "field", "var", L"status-global"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) { - if ((ptszValue = XmlGetText(valueNode)) != NULL && _ttoi(ptszValue)) + if ((ptszValue = XmlGetText(valueNode)) != NULL && _wtoi(ptszValue)) CallService(MS_CLIST_SETSTATUSMODE, status, NULL); else CallProtoService(m_szModuleName, PS_SETSTATUS, status, NULL); @@ -413,7 +413,7 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe << XATTR(L"value", JABBER_FEAT_RC); // Automatically Accept File Transfers - TCHAR szTmpBuff[ 1024 ]; + wchar_t szTmpBuff[ 1024 ]; mir_sntprintf(szTmpBuff, L"%d", db_get_b(NULL, "SRFile", "AutoAccept", 0)); xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Automatically Accept File Transfers")) << XATTR(L"type", L"boolean") << XATTR(L"var", L"auto-files") << XCHILD(L"value", szTmpBuff); @@ -442,18 +442,18 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe HXML fieldNode = XmlGetChildByTag(xNode, "field", "var", L"auto-files"), valueNode; if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) if (XmlGetText(valueNode)) - db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)_ttoi(XmlGetText(valueNode))); + db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)_wtoi(XmlGetText(valueNode))); // Use sounds fieldNode = XmlGetChildByTag(xNode, "field", "var", L"sounds"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) if (XmlGetText(valueNode)) - db_set_b(NULL, "Skin", "UseSound", (BYTE)_ttoi(XmlGetText(valueNode))); + db_set_b(NULL, "Skin", "UseSound", (BYTE)_wtoi(XmlGetText(valueNode))); // Disable remote controlling fieldNode = XmlGetChildByTag(xNode, "field", "var", L"enable-rc"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) - if (XmlGetText(valueNode) && _ttoi(XmlGetText(valueNode))) + if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode))) m_options.EnableRemoteControl = 0; return JABBER_ADHOC_HANDLER_STATUS_COMPLETED; @@ -477,7 +477,7 @@ int CJabberProto::RcGetUnreadEventsCount() dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1); int nGetTextResult = db_event_get(hDbEvent, &dbei); if (!nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) { - TCHAR *szEventText = DbGetEventTextT(&dbei, CP_ACP); + wchar_t *szEventText = DbGetEventTextT(&dbei, CP_ACP); if (szEventText) { nEventsSent++; mir_free(szEventText); @@ -491,7 +491,7 @@ int CJabberProto::RcGetUnreadEventsCount() int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSession* pSession) { - TCHAR szMsg[ 1024 ]; + wchar_t szMsg[ 1024 ]; if (pSession->GetStage() == 0) { int nUnreadEvents = RcGetUnreadEventsCount(); if (!nUnreadEvents) { @@ -544,7 +544,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // remove clist events HXML fieldNode = XmlGetChildByTag(xNode,"field", "var", L"remove-clist-events"), valueNode; if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) - if (XmlGetText(valueNode) && !_ttoi(XmlGetText(valueNode))) + if (XmlGetText(valueNode) && !_wtoi(XmlGetText(valueNode))) bRemoveCListEvents = FALSE; m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0; @@ -578,21 +578,21 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe << XCHILD(L"body", szEventText); HXML addressesNode = msg << XCHILDNS(L"addresses", JABBER_FEAT_EXT_ADDRESSING); - TCHAR szOFrom[JABBER_MAX_JID_LEN]; + wchar_t szOFrom[JABBER_MAX_JID_LEN]; size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1; if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1)); mir_sntprintf(szOFrom, L"%s/%s", tszJid, szOResource); } else - _tcsncpy_s(szOFrom, tszJid, _TRUNCATE); + wcsncpy_s(szOFrom, tszJid, _TRUNCATE); addressesNode << XCHILD(L"address") << XATTR(L"type", L"ofrom") << XATTR(L"jid", szOFrom); addressesNode << XCHILD(L"address") << XATTR(L"type", L"oto") << XATTR(L"jid", m_ThreadInfo->fullJID); time_t ltime = (time_t)dbei.timestamp; struct tm *gmt = gmtime(<ime); - TCHAR stime[512]; + wchar_t stime[512]; mir_sntprintf(stime, L"%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); msg << XCHILDNS(L"delay", L"urn:xmpp:delay") << XATTR(L"stamp", stime); @@ -625,7 +625,7 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes { BOOL bOk = LockWorkStation(); - TCHAR szMsg[ 1024 ]; + wchar_t szMsg[ 1024 ]; if (bOk) mir_sntprintf(szMsg, TranslateT("Workstation successfully locked")); else @@ -683,7 +683,7 @@ int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo *pInfo, CJabberAdh // I Agree checkbox fieldNode = XmlGetChildByTag(xNode,"field", "var", L"allow-shutdown"); if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value"))) - if (XmlGetText(valueNode) && _ttoi(XmlGetText(valueNode))) + if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode))) CallFunctionAsync(JabberQuitMirandaIMThread, 0); return JABBER_ADHOC_HANDLER_STATUS_COMPLETED; @@ -708,7 +708,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe } if (!nChatsCount) { - TCHAR szMsg[ 1024 ]; + wchar_t szMsg[ 1024 ]; mir_sntprintf(szMsg, TranslateT("There is no group chats to leave")); m_ThreadInfo->send( diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index 73fa177f71..aa5306e381 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -102,14 +102,14 @@ class CJabberAdhocNode; class CJabberAdhocNode { protected: - TCHAR *m_szJid; - TCHAR *m_szNode; - TCHAR *m_szName; + wchar_t *m_szJid; + wchar_t *m_szNode; + wchar_t *m_szName; CJabberAdhocNode* m_pNext; JABBER_ADHOC_HANDLER m_pHandler; CJabberProto *m_pProto; public: - CJabberAdhocNode(CJabberProto* pProto, TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler) + CJabberAdhocNode(CJabberProto* pProto, wchar_t* szJid, wchar_t* szNode, wchar_t* szName, JABBER_ADHOC_HANDLER pHandler) { memset(this, 0, sizeof(CJabberAdhocNode)); replaceStrT(m_szJid, szJid); @@ -137,15 +137,15 @@ public: m_pNext = pNext; return pRetVal; } - TCHAR* GetJid() + wchar_t* GetJid() { return m_szJid; } - TCHAR* GetNode() + wchar_t* GetNode() { return m_szNode; } - TCHAR* GetName() + wchar_t* GetName() { return m_szName; } @@ -165,7 +165,7 @@ protected: CJabberAdhocSession* m_pSessions; mir_cs m_cs; - CJabberAdhocSession* FindSession(const TCHAR *szSession) + CJabberAdhocSession* FindSession(const wchar_t *szSession) { CJabberAdhocSession* pSession = m_pSessions; while (pSession) { @@ -188,7 +188,7 @@ protected: return pSession; } - CJabberAdhocNode* FindNode(const TCHAR *szNode) + CJabberAdhocNode* FindNode(const wchar_t *szNode) { CJabberAdhocNode* pNode = m_pNodes; while (pNode) { @@ -264,7 +264,7 @@ public: } BOOL FillDefaultNodes(); - BOOL AddNode(TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler) + BOOL AddNode(wchar_t* szJid, wchar_t* szNode, wchar_t* szName, JABBER_ADHOC_HANDLER pHandler) { CJabberAdhocNode* pNode = new CJabberAdhocNode(m_pProto, szJid, szNode, szName, pHandler); if (!pNode) @@ -287,9 +287,9 @@ public: return m_pNodes; } - BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode); - BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode); - BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const TCHAR *szNode); + BOOL HandleItemsRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode); + BOOL HandleInfoRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode); + BOOL HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo, const wchar_t *szNode); BOOL ExpireSessions() { diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 3c033d178c..c1d3795688 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -122,8 +122,8 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) dat->pJSInf = (JabberSearchFieldsInfo*)realloc(dat->pJSInf, sizeof(JabberSearchFieldsInfo)*(dat->nJSInfCount + 1)); dat->pJSInf[dat->nJSInfCount].hwndCaptionItem = hwndLabel; dat->pJSInf[dat->nJSInfCount].hwndValueItem = hwndVar; - dat->pJSInf[dat->nJSInfCount].szFieldCaption = _tcsdup(FieldDat->Label); - dat->pJSInf[dat->nJSInfCount].szFieldName = _tcsdup(FieldDat->Var); + dat->pJSInf[dat->nJSInfCount].szFieldCaption = wcsdup(FieldDat->Label); + dat->pJSInf[dat->nJSInfCount].szFieldName = wcsdup(FieldDat->Var); dat->nJSInfCount++; } return CornerY + Order * 40 + 14 + 20; @@ -177,16 +177,16 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) } } - const TCHAR *szFrom = XmlGetAttrValue(iqNode, L"from"); + const wchar_t *szFrom = XmlGetAttrValue(iqNode, L"from"); if (szFrom) SearchAddToRecent(szFrom, searchHandleDlg); PostMessage(searchHandleDlg, WM_USER + 10, 0, 0); ShowWindow(searchHandleDlg, SW_SHOW); } else if (!mir_tstrcmp(type, L"error")) { - const TCHAR *code = NULL; - const TCHAR *description = NULL; - TCHAR buff[255]; + const wchar_t *code = NULL; + const wchar_t *description = NULL; + wchar_t buff[255]; HXML errorNode = XmlGetChild(iqNode, "error"); if (errorNode) { code = XmlGetAttrValue(errorNode, L"code"); @@ -203,12 +203,12 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) // The pmFields is the pointer to map of <field Name, field Label> Not unical but ordered // This can help to made result parser routines more simple -static TCHAR *nickfields[] = { L"nick", L"nickname", L"fullname", L"name", L"given", L"first", L"jid", NULL }; +static wchar_t *nickfields[] = { L"nick", L"nickname", L"fullname", L"name", L"given", L"first", L"jid", NULL }; void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_MAP * pmAllFields) { - LIST<TCHAR> ListOfNonEmptyFields(20, (LIST<TCHAR>::FTSortFunc)TCharKeyCmp); - LIST<TCHAR> ListOfFields(20); + LIST<wchar_t> ListOfNonEmptyFields(20, (LIST<wchar_t>::FTSortFunc)TCharKeyCmp); + LIST<wchar_t> ListOfFields(20); LIST<void>* plUsersInfo = (LIST<void>*)pvUsersInfo; int i, nUsersFound = plUsersInfo->getCount(); @@ -217,7 +217,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M U_TCHAR_MAP* pmUserData = (U_TCHAR_MAP*)plUsersInfo->operator [](i); int nUserFields = pmUserData->getCount(); for (int j = 0; j < nUserFields; j++) { - TCHAR *var = pmUserData->getKeyName(j); + wchar_t *var = pmUserData->getKeyName(j); if (var && ListOfNonEmptyFields.getIndex(var) < 0) ListOfNonEmptyFields.insert(var); } @@ -226,7 +226,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M // now fill the ListOfFields but order is from pmAllFields int nAllCount = pmAllFields->getCount(); for (i = 0; i < nAllCount; i++) { - TCHAR *var = pmAllFields->getUnOrderedKeyName(i); + wchar_t *var = pmAllFields->getUnOrderedKeyName(i); if (var && ListOfNonEmptyFields.getIndex(var) < 0) continue; ListOfFields.insert(var); @@ -237,12 +237,12 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M CUSTOMSEARCHRESULTS Results = { 0 }; Results.nSize = sizeof(Results); - Results.pszFields = (TCHAR**)mir_alloc(sizeof(TCHAR*)*nFieldCount); + Results.pszFields = (wchar_t**)mir_alloc(sizeof(wchar_t*)*nFieldCount); Results.nFieldCount = nFieldCount; /* Sending Columns Titles */ for (i = 0; i < nFieldCount; i++) { - TCHAR *var = ListOfFields[i]; + wchar_t *var = ListOfFields[i]; if (var) Results.pszFields[i] = pmAllFields->operator [](var); } @@ -254,44 +254,44 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M Results.psr.cbSize = sizeof(Results.psr); // sending user data for (i = 0; i < nUsersFound; i++) { - TCHAR buff[200]; + wchar_t buff[200]; buff[0] = 0; U_TCHAR_MAP *pmUserData = (U_TCHAR_MAP *)plUsersInfo->operator [](i); for (int j = 0; j < nFieldCount; j++) { - TCHAR *var = ListOfFields[j]; - TCHAR *value = pmUserData->operator [](var); - Results.pszFields[j] = value ? value : (TCHAR *)L" "; + wchar_t *var = ListOfFields[j]; + wchar_t *value = pmUserData->operator [](var); + Results.pszFields[j] = value ? value : (wchar_t *)L" "; if (!mir_tstrcmpi(var, L"jid") && value) - Results.psr.id.t = value; + Results.psr.id.w = value; } - TCHAR *nick = NULL; + wchar_t *nick = NULL; for (int k = 0; k < _countof(nickfields) && !nick; k++) nick = pmUserData->operator [](nickfields[k]); if (nick) { - if (mir_tstrcmpi(nick, Results.psr.id.t)) - mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.t); + if (mir_tstrcmpi(nick, Results.psr.id.w)) + mir_sntprintf(buff, L"%s (%s)", nick, Results.psr.id.w); else - _tcsncpy_s(buff, nick, _TRUNCATE); + wcsncpy_s(buff, nick, _TRUNCATE); nick = buff; } - Results.psr.nick.t = nick; + Results.psr.nick.w = nick; Results.psr.flags = PSR_TCHAR; ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, id, (LPARAM)&Results); - Results.psr.nick.t = NULL; + Results.psr.nick.w = NULL; } mir_free(Results.pszFields); } -void DestroyKey(TCHAR* key) +void DestroyKey(wchar_t* key) { mir_free(key); } -TCHAR* CopyKey(TCHAR* key) +wchar_t* CopyKey(wchar_t* key) { return mir_tstrdup(key); } @@ -301,7 +301,7 @@ TCHAR* CopyKey(TCHAR* key) void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) { - const TCHAR *type; + const wchar_t *type; int id; U_TCHAR_MAP mColumnsNames(10); @@ -321,9 +321,9 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (reportNode) { int i = 1; while (HXML fieldNode = XmlGetNthChild(reportNode, L"field", i++)) { - TCHAR *var = (TCHAR*)XmlGetAttrValue(fieldNode, L"var"); + wchar_t *var = (wchar_t*)XmlGetAttrValue(fieldNode, L"var"); if (var) { - TCHAR *Label = (TCHAR*)XmlGetAttrValue(fieldNode, L"label"); + wchar_t *Label = (wchar_t*)XmlGetAttrValue(fieldNode, L"label"); mColumnsNames.insert(var, (Label != NULL) ? Label : var); } } @@ -335,8 +335,8 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); int j = 1; while (HXML fieldNode = XmlGetNthChild(itemNode, L"field", j++)) { - if (TCHAR* var = (TCHAR*)XmlGetAttrValue(fieldNode, L"var")) { - if (TCHAR* Text = (TCHAR*)XmlGetText(XmlGetChild(fieldNode, L"value"))) { + if (wchar_t* var = (wchar_t*)XmlGetAttrValue(fieldNode, L"var")) { + if (wchar_t* Text = (wchar_t*)XmlGetText(XmlGetChild(fieldNode, L"value"))) { if (!mColumnsNames[var]) mColumnsNames.insert(var, var); pUserColumn->insert(var, Text); @@ -353,8 +353,8 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) while (HXML itemNode = XmlGetNthChild(queryNode, L"item", i++)) { U_TCHAR_MAP *pUserColumn = new U_TCHAR_MAP(10); - TCHAR *jid = (TCHAR*)XmlGetAttrValue(itemNode, L"jid"); - TCHAR *keyReturned; + wchar_t *jid = (wchar_t*)XmlGetAttrValue(itemNode, L"jid"); + wchar_t *keyReturned; mColumnsNames.insertCopyKey(L"jid", L"jid", &keyReturned, CopyKey, DestroyKey); mColumnsNames.insert(L"jid", keyReturned); pUserColumn->insertCopyKey(L"jid", jid, NULL, CopyKey, DestroyKey); @@ -364,13 +364,13 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) if (!child) break; - const TCHAR *szColumnName = XmlGetName(child); + const wchar_t *szColumnName = XmlGetName(child); if (szColumnName) { LPCTSTR ptszChild = XmlGetText(child); if (ptszChild && *ptszChild) { - mColumnsNames.insertCopyKey((TCHAR*)szColumnName, L"", &keyReturned, CopyKey, DestroyKey); - mColumnsNames.insert((TCHAR*)szColumnName, keyReturned); - pUserColumn->insertCopyKey((TCHAR*)szColumnName, (TCHAR*)ptszChild, NULL, CopyKey, DestroyKey); + mColumnsNames.insertCopyKey((wchar_t*)szColumnName, L"", &keyReturned, CopyKey, DestroyKey); + mColumnsNames.insert((wchar_t*)szColumnName, keyReturned); + pUserColumn->insertCopyKey((wchar_t*)szColumnName, (wchar_t*)ptszChild, NULL, CopyKey, DestroyKey); } } } @@ -380,9 +380,9 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) } } else if (!mir_tstrcmp(type, L"error")) { - const TCHAR *code = NULL; - const TCHAR *description = NULL; - TCHAR buff[255]; + const wchar_t *code = NULL; + const wchar_t *description = NULL; + wchar_t buff[255]; HXML errorNode = XmlGetChild(iqNode, "error"); if (errorNode) { code = XmlGetAttrValue(errorNode, L"code"); @@ -459,7 +459,7 @@ static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData *dat) int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) { - TCHAR szServerName[100]; + wchar_t szServerName[100]; EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE); GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); dat->CurrentHeight = 0; @@ -481,14 +481,14 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) return pInfo->GetIqId(); } -static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const TCHAR *szAddr) +static void JabberSearchAddUrlToRecentCombo(HWND hwndDlg, const wchar_t *szAddr) { int lResult = SendDlgItemMessage(hwndDlg, IDC_SERVER, (UINT)CB_FINDSTRING, 0, (LPARAM)szAddr); if (lResult == -1) SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szAddr); } -void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFromDB) +void CJabberProto::SearchDeleteFromRecent(const wchar_t *szAddr, bool deleteLastFromDB) { // search in recent for (int i = 0; i < 10; i++) { @@ -517,7 +517,7 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, bool deleteLastFr } } -void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) +void CJabberProto::SearchAddToRecent(const wchar_t *szAddr, HWND hwndDialog) { char key[30]; SearchDeleteFromRecent(szAddr, true); @@ -556,7 +556,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR //TO DO: Add Transports here int i, transpCount = dat->ppro->m_lstTransports.getCount(); for (i = 0; i < transpCount; i++) { - TCHAR *szTransp = dat->ppro->m_lstTransports[i]; + wchar_t *szTransp = dat->ppro->m_lstTransports[i]; if (szTransp) JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp); } @@ -742,7 +742,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) BOOL fRequestNotEmpty = FALSE; // get server name - TCHAR szServerName[100]; + wchar_t szServerName[100]; GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); // formating query @@ -763,7 +763,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) } else { //and Simple fields: XEP-0055 Example 3 for (int i = 0; i < dat->nJSInfCount; i++) { - TCHAR szFieldValue[100]; + wchar_t szFieldValue[100]; GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, _countof(szFieldValue)); if (szFieldValue[0] != 0) { XmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue); diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h index ef96830e7b..cf3f053728 100644 --- a/protocols/JabberG/src/jabber_search.h +++ b/protocols/JabberG/src/jabber_search.h @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _tagJabberSearchFieldsInfo { - TCHAR * szFieldName; - TCHAR * szFieldCaption; + wchar_t * szFieldName; + wchar_t * szFieldCaption; HWND hwndCaptionItem; HWND hwndValueItem; } JabberSearchFieldsInfo; @@ -51,9 +51,9 @@ typedef struct _tagJabberSearchData typedef struct tag_Data { - TCHAR *Label; - TCHAR * Var; - TCHAR * defValue; + wchar_t *Label; + wchar_t * Var; + wchar_t * defValue; BOOL bHidden; BOOL bReadOnly; int Order; @@ -69,8 +69,8 @@ static void JabberIqResultGetSearchFields(HXML iqNode, void *userdata); static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat); static void JabberSearchRefreshFrameScroll(HWND hwndDlg, JabberSearchData * dat); static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static void JabberSearchDeleteFromRecent(TCHAR * szAddr,BOOL deleteLastFromDB); -void SearchAddToRecent(TCHAR * szAddr, HWND hwnd); +static void JabberSearchDeleteFromRecent(wchar_t * szAddr,BOOL deleteLastFromDB); +void SearchAddToRecent(wchar_t * szAddr, HWND hwnd); // Implementation of MAP class (the list template <typename _KEYTYPE , int (*COMPARATOR)(_KEYTYPE*, _KEYTYPE*) > @@ -84,7 +84,7 @@ public: private: typedef struct _tagRECORD { - _tagRECORD(_KEYTYPE * key, TCHAR * value=NULL) { _key=key; _value=value; _order=0; _destroyKeyProc=NULL; } + _tagRECORD(_KEYTYPE * key, wchar_t * value=NULL) { _key=key; _value=value; _order=0; _destroyKeyProc=NULL; } ~_tagRECORD() { if (_key && _destroyKeyProc) @@ -93,7 +93,7 @@ private: _destroyKeyProc=NULL; } _KEYTYPE *_key; - TCHAR * _value; + wchar_t * _value; int _order; DESTROYKEYPROC _destroyKeyProc; } _RECORD; @@ -148,7 +148,7 @@ public: while (record=_Records[i++]) delete record; } - int insert(_KEYTYPE* Key, TCHAR *Value) + int insert(_KEYTYPE* Key, wchar_t *Value) { _RECORD * rec= new _RECORD(Key,Value); int index=_Records.getIndex(rec); @@ -168,7 +168,7 @@ public: } return index; } - int insertCopyKey(_KEYTYPE* Key, TCHAR *Value, _KEYTYPE** _KeyReturn, COPYKEYPROC CopyProc, DESTROYKEYPROC DestroyProc) + int insertCopyKey(_KEYTYPE* Key, wchar_t *Value, _KEYTYPE** _KeyReturn, COPYKEYPROC CopyProc, DESTROYKEYPROC DestroyProc) { _RECORD * rec= new _RECORD(Key,Value); int index=_Records.getIndex(rec); @@ -198,7 +198,7 @@ public: } return index; } - inline TCHAR* operator[](_KEYTYPE* _KEY) const + inline wchar_t* operator[](_KEYTYPE* _KEY) const { _RECORD rec(_KEY); int index=_Records.getIndex(&rec); @@ -213,7 +213,7 @@ public: else return NULL; } - inline TCHAR* operator[](int index) const + inline wchar_t* operator[](int index) const { _RECORD * rv=_Records[index]; if (rv) return rv->_value; @@ -225,7 +225,7 @@ public: if (rv) return rv->_key; else return NULL; } - inline TCHAR * getUnOrdered(int index) + inline wchar_t * getUnOrdered(int index) { _RECORD * rec=_getUnorderedRec(index); if (rec) return rec->_value; @@ -260,7 +260,7 @@ public: } }; -inline int TCharKeyCmp(TCHAR* a, TCHAR* b) +inline int TCharKeyCmp(wchar_t* a, wchar_t* b) { return (int)(mir_tstrcmpi(a,b)); } diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 1308ba8a40..447e15edd1 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -28,13 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// // ntlm auth - LanServer based authorization -TNtlmAuth::TNtlmAuth(ThreadData *info, const char* mechanism, const TCHAR *hostname) : +TNtlmAuth::TNtlmAuth(ThreadData *info, const char* mechanism, const wchar_t *hostname) : TJabberAuth(info) { szName = mechanism; szHostName = hostname; - const TCHAR *szProvider; + const wchar_t *szProvider; if (!mir_strcmp(mechanism, "GSS-SPNEGO")) szProvider = L"Negotiate"; else if (!mir_strcmp(mechanism, "GSSAPI")) @@ -48,7 +48,7 @@ LBL_Invalid: return; } - TCHAR szSpn[1024] = L""; + wchar_t szSpn[1024] = L""; if (mir_strcmp(mechanism, "NTLM")) if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI")) goto LBL_Invalid; @@ -63,9 +63,9 @@ TNtlmAuth::~TNtlmAuth() Netlib_DestroySecurityProvider(NULL, hProvider); } -bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) +bool TNtlmAuth::getSpn(wchar_t* szSpn, size_t dwSpnLen) { - TCHAR szFullUserName[128] = L""; + wchar_t szFullUserName[128] = L""; ULONG szFullUserNameLen = _countof(szFullUserName); if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) { szFullUserName[0] = 0; @@ -73,12 +73,12 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen); } - TCHAR *name = _tcsrchr(szFullUserName, '\\'); + wchar_t *name = wcsrchr(szFullUserName, '\\'); if (name) *name = 0; else return false; if (szHostName && szHostName[0]) { - TCHAR *szFullUserNameU = _tcsupr(mir_tstrdup(szFullUserName)); + wchar_t *szFullUserNameU = wcsupr(mir_tstrdup(szFullUserName)); mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s/%s@%s", szHostName, szFullUserName, szFullUserNameU); mir_free(szFullUserNameU); } @@ -90,8 +90,8 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen) if (host && host->h_name) connectHost = host->h_name; - TCHAR *connectHostT = mir_a2t(connectHost); - mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, _tcsupr(szFullUserName)); + wchar_t *connectHostT = mir_a2t(connectHost); + mir_sntprintf(szSpn, dwSpnLen, L"xmpp/%s@%s", connectHostT, wcsupr(szFullUserName)); mir_free(connectHostT); } @@ -111,7 +111,7 @@ char* TNtlmAuth::getInitialRequest() return Netlib_NtlmCreateResponse2(hProvider, "", NULL, NULL, &complete); } -char* TNtlmAuth::getChallenge(const TCHAR *challenge) +char* TNtlmAuth::getChallenge(const wchar_t *challenge) { if (!hProvider) return NULL; @@ -137,7 +137,7 @@ TMD5Auth::~TMD5Auth() { } -char* TMD5Auth::getChallenge(const TCHAR *challenge) +char* TMD5Auth::getChallenge(const wchar_t *challenge) { if (iCallCount > 0) return NULL; @@ -238,7 +238,7 @@ void TScramAuth::Hi(BYTE* res, char* passw, size_t passwLen, char* salt, size_t } } -char* TScramAuth::getChallenge(const TCHAR *challenge) +char* TScramAuth::getChallenge(const wchar_t *challenge) { unsigned chlLen, saltLen = 0; ptrA snonce, salt; @@ -315,7 +315,7 @@ char* TScramAuth::getInitialRequest() return mir_base64_encode((PBYTE)buf, cbLen); } -bool TScramAuth::validateLogin(const TCHAR *challenge) +bool TScramAuth::validateLogin(const wchar_t *challenge) { unsigned chlLen; ptrA chl((char*)mir_base64_decode(_T2A(challenge), &chlLen)); @@ -370,12 +370,12 @@ char* TJabberAuth::getInitialRequest() return NULL; } -char* TJabberAuth::getChallenge(const TCHAR*) +char* TJabberAuth::getChallenge(const wchar_t*) { return NULL; } -bool TJabberAuth::validateLogin(const TCHAR*) +bool TJabberAuth::validateLogin(const wchar_t*) { return true; } diff --git a/protocols/JabberG/src/jabber_secur.h b/protocols/JabberG/src/jabber_secur.h index 90a3535c6a..f0099560d4 100644 --- a/protocols/JabberG/src/jabber_secur.h +++ b/protocols/JabberG/src/jabber_secur.h @@ -37,8 +37,8 @@ public: virtual ~TJabberAuth(); virtual char* getInitialRequest(); - virtual char* getChallenge(const TCHAR *challenge); - virtual bool validateLogin(const TCHAR *challenge); + virtual char* getChallenge(const wchar_t *challenge); + virtual bool validateLogin(const wchar_t *challenge); inline const char* getName() const { return szName; @@ -75,7 +75,7 @@ public: TMD5Auth(ThreadData*); virtual ~TMD5Auth(); - virtual char* getChallenge(const TCHAR *challenge); + virtual char* getChallenge(const wchar_t *challenge); }; class TScramAuth : public TJabberAuth @@ -88,8 +88,8 @@ public: virtual ~TScramAuth(); virtual char* getInitialRequest(); - virtual char* getChallenge(const TCHAR *challenge); - virtual bool validateLogin(const TCHAR *challenge); + virtual char* getChallenge(const wchar_t *challenge); + virtual bool validateLogin(const wchar_t *challenge); void Hi(BYTE* res , char* passw, size_t passwLen, char* salt, size_t saltLen, int ind); }; @@ -101,13 +101,13 @@ class TNtlmAuth : public TJabberAuth typedef TJabberAuth CSuper; HANDLE hProvider; - const TCHAR *szHostName; + const wchar_t *szHostName; public: - TNtlmAuth(ThreadData*, const char* mechanism, const TCHAR *hostname = NULL); + TNtlmAuth(ThreadData*, const char* mechanism, const wchar_t *hostname = NULL); virtual ~TNtlmAuth(); virtual char* getInitialRequest(); - virtual char* getChallenge(const TCHAR *challenge); + virtual char* getChallenge(const wchar_t *challenge); - bool getSpn(TCHAR* szSpn, size_t dwSpnLen); + bool getSpn(wchar_t* szSpn, size_t dwSpnLen); }; diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index bfdee3d9c7..521d4eaa08 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) { - TCHAR *szStatus = NULL; + wchar_t *szStatus = NULL; mir_cslock lck(m_csModeMsgMutex); switch (wParam ? (int)wParam : m_iStatus) { @@ -74,7 +74,7 @@ INT_PTR __cdecl CJabberProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberGetAvatar(WPARAM wParam, LPARAM lParam) { - TCHAR *buf = (TCHAR*)wParam; + wchar_t *buf = (wchar_t*)wParam; int size = (int)lParam; if (buf == NULL || size <= 0) @@ -129,13 +129,13 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR; } - TCHAR tszFileName[MAX_PATH]; + wchar_t tszFileName[MAX_PATH]; GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName)); - _tcsncpy_s(pai->filename, tszFileName, _TRUNCATE); + wcsncpy_s(pai->filename, tszFileName, _TRUNCATE); pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0); - if (::_taccess(pai->filename, 0) == 0) { + if (::_waccess(pai->filename, 0) == 0) { ptrA szSavedHash( getStringA(pai->hContact, "AvatarSaved")); if (szSavedHash != NULL && !mir_strcmp(szSavedHash, szHashValue)) { debugLogA("Avatar is Ok: %s == %s", szSavedHash, szHashValue); @@ -150,13 +150,13 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) if (item != NULL) { BOOL isXVcard = getByte(pai->hContact, "AvatarXVcard", 0); - TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0; + wchar_t szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0; if (item->arResources.getCount() != NULL && !isXVcard) - if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid)) + if (wchar_t *bestResName = ListGetBestClientResourceNamePtr(tszJid)) mir_sntprintf(szJid, L"%s/%s", tszJid, bestResName); if (szJid[0] == 0) - _tcsncpy_s(szJid, tszJid, _TRUNCATE); + wcsncpy_s(szJid, tszJid, _TRUNCATE); debugLog(L"Rereading %s for %s", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid); @@ -250,7 +250,7 @@ INT_PTR __cdecl CJabberProto::OnGetEventTextPresence(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) { - TCHAR *tszFileName = (TCHAR*)lParam; + wchar_t *tszFileName = (wchar_t*)lParam; if (m_bJabberOnline) { SetServerVcard(TRUE, tszFileName); @@ -258,7 +258,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) } else if (tszFileName == NULL || tszFileName[0] == 0) { // Remove avatar - TCHAR tFileName[ MAX_PATH ]; + wchar_t tFileName[ MAX_PATH ]; GetAvatarFileName(NULL, tFileName, MAX_PATH); DeleteFile(tFileName); @@ -266,7 +266,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) delSetting("AvatarHash"); } else { - int fileIn = _topen(tszFileName, O_RDWR | O_BINARY, S_IREAD | S_IWRITE); + int fileIn = _wopen(tszFileName, O_RDWR | O_BINARY, S_IREAD | S_IWRITE); if (fileIn == -1) { mir_free(tszFileName); return 1; @@ -289,7 +289,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) mir_sha1_append(&sha1ctx, (BYTE*)pResult, dwPngSize); mir_sha1_finish(&sha1ctx, digest); - TCHAR tFileName[MAX_PATH]; + wchar_t tFileName[MAX_PATH]; GetAvatarFileName(NULL, tFileName, MAX_PATH); DeleteFile(tFileName); @@ -299,7 +299,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) m_options.AvatarType = ProtoGetBufferFormat(pResult); GetAvatarFileName(NULL, tFileName, MAX_PATH); - FILE *out = _tfopen(tFileName, L"wb"); + FILE *out = _wfopen(tFileName, L"wb"); if (out != NULL) { fwrite(pResult, dwPngSize, 1, out); fclose(out); @@ -317,7 +317,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberSetNickname(WPARAM wParam, LPARAM lParam) { - TCHAR *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam); + wchar_t *nickname = (wParam & SMNN_UNICODE) ? mir_u2t((WCHAR*)lParam) : mir_a2t((char*)lParam); setTString("Nick", nickname); SetServerVcard(FALSE, L""); @@ -335,10 +335,10 @@ INT_PTR __cdecl CJabberProto::ServiceSendXML(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // "/GCGetToolTipText" - gets tooltip text -static const TCHAR *JabberEnum2AffilationStr[] = { LPGENT("None"), LPGENT("Outcast"), LPGENT("Member"), LPGENT("Admin"), LPGENT("Owner") }, - *JabberEnum2RoleStr[] = { LPGENT("None"), LPGENT("Visitor"), LPGENT("Participant"), LPGENT("Moderator") }; +static const wchar_t *JabberEnum2AffilationStr[] = { LPGENW("None"), LPGENW("Outcast"), LPGENW("Member"), LPGENW("Admin"), LPGENW("Owner") }, + *JabberEnum2RoleStr[] = { LPGENW("None"), LPGENW("Visitor"), LPGENW("Participant"), LPGENW("Moderator") }; -static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tszValue, CMString &out) +static void appendString(bool bIsTipper, const wchar_t *tszTitle, const wchar_t *tszValue, CMString &out) { if (!out.IsEmpty()) out.Append(bIsTipper ? L"\n" : L"\r\n"); @@ -346,7 +346,7 @@ static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tsz if (bIsTipper) out.AppendFormat(L"<b>%s</b>\t%s", TranslateTS(tszTitle), tszValue); else { - TCHAR *p = TranslateTS(tszTitle); + wchar_t *p = TranslateTS(tszTitle); out.AppendFormat(L"%s%s\t%s", p, mir_tstrlen(p) <= 7 ? L"\t" : L"", tszValue); } } @@ -356,11 +356,11 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara if (!wParam || !lParam) return 0; //room global tooltip not supported yet - JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, (TCHAR*)wParam); + JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, (wchar_t*)wParam); if (item == NULL) return 0; //no room found - pResourceStatus info( item->findResource((TCHAR*)lParam)); + pResourceStatus info( item->findResource((wchar_t*)lParam)); if (info == NULL) return 0; //no info found @@ -375,28 +375,28 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara //JID: CMString outBuf; - if (_tcschr(info->m_tszResourceName, _T('@')) != NULL) - appendString(bIsTipper, LPGENT("JID:"), info->m_tszResourceName, outBuf); + if (wcschr(info->m_tszResourceName, '@') != NULL) + appendString(bIsTipper, LPGENW("JID:"), info->m_tszResourceName, outBuf); else if (lParam) //or simple nick - appendString(bIsTipper, LPGENT("Nick:"), (TCHAR*)lParam, outBuf); + appendString(bIsTipper, LPGENW("Nick:"), (wchar_t*)lParam, outBuf); // status if (info->m_iStatus >= ID_STATUS_OFFLINE && info->m_iStatus <= ID_STATUS_IDLE ) - appendString(bIsTipper, LPGENT("Status:"), pcli->pfnGetStatusModeDescription(info->m_iStatus, 0), outBuf); + appendString(bIsTipper, LPGENW("Status:"), pcli->pfnGetStatusModeDescription(info->m_iStatus, 0), outBuf); // status text if (info->m_tszStatusMessage) - appendString(bIsTipper, LPGENT("Status message:"), info->m_tszStatusMessage, outBuf); + appendString(bIsTipper, LPGENW("Status message:"), info->m_tszStatusMessage, outBuf); // Role - appendString(bIsTipper, LPGENT("Role:"), TranslateTS(JabberEnum2RoleStr[info->m_role]), outBuf); + appendString(bIsTipper, LPGENW("Role:"), TranslateTS(JabberEnum2RoleStr[info->m_role]), outBuf); // Affiliation - appendString(bIsTipper, LPGENT("Affiliation:"), TranslateTS(JabberEnum2AffilationStr[info->m_affiliation]), outBuf); + appendString(bIsTipper, LPGENW("Affiliation:"), TranslateTS(JabberEnum2AffilationStr[info->m_affiliation]), outBuf); // real jid if (info->m_tszRealJid) - appendString(bIsTipper, LPGENT("Real JID:"), info->m_tszRealJid, outBuf); + appendString(bIsTipper, LPGENW("Real JID:"), info->m_tszRealJid, outBuf); return (outBuf.IsEmpty() ? NULL : (INT_PTR)mir_tstrdup(outBuf)); } @@ -404,32 +404,32 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara // File Association Manager plugin support INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) { - TCHAR *arg = (TCHAR *)lParam; + wchar_t *arg = (wchar_t *)lParam; if (arg == NULL) return 1; // skip leading prefix - TCHAR szUri[ 1024 ]; - _tcsncpy_s(szUri, arg, _TRUNCATE); - TCHAR *szJid = _tcschr(szUri, _T(':')); + wchar_t szUri[ 1024 ]; + wcsncpy_s(szUri, arg, _TRUNCATE); + wchar_t *szJid = wcschr(szUri, ':'); if (szJid == NULL) return 1; // skip // - for (++szJid; *szJid == _T('/'); ++szJid); + for (++szJid; *szJid == '/'; ++szJid); // empty jid? if (!*szJid) return 1; // command code - TCHAR *szCommand = szJid; - szCommand = _tcschr(szCommand, _T('?')); + wchar_t *szCommand = szJid; + szCommand = wcschr(szCommand, '?'); if (szCommand) *(szCommand++) = 0; // parameters - TCHAR *szSecondParam = szCommand ? _tcschr(szCommand, _T(';')) : NULL; + wchar_t *szSecondParam = szCommand ? wcschr(szCommand, ';') : NULL; if (szSecondParam) *(szSecondParam++) = 0; @@ -439,7 +439,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) if (!ServiceExists(MS_MSG_SENDMESSAGEW)) return 1; - TCHAR *szMsgBody = NULL; + wchar_t *szMsgBody = NULL; MCONTACT hContact = HContactFromJID(szJid, false); if (hContact == NULL) hContact = DBCreateContact(szJid, szJid, true, true); @@ -447,10 +447,10 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) return 1; if (szSecondParam) { //there are parameters to message - szMsgBody = _tcsstr(szSecondParam, L"body="); + szMsgBody = wcsstr(szSecondParam, L"body="); if (szMsgBody) { szMsgBody += 5; - TCHAR *szDelim = _tcschr(szMsgBody, _T(';')); + wchar_t *szDelim = wcschr(szMsgBody, ';'); if (szDelim) szDelim = 0; JabberHttpUrlDecode(szMsgBody); @@ -466,8 +466,8 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { 0 }; psr.cbSize = sizeof(psr); psr.flags = PSR_TCHAR; - psr.nick.t = szJid; - psr.id.t = szJid; + psr.nick.w = szJid; + psr.id.w = szJid; ADDCONTACTSTRUCT acs; acs.handleType = HANDLE_SEARCHRESULT; @@ -493,7 +493,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) // ad-hoc commands if (!mir_tstrcmpi(szCommand, L"command")) { if (szSecondParam) { - if (!_tcsnicmp(szSecondParam, L"node=", 5)) { + if (!wcsnicmp(szSecondParam, L"node=", 5)) { szSecondParam += 5; if (!*szSecondParam) szSecondParam = NULL; @@ -529,12 +529,12 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) if (jid == NULL) return 0; - TCHAR tszJid[JABBER_MAX_JID_LEN]; - TCHAR *szResource = ListGetBestClientResourceNamePtr(jid); + wchar_t tszJid[JABBER_MAX_JID_LEN]; + wchar_t *szResource = ListGetBestClientResourceNamePtr(jid); if (szResource) mir_sntprintf(tszJid, L"%s/%s", jid, szResource); else - _tcsncpy_s(tszJid, jid, _TRUNCATE); + wcsncpy_s(tszJid, jid, _TRUNCATE); m_ThreadInfo->send( XmlNode(L"message") << XATTR(L"type", L"headline") << XATTR(L"to", tszJid) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 328ada850e..074476651f 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -60,9 +60,9 @@ struct JabberPasswordDlgParam BOOL saveOnlinePassword; WORD dlgResult; - TCHAR onlinePassword[128]; + wchar_t onlinePassword[128]; HANDLE hEventPasswdDlg; - TCHAR *ptszJid; + wchar_t *ptszJid; }; static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -76,7 +76,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa param = (JabberPasswordDlgParam*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - TCHAR text[512]; + wchar_t text[512]; mir_sntprintf(text, TranslateT("Enter password for %s"), param->ptszJid); SetDlgItemText(hwndDlg, IDC_JID, text); @@ -246,7 +246,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) m_ThreadInfo = &info; if ((tszValue = getTStringA("LoginName")) != NULL) - _tcsncpy_s(info.conn.username, tszValue, _TRUNCATE); + wcsncpy_s(info.conn.username, tszValue, _TRUNCATE); if (*rtrimt(info.conn.username) == '\0') { DWORD dwSize = _countof(info.conn.username); @@ -283,20 +283,20 @@ LBL_FatalError: } else { if ((tszValue = getTStringA("Resource")) != NULL) - _tcsncpy_s(info.resource, tszValue, _TRUNCATE); + wcsncpy_s(info.resource, tszValue, _TRUNCATE); else mir_tstrcpy(info.resource, L"Miranda"); } - TCHAR jidStr[512]; + wchar_t jidStr[512]; mir_sntprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource); - _tcsncpy_s(info.fullJID, jidStr, _TRUNCATE); + wcsncpy_s(info.fullJID, jidStr, _TRUNCATE); if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password info.conn.password[0] = 0; else if (!m_options.SavePassword) { // we have to enter a password manually. have we done it before? if (m_savedPassword != NULL) - _tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE); + wcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE); else { mir_sntprintf(jidStr, L"%s@%S", info.conn.username, info.conn.server); @@ -315,7 +315,7 @@ LBL_FatalError: } m_savedPassword = (param.saveOnlinePassword) ? mir_tstrdup(param.onlinePassword) : NULL; - _tcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE); + wcsncpy_s(info.conn.password, param.onlinePassword, _TRUNCATE); } } else { @@ -325,7 +325,7 @@ LBL_FatalError: debugLogA("Thread ended, password is not configured"); goto LBL_FatalError; } - _tcsncpy_s(info.conn.password, tszPassw, _TRUNCATE); + wcsncpy_s(info.conn.password, tszPassw, _TRUNCATE); } } else { @@ -391,7 +391,7 @@ LBL_FatalError: if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) { if (!info.bIsReg) { size_t len = mir_tstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1; - m_szJabberJID = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len + 1)); + m_szJabberJID = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1)); mir_sntprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server); m_bSendKeepAlive = m_options.KeepAlive != 0; setTString("jid", m_szJabberJID); // store jid in database @@ -400,7 +400,7 @@ LBL_FatalError: } xmlStreamInitializeNow(&info); - const TCHAR *tag = L"stream:stream"; + const wchar_t *tag = L"stream:stream"; debugLogA("Entering main recv loop"); int datalen = 0; @@ -573,7 +573,7 @@ void CJabberProto::OnProcessStreamOpening(HXML node, ThreadData *info) return; if (!info->bIsReg) { - const TCHAR *sid = XmlGetAttrValue(node, L"id"); + const wchar_t *sid = XmlGetAttrValue(node, L"id"); if (sid != NULL) info->szStreamId = mir_t2a(sid); } @@ -653,7 +653,7 @@ void CJabberProto::PerformAuthentication(ThreadData *info) return; } - TCHAR text[1024]; + wchar_t text[1024]; mir_sntprintf(text, TranslateT("Authentication failed for %s@%S."), info->conn.username, info->conn.server); MsgPopup(NULL, text, TranslateT("Jabber Authentication")); JLoginFailed(LOGINERR_WRONGPASSWORD); @@ -731,7 +731,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) else if (!mir_tstrcmp(ptszMechanism, L"GSSAPI")) m_AuthMechs.isKerberosAvailable = true; } else if (!mir_tstrcmp(XmlGetName(c), L"hostname")) { - const TCHAR *mech = XmlGetAttrValue(c, L"mechanism"); + const wchar_t *mech = XmlGetAttrValue(c, L"mechanism"); if (mech && mir_tstrcmpi(mech, L"GSSAPI") == 0) { m_AuthMechs.m_gssapiHostName = mir_tstrdup(XmlGetText(c)); } @@ -770,7 +770,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) { - const TCHAR *type; + const wchar_t *type; //failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" if ((type = XmlGetAttrValue(node, L"xmlns")) == NULL) return; if (!mir_tstrcmp(type, L"urn:ietf:params:xml:ns:xmpp-sasl")) { @@ -780,7 +780,7 @@ void CJabberProto::OnProcessFailure(HXML node, ThreadData *info) void CJabberProto::OnProcessError(HXML node, ThreadData *info) { - TCHAR *buff; + wchar_t *buff; int i; int pos; bool skipMsg = false; @@ -789,15 +789,15 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) if (!XmlGetChild(node, 0)) return; - buff = (TCHAR *)mir_alloc(1024 * sizeof(TCHAR)); + buff = (wchar_t *)mir_alloc(1024 * sizeof(wchar_t)); pos = 0; for (i = 0;; i++) { HXML n = XmlGetChild(node, i); if (!n) break; - const TCHAR *name = XmlGetName(n); - const TCHAR *desc = XmlGetText(n); + const wchar_t *name = XmlGetName(n); + const wchar_t *desc = XmlGetText(n); if (desc) pos += mir_sntprintf(buff + pos, 1024 - pos, L"%s: %s\r\n", name, desc); else @@ -816,7 +816,7 @@ void CJabberProto::OnProcessError(HXML node, ThreadData *info) void CJabberProto::OnProcessSuccess(HXML node, ThreadData *info) { - const TCHAR *type; + const wchar_t *type; // int iqId; // RECVED: <success ... // ACTION: if successfully logged in, continue by requesting roster list and set my initial status @@ -894,7 +894,7 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData *info) void CJabberProto::OnProcessProceed(HXML node, ThreadData *info) { - const TCHAR *type; + const wchar_t *type; if ((type = XmlGetAttrValue(node, L"xmlns")) != NULL && !mir_tstrcmp(type, L"error")) return; @@ -922,7 +922,7 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) { debugLogA("Compression confirmed"); - const TCHAR *type = XmlGetAttrValue(node, L"xmlns"); + const wchar_t *type = XmlGetAttrValue(node, L"xmlns"); if (type != NULL && !mir_tstrcmp(type, L"error")) return; if (mir_tstrcmp(type, L"http://jabber.org/protocol/compress")) @@ -938,7 +938,7 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData *info) void CJabberProto::OnProcessPubsubEvent(HXML node) { - const TCHAR *from = XmlGetAttrValue(node, L"from"); + const wchar_t *from = XmlGetAttrValue(node, L"from"); if (!from) return; @@ -964,16 +964,16 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) if (!tuneNode) return; - const TCHAR *szArtist = XPathT(tuneNode, "artist"); - const TCHAR *szLength = XPathT(tuneNode, "length"); - const TCHAR *szSource = XPathT(tuneNode, "source"); - const TCHAR *szTitle = XPathT(tuneNode, "title"); - const TCHAR *szTrack = XPathT(tuneNode, "track"); + const wchar_t *szArtist = XPathT(tuneNode, "artist"); + const wchar_t *szLength = XPathT(tuneNode, "length"); + const wchar_t *szSource = XPathT(tuneNode, "source"); + const wchar_t *szTitle = XPathT(tuneNode, "title"); + const wchar_t *szTrack = XPathT(tuneNode, "track"); - TCHAR szLengthInTime[32]; + wchar_t szLengthInTime[32]; szLengthInTime[0] = 0; if (szLength) { - int nLength = _ttoi(szLength); + int nLength = _wtoi(szLength); mir_sntprintf(szLengthInTime, L"%02d:%02d:%02d", nLength / 3600, (nLength / 60) % 60, nLength % 60); } @@ -1003,12 +1003,12 @@ DWORD JabberGetLastContactMessageTime(MCONTACT hContact) return dwTime; } -MCONTACT CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem) +MCONTACT CJabberProto::CreateTemporaryContact(const wchar_t *szJid, JABBER_LIST_ITEM* chatItem) { if (chatItem == NULL) return DBCreateContact(szJid, ptrT(JabberNickFromJID(szJid)), true, true); - const TCHAR *p = _tcschr(szJid, '/'); + const wchar_t *p = wcschr(szJid, '/'); if (p != NULL && p[1] != '\0') p++; else @@ -1058,7 +1058,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) return; } - const TCHAR *szMessage = NULL; + const wchar_t *szMessage = NULL; HXML bodyNode = XmlGetChildByTag(node, "body", "xml:lang", m_tszSelectedLang); if (bodyNode == NULL) bodyNode = XmlGetChild(node, "body"); @@ -1068,7 +1068,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszSubject = XmlGetText(XmlGetChild(node, "subject")); if (ptszSubject && *ptszSubject) { size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszSubject) + 128; - TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen); + wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t) * cbLen); szTmp[0] = 0; if (szMessage) mir_tstrcat(szTmp, L"Subject: "); @@ -1083,10 +1083,10 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (szMessage && (n = XmlGetChildByTag(node, "addresses", "xmlns", JABBER_FEAT_EXT_ADDRESSING))) { HXML addressNode = XmlGetChildByTag(n, "address", "type", L"ofrom"); if (addressNode) { - const TCHAR *szJid = XmlGetAttrValue(addressNode, L"jid"); + const wchar_t *szJid = XmlGetAttrValue(addressNode, L"jid"); if (szJid) { size_t cbLen = mir_tstrlen(szMessage) + 1000; - TCHAR *p = (TCHAR*)alloca(sizeof(TCHAR) * cbLen); + wchar_t *p = (wchar_t*)alloca(sizeof(wchar_t) * cbLen); mir_sntprintf(p, cbLen, TranslateT("Message redirected from: %s\r\n%s"), from, szMessage); szMessage = p; from = szJid; @@ -1103,10 +1103,10 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) time_t msgTime = 0; bool isChatRoomInvitation = false; - const TCHAR *inviteRoomJid = NULL; - const TCHAR *inviteFromJid = NULL; - const TCHAR *inviteReason = NULL; - const TCHAR *invitePassword = NULL; + const wchar_t *inviteRoomJid = NULL; + const wchar_t *inviteFromJid = NULL; + const wchar_t *inviteReason = NULL; + const wchar_t *invitePassword = NULL; bool isDelivered = false; // check chatstates availability @@ -1161,9 +1161,9 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) } if ((n = XmlGetChildByTag(node, "confirm", "xmlns", JABBER_FEAT_HTTP_AUTH)) && m_options.AcceptHttpAuth) { - const TCHAR *szId = XmlGetAttrValue(n, L"id"); - const TCHAR *szMethod = XmlGetAttrValue(n, L"method"); - const TCHAR *szUrl = XmlGetAttrValue(n, L"url"); + const wchar_t *szId = XmlGetAttrValue(n, L"id"); + const wchar_t *szMethod = XmlGetAttrValue(n, L"method"); + const wchar_t *szUrl = XmlGetAttrValue(n, L"url"); if (!szId || !szMethod || !szUrl) return; @@ -1190,7 +1190,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if ((xNode = XmlGetNthChild(node, L"x", i + 1)) == NULL) continue; - const TCHAR *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns"); + const wchar_t *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns"); if (ptszXmlns == NULL) continue; @@ -1205,29 +1205,29 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) //XEP-0027 is not strict enough, different clients have different implementations //additional validation is required - TCHAR *prolog = L"-----BEGIN PGP MESSAGE-----"; - TCHAR *prolog_newline = L"\r\n\r\n"; - TCHAR *epilog = L"\r\n-----END PGP MESSAGE-----\r\n"; + wchar_t *prolog = L"-----BEGIN PGP MESSAGE-----"; + wchar_t *prolog_newline = L"\r\n\r\n"; + wchar_t *epilog = L"\r\n-----END PGP MESSAGE-----\r\n"; size_t len = 0; - TCHAR *tempstring = nullptr; - if(!_tcsstr(ptszText, prolog)) + wchar_t *tempstring = nullptr; + if(!wcsstr(ptszText, prolog)) { len = mir_tstrlen(prolog) + mir_tstrlen(prolog_newline) + mir_tstrlen(ptszText) + mir_tstrlen(epilog) + 3; - tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len); + tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len); mir_sntprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog); } else { len = mir_tstrlen(ptszText) + 3; - tempstring = (TCHAR*)_alloca(sizeof(TCHAR)*len); + tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len); mir_sntprintf(tempstring, len, L"%s", ptszText); } szMessage = tempstring; } else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) { - const TCHAR *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp"); + const wchar_t *ptszTimeStamp = XmlGetAttrValue(xNode, L"stamp"); if (ptszTimeStamp != NULL) msgTime = JabberIsoToUnixTime(ptszTimeStamp); } @@ -1246,8 +1246,8 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (XmlGetChild(xNode, "delivered") != NULL || XmlGetChild(xNode, "offline") != NULL) { int id = -1; if (idNode != NULL && XmlGetText(idNode) != NULL) - if (!_tcsncmp(XmlGetText(idNode), _T(JABBER_IQID), mir_strlen(JABBER_IQID))) - id = _ttoi((XmlGetText(idNode)) + mir_strlen(JABBER_IQID)); + if (!wcsncmp(XmlGetText(idNode), _T(JABBER_IQID), mir_strlen(JABBER_IQID))) + id = _wtoi((XmlGetText(idNode)) + mir_strlen(JABBER_IQID)); if (id != -1) ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)id, 0); @@ -1283,7 +1283,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) LPCTSTR ptszUrl = XmlGetText(XmlGetChild(xNode, "url")); if (ptszUrl != NULL && *ptszUrl) { size_t cbLen = (szMessage ? mir_tstrlen(szMessage) : 0) + mir_tstrlen(ptszUrl) + 32; - TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR)* cbLen); + wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t)* cbLen); mir_tstrcpy(szTmp, ptszUrl); if (szMessage) { mir_tstrcat(szTmp, L"\r\n"); @@ -1306,18 +1306,18 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) } else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) && item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) { - TCHAR chkJID[JABBER_MAX_JID_LEN] = L"@"; + wchar_t chkJID[JABBER_MAX_JID_LEN] = L"@"; JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1); for (int j = 1;; j++) { HXML iNode = XmlGetNthChild(xNode, L"item", j); if (iNode == NULL) break; - const TCHAR *action = XmlGetAttrValue(iNode, L"action"); - const TCHAR *jid = XmlGetAttrValue(iNode, L"jid"); - const TCHAR *nick = XmlGetAttrValue(iNode, L"name"); - const TCHAR *group = XmlGetText(XmlGetChild(iNode, L"group")); - if (action && jid && _tcsstr(jid, chkJID)) { + const wchar_t *action = XmlGetAttrValue(iNode, L"action"); + const wchar_t *jid = XmlGetAttrValue(iNode, L"jid"); + const wchar_t *nick = XmlGetAttrValue(iNode, L"name"); + const wchar_t *group = XmlGetText(XmlGetChild(iNode, L"group")); + if (action && jid && wcsstr(jid, chkJID)) { if (!mir_tstrcmp(action, L"add")) { MCONTACT cc = DBCreateContact(jid, nick, false, false); if (group) @@ -1403,7 +1403,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) // XEP-0115: Entity Capabilities void CJabberProto::OnProcessPresenceCapabilites(HXML node) { - const TCHAR *from = XmlGetAttrValue(node, L"from"); + const wchar_t *from = XmlGetAttrValue(node, L"from"); if (from == NULL) return; @@ -1418,9 +1418,9 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) if ((n = XmlGetChildByTag(node, "c", "xmlns", JABBER_FEAT_ENTITY_CAPS)) != NULL || (n = XmlGetChild(node, "c")) != NULL) { - const TCHAR *szNode = XmlGetAttrValue(n, L"node"); - const TCHAR *szVer = XmlGetAttrValue(n, L"ver"); - const TCHAR *szExt = XmlGetAttrValue(n, L"ext"); + const wchar_t *szNode = XmlGetAttrValue(n, L"node"); + const wchar_t *szVer = XmlGetAttrValue(n, L"ver"); + const wchar_t *szExt = XmlGetAttrValue(n, L"ext"); if (szNode && szVer) { r->m_tszCapsNode = mir_tstrdup(szNode); r->m_tszCapsVer = mir_tstrdup(szVer); @@ -1435,7 +1435,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) // JabberCapsBits jcbCaps = GetResourceCapabilites(from, TRUE); } -void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) +void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); if (item == NULL) return; @@ -1446,7 +1446,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) int status = ID_STATUS_OFFLINE; if (!item->arResources.getCount()) { // set offline only if jid has resources - if (_tcschr(jid, '/') == NULL) + if (wcschr(jid, '/') == NULL) status = item->getTemp()->m_iStatus; if (item->getTemp()->m_tszStatusMessage) db_set_ts(hContact, "CList", "StatusMsg", item->getTemp()->m_tszStatusMessage); @@ -1481,7 +1481,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) } else delSetting(hContact, DBSETTING_DISPLAY_UID); - if (_tcschr(jid, '@') != NULL || m_options.ShowTransport == TRUE) + if (wcschr(jid, '@') != NULL || m_options.ShowTransport == TRUE) if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != status) setWord(hContact, "Status", (WORD)status); @@ -1514,9 +1514,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) MCONTACT hContact; bool bSelfPresence = false; - TCHAR szBareFrom[JABBER_MAX_JID_LEN]; + wchar_t szBareFrom[JABBER_MAX_JID_LEN]; JabberStripJid(from, szBareFrom, _countof(szBareFrom)); - TCHAR szBareOurJid[JABBER_MAX_JID_LEN]; + wchar_t szBareOurJid[JABBER_MAX_JID_LEN]; JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid)); if (!mir_tstrcmpi(szBareFrom, szBareOurJid)) @@ -1552,7 +1552,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) char priority = 0; if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority"))) - priority = (char)_ttoi(ptszPriority); + priority = (char)_wtoi(ptszPriority); ListAddResource(LIST_ROSTER, from, status, XmlGetText(XmlGetChild(node, "status")), priority); @@ -1561,7 +1561,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) UpdateJidDbSettings(from); - if (_tcschr(from, '@') == NULL) { + if (wcschr(from, '@') == NULL) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } debugLog(L"%s (%s) online, set contact status to %s", nick, from, pcli->pfnGetStatusModeDescription(status, 0)); @@ -1643,7 +1643,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) UpdateJidDbSettings(from); - if (_tcschr(from, '@') == NULL) + if (wcschr(from, '@') == NULL) UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); DBCheckIsTransportedContact(from, hContact); @@ -1665,7 +1665,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) } // automatically send authorization allowed to agent/transport - if (_tcschr(from, '@') == NULL || m_options.AutoAcceptAuthorization) { + if (wcschr(from, '@') == NULL || m_options.AutoAcceptAuthorization) { ListAdd(LIST_ROSTER, from, hContact); info->send(XmlNode(L"presence") << XATTR(L"to", from) << XATTR(L"type", L"subscribed")); @@ -1710,7 +1710,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (item->subscription == SUB_FROM) item->subscription = SUB_BOTH; else if (item->subscription == SUB_NONE) { item->subscription = SUB_TO; - if (_tcschr(from, '@') == NULL) { + if (wcschr(from, '@') == NULL) { UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH); } } @@ -1799,7 +1799,7 @@ BOOL CJabberProto::OnProcessJingle(HXML node) void CJabberProto::OnProcessIq(HXML node) { HXML queryNode; - const TCHAR *type, *xmlns; + const wchar_t *type, *xmlns; if (!XmlGetName(node) || mir_tstrcmp(XmlGetName(node), L"iq")) return; if ((type = XmlGetAttrValue(node, L"type")) == NULL) return; @@ -1823,8 +1823,8 @@ void CJabberProto::OnProcessIq(HXML node) // RECVED: <iq type='error'> ... if (!mir_tstrcmp(type, L"error")) { - TCHAR tszBuf[20]; - _itot(id, tszBuf, 10); + wchar_t tszBuf[20]; + _itow(id, tszBuf, 10); debugLogA("XXX on entry"); // Check for file transfer deny by comparing idStr with ft->iqId @@ -1856,9 +1856,9 @@ ThreadData *m_regInfo; void CJabberProto::SetRegConfig(HXML node, void *from) { if (m_regInfo && from) { - TCHAR text[MAX_PATH]; + wchar_t text[MAX_PATH]; mir_sntprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server); - XmlNodeIq iq(L"set", SerialNext(), (TCHAR*)from); + XmlNodeIq iq(L"set", SerialNext(), (wchar_t*)from); iq << XATTR(L"from", text); HXML query = iq << XQUERY(JABBER_FEAT_REGISTER); XmlAddChild(query, node); @@ -1918,7 +1918,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) } else if (!mir_tstrcmp(type, L"error")) { - TCHAR *str = JabberErrorMsg(XmlGetChild(node, "error")); + wchar_t *str = JabberErrorMsg(XmlGetChild(node, "error")); SendMessage(info->conn.reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str); mir_free(str); info->reg_done = TRUE; @@ -2025,11 +2025,11 @@ int ThreadData::send(HXML node) proto->OnConsoleProcessXml(node, JCPF_OUT); - TCHAR *str = xmlToString(node, NULL); + wchar_t *str = xmlToString(node, NULL); // strip forbidden control characters from outgoing XML stream - TCHAR *q = str; - for (TCHAR *p = str; *p; ++p) { + wchar_t *q = str; + for (wchar_t *p = str; *p; ++p) { WCHAR c = *p; if (c < 32 && c != '\t' && c != '\n' && c != '\r') diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index 33d0acf232..c3d2bdb878 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -41,7 +41,7 @@ struct TTreeList_ItemInfo struct TTreeList_ItemInfo *parent; int iIcon, iOverlay; - LIST<TCHAR> text; + LIST<wchar_t> text; LPARAM data; LIST<TTreeList_ItemInfo> subItems; @@ -61,7 +61,7 @@ struct TTreeList_ItemInfo struct TTreeList_Data { int mode, sortMode; - TCHAR *filter; + wchar_t *filter; HTREELISTITEM hItemSelected; TTreeList_ItemInfo *root; @@ -178,7 +178,7 @@ void TreeList_SetSortMode(HWND hwnd, int col, BOOL descending) TreeList_Update(hwnd); } -void TreeList_SetFilter(HWND hwnd, TCHAR *filter) +void TreeList_SetFilter(HWND hwnd, wchar_t *filter) { TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd); if (data->filter) mir_free(data->filter); @@ -199,7 +199,7 @@ HTREELISTITEM TreeList_GetActiveItem(HWND hwnd) return (HTREELISTITEM)lvi.lParam; } -HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, TCHAR *text, LPARAM nodeDdata) +HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, LPARAM nodeDdata) { TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd); if (!hParent) hParent = data->root; @@ -239,7 +239,7 @@ void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag) hItem->flags |= TLIF_MODIFIED; } -void TreeList_AppendColumn(HTREELISTITEM hItem, TCHAR *text) +void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text) { hItem->text.insert(mir_tstrdup(text)); hItem->flags |= TLIF_MODIFIED; @@ -509,7 +509,7 @@ static void sttTreeList_FilterItems(HTREELISTITEM hItem, LPARAM data) { int i = 0; for (i=0; i < hItem->text.getCount(); i++) - if (JabberStrIStr(hItem->text[i], (TCHAR *)data)) + if (JabberStrIStr(hItem->text[i], (wchar_t *)data)) break; if (i < hItem->text.getCount()) { diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index a4f11912b4..6b0907a7b3 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -37,28 +37,28 @@ struct UserInfoStringBuf { enum { STRINGBUF_INCREMENT = 1024 }; - TCHAR *buf; + wchar_t *buf; size_t size, offset; UserInfoStringBuf() { buf = 0; size = 0; offset = 0; } ~UserInfoStringBuf() { mir_free(buf); } - void append(TCHAR *str) { + void append(wchar_t *str) { if (!str) return; size_t length = mir_tstrlen(str); if (size - offset < length + 1) { size += (length + STRINGBUF_INCREMENT); - buf = (TCHAR *)mir_realloc(buf, size * sizeof(TCHAR)); + buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } mir_tstrcpy(buf + offset, str); offset += length; } - TCHAR* allocate(int length) { + wchar_t* allocate(int length) { if (size - offset < length) { size += (length + STRINGBUF_INCREMENT); - buf = (TCHAR *)mir_realloc(buf, size * sizeof(TCHAR)); + buf = (wchar_t *)mir_realloc(buf, size * sizeof(wchar_t)); } return buf + offset; } @@ -168,11 +168,11 @@ void sttCleanupInfo(HWND hwndTree, int stage) } } -static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, TCHAR *title, TCHAR *value, LPARAM id=INFOLINE_BAD_ID, bool expand=false) +static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, wchar_t *title, wchar_t *value, LPARAM id=INFOLINE_BAD_ID, bool expand=false) { HTREEITEM hti = sttFindInfoLine(hwndTree, htiRoot, id); - TCHAR buf[256]; + wchar_t buf[256]; if (title) mir_sntprintf(buf, L"%s: %s", title, value); else @@ -210,7 +210,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, JABBER_LIST_ITEM *item, int resource) { - TCHAR buf[256]; + wchar_t buf[256]; HTREEITEM htiResource = htiRoot; pResourceStatus r = resource ? item->arResources[resource-1] : item->getTemp(); @@ -250,13 +250,13 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttInfoLineId(resource, INFOLINE_SYSTEM)); // Resource priority - TCHAR szPriority[128]; + wchar_t szPriority[128]; mir_sntprintf(szPriority, L"%d", (int)r->m_iPriority); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY)); // Idle if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); + mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; @@ -277,21 +277,21 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti int i; for (i=0; g_JabberFeatCapPairs[i].szFeature; i++) if (jcb & g_JabberFeatCapPairs[i].jcbCap) { - TCHAR szDescription[ 1024 ]; + wchar_t szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else - _tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); + wcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } for (int j = 0; j < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); j++, i++) if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { - TCHAR szDescription[ 1024 ]; + wchar_t szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) mir_sntprintf(szDescription, L"%s (%s)", TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else - _tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); + wcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); } } @@ -311,18 +311,18 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Miranda core version"), r->m_tszXMirandaCoreVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); } -static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, MCONTACT hContact, TCHAR *szTitle, char *pszSlot) +static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, MCONTACT hContact, wchar_t *szTitle, char *pszSlot) { char *szAdvStatusIcon = ppro->ReadAdvStatusA(hContact, pszSlot, ADVSTATUS_VAL_ICON); - TCHAR *szAdvStatusTitle = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TITLE); - TCHAR *szAdvStatusText = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TEXT); + wchar_t *szAdvStatusTitle = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TITLE); + wchar_t *szAdvStatusText = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TEXT); if (szAdvStatusIcon && szAdvStatusTitle && *szAdvStatusTitle) { - TCHAR szText[2048]; + wchar_t szText[2048]; if (szAdvStatusText && *szAdvStatusText) mir_sntprintf(szText, L"%s (%s)", TranslateTS(szAdvStatusTitle), szAdvStatusText); else - _tcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); + wcsncpy_s(szText, TranslateTS(szAdvStatusTitle), _TRUNCATE); sttFillInfoLine(hwndTree, htiRoot, IcoLib_GetIcon(szAdvStatusIcon), szTitle, szText, dwInfoLine); } @@ -338,7 +338,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM sttCleanupInfo(hwndTree, 0); HTREEITEM htiRoot = sttFillInfoLine(hwndTree, NULL, ppro->LoadIconEx("main"), L"JID", item->jid, sttInfoLineId(0, INFOLINE_NAME), true); - TCHAR buf[256]; + wchar_t buf[256]; if (MCONTACT hContact = ppro->HContactFromJID(item->jid)) { sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_MOOD), hContact, TranslateT("Mood"), ADVSTATUS_MOOD); @@ -365,7 +365,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // logoff JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); + mir_tstrncpy(buf, _wctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; @@ -376,7 +376,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, - (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, + (item->jid && wcschr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, sttInfoLineId(0, INFOLINE_LOGOFF)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Logoff message"), @@ -396,7 +396,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM for (int i=0; i < item->arResources.getCount(); i++) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, i+1); } - else if (!_tcschr(item->jid, _T('@')) || (r->m_iStatus != ID_STATUS_OFFLINE)) + else if (!wcschr(item->jid, '@') || (r->m_iStatus != ID_STATUS_OFFLINE)) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, 0); sttCleanupInfo(hwndTree, 1); @@ -532,14 +532,14 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa JabberCopyText(hwndDlg, buf.buf); } else if (nReturnCmd == 2) { - TCHAR szBuffer[1024]; + wchar_t szBuffer[1024]; TVITEMEX tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; tvi.hItem = hItem; tvi.cchTextMax = _countof(szBuffer); tvi.pszText = szBuffer; if (TreeView_GetItem(hwndTree, &tvi)) { - if (TCHAR *str = _tcsstr(szBuffer, L": ")) + if (wchar_t *str = wcsstr(szBuffer, L": ")) JabberCopyText(hwndDlg, str + 2); else JabberCopyText(hwndDlg, szBuffer); @@ -664,7 +664,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_SAVE: - static TCHAR szFilter[512]; + static wchar_t szFilter[512]; ptrT jid(photoInfo->ppro->getTStringA(photoInfo->hContact, "jid")); if (jid == NULL) @@ -692,7 +692,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP mir_sntprintf(szFilter, L"%s (*.*)%c*.*", TranslateT("Unknown format"), 0); } - TCHAR szFileName[MAX_PATH]; szFileName[0] = '\0'; + wchar_t szFileName[MAX_PATH]; szFileName[0] = '\0'; OPENFILENAME ofn = { 0 }; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index e4da6b2df3..610790fe63 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -34,7 +34,7 @@ int CJabberProto::SerialNext(void) /////////////////////////////////////////////////////////////////////////////// // JabberChatRoomHContactFromJID - looks for the char room MCONTACT with required JID -MCONTACT CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) +MCONTACT CJabberProto::ChatRoomHContactFromJID(const wchar_t *jid) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid); if (item != NULL && item->hContact) @@ -46,7 +46,7 @@ MCONTACT CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) /////////////////////////////////////////////////////////////////////////////// // JabberHContactFromJID - looks for the MCONTACT with required JID -MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource) +MCONTACT CJabberProto::HContactFromJID(const wchar_t *jid, bool bStripResource) { if (jid == NULL) return NULL; @@ -56,7 +56,7 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource) return item->hContact; if (bStripResource) { - TCHAR szJid[JABBER_MAX_JID_LEN]; + wchar_t szJid[JABBER_MAX_JID_LEN]; JabberStripJid(jid, szJid, _countof(szJid)); item = ListGetItemPtr(LIST_ROSTER, szJid); if (item != NULL && item->hContact) @@ -66,19 +66,19 @@ MCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, bool bStripResource) return NULL; } -TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid) +wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid) { if (jid == NULL) return mir_tstrdup(L""); - const TCHAR *p = _tcschr(jid, '@'); + const wchar_t *p = wcschr(jid, '@'); if (p == NULL) - p = _tcschr(jid, '/'); + p = wcschr(jid, '/'); return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid); } -pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid) +pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid) { if (jid == NULL) return NULL; @@ -89,22 +89,22 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid) if (item == NULL) return NULL; - const TCHAR *p = _tcschr(jid, '/'); + const wchar_t *p = wcschr(jid, '/'); if (p == NULL) return item->getTemp(); return item->findResource(p + 1); } -TCHAR* JabberPrepareJid(LPCTSTR jid) +wchar_t* JabberPrepareJid(LPCTSTR jid) { if (jid == NULL) return NULL; - TCHAR *szNewJid = mir_tstrdup(jid); + wchar_t *szNewJid = mir_tstrdup(jid); if (!szNewJid) return NULL; - TCHAR *pDelimiter = _tcschr(szNewJid, _T('/')); + wchar_t *pDelimiter = wcschr(szNewJid, '/'); if (pDelimiter) *pDelimiter = 0; CharLower(szNewJid); - if (pDelimiter) *pDelimiter = _T('/'); + if (pDelimiter) *pDelimiter = '/'; return szNewJid; } @@ -142,46 +142,46 @@ char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf) return buf; } -TCHAR* __stdcall JabberStrFixLines(const TCHAR *str) +wchar_t* __stdcall JabberStrFixLines(const wchar_t *str) { if (str == NULL) return NULL; - const TCHAR *p; + const wchar_t *p; int add = 0; bool prev_r = false; bool prev_n = false; for (p = str; p && *p; ++p) - if (*p == _T('\r') || *p == _T('\n')) + if (*p == '\r' || *p == '\n') ++add; - TCHAR *buf = (TCHAR *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(TCHAR)); - TCHAR *res = buf; + wchar_t *buf = (wchar_t *)mir_alloc((mir_tstrlen(str) + add + 1) * sizeof(wchar_t)); + wchar_t *res = buf; for (p = str; p && *p; ++p) { - if (*p == _T('\n') && !prev_r) - *res++ = _T('\r'); - if (*p != _T('\r') && *p != _T('\n') && prev_r) - *res++ = _T('\n'); + if (*p == '\n' && !prev_r) + *res++ = '\r'; + if (*p != '\r' && *p != '\n' && prev_r) + *res++ = '\n'; *res++ = *p; - prev_r = *p == _T('\r'); - prev_n = *p == _T('\n'); + prev_r = *p == '\r'; + prev_n = *p == '\n'; } *res = 0; return buf; } -void __stdcall JabberHttpUrlDecode(TCHAR *str) +void __stdcall JabberHttpUrlDecode(wchar_t *str) { - TCHAR *p, *q; + wchar_t *p, *q; unsigned int code; if (str == NULL) return; - for (p = q = (TCHAR*)str; *p != '\0'; p++, q++) { + for (p = q = (wchar_t*)str; *p != '\0'; p++, q++) { if (*p == '%' && *(p + 1) != '\0' && isxdigit(*(p + 1)) && *(p + 2) != '\0' && isxdigit(*(p + 2))) { - _stscanf((TCHAR*)p + 1, L"%2x", &code); + swscanf((wchar_t*)p + 1, L"%2x", &code); *q = (unsigned char)code; p += 2; } @@ -222,29 +222,29 @@ int __stdcall JabberCombineStatus(int status1, int status2) struct tagErrorCodeToStr { int code; - TCHAR *str; + wchar_t *str; } static JabberErrorCodeToStrMapping[] = { - { JABBER_ERROR_REDIRECT, LPGENT("Redirect") }, - { JABBER_ERROR_BAD_REQUEST, LPGENT("Bad request") }, - { JABBER_ERROR_UNAUTHORIZED, LPGENT("Unauthorized") }, - { JABBER_ERROR_PAYMENT_REQUIRED, LPGENT("Payment required") }, - { JABBER_ERROR_FORBIDDEN, LPGENT("Forbidden") }, - { JABBER_ERROR_NOT_FOUND, LPGENT("Not found") }, - { JABBER_ERROR_NOT_ALLOWED, LPGENT("Not allowed") }, - { JABBER_ERROR_NOT_ACCEPTABLE, LPGENT("Not acceptable") }, - { JABBER_ERROR_REGISTRATION_REQUIRED, LPGENT("Registration required") }, - { JABBER_ERROR_REQUEST_TIMEOUT, LPGENT("Request timeout") }, - { JABBER_ERROR_CONFLICT, LPGENT("Conflict") }, - { JABBER_ERROR_INTERNAL_SERVER_ERROR, LPGENT("Internal server error") }, - { JABBER_ERROR_NOT_IMPLEMENTED, LPGENT("Not implemented") }, - { JABBER_ERROR_REMOTE_SERVER_ERROR, LPGENT("Remote server error") }, - { JABBER_ERROR_SERVICE_UNAVAILABLE, LPGENT("Service unavailable") }, - { JABBER_ERROR_REMOTE_SERVER_TIMEOUT, LPGENT("Remote server timeout") }, - { -1, LPGENT("Unknown error") } + { JABBER_ERROR_REDIRECT, LPGENW("Redirect") }, + { JABBER_ERROR_BAD_REQUEST, LPGENW("Bad request") }, + { JABBER_ERROR_UNAUTHORIZED, LPGENW("Unauthorized") }, + { JABBER_ERROR_PAYMENT_REQUIRED, LPGENW("Payment required") }, + { JABBER_ERROR_FORBIDDEN, LPGENW("Forbidden") }, + { JABBER_ERROR_NOT_FOUND, LPGENW("Not found") }, + { JABBER_ERROR_NOT_ALLOWED, LPGENW("Not allowed") }, + { JABBER_ERROR_NOT_ACCEPTABLE, LPGENW("Not acceptable") }, + { JABBER_ERROR_REGISTRATION_REQUIRED, LPGENW("Registration required") }, + { JABBER_ERROR_REQUEST_TIMEOUT, LPGENW("Request timeout") }, + { JABBER_ERROR_CONFLICT, LPGENW("Conflict") }, + { JABBER_ERROR_INTERNAL_SERVER_ERROR, LPGENW("Internal server error") }, + { JABBER_ERROR_NOT_IMPLEMENTED, LPGENW("Not implemented") }, + { JABBER_ERROR_REMOTE_SERVER_ERROR, LPGENW("Remote server error") }, + { JABBER_ERROR_SERVICE_UNAVAILABLE, LPGENW("Service unavailable") }, + { JABBER_ERROR_REMOTE_SERVER_TIMEOUT, LPGENW("Remote server timeout") }, + { -1, LPGENW("Unknown error") } }; -TCHAR* __stdcall JabberErrorStr(int errorCode) +wchar_t* __stdcall JabberErrorStr(int errorCode) { int i; @@ -252,9 +252,9 @@ TCHAR* __stdcall JabberErrorStr(int errorCode) return JabberErrorCodeToStrMapping[i].str; } -TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) +wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) { - TCHAR *errorStr = (TCHAR*)mir_alloc(256 * sizeof(TCHAR)); + wchar_t *errorStr = (wchar_t*)mir_alloc(256 * sizeof(wchar_t)); if (errorNode == NULL) { if (pErrorCode) *pErrorCode = -1; @@ -263,9 +263,9 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) } int errorCode = -1; - const TCHAR *str = XmlGetAttrValue(errorNode, L"code"); + const wchar_t *str = XmlGetAttrValue(errorNode, L"code"); if (str != NULL) - errorCode = _ttoi(str); + errorCode = _wtoi(str); str = XmlGetText(errorNode); if (str == NULL) @@ -274,7 +274,7 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) for (int i = 0;; i++) { HXML c = XmlGetChild(errorNode, i); if (c == NULL) break; - const TCHAR *attr = XmlGetAttrValue(c, L"xmlns"); + const wchar_t *attr = XmlGetAttrValue(c, L"xmlns"); if (attr && !mir_tstrcmp(attr, L"urn:ietf:params:xml:ns:xmpp-stanzas")) { str = XmlGetName(c); break; @@ -314,15 +314,15 @@ void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible) } } -time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp) +time_t __stdcall JabberIsoToUnixTime(const wchar_t *stamp) { - TCHAR date[9]; + wchar_t date[9]; int i, y; if (stamp == NULL) return 0; - const TCHAR *p = stamp; + const wchar_t *p = stamp; // Get the date part for (i = 0; *p != '\0' && i < 8 && isdigit(*p); p++, i++) @@ -354,7 +354,7 @@ time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp) for (; *p != '\0' && !isdigit(*p); p++); // Parse time - if (_stscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) + if (swscanf(p, L"%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) return (time_t)0; timestamp.tm_isdst = 0; // DST is already present in _timezone below @@ -365,7 +365,7 @@ time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp) return (t >= 0) ? t : 0; } -void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg) +void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg) { if (!m_bJabberOnline) return; @@ -373,8 +373,8 @@ void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const int iPriority = getDword("Priority", 0); UpdatePriorityMenu(iPriority); - TCHAR szPriority[40]; - _itot(iPriority, szPriority, 10); + wchar_t szPriority[40]; + _itow(iPriority, szPriority, 10); XmlNode p(L"presence"); p << XCHILD(L"priority", szPriority); if (to != NULL) @@ -387,7 +387,7 @@ void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const HXML c = p << XCHILDNS(L"c", JABBER_FEAT_ENTITY_CAPS) << XATTR(L"node", JABBER_CAPS_MIRANDA_NODE) << XATTR(L"ver", szCoreVersion); - LIST<TCHAR> arrExtCaps(5); + LIST<wchar_t> arrExtCaps(5); if (bSecureIM) arrExtCaps.insert(JABBER_EXT_SECUREIM); @@ -492,7 +492,7 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) { JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i); if (item != NULL && item->nick != NULL) { - TCHAR text[1024]; + wchar_t text[1024]; mir_sntprintf(text, L"%s/%s", item->jid, item->nick); SendPresenceTo(status == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : status, text, NULL); } @@ -505,17 +505,17 @@ void CJabberProto::SendPresence(int status, bool bSendToAll) int __stdcall JabberGetPacketID(HXML n) { - const TCHAR *str = XmlGetAttrValue(n, L"id"); + const wchar_t *str = XmlGetAttrValue(n, L"id"); if (str) - if (!_tcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1)) - return _ttoi(str + _countof(JABBER_IQID) - 1); + if (!wcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1)) + return _wtoi(str + _countof(JABBER_IQID) - 1); return -1; } -TCHAR* __stdcall JabberId2string(int id) +wchar_t* __stdcall JabberId2string(int id) { - TCHAR text[100]; + wchar_t text[100]; mir_sntprintf(text, _T(JABBER_IQID) L"%d", id); return mir_tstrdup(text); } @@ -523,7 +523,7 @@ TCHAR* __stdcall JabberId2string(int id) /////////////////////////////////////////////////////////////////////////////// // JabberGetClientJID - adds a resource postfix to a JID -TCHAR* CJabberProto::GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen) +wchar_t* CJabberProto::GetClientJID(MCONTACT hContact, wchar_t *dest, size_t destLen) { if (hContact == NULL) return NULL; @@ -532,13 +532,13 @@ TCHAR* CJabberProto::GetClientJID(MCONTACT hContact, TCHAR *dest, size_t destLen return GetClientJID(jid, dest, destLen); } -TCHAR* CJabberProto::GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen) +wchar_t* CJabberProto::GetClientJID(const wchar_t *jid, wchar_t *dest, size_t destLen) { if (jid == NULL) return NULL; - _tcsncpy_s(dest, destLen, jid, _TRUNCATE); - TCHAR *p = _tcschr(dest, '/'); + wcsncpy_s(dest, destLen, jid, _TRUNCATE); + wchar_t *p = wcschr(dest, '/'); mir_cslock lck(m_csLists); JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, jid); @@ -561,14 +561,14 @@ TCHAR* CJabberProto::GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen) /////////////////////////////////////////////////////////////////////////////// // JabberStripJid - strips a resource postfix from a JID -TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen) +wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t destLen) { if (jid == NULL) *dest = 0; else { - _tcsncpy_s(dest, destLen, jid, _TRUNCATE); + wcsncpy_s(dest, destLen, jid, _TRUNCATE); - TCHAR *p = _tcschr(dest, '/'); + wchar_t *p = wcschr(dest, '/'); if (p != NULL) *p = 0; } @@ -667,7 +667,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, (LPARAM)L""); } -void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount) +void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount) { if (!string || !*string) return; @@ -728,7 +728,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) LISTFOREACH(i, ppro, LIST_ROSTER) { if ((item = ppro->ListGetItemPtrFromIndex(i)) != NULL) { - if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) { + if (wcschr(item->jid, '@') == NULL && wcschr(item->jid, '/') == NULL && item->subscription != SUB_NONE) { MCONTACT hContact = ppro->HContactFromJID(item->jid); if (hContact == NULL) continue; @@ -736,7 +736,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) char *jid_copy = mir_t2a(item->jid); mir_snprintf(name, "$/Transports/%s", jid_copy); ppro->m_pInfoFrame->CreateInfoItem(name, true, hContact); - ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (TCHAR *)item->jid); + ppro->m_pInfoFrame->UpdateInfoItem(name, ppro->GetIconHandle(IDI_TRANSPORTL), (wchar_t *)item->jid); ppro->m_pInfoFrame->SetInfoItemCallback(name, &CJabberProto::InfoFrame_OnTransport); mir_free(jid_copy); } @@ -755,7 +755,7 @@ void CJabberProto::RebuildInfoFrame() //////////////////////////////////////////////////////////////////////// // time2str & str2time -TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen) +wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen) { struct tm* T = gmtime(&_time); mir_sntprintf(buf, bufLen, L"%04d-%02d-%02dT%02d:%02d:%02dZ", @@ -763,12 +763,12 @@ TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen) return buf; } -time_t str2time(const TCHAR *buf) +time_t str2time(const wchar_t *buf) { struct tm T = { 0 }; - if (_stscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec) != 6) { + if (swscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec) != 6) { int boo; - if (_stscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02d.%dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7) + if (swscanf(buf, L"%04d-%02d-%02dT%02d:%02d:%02d.%dZ", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, &boo) != 7) return 0; } @@ -778,30 +778,30 @@ time_t str2time(const TCHAR *buf) } //////////////////////////////////////////////////////////////////////// -// case-insensitive _tcsstr -const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr) +// case-insensitive wcsstr +const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr) { - TCHAR *str_up = NEWTSTR_ALLOCA(str); - TCHAR *substr_up = NEWTSTR_ALLOCA(substr); + wchar_t *str_up = NEWWSTR_ALLOCA(str); + wchar_t *substr_up = NEWWSTR_ALLOCA(substr); CharUpperBuff(str_up, (DWORD)mir_tstrlen(str_up)); CharUpperBuff(substr_up, (DWORD)mir_tstrlen(substr_up)); - TCHAR *p = _tcsstr(str_up, substr_up); + wchar_t *p = wcsstr(str_up, substr_up); return p ? (str + (p - str_up)) : NULL; } //////////////////////////////////////////////////////////////////////// // clipboard processing -void JabberCopyText(HWND hwnd, const TCHAR *text) +void JabberCopyText(HWND hwnd, const wchar_t *text) { if (!hwnd || !text) return; if (OpenClipboard(hwnd)) { EmptyClipboard(); - HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1)); - TCHAR *s = (TCHAR *)GlobalLock(hMem); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(text) + 1)); + wchar_t *s = (wchar_t *)GlobalLock(hMem); mir_tstrcpy(s, text); GlobalUnlock(hMem); SetClipboardData(CF_UNICODETEXT, hMem); @@ -812,7 +812,7 @@ void JabberCopyText(HWND hwnd, const TCHAR *text) BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout) { if (caption == NULL) { - caption = NEWTSTR_ALLOCA(result.GetString()); + caption = NEWWSTR_ALLOCA(result.GetString()); result.Empty(); } @@ -841,15 +841,15 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime) if (n == NULL) return false; - const TCHAR *ptszTimeStamp = XmlGetAttrValue(n, L"stamp"); + const wchar_t *ptszTimeStamp = XmlGetAttrValue(n, L"stamp"); if (ptszTimeStamp == NULL) return false; // skip '-' chars - TCHAR *szStamp = NEWTSTR_ALLOCA(ptszTimeStamp); + wchar_t *szStamp = NEWWSTR_ALLOCA(ptszTimeStamp); int si = 0, sj = 0; while (true) { - if (szStamp[si] == _T('-')) + if (szStamp[si] == '-') si++; else if (!(szStamp[sj++] = szStamp[si++])) break; @@ -871,11 +871,11 @@ bool CJabberProto::IsMyOwnJID(LPCTSTR szJID) if (szTo == NULL) return false; - TCHAR *pDelimiter = _tcschr(szFrom, _T('/')); + wchar_t *pDelimiter = wcschr(szFrom, '/'); if (pDelimiter) *pDelimiter = 0; - pDelimiter = _tcschr(szTo, _T('/')); + pDelimiter = wcschr(szTo, '/'); if (pDelimiter) *pDelimiter = 0; @@ -907,7 +907,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ai.hContact = avs[i].hContact; if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) { - TCHAR tszFileName[MAX_PATH]; + wchar_t tszFileName[MAX_PATH]; GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName)); DeleteFile(tszFileName); } @@ -924,10 +924,10 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved")); if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) { - TCHAR tszFileName[MAX_PATH]; + wchar_t tszFileName[MAX_PATH]; GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName)); - _tcsncpy_s(ai.filename, tszFileName, _TRUNCATE); - FILE* out = _tfopen(tszFileName, L"wb"); + wcsncpy_s(ai.filename, tszFileName, _TRUNCATE); + FILE* out = _wfopen(tszFileName, L"wb"); if (out != NULL) { fwrite(res->pData, res->dataLength, 1, out); fclose(out); diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index ad0f752bb2..6d1ae5d239 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// -int CJabberProto::SendGetVcard(const TCHAR *jid) +int CJabberProto::SendGetVcard(const wchar_t *jid) { if (!m_bJabberOnline) return 0; @@ -126,7 +126,7 @@ static INT_PTR CALLBACK HomeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg); for (int i = 0; i < g_cbCountries; i++) { if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) { - TCHAR *country = mir_a2t(g_countries[i].szName); + wchar_t *country = mir_a2t(g_countries[i].szName); SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country)); mir_free(country); } @@ -190,7 +190,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TranslateDialogDefault(hwndDlg); for (int i = 0; i < g_cbCountries; i++) { if (g_countries[i].id != 0xFFFF && g_countries[i].id != 0) { - TCHAR *country = mir_a2t(g_countries[i].szName); + wchar_t *country = mir_a2t(g_countries[i].szName); SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)TranslateTS(country)); mir_free(country); } @@ -257,7 +257,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { const unsigned long iPageId = 3; - TCHAR szAvatarFileName[MAX_PATH], szTempPath[MAX_PATH], szTempFileName[MAX_PATH]; + wchar_t szAvatarFileName[MAX_PATH], szTempPath[MAX_PATH], szTempFileName[MAX_PATH]; PhotoDlgProcData* dat = (PhotoDlgProcData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { @@ -289,7 +289,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE); dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName)); - if (_taccess(szAvatarFileName, 0) == 0) { + if (_waccess(szAvatarFileName, 0) == 0) { if (GetTempPath(_countof(szTempPath), szTempPath) <= 0) mir_tstrcpy(szTempPath, L".\\"); if (GetTempFileName(szTempPath, L"jab", 0, szTempFileName) > 0) { @@ -333,7 +333,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case IDC_LOAD: - TCHAR szFilter[512], szFileName[MAX_PATH]; + wchar_t szFilter[512], szFileName[MAX_PATH]; Bitmap_GetFilter(szFilter, _countof(szFilter)); OPENFILENAME ofn = { 0 }; @@ -350,7 +350,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR HBITMAP hNewBitmap; dat->ppro->debugLog(L"File selected is %s", szFileName); - if (_tstat(szFileName, &st) < 0 || st.st_size > 40 * 1024) { + if (_wstat(szFileName, &st) < 0 || st.st_size > 40 * 1024) { MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND); break; } @@ -578,7 +578,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; } - TCHAR text[128]; + wchar_t text[128]; GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text)); mir_snprintf(idstr, "e-mail%d", dat->id); dat->ppro->setTString(idstr, text); @@ -719,7 +719,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP { int i; char idstr[33]; - TCHAR number[20]; + wchar_t number[20]; //e-mails ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS)); @@ -916,7 +916,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) { - TCHAR text[2048]; + wchar_t text[2048]; // Page 0: Personal switch (iPage) { @@ -958,7 +958,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("ZIP", text); { int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0); - TCHAR *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName); + wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName); setTString("Country", country); mir_free(country); } @@ -984,7 +984,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) setTString("CompanyZIP", text); { int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0); - TCHAR *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName); + wchar_t *country = mir_a2t((i) ? g_countries[i + 2].szName : g_countries[1].szName); setTString("CompanyCountry", country); mir_free(country); } @@ -1010,7 +1010,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key) n << XCHILD(_A2T(tag), tszValue); } -void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) +void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) { if (!m_bJabberOnline) return; @@ -1104,7 +1104,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) if (nFlag & JABBER_VCTEL_PCS) n << XCHILD(L"PCS"); } - TCHAR szAvatarName[MAX_PATH], *szFileName; + wchar_t szAvatarName[MAX_PATH], *szFileName; GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName)); if (bPhotoChanged) szFileName = szPhotoFileName; @@ -1123,7 +1123,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) debugLog(L"Saving picture from %s", szFileName); struct _stat st; - if (_tstat(szFileName, &st) >= 0) { + if (_wstat(szFileName, &st) >= 0) { // Note the FILE_SHARE_READ attribute so that the CopyFile can succeed HANDLE hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { @@ -1134,7 +1134,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) ptrA str(mir_base64_encode((PBYTE)(LPSTR)buffer, nRead)); if (str != NULL) { n = v << XCHILD(L"PHOTO"); - TCHAR *szFileType; + wchar_t *szFileType; switch (ProtoGetBufferFormat(buffer)) { case PA_FORMAT_PNG: szFileType = L"image/png"; break; case PA_FORMAT_GIF: szFileType = L"image/gif"; break; @@ -1188,36 +1188,36 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM) odp.hInstance = hInst; odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE; - odp.ptszTitle = m_tszUserName; + odp.pwszTitle = m_tszUserName; odp.pfnDlgProc = PersonalDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PERSONAL); - odp.ptszTab = LPGENT("General"); + odp.pwszTab = LPGENW("General"); UserInfo_AddPage(wParam, &odp); odp.pfnDlgProc = ContactDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_CONTACT); - odp.ptszTab = LPGENT("Contacts"); + odp.pwszTab = LPGENW("Contacts"); UserInfo_AddPage(wParam, &odp); odp.pfnDlgProc = HomeDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_HOME); - odp.ptszTab = LPGENT("Home"); + odp.pwszTab = LPGENW("Home"); UserInfo_AddPage(wParam, &odp); odp.pfnDlgProc = WorkDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_WORK); - odp.ptszTab = LPGENT("Work"); + odp.pwszTab = LPGENW("Work"); UserInfo_AddPage(wParam, &odp); odp.pfnDlgProc = PhotoDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_PHOTO); - odp.ptszTab = LPGENT("Photo"); + odp.pwszTab = LPGENW("Photo"); UserInfo_AddPage(wParam, &odp); odp.pfnDlgProc = NoteDlgProc; odp.pszTemplate = MAKEINTRESOURCEA(IDD_VCARD_NOTE); - odp.ptszTab = LPGENT("Note"); + odp.pwszTab = LPGENW("Note"); UserInfo_AddPage(wParam, &odp); SendGetVcard(m_szJabberJID); diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 17460ea992..201b1fbbd4 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -28,7 +28,7 @@ BOOL CJabberProto::WsInit(void) { m_lastTicks = ::GetTickCount(); - TCHAR name[128]; + wchar_t name[128]; mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index f4626e8921..32b1b6194e 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ///////////////////////////////////////////////////////////////////////////////////////// // XmlNodeIq class members -XmlNodeIq::XmlNodeIq(const TCHAR *type, int id, LPCTSTR to) : +XmlNodeIq::XmlNodeIq(const wchar_t *type, int id, LPCTSTR to) : XmlNode(L"iq") { if (type != NULL) *this << XATTR(L"type", type); @@ -41,7 +41,7 @@ XmlNodeIq::XmlNodeIq(const TCHAR *type, int id, LPCTSTR to) : if (id != -1 ) *this << XATTRID(id); } -XmlNodeIq::XmlNodeIq(const TCHAR *type, LPCTSTR idStr, LPCTSTR to) : +XmlNodeIq::XmlNodeIq(const wchar_t *type, LPCTSTR idStr, LPCTSTR to) : XmlNode(L"iq") { if (type != NULL) *this << XATTR(L"type", type ); @@ -49,13 +49,13 @@ XmlNodeIq::XmlNodeIq(const TCHAR *type, LPCTSTR idStr, LPCTSTR to) : if (idStr != NULL) *this << XATTR(L"id", idStr); } -XmlNodeIq::XmlNodeIq(const TCHAR *type, HXML node, LPCTSTR to) : +XmlNodeIq::XmlNodeIq(const wchar_t *type, HXML node, LPCTSTR to) : XmlNode(L"iq") { if (type != NULL) *this << XATTR(L"type", type ); if (to != NULL) *this << XATTR(L"to", to ); if (node != NULL) { - const TCHAR *iqId = XmlGetAttrValue(*this, L"id"); + const wchar_t *iqId = XmlGetAttrValue(*this, L"id"); if (iqId != NULL) *this << XATTR(L"id", iqId); } } @@ -70,7 +70,7 @@ XmlNodeIq::XmlNodeIq(CJabberIqInfo *pInfo) : } } -XmlNodeIq::XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo) : +XmlNodeIq::XmlNodeIq(const wchar_t *type, CJabberIqInfo *pInfo) : XmlNode(L"iq") { if (type != NULL) *this << XATTR(L"type", type); @@ -145,7 +145,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, int value) void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) { - TCHAR buf[60]; + wchar_t buf[60]; _ui64tot(value, buf, 10); xmlAddAttr(hXml, T2UTF(pszName), T2UTF(buf)); @@ -153,7 +153,7 @@ void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value) void __fastcall XmlAddAttrID(HXML hXml, int id) { - TCHAR text[100]; + wchar_t text[100]; mir_sntprintf(text, _T(JABBER_IQID) L"%d", id); XmlAddAttr(hXml, L"id", text); } @@ -194,8 +194,8 @@ HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, LPCTSTR value) HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, int value) { - TCHAR buf[40]; - _itot(value, buf, 10); + wchar_t buf[40]; + _itow(value, buf, 10); return xmlAddChild(hXml, T2UTF(name), buf); } @@ -280,20 +280,20 @@ void XPath::ProcessPath(LookupInfo &info, bool bCreate) { if (!info.nodeName) return; - TCHAR *nodeName = (TCHAR *)alloca(sizeof(TCHAR) * (info.nodeName.length+1)); + wchar_t *nodeName = (wchar_t *)alloca(sizeof(wchar_t) * (info.nodeName.length+1)); mir_tstrncpy(nodeName, info.nodeName.p, info.nodeName.length+1); if (info.attrName && info.attrValue) { - TCHAR *attrName = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrName.length + 1)); + wchar_t *attrName = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrName.length + 1)); mir_tstrncpy(attrName, info.attrName.p, info.attrName.length + 1); - TCHAR *attrValue = (TCHAR *)alloca(sizeof(TCHAR)* (info.attrValue.length + 1)); + wchar_t *attrValue = (wchar_t *)alloca(sizeof(wchar_t)* (info.attrValue.length + 1)); mir_tstrncpy(attrValue, info.attrValue.p, info.attrValue.length + 1); HXML hXml = XmlGetChildByTag(m_hXml, nodeName, attrName, attrValue); m_hXml = (hXml || !bCreate) ? hXml : (m_hXml << XCHILD(nodeName) << XATTR(attrName, attrValue)); } else if (info.nodeIndex) { - int idx = _ttoi(info.nodeIndex.p); + int idx = _wtoi(info.nodeIndex.p); m_hXml = mir_tstrcmp(nodeName, L"*") ? XmlGetNthChild(m_hXml, nodeName, idx) : XmlGetChild(m_hXml, idx - 1); } else { @@ -322,11 +322,11 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T('@'): + case '@': info.attrName.Begin(p + 1); state = S_ATTR_STEP; break; - case _T('/'): + case '/': break; default: info.nodeName.Begin(p); @@ -352,11 +352,11 @@ XPath::PathType XPath::LookupImpl(bool bCreate) info.nodeName.End(p); state = S_FINAL_NODESET; break; - case _T('['): + case '[': info.nodeName.End(p); state = S_NODE_OPENBRACKET; break; - case _T('/'): + case '/': info.nodeName.End(p); state = S_START; break; @@ -370,12 +370,12 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T('@'): + case '@': info.attrName.Begin(p + 1); state = S_NODE_ATTRNAME; break; - case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'): - case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'): + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': info.nodeIndex.Begin(p); state = S_NODE_INDEX; break; @@ -390,12 +390,12 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T(']'): + case ']': info.nodeIndex.End(p); state = S_NODE_CLOSEBRACKET; break; - case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'): - case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'): + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': break; default: state = S_FINAL_ERROR; @@ -408,7 +408,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T('='): + case '=': info.attrName.End(p); state = S_NODE_ATTREQUALS; break; @@ -422,7 +422,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T('\''): + case '\'': info.attrValue.Begin(p + 1); state = S_NODE_ATTRVALUE; break; @@ -437,7 +437,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T('\''): + case '\'': info.attrValue.End(p); state = S_NODE_ATTRCLOSEVALUE; break; @@ -451,7 +451,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_ERROR; break; - case _T(']'): + case ']': state = S_NODE_CLOSEBRACKET; break; default: @@ -465,7 +465,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) case 0: state = S_FINAL_NODE; break; - case _T('/'): + case '/': state = S_START; break; default: diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 685336b35c..739ba708db 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -83,13 +83,13 @@ class CJabberIqInfo; struct XmlNodeIq : public XmlNode { - XmlNodeIq(const TCHAR *type, int id = -1, const TCHAR *to = NULL); - XmlNodeIq(const TCHAR *type, const TCHAR *idStr, const TCHAR *to); - XmlNodeIq(const TCHAR *type, HXML node, const TCHAR *to); + XmlNodeIq(const wchar_t *type, int id = -1, const wchar_t *to = NULL); + XmlNodeIq(const wchar_t *type, const wchar_t *idStr, const wchar_t *to); + XmlNodeIq(const wchar_t *type, HXML node, const wchar_t *to); // new request XmlNodeIq(CJabberIqInfo *pInfo); // answer to request - XmlNodeIq(const TCHAR *type, CJabberIqInfo *pInfo); + XmlNodeIq(const wchar_t *type, CJabberIqInfo *pInfo); }; typedef void (*JABBER_XML_CALLBACK)(HXML, void*); @@ -224,7 +224,7 @@ HXML __fastcall operator<<(HXML node, const XQUERY& child); class XPath { public: - __forceinline XPath(HXML hXml, TCHAR *path): + __forceinline XPath(HXML hXml, wchar_t *path): m_type(T_UNKNOWN), m_hXml(hXml), m_szPath(path), @@ -245,22 +245,22 @@ public: { switch (Lookup()) { - case T_ATTRIBUTE: return (TCHAR *)XmlGetAttrValue(m_hXml, m_szParam); - case T_NODE: return (TCHAR *)XmlGetText(m_hXml); - case T_NODESET: return (TCHAR *)XmlGetText(XmlGetNthChild(m_hXml, m_szParam, 1)); + case T_ATTRIBUTE: return (wchar_t *)XmlGetAttrValue(m_hXml, m_szParam); + case T_NODE: return (wchar_t *)XmlGetText(m_hXml); + case T_NODESET: return (wchar_t *)XmlGetText(XmlGetNthChild(m_hXml, m_szParam, 1)); } return NULL; } operator int() { - if (TCHAR *s = *this) return _ttoi(s); + if (wchar_t *s = *this) return _wtoi(s); return 0; } - __forceinline bool operator== (TCHAR *str) + __forceinline bool operator== (wchar_t *str) { return !mir_tstrcmp((LPCTSTR)*this, str); } - __forceinline bool operator!= (TCHAR *str) + __forceinline bool operator!= (wchar_t *str) { return mir_tstrcmp((LPCTSTR)*this, str) ? true : false; } @@ -280,8 +280,8 @@ public: } void operator= (int value) { - TCHAR buf[16]; - _itot(value, buf, 10); + wchar_t buf[16]; + _itow(value, buf, 10); *this = buf; } @@ -322,11 +322,11 @@ private: struct LookupString { - void Begin(const TCHAR *p_) { p = p_; } - void End(const TCHAR *p_) { length = p_ - p; } + void Begin(const wchar_t *p_) { p = p_; } + void End(const wchar_t *p_) { length = p_ - p; } operator bool() { return p ? true : false; } - const TCHAR *p; + const wchar_t *p; int length; }; @@ -353,7 +353,7 @@ class XPathFmt: public XPath { public: enum { BUFSIZE = 512 }; - XPathFmt(HXML hXml, TCHAR *path, ...): XPath(hXml, m_buf) + XPathFmt(HXML hXml, wchar_t *path, ...): XPath(hXml, m_buf) { *m_buf = 0; @@ -378,7 +378,7 @@ public: } private: - TCHAR m_buf[BUFSIZE]; + wchar_t m_buf[BUFSIZE]; }; #endif diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index e9bacc1e5d..4e0b3b521b 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -67,7 +67,7 @@ void CJabberDlgPepBase::OnInitDialog() SetTimer(m_hwnd, 1, 1000, NULL); - TCHAR buf[128]; + wchar_t buf[128]; mir_sntprintf(buf, TranslateT("OK (%d)"), m_time); m_btnOk.SetText(buf); } @@ -88,7 +88,7 @@ INT_PTR CJabberDlgPepBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (msg) { case WM_TIMER: if (wParam == 1) { - TCHAR buf[128]; + wchar_t buf[128]; mir_sntprintf(buf, TranslateT("OK (%d)"), --m_time); m_btnOk.SetText(buf); @@ -119,14 +119,14 @@ class CJabberDlgPepSimple: public CJabberDlgPepBase { typedef CJabberDlgPepBase CSuper; public: - CJabberDlgPepSimple(CJabberProto *proto, TCHAR *title); + CJabberDlgPepSimple(CJabberProto *proto, wchar_t *title); ~CJabberDlgPepSimple(); bool OkClicked() { return m_bOkClicked; } - void AddStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem = false); - void SetActiveStatus(LPARAM id, TCHAR *text); + void AddStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem = false); + void SetActiveStatus(LPARAM id, wchar_t *text); LPARAM GetStatusMode(); - TCHAR *GetStatusText(); + wchar_t *GetStatusText(); protected: CCtrlCombo m_cbModes; @@ -151,30 +151,30 @@ private: LPARAM m_id; char *m_name; HICON m_hIcon; - TCHAR *m_title; + wchar_t *m_title; bool m_subitem; - CStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem): m_id(id), m_name(name), m_hIcon(hIcon), m_title(title), m_subitem(subitem) {} + CStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem): m_id(id), m_name(name), m_hIcon(hIcon), m_title(title), m_subitem(subitem) {} ~CStatusMode() { IcoLib_ReleaseIcon(m_hIcon); } }; OBJLIST<CStatusMode> m_modes; - TCHAR *m_text; - TCHAR *m_title; + wchar_t *m_text; + wchar_t *m_title; int m_time; int m_prevSelected; int m_selected; bool m_bOkClicked; LPARAM m_active; - TCHAR *m_activeText; + wchar_t *m_activeText; void btnOk_OnClick(CCtrlButton *btn); void global_OnChange(CCtrlData *); void cbModes_OnChange(CCtrlData *); }; -CJabberDlgPepSimple::CJabberDlgPepSimple(CJabberProto *proto, TCHAR *title): +CJabberDlgPepSimple::CJabberDlgPepSimple(CJabberProto *proto, wchar_t *title): CJabberDlgPepBase(proto, IDD_PEP_SIMPLE), m_cbModes(this, IDC_CB_MODES), m_txtDescription(this, IDC_TXT_DESCRIPTION), @@ -199,12 +199,12 @@ CJabberDlgPepSimple::~CJabberDlgPepSimple() mir_free(m_text); } -void CJabberDlgPepSimple::AddStatusMode(LPARAM id, char *name, HICON hIcon, TCHAR *title, bool subitem) +void CJabberDlgPepSimple::AddStatusMode(LPARAM id, char *name, HICON hIcon, wchar_t *title, bool subitem) { m_modes.insert(new CStatusMode(id, name, hIcon, title, subitem)); } -void CJabberDlgPepSimple::SetActiveStatus(LPARAM id, TCHAR *text) +void CJabberDlgPepSimple::SetActiveStatus(LPARAM id, wchar_t *text) { m_active = id; m_activeText = text; @@ -215,7 +215,7 @@ LPARAM CJabberDlgPepSimple::GetStatusMode() return m_modes[m_selected].m_id; } -TCHAR *CJabberDlgPepSimple::GetStatusText() +wchar_t *CJabberDlgPepSimple::GetStatusText() { return m_text; } @@ -275,7 +275,7 @@ void CJabberDlgPepSimple::cbModes_OnChange(CCtrlData *) char szSetting[128]; if ((m_prevSelected >= 0) && (m_modes[m_cbModes.GetItemData(m_prevSelected)].m_id >= 0)) { - TCHAR *txt = m_txtDescription.GetText(); + wchar_t *txt = m_txtDescription.GetText(); mir_snprintf(szSetting, "PepMsg_%s", m_modes[m_cbModes.GetItemData(m_prevSelected)].m_name); m_proto->setTString(szSetting, txt); mir_free(txt); @@ -337,7 +337,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) } if (!mode->m_subitem || (lpdis->itemState & ODS_COMBOBOXEDIT)) { - TCHAR text[128]; + wchar_t text[128]; if (mode->m_subitem) { for (int i = lpdis->itemData; i >= 0; --i) if (!m_modes[i].m_subitem) { @@ -351,7 +351,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text)); } else { - TCHAR text[128]; + wchar_t text[128]; mir_sntprintf(text, L"...%s", mode->m_title); DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL); TextOut(lpdis->hDC, lpdis->rcItem.left + 44, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text)); @@ -371,7 +371,7 @@ BOOL CJabberDlgPepSimple::OnWmGetMinMaxInfo(UINT, WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////// // CPepService base class -CPepService::CPepService(CJabberProto *proto, char *name, TCHAR *node): +CPepService::CPepService(CJabberProto *proto, char *name, wchar_t *node): m_proto(proto), m_name(name), m_node(node), @@ -398,8 +398,8 @@ void CPepService::Publish() void CPepService::Retract() { - TCHAR *tempName = mir_a2t(m_name); - _tcslwr(tempName); + wchar_t *tempName = mir_a2t(m_name); + wcslwr(tempName); m_proto->m_ThreadInfo->send( XmlNodeIq(L"set", m_proto->SerialNext()) @@ -425,7 +425,7 @@ void CPepService::ForceRepublishOnLogin() /////////////////////////////////////////////////////////////////////////////// // CPepGuiService base class -CPepGuiService::CPepGuiService(CJabberProto *proto, char *name, TCHAR *node): +CPepGuiService::CPepGuiService(CJabberProto *proto, char *name, wchar_t *node): CPepService(proto, name, node), m_bGuiOpen(false), m_hIcolibItem(NULL), @@ -471,7 +471,7 @@ void CPepGuiService::RebuildMenu() mi.position = 200010; mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_HIDDEN; mi.hIcolibItem = m_hIcolibItem; - mi.name.t = m_szText ? m_szText : LPGENT("<advanced status slot>"); + mi.name.w = m_szText ? m_szText : LPGENW("<advanced status slot>"); m_hMenuItem = Menu_AddProtoMenuItem(&mi, m_proto->m_szModuleName); } @@ -486,7 +486,7 @@ bool CPepGuiService::LaunchSetGui(BYTE bQuiet) return true; } -void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text) +void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text) { m_hIcolibItem = hIcolibIcon; replaceStrT(m_szText, text); @@ -506,96 +506,96 @@ int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM) struct { - TCHAR *szName; + wchar_t *szName; char* szTag; } static g_arrMoods[] = { - { LPGENT("None"), NULL }, - { LPGENT("Afraid"), "afraid" }, - { LPGENT("Amazed"), "amazed" }, - { LPGENT("Amorous"), "amorous" }, - { LPGENT("Angry"), "angry" }, - { LPGENT("Annoyed"), "annoyed" }, - { LPGENT("Anxious"), "anxious" }, - { LPGENT("Aroused"), "aroused" }, - { LPGENT("Ashamed"), "ashamed" }, - { LPGENT("Bored"), "bored" }, - { LPGENT("Brave"), "brave" }, - { LPGENT("Calm"), "calm" }, - { LPGENT("Cautious"), "cautious" }, - { LPGENT("Cold"), "cold" }, - { LPGENT("Confident"), "confident" }, - { LPGENT("Confused"), "confused" }, - { LPGENT("Contemplative"),"contemplative" }, - { LPGENT("Contented"), "contented" }, - { LPGENT("Cranky"), "cranky" }, - { LPGENT("Crazy"), "crazy" }, - { LPGENT("Creative"), "creative" }, - { LPGENT("Curious"), "curious" }, - { LPGENT("Dejected"), "dejected" }, - { LPGENT("Depressed"), "depressed" }, - { LPGENT("Disappointed"), "disappointed" }, - { LPGENT("Disgusted"), "disgusted" }, - { LPGENT("Dismayed"), "dismayed" }, - { LPGENT("Distracted"), "distracted" }, - { LPGENT("Embarrassed"), "embarrassed" }, - { LPGENT("Envious"), "envious" }, - { LPGENT("Excited"), "excited" }, - { LPGENT("Flirtatious"), "flirtatious" }, - { LPGENT("Frustrated"), "frustrated" }, - { LPGENT("Grateful"), "grateful" }, - { LPGENT("Grieving"), "grieving" }, - { LPGENT("Grumpy"), "grumpy" }, - { LPGENT("Guilty"), "guilty" }, - { LPGENT("Happy"), "happy" }, - { LPGENT("Hopeful"), "hopeful" }, - { LPGENT("Hot"), "hot" }, - { LPGENT("Humbled"), "humbled" }, - { LPGENT("Humiliated"), "humiliated" }, - { LPGENT("Hungry"), "hungry" }, - { LPGENT("Hurt"), "hurt" }, - { LPGENT("Impressed"), "impressed" }, - { LPGENT("In awe"), "in_awe" }, - { LPGENT("In love"), "in_love" }, - { LPGENT("Indignant"), "indignant" }, - { LPGENT("Interested"), "interested" }, - { LPGENT("Intoxicated"), "intoxicated" }, - { LPGENT("Invincible"), "invincible" }, - { LPGENT("Jealous"), "jealous" }, - { LPGENT("Lonely"), "lonely" }, - { LPGENT("Lost"), "lost" }, - { LPGENT("Lucky"), "lucky" }, - { LPGENT("Mean"), "mean" }, - { LPGENT("Moody"), "moody" }, - { LPGENT("Nervous"), "nervous" }, - { LPGENT("Neutral"), "neutral" }, - { LPGENT("Offended"), "offended" }, - { LPGENT("Outraged"), "outraged" }, - { LPGENT("Playful"), "playful" }, - { LPGENT("Proud"), "proud" }, - { LPGENT("Relaxed"), "relaxed" }, - { LPGENT("Relieved"), "relieved" }, - { LPGENT("Remorseful"), "remorseful" }, - { LPGENT("Restless"), "restless" }, - { LPGENT("Sad"), "sad" }, - { LPGENT("Sarcastic"), "sarcastic" }, - { LPGENT("Satisfied"), "satisfied" }, - { LPGENT("Serious"), "serious" }, - { LPGENT("Shocked"), "shocked" }, - { LPGENT("Shy"), "shy" }, - { LPGENT("Sick"), "sick" }, - { LPGENT("Sleepy"), "sleepy" }, - { LPGENT("Spontaneous"), "spontaneous" }, - { LPGENT("Stressed"), "stressed" }, - { LPGENT("Strong"), "strong" }, - { LPGENT("Surprised"), "surprised" }, - { LPGENT("Thankful"), "thankful" }, - { LPGENT("Thirsty"), "thirsty" }, - { LPGENT("Tired"), "tired" }, - { LPGENT("Undefined"), "undefined" }, - { LPGENT("Weak"), "weak" }, - { LPGENT("Worried"), "worried" }, + { LPGENW("None"), NULL }, + { LPGENW("Afraid"), "afraid" }, + { LPGENW("Amazed"), "amazed" }, + { LPGENW("Amorous"), "amorous" }, + { LPGENW("Angry"), "angry" }, + { LPGENW("Annoyed"), "annoyed" }, + { LPGENW("Anxious"), "anxious" }, + { LPGENW("Aroused"), "aroused" }, + { LPGENW("Ashamed"), "ashamed" }, + { LPGENW("Bored"), "bored" }, + { LPGENW("Brave"), "brave" }, + { LPGENW("Calm"), "calm" }, + { LPGENW("Cautious"), "cautious" }, + { LPGENW("Cold"), "cold" }, + { LPGENW("Confident"), "confident" }, + { LPGENW("Confused"), "confused" }, + { LPGENW("Contemplative"),"contemplative" }, + { LPGENW("Contented"), "contented" }, + { LPGENW("Cranky"), "cranky" }, + { LPGENW("Crazy"), "crazy" }, + { LPGENW("Creative"), "creative" }, + { LPGENW("Curious"), "curious" }, + { LPGENW("Dejected"), "dejected" }, + { LPGENW("Depressed"), "depressed" }, + { LPGENW("Disappointed"), "disappointed" }, + { LPGENW("Disgusted"), "disgusted" }, + { LPGENW("Dismayed"), "dismayed" }, + { LPGENW("Distracted"), "distracted" }, + { LPGENW("Embarrassed"), "embarrassed" }, + { LPGENW("Envious"), "envious" }, + { LPGENW("Excited"), "excited" }, + { LPGENW("Flirtatious"), "flirtatious" }, + { LPGENW("Frustrated"), "frustrated" }, + { LPGENW("Grateful"), "grateful" }, + { LPGENW("Grieving"), "grieving" }, + { LPGENW("Grumpy"), "grumpy" }, + { LPGENW("Guilty"), "guilty" }, + { LPGENW("Happy"), "happy" }, + { LPGENW("Hopeful"), "hopeful" }, + { LPGENW("Hot"), "hot" }, + { LPGENW("Humbled"), "humbled" }, + { LPGENW("Humiliated"), "humiliated" }, + { LPGENW("Hungry"), "hungry" }, + { LPGENW("Hurt"), "hurt" }, + { LPGENW("Impressed"), "impressed" }, + { LPGENW("In awe"), "in_awe" }, + { LPGENW("In love"), "in_love" }, + { LPGENW("Indignant"), "indignant" }, + { LPGENW("Interested"), "interested" }, + { LPGENW("Intoxicated"), "intoxicated" }, + { LPGENW("Invincible"), "invincible" }, + { LPGENW("Jealous"), "jealous" }, + { LPGENW("Lonely"), "lonely" }, + { LPGENW("Lost"), "lost" }, + { LPGENW("Lucky"), "lucky" }, + { LPGENW("Mean"), "mean" }, + { LPGENW("Moody"), "moody" }, + { LPGENW("Nervous"), "nervous" }, + { LPGENW("Neutral"), "neutral" }, + { LPGENW("Offended"), "offended" }, + { LPGENW("Outraged"), "outraged" }, + { LPGENW("Playful"), "playful" }, + { LPGENW("Proud"), "proud" }, + { LPGENW("Relaxed"), "relaxed" }, + { LPGENW("Relieved"), "relieved" }, + { LPGENW("Remorseful"), "remorseful" }, + { LPGENW("Restless"), "restless" }, + { LPGENW("Sad"), "sad" }, + { LPGENW("Sarcastic"), "sarcastic" }, + { LPGENW("Satisfied"), "satisfied" }, + { LPGENW("Serious"), "serious" }, + { LPGENW("Shocked"), "shocked" }, + { LPGENW("Shy"), "shy" }, + { LPGENW("Sick"), "sick" }, + { LPGENW("Sleepy"), "sleepy" }, + { LPGENW("Spontaneous"), "spontaneous" }, + { LPGENW("Stressed"), "stressed" }, + { LPGENW("Strong"), "strong" }, + { LPGENW("Surprised"), "surprised" }, + { LPGENW("Thankful"), "thankful" }, + { LPGENW("Thirsty"), "thirsty" }, + { LPGENW("Tired"), "tired" }, + { LPGENW("Undefined"), "undefined" }, + { LPGENW("Weak"), "weak" }, + { LPGENW("Worried"), "worried" }, }; CPepMood::CPepMood(CJabberProto *proto) : @@ -603,7 +603,7 @@ CPepMood::CPepMood(CJabberProto *proto) : m_text(NULL), m_mode(-1) { - UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set mood...")); + UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set mood...")); } CPepMood::~CPepMood() @@ -611,7 +611,7 @@ CPepMood::~CPepMood() mir_free(m_text); } -void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode) +void CPepMood::ProcessItems(const wchar_t *from, HXML itemsNode) { MCONTACT hContact = NULL, hSelfContact = NULL; if (!m_proto->IsMyOwnJID(from)) { @@ -638,7 +638,7 @@ void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode) moodType = XmlGetName(n); } - TCHAR *fixedText = JabberStrFixLines(moodText); + wchar_t *fixedText = JabberStrFixLines(moodText); if (hSelfContact) SetMood(hSelfContact, moodType, fixedText); SetMood(hContact, moodType, fixedText); @@ -668,7 +668,7 @@ void CPepMood::SetExtraIcon(MCONTACT hContact, char *szMood) ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : g_MoodIcons.GetIcolibHandle(szMood)); } -void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szText) +void CPepMood::SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *szText) { int mood = -1; if (szMood) { @@ -691,7 +691,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe replaceStrT(m_text, szText); HANDLE hIcon; - TCHAR title[128]; + wchar_t title[128]; if (mood >= 0) { mir_sntprintf(title, TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName)); hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag); @@ -745,7 +745,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) } HANDLE hIcon; - TCHAR *ptszTitle; + wchar_t *ptszTitle; if (m_mode >= 0) { Publish(); hIcon = g_MoodIcons.GetIcolibHandle(g_arrMoods[m_mode].szTag); ptszTitle = TranslateTS(g_arrMoods[m_mode].szName); @@ -769,89 +769,89 @@ struct { char *szFirst; char *szSecond; - TCHAR *szTitle; + wchar_t *szTitle; int iconid; } static g_arrActivities[] = { - { "doing_chores", NULL, LPGENT("Doing chores"), ACTIVITY_ICON(0, 0) }, - { NULL, "buying_groceries", LPGENT("buying groceries"), ACTIVITY_ICON(0, 1) }, - { NULL, "cleaning", LPGENT("cleaning"), ACTIVITY_ICON(0, 2) }, - { NULL, "cooking", LPGENT("cooking"), ACTIVITY_ICON(0, 3) }, - { NULL, "doing_maintenance", LPGENT("doing maintenance"), ACTIVITY_ICON(0, 4) }, - { NULL, "doing_the_dishes", LPGENT("doing the dishes"), ACTIVITY_ICON(0, 5) }, - { NULL, "doing_the_laundry", LPGENT("doing the laundry"), ACTIVITY_ICON(0, 6) }, - { NULL, "gardening", LPGENT("gardening"), ACTIVITY_ICON(0, 7) }, - { NULL, "running_an_errand", LPGENT("running an errand"), ACTIVITY_ICON(0, 8) }, - { NULL, "walking_the_dog", LPGENT("walking the dog"), ACTIVITY_ICON(0, 9) }, - { "drinking", NULL, LPGENT("Drinking"), ACTIVITY_ICON(1, 0) }, - { NULL, "having_a_beer", LPGENT("having a beer"), ACTIVITY_ICON(1, 1) }, - { NULL, "having_coffee", LPGENT("having coffee"), ACTIVITY_ICON(1, 2) }, - { NULL, "having_tea", LPGENT("having tea"), ACTIVITY_ICON(1, 3) }, - { "eating", NULL, LPGENT("Eating"), ACTIVITY_ICON(2, 0) }, - { NULL, "having_a_snack", LPGENT("having a snack"), ACTIVITY_ICON(2, 1) }, - { NULL, "having_breakfast", LPGENT("having breakfast"), ACTIVITY_ICON(2, 2) }, - { NULL, "having_dinner", LPGENT("having dinner"), ACTIVITY_ICON(2, 3) }, - { NULL, "having_lunch", LPGENT("having lunch"), ACTIVITY_ICON(2, 4) }, - { "exercising", NULL, LPGENT("Exercising"), ACTIVITY_ICON(3, 0) }, - { NULL, "cycling", LPGENT("cycling"), ACTIVITY_ICON(3, 1) }, - { NULL, "dancing", LPGENT("dancing"), ACTIVITY_ICON(3, 2) }, - { NULL, "hiking", LPGENT("hiking"), ACTIVITY_ICON(3, 3) }, - { NULL, "jogging", LPGENT("jogging"), ACTIVITY_ICON(3, 4) }, - { NULL, "playing_sports", LPGENT("playing sports"), ACTIVITY_ICON(3, 5) }, - { NULL, "running", LPGENT("running"), ACTIVITY_ICON(3, 6) }, - { NULL, "skiing", LPGENT("skiing"), ACTIVITY_ICON(3, 7) }, - { NULL, "swimming", LPGENT("swimming"), ACTIVITY_ICON(3, 8) }, - { NULL, "working_out", LPGENT("working out"), ACTIVITY_ICON(3, 9) }, - { "grooming", NULL, LPGENT("Grooming"), ACTIVITY_ICON(4, 0) }, - { NULL, "at_the_spa", LPGENT("at the spa"), ACTIVITY_ICON(4, 1) }, - { NULL, "brushing_teeth", LPGENT("brushing teeth"), ACTIVITY_ICON(4, 2) }, - { NULL, "getting_a_haircut", LPGENT("getting a haircut"), ACTIVITY_ICON(4, 3) }, - { NULL, "shaving", LPGENT("shaving"), ACTIVITY_ICON(4, 4) }, - { NULL, "taking_a_bath", LPGENT("taking a bath"), ACTIVITY_ICON(4, 5) }, - { NULL, "taking_a_shower", LPGENT("taking a shower"), ACTIVITY_ICON(4, 6) }, - { "having_appointment", NULL, LPGENT("Having appointment"), ACTIVITY_ICON(5, 0) }, - { "inactive", NULL, LPGENT("Inactive"), ACTIVITY_ICON(6, 0) }, - { NULL, "day_off", LPGENT("day off"), ACTIVITY_ICON(6, 1) }, - { NULL, "hanging_out", LPGENT("hanging out"), ACTIVITY_ICON(6, 2) }, - { NULL, "hiding", LPGENT("hiding"), ACTIVITY_ICON(6, 3) }, - { NULL, "on_vacation", LPGENT("on vacation"), ACTIVITY_ICON(6, 4) }, - { NULL, "praying", LPGENT("praying"), ACTIVITY_ICON(6, 5) }, - { NULL, "scheduled_holiday", LPGENT("scheduled holiday"), ACTIVITY_ICON(6, 6) }, - { NULL, "sleeping", LPGENT("sleeping"), ACTIVITY_ICON(6, 7) }, - { NULL, "thinking", LPGENT("thinking"), ACTIVITY_ICON(6, 8) }, - { "relaxing", NULL, LPGENT("Relaxing"), ACTIVITY_ICON(7, 0) }, - { NULL, "fishing", LPGENT("fishing"), ACTIVITY_ICON(7, 1) }, - { NULL, "gaming", LPGENT("gaming"), ACTIVITY_ICON(7, 2) }, - { NULL, "going_out", LPGENT("going out"), ACTIVITY_ICON(7, 3) }, - { NULL, "partying", LPGENT("partying"), ACTIVITY_ICON(7, 4) }, - { NULL, "reading", LPGENT("reading"), ACTIVITY_ICON(7, 5) }, - { NULL, "rehearsing", LPGENT("rehearsing"), ACTIVITY_ICON(7, 6) }, - { NULL, "shopping", LPGENT("shopping"), ACTIVITY_ICON(7, 7) }, - { NULL, "smoking", LPGENT("smoking"), ACTIVITY_ICON(7, 8) }, - { NULL, "socializing", LPGENT("socializing"), ACTIVITY_ICON(7, 9) }, - { NULL, "sunbathing", LPGENT("sunbathing"), ACTIVITY_ICON(7, 10) }, - { NULL, "watching_tv", LPGENT("watching TV"), ACTIVITY_ICON(7, 11) }, - { NULL, "watching_a_movie", LPGENT("watching a movie"), ACTIVITY_ICON(7, 12) }, - { "talking", NULL, LPGENT("Talking"), ACTIVITY_ICON(8, 0) }, - { NULL, "in_real_life", LPGENT("in real life"), ACTIVITY_ICON(8, 1) }, - { NULL, "on_the_phone", LPGENT("on the phone"), ACTIVITY_ICON(8, 2) }, - { NULL, "on_video_phone", LPGENT("on video phone"), ACTIVITY_ICON(8, 3) }, - { "traveling", NULL, LPGENT("Traveling"), ACTIVITY_ICON(9, 0) }, - { NULL, "commuting", LPGENT("commuting"), ACTIVITY_ICON(9, 1) }, - { NULL, "cycling", LPGENT("cycling"), ACTIVITY_ICON(9, 2) }, - { NULL, "driving", LPGENT("driving"), ACTIVITY_ICON(9, 3) }, - { NULL, "in_a_car", LPGENT("in a car"), ACTIVITY_ICON(9, 4) }, - { NULL, "on_a_bus", LPGENT("on a bus"), ACTIVITY_ICON(9, 5) }, - { NULL, "on_a_plane", LPGENT("on a plane"), ACTIVITY_ICON(9, 6) }, - { NULL, "on_a_train", LPGENT("on a train"), ACTIVITY_ICON(9, 7) }, - { NULL, "on_a_trip", LPGENT("on a trip"), ACTIVITY_ICON(9, 8) }, - { NULL, "walking", LPGENT("walking"), ACTIVITY_ICON(9, 9) }, - { "working", NULL, LPGENT("Working"), ACTIVITY_ICON(10, 0) }, - { NULL, "coding", LPGENT("coding"), ACTIVITY_ICON(10, 1) }, - { NULL, "in_a_meeting", LPGENT("in a meeting"), ACTIVITY_ICON(10, 2) }, - { NULL, "studying", LPGENT("studying"), ACTIVITY_ICON(10, 3) }, - { NULL, "writing", LPGENT("writing"), ACTIVITY_ICON(10, 4) }, + { "doing_chores", NULL, LPGENW("Doing chores"), ACTIVITY_ICON(0, 0) }, + { NULL, "buying_groceries", LPGENW("buying groceries"), ACTIVITY_ICON(0, 1) }, + { NULL, "cleaning", LPGENW("cleaning"), ACTIVITY_ICON(0, 2) }, + { NULL, "cooking", LPGENW("cooking"), ACTIVITY_ICON(0, 3) }, + { NULL, "doing_maintenance", LPGENW("doing maintenance"), ACTIVITY_ICON(0, 4) }, + { NULL, "doing_the_dishes", LPGENW("doing the dishes"), ACTIVITY_ICON(0, 5) }, + { NULL, "doing_the_laundry", LPGENW("doing the laundry"), ACTIVITY_ICON(0, 6) }, + { NULL, "gardening", LPGENW("gardening"), ACTIVITY_ICON(0, 7) }, + { NULL, "running_an_errand", LPGENW("running an errand"), ACTIVITY_ICON(0, 8) }, + { NULL, "walking_the_dog", LPGENW("walking the dog"), ACTIVITY_ICON(0, 9) }, + { "drinking", NULL, LPGENW("Drinking"), ACTIVITY_ICON(1, 0) }, + { NULL, "having_a_beer", LPGENW("having a beer"), ACTIVITY_ICON(1, 1) }, + { NULL, "having_coffee", LPGENW("having coffee"), ACTIVITY_ICON(1, 2) }, + { NULL, "having_tea", LPGENW("having tea"), ACTIVITY_ICON(1, 3) }, + { "eating", NULL, LPGENW("Eating"), ACTIVITY_ICON(2, 0) }, + { NULL, "having_a_snack", LPGENW("having a snack"), ACTIVITY_ICON(2, 1) }, + { NULL, "having_breakfast", LPGENW("having breakfast"), ACTIVITY_ICON(2, 2) }, + { NULL, "having_dinner", LPGENW("having dinner"), ACTIVITY_ICON(2, 3) }, + { NULL, "having_lunch", LPGENW("having lunch"), ACTIVITY_ICON(2, 4) }, + { "exercising", NULL, LPGENW("Exercising"), ACTIVITY_ICON(3, 0) }, + { NULL, "cycling", LPGENW("cycling"), ACTIVITY_ICON(3, 1) }, + { NULL, "dancing", LPGENW("dancing"), ACTIVITY_ICON(3, 2) }, + { NULL, "hiking", LPGENW("hiking"), ACTIVITY_ICON(3, 3) }, + { NULL, "jogging", LPGENW("jogging"), ACTIVITY_ICON(3, 4) }, + { NULL, "playing_sports", LPGENW("playing sports"), ACTIVITY_ICON(3, 5) }, + { NULL, "running", LPGENW("running"), ACTIVITY_ICON(3, 6) }, + { NULL, "skiing", LPGENW("skiing"), ACTIVITY_ICON(3, 7) }, + { NULL, "swimming", LPGENW("swimming"), ACTIVITY_ICON(3, 8) }, + { NULL, "working_out", LPGENW("working out"), ACTIVITY_ICON(3, 9) }, + { "grooming", NULL, LPGENW("Grooming"), ACTIVITY_ICON(4, 0) }, + { NULL, "at_the_spa", LPGENW("at the spa"), ACTIVITY_ICON(4, 1) }, + { NULL, "brushing_teeth", LPGENW("brushing teeth"), ACTIVITY_ICON(4, 2) }, + { NULL, "getting_a_haircut", LPGENW("getting a haircut"), ACTIVITY_ICON(4, 3) }, + { NULL, "shaving", LPGENW("shaving"), ACTIVITY_ICON(4, 4) }, + { NULL, "taking_a_bath", LPGENW("taking a bath"), ACTIVITY_ICON(4, 5) }, + { NULL, "taking_a_shower", LPGENW("taking a shower"), ACTIVITY_ICON(4, 6) }, + { "having_appointment", NULL, LPGENW("Having appointment"), ACTIVITY_ICON(5, 0) }, + { "inactive", NULL, LPGENW("Inactive"), ACTIVITY_ICON(6, 0) }, + { NULL, "day_off", LPGENW("day off"), ACTIVITY_ICON(6, 1) }, + { NULL, "hanging_out", LPGENW("hanging out"), ACTIVITY_ICON(6, 2) }, + { NULL, "hiding", LPGENW("hiding"), ACTIVITY_ICON(6, 3) }, + { NULL, "on_vacation", LPGENW("on vacation"), ACTIVITY_ICON(6, 4) }, + { NULL, "praying", LPGENW("praying"), ACTIVITY_ICON(6, 5) }, + { NULL, "scheduled_holiday", LPGENW("scheduled holiday"), ACTIVITY_ICON(6, 6) }, + { NULL, "sleeping", LPGENW("sleeping"), ACTIVITY_ICON(6, 7) }, + { NULL, "thinking", LPGENW("thinking"), ACTIVITY_ICON(6, 8) }, + { "relaxing", NULL, LPGENW("Relaxing"), ACTIVITY_ICON(7, 0) }, + { NULL, "fishing", LPGENW("fishing"), ACTIVITY_ICON(7, 1) }, + { NULL, "gaming", LPGENW("gaming"), ACTIVITY_ICON(7, 2) }, + { NULL, "going_out", LPGENW("going out"), ACTIVITY_ICON(7, 3) }, + { NULL, "partying", LPGENW("partying"), ACTIVITY_ICON(7, 4) }, + { NULL, "reading", LPGENW("reading"), ACTIVITY_ICON(7, 5) }, + { NULL, "rehearsing", LPGENW("rehearsing"), ACTIVITY_ICON(7, 6) }, + { NULL, "shopping", LPGENW("shopping"), ACTIVITY_ICON(7, 7) }, + { NULL, "smoking", LPGENW("smoking"), ACTIVITY_ICON(7, 8) }, + { NULL, "socializing", LPGENW("socializing"), ACTIVITY_ICON(7, 9) }, + { NULL, "sunbathing", LPGENW("sunbathing"), ACTIVITY_ICON(7, 10) }, + { NULL, "watching_tv", LPGENW("watching TV"), ACTIVITY_ICON(7, 11) }, + { NULL, "watching_a_movie", LPGENW("watching a movie"), ACTIVITY_ICON(7, 12) }, + { "talking", NULL, LPGENW("Talking"), ACTIVITY_ICON(8, 0) }, + { NULL, "in_real_life", LPGENW("in real life"), ACTIVITY_ICON(8, 1) }, + { NULL, "on_the_phone", LPGENW("on the phone"), ACTIVITY_ICON(8, 2) }, + { NULL, "on_video_phone", LPGENW("on video phone"), ACTIVITY_ICON(8, 3) }, + { "traveling", NULL, LPGENW("Traveling"), ACTIVITY_ICON(9, 0) }, + { NULL, "commuting", LPGENW("commuting"), ACTIVITY_ICON(9, 1) }, + { NULL, "cycling", LPGENW("cycling"), ACTIVITY_ICON(9, 2) }, + { NULL, "driving", LPGENW("driving"), ACTIVITY_ICON(9, 3) }, + { NULL, "in_a_car", LPGENW("in a car"), ACTIVITY_ICON(9, 4) }, + { NULL, "on_a_bus", LPGENW("on a bus"), ACTIVITY_ICON(9, 5) }, + { NULL, "on_a_plane", LPGENW("on a plane"), ACTIVITY_ICON(9, 6) }, + { NULL, "on_a_train", LPGENW("on a train"), ACTIVITY_ICON(9, 7) }, + { NULL, "on_a_trip", LPGENW("on a trip"), ACTIVITY_ICON(9, 8) }, + { NULL, "walking", LPGENW("walking"), ACTIVITY_ICON(9, 9) }, + { "working", NULL, LPGENW("Working"), ACTIVITY_ICON(10, 0) }, + { NULL, "coding", LPGENW("coding"), ACTIVITY_ICON(10, 1) }, + { NULL, "in_a_meeting", LPGENW("in a meeting"), ACTIVITY_ICON(10, 2) }, + { NULL, "studying", LPGENW("studying"), ACTIVITY_ICON(10, 3) }, + { NULL, "writing", LPGENW("writing"), ACTIVITY_ICON(10, 4) }, { NULL, NULL, NULL } // the end, don't delete this }; @@ -945,7 +945,7 @@ char *ActivityGetSecond(int id) return (id >= 0) ? g_arrActivities[id].szSecond : NULL; } -TCHAR *ActivityGetFirstTitle(int id) +wchar_t *ActivityGetFirstTitle(int id) { if (id >= _countof(g_arrActivities) - 1) return NULL; @@ -959,15 +959,15 @@ TCHAR *ActivityGetFirstTitle(int id) return NULL; } -TCHAR *ActivityGetSecondTitle(int id) +wchar_t *ActivityGetSecondTitle(int id) { return ((id >= 0) && g_arrActivities[id].szSecond) ? g_arrActivities[id].szTitle : NULL; } -void ActivityBuildTitle(int id, TCHAR *buf, int size) +void ActivityBuildTitle(int id, wchar_t *buf, int size) { - TCHAR *szFirst = ActivityGetFirstTitle(id); - TCHAR *szSecond = ActivityGetSecondTitle(id); + wchar_t *szFirst = ActivityGetFirstTitle(id); + wchar_t *szSecond = ActivityGetSecondTitle(id); if (szFirst) { if (szSecond) @@ -983,7 +983,7 @@ CPepActivity::CPepActivity(CJabberProto *proto): m_text(NULL), m_mode(-1) { - UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set activity...")); + UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set activity...")); } CPepActivity::~CPepActivity() @@ -991,7 +991,7 @@ CPepActivity::~CPepActivity() mir_free(m_text); } -void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode) +void CPepActivity::ProcessItems(const wchar_t *from, HXML itemsNode) { MCONTACT hContact = NULL, hSelfContact = NULL; if (!m_proto->IsMyOwnJID(from)) { @@ -1025,7 +1025,7 @@ void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode) } } - TCHAR *fixedText = JabberStrFixLines(szText); + wchar_t *fixedText = JabberStrFixLines(szText); if (hSelfContact) SetActivity(hSelfContact, szFirstNode, szSecondNode, fixedText); SetActivity(hContact, szFirstNode, szSecondNode, fixedText); @@ -1071,7 +1071,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec return; } - TCHAR activityTitle[128]; + wchar_t activityTitle[128]; ActivityBuildTitle(activity, activityTitle, _countof(activityTitle)); if (!hContact) { @@ -1079,7 +1079,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec replaceStrT(m_text, szText); HANDLE hIcon; - TCHAR title[128]; + wchar_t title[128]; if (activity >= 0) { mir_sntprintf(title, TranslateT("Activity: %s"), activityTitle); @@ -1097,7 +1097,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec else SetExtraIcon(hContact, activity < 0 ? NULL : returnActivity(activity)); if (activity >= 0) { - TCHAR *p = mir_a2t(ActivityGetId(activity)); + wchar_t *p = mir_a2t(ActivityGetId(activity)); m_proto->WriteAdvStatus(hContact, ADVSTATUS_ACTIVITY, p, g_ActivityIcons.GetIcolibName(returnActivity(activity)), activityTitle, szText); mir_free(p); } @@ -1127,7 +1127,7 @@ void CPepActivity::ShowSetDialog(BYTE) } else { Retract(); - UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENT("Set activity...")); + UpdateMenuItem(Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), LPGENW("Set activity...")); if (m_proto->m_pInfoFrame) m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", Skin_GetIconHandle(SKINICON_OTHER_SMALLDOT), TranslateT("Set activity...")); } @@ -1169,7 +1169,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // SendPepMood - sends mood -BOOL CJabberProto::SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri) +BOOL CJabberProto::SendPepTune(wchar_t* szArtist, wchar_t* szLength, wchar_t* szSource, wchar_t* szTitle, wchar_t* szTrack, wchar_t* szUri) { if (!m_bJabberOnline || !m_bPepSupported) return FALSE; @@ -1200,21 +1200,21 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s return; } - TCHAR *szListeningTo; + wchar_t *szListeningTo; if (ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)) { LISTENINGTOINFO li; memset(&li, 0, sizeof(li)); li.cbSize = sizeof(li); li.dwFlags = LTI_TCHAR; - li.ptszArtist = (TCHAR*)szArtist; - li.ptszLength = (TCHAR*)szLength; - li.ptszAlbum = (TCHAR*)szSource; - li.ptszTitle = (TCHAR*)szTitle; - li.ptszTrack = (TCHAR*)szTrack; - szListeningTo = (TCHAR*)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&li); + li.ptszArtist = (wchar_t*)szArtist; + li.ptszLength = (wchar_t*)szLength; + li.ptszAlbum = (wchar_t*)szSource; + li.ptszTitle = (wchar_t*)szTitle; + li.ptszTrack = (wchar_t*)szTrack; + szListeningTo = (wchar_t*)CallService(MS_LISTENINGTO_GETPARSEDTEXT, (WPARAM)L"%title% - %artist%", (LPARAM)&li); } else { - szListeningTo = (TCHAR*)mir_alloc(2048 * sizeof(TCHAR)); + szListeningTo = (wchar_t*)mir_alloc(2048 * sizeof(wchar_t)); mir_sntprintf(szListeningTo, 2047, L"%s - %s", szTitle ? szTitle : L"", szArtist ? szArtist : L""); } @@ -1227,7 +1227,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s mir_free(szListeningTo); } -TCHAR* a2tf(const TCHAR *str, BOOL unicode) +wchar_t* a2tf(const wchar_t *str, BOOL unicode) { if (str == NULL) return NULL; @@ -1235,7 +1235,7 @@ TCHAR* a2tf(const TCHAR *str, BOOL unicode) return (unicode) ? mir_tstrdup(str) : mir_a2t((char*)str); } -void overrideStr(TCHAR*& dest, const TCHAR *src, BOOL unicode, const TCHAR *def = NULL) +void overrideStr(wchar_t*& dest, const wchar_t *src, BOOL unicode, const wchar_t *def = NULL) { if (dest != NULL) { mir_free(dest); @@ -1256,8 +1256,8 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) delSetting("ListeningTo"); } else { - TCHAR *szArtist = NULL, *szLength = NULL, *szSource = NULL; - TCHAR *szTitle = NULL, *szTrack = NULL; + wchar_t *szArtist = NULL, *szLength = NULL, *szSource = NULL; + wchar_t *szTitle = NULL, *szTrack = NULL; BOOL unicode = cm->dwFlags & LTI_UNICODE; @@ -1267,20 +1267,20 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) overrideStr(szTrack, cm->ptszTrack, unicode); overrideStr(szLength, cm->ptszLength, unicode); - TCHAR szLengthInSec[ 32 ]; + wchar_t szLengthInSec[ 32 ]; szLengthInSec[ 0 ] = 0; if (szLength) { unsigned int multiplier = 1, result = 0; - for (TCHAR *p = szLength; *p; p++) - if (*p == _T(':')) + for (wchar_t *p = szLength; *p; p++) + if (*p == ':') multiplier *= 60; if (multiplier <= 3600) { - TCHAR *szTmp = szLength; + wchar_t *szTmp = szLength; while (szTmp[0]) { - result += (_ttoi(szTmp) * multiplier); + result += (_wtoi(szTmp) * multiplier); multiplier /= 60; - szTmp = _tcschr(szTmp, _T(':')); + szTmp = wcschr(szTmp, ':'); if (!szTmp) break; szTmp++; @@ -1367,7 +1367,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_UNICODE) { ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE)); if (title) - _tcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE); + wcsncpy_s(pData->ptszName, STATUS_TITLE_MAX, title, _TRUNCATE); } else { ptrA title(ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TITLE)); @@ -1383,7 +1383,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_UNICODE) { ptrT title(ReadAdvStatusT(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT)); if (title) - _tcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE); + wcsncpy_s(pData->ptszMessage, STATUS_TITLE_MAX, title, _TRUNCATE); } else { ptrA title(ReadAdvStatusA(hContact, ADVSTATUS_MOOD, ADVSTATUS_VAL_TEXT)); @@ -1463,7 +1463,7 @@ void CJabberProto::ResetAdvStatus(MCONTACT hContact, const char *pszSlot) db_unset(hContact, "AdvStatus", szSetting); } -void CJabberProto::WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText) +void CJabberProto::WriteAdvStatus(MCONTACT hContact, const char *pszSlot, const wchar_t *pszMode, const char *pszIcon, const wchar_t *pszTitle, const wchar_t *pszText) { char szSetting[128]; @@ -1490,7 +1490,7 @@ char* CJabberProto::ReadAdvStatusA(MCONTACT hContact, const char *pszSlot, const return db_get_sa(hContact, "AdvStatus", szSetting); } -TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue) +wchar_t* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, const char *pszValue) { char szSetting[128]; mir_snprintf(szSetting, "%s/%s/%s", m_szModuleName, pszSlot, pszValue); @@ -1502,18 +1502,18 @@ TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, cons void g_XstatusIconsInit() { - TCHAR szFile[MAX_PATH]; + wchar_t szFile[MAX_PATH]; GetModuleFileName(hInst, szFile, _countof(szFile)); - if (TCHAR *p = _tcsrchr(szFile, '\\')) + if (wchar_t *p = wcsrchr(szFile, '\\')) mir_tstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll"); - TCHAR szSection[100]; - mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENT("Moods")); + wchar_t szSection[100]; + mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Moods")); for (int i = 1; i < _countof(g_arrMoods); i++) g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName)); - mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENT("Activities")); + mir_tstrcpy(szSection, L"Protocols/Jabber/" LPGENW("Activities")); for (int k = 0; k < _countof(g_arrActivities); k++) { if (g_arrActivities[k].szFirst) g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle)); diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index 194a4c71de..ccda5b0886 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -32,12 +32,12 @@ struct CJabberProto; class CPepService { public: - CPepService(CJabberProto *proto, char *name, TCHAR *node); + CPepService(CJabberProto *proto, char *name, wchar_t *node); virtual ~CPepService(); HGENMENU GetMenu() { return m_hMenuItem; } - TCHAR *GetNode() { return m_node; } - virtual void ProcessItems(const TCHAR *from, HXML items) = 0; + wchar_t *GetNode() { return m_node; } + virtual void ProcessItems(const wchar_t *from, HXML items) = 0; void Publish(); void Retract(); @@ -52,7 +52,7 @@ protected: CJabberProto *m_proto; bool m_wasPublished; char *m_name; - TCHAR *m_node; + wchar_t *m_node; HGENMENU m_hMenuItem; virtual void CreateData(HXML) = 0; @@ -64,7 +64,7 @@ class CPepServiceList: public OBJLIST<CPepService> public: CPepServiceList(): OBJLIST<CPepService>(1) {} - void ProcessEvent(const TCHAR *from, HXML eventNode) + void ProcessEvent(const wchar_t *from, HXML eventNode) { for (int i=0; i < getCount(); i++) { @@ -111,7 +111,7 @@ public: (*this)[i].ResetPublish(); } - CPepService *Find(TCHAR *node) + CPepService *Find(wchar_t *node) { for (int i=0; i < getCount(); i++) if (!mir_tstrcmp((*this)[i].GetNode(), node)) @@ -124,20 +124,20 @@ class CPepGuiService: public CPepService { typedef CPepService CSuper; public: - CPepGuiService(CJabberProto *proto, char *name, TCHAR *node); + CPepGuiService(CJabberProto *proto, char *name, wchar_t *node); ~CPepGuiService(); void InitGui(); void RebuildMenu(); bool LaunchSetGui(BYTE bQuiet); protected: - void UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text); + void UpdateMenuItem(HANDLE hIcolibIcon, wchar_t *text); virtual void ShowSetDialog(BYTE bQuiet) = 0; private: HANDLE m_hMenuService; HANDLE m_hIcolibItem; - TCHAR *m_szText; + wchar_t *m_szText; bool m_bGuiOpen; @@ -150,11 +150,11 @@ class CPepMood: public CPepGuiService public: CPepMood(CJabberProto *proto); ~CPepMood(); - void ProcessItems(const TCHAR *from, HXML items); + void ProcessItems(const wchar_t *from, HXML items); void ResetExtraIcon(MCONTACT hContact); public: - TCHAR *m_text; + wchar_t *m_text; int m_mode; protected: @@ -162,7 +162,7 @@ protected: void ShowSetDialog(BYTE bQuiet); void SetExtraIcon(MCONTACT hContact, char *szMood); - void SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szText); + void SetMood(MCONTACT hContact, const wchar_t *szMood, const wchar_t *szText); }; class CPepActivity: public CPepGuiService @@ -171,11 +171,11 @@ class CPepActivity: public CPepGuiService public: CPepActivity(CJabberProto *proto); ~CPepActivity(); - void ProcessItems(const TCHAR *from, HXML items); + void ProcessItems(const wchar_t *from, HXML items); void ResetExtraIcon(MCONTACT hContact); protected: - TCHAR *m_text; + wchar_t *m_text; int m_mode; void CreateData(HXML); diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 805b83eb23..56f199f509 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -149,7 +149,7 @@ public: CCtrlFilterListView(CDlgBase* dlg, int ctrlId, bool trackFilter, bool keepHiglight); ~CCtrlFilterListView(); - TCHAR *GetFilterText(); + wchar_t *GetFilterText(); CCallback<CCtrlFilterListView> OnFilterChanged; protected: @@ -159,7 +159,7 @@ protected: void OnInit(); LRESULT CustomWndProc(UINT msg, WPARAM wParam, LPARAM lParam); - void FilterHighlight(TCHAR *filter); + void FilterHighlight(wchar_t *filter); }; #if !defined(OPENFILENAME_SIZE_VERSION_400) @@ -177,8 +177,8 @@ protected: #define JABBER_IQID "mir_" #define JABBER_MAX_JID_LEN 1024 -#define JABBER_GC_MSG_QUIT LPGENT("I'm happy Miranda NG user. Get it at http://miranda-ng.org/.") -#define JABBER_GC_MSG_SLAP LPGENT("/me slaps %s around a bit with a large trout") +#define JABBER_GC_MSG_QUIT LPGENW("I'm happy Miranda NG user. Get it at http://miranda-ng.org/.") +#define JABBER_GC_MSG_SLAP LPGENW("/me slaps %s around a bit with a large trout") #define JABBER_SERVER_URL "https://xmpp.net/services.php" // registered db event types @@ -307,12 +307,12 @@ enum { struct CJabberHttpAuthParams { enum {IQ = 1, MSG = 2} m_nType; - TCHAR *m_szFrom; - TCHAR *m_szIqId; - TCHAR *m_szThreadId; - TCHAR *m_szId; - TCHAR *m_szMethod; - TCHAR *m_szUrl; + wchar_t *m_szFrom; + wchar_t *m_szIqId; + wchar_t *m_szThreadId; + wchar_t *m_szId; + wchar_t *m_szMethod; + wchar_t *m_szUrl; CJabberHttpAuthParams() { memset(this, 0, sizeof(CJabberHttpAuthParams)); @@ -352,8 +352,8 @@ typedef HANDLE JABBER_SOCKET; struct JABBER_CONN_DATA : public MZeroedObject { - TCHAR username[512]; - TCHAR password[512]; + wchar_t username[512]; + wchar_t password[512]; char server[128]; char manualHost[128]; int port; @@ -401,8 +401,8 @@ struct ThreadData // connection & login data JABBER_CONN_DATA conn; - TCHAR resource[128]; - TCHAR fullJID[JABBER_MAX_JID_LEN]; + wchar_t resource[128]; + wchar_t fullJID[JABBER_MAX_JID_LEN]; ptrT tszNewPassword; class TJabberAuth *auth; @@ -420,11 +420,11 @@ struct ThreadData struct JABBER_MODEMSGS { - TCHAR *szOnline; - TCHAR *szAway; - TCHAR *szNa; - TCHAR *szDnd; - TCHAR *szFreechat; + wchar_t *szOnline; + wchar_t *szAway; + wchar_t *szNa; + wchar_t *szDnd; + wchar_t *szFreechat; }; typedef enum { FT_SI, FT_OOB, FT_BYTESTREAM, FT_IBB } JABBER_FT_TYPE; @@ -444,10 +444,10 @@ struct filetransfer JABBER_FT_TYPE type; JABBER_SOCKET s; JABBER_FILE_STATE state; - TCHAR *jid; + wchar_t *jid; int fileId; - TCHAR* szId; - TCHAR *sid; + wchar_t* szId; + wchar_t *sid; int bCompleted; HANDLE hWaitEvent; @@ -459,13 +459,13 @@ struct filetransfer // Used by file receiving only char* httpHostName; WORD httpPort; - TCHAR *httpPath; + wchar_t *httpPath; unsigned __int64 dwExpectedRecvFileSize; // Used by file sending only HANDLE hFileEvent; unsigned __int64 *fileSize; - TCHAR *szDescription; + wchar_t *szDescription; CJabberProto *ppro; }; @@ -500,11 +500,11 @@ struct JABBER_MUC_JIDLIST_INFO ~JABBER_MUC_JIDLIST_INFO(); JABBER_MUC_JIDLIST_TYPE type; - TCHAR *roomJid; // filled-in by the WM_JABBER_REFRESH code + wchar_t *roomJid; // filled-in by the WM_JABBER_REFRESH code HXML iqNode; CJabberProto *ppro; - TCHAR *type2str(void) const; + wchar_t *type2str(void) const; }; typedef void (CJabberProto::*JABBER_FORM_SUBMIT_FUNC)(HXML values, void *userdata); @@ -533,7 +533,7 @@ public: void CreateInfoItem(char *pszName, bool bCompact=false, LPARAM pUserData=0); void SetInfoItemCallback(char *pszName, void (CJabberProto::*onEvent)(CJabberInfoFrame_Event *)); - void UpdateInfoItem(char *pszName, HANDLE hIcolibItem, TCHAR *pszText); + void UpdateInfoItem(char *pszName, HANDLE hIcolibItem, wchar_t *pszText); void ShowInfoItem(char *pszName, bool bShow); void RemoveInfoItem(char *pszName); @@ -564,7 +564,7 @@ private: void UpdateSize(); void RemoveTooltip(int id); - void SetToolTip(int id, RECT *rc, TCHAR *pszText); + void SetToolTip(int id, RECT *rc, wchar_t *pszText); void PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF fallback); void PaintCompact(HDC hdc); @@ -590,7 +590,7 @@ extern HINSTANCE hInst; extern HANDLE hExtraMood; extern HANDLE hExtraActivity; -extern TCHAR szCoreVersion[]; +extern wchar_t szCoreVersion[]; extern unsigned int g_nTempFileId; extern int g_cbCountries; @@ -613,11 +613,11 @@ void TreeList_Reset(HWND hwnd); void TreeList_SetMode(HWND hwnd, int mode); HTREELISTITEM TreeList_GetActiveItem(HWND hwnd); void TreeList_SetSortMode(HWND hwnd, int col, BOOL descending); -void TreeList_SetFilter(HWND hwnd, TCHAR *filter); -HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, TCHAR *text, LPARAM data); +void TreeList_SetFilter(HWND hwnd, wchar_t *filter); +HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, wchar_t *text, LPARAM data); void TreeList_ResetItem(HWND hwnd, HTREELISTITEM hParent); void TreeList_MakeFakeParent(HTREELISTITEM hItem, BOOL flag); -void TreeList_AppendColumn(HTREELISTITEM hItem, TCHAR *text); +void TreeList_AppendColumn(HTREELISTITEM hItem, wchar_t *text); int TreeList_AddIcon(HWND hwnd, HICON hIcon, int iOverlay); void TreeList_SetIcon(HTREELISTITEM hItem, int iIcon, int iOverlay); LPARAM TreeList_GetData(HTREELISTITEM hItem); @@ -641,9 +641,9 @@ typedef struct TJabberFormLayoutInfo *HJFORMLAYOUT; void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bCompact = FALSE); void JabberFormDestroyUI(HWND hwndStatic); -void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text); +void JabberFormSetInstruction(HWND hwndForm, const wchar_t *text); HJFORMLAYOUT JabberFormCreateLayout(HWND hwndStatic); // use mir_free to destroy -HJFORMCTRL JabberFormAppendControl(HWND hwndStatic, HJFORMLAYOUT layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr); +HJFORMCTRL JabberFormAppendControl(HWND hwndStatic, HJFORMLAYOUT layout_info, TJabberFormControlType type, const wchar_t *labelStr, const wchar_t *valueStr); void JabberFormLayoutControls(HWND hwndStatic, HJFORMLAYOUT layout_info, int *formHeight); HXML JabberFormGetData(HWND hwndStatic, HXML xNode); @@ -659,7 +659,7 @@ void ImageList_AddIcon_Icolib(HIMAGELIST hIml, HICON hIcon); //---- jabber_libstr.c ---------------------------------------------- -int lstrcmp_null(const TCHAR *s1, const TCHAR *s2); +int lstrcmp_null(const wchar_t *s1, const wchar_t *s2); //---- jabber_menu.c ------------------------------------------------ @@ -670,17 +670,17 @@ int g_OnToolbarInit(WPARAM, LPARAM); //---- jabber_misc.c ------------------------------------------------ void JabberChatDllError(void); -TCHAR* UnEscapeChatTags(TCHAR* str_in); +wchar_t* UnEscapeChatTags(wchar_t* str_in); //---- jabber_adhoc.cpp --------------------------------------------- struct CJabberAdhocStartupParams { - TCHAR *m_szJid; - TCHAR *m_szNode; + wchar_t *m_szJid; + wchar_t *m_szNode; CJabberProto *m_pProto; - CJabberAdhocStartupParams(CJabberProto *proto, TCHAR* szJid, TCHAR* szNode = NULL) + CJabberAdhocStartupParams(CJabberProto *proto, wchar_t* szJid, wchar_t* szNode = NULL) { m_pProto = proto; m_szJid = mir_tstrdup(szJid); @@ -702,7 +702,7 @@ struct JabberAdHocData RECT frameRect; HXML AdHocNode; HXML CommandsNode; - TCHAR *ResponderJID; + wchar_t *ResponderJID; }; //---- jabber_util.cpp ------------------------------------------------------------------ @@ -725,27 +725,27 @@ struct TStringPairs typedef char JabberShaStrBuf[2*MIR_SHA1_HASH_SIZE + 1]; -TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid); -TCHAR* JabberPrepareJid(LPCTSTR jid); +wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid); +wchar_t* JabberPrepareJid(LPCTSTR jid); void __stdcall JabberUrlDecodeW(WCHAR *str); char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf); -TCHAR* __stdcall JabberStrFixLines(const TCHAR *str); -void __stdcall JabberHttpUrlDecode(TCHAR *str); +wchar_t* __stdcall JabberStrFixLines(const wchar_t *str); +void __stdcall JabberHttpUrlDecode(wchar_t *str); int __stdcall JabberCombineStatus(int status1, int status2); -TCHAR* __stdcall JabberErrorStr(int errorCode); -TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int *errorCode = NULL); -time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp); -TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen); +wchar_t* __stdcall JabberErrorStr(int errorCode); +wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int *errorCode = NULL); +time_t __stdcall JabberIsoToUnixTime(const wchar_t *stamp); +wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t destLen); int __stdcall JabberGetPacketID(HXML n); -TCHAR* __stdcall JabberId2string(int id); +wchar_t* __stdcall JabberId2string(int id); LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf); -TCHAR* time2str(time_t _time, TCHAR *buf, size_t bufLen); -time_t str2time(const TCHAR*); +wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen); +time_t str2time(const wchar_t*); -const TCHAR* JabberStrIStr(const TCHAR *str, const TCHAR *substr); -void JabberCopyText(HWND hwnd, const TCHAR *text); +const wchar_t* JabberStrIStr(const wchar_t *str, const wchar_t *substr); +void JabberCopyText(HWND hwnd, const wchar_t *text); CJabberProto* JabberChooseInstance(bool bIsLink=false); bool JabberReadXep203delay(HXML node, time_t &msgTime); -- cgit v1.2.3