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_thread.cpp | 170 ++++++++++++++++---------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'protocols/JabberG/src/jabber_thread.cpp') 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: 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: ... 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') -- cgit v1.2.3