summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-18 22:26:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-18 22:26:07 +0300
commitc56f054c476f1f54075442478745d9fd6a986d05 (patch)
treedf7921e9485959a94efb05fafd72a7928e22088c
parent0e854af70f6f330e63aa36fde125fbb0ca4ff8ef (diff)
code cleaning
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp21
-rw-r--r--protocols/JabberG/src/jabber_agent.cpp56
-rw-r--r--protocols/JabberG/src/jabber_api.cpp32
-rw-r--r--protocols/JabberG/src/jabber_archive.cpp2
-rw-r--r--protocols/JabberG/src/jabber_bookmarks.cpp23
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp157
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.h5
-rw-r--r--protocols/JabberG/src/jabber_console.cpp4
-rw-r--r--protocols/JabberG/src/jabber_events.cpp6
-rw-r--r--protocols/JabberG/src/jabber_form.cpp13
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp33
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp15
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp23
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp68
-rw-r--r--protocols/JabberG/src/jabber_treelist.cpp301
-rwxr-xr-xprotocols/JabberG/src/jabber_userinfo.cpp2
18 files changed, 384 insertions, 381 deletions
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index e69c40b6c0..69377f2de1 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -40,11 +40,6 @@ enum
JAHM_PROCESSRESULT
};
-//Declarations
-static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-//implementations
-
// convert iqID to dialog hwnd
HWND CJabberProto::GetWindowFromIq(CJabberIqInfo *pInfo)
{
@@ -271,19 +266,19 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA
}
else if (!mir_wstrcmp(type, L"error")) {
// error occurred here
- int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0};
+ int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0 };
sttShowControls(hwndDlg, FALSE, toHide);
- const wchar_t *code=nullptr;
- const wchar_t *description=nullptr;
+ const wchar_t *code = nullptr;
+ const wchar_t *description = nullptr;
wchar_t buff[255];
- HXML errorNode = XmlGetChild(workNode , "error");
+ HXML errorNode = XmlGetChild(workNode, "error");
if (errorNode) {
code = XmlGetAttrValue(errorNode, L"code");
description = XmlGetText(errorNode);
}
mir_snwprintf(buff, TranslateT("Error %s %s"), code ? code : L"", description ? description : L"");
- JabberFormSetInstruction(hwndDlg,buff);
+ JabberFormSetInstruction(hwndDlg, buff);
}
JabberAdHoc_RefreshFrameScroll(hwndDlg, dat);
return TRUE;
@@ -365,7 +360,6 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
// hide frame first
LONG frameExStyle = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE);
frameExStyle |= WS_EX_CONTROLPARENT;
-
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
int toHide[] = { IDC_FRAME, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_FRAME_TEXT, 0 };
@@ -550,12 +544,11 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
}
if (item == nullptr || selected) {
- CJabberAdhocStartupParams* pStartupParams = new CJabberAdhocStartupParams(this, jid, nullptr);
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)pStartupParams);
+ ContactMenuAdhocCommands(new CJabberAdhocStartupParams(this, jid, nullptr));
}
}
else if (lParam != 0)
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, lParam);
+ ContactMenuAdhocCommands((CJabberAdhocStartupParams*)lParam);
}
return res;
}
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp
index ca2a996272..82571acac1 100644
--- a/protocols/JabberG/src/jabber_agent.cpp
+++ b/protocols/JabberG/src/jabber_agent.cpp
@@ -105,9 +105,9 @@ public:
SetDlgItemText(m_hwnd, IDC_SUBMIT, TranslateT("Register"));
SetDlgItemText(m_hwnd, IDC_FRAME_TEXT, TranslateT("Please wait..."));
- m_proto->m_ThreadInfo->send(
+ m_proto->m_ThreadInfo->send(
XmlNodeIq(m_proto->AddIQ(&CJabberProto::OnIqResultGetRegister, JABBER_IQ_TYPE_GET, m_jid))
- << XQUERY(JABBER_FEAT_REGISTER));
+ << XQUERY(JABBER_FEAT_REGISTER));
// Enable WS_EX_CONTROLPARENT on IDC_FRAME (so tab stop goes through all its children)
LONG_PTR frameExStyle = GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_FRAME), GWL_EXSTYLE);
@@ -127,9 +127,9 @@ public:
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
{
- switch(msg) {
+ switch (msg) {
case WM_CTLCOLORSTATIC:
- switch(GetDlgCtrlID((HWND)lParam)) {
+ switch (GetDlgCtrlID((HWND)lParam)) {
case IDC_WHITERECT: case IDC_INSTRUCTION: case IDC_TITLE:
return (INT_PTR)GetStockObject(WHITE_BRUSH);
default:
@@ -144,20 +144,20 @@ public:
HXML queryNode, xNode;
if ((m_agentRegIqNode = (HXML)lParam) == nullptr) return TRUE;
- if ((queryNode = XmlGetChild(m_agentRegIqNode , "query")) == nullptr) return TRUE;
-
- RECT rect;
+ if ((queryNode = XmlGetChild(m_agentRegIqNode, "query")) == nullptr) return TRUE;
m_curPos = 0;
- GetClientRect(GetDlgItem(m_hwnd, IDC_FRAME), &(m_frameRect));
+ GetClientRect(GetDlgItem(m_hwnd, IDC_FRAME), &m_frameRect);
+
+ RECT rect;
GetClientRect(GetDlgItem(m_hwnd, IDC_VSCROLL), &rect);
m_frameRect.right -= (rect.right - rect.left);
GetClientRect(GetDlgItem(m_hwnd, IDC_FRAME), &rect);
m_frameHeight = rect.bottom - rect.top;
- if ((xNode=XmlGetChild(queryNode , "x")) != nullptr) {
+ if ((xNode = XmlGetChild(queryNode, "x")) != nullptr) {
// use new jabber:x:data form
- if (const wchar_t *ptszInstr = XmlGetText( XmlGetChild(xNode, "instructions")))
+ if (const wchar_t *ptszInstr = XmlGetText(XmlGetChild(xNode, "instructions")))
JabberFormSetInstruction(m_hwnd, ptszInstr);
JabberFormCreateUI(hFrame, xNode, &m_formHeight /*dummy*/);
@@ -165,8 +165,8 @@ public:
else {
// use old registration information form
HJFORMLAYOUT layout_info = JabberFormCreateLayout(hFrame);
- for (int i=0; ; i++) {
- HXML n = XmlGetChild(queryNode ,i);
+ for (int i = 0; ; i++) {
+ HXML n = XmlGetChild(queryNode, i);
if (n == nullptr)
break;
@@ -181,7 +181,8 @@ public:
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_PRIVATE, XmlGetName(n), XmlGetText(n));
else // everything else is a normal text field
JabberFormAppendControl(hFrame, layout_info, JFORM_CTYPE_TEXT_SINGLE, XmlGetName(n), XmlGetText(n));
- } }
+ }
+ }
JabberFormLayoutControls(hFrame, layout_info, &m_formHeight);
mir_free(layout_info);
}
@@ -199,18 +200,18 @@ public:
}
else if (wParam == 0) {
// lParam = error message
- SetDlgItemText(m_hwnd, IDC_FRAME_TEXT, (const wchar_t *) lParam);
+ SetDlgItemText(m_hwnd, IDC_FRAME_TEXT, (const wchar_t *)lParam);
}
return TRUE;
case WM_VSCROLL:
int pos = m_curPos;
switch (LOWORD(wParam)) {
- case SB_LINEDOWN: pos += 10; break;
- case SB_LINEUP: pos -= 10; break;
+ case SB_LINEDOWN: pos += 10; break;
+ case SB_LINEUP: pos -= 10; break;
case SB_PAGEDOWN: pos += (m_frameHeight - 10); break;
case SB_PAGEUP: pos -= (m_frameHeight - 10); break;
- case SB_THUMBTRACK: pos = HIWORD(wParam); break;
+ case SB_THUMBTRACK: pos = HIWORD(wParam); break;
}
if (pos > (m_formHeight - m_frameHeight))
pos = m_formHeight - m_frameHeight;
@@ -220,19 +221,21 @@ public:
ScrollWindow(GetDlgItem(m_hwnd, IDC_FRAME), 0, m_curPos - pos, nullptr, &(m_frameRect));
SetScrollPos(GetDlgItem(m_hwnd, IDC_VSCROLL), SB_CTL, pos, TRUE);
m_curPos = pos;
- } }
+ }
+ }
return CJabberDlgBase::DlgProc(msg, wParam, lParam);
}
void OnSubmit(CCtrlButton*)
{
+ if (m_agentRegIqNode == nullptr)
+ return;
+
HXML queryNode, xNode;
const wchar_t *from;
-
- if (m_agentRegIqNode == nullptr) return;
if ((from = XmlGetAttrValue(m_agentRegIqNode, L"from")) == nullptr) return;
- if ((queryNode = XmlGetChild(m_agentRegIqNode , "query")) == nullptr) return;
+ if ((queryNode = XmlGetChild(m_agentRegIqNode, "query")) == nullptr) return;
HWND hFrame = GetDlgItem(m_hwnd, IDC_FRAME);
wchar_t *str2 = (wchar_t*)alloca(sizeof(wchar_t) * 128);
@@ -241,7 +244,7 @@ public:
XmlNodeIq iq(m_proto->AddIQ(&CJabberProto::OnIqResultSetRegister, JABBER_IQ_TYPE_SET, from));
HXML query = iq << XQUERY(JABBER_FEAT_REGISTER);
- if ((xNode = XmlGetChild(queryNode , "x")) != nullptr) {
+ if ((xNode = XmlGetChild(queryNode, "x")) != nullptr) {
// use new jabber:x:data form
HXML n = JabberFormGetData(hFrame, xNode);
XmlAddChild(query, n);
@@ -249,8 +252,8 @@ public:
}
else {
// use old registration information form
- for (int i=0; ; i++) {
- HXML n = XmlGetChild(queryNode ,i);
+ for (int i = 0; ; i++) {
+ HXML n = XmlGetChild(queryNode, i);
if (!n)
break;
@@ -269,7 +272,10 @@ public:
GetDlgItemText(hFrame, id, str2, 128);
XmlAddChild(query, XmlGetName(n), str2);
id++;
- } } } }
+ }
+ }
+ }
+ }
m_proto->m_ThreadInfo->send(iq);
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 6e0ff4d2f8..8a72dc3b91 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -211,8 +211,7 @@ int CJabberProto::RegisterFeature(const wchar_t *szFeature, const wchar_t *szDes
return false;
// check for this feature in core features, and return false if it's present, to prevent re-registering a core feature
- int i;
- for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
+ for (int i = 0; i < g_cJabberFeatCapPairs; i++)
if (!mir_wstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
return false;
@@ -222,7 +221,7 @@ int CJabberProto::RegisterFeature(const wchar_t *szFeature, const wchar_t *szDes
JabberCapsBits jcb = JABBER_CAPS_OTHER_SPECIAL; // set all bits not included in g_JabberFeatCapPairs
// set all bits occupied by g_JabberFeatCapPairs
- for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
+ for (int i = 0; i < g_cJabberFeatCapPairs; i++)
jcb |= g_JabberFeatCapPairs[i].jcbCap;
// set all bits already occupied by external plugins
@@ -322,35 +321,24 @@ LPTSTR CJabberProto::GetResourceFeatures(const wchar_t *jid)
if (jcb & JABBER_RESOURCE_CAPS_ERROR)
return nullptr;
+ CMStringW res;
mir_cslockfull lck(m_csLists);
- size_t iLen = 1; // 1 for extra zero terminator at the end of the string
- // calculate total necessary string length
- for (int i=0; g_JabberFeatCapPairs[i].szFeature; i++)
- if (jcb & g_JabberFeatCapPairs[i].jcbCap)
- iLen += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
-
- for (auto &it : m_lstJabberFeatCapPairsDynamic)
- if (jcb & it->jcbCap)
- iLen += mir_wstrlen(it->szFeature) + 1;
-
// allocate memory and fill it
- LPTSTR str = (LPTSTR)mir_alloc(iLen * sizeof(wchar_t));
- LPTSTR p = str;
- for (int i=0; g_JabberFeatCapPairs[i].szFeature; i++)
+ for (int i = 0; i < g_cJabberFeatCapPairs; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
- mir_wstrcpy(p, g_JabberFeatCapPairs[i].szFeature);
- p += mir_wstrlen(g_JabberFeatCapPairs[i].szFeature) + 1;
+ res.Append(g_JabberFeatCapPairs[i].szFeature);
+ res.AppendChar(0);
}
for (auto &it : m_lstJabberFeatCapPairsDynamic)
if (jcb & it->jcbCap) {
- mir_wstrcpy(p, it->szFeature);
- p += mir_wstrlen(it->szFeature) + 1;
+ res.Append(it->szFeature);
+ res.AppendChar(0);
}
- *p = 0; // extra zero terminator
- return str;
+ res.AppendChar(0);
+ return res.Detach();
}
HNETLIBUSER CJabberProto::GetHandle()
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp
index ab3fba07eb..7e1c59018c 100644
--- a/protocols/JabberG/src/jabber_archive.cpp
+++ b/protocols/JabberG/src/jabber_archive.cpp
@@ -265,7 +265,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*)
DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.szModule = m_szModuleName;
- dbei.cbBlob = (DWORD)mir_strlen(szEventText)+1;
+ dbei.cbBlob = (DWORD)mir_strlen(szEventText) + 1;
dbei.flags = DBEF_READ + DBEF_UTF + from;
dbei.pBlob = szEventText;
dbei.timestamp = tmStart + _wtol(tszSecs);
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp
index 6954dd9656..17c8dd9af6 100644
--- a/protocols/JabberG/src/jabber_bookmarks.cpp
+++ b/protocols/JabberG/src/jabber_bookmarks.cpp
@@ -27,7 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
// Bookmarks editor window
-struct JabberAddBookmarkDlgParam {
+struct JabberAddBookmarkDlgParam
+{
CJabberProto *ppro;
JABBER_LIST_ITEM* m_item;
};
@@ -85,7 +86,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
case WM_COMMAND:
switch (HIWORD(wParam)) {
case BN_CLICKED:
- switch (LOWORD (wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_ROOM_RADIO:
EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
@@ -103,7 +104,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
switch (LOWORD(wParam)) {
case IDC_ROOM_JID:
- if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
+ if ((HWND)lParam == GetFocus() && HIWORD(wParam) == EN_CHANGE)
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)));
break;
@@ -266,7 +267,7 @@ void CJabberDlgBookmarks::UpdateData()
m_proto->m_ThreadInfo->send(
XmlNodeIq(m_proto->AddIQ(&CJabberProto::OnIqResultDiscoBookmarks, JABBER_IQ_TYPE_GET))
- << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) << XCHILDNS(L"storage", L"storage:bookmarks"));
+ << XQUERY(JABBER_FEAT_PRIVATE_STORAGE) << XCHILDNS(L"storage", L"storage:bookmarks"));
}
bool CJabberDlgBookmarks::OnInitDialog()
@@ -279,15 +280,15 @@ bool CJabberDlgBookmarks::OnInitDialog()
m_btnEdit.Disable();
m_btnRemove.Disable();
- m_lvBookmarks.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER);
+ m_lvBookmarks.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER);
HIMAGELIST hIml = m_lvBookmarks.CreateImageList(LVSIL_SMALL);
ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("group"));
ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_EVENT_URL));
- m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120));
+ m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120));
m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->getWord("bookmarksWnd_cx1", 210));
- m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->getWord("bookmarksWnd_cx2", 90));
+ m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->getWord("bookmarksWnd_cx2", 90));
m_lvBookmarks.EnableGroupView(TRUE);
m_lvBookmarks.AddGroup(0, TranslateT("Conferences"));
@@ -299,7 +300,7 @@ bool CJabberDlgBookmarks::OnInitDialog()
bool CJabberDlgBookmarks::OnClose()
{
- LVCOLUMN lvc = {0};
+ LVCOLUMN lvc = { 0 };
lvc.mask = LVCF_WIDTH;
m_lvBookmarks.GetColumn(0, &lvc);
m_proto->setWord("bookmarksWnd_cx0", lvc.cx);
@@ -413,15 +414,15 @@ int CJabberDlgBookmarks::Resizer(UTILRESIZECONTROL *urc)
{
switch (urc->wId) {
case IDC_BM_LIST:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDCANCEL:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
case IDC_ADD:
case IDC_EDIT:
case IDC_REMOVE:
- return RD_ANCHORX_LEFT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
}
return CSuper::Resizer(urc);
}
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index d2bb4755bb..b360fed925 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -28,59 +28,62 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_caps.h"
#include "version.h"
-const JabberFeatCapPair g_JabberFeatCapPairs[] = {
- { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENW("Supports Service Discovery info") },
- { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENW("Supports Service Discovery items list") },
- { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENW("Can inform about its Jabber capabilities") },
- { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENW("Supports stream initiation (e.g., for filetransfers)") },
- { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENW("Supports stream initiation for file transfers") },
- { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENW("Supports file transfers via SOCKS5 Bytestreams") },
- { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENW("Supports file transfers via In-Band Bytestreams") },
- { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
- { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENW("Supports execution of Ad-Hoc commands") },
- { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENW("Supports in-band registration") },
- { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENW("Supports multi-user chat") },
- { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENW("Can report chat state in a chat session") },
- { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENW("Can report information about the last activity of the user") },
- { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENW("Can report own version information") },
- { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENW("Can report local time of the user") },
- { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENW("Can send and receive ping requests") },
- { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENW("Supports data forms") },
- { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENW("Can request and respond to events relating to the delivery, display, and composition of messages") },
- { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENW("Supports vCard") },
- { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENW("Supports iq-based avatars") },
- { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENW("Supports XHTML formatting of chat messages") },
- { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENW("Supports Jabber Browsing") },
- { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENW("Supports Jabber Browsing") },
- { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENW("Can negotiate options for specific features") },
- { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENW("Can request advanced processing of message stanzas") },
- { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENW("Can report information about user moods") },
- { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENW("Receives information about user moods") },
- { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENW("Supports generic publish-subscribe functionality") },
- { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENW("Supports SecureIM plugin for Miranda NG") },
- { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENW("Supports OTR (Off-the-Record Messaging)") },
- { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENW("Supports New_GPG plugin for Miranda NG") },
- { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENW("Blocks packets from other users/group chats using Privacy lists") },
- { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENW("Supports Message Receipts") },
- { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENW("Can report information about the music to which a user is listening") },
- { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENW("Receives information about the music to which a user is listening") },
- { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENW("Supports private XML Storage (for bookmarks and other)") },
- { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENW("Supports attention requests ('nudge')") },
- { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENW("Supports chat history retrieving") },
- { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENW("Supports chat history management") },
- { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENW("Can report information about user activity") },
- { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENW("Receives information about user activity") },
- { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENW("Supports Miranda NG notes extension") },
- { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") },
- { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") },
- { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") },
- { JABBER_FEAT_OMEMO_DEVICELIST_NOTIFY, JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY, LPGENW("Receives information about OMEMO devices") },
- { JABBER_FEAT_CARBONS, JABBER_CAPS_CARBONS, LPGENW("Supports message carbons (XEP-0280)")},
- { nullptr }
+const JabberFeatCapPair g_JabberFeatCapPairs[] =
+{
+ { JABBER_FEAT_DISCO_INFO, JABBER_CAPS_DISCO_INFO, LPGENW("Supports Service Discovery info") },
+ { JABBER_FEAT_DISCO_ITEMS, JABBER_CAPS_DISCO_ITEMS, LPGENW("Supports Service Discovery items list") },
+ { JABBER_FEAT_ENTITY_CAPS, JABBER_CAPS_ENTITY_CAPS, LPGENW("Can inform about its Jabber capabilities") },
+ { JABBER_FEAT_SI, JABBER_CAPS_SI, LPGENW("Supports stream initiation (e.g., for filetransfers)") },
+ { JABBER_FEAT_SI_FT, JABBER_CAPS_SI_FT, LPGENW("Supports stream initiation for file transfers") },
+ { JABBER_FEAT_BYTESTREAMS, JABBER_CAPS_BYTESTREAMS, LPGENW("Supports file transfers via SOCKS5 Bytestreams") },
+ { JABBER_FEAT_IBB, JABBER_CAPS_IBB, LPGENW("Supports file transfers via In-Band Bytestreams") },
+ { JABBER_FEAT_OOB, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_OOB2, JABBER_CAPS_OOB, LPGENW("Supports file transfers via Out-of-Band Bytestreams") },
+ { JABBER_FEAT_COMMANDS, JABBER_CAPS_COMMANDS, LPGENW("Supports execution of Ad-Hoc commands") },
+ { JABBER_FEAT_REGISTER, JABBER_CAPS_REGISTER, LPGENW("Supports in-band registration") },
+ { JABBER_FEAT_MUC, JABBER_CAPS_MUC, LPGENW("Supports multi-user chat") },
+ { JABBER_FEAT_CHATSTATES, JABBER_CAPS_CHATSTATES, LPGENW("Can report chat state in a chat session") },
+ { JABBER_FEAT_LAST_ACTIVITY, JABBER_CAPS_LAST_ACTIVITY, LPGENW("Can report information about the last activity of the user") },
+ { JABBER_FEAT_VERSION, JABBER_CAPS_VERSION, LPGENW("Can report own version information") },
+ { JABBER_FEAT_ENTITY_TIME, JABBER_CAPS_ENTITY_TIME, LPGENW("Can report local time of the user") },
+ { JABBER_FEAT_PING, JABBER_CAPS_PING, LPGENW("Can send and receive ping requests") },
+ { JABBER_FEAT_DATA_FORMS, JABBER_CAPS_DATA_FORMS, LPGENW("Supports data forms") },
+ { JABBER_FEAT_MESSAGE_EVENTS, JABBER_CAPS_MESSAGE_EVENTS, LPGENW("Can request and respond to events relating to the delivery, display, and composition of messages") },
+ { JABBER_FEAT_VCARD_TEMP, JABBER_CAPS_VCARD_TEMP, LPGENW("Supports vCard") },
+ { JABBER_FEAT_AVATAR, JABBER_CAPS_AVATAR, LPGENW("Supports iq-based avatars") },
+ { JABBER_FEAT_XHTML, JABBER_CAPS_XHTML, LPGENW("Supports XHTML formatting of chat messages") },
+ { JABBER_FEAT_AGENTS, JABBER_CAPS_AGENTS, LPGENW("Supports Jabber Browsing") },
+ { JABBER_FEAT_BROWSE, JABBER_CAPS_BROWSE, LPGENW("Supports Jabber Browsing") },
+ { JABBER_FEAT_FEATURE_NEG, JABBER_CAPS_FEATURE_NEG, LPGENW("Can negotiate options for specific features") },
+ { JABBER_FEAT_AMP, JABBER_CAPS_AMP, LPGENW("Can request advanced processing of message stanzas") },
+ { JABBER_FEAT_USER_MOOD, JABBER_CAPS_USER_MOOD, LPGENW("Can report information about user moods") },
+ { JABBER_FEAT_USER_MOOD_NOTIFY, JABBER_CAPS_USER_MOOD_NOTIFY, LPGENW("Receives information about user moods") },
+ { JABBER_FEAT_PUBSUB, JABBER_CAPS_PUBSUB, LPGENW("Supports generic publish-subscribe functionality") },
+ { JABBER_FEAT_SECUREIM, JABBER_CAPS_SECUREIM, LPGENW("Supports SecureIM plugin for Miranda NG") },
+ { JABBER_FEAT_MIROTR, JABBER_CAPS_MIROTR, LPGENW("Supports OTR (Off-the-Record Messaging)") },
+ { JABBER_FEAT_NEWGPG, JABBER_CAPS_NEWGPG, LPGENW("Supports New_GPG plugin for Miranda NG") },
+ { JABBER_FEAT_PRIVACY_LISTS, JABBER_CAPS_PRIVACY_LISTS, LPGENW("Blocks packets from other users/group chats using Privacy lists") },
+ { JABBER_FEAT_MESSAGE_RECEIPTS, JABBER_CAPS_MESSAGE_RECEIPTS, LPGENW("Supports Message Receipts") },
+ { JABBER_FEAT_USER_TUNE, JABBER_CAPS_USER_TUNE, LPGENW("Can report information about the music to which a user is listening") },
+ { JABBER_FEAT_USER_TUNE_NOTIFY, JABBER_CAPS_USER_TUNE_NOTIFY, LPGENW("Receives information about the music to which a user is listening") },
+ { JABBER_FEAT_PRIVATE_STORAGE, JABBER_CAPS_PRIVATE_STORAGE, LPGENW("Supports private XML Storage (for bookmarks and other)") },
+ { JABBER_FEAT_ATTENTION, JABBER_CAPS_ATTENTION, LPGENW("Supports attention requests ('nudge')") },
+ { JABBER_FEAT_ARCHIVE_AUTO, JABBER_CAPS_ARCHIVE_AUTO, LPGENW("Supports chat history retrieving") },
+ { JABBER_FEAT_ARCHIVE_MANAGE, JABBER_CAPS_ARCHIVE_MANAGE, LPGENW("Supports chat history management") },
+ { JABBER_FEAT_USER_ACTIVITY, JABBER_CAPS_USER_ACTIVITY, LPGENW("Can report information about user activity") },
+ { JABBER_FEAT_USER_ACTIVITY_NOTIFY, JABBER_CAPS_USER_ACTIVITY_NOTIFY, LPGENW("Receives information about user activity") },
+ { JABBER_FEAT_MIRANDA_NOTES, JABBER_CAPS_MIRANDA_NOTES, LPGENW("Supports Miranda NG notes extension") },
+ { JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") },
+ { JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") },
+ { JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") },
+ { JABBER_FEAT_OMEMO_DEVICELIST_NOTIFY, JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY, LPGENW("Receives information about OMEMO devices") },
+ { JABBER_FEAT_CARBONS, JABBER_CAPS_CARBONS, LPGENW("Supports message carbons (XEP-0280)")},
};
-const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] = {
+const int g_cJabberFeatCapPairs = _countof(g_JabberFeatCapPairs);
+
+const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] =
+{
{ JABBER_EXT_SECUREIM, JABBER_CAPS_SECUREIM, "SecureIM/IsContactSecured" },
{ JABBER_EXT_MIROTR, JABBER_CAPS_MIROTR, "MirOTRMenuCheckService" },
{ JABBER_EXT_NEWGPG, JABBER_CAPS_NEWGPG, "/ExportGPGKeys" },
@@ -96,17 +99,19 @@ const JabberFeatCapPairExt g_JabberFeatCapPairsExt[] = {
{ szCoreVersion, JABBER_CAPS_MIRANDA_PARTIAL },
{ JABBER_EXT_PLATFORMX86, JABBER_CAPS_PLATFORMX86 },
{ JABBER_EXT_PLATFORMX64, JABBER_CAPS_PLATFORMX64 },
- { nullptr }
};
+const int g_cJabberFeatCapPairsExt = _countof(g_JabberFeatCapPairsExt);
+
void CJabberProto::AddDefaultCaps()
{
JabberCapsBits myCaps = JABBER_CAPS_MIRANDA_ALL;
if (m_bUseOMEMO)
myCaps |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
- for (int i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++)
- if (g_JabberFeatCapPairsExt[i].Valid())
- myCaps |= g_JabberFeatCapPairsExt[i].jcbCap;
+
+ for (auto &it : g_JabberFeatCapPairsExt)
+ if (it.Valid())
+ myCaps |= it.jcbCap;
wchar_t szOsBuffer[256]; szOsBuffer[0] = 0;
GetOSDisplayString(szOsBuffer, _countof(szOsBuffer));
@@ -115,7 +120,7 @@ void CJabberProto::AddDefaultCaps()
pCaps->m_szOs = mir_wstrdup(L"Microsoft Windows");
pCaps->m_szOsVer = mir_wstrdup(szOsBuffer);
pCaps->m_szSoft = mir_wstrdup(L"Miranda NG Jabber Protocol");
- pCaps->m_szSoftMir = mir_wstrdup(szCoreVersion);
+ pCaps->m_szSoftMir = mir_wstrdup(szCoreVersion);
}
void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
@@ -134,9 +139,9 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
if (!featureName)
continue;
- for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
- jcbCaps |= g_JabberFeatCapPairs[j].jcbCap;
+ for (auto &it : g_JabberFeatCapPairs) {
+ if (!mir_wstrcmp(it.szFeature, featureName)) {
+ jcbCaps |= it.jcbCap;
break;
}
}
@@ -172,7 +177,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
root.push_back(JSONNode("sv", _T2A(pCaps->m_szSoftVer).get()));
if (pCaps->m_szSoftMir = mir_wstrdup(XPath(xform, L"field[@var='x-miranda-core-version']/value")))
root.push_back(JSONNode("sm", _T2A(pCaps->m_szSoftMir).get()));
- root.push_back(JSONNode("c", CMStringA(FORMAT, "%lld", jcbCaps)));
+ root.push_back(JSONNode("c", CMStringA(FORMAT, "%lld", jcbCaps)));
CMStringA szName(FORMAT, "%S#%S", pCaps->GetNode(), pCaps->GetHash());
json_string szValue = root.write();
@@ -297,7 +302,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilities(const wchar_t *jid, pResour
}
// no XEP-0115: send query each time it's needed
- switch(r->m_dwDiscoInfoRequestTime) {
+ switch (r->m_dwDiscoInfoRequestTime) {
case -1:
return r->m_jcbCachedCaps;
@@ -476,9 +481,9 @@ void CJabberClientCapsManager::UpdateFeatHash()
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);
- for (int i = 0; g_JabberFeatCapPairs[i].szFeature; i++)
- if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
- feat_buf.Append(_T2A(g_JabberFeatCapPairs[i].szFeature));
+ for (auto &it : g_JabberFeatCapPairs)
+ if (jcb & it.jcbCap) {
+ feat_buf.Append(_T2A(it.szFeature));
feat_buf.AppendChar('<');
}
@@ -493,8 +498,8 @@ void CJabberClientCapsManager::UpdateFeatHash()
feat_buf.Append("software_version"); feat_buf.AppendChar('<');
feat_buf.Append(__VERSION_STRING_DOTS); feat_buf.AppendChar('<');
-
- feat_buf.Append("x-miranda-core-version"); feat_buf.AppendChar('<');
+
+ feat_buf.Append("x-miranda-core-version"); feat_buf.AppendChar('<');
feat_buf.Append(_T2A(szCoreVersion)); feat_buf.AppendChar('<');
BYTE hash[MIR_SHA1_HASH_SIZE];
@@ -546,7 +551,7 @@ CJabberClientPartialCaps* CJabberClientCapsManager::SetClientCaps(const wchar_t
pClient = new CJabberClientCaps(szNode);
m_arCaps.insert(pClient);
}
-
+
CJabberClientPartialCaps *res = pClient->SetPartialCaps(szHash, szVer, jcbCaps, nIqId);
lck.unlock();
ppro->debugLogW(L"CAPS: set caps %I64x for: %s#%s => [%s]", jcbCaps, szHash, szNode, szVer);
@@ -565,14 +570,15 @@ bool CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
goto LBL_All;
}
- for (int i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++) {
- if (!g_JabberFeatCapPairsExt[i].Valid())
+ for (auto &it : g_JabberFeatCapPairsExt) {
+ if (!it.Valid())
continue;
+
// TODO: something better here
- mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ mir_snwprintf(szExtCap, L"%s#%s", JABBER_CAPS_MIRANDA_NODE, it.szFeature);
mir_snwprintf(szExtCapWHash, L"%s %s", szExtCap, m_szFeaturesCrc.c_str());
if (!mir_wstrcmp(szNode, szExtCap) || !mir_wstrcmp(szNode, szExtCapWHash)) {
- jcb = g_JabberFeatCapPairsExt[i].jcbCap;
+ jcb = it.jcbCap;
break;
}
}
@@ -614,9 +620,9 @@ LBL_All:
CMStringW szName(FORMAT, L"Miranda %d.%d.%d.%d", __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM);
query << XCHILD(L"identity") << XATTR(L"category", L"client") << XATTR(L"type", L"pc") << XATTR(L"name", szName);
- for (int i=0; g_JabberFeatCapPairs[i].szFeature; i++)
- if (jcb & g_JabberFeatCapPairs[i].jcbCap)
- query << XCHILD(L"feature") << XATTR(L"var", g_JabberFeatCapPairs[i].szFeature);
+ for (auto &it : g_JabberFeatCapPairs)
+ if (jcb & it.jcbCap)
+ query << XCHILD(L"feature") << XATTR(L"var", it.szFeature);
for (auto &it : ppro->m_lstJabberFeatCapPairsDynamic)
if (jcb & it->jcbCap)
@@ -628,8 +634,7 @@ LBL_All:
<< XCHILD(L"value", L"urn:xmpp:dataforms:softwareinfo");
CJabberClientPartialCaps *pCaps = GetPartialCaps(JABBER_CAPS_MIRANDA_NODE, m_szFeaturesCrc);
- if (pCaps)
- {
+ if (pCaps) {
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 93c12a2d2e..8fdcecd32c 100755
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -328,7 +328,10 @@ struct JabberFeatCapPairDynamic
wchar_t *szDescription;
};
-extern const JabberFeatCapPair g_JabberFeatCapPairs[];
+extern const int g_cJabberFeatCapPairs;
+extern const JabberFeatCapPair g_JabberFeatCapPairs[];
+
+extern const int g_cJabberFeatCapPairsExt;
extern const JabberFeatCapPairExt g_JabberFeatCapPairsExt[];
#endif
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 43b43e4869..aa1b88da39 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -279,9 +279,9 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo)
SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0);
- for (int i=0; g_JabberFeatCapPairs[i].szFeature; i++)
+ for (int i = 0; i < g_cJabberFeatCapPairs; i++)
SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairs[i].szFeature);
- for (int i=0; g_JabberFeatCapPairsExt[i].szFeature; i++)
+ for (int i = 0; i < g_cJabberFeatCapPairsExt; i++)
SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairsExt[i].szFeature);
LISTFOREACH(i, ppro, LIST_ROSTER)
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index f8bf39701c..19ec2768fc 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -50,7 +50,7 @@ void CJabberProto::OnContactDeleted(MCONTACT hContact)
}
// Remove from roster, server also handles the presence unsubscription process.
- m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext())
+ m_ThreadInfo->send(XmlNodeIq(L"set", SerialNext())
<< XQUERY(JABBER_FEAT_IQ_ROSTER) << XCHILD(L"item") << XATTR(L"jid", jid) << XATTR(L"subscription", L"remove"));
ListRemove(LIST_ROSTER, jid);
@@ -108,7 +108,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, MCONTACT hC
void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT hContact)
{
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW( getWStringA(hContact, "jid")));
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrW(getWStringA(hContact, "jid")));
if (item == nullptr)
return;
@@ -119,7 +119,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, MCONTACT
return;
}
- ptrW newNick( sttSettingToTchar(cws));
+ ptrW newNick(sttSettingToTchar(cws));
if (newNick && mir_wstrcmp(item->nick, newNick)) {
debugLogW(L"Renaming contact %s: %s -> %s", item->jid, item->nick, newNick);
AddContactToRoster(item->jid, newNick, item->group);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index bef07afdb5..d35c237be9 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -397,12 +397,13 @@ void JabberFormLayoutControls(HWND hwndStatic, TJabberFormLayoutInfo *layout_inf
for (auto &it : *controls) {
if (it->hLabel)
SetWindowPos(it->hLabel, nullptr,
- layout_info->offset + it->ptLabel.x, layout_info->y_pos + it->ptLabel.y, 0, 0,
- SWP_NOZORDER | SWP_NOSIZE);
+ layout_info->offset + it->ptLabel.x, layout_info->y_pos + it->ptLabel.y, 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE);
+
if (it->hCtrl)
SetWindowPos(it->hCtrl, nullptr,
- layout_info->offset + it->ptCtrl.x, layout_info->y_pos + it->ptCtrl.y, 0, 0,
- SWP_NOZORDER | SWP_NOSIZE);
+ layout_info->offset + it->ptCtrl.x, layout_info->y_pos + it->ptCtrl.y, 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE);
layout_info->y_pos += it->szBlock.cy;
layout_info->y_pos += layout_info->y_spacing;
@@ -652,7 +653,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
// an entry is selected
len = SendMessage(hCtrl, LB_GETTEXTLEN, j, 0);
- if ((str = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t))) != nullptr) {
+ if ((str = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t))) != nullptr) {
SendMessage(hCtrl, LB_GETTEXT, j, (LPARAM)str);
for (k = 0;; k++) {
o = XmlGetChild(n, k);
@@ -726,7 +727,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowText(hwndDlg, XmlGetText(n));
else
SetWindowText(hwndDlg, TranslateW(jfi->defTitle));
-
+
// Set instruction field
if (jfi->xNode != nullptr && (n = XmlGetChild(jfi->xNode, L"instructions")) != nullptr && XmlGetText(n) != nullptr)
JabberFormSetInstruction(hwndDlg, XmlGetText(n));
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index d91d7afdcb..108f091ff2 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -69,7 +69,7 @@ public:
}
};
-CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
+CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto) :
m_pItems(3, CJabberInfoFrameItem::cmp), m_compact(false)
{
m_proto = proto;
@@ -79,7 +79,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
CLISTFrame frame = { sizeof(frame) };
HWND hwndClist = g_clistApi.hwndContactList;
- frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_plugin.getInst(), this);
+ frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_plugin.getInst(), this);
frame.align = alBottom;
frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
frame.Flags = F_VISIBLE | F_LOCKED | F_NOBORDER | F_UNICODE;
@@ -132,9 +132,9 @@ void CJabberInfoFrame::InitClass()
if (bClassRegistered)
return;
- WNDCLASSEX wcx = {0};
+ WNDCLASSEX wcx = { 0 };
wcx.cbSize = sizeof(wcx);
- wcx.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
+ wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wcx.lpfnWndProc = GlobalWndProc;
wcx.hInstance = g_plugin.getInst();
wcx.lpszClassName = L"JabberInfoFrameClass";
@@ -201,8 +201,7 @@ LRESULT CJabberInfoFrame::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONUP:
{
POINT pt = { LOWORD(lParam), HIWORD(lParam) };
- if ((m_clickedItem >= 0) && (m_clickedItem < m_pItems.getCount()) && m_pItems[m_clickedItem].m_onEvent && PtInRect(&m_pItems[m_clickedItem].m_rcItem, pt))
- {
+ if ((m_clickedItem >= 0) && (m_clickedItem < m_pItems.getCount()) && m_pItems[m_clickedItem].m_onEvent && PtInRect(&m_pItems[m_clickedItem].m_rcItem, pt)) {
CJabberInfoFrame_Event evt;
evt.m_event = CJabberInfoFrame_Event::CLICK;
evt.m_pszName = m_pItems[m_clickedItem].m_pszName;
@@ -243,7 +242,7 @@ void CJabberInfoFrame::ReloadFonts()
DeleteObject(m_hfntTitle);
m_hfntTitle = CreateFontIndirect(&lfFont);
- m_clText = Font_GetW(L"Jabber", L"Frame text",&lfFont);
+ m_clText = Font_GetW(L"Jabber", L"Frame text", &lfFont);
DeleteObject(m_hfntText);
m_hfntText = CreateFontIndirect(&lfFont);
@@ -277,7 +276,7 @@ void CJabberInfoFrame::UpdateSize()
void CJabberInfoFrame::RemoveTooltip(int id)
{
- TOOLINFO ti = {0};
+ TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.hwnd = m_hwnd;
@@ -287,7 +286,7 @@ void CJabberInfoFrame::RemoveTooltip(int id)
void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText)
{
- TOOLINFO ti = {0};
+ TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.hwnd = m_hwnd;
@@ -306,7 +305,7 @@ void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText)
void CJabberInfoFrame::PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF fallback)
{
if (ServiceExists(MS_SKIN_DRAWGLYPH)) {
- SKINDRAWREQUEST rq = {0};
+ SKINDRAWREQUEST rq = { 0 };
rq.hDC = hdc;
rq.rcDestRect = *rc;
rq.rcClipRect = *rc;
@@ -345,13 +344,13 @@ void CJabberInfoFrame::PaintCompact(HDC hdc)
if (!it->m_bCompact) continue;
int depth = 0;
- for (char *p = it->m_pszName; p = strchr(p+1, '/'); ++depth) ;
+ for (char *p = it->m_pszName; p = strchr(p + 1, '/'); ++depth);
if (depth == 0) {
if (it->m_hIcolibIcon) {
HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
if (hIcon) {
- DrawIconEx(hdc, SZ_FRAMEPADDING, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
+ DrawIconEx(hdc, SZ_FRAMEPADDING, (rc.bottom - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(hIcon);
}
}
@@ -363,8 +362,8 @@ void CJabberInfoFrame::PaintCompact(HDC hdc)
if (it->m_hIcolibIcon) {
HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
if (hIcon) {
- SetRect(&it->m_rcItem, cx, (rc.bottom-cy_icon)/2, cx+cx_icon, (rc.bottom-cy_icon)/2+cy_icon);
- DrawIconEx(hdc, cx, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
+ SetRect(&it->m_rcItem, cx, (rc.bottom - cy_icon) / 2, cx + cx_icon, (rc.bottom - cy_icon) / 2 + cy_icon);
+ DrawIconEx(hdc, cx, (rc.bottom - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
cx -= cx_icon;
IcoLib_ReleaseIcon(hIcon);
@@ -400,14 +399,14 @@ void CJabberInfoFrame::PaintNormal(HDC hdc)
int cx = SZ_FRAMEPADDING;
int depth = 0;
- for (char *p = it->m_pszName; p = strchr(p+1, '/'); cx += cx_icon) ++depth;
+ for (char *p = it->m_pszName; p = strchr(p + 1, '/'); cx += cx_icon) ++depth;
SetRect(&it->m_rcItem, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
if (it->m_hIcolibIcon) {
HICON hIcon = IcoLib_GetIconByHandle(it->m_hIcolibIcon);
if (hIcon) {
- DrawIconEx(hdc, cx, cy + (line_height-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
+ DrawIconEx(hdc, cx, cy + (line_height - cy_icon) / 2, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL);
cx += cx_icon + SZ_ICONSPACING;
IcoLib_ReleaseIcon(hIcon);
@@ -418,7 +417,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc)
SetTextColor(hdc, depth ? m_clText : m_clTitle);
RECT rcText; SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
- DrawText(hdc, it->m_pszText, -1, &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, it->m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
RemoveTooltip(it->m_tooltipId);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 392d439f51..272059d159 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -393,7 +393,7 @@ protected:
wchar_t *m_jid;
bool OnInitDialog() override;
- void OnDestroy();
+ void OnDestroy();
void OnBtnOk(CCtrlButton*);
@@ -637,9 +637,9 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
else
sttRoomListAppend(GetDlgItem(m_hwnd, IDC_ROOM), RoomInfo::ROOM_FAIL,
- TranslateT("Jabber Error"),
- TranslateT("Please specify group chat directory first."),
- L"");
+ TranslateT("Jabber Error"),
+ TranslateT("Please specify group chat directory first."),
+ L"");
}
break;
}
@@ -730,10 +730,11 @@ struct JabberGroupchatChangeNicknameParam
JabberGroupchatChangeNicknameParam(CJabberProto* ppro_, const wchar_t *jid_) :
ppro(ppro_),
jid(mir_wstrdup(jid_))
- {}
+ {}
~JabberGroupchatChangeNicknameParam()
- { mir_free(jid);
+ {
+ mir_free(jid);
}
CJabberProto *ppro;
@@ -940,7 +941,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
// A new room just created by me
// Request room config
m_ThreadInfo->send(
- XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, item->jid))
<< XQUERY(JABBER_FEAT_MUC_OWNER));
}
}
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index 6c5bf322e7..35df3a8fe0 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -31,11 +31,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber_rc.h"
static int CompareIqs(const CJabberIqInfo *p1, const CJabberIqInfo *p2)
-{ return p1->GetPriority() - p2->GetPriority();
+{
+ return p1->GetPriority() - p2->GetPriority();
}
static int ComparePermanent(const CJabberIqPermanentInfo *p1, const CJabberIqPermanentInfo *p2)
-{ return p1->getPriority() - p2->getPriority();
+{
+ return p1->getPriority() - p2->getPriority();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -143,7 +145,7 @@ void CJabberIqManager::ExpirerThread()
while (!m_bExpirerThreadShutdownRequest) {
CJabberIqInfo *pInfo = DetachExpired();
if (!pInfo) {
- for (int i=0; !m_bExpirerThreadShutdownRequest && (i < 10); i++)
+ for (int i = 0; !m_bExpirerThreadShutdownRequest && (i < 10); i++)
Sleep(50);
// -1 thread :)
@@ -182,7 +184,7 @@ void CJabberIqManager::ExpireIq(int nIqId)
while (CJabberIqInfo *pInfo = DetachInfo(nIqId))
ExpireInfo(pInfo);
}
-
+
bool CJabberIqManager::ExpireByUserData(void *pUserData)
{
bool bRet = false;
@@ -261,7 +263,7 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode)
pInfo->m_nIqType = nIqType;
if (nIqType == JABBER_IQ_TYPE_RESULT) {
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_NODE)
- pInfo->m_pChildNode = XmlGetChild(pNode , 0);
+ pInfo->m_pChildNode = XmlGetChild(pNode, 0);
if (pInfo->m_pChildNode && (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_CHILD_TAG_NAME))
pInfo->m_szChildTagName = (wchar_t*)XmlGetName(pInfo->m_pChildNode);
@@ -283,7 +285,7 @@ bool CJabberIqManager::HandleIq(int nIqId, HXML pNode)
(ppro->*(pInfo->m_pHandler))(pNode, pInfo);
delete pInfo;
}
- while ((pInfo = DetachInfo(nIqId)) != nullptr);
+ while ((pInfo = DetachInfo(nIqId)) != nullptr);
return true;
}
@@ -307,7 +309,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode)
if (!(pInfo->m_nIqTypes & iqInfo.m_nIqType))
continue;
- HXML pFirstChild = XmlGetChild(pNode , 0);
+ HXML pFirstChild = XmlGetChild(pNode, 0);
if (!pFirstChild || !XmlGetName(pFirstChild))
return FALSE;
@@ -315,8 +317,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode)
const wchar_t *szXmlns = XmlGetAttrValue(pFirstChild, L"xmlns");
if ((!pInfo->m_szXmlns || (szXmlns && !mir_wstrcmp(pInfo->m_szXmlns, szXmlns))) &&
- (!pInfo->m_szTag || !mir_wstrcmp(pInfo->m_szTag, szTagName)))
- {
+ (!pInfo->m_szTag || !mir_wstrcmp(pInfo->m_szTag, szTagName))) {
// node suits handler criteria, call the handler
iqInfo.m_pChildNode = pFirstChild;
iqInfo.m_szChildTagName = (wchar_t*)szTagName;
@@ -345,7 +346,7 @@ bool CJabberIqManager::HandleIqPermanent(HXML pNode)
CJabberIqInfo* CJabberIqManager::DetachInfo()
{
mir_cslock lck(m_cs);
-
+
CJabberIqInfo *pInfo = m_arIqs[0];
if (pInfo)
m_arIqs.remove(0);
@@ -418,7 +419,7 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler(
// returns TRUE when pInfo found, or FALSE otherwise
bool CJabberIqManager::DeletePermanentHandler(CJabberIqPermanentInfo *pInfo)
-{
+{
mir_cslock lck(m_cs);
return m_arHandlers.remove(pInfo) == 1;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index af2f459959..b892d4b069 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -73,7 +73,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*)
if (!featureName)
continue;
- for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
+ for (int j = 0; j < g_cJabberFeatCapPairs; j++) {
if (!mir_wstrcmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index aaed20c1d3..64aeeecad4 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -294,7 +294,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
}
}
break;
-
+
case NM_CLICK:
{
NMLISTVIEW *nm = (NMLISTVIEW *)lParam;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 1a68e6914a..23b5b58816 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -388,7 +388,8 @@ LBL_FatalError:
info.close();
debugLogA("Thread ended, SSL connection failed");
goto LBL_FatalError;
- } }
+ }
+ }
// User may change status to OFFLINE while we are connecting above
if (m_iDesiredStatus != ID_STATUS_OFFLINE || info.bIsReg) {
@@ -422,10 +423,8 @@ LBL_FatalError:
int nSelRes = Netlib_Select(&nls);
if (nSelRes == -1) // error
break;
- else if (nSelRes == 0)
- {
- if (m_bSendKeepAlive)
- {
+ else if (nSelRes == 0) {
+ if (m_bSendKeepAlive) {
if (info.jabberServerCaps & JABBER_CAPS_PING) {
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, 0, -1, this);
pInfo->SetTimeout(m_iConnectionKeepAliveTimeout);
@@ -611,7 +610,8 @@ void CJabberProto::PerformAuthentication(ThreadData *info)
if (!auth->isValid()) {
delete auth;
auth = nullptr;
- } }
+ }
+ }
if (auth == nullptr && m_AuthMechs.isNtlmAvailable) {
m_AuthMechs.isNtlmAvailable = false;
@@ -619,7 +619,8 @@ void CJabberProto::PerformAuthentication(ThreadData *info)
if (!auth->isValid()) {
delete auth;
auth = nullptr;
- } }
+ }
+ }
if (auth == nullptr && m_AuthMechs.isKerberosAvailable) {
m_AuthMechs.isKerberosAvailable = false;
@@ -633,7 +634,9 @@ void CJabberProto::PerformAuthentication(ThreadData *info)
if (!request) {
delete auth;
auth = nullptr;
- } } }
+ }
+ }
+ }
if (auth == nullptr && m_AuthMechs.isScramAvailable) {
m_AuthMechs.isScramAvailable = false;
@@ -696,7 +699,8 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info)
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_bEnableZlib == TRUE) {
debugLogA("Server compression available");
@@ -711,7 +715,10 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info)
info->send(XmlNode(L"compress") << XATTR(L"xmlns", L"http://jabber.org/protocol/compress")
<< XCHILD(L"method", L"zlib"));
return;
- } } } }
+ }
+ }
+ }
+ }
if (!mir_wstrcmp(XmlGetName(n), L"mechanisms")) {
m_AuthMechs.isPlainAvailable = false;
@@ -764,8 +771,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info)
if (m_bEnableStreamMgmt && m_StrmMgmt.IsResumeIdPresent()) //resume should be done here
m_StrmMgmt.CheckState();
- else
- {
+ else {
// mechanisms are not defined.
if (info->auth) { //We are already logged-in
info->send(
@@ -1071,7 +1077,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
const wchar_t *from, *type = XmlGetAttrValue(node, L"type");
if ((from = XmlGetAttrValue(node, L"from")) == nullptr)
return;
-
+
const wchar_t *idStr = XmlGetAttrValue(node, L"id");
pResourceStatus pFromResource(ResourceInfoFromJID(from));
@@ -1079,7 +1085,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
if ((!type || mir_wstrcmpi(type, L"error")) && XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS)) {
info->send(
XmlNode(L"message") << XATTR(L"to", from) << XATTR(L"id", idStr)
- << XCHILDNS(L"received", JABBER_FEAT_MESSAGE_RECEIPTS) << XATTR(L"id", idStr));
+ << XCHILDNS(L"received", JABBER_FEAT_MESSAGE_RECEIPTS) << XATTR(L"id", idStr));
if (pFromResource)
pFromResource->m_jcbManualDiscoveredCaps |= JABBER_CAPS_MESSAGE_RECEIPTS;
@@ -1269,26 +1275,22 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
// parsing extensions
HXML xNode;
for (int i = 0; (xNode = XmlGetChild(node, i)) != nullptr; i++) {
- if (m_bUseOMEMO)
- {
- if ((xNode = XmlGetNthChild(node, L"encrypted", i + 1)) != nullptr)
- {
+ if (m_bUseOMEMO) {
+ if ((xNode = XmlGetNthChild(node, L"encrypted", i + 1)) != nullptr) {
const wchar_t *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns");
if (ptszXmlns == nullptr)
continue;
- if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OMEMO))
- {
+ if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OMEMO)) {
const wchar_t *jid = xmlGetAttrValue(node, L"from");
- if (jid)
- {
+ if (jid) {
if (!OmemoHandleMessage(xNode, (wchar_t*)jid, msgTime))
OmemoPutMessageToIncommingQueue(xNode, (wchar_t*)jid, msgTime);
return; //we do not want any additional processing
}
}
}
- }
+ }
if ((xNode = XmlGetNthChild(node, L"x", i + 1)) == nullptr)
continue;
@@ -1314,19 +1316,17 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
size_t len = 0;
wchar_t *tempstring = nullptr;
- if(!wcsstr(ptszText, prolog))
- {
+ if (!wcsstr(ptszText, prolog)) {
len = mir_wstrlen(prolog) + mir_wstrlen(prolog_newline) + mir_wstrlen(ptszText) + mir_wstrlen(epilog) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
mir_snwprintf(tempstring, len, L"%s%s%s%s", prolog, prolog_newline, ptszText, epilog);
}
- else
- {
+ else {
len = mir_wstrlen(ptszText) + 3;
tempstring = (wchar_t*)_alloca(sizeof(wchar_t)*len);
mir_snwprintf(tempstring, len, L"%s", ptszText);
}
-
+
szMessage = tempstring;
}
else if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
@@ -1415,7 +1415,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info)
HXML iNode = XmlGetNthChild(xNode, L"item", j);
if (iNode == nullptr)
break;
-
+
const wchar_t *action = XmlGetAttrValue(iNode, L"action");
const wchar_t *jid = XmlGetAttrValue(iNode, L"jid");
const wchar_t *nick = XmlGetAttrValue(iNode, L"name");
@@ -1570,7 +1570,7 @@ void CJabberProto::UpdateJidDbSettings(const wchar_t *jid)
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == nullptr)
return;
-
+
MCONTACT hContact = HContactFromJID(jid);
if (hContact == 0)
return;
@@ -1961,7 +1961,7 @@ void CJabberProto::OnProcessIq(HXML node)
XmlAddChild(iq, pFirstChild);
iq << XCHILD(L"error") << XATTR(L"type", L"cancel")
- << XCHILDNS(L"service-unavailable", L"urn:ietf:params:xml:ns:xmpp-stanzas");
+ << XCHILDNS(L"service-unavailable", L"urn:ietf:params:xml:ns:xmpp-stanzas");
m_ThreadInfo->send(iq);
}
}
@@ -1971,7 +1971,7 @@ void CJabberProto::SetRegConfig(HXML node, void *from)
{
if (m_regInfo) {
iqIdRegSetReg = SerialNext();
-
+
wchar_t text[MAX_PATH];
mir_snwprintf(text, L"%s@%S", m_regInfo->conn.username, m_regInfo->conn.server);
XmlNodeIq iq(L"set", iqIdRegSetReg, (const wchar_t*)from);
@@ -2071,10 +2071,10 @@ ThreadData::~ThreadData()
proto->m_ThreadInfo = nullptr;
delete auth;
-
+
mir_free(zRecvData);
mir_free(buffer);
-
+
CloseHandle(iomutex);
}
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp
index e701c79f60..73566e25c5 100644
--- a/protocols/JabberG/src/jabber_treelist.cpp
+++ b/protocols/JabberG/src/jabber_treelist.cpp
@@ -45,9 +45,11 @@ struct TTreeList_ItemInfo
LPARAM data;
LIST<TTreeList_ItemInfo> subItems;
- TTreeList_ItemInfo(int columns = 3, int children = 5):
+ TTreeList_ItemInfo(int columns = 3, int children = 5) :
text(columns), subItems(children), parent(nullptr),
- flags(0), indent(0), sortIndex(0), iIcon(0), iOverlay(0), data(0) {}
+ flags(0), indent(0), sortIndex(0), iIcon(0), iOverlay(0), data(0)
+ {
+ }
~TTreeList_ItemInfo()
{
for (auto &it : text)
@@ -124,7 +126,7 @@ void TreeList_Create(HWND hwnd)
{
TTreeList_Data *data = new TTreeList_Data;
data->root = new TTreeList_ItemInfo;
- data->root->flags = TLIF_EXPANDED|TLIF_VISIBLE|TLIF_ROOT;
+ data->root->flags = TLIF_EXPANDED | TLIF_VISIBLE | TLIF_ROOT;
data->root->indent = -1;
data->hItemSelected = data->root;
sttTreeList_SeWindowData(hwnd, data);
@@ -133,13 +135,13 @@ void TreeList_Create(HWND hwnd)
HIMAGELIST hIml;
hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1);
- ListView_SetImageList (hwnd, hIml, LVSIL_SMALL);
+ ListView_SetImageList(hwnd, hIml, LVSIL_SMALL);
hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1);
ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN));
ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT));
ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_OTHER_DOWNARROW));
- ListView_SetImageList (hwnd, hIml, LVSIL_STATE);
+ ListView_SetImageList(hwnd, hIml, LVSIL_STATE);
}
void TreeList_Destroy(HWND hwnd)
@@ -155,7 +157,7 @@ void TreeList_Reset(HWND hwnd)
TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
delete data->root;
data->root = new TTreeList_ItemInfo;
- data->root->flags = TLIF_EXPANDED|TLIF_VISIBLE|TLIF_ROOT;
+ data->root->flags = TLIF_EXPANDED | TLIF_VISIBLE | TLIF_ROOT;
data->root->indent = -1;
data->hItemSelected = data->root;
}
@@ -190,7 +192,7 @@ void TreeList_SetFilter(HWND hwnd, wchar_t *filter)
HTREELISTITEM TreeList_GetActiveItem(HWND hwnd)
{
TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM;
lvi.iItem = ListView_GetNextItem(hwnd, -1, LVNI_SELECTED);
if (lvi.iItem < 0)
@@ -261,7 +263,7 @@ void TreeList_SetIcon(HTREELISTITEM hItem, int iIcon, int iOverlay)
if ((iIcon >= 0) || (iOverlay >= 0)) hItem->flags |= TLIF_MODIFIED;
}
-void TreeList_RecursiveApply(HTREELISTITEM hItem, void (*func)(HTREELISTITEM, LPARAM), LPARAM data)
+void TreeList_RecursiveApply(HTREELISTITEM hItem, void(*func)(HTREELISTITEM, LPARAM), LPARAM data)
{
for (auto &it : hItem->subItems) {
func(it, data);
@@ -282,7 +284,7 @@ void TreeList_Update(HWND hwnd)
if (data->filter)
TreeList_RecursiveApply(hItem, sttTreeList_FilterItems, (LPARAM)data->filter);
for (int i = ListView_GetItemCount(hwnd); i--;) {
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM;
lvi.iItem = i;
lvi.iSubItem = 0;
@@ -296,19 +298,19 @@ void TreeList_Update(HWND hwnd)
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = ptli->text[0];
- lvi.stateMask = LVIS_OVERLAYMASK|LVIS_STATEIMAGEMASK;
+ lvi.stateMask = LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvi.iImage = ptli->iIcon;
if (data->mode == TLM_TREE)
lvi.state =
- INDEXTOSTATEIMAGEMASK(
- ((ptli->subItems.getCount() == 0) && !(ptli->flags & TLIF_FAKEPARENT)) ? 0 :
+ INDEXTOSTATEIMAGEMASK(
+ ((ptli->subItems.getCount() == 0) && !(ptli->flags & TLIF_FAKEPARENT)) ? 0 :
(ptli->flags & TLIF_EXPANDED) ? 1 : 2) |
- INDEXTOOVERLAYMASK(ptli->iOverlay);
+ INDEXTOOVERLAYMASK(ptli->iOverlay);
else
lvi.state =
- INDEXTOSTATEIMAGEMASK(
- ((ptli->subItems.getCount() == 0) && !(ptli->flags & TLIF_FAKEPARENT)) ? 0 : 3) |
- INDEXTOOVERLAYMASK(ptli->iOverlay);
+ INDEXTOSTATEIMAGEMASK(
+ ((ptli->subItems.getCount() == 0) && !(ptli->flags & TLIF_FAKEPARENT)) ? 0 : 3) |
+ INDEXTOOVERLAYMASK(ptli->iOverlay);
ListView_SetItem(hwnd, &lvi);
for (int j = 1; j < ptli->text.getCount(); ++j)
@@ -322,7 +324,7 @@ void TreeList_Update(HWND hwnd)
else {
for (auto &it : data->hItemSelected->subItems)
sttTreeList_CreateItems_List(it, (LPARAM)hwnd);
-
+
for (HTREELISTITEM p = data->hItemSelected; !(p->flags & TLIF_ROOT); p = p->parent)
sttTreeList_CreateItems_List(p, (LPARAM)hwnd);
}
@@ -333,136 +335,137 @@ void TreeList_Update(HWND hwnd)
BOOL TreeList_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, UINT idc, BOOL*)
{
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
switch (msg) {
case WM_NOTIFY:
- {
- if (((LPNMHDR)lparam)->idFrom != idc)
- break;
-
- TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(GetDlgItem(hwnd, idc));
- switch (((LPNMHDR)lparam)->code) {
- case LVN_COLUMNCLICK:
- {
- LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lparam;
- TreeList_SetSortMode(lpnmlv->hdr.hwndFrom, lpnmlv->iSubItem, FALSE);
- }
- break;
+ {
+ if (((LPNMHDR)lparam)->idFrom != idc)
+ break;
- case LVN_ITEMACTIVATE:
- if (data->mode == TLM_REPORT) {
- LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lparam;
- lvi.mask = LVIF_PARAM;
- lvi.iItem = lpnmia->iItem;
- ListView_GetItem(lpnmia->hdr.hwndFrom, &lvi);
-
- HTREELISTITEM hItem = (lvi.iItem < 0) ? data-> root : (HTREELISTITEM)lvi.lParam;
- if (!hItem->subItems.getCount() && !(hItem->flags & TLIF_FAKEPARENT)) break;
- data->hItemSelected = hItem;
-
- NMTREEVIEW nmtv;
- nmtv.hdr.code = TVN_ITEMEXPANDED;
- nmtv.hdr.hwndFrom = lpnmia->hdr.hwndFrom;
- nmtv.hdr.idFrom = lpnmia->hdr.idFrom;
- nmtv.itemNew.hItem = (HTREEITEM)lvi.lParam;
- SendMessage(hwnd, WM_NOTIFY, lpnmia->hdr.idFrom, (LPARAM)&nmtv);
-
- ListView_DeleteAllItems(lpnmia->hdr.hwndFrom);
- TreeList_Update(lpnmia->hdr.hwndFrom);
- }
- break;
-
- case LVN_KEYDOWN:
- if (data->mode == TLM_TREE) {
- LPNMLVKEYDOWN lpnmlvk = (LPNMLVKEYDOWN)lparam;
-
- lvi.mask = LVIF_PARAM|LVIF_INDENT;
- lvi.iItem = ListView_GetNextItem(lpnmlvk->hdr.hwndFrom, -1, LVNI_SELECTED);
- if (lvi.iItem < 0) return FALSE;
- lvi.iSubItem = 0;
- ListView_GetItem(lpnmlvk->hdr.hwndFrom, &lvi);
- HTREELISTITEM hItem = (HTREELISTITEM)lvi.lParam;
-
- switch (lpnmlvk->wVKey) {
- case VK_SUBTRACT:
- case VK_LEFT:
+ TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(GetDlgItem(hwnd, idc));
+ switch (((LPNMHDR)lparam)->code) {
+ case LVN_COLUMNCLICK:
{
- if (hItem->subItems.getCount() && (hItem->flags & TLIF_EXPANDED)) {
- hItem->flags &= ~TLIF_EXPANDED;
- hItem->flags |= TLIF_MODIFIED;
- TreeList_Update(lpnmlvk->hdr.hwndFrom);
- }
- else if (hItem->indent && (lpnmlvk->wVKey != VK_SUBTRACT)) {
- for (int i = lvi.iItem; i--;) {
- lvi.mask = LVIF_INDENT;
- lvi.iItem = i;
- lvi.iSubItem = 0;
- ListView_GetItem(lpnmlvk->hdr.hwndFrom, &lvi);
- if (lvi.iIndent < hItem->indent) {
- lvi.mask = LVIF_STATE;
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lparam;
+ TreeList_SetSortMode(lpnmlv->hdr.hwndFrom, lpnmlv->iSubItem, FALSE);
+ }
+ break;
+
+ case LVN_ITEMACTIVATE:
+ if (data->mode == TLM_REPORT) {
+ LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lparam;
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = lpnmia->iItem;
+ ListView_GetItem(lpnmia->hdr.hwndFrom, &lvi);
+
+ HTREELISTITEM hItem = (lvi.iItem < 0) ? data->root : (HTREELISTITEM)lvi.lParam;
+ if (!hItem->subItems.getCount() && !(hItem->flags & TLIF_FAKEPARENT)) break;
+ data->hItemSelected = hItem;
+
+ NMTREEVIEW nmtv;
+ nmtv.hdr.code = TVN_ITEMEXPANDED;
+ nmtv.hdr.hwndFrom = lpnmia->hdr.hwndFrom;
+ nmtv.hdr.idFrom = lpnmia->hdr.idFrom;
+ nmtv.itemNew.hItem = (HTREEITEM)lvi.lParam;
+ SendMessage(hwnd, WM_NOTIFY, lpnmia->hdr.idFrom, (LPARAM)&nmtv);
+
+ ListView_DeleteAllItems(lpnmia->hdr.hwndFrom);
+ TreeList_Update(lpnmia->hdr.hwndFrom);
+ }
+ break;
+
+ case LVN_KEYDOWN:
+ if (data->mode == TLM_TREE) {
+ LPNMLVKEYDOWN lpnmlvk = (LPNMLVKEYDOWN)lparam;
+
+ lvi.mask = LVIF_PARAM | LVIF_INDENT;
+ lvi.iItem = ListView_GetNextItem(lpnmlvk->hdr.hwndFrom, -1, LVNI_SELECTED);
+ if (lvi.iItem < 0) return FALSE;
+ lvi.iSubItem = 0;
+ ListView_GetItem(lpnmlvk->hdr.hwndFrom, &lvi);
+ HTREELISTITEM hItem = (HTREELISTITEM)lvi.lParam;
+
+ switch (lpnmlvk->wVKey) {
+ case VK_SUBTRACT:
+ case VK_LEFT:
+ if (hItem->subItems.getCount() && (hItem->flags & TLIF_EXPANDED)) {
+ hItem->flags &= ~TLIF_EXPANDED;
+ hItem->flags |= TLIF_MODIFIED;
+ TreeList_Update(lpnmlvk->hdr.hwndFrom);
+ }
+ else if (hItem->indent && (lpnmlvk->wVKey != VK_SUBTRACT)) {
+ for (int i = lvi.iItem; i--;) {
+ lvi.mask = LVIF_INDENT;
lvi.iItem = i;
lvi.iSubItem = 0;
- lvi.state = lvi.stateMask = LVIS_FOCUSED|LVNI_SELECTED;
- ListView_SetItem(lpnmlvk->hdr.hwndFrom, &lvi);
- break;
- } } }
- break;
- }
-
- case VK_ADD:
- case VK_RIGHT:
- if ((hItem->subItems.getCount() || (hItem->flags & TLIF_FAKEPARENT)) &&
- !(hItem->flags & TLIF_EXPANDED))
- {
- hItem->flags |= TLIF_EXPANDED;
- hItem->flags |= TLIF_MODIFIED;
-
- NMTREEVIEW nmtv;
- nmtv.hdr.code = TVN_ITEMEXPANDED;
- nmtv.hdr.hwndFrom = lpnmlvk->hdr.hwndFrom;
- nmtv.hdr.idFrom = lpnmlvk->hdr.idFrom;
- nmtv.itemNew.hItem = (HTREEITEM)hItem;
- SendMessage(hwnd, WM_NOTIFY, lpnmlvk->hdr.idFrom, (LPARAM)&nmtv);
- TreeList_Update(lpnmlvk->hdr.hwndFrom);
+ ListView_GetItem(lpnmlvk->hdr.hwndFrom, &lvi);
+ if (lvi.iIndent < hItem->indent) {
+ lvi.mask = LVIF_STATE;
+ lvi.iItem = i;
+ lvi.iSubItem = 0;
+ lvi.state = lvi.stateMask = LVIS_FOCUSED | LVNI_SELECTED;
+ ListView_SetItem(lpnmlvk->hdr.hwndFrom, &lvi);
+ break;
+ }
+ }
+ }
+ break;
+
+ case VK_ADD:
+ case VK_RIGHT:
+ if ((hItem->subItems.getCount() || (hItem->flags & TLIF_FAKEPARENT)) &&
+ !(hItem->flags & TLIF_EXPANDED)) {
+ hItem->flags |= TLIF_EXPANDED;
+ hItem->flags |= TLIF_MODIFIED;
+
+ NMTREEVIEW nmtv;
+ nmtv.hdr.code = TVN_ITEMEXPANDED;
+ nmtv.hdr.hwndFrom = lpnmlvk->hdr.hwndFrom;
+ nmtv.hdr.idFrom = lpnmlvk->hdr.idFrom;
+ nmtv.itemNew.hItem = (HTREEITEM)hItem;
+ SendMessage(hwnd, WM_NOTIFY, lpnmlvk->hdr.idFrom, (LPARAM)&nmtv);
+ TreeList_Update(lpnmlvk->hdr.hwndFrom);
+ }
+ break;
}
- break;
- } }
- break;
-
- case NM_CLICK:
- if (data->mode == TLM_TREE) {
- LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lparam;
- LVHITTESTINFO lvhti = {0};
- lvi.mask = LVIF_PARAM;
- lvi.iItem = lpnmia->iItem;
- ListView_GetItem(lpnmia->hdr.hwndFrom, &lvi);
- lvhti.pt = lpnmia->ptAction;
- ListView_HitTest(lpnmia->hdr.hwndFrom, &lvhti);
-
- HTREELISTITEM ptli = (HTREELISTITEM)lvi.lParam;
- if ((lvhti.iSubItem == 0) && ((lvhti.flags&LVHT_ONITEM) == LVHT_ONITEMSTATEICON) &&
- (ptli->subItems.getCount() || ptli->flags & TLIF_FAKEPARENT))
- {
- if (ptli->flags & TLIF_EXPANDED)
- ptli->flags &= ~TLIF_EXPANDED;
- else {
- ptli->flags |= TLIF_EXPANDED;
-
- NMTREEVIEW nmtv;
- nmtv.hdr.code = TVN_ITEMEXPANDED;
- nmtv.hdr.hwndFrom = lpnmia->hdr.hwndFrom;
- nmtv.hdr.idFrom = lpnmia->hdr.idFrom;
- nmtv.itemNew.hItem = (HTREEITEM)lvi.lParam;
- SendMessage(hwnd, WM_NOTIFY, lpnmia->hdr.idFrom, (LPARAM)&nmtv);
+ }
+ break;
+
+ case NM_CLICK:
+ if (data->mode == TLM_TREE) {
+ LPNMITEMACTIVATE lpnmia = (LPNMITEMACTIVATE)lparam;
+ LVHITTESTINFO lvhti = { 0 };
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = lpnmia->iItem;
+ ListView_GetItem(lpnmia->hdr.hwndFrom, &lvi);
+ lvhti.pt = lpnmia->ptAction;
+ ListView_HitTest(lpnmia->hdr.hwndFrom, &lvhti);
+
+ HTREELISTITEM ptli = (HTREELISTITEM)lvi.lParam;
+ if ((lvhti.iSubItem == 0) && ((lvhti.flags&LVHT_ONITEM) == LVHT_ONITEMSTATEICON) &&
+ (ptli->subItems.getCount() || ptli->flags & TLIF_FAKEPARENT)) {
+ if (ptli->flags & TLIF_EXPANDED)
+ ptli->flags &= ~TLIF_EXPANDED;
+ else {
+ ptli->flags |= TLIF_EXPANDED;
+
+ NMTREEVIEW nmtv;
+ nmtv.hdr.code = TVN_ITEMEXPANDED;
+ nmtv.hdr.hwndFrom = lpnmia->hdr.hwndFrom;
+ nmtv.hdr.idFrom = lpnmia->hdr.idFrom;
+ nmtv.itemNew.hItem = (HTREEITEM)lvi.lParam;
+ SendMessage(hwnd, WM_NOTIFY, lpnmia->hdr.idFrom, (LPARAM)&nmtv);
+ }
+ ptli->flags |= TLIF_MODIFIED;
+ TreeList_Update(lpnmia->hdr.hwndFrom);
}
- ptli->flags |= TLIF_MODIFIED;
- TreeList_Update(lpnmia->hdr.hwndFrom);
- } }
+ }
+ break;
+ }
break;
}
- break;
- } }
+ }
return FALSE;
}
@@ -478,7 +481,7 @@ static void sttTreeList_SortItems(HTREELISTITEM hItem, LPARAM data)
{
if (!hItem->subItems.getCount()) return;
- typedef int (__cdecl *TQSortCmp)(const void *, const void *);
+ typedef int(__cdecl *TQSortCmp)(const void *, const void *);
static TQSortCmp funcs[] =
{
sttTreeList_SortItems_Cmp0,
@@ -488,7 +491,7 @@ static void sttTreeList_SortItems(HTREELISTITEM hItem, LPARAM data)
sttTreeList_SortItems_Cmp4,
sttTreeList_SortItems_Cmp5,
};
- qsort(((SortedList *)&hItem->subItems)->items, hItem->subItems.getCount(), sizeof(void*), funcs[data-1]);
+ qsort(((SortedList *)&hItem->subItems)->items, hItem->subItems.getCount(), sizeof(void*), funcs[data - 1]);
}
static void sttTreeList_ResetIndex(HTREELISTITEM hItem, LPARAM data)
@@ -506,7 +509,7 @@ static void sttTreeList_ResetIndex(HTREELISTITEM hItem, LPARAM data)
static void sttTreeList_FilterItems(HTREELISTITEM hItem, LPARAM data)
{
int i;
- for (i=0; i < hItem->text.getCount(); i++)
+ for (i = 0; i < hItem->text.getCount(); i++)
if (JabberStrIStr(hItem->text[i], (wchar_t *)data))
break;
@@ -523,44 +526,46 @@ static void sttTreeList_CreateItems(HTREELISTITEM hItem, LPARAM data)
{
TTreeList_Data *listData = (TTreeList_Data *)sttTreeList_GeWindowData((HWND)data);
if ((hItem->flags & TLIF_VISIBLE) && (!listData->filter || (hItem->flags & TLIF_FILTERED)) && !(hItem->flags & TLIF_HASITEM) && !(hItem->flags & TLIF_ROOT)) {
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_INDENT | LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT | LVIF_STATE;
lvi.iIndent = hItem->indent;
lvi.lParam = (LPARAM)hItem;
lvi.pszText = hItem->text[0];
- lvi.stateMask = LVIS_OVERLAYMASK|LVIS_STATEIMAGEMASK;
+ lvi.stateMask = LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvi.iImage = hItem->iIcon;
lvi.state =
INDEXTOSTATEIMAGEMASK(
- ((hItem->subItems.getCount() == 0) && !(hItem->flags & TLIF_FAKEPARENT)) ? 0 :
- (hItem->flags & TLIF_EXPANDED) ? 1 : 2) |
+ ((hItem->subItems.getCount() == 0) && !(hItem->flags & TLIF_FAKEPARENT)) ? 0 :
+ (hItem->flags & TLIF_EXPANDED) ? 1 : 2) |
INDEXTOOVERLAYMASK(hItem->iOverlay);
int idx = ListView_InsertItem((HWND)data, &lvi);
for (int i = 1; i < hItem->text.getCount(); i++)
ListView_SetItemText((HWND)data, idx, i, hItem->text[i]);
-} }
+ }
+}
static void sttTreeList_CreateItems_List(HTREELISTITEM hItem, LPARAM data)
{
TTreeList_Data *listData = (TTreeList_Data *)sttTreeList_GeWindowData((HWND)data);
if ((!listData->filter || (hItem->flags & TLIF_FILTERED)) && !(hItem->flags & TLIF_HASITEM) && !(hItem->flags & TLIF_ROOT)) {
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_INDENT | LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT | LVIF_STATE;
lvi.iIndent = hItem->indent;
lvi.lParam = (LPARAM)hItem;
lvi.pszText = hItem->text[0];
- lvi.stateMask = LVIS_OVERLAYMASK|LVIS_STATEIMAGEMASK;
+ lvi.stateMask = LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvi.iImage = hItem->iIcon;
lvi.state =
INDEXTOSTATEIMAGEMASK(
- ((hItem->subItems.getCount() == 0) && !(hItem->flags & TLIF_FAKEPARENT)) ? 0 : 3) |
+ ((hItem->subItems.getCount() == 0) && !(hItem->flags & TLIF_FAKEPARENT)) ? 0 : 3) |
INDEXTOOVERLAYMASK(hItem->iOverlay);
int idx = ListView_InsertItem((HWND)data, &lvi);
for (int i = 1; i < hItem->text.getCount(); i++)
ListView_SetItemText((HWND)data, idx, i, hItem->text[i]);
-} }
+ }
+}
static int CALLBACK sttTreeList_SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM)
{
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 354ef9d9c4..7284156684 100755
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -282,7 +282,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) {
HTREEITEM htiCaps = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), nullptr, TranslateT("Client capabilities"), sttInfoLineId(resource, INFOLINE_CAPS));
int i;
- for (i = 0; g_JabberFeatCapPairs[i].szFeature; i++)
+ for (i = 0; i < g_cJabberFeatCapPairs; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap) {
wchar_t szDescription[1024];
if (g_JabberFeatCapPairs[i].tszDescription)