diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-05 21:16:04 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-05 21:16:11 +0300 |
commit | 94c711953d71b21e4cc4c950dec921b253ae0d54 (patch) | |
tree | 1b627434871ae469cce098fc69a881291e249949 /protocols/JabberG/src | |
parent | 40478d50b60d8c2e0711b3b0691c80be6b2da290 (diff) |
Jabber: code cleaning & simplification
Diffstat (limited to 'protocols/JabberG/src')
41 files changed, 556 insertions, 602 deletions
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 1f212ca851..9a5e8a84e4 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -142,7 +142,7 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, wchar_t*, JabberAdHocData* int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat)
{
int nodeIdx = 0;
- const wchar_t * type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (!type || !mir_wstrcmp(type, L"error")) {
// error occurred here
wchar_t buff[255];
@@ -227,9 +227,9 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA // use jabber:x:data form
HWND hFrame = GetDlgItem(hwndDlg, IDC_FRAME);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
- if (LPCTSTR ptszInstr = XmlGetText(XmlGetChild(xNode, "instructions")))
+ if (const wchar_t *ptszInstr = XmlGetText(XmlGetChild(xNode, "instructions")))
JabberFormSetInstruction(hwndDlg, ptszInstr);
- else if (LPCTSTR ptszTitle = XmlGetText(XmlGetChild(xNode, "title")))
+ else if (const wchar_t *ptszTitle = XmlGetText(XmlGetChild(xNode, "title")))
JabberFormSetInstruction(hwndDlg, ptszTitle);
else
JabberFormSetInstruction(hwndDlg, TranslateW(status));
@@ -241,7 +241,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA int toHide[] = { IDC_FRAME_TEXT, IDC_FRAME, IDC_VSCROLL, 0 };
sttShowControls(hwndDlg, FALSE, toHide);
- LPCTSTR noteText = XmlGetText(XmlGetChild(commandNode, "note"));
+ const wchar_t *noteText = XmlGetText(XmlGetChild(commandNode, "note"));
JabberFormSetInstruction(hwndDlg, noteText ? noteText : TranslateW(status));
}
@@ -295,7 +295,7 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, wc HXML xNode = XmlGetChild(commandNode, "x");
HXML dataNode = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), xNode);
- LPCTSTR jid2 = XmlGetAttrValue(dat->AdHocNode, L"from");
+ const wchar_t *jid2 = XmlGetAttrValue(dat->AdHocNode, L"from");
XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg));
HXML command = iq << XCHILDNS(L"command", JABBER_FEAT_COMMANDS);
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp index 30ab083d71..945640d6b5 100644 --- a/protocols/JabberG/src/jabber_agent.cpp +++ b/protocols/JabberG/src/jabber_agent.cpp @@ -155,7 +155,7 @@ public: if ((xNode=XmlGetChild(queryNode , "x")) != nullptr) {
// use new jabber:x:data form
- if (LPCTSTR ptszInstr = XmlGetText( XmlGetChild(xNode, "instructions")))
+ if (const wchar_t *ptszInstr = XmlGetText( XmlGetChild(xNode, "instructions")))
JabberFormSetInstruction(m_hwnd, ptszInstr);
JabberFormCreateUI(hFrame, xNode, &m_formHeight /*dummy*/);
@@ -197,7 +197,7 @@ public: }
else if (wParam == 0) {
// lParam = error message
- SetDlgItemText(m_hwnd, IDC_FRAME_TEXT, (LPCTSTR) lParam);
+ SetDlgItemText(m_hwnd, IDC_FRAME_TEXT, (const wchar_t *) lParam);
}
return TRUE;
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index a00cdab090..6e0ff4d2f8 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -50,7 +50,7 @@ DWORD CJabberProto::GetJabberVersion() const return PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM);
}
-MCONTACT CJabberProto::ContactFromJID(LPCTSTR jid)
+MCONTACT CJabberProto::ContactFromJID(const wchar_t *jid)
{
return HContactFromJID(jid);
}
@@ -60,11 +60,11 @@ LPTSTR CJabberProto::ContactToJID(MCONTACT hContact) return getWStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid");
}
-LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid)
+LPTSTR CJabberProto::GetBestResourceName(const wchar_t *jid)
{
if (jid == nullptr)
return nullptr;
- LPCTSTR p = wcschr(jid, '/');
+ const wchar_t *p = wcschr(jid, '/');
if (p == nullptr) {
mir_cslock lck(m_csLists);
return mir_wstrdup(ListGetBestClientResourceNamePtr(jid));
@@ -72,7 +72,7 @@ LPTSTR CJabberProto::GetBestResourceName(LPCTSTR jid) return mir_wstrdup(jid);
}
-LPTSTR CJabberProto::GetResourceList(LPCTSTR jid)
+LPTSTR CJabberProto::GetResourceList(const wchar_t *jid)
{
if (jid == nullptr)
return nullptr;
@@ -152,7 +152,7 @@ HJHANDLER CJabberProto::AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUser return (HJHANDLER)m_presenceManager.AddPermanentHandler(&CJabberProto::ExternalPresenceHandler, d, free, iPriority);
}
-HJHANDLER CJabberProto::AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority)
+HJHANDLER CJabberProto::AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority)
{
sHandlerData *d = (sHandlerData*)malloc(sizeof(sHandlerData));
d->Func = Func;
@@ -160,7 +160,7 @@ HJHANDLER CJabberProto::AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgType return (HJHANDLER)m_messageManager.AddPermanentHandler(&CJabberProto::ExternalMessageHandler, iMsgTypes, 0, szXmlns, FALSE, szTag, d, free, iPriority);
}
-HJHANDLER CJabberProto::AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority)
+HJHANDLER CJabberProto::AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority)
{
sHandlerData *d = (sHandlerData*)malloc(sizeof(sHandlerData));
d->Func = Func;
@@ -196,7 +196,7 @@ int CJabberProto::RemoveHandler(HJHANDLER hHandler) m_iqManager.DeleteHandler((CJabberIqInfo*)hHandler);
}
-JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
+JabberFeatCapPairDynamic *CJabberProto::FindFeature(const wchar_t *szFeature)
{
for (auto &it : m_lstJabberFeatCapPairsDynamic)
if (!mir_wstrcmp(it->szFeature, szFeature))
@@ -205,7 +205,7 @@ JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature) return nullptr;
}
-int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription)
+int CJabberProto::RegisterFeature(const wchar_t *szFeature, const wchar_t *szDescription)
{
if (!szFeature)
return false;
@@ -260,14 +260,14 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription) return true;
}
-int CJabberProto::AddFeatures(LPCTSTR szFeatures)
+int CJabberProto::AddFeatures(const wchar_t *szFeatures)
{
if (!szFeatures)
return false;
mir_cslockfull lck(m_csLists);
BOOL ret = true;
- LPCTSTR szFeat = szFeatures;
+ const wchar_t *szFeat = szFeatures;
while (szFeat[0]) {
JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
// if someone is trying to add one of core features, RegisterFeature() will return false, so we don't have to perform this check here
@@ -291,14 +291,14 @@ int CJabberProto::AddFeatures(LPCTSTR szFeatures) return ret;
}
-int CJabberProto::RemoveFeatures(LPCTSTR szFeatures)
+int CJabberProto::RemoveFeatures(const wchar_t *szFeatures)
{
if (!szFeatures)
return false;
mir_cslockfull lck(m_csLists);
BOOL ret = true;
- LPCTSTR szFeat = szFeatures;
+ const wchar_t *szFeat = szFeatures;
while (szFeat[0]) {
JabberFeatCapPairDynamic *fcp = FindFeature(szFeat);
if (fcp)
@@ -316,7 +316,7 @@ int CJabberProto::RemoveFeatures(LPCTSTR szFeatures) return ret;
}
-LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid)
+LPTSTR CJabberProto::GetResourceFeatures(const wchar_t *jid)
{
JabberCapsBits jcb = GetResourceCapabilities(jid);
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 1b97d0c5d8..edba68b505 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -149,9 +149,9 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) debugLogA("Thread started: type=bytestream_send");
Thread_SetName("Jabber: ByteSendThread");
- BOOL bDirect = m_options.BsDirect;
+ BOOL bDirect = m_bBsDirect;
- if (m_options.BsProxyManual) {
+ if (m_bBsProxyManual) {
ptrW proxyJid( getWStringA("BsProxyServer"));
if (proxyJid) {
jbt->bProxyDiscovered = FALSE;
@@ -189,7 +189,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (bDirect) {
ptrA localAddr;
- if (m_options.BsDirectManual)
+ if (m_bBsDirectManual)
localAddr = getStringA("BsDirectAddr");
NETLIBBIND nlb = {};
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 51b10cfd8a..32668d2d25 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -102,7 +102,7 @@ const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] = { void CJabberProto::AddDefaultCaps()
{
JabberCapsBits myCaps = JABBER_CAPS_MIRANDA_ALL;
- if (m_options.UseOMEMO)
+ if (m_bUseOMEMO)
myCaps |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
for (int i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++)
if (g_JabberFeatCapPairsExt[i].Valid())
@@ -469,10 +469,10 @@ void CJabberClientCapsManager::UpdateFeatHash() JabberCapsBits jcb = JABBER_CAPS_MIRANDA_ALL;
for (auto &it : ppro->m_lstJabberFeatCapPairsDynamic)
jcb |= it->jcbCap;
- if (!ppro->m_options.AllowVersionRequests)
+ if (!ppro->m_bAllowVersionRequests)
jcb &= ~JABBER_CAPS_VERSION;
- if (ppro->m_options.UseOMEMO)
+ if (ppro->m_bUseOMEMO)
jcb |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
CMStringA feat_buf(FORMAT, "client/pc//Miranda %d.%d.%d.%d<", __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM);
@@ -599,10 +599,10 @@ LBL_All: jcb |= it->jcbCap;
}
- if (ppro->m_options.UseOMEMO)
+ if (ppro->m_bUseOMEMO)
jcb |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
- if (!ppro->m_options.AllowVersionRequests)
+ if (!ppro->m_bAllowVersionRequests)
jcb &= ~JABBER_CAPS_VERSION;
XmlNodeIq iq(L"result", pInfo);
@@ -622,13 +622,13 @@ LBL_All: if (jcb & it->jcbCap)
query << XCHILD(L"feature") << XATTR(L"var", it->szFeature);
- if (ppro->m_options.AllowVersionRequests && !szNode) {
+ if (ppro->m_bAllowVersionRequests && !szNode) {
HXML form = query << XCHILDNS(L"x", JABBER_FEAT_DATA_FORMS) << XATTR(L"type", L"result");
form << XCHILD(L"field") << XATTR(L"var", L"FORM_TYPE") << XATTR(L"type", L"hidden")
<< XCHILD(L"value", L"urn:xmpp:dataforms:softwareinfo");
CJabberClientPartialCaps *pCaps = GetPartialCaps(JABBER_CAPS_MIRANDA_NODE, m_szFeaturesCrc);
- if (ppro->m_options.ShowOSVersion) {
+ if (ppro->m_bShowOSVersion) {
form << XCHILD(L"field") << XATTR(L"var", L"os") << XCHILD(L"value", pCaps->GetOs());
form << XCHILD(L"field") << XATTR(L"var", L"os_version") << XCHILD(L"value", pCaps->GetOsVer());
}
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index fe69024b21..93c12a2d2e 100755 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -304,14 +304,14 @@ public: struct JabberFeatCapPair
{
- LPCTSTR szFeature;
+ const wchar_t *szFeature;
JabberCapsBits jcbCap;
- LPCTSTR tszDescription;
+ const wchar_t *tszDescription;
};
struct JabberFeatCapPairExt
{
- LPCTSTR szFeature;
+ const wchar_t *szFeature;
JabberCapsBits jcbCap;
LPCSTR szService;
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 470da4fd8a..c48aea4c00 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CAPTCHA_FORM_PARAMS
{
- LPCTSTR from;
- LPCTSTR challenge;
- LPCTSTR fromjid;
- LPCTSTR sid;
- LPCTSTR to;
- LPCTSTR hint;
+ const wchar_t *from;
+ const wchar_t *challenge;
+ const wchar_t *fromjid;
+ const wchar_t *sid;
+ const wchar_t *to;
+ const wchar_t *hint;
HBITMAP bmp;
int w,h;
wchar_t Result[MAX_PATH];
@@ -47,7 +47,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, Window_SetSkinIcon_IcoLib(hwndDlg, IDI_KEYS);
params = (CAPTCHA_FORM_PARAMS*)lParam;
- LPCTSTR hint = params->hint;
+ const wchar_t *hint = params->hint;
if (hint == nullptr)
hint = TranslateT("Enter the text you see");
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, TranslateW(hint));
@@ -147,7 +147,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) return false;
IMGSRVC_MEMIO memio;
- memio.iLen = bufferLen;
+ memio.iLen = (long)bufferLen;
memio.pBuf = (void *)buffer;
memio.fif = FIF_UNKNOWN; /* detect */
memio.flags = 0;
@@ -165,7 +165,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) return true;
}
-void CJabberProto::sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR from, LPCTSTR challenge, LPCTSTR fromjid, LPCTSTR sid)
+void CJabberProto::sendCaptchaResult(wchar_t* buf, ThreadData *info, const wchar_t *from, const wchar_t *challenge, const wchar_t *fromjid, const wchar_t *sid)
{
XmlNodeIq iq(L"set", SerialNext());
HXML query= iq <<XATTR(L"to", from) << XCHILDNS(L"captcha", L"urn:xmpp:captcha") << XCHILDNS(L"x", JABBER_FEAT_DATA_FORMS) << XATTR(L"type", L"submit");
@@ -177,7 +177,7 @@ void CJabberProto::sendCaptchaResult(wchar_t* buf, ThreadData *info, LPCTSTR fro info -> send (iq);
}
-void CJabberProto::sendCaptchaError(ThreadData *info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge)
+void CJabberProto::sendCaptchaError(ThreadData *info, const wchar_t *from, const wchar_t *to, const wchar_t *challenge)
{
XmlNode message(L"message");
message << XATTR(L"type", L"error") << XATTR(L"to", from) << XATTR(L"id", challenge) << XATTR(L"from", to)
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index cf8ee50da7..a2eeaf620f 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -162,7 +162,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) for (int i = _countof(sttStatuses) - 1; i >= 0; i--)
Chat_AddGroup(m_szModuleName, item->jid, TranslateW(sttStatuses[i]));
- Chat_Control(m_szModuleName, item->jid, (item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE);
+ Chat_Control(m_szModuleName, item->jid, (item->bAutoJoin && m_bAutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(m_szModuleName, item->jid, SESSION_ONLINE);
return 0;
}
@@ -175,12 +175,12 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus switch (type) {
case INFO_BAN:
- if (m_options.GcLogBans)
+ if (m_bGcLogBans)
buf.Format(TranslateT("User %s is now banned."), user->m_tszResourceName);
break;
case INFO_STATUS:
- if (m_options.GcLogStatuses) {
+ if (m_bGcLogStatuses) {
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"),
@@ -191,12 +191,12 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus break;
case INFO_CONFIG:
- if (m_options.GcLogConfig)
+ if (m_bGcLogConfig)
buf.Format(TranslateT("Room configuration was changed."));
break;
case INFO_AFFILIATION:
- if (m_options.GcLogAffiliations) {
+ if (m_bGcLogAffiliations) {
wchar_t *name = nullptr;
switch (user->m_affiliation) {
case AFFILIATION_NONE: name = TranslateT("None"); break;
@@ -211,7 +211,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus break;
case INFO_ROLE:
- if (m_options.GcLogRoles) {
+ if (m_bGcLogRoles) {
wchar_t *name = nullptr;
switch (user->m_role) {
case ROLE_NONE: name = TranslateT("None"); break;
diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h deleted file mode 100755 index 40654207ca..0000000000 --- a/protocols/JabberG/src/jabber_db_utils.h +++ /dev/null @@ -1,150 +0,0 @@ -/*
-
-Jabber Protocol Plugin for Miranda NG
-
-Copyright (c) 2002-04 Santithorn Bunchua
-Copyright (c) 2005-12 George Hazan
-Copyright (c) 2007-09 Maxim Mluhov
-Copyright (c) 2007-09 Victor Pavlychko
-Copyright (c) 2012-18 Miranda NG team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __jabber_db_utils_h__
-#define __jabber_db_utils_h__
-
-struct CJabberOptions
-{
- CMOption<BYTE> AllowVersionRequests;
- CMOption<BYTE> AcceptHttpAuth;
- CMOption<BYTE> AddRoster2Bookmarks;
- CMOption<BYTE> AutoAcceptAuthorization;
- CMOption<BYTE> AutoAcceptMUC;
- CMOption<BYTE> AutoAdd;
- CMOption<BYTE> AutoJoinBookmarks;
- CMOption<BYTE> AutoJoinConferences;
- CMOption<BYTE> AutoJoinHidden;
- CMOption<BYTE> AvatarType;
- CMOption<BYTE> BsDirect;
- CMOption<BYTE> BsDirectManual;
- CMOption<BYTE> BsOnlyIBB;
- CMOption<BYTE> BsProxyManual;
- CMOption<BYTE> Disable3920auth;
- CMOption<BYTE> DisableFrame;
- CMOption<BYTE> EnableAvatars;
- CMOption<BYTE> EnableRemoteControl;
- CMOption<BYTE> EnableUserActivity;
- CMOption<BYTE> EnableUserMood;
- CMOption<BYTE> EnableUserTune;
- CMOption<BYTE> EnableZlib;
- CMOption<BYTE> ExtendedSearch;
- CMOption<BYTE> FixIncorrectTimestamps;
- CMOption<BYTE> GcLogAffiliations;
- CMOption<BYTE> GcLogBans;
- CMOption<BYTE> GcLogConfig;
- CMOption<BYTE> GcLogRoles;
- CMOption<BYTE> GcLogStatuses;
- CMOption<BYTE> GcLogChatHistory;
- CMOption<BYTE> HostNameAsResource;
- CMOption<BYTE> IgnoreMUCInvites;
- CMOption<BYTE> KeepAlive;
- CMOption<BYTE> LogChatstates;
- CMOption<BYTE> LogPresence;
- CMOption<BYTE> LogPresenceErrors;
- CMOption<BYTE> ManualConnect;
- CMOption<BYTE> MsgAck;
- CMOption<BYTE> RosterSync;
- CMOption<BYTE> SavePassword;
- CMOption<BYTE> UseDomainLogin;
- CMOption<BYTE> ShowForeignResourceInMirVer;
- CMOption<BYTE> ShowOSVersion;
- CMOption<BYTE> ShowTransport;
- CMOption<BYTE> UseSSL;
- CMOption<BYTE> UseTLS;
- CMOption<BYTE> AcceptNotes;
- CMOption<BYTE> AutosaveNotes;
- CMOption<BYTE> EnableMsgArchive;
- CMOption<BYTE> RcMarkMessagesAsRead;
- CMOption<DWORD> ConnectionKeepAliveInterval;
- CMOption<DWORD> ConnectionKeepAliveTimeout;
- CMOption<BYTE> ProcessXMPPLinks;
- CMOption<BYTE> IgnoreRosterGroups;
- CMOption<BYTE> EnableCarbons;
-
- CMOption<BYTE> UseOMEMO;
-
- CJabberOptions(PROTO_INTERFACE *proto) :
- BsDirect(proto, "BsDirect", TRUE),
- AllowVersionRequests(proto, "AllowVersionRequests", TRUE),
- AcceptHttpAuth(proto, "AcceptHttpAuth", TRUE),
- AddRoster2Bookmarks(proto, "AddRoster2Bookmarks", TRUE),
- AutoAcceptAuthorization(proto, "AutoAcceptAuthorization", FALSE),
- AutoAcceptMUC(proto, "AutoAcceptMUC", FALSE),
- AutoAdd(proto, "AutoAdd", TRUE),
- AutoJoinBookmarks(proto, "AutoJoinBookmarks", TRUE),
- AutoJoinConferences(proto, "AutoJoinConferences", 0),
- AutoJoinHidden(proto, "AutoJoinHidden", TRUE),
- AvatarType(proto, "AvatarType", PA_FORMAT_UNKNOWN),
- BsDirectManual(proto, "BsDirectManual", FALSE),
- BsOnlyIBB(proto, "BsOnlyIBB", FALSE),
- BsProxyManual(proto, "BsProxyManual", FALSE),
- Disable3920auth(proto, "Disable3920auth", FALSE),
- DisableFrame(proto, "DisableFrame", TRUE),
- EnableAvatars(proto, "EnableAvatars", TRUE),
- EnableRemoteControl(proto, "EnableRemoteControl", FALSE),
- EnableMsgArchive(proto, "EnableMsgArchive", FALSE),
- EnableUserActivity(proto, "EnableUserActivity", TRUE),
- EnableUserMood(proto, "EnableUserMood", TRUE),
- EnableUserTune(proto, "EnableUserTune", FALSE),
- EnableZlib(proto, "EnableZlib", TRUE),
- ExtendedSearch(proto, "ExtendedSearch", TRUE),
- FixIncorrectTimestamps(proto, "FixIncorrectTimestamps", TRUE),
- GcLogAffiliations(proto, "GcLogAffiliations", FALSE),
- GcLogBans(proto, "GcLogBans", TRUE),
- GcLogConfig(proto, "GcLogConfig", FALSE),
- GcLogRoles(proto, "GcLogRoles", FALSE),
- GcLogStatuses(proto, "GcLogStatuses", FALSE),
- GcLogChatHistory(proto, "GcLogChatHistory", TRUE),
- HostNameAsResource(proto, "HostNameAsResource", FALSE),
- IgnoreMUCInvites(proto, "IgnoreMUCInvites", FALSE),
- KeepAlive(proto, "KeepAlive", TRUE),
- LogChatstates(proto, "LogChatstates", FALSE),
- LogPresence(proto, "LogPresence", TRUE),
- LogPresenceErrors(proto, "LogPresenceErrors", FALSE),
- ManualConnect(proto, "ManualConnect", FALSE),
- MsgAck(proto, "MsgAck", FALSE),
- RosterSync(proto, "RosterSync", FALSE),
- SavePassword(proto, "SavePassword", TRUE),
- ShowForeignResourceInMirVer(proto, "ShowForeignResourceInMirVer", FALSE),
- ShowOSVersion(proto, "ShowOSVersion", TRUE),
- ShowTransport(proto, "ShowTransport", TRUE),
- UseSSL(proto, "UseSSL", FALSE),
- UseTLS(proto, "UseTLS", TRUE),
- UseDomainLogin(proto, "UseDomainLogin", FALSE),
- AcceptNotes(proto, "AcceptNotes", TRUE),
- AutosaveNotes(proto, "AutosaveNotes", FALSE),
- RcMarkMessagesAsRead(proto, "RcMarkMessagesAsRead", 1),
- ConnectionKeepAliveInterval(proto, "ConnectionKeepAliveInterval", 60000),
- ConnectionKeepAliveTimeout(proto, "ConnectionKeepAliveTimeout", 50000),
- ProcessXMPPLinks(proto, "ProcessXMPPLinks", FALSE),
- IgnoreRosterGroups(proto, "IgnoreRosterGroups", FALSE),
- EnableCarbons(proto, "EnableCarbons", TRUE),
- UseOMEMO(proto, "UseOMEMO", FALSE)
- {}
-};
-
-#endif // __jabber_db_utils_h__
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 04dae8fcf2..8939d14367 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1364,8 +1364,8 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM break;
case SD_ACT_PROXY:
- m_options.BsDirect = FALSE;
- m_options.BsProxyManual = TRUE;
+ m_bBsDirect = FALSE;
+ m_bBsProxyManual = TRUE;
setWString("BsProxyServer", pNode->GetJid());
break;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index da13c3d8fd..a05355f973 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -145,10 +145,10 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, MCONT AddContactToRoster(jid, nick, ptrW(db_get_wsa(hContact, "CList", "Group")));
- XmlNode xPresence(L"presence"); xPresence << XATTR(L"to", LPCTSTR(jid)) << XATTR(L"type", L"subscribe");
+ XmlNode xPresence(L"presence"); xPresence << XATTR(L"to", jid) << XATTR(L"type", L"subscribe");
ptrW myNick(getWStringA(0, "Nick"));
if (myNick != nullptr)
- xPresence << XCHILD(L"nick", LPCTSTR(myNick)) << XATTR(L"xmlns", JABBER_FEAT_NICK);
+ xPresence << XCHILD(L"nick", myNick) << XATTR(L"xmlns", JABBER_FEAT_NICK);
m_ThreadInfo->send(xPresence);
SendGetVcard(jid);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 413957debd..929dc061ab 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -284,7 +284,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->szId = JabberId2string(SerialNext());
ptrA myAddr;
- if (m_options.BsDirect && m_options.BsDirectManual)
+ if (m_bBsDirect && m_bBsDirectManual)
myAddr = getStringA("BsDirectAddr");
if (myAddr == nullptr) {
sockaddr_in sin = {};
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index db7a6dc8f1..170147508c 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -497,7 +497,7 @@ void CJabberProto::InitInfoFrame() if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
return;
- if (!m_options.DisableFrame)
+ if (!m_bDisableFrame)
m_pInfoFrame = new CJabberInfoFrame(this);
else {
delete m_pInfoFrame;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 5038c9f1ec..4ef7a7f3d4 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -112,8 +112,8 @@ void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft) << XCHILDNS(L"x", JABBER_FEAT_DATA_FORMS) << XATTR(L"type", L"form")
<< XCHILD(L"field") << XATTR(L"var", L"stream-method") << XATTR(L"type", L"list-single");
- BOOL bDirect = m_options.BsDirect;
- BOOL bProxy = m_options.BsProxyManual;
+ BOOL bDirect = m_bBsDirect;
+ BOOL bProxy = m_bBsProxyManual;
// bytestreams support?
if (bDirect || bProxy)
@@ -133,8 +133,8 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo) if ((siNode = XmlGetChild(iqNode, "si")) != nullptr) {
// fix for very smart clients, like gajim
- BOOL bDirect = m_options.BsDirect;
- BOOL bProxy = m_options.BsProxyManual;
+ BOOL bDirect = m_bBsDirect;
+ BOOL bProxy = m_bBsProxyManual;
if ((featureNode = XmlGetChild(siNode, "feature")) != nullptr) {
if ((xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != nullptr) {
@@ -322,7 +322,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) (xNode = XmlGetChildByTag(featureNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS)) != nullptr &&
(fieldNode = XmlGetChildByTag(xNode, "field", "var", L"stream-method")) != nullptr) {
- BOOL bIbbOnly = m_options.BsOnlyIBB;
+ BOOL bIbbOnly = m_bBsOnlyIBB;
HXML optionNode = nullptr;
JABBER_FT_TYPE ftType = FT_OOB;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index c93f8397e0..1b88b6486e 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -847,7 +847,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) // Update status of room participant
int status = ID_STATUS_ONLINE;
- LPCTSTR ptszShow = XmlGetText(XmlGetChild(node, "show"));
+ const wchar_t *ptszShow = XmlGetText(XmlGetChild(node, "show"));
if (ptszShow) {
if (!mir_wstrcmp(ptszShow, L"away")) status = ID_STATUS_AWAY;
else if (!mir_wstrcmp(ptszShow, L"xa")) status = ID_STATUS_NA;
@@ -855,10 +855,10 @@ void CJabberProto::GroupchatProcessPresence(HXML node) else if (!mir_wstrcmp(ptszShow, L"chat")) status = ID_STATUS_FREECHAT;
}
- LPCTSTR str = XmlGetText(XmlGetChild(node, "status"));
+ const wchar_t *str = XmlGetText(XmlGetChild(node, "status"));
char priority = 0;
- if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
+ if (const wchar_t *ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
priority = (char)_wtoi(ptszPriority);
bool bStatusChanged = false, bRoomCreated = false, bAffiliationChanged = false, bRoleChanged = false;
@@ -1118,7 +1118,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node) if (!isHistory)
gce.dwFlags |= GCEF_ADDTOLOG;
- if (m_options.GcLogChatHistory && isHistory)
+ if (m_bGcLogChatHistory && isHistory)
gce.dwFlags |= GCEF_NOTNOTIFY;
Chat_Event(&gce);
@@ -1187,7 +1187,7 @@ void CJabberProto::GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t if (ListGetItemPtr(LIST_CHATROOM, roomJid))
return;
- if (m_options.AutoAcceptMUC) {
+ if (m_bAutoAcceptMUC) {
ptrW nick(getWStringA(HContactFromJID(m_szJabberJID), "MyNick"));
if (nick == nullptr)
nick = getWStringA("Nick");
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp index b3d287b8c3..e96e3296c9 100644 --- a/protocols/JabberG/src/jabber_ibb.cpp +++ b/protocols/JabberG/src/jabber_ibb.cpp @@ -183,7 +183,7 @@ BOOL CJabberProto::OnIbbRecvdData(const wchar_t *data, const wchar_t *sid, const if (decodedData == nullptr)
return FALSE;
- (this->*item->jibb->pfnRecv)(nullptr, item->ft, decodedData, length);
+ (this->*item->jibb->pfnRecv)(nullptr, item->ft, decodedData, (int)length);
item->jibb->dwTransferredSize += (DWORD)length;
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 84b45355d8..63416972c8 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -33,7 +33,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) if (!pInfo->GetFrom())
return TRUE;
- if (!m_options.AllowVersionRequests)
+ if (!m_bAllowVersionRequests)
return FALSE;
XmlNodeIq iq(L"result", pInfo);
@@ -41,7 +41,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) query << XCHILD(L"name", L"Miranda NG Jabber");
query << XCHILD(L"version", szCoreVersion);
- if (m_options.ShowOSVersion) {
+ if (m_bShowOSVersion) {
wchar_t os[256] = { 0 };
if (!GetOSDisplayString(os, _countof(os)))
mir_wstrncpy(os, L"Microsoft Windows", _countof(os));
@@ -109,7 +109,7 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) XmlNodeIq iq(L"result", pInfo);
HXML timeNode = iq << XCHILDNS(L"time", JABBER_FEAT_ENTITY_TIME);
timeNode << XCHILD(L"utc", stime); timeNode << XCHILD(L"tzo", szTZ);
- LPCTSTR szTZName = TimeZone_GetName(nullptr);
+ const wchar_t *szTZName = TimeZone_GetName(nullptr);
if (szTZName)
timeNode << XCHILD(L"tz", szTZName);
m_ThreadInfo->send(iq);
@@ -134,7 +134,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) XmlNodeIq iq(L"result", pInfo);
HXML queryNode = iq << XQUERY(JABBER_FEAT_ENTITY_TIME_OLD);
queryNode << XCHILD(L"utc", stime);
- LPCTSTR szTZName = TimeZone_GetName(nullptr);
+ const wchar_t *szTZName = TimeZone_GetName(nullptr);
if (szTZName)
queryNode << XCHILD(L"tz", szTZName);
queryNode << XCHILD(L"display", dtime);
@@ -144,10 +144,10 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
{
- if (!m_options.EnableAvatars)
+ if (!m_bEnableAvatars)
return TRUE;
- int pictureType = m_options.AvatarType;
+ int pictureType = m_bAvatarType;
if (pictureType == PA_FORMAT_UNKNOWN)
return TRUE;
@@ -272,7 +272,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) }
else db_unset(hContact, "CList", "MyHandle");
- if (!m_options.IgnoreRosterGroups) {
+ if (!m_bIgnoreRosterGroups) {
if (item->group != nullptr) {
Clist_GroupCreate(0, item->group);
db_set_ws(hContact, "CList", "Group", item->group);
@@ -321,7 +321,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) if (!n || !XmlGetText(n))
return TRUE;
- if (m_options.BsOnlyIBB) {
+ if (m_bBsOnlyIBB) {
// reject
XmlNodeIq iq(L"error", pInfo);
HXML e = XmlAddChild(iq, L"error", L"File transfer refused"); XmlAddAttr(e, L"code", 406);
@@ -433,7 +433,7 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo) if (szNode)
XmlAddAttr(resultQuery, L"node", szNode);
- if (!szNode && m_options.EnableRemoteControl)
+ if (!szNode && m_bEnableRemoteControl)
resultQuery << XCHILD(L"item") << XATTR(L"jid", m_ThreadInfo->fullJID)
<< XATTR(L"node", JABBER_FEAT_COMMANDS) << XATTR(L"name", L"Ad-hoc commands");
@@ -459,7 +459,7 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo)
{
- if (!m_options.AcceptHttpAuth)
+ if (!m_bAcceptHttpAuth)
return TRUE;
if (!node || !pInfo->GetChildNode() || !pInfo->GetFrom() || !pInfo->GetIdStr())
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 62e71554bb..1fad5dcebd 100755 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -52,7 +52,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*) if (!mir_wstrcmp(tmp.category, L"pubsub") && !mir_wstrcmp(tmp.type, L"pep")) {
m_bPepSupported = true;
- if (m_options.UseOMEMO)
+ if (m_bUseOMEMO)
{
//publish ndes, precreation is not required
OmemoPublishNodes();
@@ -133,12 +133,12 @@ void CJabberProto::OnProcessLoginRq(ThreadData *info, DWORD rq) DWORD dwMask = JABBER_LOGIN_ROSTER | JABBER_LOGIN_BOOKMARKS | JABBER_LOGIN_SERVERINFO;
if ((info->dwLoginRqs & dwMask) == dwMask && !(info->dwLoginRqs & JABBER_LOGIN_BOOKMARKS_AJ)) {
if (info->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO)
- EnableArchive(m_options.EnableMsgArchive != 0);
+ EnableArchive(m_bEnableMsgArchive != 0);
if (info->jabberServerCaps & JABBER_CAPS_CARBONS)
- EnableCarbons(m_options.EnableCarbons != 0);
+ EnableCarbons(m_bEnableCarbons != 0);
- if (m_options.AutoJoinBookmarks) {
+ if (m_bAutoJoinBookmarks) {
LIST<JABBER_LIST_ITEM> ll(10);
LISTFOREACH(i, this, LIST_BOOKMARK)
{
@@ -295,7 +295,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) if (!m_ThreadInfo || !iqNode)
return;
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
- LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
+ const wchar_t *szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
if (!wcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
debugLogW(L"Result Bind: %s confirmed ", m_ThreadInfo->fullJID);
@@ -457,7 +457,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) }
else UpdateSubscriptionInfo(hContact, item);
- if (!m_options.IgnoreRosterGroups) {
+ if (!m_bIgnoreRosterGroups) {
if (item->group != nullptr) {
Clist_GroupCreate(0, item->group);
@@ -490,7 +490,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) delete httpavatars;
// Delete orphaned contacts (if roster sync is enabled)
- if (m_options.RosterSync) {
+ if (m_bRosterSync) {
LISTFOREACH(i, this, LIST_ROSTER)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
@@ -506,7 +506,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) debugLogA("Status changed via THREADSTART");
SetServerStatus(m_iDesiredStatus);
- if (m_options.AutoJoinConferences)
+ if (m_bAutoJoinConferences)
for (auto &it : chatRooms)
GroupchatJoinByHContact((DWORD_PTR)it, true);
@@ -585,7 +585,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP return;
HXML o = XmlGetChild(n, "BINVAL");
- LPCTSTR ptszBinval = XmlGetText(o);
+ const wchar_t *ptszBinval = XmlGetText(o);
if (o == nullptr || ptszBinval == nullptr)
return;
@@ -608,7 +608,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP debugLogA("Writing %d bytes", bufferLen);
DWORD nWritten;
- bool bRes = WriteFile(hFile, buffer, bufferLen, &nWritten, nullptr) != 0;
+ bool bRes = WriteFile(hFile, buffer, (DWORD)bufferLen, &nWritten, nullptr) != 0;
CloseHandle(hFile);
if (!bRes)
return;
@@ -1480,7 +1480,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo*) HXML itemNode;
for (int i = 0; itemNode = XmlGetChild(storageNode, i); i++) {
- if (LPCTSTR name = XmlGetName(itemNode)) {
+ if (const wchar_t *name = XmlGetName(itemNode)) {
if (!mir_wstrcmp(name, L"conference") && (jid = XmlGetAttrValue(itemNode, L"jid"))) {
JABBER_LIST_ITEM *item = ListAdd(LIST_BOOKMARK, jid);
item->name = mir_wstrdup(XmlGetAttrValue(itemNode, L"name"));
@@ -1579,14 +1579,14 @@ void CJabberProto::OnIqResultLastActivity(HXML iqNode, CJabberIqInfo *pInfo) time_t lastActivity = -1;
if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
- LPCTSTR szSeconds = XPathT(iqNode, "query[@xmlns='jabber:iq:last']/@seconds");
+ const wchar_t *szSeconds = XPathT(iqNode, "query[@xmlns='jabber:iq:last']/@seconds");
if (szSeconds) {
int nSeconds = _wtoi(szSeconds);
if (nSeconds > 0)
lastActivity = time(nullptr) - nSeconds;
}
- LPCTSTR szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
+ const wchar_t *szLastStatusMessage = XPathT(iqNode, "query[@xmlns='jabber:iq:last']");
if (szLastStatusMessage) // replace only if it exists
r->m_tszStatusMessage = mir_wstrdup(szLastStatusMessage);
}
@@ -1603,9 +1603,9 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo) return;
if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
- LPCTSTR szTzo = XPathFmt(pIqNode, L"time[@xmlns='%s']/tzo", JABBER_FEAT_ENTITY_TIME);
+ const wchar_t *szTzo = XPathFmt(pIqNode, L"time[@xmlns='%s']/tzo", JABBER_FEAT_ENTITY_TIME);
if (szTzo && szTzo[0]) {
- LPCTSTR szMin = wcschr(szTzo, ':');
+ const wchar_t *szMin = wcschr(szTzo, ':');
int nTz = _wtoi(szTzo) * -2;
nTz += (nTz < 0 ? -1 : 1) * (szMin ? _wtoi(szMin + 1) / 30 : 0);
@@ -1615,7 +1615,7 @@ void CJabberProto::OnIqResultEntityTime(HXML pIqNode, CJabberIqInfo *pInfo) setByte(pInfo->m_hContact, "Timezone", (signed char)nTz);
- LPCTSTR szTz = XPathFmt(pIqNode, L"time[@xmlns='%s']/tz", JABBER_FEAT_ENTITY_TIME);
+ const wchar_t *szTz = XPathFmt(pIqNode, L"time[@xmlns='%s']/tz", JABBER_FEAT_ENTITY_TIME);
if (szTz)
setWString(pInfo->m_hContact, "TzName", szTz);
else
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 7610621e28..c678f54387 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -42,17 +42,17 @@ void CJabberProto::SetMucConfig(HXML node, void *from) void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo*)
{
debugLogA("<iq/> iqIdGetMuc");
- LPCTSTR type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == nullptr)
return;
- LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from == nullptr)
return;
if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != nullptr) {
- LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *str = XmlGetAttrValue(queryNode, L"xmlns");
if (!mir_wstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != nullptr) {
@@ -98,7 +98,7 @@ static void sttFillJidList(HWND hwndDlg) wchar_t tszItemText[JABBER_MAX_JID_LEN + 256];
HXML iqNode = jidListInfo->iqNode;
if (iqNode != nullptr) {
- LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from != nullptr) {
HXML queryNode = XmlGetChild(iqNode, L"query");
if (queryNode != nullptr) {
@@ -110,18 +110,18 @@ static void sttFillJidList(HWND hwndDlg) if (!itemNode)
break;
- LPCTSTR jid = XmlGetAttrValue(itemNode, L"jid");
+ const wchar_t *jid = XmlGetAttrValue(itemNode, L"jid");
if (jid != nullptr) {
lvi.pszText = (wchar_t*)jid;
if (jidListInfo->type == MUC_BANLIST) {
- LPCTSTR reason = XmlGetText(XmlGetChild(itemNode, L"reason"));
+ const wchar_t *reason = XmlGetText(XmlGetChild(itemNode, L"reason"));
if (reason != nullptr) {
mir_snwprintf(tszItemText, L"%s (%s)", jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
- LPCTSTR nick = XmlGetAttrValue(itemNode, L"nick");
+ const wchar_t *nick = XmlGetAttrValue(itemNode, L"nick");
if (nick != nullptr) {
mir_snwprintf(tszItemText, L"%s (%s)", nick, jid);
lvi.pszText = tszItemText;
@@ -239,7 +239,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w if ((dat = (JABBER_MUC_JIDLIST_INFO *)lParam) != nullptr) {
HXML iqNode = dat->iqNode;
if (iqNode != nullptr) {
- LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from != nullptr) {
dat->roomJid = mir_wstrdup(from);
HXML queryNode = XmlGetChild(iqNode, L"query");
@@ -434,7 +434,7 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param) if (iqNode == nullptr)
return;
- LPCTSTR from = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *from = XmlGetAttrValue(iqNode, L"from");
if (from == nullptr)
return;
@@ -477,7 +477,7 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param) void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType)
{
- LPCTSTR type = XmlGetAttrValue(iqNode, L"type");
+ const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
if (type == nullptr)
return;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f5026821e6..02fc077c4f 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -455,7 +455,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM hContact, LPARAM) ptrW nick(getWStringA(hContact, "Nick"));
AddContactToRoster(roomID, nick, group);
- if (m_options.AddRoster2Bookmarks == TRUE) {
+ if (m_bAddRoster2Bookmarks == TRUE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_BOOKMARK, roomID);
if (item == nullptr) {
item = new JABBER_LIST_ITEM();
@@ -899,7 +899,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) ptrW jid(getWStringA(event->hContact, "jid"));
if (jid != nullptr) {
JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid);
- if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_options.EnableMsgArchive)
+ if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_bEnableMsgArchive)
RetrieveMessageArchive(event->hContact, pItem);
}
}
@@ -1063,7 +1063,7 @@ CJabberProto* JabberChooseInstance(bool bIsLink) if (bIsLink)
for (auto &it : g_Instances)
- if (it->m_options.ProcessXMPPLinks)
+ if (it->m_bProcessXMPPLinks)
return it;
int nItems = 0, lastItemId = 0;
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp index 632dcb28e5..c15f7028fe 100644 --- a/protocols/JabberG/src/jabber_message_manager.cpp +++ b/protocols/JabberG/src/jabber_message_manager.cpp @@ -55,7 +55,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea // have to get all data here, in the loop, because there's always possibility that previous handler modified it
CJabberMessageInfo messageInfo;
- LPCTSTR szType = XmlGetAttrValue(node, L"type");
+ const wchar_t *szType = XmlGetAttrValue(node, L"type");
if (szType) {
if (!mir_wstrcmpi(szType, L"normal"))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
@@ -77,8 +77,8 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea // enumerate all children and see whether this node suits handler criteria
HXML child = XmlGetChild(node, i);
- LPCTSTR szTagName = XmlGetName(child);
- LPCTSTR szXmlns = XmlGetAttrValue(child, L"xmlns");
+ const wchar_t *szTagName = XmlGetName(child);
+ const wchar_t *szXmlns = XmlGetAttrValue(child, L"xmlns");
if ((!it->m_szXmlns || (szXmlns && !mir_wstrcmp(it->m_szXmlns, szXmlns))) && (!it->m_szTag || !mir_wstrcmp(it->m_szTag, szTagName))) {
// node suits handler criteria, call the handler
diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h index 0ae5affdc9..680c6fa708 100644 --- a/protocols/JabberG/src/jabber_message_manager.h +++ b/protocols/JabberG/src/jabber_message_manager.h @@ -53,13 +53,13 @@ public: void *m_pUserData;
// parsed data
int m_nMessageType;
- LPCTSTR m_szFrom;
- LPCTSTR m_szChildTagXmlns;
- LPCTSTR m_szChildTagName;
+ const wchar_t *m_szFrom;
+ const wchar_t *m_szChildTagXmlns;
+ const wchar_t *m_szChildTagName;
HXML m_hChildNode;
MCONTACT m_hContact;
- LPCTSTR m_szTo;
- LPCTSTR m_szId;
+ const wchar_t *m_szTo;
+ const wchar_t *m_szId;
public:
__forceinline int GetMessageType()
@@ -68,13 +68,13 @@ public: __forceinline void* GetUserData()
{ return m_pUserData;
}
- __forceinline LPCTSTR GetFrom()
+ __forceinline const wchar_t *GetFrom()
{ return m_szFrom;
}
- __forceinline LPCTSTR GetTo()
+ __forceinline const wchar_t *GetTo()
{ return m_szTo;
}
- __forceinline LPCTSTR GetIdStr()
+ __forceinline const wchar_t *GetIdStr()
{ return m_szId;
}
__forceinline MCONTACT GetHContact()
@@ -83,7 +83,7 @@ public: __forceinline HXML GetChildNode()
{ return m_hChildNode;
}
- __forceinline LPCTSTR GetChildNodeName()
+ __forceinline const wchar_t *GetChildNodeName()
{ return m_szChildTagName;
}
};
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 7c1c4a0b5b..784364c502 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -108,12 +108,12 @@ BOOL CJabberProto::AddDbPresenceEvent(MCONTACT hContact, BYTE btEventType) case JABBER_DB_EVENT_PRESENCE_SUBSCRIBED:
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE:
case JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED:
- if (!m_options.LogPresence)
+ if (!m_bLogPresence)
return FALSE;
break;
case JABBER_DB_EVENT_PRESENCE_ERROR:
- if (!m_options.LogPresenceErrors)
+ if (!m_bLogPresenceErrors)
return FALSE;
break;
}
@@ -330,7 +330,7 @@ void CJabberProto::FormatMirVer(const pResourceStatus &resource, CMStringW &res) }
if (resource->m_tszResourceName && !wcsstr(res, resource->m_tszResourceName))
- if (wcsstr(res, L"Miranda IM") || wcsstr(res, L"Miranda NG") || m_options.ShowForeignResourceInMirVer)
+ if (wcsstr(res, L"Miranda IM") || wcsstr(res, L"Miranda NG") || m_bShowForeignResourceInMirVer)
res.AppendFormat(L" [%s]", resource->m_tszResourceName);
}
@@ -444,7 +444,7 @@ void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar CMStringW CJabberProto::ExtractImage(HXML node)
{
HXML nHtml, nBody, nImg;
- LPCTSTR src;
+ const wchar_t *src;
CMStringW link;
if ((nHtml = XmlGetChild(node, "html")) != nullptr &&
@@ -478,7 +478,7 @@ CMStringW CJabberProto::ExtractImage(HXML node) DWORD n;
size_t bufferLen;
ptrA buffer((char*)mir_base64_decode(_T2A(image), &bufferLen));
- WriteFile(h, buffer, bufferLen, &n, nullptr);
+ WriteFile(h, buffer, (DWORD)bufferLen, &n, nullptr);
CloseHandle(h);
link = L" file:///";
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index cefcb8df19..f38eae0285 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -760,7 +760,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml)
{
- if (!m_options.AcceptNotes)
+ if (!m_bAcceptNotes)
return false;
if (!szFrom || !hXml) return true;
@@ -770,7 +770,7 @@ bool CJabberProto::OnIncomingNote(const wchar_t *szFrom, HXML hXml) return true;
}
- if (m_options.AutosaveNotes && HContactFromJID(szFrom)) {
+ if (m_bAutosaveNotes && HContactFromJID(szFrom)) {
ProcessIncomingNote(pItem, true);
return false;
}
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index f35605b51d..317d299ff5 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -434,7 +434,7 @@ namespace omemo { omemo_impl::omemo_impl(CJabberProto *p) : proto(p), signal_mutex(nullptr), provider(nullptr)
{
- if (proto->m_options.UseOMEMO)
+ if (proto->m_bUseOMEMO)
init();
}
void omemo_impl::init()
@@ -475,7 +475,7 @@ namespace omemo { }
omemo_impl::~omemo_impl()
{
- if (proto->m_options.UseOMEMO)
+ if (proto->m_bUseOMEMO)
{
deinit();
}
@@ -1317,7 +1317,7 @@ namespace omemo { }
//void(*destroy_func)(void *user_data); //use first one as we have nothing special to destroy
- bool omemo_impl::create_session_store(MCONTACT hContact, LPCTSTR device_id)
+ bool omemo_impl::create_session_store(MCONTACT hContact, const wchar_t *device_id)
{
signal_store_backend_user_data *data[4];
char *device_id_a = mir_u2a(device_id);
@@ -1373,8 +1373,8 @@ namespace omemo { return true; //success
}
- bool omemo_impl::build_session(MCONTACT hContact, LPCTSTR jid, LPCTSTR dev_id, LPCTSTR key_id, LPCTSTR pre_key_public, LPCTSTR signed_pre_key_id,
- LPCTSTR signed_pre_key_public, LPCTSTR signed_pre_key_signature, LPCTSTR identity_key)
+ bool omemo_impl::build_session(MCONTACT hContact, const wchar_t *jid, const wchar_t *dev_id, const wchar_t *key_id, const wchar_t *pre_key_public, const wchar_t *signed_pre_key_id,
+ const wchar_t *signed_pre_key_public, const wchar_t *signed_pre_key_signature, const wchar_t *identity_key)
{
/* Instantiate a session_builder for a recipient address. */
char *jid_str = mir_u2a(jid);
@@ -1570,7 +1570,7 @@ void CJabberProto::OmemoPutMessageToOutgoingQueue(MCONTACT hContact, int unused_ ((omemo::message_queue*)m_omemo.message_queue_internal)->outgoing_messages.push_back(omemo::outgoing_message(hContact, unused_unknown, msg));
}
-void CJabberProto::OmemoPutMessageToIncommingQueue(HXML node, LPCTSTR jid, time_t msgTime)
+void CJabberProto::OmemoPutMessageToIncommingQueue(HXML node, const wchar_t *jid, time_t msgTime)
{
wchar_t *jid_ = mir_wstrdup(jid);
HXML node_ = xmlCopyNode(node);
@@ -1620,19 +1620,19 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) debugLogA("Jabber OMEMO: omemo message does not contain payload, it's may be \"KeyTransportElement\" which is currently unused by our implementation");
return; //this is "KeyTransportElement" which is currently unused
}
- LPCTSTR payload_base64w = XmlGetText(payload_node);
+ const wchar_t *payload_base64w = XmlGetText(payload_node);
if (!payload_base64w)
{
debugLogA("Jabber OMEMO: error: failed to get payload data");
return;
}
- LPCTSTR iv_base64 = XmlGetText(XmlGetChild(header_node, L"iv"));
+ const wchar_t *iv_base64 = XmlGetText(XmlGetChild(header_node, L"iv"));
if (!iv_base64)
{
Netlib_Log(nullptr, "Jabber OMEMO: error: failed to get iv data");
return;
}
- LPCTSTR sender_dev_id = XmlGetAttrValue(header_node, L"sid");
+ const wchar_t *sender_dev_id = XmlGetAttrValue(header_node, L"sid");
if (!sender_dev_id)
{
debugLogA("Jabber OMEMO: error: failed to get sender device id");
@@ -1652,10 +1652,10 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) }
HXML key_node;
DWORD own_id = m_omemo.GetOwnDeviceId();
- LPCTSTR encrypted_key_base64 = nullptr;
+ const wchar_t *encrypted_key_base64 = nullptr;
for (int p = 1; (key_node = XmlGetNthChild(header_node, L"key", p)) != nullptr; p++)
{
- LPCTSTR dev_id = xmlGetAttrValue(key_node, L"rid");
+ const wchar_t *dev_id = xmlGetAttrValue(key_node, L"rid");
char *dev_id_a = mir_u2a(dev_id);
DWORD dev_id_int = strtoul(dev_id_a, nullptr, 10);
mir_free(dev_id_a);
@@ -1822,12 +1822,12 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) for (;;)
{
- EVP_DecryptUpdate(ctx, (unsigned char*)out + outl, &round_len, payload + outl, (payload_len >= 128) ? 128 : payload_len);
+ EVP_DecryptUpdate(ctx, (unsigned char*)out + outl, &round_len, payload + outl, int((payload_len >= 128) ? 128 : payload_len));
outl += round_len;
if (outl >= (int)payload_len - 128)
break;
}
- EVP_DecryptUpdate(ctx, (unsigned char*)out + outl, &round_len, payload + outl, payload_len - outl);
+ EVP_DecryptUpdate(ctx, (unsigned char*)out + outl, &round_len, payload + outl, int(payload_len - outl));
outl += round_len;
out[outl] = 0;
mir_free(payload);
@@ -1845,14 +1845,14 @@ void CJabberProto::OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime) if (!msgTime)
msgTime = now;
- if (m_options.FixIncorrectTimestamps && (msgTime > now || (msgTime < (time_t)JabberGetLastContactMessageTime(hContact))))
+ if (m_bFixIncorrectTimestamps && (msgTime > now || (msgTime < (time_t)JabberGetLastContactMessageTime(hContact))))
msgTime = now;
pResourceStatus pFromResource(ResourceInfoFromJID(jid));
PROTORECVEVENT recv = { 0 };
recv.timestamp = (DWORD)msgTime;
recv.szMessage = mir_utf8encode(out);
- recv.lParam = (LPARAM)((pFromResource != nullptr && m_options.EnableRemoteControl) ? pFromResource->m_tszResourceName : 0);
+ recv.lParam = (LPARAM)((pFromResource != nullptr && m_bEnableRemoteControl) ? pFromResource->m_tszResourceName : 0);
ProtoChainRecvMsg(hContact, &recv);
mir_free(out);
}
@@ -1863,7 +1863,7 @@ void CJabberProto::OmemoHandleDeviceList(HXML node) return;
HXML message = xmlGetParent(node);
message = xmlGetParent(message);
- LPCTSTR jid = XmlGetAttrValue(message, L"from");
+ const wchar_t *jid = XmlGetAttrValue(message, L"from");
MCONTACT hContact = HContactFromJID(jid);
node = XmlGetChild(node, "item"); //get <item> node
if (!node)
@@ -1881,7 +1881,7 @@ void CJabberProto::OmemoHandleDeviceList(HXML node) if (wcsstr(m_ThreadInfo->fullJID, jid))
own_jid = true;
DWORD current_id;
- LPCTSTR current_id_str;
+ const wchar_t *current_id_str;
if (own_jid)
{
//check if our device exist
@@ -2133,7 +2133,7 @@ void CJabberProto::OmemoOnIqResultGetBundle(HXML iqNode, CJabberIqInfo *pInfo) if (iqNode == nullptr)
return;
- LPCTSTR jid = XmlGetAttrValue(iqNode, L"from");
+ const wchar_t *jid = XmlGetAttrValue(iqNode, L"from");
MCONTACT hContact = HContactFromJID(jid);
const wchar_t *type = XmlGetAttrValue(iqNode, L"type");
@@ -2176,8 +2176,8 @@ void CJabberProto::OmemoOnIqResultGetBundle(HXML iqNode, CJabberIqInfo *pInfo) return;
}
HXML items = XmlGetChild(pubsub, L"items");
- LPCTSTR items_node_val = XmlGetAttrValue(items, L"node");
- LPCTSTR device_id = items_node_val;
+ const wchar_t *items_node_val = XmlGetAttrValue(items, L"node");
+ const wchar_t *device_id = items_node_val;
device_id += mir_wstrlen(JABBER_FEAT_OMEMO L".bundles:");
HXML bundle = XmlGetChild(XmlGetChild(items, L"item"), L"bundle");
if (!bundle)
@@ -2185,25 +2185,25 @@ void CJabberProto::OmemoOnIqResultGetBundle(HXML iqNode, CJabberIqInfo *pInfo) debugLogA("Jabber OMEMO: error: device bundle does not contain bundle node");
return;
}
- LPCTSTR signedPreKeyPublic = XmlGetText(XmlGetChild(bundle, L"signedPreKeyPublic"));
+ const wchar_t *signedPreKeyPublic = XmlGetText(XmlGetChild(bundle, L"signedPreKeyPublic"));
if (!signedPreKeyPublic)
{
debugLogA("Jabber OMEMO: error: device bundle does not contain signedPreKeyPublic node");
return;
}
- LPCTSTR signedPreKeyId = XmlGetAttrValue(XmlGetChild(bundle, L"signedPreKeyPublic"), L"signedPreKeyId");
+ const wchar_t *signedPreKeyId = XmlGetAttrValue(XmlGetChild(bundle, L"signedPreKeyPublic"), L"signedPreKeyId");
if (!signedPreKeyId)
{
debugLogA("Jabber OMEMO: error: device bundle does not contain signedPreKeyPublic node");
return;
}
- LPCTSTR signedPreKeySignature = XmlGetText(XmlGetChild(bundle, L"signedPreKeySignature"));
+ const wchar_t *signedPreKeySignature = XmlGetText(XmlGetChild(bundle, L"signedPreKeySignature"));
if (!signedPreKeySignature)
{
debugLogA("Jabber OMEMO: error: device bundle does not contain signedPreKeySignature node");
return;
}
- LPCTSTR identityKey = XmlGetText(XmlGetChild(bundle, L"identityKey"));
+ const wchar_t *identityKey = XmlGetText(XmlGetChild(bundle, L"identityKey"));
if (!identityKey)
{
debugLogA("Jabber OMEMO: error: device bundle does not contain identityKey node");
@@ -2232,13 +2232,13 @@ void CJabberProto::OmemoOnIqResultGetBundle(HXML iqNode, CJabberIqInfo *pInfo) return;
}
- LPCTSTR preKeyPublic = XmlGetText(prekey_node);
+ const wchar_t *preKeyPublic = XmlGetText(prekey_node);
if (!preKeyPublic)
{
debugLogA("Jabber OMEMO: error: failed to get preKeyPublic data");
return;
}
- LPCTSTR preKeyId = XmlGetAttrValue(prekey_node, L"preKeyId");
+ const wchar_t *preKeyId = XmlGetAttrValue(prekey_node, L"preKeyId");
if (!preKeyId)
{
debugLogA("Jabber OMEMO: error: failed to get preKeyId data");
diff --git a/protocols/JabberG/src/jabber_omemo.h b/protocols/JabberG/src/jabber_omemo.h index 13cdf3a732..24177a5dcc 100755 --- a/protocols/JabberG/src/jabber_omemo.h +++ b/protocols/JabberG/src/jabber_omemo.h @@ -38,9 +38,9 @@ namespace omemo { unsigned long GetOwnDeviceId();
void RefreshDevice();
omemo_device* create_device();
- bool create_session_store(MCONTACT hContact, LPCTSTR device_id);
- bool build_session(MCONTACT hContact, LPCTSTR jid, LPCTSTR dev_id, LPCTSTR key_id, LPCTSTR pre_key_public, LPCTSTR signed_pre_key_id,
- LPCTSTR signed_pre_key_public, LPCTSTR signed_pre_key_signature, LPCTSTR identity_key);
+ bool create_session_store(MCONTACT hContact, const wchar_t *device_id);
+ bool build_session(MCONTACT hContact, const wchar_t *jid, const wchar_t *dev_id, const wchar_t *key_id, const wchar_t *pre_key_public, const wchar_t *signed_pre_key_id,
+ const wchar_t *signed_pre_key_public, const wchar_t *signed_pre_key_signature, const wchar_t *identity_key);
mir_cslockfull *signal_mutex;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index ddefa20189..94ba4caf28 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -390,19 +390,19 @@ public: {
CreateLink(m_txtUsername, "LoginName", L"");
CreateLink(m_txtPriority, "Priority", DBVT_DWORD, 0);
- CreateLink(m_chkSavePassword, proto->m_options.SavePassword);
+ CreateLink(m_chkSavePassword, proto->m_bSavePassword);
CreateLink(m_cbResource, "Resource", L"Miranda");
- CreateLink(m_chkUseHostnameAsResource, proto->m_options.HostNameAsResource);
- CreateLink(m_chkUseDomainLogin, proto->m_options.UseDomainLogin);
+ CreateLink(m_chkUseHostnameAsResource, proto->m_bHostNameAsResource);
+ CreateLink(m_chkUseDomainLogin, proto->m_bUseDomainLogin);
CreateLink(m_cbServer, "LoginServer", L"jabber.org");
CreateLink(m_txtPort, "Port", DBVT_WORD, 5222);
- CreateLink(m_chkUseSsl, proto->m_options.UseSSL);
- CreateLink(m_chkUseTls, proto->m_options.UseTLS);
- CreateLink(m_chkManualHost, proto->m_options.ManualConnect);
+ CreateLink(m_chkUseSsl, proto->m_bUseSSL);
+ CreateLink(m_chkUseTls, proto->m_bUseTLS);
+ CreateLink(m_chkManualHost, proto->m_bManualConnect);
CreateLink(m_txtManualHost, "ManualHost", L"");
CreateLink(m_txtManualPort, "ManualPort", DBVT_WORD, 0);
- CreateLink(m_chkKeepAlive, proto->m_options.KeepAlive);
- CreateLink(m_chkAutoDeleteContacts, proto->m_options.RosterSync);
+ CreateLink(m_chkKeepAlive, proto->m_bKeepAlive);
+ CreateLink(m_chkAutoDeleteContacts, proto->m_bRosterSync);
CreateLink(m_txtUserDirectory, "Jud", L"");
// Bind events
@@ -461,17 +461,17 @@ protected: EnableWindow(GetDlgItem(m_hwnd, IDC_COMBO_RESOURCE), m_chkUseHostnameAsResource.GetState() != BST_CHECKED);
EnableWindow(GetDlgItem(m_hwnd, IDC_UNREGISTER), m_proto->m_bJabberOnline);
- m_chkUseTls.Enable(!m_proto->m_options.Disable3920auth && (m_proto->m_options.UseSSL ? false : true));
- if (m_proto->m_options.Disable3920auth) m_chkUseTls.SetState(BST_UNCHECKED);
- m_chkUseSsl.Enable(m_proto->m_options.Disable3920auth || (m_proto->m_options.UseTLS ? false : true));
+ m_chkUseTls.Enable(!m_proto->m_bDisable3920auth && (m_proto->m_bUseSSL ? false : true));
+ if (m_proto->m_bDisable3920auth) m_chkUseTls.SetState(BST_UNCHECKED);
+ m_chkUseSsl.Enable(m_proto->m_bDisable3920auth || (m_proto->m_bUseTLS ? false : true));
- if (m_proto->m_options.ManualConnect) {
+ if (m_proto->m_bManualConnect) {
m_txtManualHost.Enable();
m_txtManualPort.Enable();
m_txtPort.Disable();
}
- if (m_proto->m_options.UseDomainLogin)
+ if (m_proto->m_bUseDomainLogin)
chkUseDomainLogin_OnChange(&m_chkUseDomainLogin);
CheckRegistration();
@@ -523,8 +523,8 @@ protected: {
switch (msg) {
case WM_ACTIVATE:
- m_chkUseTls.Enable(!m_proto->m_options.Disable3920auth && (m_proto->m_options.UseSSL ? false : true));
- if (m_proto->m_options.Disable3920auth) m_chkUseTls.SetState(BST_UNCHECKED);
+ m_chkUseTls.Enable(!m_proto->m_bDisable3920auth && (m_proto->m_bUseSSL ? false : true));
+ if (m_proto->m_bDisable3920auth) m_chkUseTls.SetState(BST_UNCHECKED);
break;
case WM_JABBER_REFRESH:
@@ -646,7 +646,7 @@ private: m_txtPort.SetInt(5223);
}
else {
- if (!m_proto->m_options.Disable3920auth)
+ if (!m_proto->m_bDisable3920auth)
m_chkUseTls.Enable();
if (!bManualHost)
m_txtPort.SetInt(5222);
@@ -771,11 +771,11 @@ public: m_txtDirect(this, IDC_DIRECT_ADDR),
m_txtProxy(this, IDC_PROXY_ADDR),
m_otvOptions(this, IDC_OPTTREE),
- m_oldFrameValue(proto->m_options.DisableFrame)
+ m_oldFrameValue(proto->m_bDisableFrame)
{
- CreateLink(m_chkDirect, proto->m_options.BsDirect);
- CreateLink(m_chkDirectManual, proto->m_options.BsDirectManual);
- CreateLink(m_chkProxy, proto->m_options.BsProxyManual);
+ CreateLink(m_chkDirect, proto->m_bBsDirect);
+ CreateLink(m_chkDirectManual, proto->m_bBsDirectManual);
+ CreateLink(m_chkProxy, proto->m_bBsProxyManual);
CreateLink(m_txtDirect, "BsDirectAddr", L"");
CreateLink(m_txtProxy, "BsProxyServer", L"");
@@ -783,36 +783,36 @@ public: m_chkDirectManual.OnChange = Callback(this, &CDlgOptAdvanced::chkDirect_OnChange);
m_chkProxy.OnChange = Callback(this, &CDlgOptAdvanced::chkProxy_OnChange);
- 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 (XEP-0136)"), m_proto->m_options.EnableMsgArchive);
- m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive conversations from other devices (XEP-0280)"), m_proto->m_options.EnableCarbons);
-
- 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);
- m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Use OMEMO encryption for messages if possible (Experimental! WIP!)"), m_proto->m_options.UseOMEMO);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Send messages slower, but with full acknowledgment"), m_proto->m_bMsgAck);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable avatars"), m_proto->m_bEnableAvatars);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log chat state changes"), m_proto->m_bLogChatstates);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence subscription state changes"), m_proto->m_bLogPresence);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Log presence errors"), m_proto->m_bLogPresenceErrors);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user moods receiving"), m_proto->m_bEnableUserMood);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user tunes receiving"), m_proto->m_bEnableUserTune);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable user activity receiving"), m_proto->m_bEnableUserActivity);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive notes"), m_proto->m_bAcceptNotes);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Automatically save received notes"), m_proto->m_bAutosaveNotes);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Enable server-side history (XEP-0136)"), m_proto->m_bEnableMsgArchive);
+ m_otvOptions.AddOption(LPGENW("Messaging") L"/" LPGENW("Receive conversations from other devices (XEP-0280)"), m_proto->m_bEnableCarbons);
+
+ m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Disable SASL authentication (for old servers)"), m_proto->m_bDisable3920auth);
+ m_otvOptions.AddOption(LPGENW("Server options") L"/" LPGENW("Enable stream compression (if possible)"), m_proto->m_bEnableZlib);
+
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable remote controlling (from another resource of same JID only)"), m_proto->m_bEnableRemoteControl);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Show transport agents on contact list"), m_proto->m_bShowTransport);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically add contact when accept authorization"), m_proto->m_bAutoAdd);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Automatically accept authorization requests"), m_proto->m_bAutoAcceptAuthorization);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_bFixIncorrectTimestamps);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Disable frame"), m_proto->m_bDisableFrame);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_bProcessXMPPLinks);
+ m_otvOptions.AddOption(LPGENW("Other") L"/" LPGENW("Keep contacts assigned to local groups (ignore roster group)"), m_proto->m_bIgnoreRosterGroups);
+
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Allow servers to request version (XEP-0092)"), m_proto->m_bAllowVersionRequests);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Show information about operating system in version replies"), m_proto->m_bShowOSVersion);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept only in band incoming filetransfers (don't disclose own IP)"), m_proto->m_bBsOnlyIBB);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Accept HTTP Authentication requests (XEP-0070)"), m_proto->m_bAcceptHttpAuth);
+ m_otvOptions.AddOption(LPGENW("Security") L"/" LPGENW("Use OMEMO encryption for messages if possible (Experimental! WIP!)"), m_proto->m_bUseOMEMO);
}
void OnInitDialog()
@@ -825,12 +825,12 @@ public: void OnApply()
{
- if (m_proto->m_options.DisableFrame != m_oldFrameValue) {
+ if (m_proto->m_bDisableFrame != m_oldFrameValue) {
m_proto->InitInfoFrame(); // create or destroy a frame
- m_oldFrameValue = m_proto->m_options.DisableFrame;
+ m_oldFrameValue = m_proto->m_bDisableFrame;
}
- BOOL bChecked = m_proto->m_options.ShowTransport;
+ BOOL bChecked = m_proto->m_bShowTransport;
LISTFOREACH(index, m_proto, LIST_ROSTER)
{
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtrFromIndex(index);
@@ -849,7 +849,7 @@ public: }
}
}
- if (m_proto->m_options.UseOMEMO)
+ if (m_proto->m_bUseOMEMO)
m_proto->m_omemo.init();
else
m_proto->m_omemo.deinit();
@@ -906,17 +906,17 @@ public: CreateLink(m_txtSlap, "GcMsgSlap", TranslateW(JABBER_GC_MSG_SLAP));
CreateLink(m_txtQuit, "GcMsgQuit", TranslateW(JABBER_GC_MSG_QUIT));
- 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);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Autoaccept multiuser chat invitations"), m_proto->m_bAutoAcceptMUC);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join bookmarks on login"), m_proto->m_bAutoJoinBookmarks);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Automatically join conferences on login"), m_proto->m_bAutoJoinConferences);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Hide conference windows at startup"), m_proto->m_bAutoJoinHidden);
+ m_otvOptions.AddOption(LPGENW("General") L"/" LPGENW("Do not show multiuser chat invitations"), m_proto->m_bIgnoreMUCInvites);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Ban notifications"), m_proto->m_bGcLogBans);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Room configuration changes"), m_proto->m_bGcLogConfig);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Affiliation changes"), m_proto->m_bGcLogAffiliations);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Role changes"), m_proto->m_bGcLogRoles);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Status changes"), m_proto->m_bGcLogStatuses);
+ m_otvOptions.AddOption(LPGENW("Log events") L"/" LPGENW("Don't notify history messages"), m_proto->m_bGcLogChatHistory);
}
};
@@ -942,7 +942,7 @@ struct ROSTEREDITDAT int subindex;
};
-static int _RosterInsertListItem(HWND hList, const wchar_t * jid, const wchar_t * nick, const wchar_t * group, const wchar_t * 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;
@@ -1552,11 +1552,11 @@ public: SetParent(hwndParent);
CreateLink(m_txtUsername, "LoginName", L"");
- CreateLink(m_chkSavePassword, proto->m_options.SavePassword);
+ CreateLink(m_chkSavePassword, proto->m_bSavePassword);
CreateLink(m_cbResource, "Resource", L"Miranda");
CreateLink(m_cbServer, "LoginServer", L"jabber.org");
CreateLink(m_txtPort, "Port", DBVT_WORD, 5222);
- CreateLink(m_chkUseDomainLogin, proto->m_options.UseDomainLogin);
+ CreateLink(m_chkUseDomainLogin, proto->m_bUseDomainLogin);
// Bind events
m_cbType.OnChange = Callback(this, &CJabberDlgAccMgrUI::cbType_OnChange);
@@ -1654,16 +1654,16 @@ protected: m_cbType.SetCurSel(ACC_SMS);
m_canregister = false;
}
- else if (m_proto->m_options.UseSSL)
+ else if (m_proto->m_bUseSSL)
m_cbType.SetCurSel(ACC_SSL);
- else if (m_proto->m_options.UseTLS) {
+ else if (m_proto->m_bUseTLS) {
m_cbType.SetCurSel(ACC_TLS);
m_txtPort.SetInt(5222);
}
else m_cbType.SetCurSel(ACC_PUBLIC);
if (m_chkManualHost.Enabled()) {
- if (m_proto->m_options.ManualConnect) {
+ if (m_proto->m_bManualConnect) {
m_chkManualHost.SetState(BST_CHECKED);
m_txtManualHost.Enable();
m_txtPort.Enable();
@@ -1694,7 +1694,7 @@ protected: }
}
- if (m_proto->m_options.UseDomainLogin)
+ if (m_proto->m_bUseDomainLogin)
chkUseDomainLogin_OnChange(&m_chkUseDomainLogin);
CheckRegistration();
@@ -1713,7 +1713,7 @@ protected: if (!mir_wstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
- m_proto->m_options.HostNameAsResource = bUseHostnameAsResource;
+ m_proto->m_bHostNameAsResource = bUseHostnameAsResource;
if (m_chkSavePassword.GetState() == BST_CHECKED) {
wchar_t *text = m_txtPassword.GetText();
@@ -1724,7 +1724,7 @@ protected: switch (m_cbType.GetItemData(m_cbType.GetCurSel())) {
case ACC_PUBLIC:
- m_proto->m_options.UseSSL = m_proto->m_options.UseTLS = FALSE;
+ m_proto->m_bUseSSL = m_proto->m_bUseTLS = FALSE;
break;
case ACC_GTALK:
@@ -1732,26 +1732,26 @@ protected: {
int port = m_txtPort.GetInt();
if (port == 443 || port == 5223) {
- m_proto->m_options.UseSSL = TRUE;
- m_proto->m_options.UseTLS = FALSE;
+ m_proto->m_bUseSSL = TRUE;
+ m_proto->m_bUseTLS = FALSE;
}
else if (port == 5222) {
- m_proto->m_options.UseSSL = FALSE;
- m_proto->m_options.UseTLS = TRUE;
+ m_proto->m_bUseSSL = FALSE;
+ m_proto->m_bUseTLS = TRUE;
}
}
break;
case ACC_OK:
- m_proto->m_options.IgnoreRosterGroups = TRUE;
- m_proto->m_options.UseSSL = FALSE;
- m_proto->m_options.UseTLS = TRUE;
+ m_proto->m_bIgnoreRosterGroups = TRUE;
+ m_proto->m_bUseSSL = FALSE;
+ m_proto->m_bUseTLS = TRUE;
case ACC_TLS:
case ACC_LJTALK:
case ACC_SMS:
- m_proto->m_options.UseSSL = FALSE;
- m_proto->m_options.UseTLS = TRUE;
+ m_proto->m_bUseSSL = FALSE;
+ m_proto->m_bUseTLS = TRUE;
break;
case ACC_LOL_EN:
@@ -1759,13 +1759,13 @@ protected: case ACC_LOL_OC:
case ACC_LOL_US:
m_proto->setDword("Priority", -2);
- m_proto->m_options.UseSSL = TRUE;
- m_proto->m_options.UseTLS = FALSE;
+ m_proto->m_bUseSSL = TRUE;
+ m_proto->m_bUseTLS = FALSE;
break;
case ACC_SSL:
- m_proto->m_options.UseSSL = TRUE;
- m_proto->m_options.UseTLS = FALSE;
+ m_proto->m_bUseSSL = TRUE;
+ m_proto->m_bUseTLS = FALSE;
break;
}
@@ -1776,13 +1776,13 @@ protected: m_txtManualHost.GetTextA(manualServer, _countof(manualServer));
if ((m_chkManualHost.GetState() == BST_CHECKED) && mir_strcmp(server, manualServer)) {
- m_proto->m_options.ManualConnect = TRUE;
+ m_proto->m_bManualConnect = TRUE;
m_proto->setString("ManualHost", manualServer);
m_proto->setWord("ManualPort", m_txtPort.GetInt());
m_proto->setWord("Port", m_txtPort.GetInt());
}
else {
- m_proto->m_options.ManualConnect = FALSE;
+ m_proto->m_bManualConnect = FALSE;
m_proto->delSetting("ManualHost");
m_proto->delSetting("ManualPort");
m_proto->setWord("Port", m_txtPort.GetInt());
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 9fce6b38b9..bd9b540917 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -55,7 +55,6 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) :
PROTO<CJabberProto>(aProtoName, aUserName),
m_omemo(this),
- m_options(this),
m_lstTransports(50, compareTransports),
m_lstRoster(50, compareListItems),
m_iqManager(this),
@@ -71,7 +70,64 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_hPrivacyMenuRoot(nullptr),
m_hPrivacyMenuItems(10),
m_lstJabberFeatCapPairsDynamic(2),
- m_uEnabledFeatCapsDynamic(0)
+ m_uEnabledFeatCapsDynamic(0),
+
+ m_bBsDirect(this, "BsDirect", TRUE),
+ m_bAllowVersionRequests(this, "m_bAllowVersionRequests", TRUE),
+ m_bAcceptHttpAuth(this, "m_bAcceptHttpAuth", TRUE),
+ m_bAddRoster2Bookmarks(this, "m_bAddRoster2Bookmarks", TRUE),
+ m_bAutoAcceptAuthorization(this, "AutoAcceptAuthorization", FALSE),
+ m_bAutoAcceptMUC(this, "AutoAcceptMUC", FALSE),
+ m_bAutoAdd(this, "AutoAdd", TRUE),
+ m_bAutoJoinBookmarks(this, "AutoJoinBookmarks", TRUE),
+ m_bAutoJoinConferences(this, "AutoJoinConferences", 0),
+ m_bAutoJoinHidden(this, "AutoJoinHidden", TRUE),
+ m_bAvatarType(this, "AvatarType", PA_FORMAT_UNKNOWN),
+ m_bBsDirectManual(this, "BsDirectManual", FALSE),
+ m_bBsOnlyIBB(this, "BsOnlyIBB", FALSE),
+ m_bBsProxyManual(this, "BsProxyManual", FALSE),
+ m_bDisable3920auth(this, "Disable3920auth", FALSE),
+ m_bDisableFrame(this, "DisableFrame", TRUE),
+ m_bEnableAvatars(this, "EnableAvatars", TRUE),
+ m_bEnableRemoteControl(this, "EnableRemoteControl", FALSE),
+ m_bEnableMsgArchive(this, "EnableMsgArchive", FALSE),
+ m_bEnableUserActivity(this, "EnableUserActivity", TRUE),
+ m_bEnableUserMood(this, "EnableUserMood", TRUE),
+ m_bEnableUserTune(this, "EnableUserTune", FALSE),
+ m_bEnableZlib(this, "EnableZlib", TRUE),
+ m_bExtendedSearch(this, "ExtendedSearch", TRUE),
+ m_bFixIncorrectTimestamps(this, "FixIncorrectTimestamps", TRUE),
+ m_bGcLogAffiliations(this, "GcLogAffiliations", FALSE),
+ m_bGcLogBans(this, "GcLogBans", TRUE),
+ m_bGcLogConfig(this, "GcLogConfig", FALSE),
+ m_bGcLogRoles(this, "GcLogRoles", FALSE),
+ m_bGcLogStatuses(this, "GcLogStatuses", FALSE),
+ m_bGcLogChatHistory(this, "GcLogChatHistory", TRUE),
+ m_bHostNameAsResource(this, "HostNameAsResource", FALSE),
+ m_bIgnoreMUCInvites(this, "IgnoreMUCInvites", FALSE),
+ m_bKeepAlive(this, "KeepAlive", TRUE),
+ m_bLogChatstates(this, "LogChatstates", FALSE),
+ m_bLogPresence(this, "LogPresence", TRUE),
+ m_bLogPresenceErrors(this, "LogPresenceErrors", FALSE),
+ m_bManualConnect(this, "ManualConnect", FALSE),
+ m_bMsgAck(this, "MsgAck", FALSE),
+ m_bRosterSync(this, "RosterSync", FALSE),
+ m_bSavePassword(this, "SavePassword", TRUE),
+ m_bShowForeignResourceInMirVer(this, "ShowForeignResourceInMirVer", FALSE),
+ m_bShowOSVersion(this, "ShowOSVersion", TRUE),
+ m_bShowTransport(this, "ShowTransport", TRUE),
+ m_bUseSSL(this, "UseSSL", FALSE),
+ m_bUseTLS(this, "UseTLS", TRUE),
+ m_bUseDomainLogin(this, "UseDomainLogin", FALSE),
+ m_bAcceptNotes(this, "AcceptNotes", TRUE),
+ m_bAutosaveNotes(this, "AutosaveNotes", FALSE),
+ m_bRcMarkMessagesAsRead(this, "RcMarkMessagesAsRead", 1),
+ m_iConnectionKeepAliveInterval(this, "ConnectionKeepAliveInterval", 60000),
+ m_iConnectionKeepAliveTimeout(this, "ConnectionKeepAliveTimeout", 50000),
+ m_bProcessXMPPLinks(this, "ProcessXMPPLinks", FALSE),
+ m_bIgnoreRosterGroups(this, "IgnoreRosterGroups", FALSE),
+ m_bEnableCarbons(this, "EnableCarbons", TRUE),
+ m_bUseOMEMO(this, "UseOMEMO", FALSE)
{
m_szXmlStreamToBeInitialized = nullptr;
@@ -142,8 +198,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_pepServices.insert(new CPepMood(this));
m_pepServices.insert(new CPepActivity(this));
- if (m_options.UseOMEMO)
- {
+ if (m_bUseOMEMO) {
db_set_resident(m_szModuleName, "OmemoSessionChecked");
OmemoInitDevice();
}
@@ -368,7 +423,7 @@ int CJabberProto::Authorize(MEVENT hDbEvent) m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", newJid) << XATTR(L"type", L"subscribed"));
// Automatically add this user to my roster if option is enabled
- if (m_options.AutoAdd == TRUE) {
+ if (m_bAutoAdd == TRUE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, newJid);
if (item == nullptr || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
debugLogW(L"Try adding contact automatically jid = %s", blob.get_email());
@@ -709,7 +764,7 @@ HANDLE __cdecl CJabberProto::SearchByName(const wchar_t *nick, const wchar_t *fi if (!m_bJabberOnline)
return nullptr;
- BOOL bIsExtFormat = m_options.ExtendedSearch;
+ BOOL bIsExtFormat = m_bExtendedSearch;
ptrA szServerName(getStringA("Jud"));
@@ -753,7 +808,7 @@ HANDLE __cdecl CJabberProto::SearchByName(const wchar_t *nick, const wchar_t *fi int __cdecl CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
{
- T2Utf szResUtf((LPCTSTR)evt->lParam);
+ T2Utf szResUtf((const wchar_t *)evt->lParam);
evt->pCustomData = (char*)szResUtf;
evt->cbCustomDataSize = (DWORD)mir_strlen(szResUtf);
return CSuper::RecvMsg(hContact, evt);
@@ -819,7 +874,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri }
// fix for very smart clients, like gajim
- if (!m_options.BsDirect && !m_options.BsProxyManual) {
+ if (!m_bBsDirect && !m_bBsProxyManual) {
// disable bytestreams
jcb &= ~JABBER_CAPS_BYTESTREAMS;
}
@@ -912,7 +967,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c return 1;
}
- if (m_options.UseOMEMO)
+ if (m_bUseOMEMO)
{
if (!OmemoCheckSession(hContact))
{
@@ -948,7 +1003,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c msgType = L"chat";
XmlNode m(L"message");
- if(m_options.UseOMEMO && OmemoIsEnabled(hContact) && !mir_wstrcmp(msgType, L"chat")) //omemo enabled in options, omemo enabled for contact
+ if(m_bUseOMEMO && OmemoIsEnabled(hContact) && !mir_wstrcmp(msgType, L"chat")) //omemo enabled in options, omemo enabled for contact
{
//TODO: check if message encrypted for at least one session and return error if not
if (!OmemoEncryptMessage(m, msg, hContact))
@@ -991,7 +1046,7 @@ int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const c // if message sent to groupchat
!mir_wstrcmp(msgType, L"groupchat") ||
// if message delivery check disabled in settings
- !m_options.MsgAck || !getByte(hContact, "MsgAck", true))
+ !m_bMsgAck || !getByte(hContact, "MsgAck", true))
{
if (!mir_wstrcmp(msgType, L"groupchat"))
XmlAddAttr(m, L"to", szClientJid);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index bca7b73ab8..d6144695d7 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -137,20 +137,77 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //====| Data |========================================================================
ThreadData* m_ThreadInfo;
- CJabberOptions m_options;
+
+ CMOption<BYTE> m_bAllowVersionRequests;
+ CMOption<BYTE> m_bAcceptHttpAuth;
+ CMOption<BYTE> m_bAddRoster2Bookmarks;
+ CMOption<BYTE> m_bAutoAcceptAuthorization;
+ CMOption<BYTE> m_bAutoAcceptMUC;
+ CMOption<BYTE> m_bAutoAdd;
+ CMOption<BYTE> m_bAutoJoinBookmarks;
+ CMOption<BYTE> m_bAutoJoinConferences;
+ CMOption<BYTE> m_bAutoJoinHidden;
+ CMOption<BYTE> m_bAvatarType;
+ CMOption<BYTE> m_bBsDirect;
+ CMOption<BYTE> m_bBsDirectManual;
+ CMOption<BYTE> m_bBsOnlyIBB;
+ CMOption<BYTE> m_bBsProxyManual;
+ CMOption<BYTE> m_bDisable3920auth;
+ CMOption<BYTE> m_bDisableFrame;
+ CMOption<BYTE> m_bEnableAvatars;
+ CMOption<BYTE> m_bEnableRemoteControl;
+ CMOption<BYTE> m_bEnableUserActivity;
+ CMOption<BYTE> m_bEnableUserMood;
+ CMOption<BYTE> m_bEnableUserTune;
+ CMOption<BYTE> m_bEnableZlib;
+ CMOption<BYTE> m_bExtendedSearch;
+ CMOption<BYTE> m_bFixIncorrectTimestamps;
+ CMOption<BYTE> m_bGcLogAffiliations;
+ CMOption<BYTE> m_bGcLogBans;
+ CMOption<BYTE> m_bGcLogConfig;
+ CMOption<BYTE> m_bGcLogRoles;
+ CMOption<BYTE> m_bGcLogStatuses;
+ CMOption<BYTE> m_bGcLogChatHistory;
+ CMOption<BYTE> m_bHostNameAsResource;
+ CMOption<BYTE> m_bIgnoreMUCInvites;
+ CMOption<BYTE> m_bKeepAlive;
+ CMOption<BYTE> m_bLogChatstates;
+ CMOption<BYTE> m_bLogPresence;
+ CMOption<BYTE> m_bLogPresenceErrors;
+ CMOption<BYTE> m_bManualConnect;
+ CMOption<BYTE> m_bMsgAck;
+ CMOption<BYTE> m_bRosterSync;
+ CMOption<BYTE> m_bSavePassword;
+ CMOption<BYTE> m_bUseDomainLogin;
+ CMOption<BYTE> m_bShowForeignResourceInMirVer;
+ CMOption<BYTE> m_bShowOSVersion;
+ CMOption<BYTE> m_bShowTransport;
+ CMOption<BYTE> m_bUseSSL;
+ CMOption<BYTE> m_bUseTLS;
+ CMOption<BYTE> m_bAcceptNotes;
+ CMOption<BYTE> m_bAutosaveNotes;
+ CMOption<BYTE> m_bEnableMsgArchive;
+ CMOption<BYTE> m_bRcMarkMessagesAsRead;
+ CMOption<BYTE> m_bProcessXMPPLinks;
+ CMOption<BYTE> m_bIgnoreRosterGroups;
+ CMOption<BYTE> m_bEnableCarbons;
+ CMOption<BYTE> m_bUseOMEMO;
+
+ CMOption<DWORD> m_iConnectionKeepAliveInterval;
+ CMOption<DWORD> m_iConnectionKeepAliveTimeout;
PVOID m_sslCtx;
HANDLE m_hThreadHandle;
wchar_t *m_szJabberJID;
- int m_nJabberSearchID;
- time_t m_tmJabberLoggedInTime;
- time_t m_tmJabberIdleStartTime;
- UINT m_nJabberCodePage;
+ int m_nJabberSearchID;
+ time_t m_tmJabberLoggedInTime;
+ time_t m_tmJabberIdleStartTime;
+ UINT m_nJabberCodePage;
wchar_t *m_tszSelectedLang;
- mir_cs m_csModeMsgMutex;
+ mir_cs m_csModeMsgMutex;
JABBER_MODEMSGS m_modeMsgs;
bool m_bJabberOnline; // XMPP connection initialized and we can send XMPP packets
@@ -279,7 +336,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_bookmarks.c ------------------------------------------------------------
- INT_PTR __cdecl OnMenuHandleBookmarks(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnMenuHandleBookmarks(WPARAM wParam, LPARAM lParam);
int AddEditBookmark(JABBER_LIST_ITEM *item);
@@ -290,9 +347,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface bool OnIncomingNote(const wchar_t *szFrom, HXML hXml);
- INT_PTR __cdecl OnMenuSendNote(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuHandleNotes(WPARAM, LPARAM);
- INT_PTR __cdecl OnIncomingNoteEvent(WPARAM, LPARAM);
+ INT_PTR __cdecl OnMenuSendNote(WPARAM, LPARAM);
+ INT_PTR __cdecl OnMenuHandleNotes(WPARAM, LPARAM);
+ INT_PTR __cdecl OnIncomingNoteEvent(WPARAM, LPARAM);
//---- jabber_byte.c -----------------------------------------------------------------
@@ -319,8 +376,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_captcha.cpp ------------------------------------------------------------
- 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);
+ void sendCaptchaResult(wchar_t* buf, ThreadData *info, const wchar_t *from, const wchar_t *challenge, const wchar_t *fromjid, const wchar_t *sid);
+ void sendCaptchaError(ThreadData *info, const wchar_t *from, const wchar_t *to, const wchar_t *challenge);
//---- jabber_chat.cpp ---------------------------------------------------------------
@@ -340,7 +397,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OmemoHandleMessage(HXML node, wchar_t *jid, time_t msgTime);
void OmemoPutMessageToOutgoingQueue(MCONTACT hContact, int, const char* pszSrc);
- void OmemoPutMessageToIncommingQueue(HXML node, LPCTSTR jid, time_t msgTime);
+ void OmemoPutMessageToIncommingQueue(HXML node, const wchar_t *jid, time_t msgTime);
void OmemoHandleMessageQueue();
void OmemoHandleDeviceList(HXML node);
void OmemoInitDevice();
@@ -368,10 +425,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //---- jabber_disco.cpp --------------------------------------------------------------
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);
- INT_PTR __cdecl OnMenuHandleServiceDiscoveryConferences(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnMenuHandleServiceDiscovery(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnMenuHandleServiceDiscoveryMyTransports(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnMenuHandleServiceDiscoveryTransports(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl OnMenuHandleServiceDiscoveryConferences(WPARAM wParam, LPARAM lParam);
void OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *pInfo);
@@ -423,11 +480,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface INT_PTR __cdecl OnJoinChat(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM lParam);
- void GroupchatJoinRoom(LPCTSTR server, LPCTSTR room, LPCTSTR nick, LPCTSTR password, bool autojoin = false);
+ void GroupchatJoinRoom(const wchar_t *server, const wchar_t *room, const wchar_t *nick, const wchar_t *password, bool autojoin = false);
void GroupchatProcessPresence(HXML node);
void GroupchatProcessMessage(HXML node);
- void GroupchatProcessInvite(LPCTSTR roomJid, LPCTSTR from, LPCTSTR reason, LPCTSTR password);
- void GroupchatJoinDlg(wchar_t* roomJid);
+ void GroupchatProcessInvite(const wchar_t *roomJid, const wchar_t *from, const wchar_t *reason, const wchar_t *password);
void OnIqResultDiscovery(HXML iqNode, CJabberIqInfo *pInfo);
//---- jabber_icolib.cpp -------------------------------------------------------------
@@ -550,7 +606,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo);
void OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasPhoto);
- void SetBookmarkRequest (XmlNodeIq& iqId);
+ void SetBookmarkRequest(XmlNodeIq &iqId);
//---- jabber_menu.cpp ---------------------------------------------------------------
@@ -744,10 +800,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface MCONTACT HContactFromJID(const wchar_t *jid, bool bStripResource = true);
MCONTACT ChatRoomHContactFromJID(const wchar_t *jid);
- void SendVisibleInvisiblePresence(BOOL invisible);
+ void SendVisibleInvisiblePresence(bool invisible);
void SendPresenceTo(int status, const wchar_t* to, HXML extra, const wchar_t *msg = nullptr);
void SendPresence(int m_iStatus, bool bSendToAll);
- void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...);
void RebuildInfoFrame(void);
void InitInfoFrame(void);
@@ -758,8 +813,8 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, 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(CMStringW &result, LPCTSTR caption, int type, char *windowName=nullptr, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0);
- bool IsMyOwnJID(LPCTSTR szJID);
+ BOOL EnterString(CMStringW &result, const wchar_t *caption, int type, char *windowName=nullptr, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0);
+ bool IsMyOwnJID(const wchar_t *szJID);
void __cdecl LoadHttpAvatars(void* param);
@@ -813,7 +868,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void XStatusInit(void);
- void SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack);
+ void SetContactTune(MCONTACT hContact, const wchar_t *szArtist, const wchar_t *szLength, const wchar_t *szSource, const wchar_t *szTitle, const wchar_t *szTrack);
void InfoFrame_OnUserMood(CJabberInfoFrame_Event *evt);
void InfoFrame_OnUserActivity(CJabberInfoFrame_Event *evt);
@@ -841,31 +896,31 @@ public: int STDMETHODCALLTYPE GetVersion() const; // Returns version of IJabberInterface.
DWORD STDMETHODCALLTYPE GetJabberVersion() const; // Returns Jabber plugin version.
- MCONTACT STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid); // Returns contact handle for given JID.
+ MCONTACT STDMETHODCALLTYPE ContactFromJID(const wchar_t *jid); // Returns contact handle for given JID.
LPTSTR STDMETHODCALLTYPE ContactToJID(MCONTACT hContact); // Returns JID of hContact. You must free the result using mir_free().
- LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid); // Returns best resource name for given JID. You must free the result using mir_free().
- LPTSTR STDMETHODCALLTYPE GetResourceList(LPCTSTR jid); // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters). You must free the string using mir_free().
+ LPTSTR STDMETHODCALLTYPE GetBestResourceName(const wchar_t *jid); // Returns best resource name for given JID. You must free the result using mir_free().
+ LPTSTR STDMETHODCALLTYPE GetResourceList(const wchar_t *jid); // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters). You must free the string using mir_free().
char* STDMETHODCALLTYPE GetModuleName() const; // Returns Jabber module name.
int STDMETHODCALLTYPE SerialNext(); // Returns id that can be used for next message sent through SendXmlNode().
int STDMETHODCALLTYPE SendXmlNode(HXML node); // Sends XML node.
HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
- HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
- HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, const wchar_t *szXmlns, const wchar_t *szTag, void *pUserData, int iPriority);
HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority);
HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler);
- int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription);
- int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
- int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client.
- LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
+ int STDMETHODCALLTYPE RegisterFeature(const wchar_t *szFeature, const wchar_t *szDescription);
+ int STDMETHODCALLTYPE AddFeatures(const wchar_t *szFeatures); // Adds features to the list of features returned by the client.
+ int STDMETHODCALLTYPE RemoveFeatures(const wchar_t *szFeatures); // Removes features from the list of features returned by the client.
+ LPTSTR STDMETHODCALLTYPE GetResourceFeatures(const wchar_t *jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
HNETLIBUSER STDMETHODCALLTYPE GetHandle(); // Returns connection handle
private:
- JabberFeatCapPairDynamic *FindFeature(LPCTSTR szFeature);
+ JabberFeatCapPairDynamic *FindFeature(const wchar_t *szFeature);
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index c5879b41a6..e0201f51ff 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -53,7 +53,7 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo) if (!pInfo->GetChildNode())
return TRUE;
- if (!m_options.EnableRemoteControl || !IsRcRequestAllowedByACL(pInfo)) {
+ if (!m_bEnableRemoteControl || !IsRcRequestAllowedByACL(pInfo)) {
// FIXME: send error and return
return TRUE;
}
@@ -68,7 +68,7 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo) BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
- if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
+ if (!szNode || !m_pProto->m_bEnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
if (!mir_wstrcmp(szNode, JABBER_FEAT_COMMANDS)) {
@@ -98,7 +98,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const w BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const wchar_t *szNode)
{
- if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
+ if (!szNode || !m_pProto->m_bEnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
// FIXME: same code twice
@@ -341,7 +341,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc if (!fieldNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
- LPCTSTR ptszValue = XmlGetText( XmlGetChild(fieldNode , "value"));
+ const wchar_t *ptszValue = XmlGetText( XmlGetChild(fieldNode , "value"));
if (ptszValue == nullptr)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
@@ -454,7 +454,7 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe fieldNode = XmlGetChildByTag(xNode, "field", "var", L"enable-rc");
if (fieldNode && (valueNode = XmlGetChild(fieldNode , "value")))
if (XmlGetText(valueNode) && _wtoi(XmlGetText(valueNode)))
- m_options.EnableRemoteControl = 0;
+ m_bEnableRemoteControl = 0;
return JABBER_ADHOC_HANDLER_STATUS_COMPLETED;
}
@@ -526,7 +526,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // remove clist events
xNode << XCHILD(L"field") << XATTR(L"label", TranslateT("Mark messages as read")) << XATTR(L"type", L"boolean")
<< XATTR(L"var", L"remove-clist-events") << XCHILD(L"value",
- m_options.RcMarkMessagesAsRead == 1 ? L"1" : L"0");
+ m_bRcMarkMessagesAsRead == 1 ? L"1" : L"0");
m_ThreadInfo->send(iq);
return JABBER_ADHOC_HANDLER_STATUS_EXECUTING;
@@ -547,7 +547,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (XmlGetText(valueNode) && !_wtoi(XmlGetText(valueNode)))
bRemoveCListEvents = FALSE;
- m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0;
+ m_bRcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0;
int nEventsSent = 0;
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h index 6481885ed8..c2567f302d 100644 --- a/protocols/JabberG/src/jabber_rc.h +++ b/protocols/JabberG/src/jabber_rc.h @@ -74,7 +74,7 @@ public: {
return m_dwStartTime;
}
- LPCTSTR GetSessionId()
+ const wchar_t *GetSessionId()
{
return m_szSessionId;
}
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 1872aef10a..e325fad9fe 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -105,8 +105,8 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat) int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order; - HWND hwndLabel = CreateWindowEx(0, L"STATIC", (LPCTSTR)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, hInst, nullptr); - HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (LPCTSTR)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, hInst, nullptr); + HWND hwndLabel = CreateWindowEx(0, L"STATIC", (const wchar_t *)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, hInst, nullptr); + HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (const wchar_t *)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, hInst, nullptr); SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0); SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0); if (!FieldDat->bHidden) { @@ -137,7 +137,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo*) if (!searchHandleDlg) return; - LPCTSTR type = XmlGetAttrValue(iqNode, L"type"); + const wchar_t *type = XmlGetAttrValue(iqNode, L"type"); if (type == nullptr) return; @@ -366,7 +366,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo*) const wchar_t *szColumnName = XmlGetName(child); if (szColumnName) { - LPCTSTR ptszChild = XmlGetText(child); + const wchar_t *ptszChild = XmlGetText(child); if (ptszChild && *ptszChild) { mColumnsNames.insertCopyKey((wchar_t*)szColumnName, L"", &keyReturned, CopyKey, DestroyKey); mColumnsNames.insert((wchar_t*)szColumnName, keyReturned); diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 088cfbff7b..e65522780c 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -79,7 +79,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatar(WPARAM wParam, LPARAM lParam) if (buf == nullptr || size <= 0)
return -1;
- if (!m_options.EnableAvatars)
+ if (!m_bEnableAvatars)
return -2;
GetAvatarFileName(0, buf, size);
@@ -107,7 +107,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarCaps(WPARAM wParam, LPARAM lParam) return 1;
case AF_ENABLED:
- return m_options.EnableAvatars;
+ return m_bEnableAvatars;
}
return -1;
}
@@ -117,7 +117,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarCaps(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
- if (!m_options.EnableAvatars)
+ if (!m_bEnableAvatars)
return GAIR_NOAVATAR;
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
@@ -283,7 +283,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) char buf[MIR_SHA1_HASH_SIZE*2+1];
bin2hex(digest, sizeof(digest), buf);
- m_options.AvatarType = ProtoGetBufferFormat(pResult);
+ m_bAvatarType = ProtoGetBufferFormat(pResult);
GetAvatarFileName(0, tFileName, MAX_PATH);
FILE *out = _wfopen(tFileName, L"wb");
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index b5954585cc..a8b2b49bd4 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -199,7 +199,7 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData *info) if (m_tszSelectedLang)
XmlAddAttr(stream, L"xml:lang", m_tszSelectedLang);
- if (!m_options.Disable3920auth)
+ if (!m_bDisable3920auth)
XmlAddAttr(stream, L"version", L"1.0");
LPTSTR xmlQuery = xmlToString(n, nullptr);
@@ -224,7 +224,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) debugLogA("Thread started: type=%d", info.bIsReg);
Thread_SetName("Jabber: ServerThread");
- if (m_options.ManualConnect == TRUE) {
+ if (m_bManualConnect == TRUE) {
ptrA szManualHost(getStringA("ManualHost"));
if (szManualHost != nullptr)
strncpy_s(info.conn.manualHost, szManualHost, _TRUNCATE);
@@ -233,7 +233,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *pParam) }
else info.conn.port = getWord("Port", JABBER_DEFAULT_PORT);
- info.conn.useSSL = m_options.UseSSL;
+ info.conn.useSSL = m_bUseSSL;
if (!info.bIsReg) {
// Normal server connection, we will fetch all connection parameters
@@ -276,7 +276,7 @@ LBL_FatalError: goto LBL_FatalError;
}
- if (m_options.HostNameAsResource) {
+ if (m_bHostNameAsResource) {
DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
mir_wstrcpy(info.resource, L"Miranda");
@@ -292,9 +292,9 @@ LBL_FatalError: mir_snwprintf(jidStr, L"%s@%S/%s", info.conn.username, info.conn.server, info.resource);
wcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
- if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
+ if (m_bUseDomainLogin) // 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?
+ else if (!m_bSavePassword) { // we have to enter a password manually. have we done it before?
if (m_savedPassword != nullptr)
wcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
@@ -393,7 +393,7 @@ LBL_FatalError: size_t len = mir_wstrlen(info.conn.username) + mir_strlen(info.conn.server) + 1;
m_szJabberJID = (wchar_t*)mir_alloc(sizeof(wchar_t)*(len + 1));
mir_snwprintf(m_szJabberJID, len + 1, L"%s@%S", info.conn.username, info.conn.server);
- m_bSendKeepAlive = m_options.KeepAlive != 0;
+ m_bSendKeepAlive = m_bKeepAlive != 0;
setWString("jid", m_szJabberJID); // store jid in database
ListInit();
@@ -406,7 +406,7 @@ LBL_FatalError: int datalen = 0;
// cache values
- DWORD dwConnectionKeepAliveInterval = m_options.ConnectionKeepAliveInterval;
+ DWORD dwConnectionKeepAliveInterval = m_iConnectionKeepAliveInterval;
for (;;) {
if (!info.useZlib || info.zRecvReady) {
DWORD dwIdle = GetTickCount() - m_lastTicks;
@@ -422,7 +422,7 @@ LBL_FatalError: else if (nSelRes == 0 && m_bSendKeepAlive) {
if (info.jabberServerCaps & JABBER_CAPS_PING) {
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, 0, -1, this);
- pInfo->SetTimeout(m_options.ConnectionKeepAliveTimeout);
+ pInfo->SetTimeout(m_iConnectionKeepAliveTimeout);
info.send(XmlNodeIq(pInfo) << XATTR(L"from", info.fullJID) << XCHILDNS(L"ping", JABBER_FEAT_PING));
}
else info.send(" \t ");
@@ -577,11 +577,7 @@ void CJabberProto::OnProcessStreamOpening(HXML node, ThreadData *info) info->szStreamId = mir_u2a(sid);
}
- // old server - disable SASL then
- if (XmlGetAttrValue(node, L"version") == nullptr)
- info->proto->m_options.Disable3920auth = TRUE;
-
- if (info->proto->m_options.Disable3920auth)
+ if (info->proto->m_bDisable3920auth)
info->proto->PerformIqAuth(info);
}
@@ -682,13 +678,13 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) break;
if (!mir_wstrcmp(XmlGetName(n), L"starttls")) {
- if (!info->conn.useSSL && m_options.UseTLS) {
+ if (!info->conn.useSSL && m_bUseTLS) {
debugLogA("Requesting TLS");
info->send(XmlNode(XmlGetName(n)) << XATTR(L"xmlns", L"urn:ietf:params:xml:ns:xmpp-tls"));
return;
} }
- if (!mir_wstrcmp(XmlGetName(n), L"compression") && m_options.EnableZlib == TRUE) {
+ if (!mir_wstrcmp(XmlGetName(n), L"compression") && m_bEnableZlib == TRUE) {
debugLogA("Server compression available");
for (int k = 0;; k++) {
HXML c = XmlGetChild(n, k);
@@ -721,7 +717,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info) break;
if (!mir_wstrcmp(XmlGetName(c), L"mechanism")) {
- LPCTSTR ptszMechanism = XmlGetText(c);
+ const wchar_t *ptszMechanism = XmlGetText(c);
if (!mir_wstrcmp(ptszMechanism, L"PLAIN")) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
else if (!mir_wstrcmp(ptszMechanism, L"DIGEST-MD5")) m_AuthMechs.isMd5Available = true;
else if (!mir_wstrcmp(ptszMechanism, L"SCRAM-SHA-1")) m_AuthMechs.isScramAvailable = true;
@@ -945,17 +941,16 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) return;
HXML itemsNode;
- if (m_options.UseOMEMO)
- {
+ if (m_bUseOMEMO) {
itemsNode = XmlGetChildByTag(eventNode, L"items", L"node", JABBER_FEAT_OMEMO L".devicelist");
- if (itemsNode)
- {
+ if (itemsNode) {
OmemoHandleDeviceList(itemsNode);
return;
}
//TODO:handle omemo device list
}
- if (m_options.EnableUserTune && (itemsNode = XmlGetChildByTag(eventNode, "items", "node", JABBER_FEAT_USER_TUNE))) {
+
+ if (m_bEnableUserTune && (itemsNode = XmlGetChildByTag(eventNode, "items", "node", JABBER_FEAT_USER_TUNE))) {
// node retract?
if (XmlGetChild(itemsNode, "retract")) {
SetContactTune(hContact, nullptr, nullptr, nullptr, nullptr, nullptr);
@@ -1031,11 +1026,11 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"message"))
return;
- LPCTSTR from, type = XmlGetAttrValue(node, L"type");
+ const wchar_t *from, *type = XmlGetAttrValue(node, L"type");
if ((from = XmlGetAttrValue(node, L"from")) == nullptr)
return;
- LPCTSTR idStr = XmlGetAttrValue(node, L"id");
+ const wchar_t *idStr = XmlGetAttrValue(node, L"id");
pResourceStatus pFromResource(ResourceInfoFromJID(from));
// Message receipts delivery request. Reply here, before a call to HandleMessagePermanent() to make sure message receipts are handled for external plugins too.
@@ -1063,7 +1058,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
if (carbon) {
//If carbons are disabled in options, we should ignore occasional carbons sent to us by server
- if (!m_options.EnableCarbons)
+ if (!m_bEnableCarbons)
return;
HXML forwarded = nullptr;
@@ -1108,7 +1103,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (bodyNode != nullptr)
szMessage = XmlGetText(bodyNode);
- LPCTSTR ptszSubject = XmlGetText(XmlGetChild(node, "subject"));
+ const wchar_t *ptszSubject = XmlGetText(XmlGetChild(node, "subject"));
if (ptszSubject && *ptszSubject) {
size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszSubject) + 128;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t) * cbLen);
@@ -1191,7 +1186,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
// chatstates gone event
- if (hContact && XmlGetChildByTag(node, "gone", "xmlns", JABBER_FEAT_CHATSTATES) && m_options.LogChatstates) {
+ if (hContact && XmlGetChildByTag(node, "gone", "xmlns", JABBER_FEAT_CHATSTATES) && m_bLogChatstates) {
BYTE bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event
DBEVENTINFO dbei = {};
dbei.pBlob = &bEventType;
@@ -1203,7 +1198,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) db_event_add(hContact, &dbei);
}
- if ((n = XmlGetChildByTag(node, "confirm", "xmlns", JABBER_FEAT_HTTP_AUTH)) && m_options.AcceptHttpAuth) {
+ if ((n = XmlGetChildByTag(node, "confirm", "xmlns", JABBER_FEAT_HTTP_AUTH)) && m_bAcceptHttpAuth) {
const wchar_t *szId = XmlGetAttrValue(n, L"id");
const wchar_t *szMethod = XmlGetAttrValue(n, L"method");
const wchar_t *szUrl = XmlGetAttrValue(n, L"url");
@@ -1217,7 +1212,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) memset(pParams, 0, sizeof(CJabberHttpAuthParams));
pParams->m_nType = CJabberHttpAuthParams::MSG;
pParams->m_szFrom = mir_wstrdup(from);
- LPCTSTR ptszThread = XmlGetText(XmlGetChild(node, "thread"));
+ const wchar_t *ptszThread = XmlGetText(XmlGetChild(node, "thread"));
if (ptszThread && *ptszThread)
pParams->m_szThreadId = mir_wstrdup(ptszThread);
pParams->m_szId = mir_wstrdup(szId);
@@ -1230,7 +1225,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) // parsing extensions
for (int i = 0; (xNode = XmlGetChild(node, i)) != nullptr; i++) {
- if (m_options.UseOMEMO)
+ if (m_bUseOMEMO)
{
if ((xNode = XmlGetNthChild(node, L"encrypted", i + 1)) != nullptr)
{
@@ -1240,7 +1235,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OMEMO))
{
- LPCTSTR jid = xmlGetAttrValue(node, L"from");
+ const wchar_t *jid = xmlGetAttrValue(node, L"from");
if (jid)
{
OmemoHandleMessage(xNode, (wchar_t*)jid, msgTime);
@@ -1262,7 +1257,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) return;
}
else if (!mir_wstrcmp(ptszXmlns, L"jabber:x:encrypted")) {
- LPCTSTR ptszText = XmlGetText(xNode);
+ const wchar_t *ptszText = XmlGetText(xNode);
if (ptszText == nullptr)
return;
@@ -1343,7 +1338,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
}
else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OOB2)) {
- LPCTSTR ptszUrl = XmlGetText(XmlGetChild(xNode, "url"));
+ const wchar_t *ptszUrl = XmlGetText(XmlGetChild(xNode, "url"));
if (ptszUrl != nullptr && *ptszUrl) {
size_t cbLen = (szMessage ? mir_wstrlen(szMessage) : 0) + mir_wstrlen(ptszUrl) + 32;
wchar_t *szTmp = (wchar_t *)alloca(sizeof(wchar_t)* cbLen);
@@ -1407,7 +1402,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (isChatRoomInvitation) {
if (inviteRoomJid != nullptr) {
- if (m_options.IgnoreMUCInvites) {
+ if (m_bIgnoreMUCInvites) {
// FIXME: temporary disabled due to MUC inconsistence on server side
/*
XmlNode m("message"); XmlAddAttr(m, "to", from);
@@ -1453,7 +1448,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) if (!msgTime)
msgTime = now;
- if (m_options.FixIncorrectTimestamps && (msgTime > now || (msgTime < (time_t)JabberGetLastContactMessageTime(hContact))))
+ if (m_bFixIncorrectTimestamps && (msgTime > now || (msgTime < (time_t)JabberGetLastContactMessageTime(hContact))))
msgTime = now;
PROTORECVEVENT recv = { 0 };
@@ -1464,7 +1459,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) }
recv.timestamp = (DWORD)msgTime;
recv.szMessage = buf;
- recv.lParam = (LPARAM)((pFromResource != nullptr && m_options.EnableRemoteControl) ? pFromResource->m_tszResourceName : 0);
+ recv.lParam = (LPARAM)((pFromResource != nullptr && m_bEnableRemoteControl) ? pFromResource->m_tszResourceName : 0);
ProtoChainRecvMsg(hContact, &recv);
}
@@ -1574,7 +1569,7 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid) }
else delSetting(hContact, DBSETTING_DISPLAY_UID);
- if (wcschr(jid, '@') != nullptr || m_options.ShowTransport == TRUE)
+ if (wcschr(jid, '@') != nullptr || m_bShowTransport == TRUE)
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != status)
setWord(hContact, "Status", (WORD)status);
@@ -1593,7 +1588,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (!node || !XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"presence"))
return;
- LPCTSTR from = XmlGetAttrValue(node, L"from");
+ const wchar_t *from = XmlGetAttrValue(node, L"from");
if (from == nullptr)
return;
@@ -1615,7 +1610,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) if (!mir_wstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = true;
- LPCTSTR type = XmlGetAttrValue(node, L"type");
+ const wchar_t *type = XmlGetAttrValue(node, L"type");
if (type == nullptr || !mir_wstrcmp(type, L"available")) {
ptrW nick(JabberNickFromJID(from));
if (nick == nullptr)
@@ -1635,7 +1630,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) DBCheckIsTransportedContact(from, hContact);
int status = ID_STATUS_ONLINE;
if (HXML showNode = XmlGetChild(node, "show")) {
- if (LPCTSTR show = XmlGetText(showNode)) {
+ if (const wchar_t *show = XmlGetText(showNode)) {
if (!mir_wstrcmp(show, L"away")) status = ID_STATUS_AWAY;
else if (!mir_wstrcmp(show, L"xa")) status = ID_STATUS_NA;
else if (!mir_wstrcmp(show, L"dnd")) status = ID_STATUS_DND;
@@ -1644,7 +1639,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) }
char priority = 0;
- if (LPCTSTR ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
+ if (const wchar_t *ptszPriority = XmlGetText(XmlGetChild(node, "priority")))
priority = (char)_wtoi(ptszPriority);
ListAddResource(LIST_ROSTER, from, status, XmlGetText(XmlGetChild(node, "status")), priority);
@@ -1662,13 +1657,13 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) debugLogW(L"%s (%s) online, set contact status to %s", nick, from, pcli->pfnGetStatusModeDescription(status, 0));
HXML xNode;
- if (m_options.EnableAvatars) {
+ if (m_bEnableAvatars) {
bool bHasAvatar = false, bRemovedAvatar = false;
debugLogA("Avatar enabled");
for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != nullptr; i++) {
if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"jabber:x:avatar")) {
- LPCTSTR ptszHash = XmlGetText(XmlGetChild(xNode, "hash"));
+ const wchar_t *ptszHash = XmlGetText(XmlGetChild(xNode, "hash"));
if (ptszHash != nullptr) {
delSetting(hContact, "AvatarXVcard");
debugLogA("AvatarXVcard deleted");
@@ -1688,7 +1683,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) for (int i = 1; (xNode = XmlGetNthChild(node, L"x", i)) != nullptr; i++) {
if (!mir_wstrcmp(XmlGetAttrValue(xNode, L"xmlns"), L"vcard-temp:x:update")) {
if ((xNode = XmlGetChild(xNode, "photo")) != nullptr) {
- LPCTSTR txt = XmlGetText(xNode);
+ const wchar_t *txt = XmlGetText(xNode);
if (txt != nullptr && txt[0] != 0) {
setByte(hContact, "AvatarXVcard", 1);
debugLogA("AvatarXVcard set");
@@ -1752,7 +1747,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) ptrW tszNick(JabberNickFromJID(from));
HXML xNick = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK);
if (xNick != nullptr) {
- LPCTSTR xszNick = XmlGetText(xNick);
+ const wchar_t *xszNick = XmlGetText(xNick);
if (xszNick != nullptr && *xszNick) {
debugLogW(L"Grabbed nick from presence: %s", xszNick);
tszNick = mir_wstrdup(xszNick);
@@ -1760,11 +1755,11 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) }
// automatically send authorization allowed to agent/transport
- if (wcschr(from, '@') == nullptr || m_options.AutoAcceptAuthorization) {
+ if (wcschr(from, '@') == nullptr || m_bAutoAcceptAuthorization) {
ListAdd(LIST_ROSTER, from, hContact);
info->send(XmlNode(L"presence") << XATTR(L"to", from) << XATTR(L"type", L"subscribed"));
- if (m_options.AutoAdd == TRUE) {
+ if (m_bAutoAdd == TRUE) {
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, from);
if (item == nullptr || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
debugLogW(L"Try adding contact automatically jid = %s", from);
@@ -1816,15 +1811,15 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) BOOL CJabberProto::OnProcessJingle(HXML node)
{
- LPCTSTR type;
+ const wchar_t *type;
HXML child = XmlGetChildByTag(node, L"jingle", L"xmlns", JABBER_FEAT_JINGLE);
if (child) {
if ((type = XmlGetAttrValue(node, L"type")) == nullptr) return FALSE;
if ((!mir_wstrcmp(type, L"get") || !mir_wstrcmp(type, L"set"))) {
- LPCTSTR szAction = XmlGetAttrValue(child, L"action");
- LPCTSTR idStr = XmlGetAttrValue(node, L"id");
- LPCTSTR from = XmlGetAttrValue(node, L"from");
+ const wchar_t *szAction = XmlGetAttrValue(child, L"action");
+ const wchar_t *idStr = XmlGetAttrValue(node, L"id");
+ const wchar_t *from = XmlGetAttrValue(node, L"from");
if (szAction && !mir_wstrcmp(szAction, L"session-initiate")) {
// if this is a Jingle 'session-initiate' and noone processed it yet, reply with "unsupported-applications"
m_ThreadInfo->send(XmlNodeIq(L"result", idStr, from));
@@ -1833,10 +1828,10 @@ BOOL CJabberProto::OnProcessJingle(HXML node) HXML jingleNode = iq << XCHILDNS(L"jingle", JABBER_FEAT_JINGLE);
jingleNode << XATTR(L"action", L"session-terminate");
- LPCTSTR szInitiator = XmlGetAttrValue(child, L"initiator");
+ const wchar_t *szInitiator = XmlGetAttrValue(child, L"initiator");
if (szInitiator)
jingleNode << XATTR(L"initiator", szInitiator);
- LPCTSTR szSid = XmlGetAttrValue(child, L"sid");
+ const wchar_t *szSid = XmlGetAttrValue(child, L"sid");
if (szSid)
jingleNode << XATTR(L"sid", szSid);
@@ -1935,7 +1930,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from) void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info)
{
if (!XmlGetName(node) || mir_wstrcmp(XmlGetName(node), L"iq")) return;
- LPCTSTR type = XmlGetAttrValue(node, L"type");
+ const wchar_t *type = XmlGetAttrValue(node, L"type");
if (type == nullptr)
return;
@@ -1944,7 +1939,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData *info) if (!mir_wstrcmp(type, L"result")) {
HXML queryNode = XmlGetChild(node, L"query");
if (queryNode != nullptr) {
- LPCTSTR str = XmlGetAttrValue(queryNode, L"xmlns");
+ const wchar_t *str = XmlGetAttrValue(queryNode, L"xmlns");
if (!mir_wstrcmp(str, JABBER_FEAT_REGISTER)) {
HXML xNode = XmlGetChild(queryNode, L"x");
if (xNode != nullptr) {
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 10a110b1b8..9679ee23ca 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -104,7 +104,7 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const wchar_t *jid) return item->findResource(p + 1);
}
-wchar_t* JabberPrepareJid(LPCTSTR jid)
+wchar_t* JabberPrepareJid(const wchar_t *jid)
{
if (jid == nullptr) return nullptr;
wchar_t *szNewJid = mir_wstrdup(jid);
@@ -300,7 +300,7 @@ wchar_t* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) return errorStr;
}
-void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible)
+void CJabberProto::SendVisibleInvisiblePresence(bool invisible)
{
if (!m_bJabberOnline) return;
@@ -315,9 +315,9 @@ void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible) continue;
WORD apparentMode = getWord(hContact, "ApparentMode", 0);
- if (invisible == TRUE && apparentMode == ID_STATUS_OFFLINE)
+ if (invisible && apparentMode == ID_STATUS_OFFLINE)
m_ThreadInfo->send(XmlNode(L"presence") << XATTR(L"to", item->jid) << XATTR(L"type", L"invisible"));
- else if (invisible == FALSE && apparentMode == ID_STATUS_ONLINE)
+ else if (!invisible && apparentMode == ID_STATUS_ONLINE)
SendPresenceTo(m_iStatus, item->jid, nullptr);
}
}
@@ -392,7 +392,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con XmlAddChild(p, extra);
// XEP-0115:Entity Capabilities
- if (m_options.AllowVersionRequests) {
+ if (m_bAllowVersionRequests) {
HXML c = p << XCHILDNS(L"c", JABBER_FEAT_ENTITY_CAPS) << XATTR(L"hash", L"sha-1")
<< XATTR(L"node", JABBER_CAPS_MIRANDA_NODE) << XATTR(L"ver", m_clientCapsManager.GetFeaturesCrc());
@@ -406,7 +406,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con if (bNewGPG)
arrExtCaps.insert(JABBER_EXT_NEWGPG);
- if(m_options.UseOMEMO)
+ if(m_bUseOMEMO)
arrExtCaps.insert(JABBER_EXT_OMEMO);
if (bPlatform)
@@ -414,19 +414,19 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con else
arrExtCaps.insert(JABBER_EXT_PLATFORMX86);
- if (m_options.EnableRemoteControl)
+ if (m_bEnableRemoteControl)
arrExtCaps.insert(JABBER_EXT_COMMANDS);
- if (m_options.EnableUserMood)
+ if (m_bEnableUserMood)
arrExtCaps.insert(JABBER_EXT_USER_MOOD);
- if (m_options.EnableUserTune)
+ if (m_bEnableUserTune)
arrExtCaps.insert(JABBER_EXT_USER_TUNE);
- if (m_options.EnableUserActivity)
+ if (m_bEnableUserActivity)
arrExtCaps.insert(JABBER_EXT_USER_ACTIVITY);
- if (m_options.AcceptNotes)
+ if (m_bAcceptNotes)
arrExtCaps.insert(JABBER_EXT_MIR_NOTES);
NotifyFastHook(hExtListInit, (WPARAM)&arrExtCaps, (LPARAM)(IJabberInterface*)this);
@@ -449,7 +449,7 @@ void CJabberProto::SendPresenceTo(int status, const wchar_t* to, HXML extra, con if (m_tmJabberIdleStartTime)
p << XQUERY(JABBER_FEAT_LAST_ACTIVITY) << XATTRI(L"seconds", time(nullptr) - m_tmJabberIdleStartTime);
- if (m_options.EnableAvatars) {
+ if (m_bEnableAvatars) {
HXML x = p << XCHILDNS(L"x", L"vcard-temp:x:update");
ptrA hashValue(getStringA("AvatarHash"));
@@ -590,9 +590,9 @@ wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size_t dest /////////////////////////////////////////////////////////////////////////////////////////
// JabberGetPictureType - tries to autodetect the picture type from the buffer
-LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
+const wchar_t *__stdcall JabberGetPictureType(HXML node, const char *picBuf)
{
- if (LPCTSTR ptszType = XmlGetText(XmlGetChild(node, "TYPE")))
+ if (const wchar_t *ptszType = XmlGetText(XmlGetChild(node, "TYPE")))
if (ProtoGetAvatarFormatByMimeType(ptszType) != PA_FORMAT_UNKNOWN)
return ptszType;
@@ -811,7 +811,7 @@ void JabberCopyText(HWND hwnd, const wchar_t *text) }
}
-BOOL CJabberProto::EnterString(CMStringW &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
+BOOL CJabberProto::EnterString(CMStringW &result, const wchar_t *caption, int type, char *windowName, int recentCount, int timeout)
{
if (caption == nullptr) {
caption = NEWWSTR_ALLOCA(result.GetString());
@@ -860,7 +860,7 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime) return msgTime != 0;
}
-bool CJabberProto::IsMyOwnJID(LPCTSTR szJID)
+bool CJabberProto::IsMyOwnJID(const wchar_t *szJID)
{
if (m_ThreadInfo == nullptr)
return false;
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 3191ea28de..5fd5cd0521 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -1147,7 +1147,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName) char buf[MIR_SHA1_HASH_SIZE * 2 + 1];
bin2hex(digest, sizeof(digest), buf);
- m_options.AvatarType = ProtoGetBufferFormat(buffer);
+ m_bAvatarType = ProtoGetBufferFormat(buffer);
if (bPhotoChanged) {
DeleteFile(szAvatarName);
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 6d52966242..b9ea865514 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 wchar_t *type, int id, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, int id, const wchar_t *to) :
XmlNode(L"iq")
{
if (type != nullptr) *this << XATTR(L"type", type);
@@ -41,7 +41,7 @@ XmlNodeIq::XmlNodeIq(const wchar_t *type, int id, LPCTSTR to) : if (id != -1 ) *this << XATTRID(id);
}
-XmlNodeIq::XmlNodeIq(const wchar_t *type, LPCTSTR idStr, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, const wchar_t *idStr, const wchar_t *to) :
XmlNode(L"iq")
{
if (type != nullptr) *this << XATTR(L"type", type );
@@ -49,7 +49,7 @@ XmlNodeIq::XmlNodeIq(const wchar_t *type, LPCTSTR idStr, LPCTSTR to) : if (idStr != nullptr) *this << XATTR(L"id", idStr);
}
-XmlNodeIq::XmlNodeIq(const wchar_t *type, HXML node, LPCTSTR to) :
+XmlNodeIq::XmlNodeIq(const wchar_t *type, HXML node, const wchar_t *to) :
XmlNode(L"iq")
{
if (type != nullptr) *this << XATTR(L"type", type );
@@ -83,12 +83,12 @@ XmlNodeIq::XmlNodeIq(const wchar_t *type, CJabberIqInfo *pInfo) : /////////////////////////////////////////////////////////////////////////////////////////
// XmlNode class members
-XmlNode::XmlNode(LPCTSTR pszName)
+XmlNode::XmlNode(const wchar_t *pszName)
{
m_hXml = xmlCreateNode(T2UTF(pszName), nullptr, 0);
}
-XmlNode::XmlNode(LPCTSTR pszName, LPCTSTR ptszText)
+XmlNode::XmlNode(const wchar_t *pszName, const wchar_t *ptszText)
{
m_hXml = xmlCreateNode(T2UTF(pszName), ptszText, 0);
}
@@ -132,18 +132,18 @@ HXML __fastcall operator<<(HXML node, const XQUERY& child) /////////////////////////////////////////////////////////////////////////////////////////
-void __fastcall XmlAddAttr(HXML hXml, LPCTSTR name, LPCTSTR value)
+void __fastcall XmlAddAttr(HXML hXml, const wchar_t *name, const wchar_t *value)
{
if (value)
xmlAddAttr(hXml, name, T2UTF(value));
}
-void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, int value)
+void __fastcall XmlAddAttr(HXML hXml, const wchar_t *pszName, int value)
{
xmlAddAttrInt(hXml, T2UTF(pszName), value);
}
-void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value)
+void __fastcall XmlAddAttr(HXML hXml, const wchar_t *pszName, unsigned __int64 value)
{
wchar_t buf[60];
_ui64tot(value, buf, 10);
@@ -160,7 +160,7 @@ void __fastcall XmlAddAttrID(HXML hXml, int id) /////////////////////////////////////////////////////////////////////////////////////////
-LPCTSTR __fastcall XmlGetAttr(HXML hXml, int n)
+const wchar_t *__fastcall XmlGetAttr(HXML hXml, int n)
{
return xmlGetAttr(hXml, n);
}
@@ -170,7 +170,7 @@ int __fastcall XmlGetAttrCount(HXML hXml) return xmlGetAttrCount(hXml);
}
-LPCTSTR __fastcall XmlGetAttrName(HXML hXml, int n)
+const wchar_t *__fastcall XmlGetAttrName(HXML hXml, int n)
{
return xmlGetAttrName(hXml, n);
}
@@ -182,17 +182,17 @@ void __fastcall XmlAddChild(HXML hXml, HXML n) xmlAddChild2(n, hXml);
}
-HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name)
+HXML __fastcall XmlAddChild(HXML hXml, const wchar_t *name)
{
return xmlAddChild(hXml, T2UTF(name), nullptr);
}
-HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, LPCTSTR value)
+HXML __fastcall XmlAddChild(HXML hXml, const wchar_t *name, const wchar_t *value)
{
return xmlAddChild(hXml, T2UTF(name), T2UTF(value));
}
-HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, int value)
+HXML __fastcall XmlAddChild(HXML hXml, const wchar_t *name, int value)
{
wchar_t buf[40];
_itow(value, buf, 10);
@@ -201,7 +201,7 @@ HXML __fastcall XmlAddChild(HXML hXml, LPCTSTR name, int value) /////////////////////////////////////////////////////////////////////////////////////////
-LPCTSTR __fastcall XmlGetAttrValue(HXML hXml, LPCTSTR key)
+const wchar_t *__fastcall XmlGetAttrValue(HXML hXml, const wchar_t *key)
{
return xmlGetAttrValue(hXml, key);
}
@@ -211,7 +211,7 @@ HXML __fastcall XmlGetChild(HXML hXml, int n) return xmlGetChild(hXml, n);
}
-HXML __fastcall XmlGetChild(HXML hXml, LPCTSTR key)
+HXML __fastcall XmlGetChild(HXML hXml, const wchar_t *key)
{
return xmlGetNthChild(hXml, key, 0);
}
@@ -224,12 +224,12 @@ HXML __fastcall XmlGetChild(HXML hXml, LPCSTR key) return result;
}
-HXML __fastcall XmlGetChildByTag(HXML hXml, LPCTSTR key, LPCTSTR attrName, LPCTSTR attrValue)
+HXML __fastcall XmlGetChildByTag(HXML hXml, const wchar_t *key, const wchar_t *attrName, const wchar_t *attrValue)
{
return xmlGetChildByAttrValue(hXml, key, attrName, attrValue);
}
-HXML __fastcall XmlGetChildByTag(HXML hXml, LPCSTR key, LPCSTR attrName, LPCTSTR attrValue)
+HXML __fastcall XmlGetChildByTag(HXML hXml, LPCSTR key, LPCSTR attrName, const wchar_t *attrValue)
{
LPTSTR wszKey = mir_a2u(key), wszName = mir_a2u(attrName);
HXML result = xmlGetChildByAttrValue(hXml, wszKey, wszName, attrValue);
@@ -242,7 +242,7 @@ int __fastcall XmlGetChildCount(HXML hXml) return xmlGetChildCount(hXml);
}
-HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth)
+HXML __fastcall XmlGetNthChild(HXML hXml, const wchar_t *tag, int nth)
{
int i, num;
@@ -264,12 +264,12 @@ HXML __fastcall XmlGetNthChild(HXML hXml, LPCTSTR tag, int nth) return nullptr;
}
-LPCTSTR __fastcall XmlGetName(HXML xml)
+const wchar_t *__fastcall XmlGetName(HXML xml)
{
return xmlGetName(xml);
}
-LPCTSTR __fastcall XmlGetText(HXML xml)
+const wchar_t *__fastcall XmlGetText(HXML xml)
{
return (xml) ? xmlGetText(xml) : nullptr;
}
@@ -309,7 +309,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate) LookupState state = S_START;
LookupInfo info = {};
- for (LPCTSTR p = m_szPath; state < S_FINAL; ++p) {
+ for (const wchar_t *p = m_szPath; state < S_FINAL; ++p) {
switch (state) {
case S_START:
ProcessPath(info, bCreate);
diff --git a/protocols/JabberG/src/jabber_xml.h b/protocols/JabberG/src/jabber_xml.h index 61a4b1c3d0..b3072ab4b4 100644 --- a/protocols/JabberG/src/jabber_xml.h +++ b/protocols/JabberG/src/jabber_xml.h @@ -29,44 +29,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_xml.h>
void __fastcall XmlAddChild(HXML, HXML);
-HXML __fastcall XmlAddChild(HXML, LPCTSTR pszName);
-HXML __fastcall XmlAddChild(HXML, LPCTSTR pszName, LPCTSTR ptszValue);
-HXML __fastcall XmlAddChild(HXML, LPCTSTR pszName, int iValue);
+HXML __fastcall XmlAddChild(HXML, const wchar_t *pszName);
+HXML __fastcall XmlAddChild(HXML, const wchar_t *pszName, const wchar_t *ptszValue);
+HXML __fastcall XmlAddChild(HXML, const wchar_t *pszName, int iValue);
-LPCTSTR __fastcall XmlGetAttrValue(HXML, LPCTSTR key);
+const wchar_t *__fastcall XmlGetAttrValue(HXML, const wchar_t *key);
HXML __fastcall XmlGetChild(HXML, int n = 0);
HXML __fastcall XmlGetChild(HXML, LPCSTR key);
-HXML __fastcall XmlGetChild(HXML, LPCTSTR key);
+HXML __fastcall XmlGetChild(HXML, const wchar_t *key);
int __fastcall XmlGetChildCount(HXML);
-HXML __fastcall XmlGetChildByTag(HXML, LPCTSTR key, LPCTSTR attrName, LPCTSTR attrValue);
-HXML __fastcall XmlGetChildByTag(HXML, LPCSTR key, LPCSTR attrName, LPCTSTR attrValue);
-HXML __fastcall XmlGetNthChild(HXML, LPCTSTR key, int n = 0);
+HXML __fastcall XmlGetChildByTag(HXML, const wchar_t *key, const wchar_t *attrName, const wchar_t *attrValue);
+HXML __fastcall XmlGetChildByTag(HXML, LPCSTR key, LPCSTR attrName, const wchar_t *attrValue);
+HXML __fastcall XmlGetNthChild(HXML, const wchar_t *key, int n = 0);
-LPCTSTR __fastcall XmlGetName(HXML);
-LPCTSTR __fastcall XmlGetText(HXML);
+const wchar_t *__fastcall XmlGetName(HXML);
+const wchar_t *__fastcall XmlGetText(HXML);
-void __fastcall XmlAddAttr(HXML, LPCTSTR pszName, LPCTSTR ptszValue);
-void __fastcall XmlAddAttr(HXML, LPCTSTR pszName, int value);
-void __fastcall XmlAddAttr(HXML hXml, LPCTSTR pszName, unsigned __int64 value);
+void __fastcall XmlAddAttr(HXML, const wchar_t *pszName, const wchar_t *ptszValue);
+void __fastcall XmlAddAttr(HXML, const wchar_t *pszName, int value);
+void __fastcall XmlAddAttr(HXML hXml, const wchar_t *pszName, unsigned __int64 value);
void __fastcall XmlAddAttrID(HXML, int id);
int __fastcall XmlGetAttrCount(HXML);
-LPCTSTR __fastcall XmlGetAttr(HXML, int n);
-LPCTSTR __fastcall XmlGetAttrName(HXML, int n);
-LPCTSTR __fastcall XmlGetAttrValue(HXML, LPCTSTR key);
+const wchar_t *__fastcall XmlGetAttr(HXML, int n);
+const wchar_t *__fastcall XmlGetAttrName(HXML, int n);
+const wchar_t *__fastcall XmlGetAttrValue(HXML, const wchar_t *key);
struct XmlNode
{
__forceinline XmlNode() { m_hXml = nullptr; }
- __forceinline XmlNode(LPCTSTR pszString, int* numBytes, LPCTSTR ptszTag)
+ __forceinline XmlNode(const wchar_t *pszString, int* numBytes, const wchar_t *ptszTag)
{
m_hXml = xmlParseString(pszString, numBytes, ptszTag);
}
XmlNode(const XmlNode& n);
- XmlNode(LPCTSTR name);
- XmlNode(LPCTSTR pszName, LPCTSTR ptszText);
+ XmlNode(const wchar_t *name);
+ XmlNode(const wchar_t *pszName, const wchar_t *ptszText);
~XmlNode();
XmlNode& operator =(const XmlNode& n);
@@ -98,9 +98,9 @@ typedef void (*JABBER_XML_CALLBACK)(HXML, void*); struct XATTR
{
- LPCTSTR name, value;
+ const wchar_t *name, *value;
- __forceinline XATTR(LPCTSTR _name, LPCTSTR _value) :
+ __forceinline XATTR(const wchar_t *_name, const wchar_t *_value) :
name(_name),
value(_value)
{}
@@ -115,10 +115,10 @@ HXML __forceinline operator<<(HXML node, const XATTR& attr) struct XATTRI
{
- LPCTSTR name;
+ const wchar_t *name;
int value;
- __forceinline XATTRI(LPCTSTR _name, int _value) :
+ __forceinline XATTRI(const wchar_t *_name, int _value) :
name(_name),
value(_value)
{}
@@ -133,10 +133,10 @@ HXML __forceinline operator<<(HXML node, const XATTRI& attr) struct XATTRI64
{
- LPCTSTR name;
+ const wchar_t *name;
unsigned __int64 value;
- __forceinline XATTRI64(LPCTSTR _name, unsigned __int64 _value) :
+ __forceinline XATTRI64(const wchar_t *_name, unsigned __int64 _value) :
name(_name),
value(_value)
{}
@@ -167,9 +167,9 @@ HXML __forceinline operator<<(HXML node, const XATTRID& attr) struct XCHILD
{
- LPCTSTR name, value;
+ const wchar_t *name, *value;
- __forceinline XCHILD(LPCTSTR _name, LPCTSTR _value = nullptr) :
+ __forceinline XCHILD(const wchar_t *_name, const wchar_t *_value = nullptr) :
name(_name),
value(_value)
{}
@@ -183,9 +183,9 @@ HXML __forceinline operator<<(HXML node, const XCHILD& child) struct XCHILDNS
{
- LPCTSTR name, ns;
+ const wchar_t *name, *ns;
- __forceinline XCHILDNS(LPCTSTR _name, LPCTSTR _ns = nullptr) :
+ __forceinline XCHILDNS(const wchar_t *_name, const wchar_t *_ns = nullptr) :
name(_name),
ns(_ns)
{}
@@ -197,9 +197,9 @@ HXML __fastcall operator<<(HXML node, const XCHILDNS& child); struct XQUERY
{
- LPCTSTR ns;
+ const wchar_t *ns;
- __forceinline XQUERY(LPCTSTR _ns) :
+ __forceinline XQUERY(const wchar_t *_ns) :
ns(_ns)
{}
};
@@ -213,8 +213,8 @@ HXML __fastcall operator<<(HXML node, const XQUERY& child); // result may be either "node-spec", or "@attr-name"
//
// Samples:
-// LPCTSTR s = XPathT(node, "child/subchild[@attr='value']"); // get node text
-// LPCTSTR s = XPathT(node, "child/subchild[2]/@attr"); // get attribute value
+// const wchar_t *s = XPathT(node, "child/subchild[@attr='value']"); // get node text
+// const wchar_t *s = XPathT(node, "child/subchild[2]/@attr"); // get attribute value
// XPathT(node, "child/subchild[@name='test']/@attr") = L"Hello"; // create path if needed and set attribute value
//
// XPathT(node, "child/subchild[@name='test']") = L"Hello"; // TODO: create path if needed and set node text
@@ -258,11 +258,11 @@ public: }
__forceinline bool operator== (wchar_t *str)
{
- return !mir_wstrcmp((LPCTSTR)*this, str);
+ return !mir_wstrcmp((const wchar_t *)*this, str);
}
__forceinline bool operator!= (wchar_t *str)
{
- return mir_wstrcmp((LPCTSTR)*this, str) ? true : false;
+ return mir_wstrcmp((const wchar_t *)*this, str) ? true : false;
}
HXML operator[] (int idx)
{
@@ -270,7 +270,7 @@ public: }
// Write data
- void operator= (LPCTSTR value)
+ void operator= (const wchar_t *value)
{
switch (Lookup(true))
{
@@ -345,8 +345,8 @@ private: PathType m_type;
HXML m_hXml;
- LPCTSTR m_szPath;
- LPCTSTR m_szParam;
+ const wchar_t *m_szPath;
+ const wchar_t *m_szParam;
};
class XPathFmt: public XPath
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index aaf32c38fc..43072a3749 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -630,7 +630,7 @@ void CPepMood::ProcessItems(const wchar_t *from, HXML itemsNode) HXML n, moodNode = XPath(itemsNode, L"item/mood[@xmlns='" JABBER_FEAT_USER_MOOD L"']");
if (!moodNode) return;
- LPCTSTR moodType = nullptr, moodText = nullptr;
+ const wchar_t *moodType = nullptr, *moodText = nullptr;
for (int i=0; n = XmlGetChild(moodNode, i); i++) {
if (!mir_wstrcmp(XmlGetName(n), L"text"))
moodText = XmlGetText(n);
@@ -861,7 +861,7 @@ inline char *ActivityGetId(int id) }
// -1 if not found, otherwise activity number
-static int ActivityCheck(LPCTSTR szFirstNode, LPCTSTR szSecondNode)
+static int ActivityCheck(const wchar_t *szFirstNode, const wchar_t *szSecondNode)
{
if (!szFirstNode) return 0;
@@ -1011,8 +1011,8 @@ void CPepActivity::ProcessItems(const wchar_t *from, HXML itemsNode) if (!actNode)
return;
- LPCTSTR szText = XPathT(actNode, "text");
- LPCTSTR szFirstNode = nullptr, szSecondNode = nullptr;
+ const wchar_t *szText = XPathT(actNode, "text");
+ const wchar_t *szFirstNode = nullptr, *szSecondNode = nullptr;
HXML n;
for (int i=0; n = XmlGetChild(actNode, i); i++) {
@@ -1062,7 +1062,7 @@ void CPepActivity::SetExtraIcon(MCONTACT hContact, char *szActivity) ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == nullptr ? nullptr : g_ActivityIcons.GetIcolibHandle(szActivity));
}
-void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText)
+void CPepActivity::SetActivity(MCONTACT hContact, const wchar_t *szFirst, const wchar_t *szSecond, const wchar_t *szText)
{
int activity = -1;
if (szFirst || szSecond) {
@@ -1192,7 +1192,7 @@ BOOL CJabberProto::SendPepTune(wchar_t* szArtist, wchar_t* szLength, wchar_t* sz return TRUE;
}
-void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack)
+void CJabberProto::SetContactTune(MCONTACT hContact, const wchar_t *szArtist, const wchar_t *szLength, const wchar_t *szSource, const wchar_t *szTitle, const wchar_t *szTrack)
{
if (!szArtist && !szTitle) {
delSetting(hContact, "ListeningTo");
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index b74a80b62d..b7878f9c7c 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -180,7 +180,7 @@ protected: void ShowSetDialog(BYTE bQuiet);
void SetExtraIcon(MCONTACT hContact, char *szActivity);
- void SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText);
+ void SetActivity(MCONTACT hContact, const wchar_t *szFirst, const wchar_t *szSecond, const wchar_t *szText);
};
#endif // _JABBER_XSTATUS_H_
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index e9b233babc..6943d549e0 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -105,7 +105,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "jabber_xml.h"
#include "jabber_byte.h"
#include "jabber_ibb.h"
-#include "jabber_db_utils.h"
struct SESSION_INFO : public GCSessionInfoBase {};
@@ -680,12 +679,12 @@ struct CJabberAdhocStartupParams struct JabberAdHocData
{
CJabberProto *proto;
- int CurrentHeight;
- int curPos;
- int frameHeight;
- RECT frameRect;
- HXML AdHocNode;
- HXML CommandsNode;
+ int CurrentHeight;
+ int curPos;
+ int frameHeight;
+ RECT frameRect;
+ HXML AdHocNode;
+ HXML CommandsNode;
wchar_t *ResponderJID;
};
@@ -710,7 +709,7 @@ struct TStringPairs typedef char JabberShaStrBuf[2*MIR_SHA1_HASH_SIZE + 1];
wchar_t* __stdcall JabberNickFromJID(const wchar_t *jid);
-wchar_t* JabberPrepareJid(LPCTSTR jid);
+wchar_t* JabberPrepareJid(const wchar_t *jid);
void __stdcall JabberUrlDecodeW(WCHAR *str);
char* __stdcall JabberSha1(const char *str, JabberShaStrBuf buf);
wchar_t* __stdcall JabberStrFixLines(const wchar_t *str);
@@ -723,7 +722,7 @@ wchar_t* __stdcall JabberStripJid(const wchar_t *jid, wchar_t *dest, size int __stdcall JabberGetPacketID(HXML n);
wchar_t* __stdcall JabberId2string(int id);
-LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf);
+const wchar_t * __stdcall JabberGetPictureType(HXML node, const char *picBuf);
wchar_t* time2str(time_t _time, wchar_t *buf, size_t bufLen);
time_t str2time(const wchar_t*);
|