summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-10 13:49:11 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-10 13:49:11 +0000
commit73efaa00c6044d77a6c098bec38057b231ef8243 (patch)
tree07237735ddf83c6cb011188b6c4b067bdcd6b5e3 /protocols/JabberG/src
parent183f4dfbadce9c687c66e5377274a464f6c9a72f (diff)
Jabber:
- these long static buffers replaced with CMString; - some crazy memory allocations in chats also replaced with CMString; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7577 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r--protocols/JabberG/src/jabber.h3
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp181
-rw-r--r--protocols/JabberG/src/jabber_agent.cpp12
-rw-r--r--protocols/JabberG/src/jabber_api.cpp22
-rw-r--r--protocols/JabberG/src/jabber_archive.cpp6
-rw-r--r--protocols/JabberG/src/jabber_bookmarks.cpp20
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp8
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp56
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp129
-rw-r--r--protocols/JabberG/src/jabber_console.cpp391
-rw-r--r--protocols/JabberG/src/jabber_disco.cpp70
-rw-r--r--protocols/JabberG/src/jabber_disco.h18
-rw-r--r--protocols/JabberG/src/jabber_events.cpp10
-rw-r--r--protocols/JabberG/src/jabber_file.cpp6
-rw-r--r--protocols/JabberG/src/jabber_form.cpp56
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp20
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp34
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp37
-rw-r--r--protocols/JabberG/src/jabber_ibb.cpp8
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp14
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp32
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp56
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp118
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp36
-rw-r--r--protocols/JabberG/src/jabber_libstr.cpp6
-rw-r--r--protocols/JabberG/src/jabber_list.cpp6
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp37
-rw-r--r--protocols/JabberG/src/jabber_message_manager.cpp14
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp51
-rw-r--r--protocols/JabberG/src/jabber_notes.cpp26
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp112
-rw-r--r--protocols/JabberG/src/jabber_opttree.cpp6
-rw-r--r--protocols/JabberG/src/jabber_presence_manager.cpp17
-rw-r--r--protocols/JabberG/src/jabber_presence_manager.h64
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp78
-rw-r--r--protocols/JabberG/src/jabber_privacy.h14
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp46
-rw-r--r--protocols/JabberG/src/jabber_proto.h16
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp56
-rw-r--r--protocols/JabberG/src/jabber_rc.h14
-rw-r--r--protocols/JabberG/src/jabber_search.cpp36
-rw-r--r--protocols/JabberG/src/jabber_search.h4
-rw-r--r--protocols/JabberG/src/jabber_secur.cpp16
-rw-r--r--protocols/JabberG/src/jabber_send_manager.cpp17
-rw-r--r--protocols/JabberG/src/jabber_send_manager.h63
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp42
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp188
-rw-r--r--protocols/JabberG/src/jabber_treelist.cpp8
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp34
-rw-r--r--protocols/JabberG/src/jabber_util.cpp212
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp22
-rw-r--r--protocols/JabberG/src/jabber_xml.cpp12
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp64
-rw-r--r--protocols/JabberG/src/jabber_xstatus.h2
-rw-r--r--protocols/JabberG/src/ui_utils.cpp22
55 files changed, 1234 insertions, 1414 deletions
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 67946feb74..debcb70949 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -670,7 +670,6 @@ int g_OnToolbarInit(WPARAM, LPARAM);
void JabberChatDllError(void);
int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2);
-TCHAR* EscapeChatTags(TCHAR* pszText);
TCHAR* UnEscapeChatTags(TCHAR* str_in);
//---- jabber_adhoc.cpp ---------------------------------------------
@@ -750,7 +749,7 @@ time_t str2time(const TCHAR*);
#define JabberUnixToDosT JabberUnixToDosW
const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr);
-void JabberCopyText(HWND hwnd, TCHAR *text);
+void JabberCopyText(HWND hwnd, const TCHAR *text);
CJabberProto *JabberChooseInstance(bool bIsLink=false);
bool JabberReadXep203delay(HXML node, time_t &msgTime);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index 9a296dca4f..1f4f55acf7 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -62,13 +62,13 @@ static BOOL CALLBACK sttDeleteChildWindowsProc(HWND hwnd, LPARAM)
static void sttEnableControls(HWND hwndDlg, BOOL bEnable, const int *controlsID)
{
- for (int i=0; controlsID[i] != 0; i++)
+ for (int i = 0; controlsID[i] != 0; i++)
EnableDlgItem(hwndDlg, controlsID[i], bEnable);
}
static void sttShowControls(HWND hwndDlg, BOOL bShow, int *controlsID)
{
- for (int i=0; controlsID[i] != 0; i++)
+ for (int i = 0; controlsID[i] != 0; i++)
ShowDlgItem(hwndDlg, controlsID[i], (bShow) ? SW_SHOW : SW_HIDE);
}
@@ -81,15 +81,15 @@ static void JabberAdHoc_RefreshFrameScroll(HWND hwndDlg, JabberAdHocData * dat)
GetClientRect(hFrame, &rc);
GetClientRect(hFrame, &dat->frameRect);
GetWindowRect(hwndScroll, &rcScrollRc);
- dat->frameRect.right-=(rcScrollRc.right-rcScrollRc.left);
- dat->frameHeight = rc.bottom-rc.top;
+ dat->frameRect.right -= (rcScrollRc.right - rcScrollRc.left);
+ dat->frameHeight = rc.bottom - rc.top;
if (dat->frameHeight < dat->CurrentHeight) {
ShowWindow(hwndScroll, SW_SHOW);
EnableWindow(hwndScroll, TRUE);
}
else ShowWindow(hwndScroll, SW_HIDE);
- SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight-dat->frameHeight, FALSE);
+ SetScrollRange(hwndScroll, SB_CTL, 0, dat->CurrentHeight - dat->frameHeight, FALSE);
}
//////////////////////////////////////////////////////////////////////////
@@ -98,36 +98,36 @@ static void JabberAdHoc_RefreshFrameScroll(HWND hwndDlg, JabberAdHocData * dat)
void CJabberProto::OnIqResult_ListOfCommands(HXML iqNode, CJabberIqInfo *pInfo)
{
- SendMessage( GetWindowFromIq(pInfo), JAHM_COMMANDLISTRESULT, 0, (LPARAM)xi.copyNode(iqNode));
+ SendMessage(GetWindowFromIq(pInfo), JAHM_COMMANDLISTRESULT, 0, (LPARAM)xi.copyNode(iqNode));
}
void CJabberProto::OnIqResult_CommandExecution(HXML iqNode, CJabberIqInfo *pInfo)
{
- SendMessage( GetWindowFromIq(pInfo), JAHM_PROCESSRESULT, (WPARAM)xi.copyNode(iqNode), 0);
+ SendMessage(GetWindowFromIq(pInfo), JAHM_PROCESSRESULT, (WPARAM)xi.copyNode(iqNode), 0);
}
void CJabberProto::AdHoc_RequestListOfCommands(TCHAR * szResponder, HWND hwndDlg)
{
- m_ThreadInfo->send( XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetCollectionList, JABBER_IQ_TYPE_GET, szResponder, 0, -1, hwndDlg))
+ m_ThreadInfo->send(XmlNodeIq(AddIQ(&CJabberProto::OnIqResultGetCollectionList, JABBER_IQ_TYPE_GET, szResponder, 0, -1, hwndDlg))
<< XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(_T("node"), JABBER_FEAT_COMMANDS));
}
int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* dat)
{
- for (int i = 1; ; i++) {
+ for (int i = 1;; i++) {
HXML itemNode = xmlGetNthChild(dat->CommandsNode, _T("item"), i);
- if ( !itemNode)
+ if (!itemNode)
break;
- if ( !IsDlgButtonChecked(GetDlgItem(hwndDlg, IDC_FRAME), i))
+ if (!IsDlgButtonChecked(GetDlgItem(hwndDlg, IDC_FRAME), i))
continue;
const TCHAR *node = xmlGetAttrValue(itemNode, _T("node"));
if (node) {
const TCHAR *jid2 = xmlGetAttrValue(itemNode, _T("jid"));
m_ThreadInfo->send(
- XmlNodeIq( AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg))
- << XCHILDNS(_T("command"), JABBER_FEAT_COMMANDS) << XATTR(_T("node"), node) << XATTR(_T("action"), _T("execute")));
+ XmlNodeIq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg))
+ << XCHILDNS(_T("command"), JABBER_FEAT_COMMANDS) << XATTR(_T("node"), node) << XATTR(_T("action"), _T("execute")));
EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE);
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
@@ -138,15 +138,15 @@ int CJabberProto::AdHoc_ExecuteCommand(HWND hwndDlg, TCHAR*, JabberAdHocData* da
return TRUE;
}
-//Messages handlers
+// Messages handlers
int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, JabberAdHocData* dat)
{
int nodeIdx = 0;
const TCHAR * type = xmlGetAttrValue(iqNode, _T("type"));
- if ( !type || !_tcscmp(type, _T("error"))) {
+ if (!type || !_tcscmp(type, _T("error"))) {
// error occurred here
TCHAR buff[255];
- const TCHAR *code = NULL;
+ const TCHAR *code = NULL;
const TCHAR *description = NULL;
HXML errorNode = xmlGetChild(iqNode, "error");
@@ -157,31 +157,31 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe
mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s"), (code) ? code : _T(""), (description) ? description : _T(""));
JabberFormSetInstruction(hwndDlg, buff);
}
- else if ( !_tcscmp(type, _T("result"))) {
+ else if (!_tcscmp(type, _T("result"))) {
BOOL validResponse = FALSE;
EnumChildWindows(GetDlgItem(hwndDlg, IDC_FRAME), sttDeleteChildWindowsProc, 0);
dat->CurrentHeight = 0;
dat->curPos = 0;
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE);
- HXML queryNode = xmlGetChild(iqNode , "query");
+ HXML queryNode = xmlGetChild(iqNode, "query");
if (queryNode) {
const TCHAR *xmlns = xmlGetAttrValue(queryNode, _T("xmlns"));
- const TCHAR *node = xmlGetAttrValue(queryNode, _T("node"));
- if (xmlns && node && !_tcscmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !_tcscmp(node, JABBER_FEAT_COMMANDS))
+ const TCHAR *node = xmlGetAttrValue(queryNode, _T("node"));
+ if (xmlns && node && !_tcscmp(xmlns, JABBER_FEAT_DISCO_ITEMS) && !_tcscmp(node, JABBER_FEAT_COMMANDS))
validResponse = TRUE;
}
- if (queryNode && xmlGetChild(queryNode ,0) && validResponse) {
+ if (queryNode && xmlGetChild(queryNode, 0) && validResponse) {
dat->CommandsNode = xi.copyNode(queryNode);
int ypos = 20;
- for (nodeIdx = 1; ; nodeIdx++) {
+ for (nodeIdx = 1;; nodeIdx++) {
HXML itemNode = xmlGetNthChild(queryNode, _T("item"), nodeIdx);
if (!itemNode)
break;
const TCHAR *name = xmlGetAttrValue(itemNode, _T("name"));
- if ( !name) name = xmlGetAttrValue(itemNode, _T("node"));
- ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg,IDC_FRAME), TranslateTS(name), nodeIdx, ypos, (nodeIdx==1) ? 1 : 0);
+ if (!name) name = xmlGetAttrValue(itemNode, _T("node"));
+ ypos = AdHoc_AddCommandRadio(GetDlgItem(hwndDlg, IDC_FRAME), TranslateTS(name), nodeIdx, ypos, (nodeIdx == 1) ? 1 : 0);
dat->CurrentHeight = ypos;
}
}
@@ -213,61 +213,63 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA
const TCHAR *type;
if ((type = xmlGetAttrValue(workNode, _T("type"))) == NULL) return TRUE;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
// wParam = <iq/> node from responder as a result of command execution
HXML commandNode, xNode;
if ((commandNode = xmlGetChild(dat->AdHocNode, _T("command"))) == NULL)
return TRUE;
const TCHAR *status = xmlGetAttrValue(commandNode, _T("status"));
- if ( !status)
+ if (!status)
status = _T("completed");
- if ((xNode = xmlGetChild(commandNode , "x"))) {
+ if ((xNode = xmlGetChild(commandNode, "x"))) {
// 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 (LPCTSTR ptszInstr = xmlGetText(xmlGetChild(xNode, "instructions")))
JabberFormSetInstruction(hwndDlg, ptszInstr);
- else if (LPCTSTR ptszTitle = xmlGetText( xmlGetChild(xNode , "title")))
+ else if (LPCTSTR ptszTitle = xmlGetText(xmlGetChild(xNode, "title")))
JabberFormSetInstruction(hwndDlg, ptszTitle);
else
JabberFormSetInstruction(hwndDlg, TranslateTS(status));
JabberFormCreateUI(hFrame, xNode, &dat->CurrentHeight);
- ShowDlgItem( hwndDlg, IDC_FRAME , SW_SHOW);
+ ShowDlgItem(hwndDlg, IDC_FRAME, SW_SHOW);
}
else {
//NO X FORM
- int toHide[] = { IDC_FRAME_TEXT, IDC_FRAME, IDC_VSCROLL, 0};
+ int toHide[] = { IDC_FRAME_TEXT, IDC_FRAME, IDC_VSCROLL, 0 };
sttShowControls(hwndDlg, FALSE, toHide);
- LPCTSTR noteText = xmlGetText( xmlGetChild(commandNode, "note"));
+ LPCTSTR noteText = xmlGetText(xmlGetChild(commandNode, "note"));
JabberFormSetInstruction(hwndDlg, noteText ? noteText : TranslateTS(status));
}
- //check actions
- HXML actionsNode = xmlGetChild(commandNode , "actions");
+ // check actions
+ HXML actionsNode = xmlGetChild(commandNode, "actions");
if (actionsNode != NULL) {
ShowDlgItem(hwndDlg, IDC_PREV, (xmlGetChild(actionsNode, "prev") != NULL) ? SW_SHOW : SW_HIDE);
ShowDlgItem(hwndDlg, IDC_NEXT, (xmlGetChild(actionsNode, "next") != NULL) ? SW_SHOW : SW_HIDE);
ShowDlgItem(hwndDlg, IDC_COMPLETE, (xmlGetChild(actionsNode, "complete") != NULL) ? SW_SHOW : SW_HIDE);
ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_HIDE);
- int toEnable[] = { IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0};
+ int toEnable[] = { IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0 };
sttEnableControls(hwndDlg, TRUE, toEnable);
- } else {
- int toHide[] = { IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0};
- sttShowControls(hwndDlg, FALSE, toHide);
+ }
+ else {
+ int toHide[] = { IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0 };
+ sttShowControls(hwndDlg, FALSE, toHide);
- ShowDlgItem(hwndDlg,IDC_SUBMIT, SW_SHOW);
- EnableDlgItem(hwndDlg,IDC_SUBMIT, TRUE);
+ ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_SHOW);
+ EnableDlgItem(hwndDlg, IDC_SUBMIT, TRUE);
}
- if ( !status || _tcscmp(status,_T("executing"))) {
+ if (!status || _tcscmp(status, _T("executing"))) {
ShowDlgItem(hwndDlg, IDC_SUBMIT, SW_HIDE);
- SetWindowText(GetDlgItem(hwndDlg,IDCANCEL), TranslateT("Done"));
- } }
- else if ( !lstrcmp(type, _T("error"))) {
+ SetWindowText(GetDlgItem(hwndDlg, IDCANCEL), TranslateT("Done"));
+ }
+ }
+ else if (!lstrcmp(type, _T("error"))) {
// error occurred here
int toHide[] = { IDC_FRAME, IDC_FRAME_TEXT, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_SUBMIT, 0};
sttShowControls(hwndDlg, FALSE, toHide);
@@ -290,11 +292,11 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA
int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TCHAR* action)
{
HXML commandNode = xmlGetChild(dat->AdHocNode, "command");
- HXML xNode = xmlGetChild(commandNode , "x");
- HXML dataNode = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), xNode);
+ HXML xNode = xmlGetChild(commandNode, "x");
+ HXML dataNode = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), xNode);
LPCTSTR jid2 = xmlGetAttrValue(dat->AdHocNode, _T("from"));
- XmlNodeIq iq( AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg));
+ XmlNodeIq iq(AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, jid2, 0, -1, hwndDlg));
HXML command = iq << XCHILDNS(_T("command"), JABBER_FEAT_COMMANDS);
const TCHAR *sessionId = xmlGetAttrValue(commandNode, _T("sessionid"));
@@ -313,16 +315,16 @@ int CJabberProto::AdHoc_SubmitCommandForm(HWND hwndDlg, JabberAdHocData* dat, TC
xi.destroyNode(dataNode);
- JabberFormSetInstruction(hwndDlg,TranslateT("In progress. Please Wait..."));
+ JabberFormSetInstruction(hwndDlg, TranslateT("In progress. Please Wait..."));
- static const int toDisable[] = {IDC_SUBMIT, IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0};
+ static const int toDisable[] = { IDC_SUBMIT, IDC_PREV, IDC_NEXT, IDC_COMPLETE, 0 };
sttEnableControls(hwndDlg, FALSE, toDisable);
return TRUE;
}
int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, int ypos, int value)
{
- RECT strRect = {0};
+ RECT strRect = { 0 };
int verticalStep = 4;
int ctrlMinHeight = 18;
@@ -330,14 +332,14 @@ int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, TCHAR * labelStr, int id, i
GetClientRect(hFrame, &rcFrame);
int ctrlOffset = 20;
- int ctrlWidth = rcFrame.right-ctrlOffset;
+ int ctrlWidth = rcFrame.right - ctrlOffset;
HDC hdc = GetDC(hFrame);
- int labelHeight = max(ctrlMinHeight, DrawText(hdc , labelStr, -1, &strRect, DT_CALCRECT));
- ctrlWidth = min(ctrlWidth, strRect.right-strRect.left+20);
+ int labelHeight = max(ctrlMinHeight, DrawText(hdc, labelStr, -1, &strRect, DT_CALCRECT));
+ ctrlWidth = min(ctrlWidth, strRect.right - strRect.left + 20);
ReleaseDC(hFrame, hdc);
- HWND hCtrl = CreateWindowEx(0, _T("button"), labelStr, WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTORADIOBUTTON, ctrlOffset, ypos, ctrlWidth, labelHeight, hFrame, (HMENU) id, hInst, NULL);
+ HWND hCtrl = CreateWindowEx(0, _T("button"), labelStr, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, ctrlOffset, ypos, ctrlWidth, labelHeight, hFrame, (HMENU)id, hInst, NULL);
SendMessage(hCtrl, WM_SETFONT, (WPARAM)SendMessage(GetParent(hFrame), WM_GETFONT, 0, 0), 0);
SendMessage(hCtrl, BM_SETCHECK, value, 0);
return (ypos + labelHeight + verticalStep);
@@ -355,7 +357,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
dat->ResponderJID = mir_tstrdup(pStartupParams->m_szJid);
dat->proto = pStartupParams->m_pProto;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
WindowSetIcon(hwndDlg, dat->proto, "adhoc");
dat->proto->m_hwndCommandWindow = hwndDlg;
TranslateDialogDefault(hwndDlg);
@@ -366,20 +368,20 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
- int toHide[] = { IDC_FRAME, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_FRAME_TEXT, 0};
+ int toHide[] = { IDC_FRAME, IDC_VSCROLL, IDC_PREV, IDC_NEXT, IDC_COMPLETE, IDC_FRAME_TEXT, 0 };
sttShowControls(hwndDlg, FALSE, toHide);
- int toShow[] = { IDC_INSTRUCTION, IDC_SUBMIT, IDCANCEL, 0};
+ int toShow[] = { IDC_INSTRUCTION, IDC_SUBMIT, IDCANCEL, 0 };
sttShowControls(hwndDlg, TRUE, toShow);
- EnableDlgItem(hwndDlg,IDC_VSCROLL,TRUE);
+ EnableDlgItem(hwndDlg, IDC_VSCROLL, TRUE);
- SetWindowPos(GetDlgItem(hwndDlg,IDC_VSCROLL),HWND_BOTTOM,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_VSCROLL), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- SetDlgItemText(hwndDlg,IDC_SUBMIT, TranslateT("Execute"));
- JabberFormSetInstruction(hwndDlg,TranslateT("Requesting command list. Please wait..."));
+ SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("Execute"));
+ JabberFormSetInstruction(hwndDlg, TranslateT("Requesting command list. Please wait..."));
- if ( !pStartupParams->m_szNode) {
+ if (!pStartupParams->m_szNode) {
dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
TCHAR Caption[512];
@@ -388,9 +390,9 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
}
else {
dat->proto->m_ThreadInfo->send(
- XmlNodeIq( dat->proto->AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, pStartupParams->m_szJid, 0, -1, hwndDlg))
- << XCHILDNS(_T("command"), JABBER_FEAT_COMMANDS)
- << XATTR(_T("node"), pStartupParams->m_szNode) << XATTR(_T("action"), _T("execute")));
+ XmlNodeIq(dat->proto->AddIQ(&CJabberProto::OnIqResult_CommandExecution, JABBER_IQ_TYPE_SET, pStartupParams->m_szJid, 0, -1, hwndDlg))
+ << XCHILDNS(_T("command"), JABBER_FEAT_COMMANDS)
+ << XATTR(_T("node"), pStartupParams->m_szNode) << XATTR(_T("action"), _T("execute")));
EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE);
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
@@ -414,16 +416,16 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_PREV:
- return dat->proto->AdHoc_SubmitCommandForm(hwndDlg,dat,_T("prev"));
+ return dat->proto->AdHoc_SubmitCommandForm(hwndDlg, dat, _T("prev"));
case IDC_NEXT:
- return dat->proto->AdHoc_SubmitCommandForm(hwndDlg,dat,_T("next"));
+ return dat->proto->AdHoc_SubmitCommandForm(hwndDlg, dat, _T("next"));
case IDC_COMPLETE:
- return dat->proto->AdHoc_SubmitCommandForm(hwndDlg,dat,_T("complete"));
+ return dat->proto->AdHoc_SubmitCommandForm(hwndDlg, dat, _T("complete"));
case IDC_SUBMIT:
- if ( !dat->AdHocNode && dat->CommandsNode && LOWORD(wParam)==IDC_SUBMIT)
- return dat->proto->AdHoc_ExecuteCommand(hwndDlg,dat->ResponderJID, dat);
+ if (!dat->AdHocNode && dat->CommandsNode && LOWORD(wParam) == IDC_SUBMIT)
+ return dat->proto->AdHoc_ExecuteCommand(hwndDlg, dat->ResponderJID, dat);
else
- return dat->proto->AdHoc_SubmitCommandForm(hwndDlg,dat, NULL);
+ return dat->proto->AdHoc_SubmitCommandForm(hwndDlg, dat, NULL);
case IDCLOSE:
case IDCANCEL:
xi.destroyNode(dat->AdHocNode); dat->AdHocNode = NULL;
@@ -433,20 +435,21 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
break;
case JAHM_COMMANDLISTRESULT:
- return dat->proto->AdHoc_OnJAHMCommandListResult(hwndDlg,(HXML)lParam,dat);
+ return dat->proto->AdHoc_OnJAHMCommandListResult(hwndDlg, (HXML)lParam, dat);
case JAHM_PROCESSRESULT:
- return dat->proto->AdHoc_OnJAHMProcessResult(hwndDlg, (HXML)wParam,dat);
+ return dat->proto->AdHoc_OnJAHMProcessResult(hwndDlg, (HXML)wParam, dat);
case WM_MOUSEWHEEL:
{
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (zDelta) {
- int nScrollLines=0;
- SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0,(void*)&nScrollLines,0);
- for (int i=0; i<(nScrollLines+1)/2; i++)
- SendMessage(hwndDlg,WM_VSCROLL, (zDelta<0)?SB_LINEDOWN:SB_LINEUP,0);
- } }
+ int nScrollLines = 0;
+ SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);
+ for (int i = 0; i < (nScrollLines + 1) / 2; i++)
+ SendMessage(hwndDlg, WM_VSCROLL, (zDelta < 0) ? SB_LINEDOWN : SB_LINEUP, 0);
+ }
+ }
return TRUE;
case WM_VSCROLL:
@@ -475,15 +478,15 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA
if (pos < 0)
pos = 0;
if (dat->curPos != pos) {
- ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL , &(dat->frameRect));
+ ScrollWindow(GetDlgItem(hwndDlg, IDC_FRAME), 0, dat->curPos - pos, NULL, &(dat->frameRect));
SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, pos, TRUE);
- RECT Invalid=dat->frameRect;
+ RECT Invalid = dat->frameRect;
if (dat->curPos - pos >0)
- Invalid.bottom=Invalid.top+(dat->curPos - pos);
+ Invalid.bottom = Invalid.top + (dat->curPos - pos);
else
- Invalid.top=Invalid.bottom+(dat->curPos - pos);
+ Invalid.top = Invalid.bottom + (dat->curPos - pos);
- RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW |RDW_ALLCHILDREN);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_FRAME), NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN);
dat->curPos = pos;
}
}
@@ -511,7 +514,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam)
int res = -1;
if ((hContact != NULL || lParam != 0) && m_bJabberOnline) {
- ptrT szJid( getTStringA(hContact, "jid"));
+ ptrT szJid(getTStringA(hContact, "jid"));
if (wParam && szJid != NULL) {
JABBER_LIST_ITEM *item = NULL;
int selected = 0;
@@ -523,9 +526,9 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam)
if (item) {
if (item->arResources.getCount() > 1) {
HMENU hMenu = CreatePopupMenu();
- for (int i=0; i < item->arResources.getCount(); i++)
- AppendMenu(hMenu,MF_STRING,i+1, item->arResources[i]->m_tszResourceName);
- HWND hwndTemp = CreateWindowEx(WS_EX_TOOLWINDOW,_T("button"),_T("PopupMenuHost"),0,0,0,10,10,NULL,NULL,hInst,NULL);
+ for (int i = 0; i < item->arResources.getCount(); i++)
+ AppendMenu(hMenu, MF_STRING, i + 1, item->arResources[i]->m_tszResourceName);
+ HWND hwndTemp = CreateWindowEx(WS_EX_TOOLWINDOW, _T("button"), _T("PopupMenuHost"), 0, 0, 0, 10, 10, NULL, NULL, hInst, NULL);
SetForegroundWindow(hwndTemp);
RECT rc;
POINT pt;
@@ -537,9 +540,9 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam)
else selected = 1;
if (selected > 0) {
- JABBER_RESOURCE_STATUS *r = item->arResources[selected-1];
+ JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- _tcsncat(jid, _T("/"),SIZEOF(jid));
+ _tcsncat(jid, _T("/"), SIZEOF(jid));
_tcsncat(jid, r->m_tszResourceName, SIZEOF(jid));
}
selected = 1;
diff --git a/protocols/JabberG/src/jabber_agent.cpp b/protocols/JabberG/src/jabber_agent.cpp
index db15764e8b..de48e3c796 100644
--- a/protocols/JabberG/src/jabber_agent.cpp
+++ b/protocols/JabberG/src/jabber_agent.cpp
@@ -167,13 +167,13 @@ public:
break;
if (xmlGetName(n)) {
- if ( !lstrcmp(xmlGetName(n), _T("instructions"))) {
+ if (!lstrcmp(xmlGetName(n), _T("instructions"))) {
JabberFormSetInstruction(m_hwnd, xmlGetText(n));
}
- else if ( !lstrcmp(xmlGetName(n), _T("key")) || !lstrcmp(xmlGetName(n), _T("registered"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("key")) || !lstrcmp(xmlGetName(n), _T("registered"))) {
// do nothing
}
- else if ( !lstrcmp(xmlGetName(n), _T("password")))
+ else if (!lstrcmp(xmlGetName(n), _T("password")))
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));
@@ -247,18 +247,18 @@ public:
// use old registration information form
for (int i=0; ; i++) {
HXML n = xmlGetChild(queryNode ,i);
- if ( !n)
+ if (!n)
break;
if (xmlGetName(n)) {
- if ( !lstrcmp(xmlGetName(n), _T("key"))) {
+ if (!lstrcmp(xmlGetName(n), _T("key"))) {
// field that must be passed along with the registration
if (xmlGetText(n))
xmlAddChild(query, xmlGetName(n), xmlGetText(n));
else
xmlAddChild(query, xmlGetName(n));
}
- else if ( !lstrcmp(xmlGetName(n), _T("registered")) || !lstrcmp(xmlGetName(n), _T("instructions"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("registered")) || !lstrcmp(xmlGetName(n), _T("instructions"))) {
// do nothing, we will skip these
}
else {
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 52cfc0f755..7cacaa4c21 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR __cdecl CJabberProto::JabberGetApi(WPARAM wParam, LPARAM lParam)
{
IJabberInterface **ji = (IJabberInterface**)lParam;
- if ( !ji)
+ if (!ji)
return -1;
*ji = this;
return 0;
@@ -52,7 +52,7 @@ DWORD CJabberProto::GetJabberVersion() const
int CJabberProto::CompareJIDs(LPCTSTR jid1, LPCTSTR jid2)
{
- if ( !jid1 || !jid2) return 0;
+ if (!jid1 || !jid2) return 0;
return JabberCompareJids(jid1, jid2);
}
@@ -206,7 +206,7 @@ int CJabberProto::RemoveHandler(HJHANDLER hHandler)
JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
{
for (int i=0; i < m_lstJabberFeatCapPairsDynamic.getCount(); i++)
- if ( !lstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
+ if (!lstrcmp(m_lstJabberFeatCapPairsDynamic[i]->szFeature, szFeature))
return m_lstJabberFeatCapPairsDynamic[i];
return NULL;
@@ -214,18 +214,18 @@ JabberFeatCapPairDynamic *CJabberProto::FindFeature(LPCTSTR szFeature)
int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription)
{
- if ( !szFeature)
+ if (!szFeature)
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++)
- if ( !lstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
+ if (!lstrcmp(g_JabberFeatCapPairs[i].szFeature, szFeature))
return false;
mir_cslock lck(m_csLists);
JabberFeatCapPairDynamic *fcp = FindFeature(szFeature);
- if ( !fcp) { // if the feature is not registered yet, allocate new bit for it
+ if (!fcp) { // if the feature is not registered yet, allocate new bit for it
JabberCapsBits jcb = JABBER_CAPS_OTHER_SPECIAL; // set all bits not included in g_JabberFeatCapPairs
// set all bits occupied by g_JabberFeatCapPairs
@@ -240,7 +240,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription)
jcb = (~jcb) & (JabberCapsBits)(-(__int64)(~jcb));
// no more free bits
- if ( !jcb)
+ if (!jcb)
return false;
// remove unnecessary symbols from szFeature to make the string shorter, and use it as szExt
@@ -269,7 +269,7 @@ int CJabberProto::RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription)
int CJabberProto::AddFeatures(LPCTSTR szFeatures)
{
- if ( !szFeatures)
+ if (!szFeatures)
return false;
mir_cslockfull lck(m_csLists);
@@ -278,8 +278,8 @@ int CJabberProto::AddFeatures(LPCTSTR 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
- if ( !fcp) { // if the feature is not registered yet
- if ( !RegisterFeature(szFeat, NULL))
+ if (!fcp) { // if the feature is not registered yet
+ if (!RegisterFeature(szFeat, NULL))
ret = false;
else
fcp = FindFeature(szFeat); // update fcp after RegisterFeature()
@@ -300,7 +300,7 @@ int CJabberProto::AddFeatures(LPCTSTR szFeatures)
int CJabberProto::RemoveFeatures(LPCTSTR szFeatures)
{
- if ( !szFeatures)
+ if (!szFeatures)
return false;
mir_cslockfull lck(m_csLists);
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp
index ae352403e0..d2faf4fd8e 100644
--- a/protocols/JabberG/src/jabber_archive.cpp
+++ b/protocols/JabberG/src/jabber_archive.cpp
@@ -272,9 +272,9 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*)
int from;
const TCHAR *itemName = xmlGetName(itemNode);
- if ( !lstrcmp(itemName, _T("to")))
+ if (!lstrcmp(itemName, _T("to")))
from = DBEF_SENT;
- else if ( !lstrcmp(itemName, _T("from")))
+ else if (!lstrcmp(itemName, _T("from")))
from = 0;
else
continue;
@@ -297,7 +297,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*)
dbei.flags = DBEF_READ + DBEF_UTF + from;
dbei.pBlob = (PBYTE)(char*)szEventText;
dbei.timestamp = tmStart + _ttol(tszSecs) - timezone;
- if ( !IsDuplicateEvent(hContact, dbei))
+ if (!IsDuplicateEvent(hContact, dbei))
db_event_add(hContact, &dbei);
}
}
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp
index 8a73474b89..80d0eeeec4 100644
--- a/protocols/JabberG/src/jabber_bookmarks.cpp
+++ b/protocols/JabberG/src/jabber_bookmarks.cpp
@@ -47,8 +47,8 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
param->ppro->m_hwndJabberAddBookmark = hwndDlg;
TranslateDialogDefault(hwndDlg);
if (item = param->m_item) {
- if ( !lstrcmp(item->type, _T("conference"))) {
- if ( !_tcschr(item->jid, _T('@'))) { //no room name - consider it is transport
+ if (!lstrcmp(item->type, _T("conference"))) {
+ if (!_tcschr(item->jid, _T('@'))) { //no room name - consider it is transport
SendDlgItemMessage(hwndDlg, IDC_AGENT_RADIO, BM_SETCHECK, BST_CHECKED, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
@@ -145,7 +145,7 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM
break;
case WM_JABBER_CHECK_ONLINE:
- if ( !param->ppro->m_bJabberOnline)
+ if (!param->ppro->m_bJabberOnline)
EndDialog(hwndDlg, 0);
break;
@@ -192,7 +192,7 @@ private:
void btnAdd_OnClick(CCtrlFilterListView *)
{
- if ( !m_proto->m_bJabberOnline) return;
+ if (!m_proto->m_bJabberOnline) return;
JabberAddBookmarkDlgParam param;
param.ppro = m_proto;
@@ -202,7 +202,7 @@ private:
void btnEdit_OnClick(CCtrlFilterListView *)
{
- if ( !m_proto->m_bJabberOnline) return;
+ if (!m_proto->m_bJabberOnline) return;
int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED);
if (iItem < 0) return;
@@ -221,7 +221,7 @@ private:
void btnRemove_OnClick(CCtrlFilterListView *)
{
- if ( !m_proto->m_bJabberOnline) return;
+ if (!m_proto->m_bJabberOnline) return;
int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED);
if (iItem < 0) return;
@@ -261,7 +261,7 @@ CJabberDlgBookmarks::CJabberDlgBookmarks(CJabberProto *proto) :
void CJabberDlgBookmarks::UpdateData()
{
- if ( !m_proto->m_bJabberOnline) return;
+ if (!m_proto->m_bJabberOnline) return;
m_proto->m_ThreadInfo->send(
XmlNodeIq( m_proto->AddIQ(&CJabberProto::OnIqResultDiscoBookmarks, JABBER_IQ_TYPE_GET))
@@ -329,11 +329,11 @@ void CJabberDlgBookmarks::OpenBookmark()
JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address);
if (item == NULL) return;
- if ( !lstrcmpi(item->type, _T("conference"))) {
+ if (!lstrcmpi(item->type, _T("conference"))) {
m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item
/* some hack for using bookmark to transport not under XEP-0048 */
- if ( !_tcschr(item->jid, _T('@')))
+ if (!_tcschr(item->jid, _T('@')))
//the room name is not provided let consider that it is transport and send request to registration
m_proto->RegisterAgent(NULL, item->jid);
else {
@@ -378,7 +378,7 @@ INT_PTR CJabberDlgBookmarks::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
void CJabberDlgBookmarks::OnProtoCheckOnline(WPARAM, LPARAM)
{
- if ( !m_proto->m_bJabberOnline) {
+ if (!m_proto->m_bJabberOnline) {
m_btnAdd.Disable();
m_btnEdit.Disable();
m_btnRemove.Disable();
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index bbf6654dd0..fe376d53c3 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -240,7 +240,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
CloseHandle(jbt->hProxyEvent);
jbt->hProxyEvent = NULL;
- if ( !jbt->szStreamhostUsed) {
+ if (!jbt->szStreamhostUsed) {
if (bDirect) {
SetEvent(jbt->hSendEvent);
CloseHandle(jbt->hSendEvent);
@@ -416,7 +416,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*)
if (item == NULL)
return;
- if ( !lstrcmp(xmlGetAttrValue(iqNode, _T("type")), _T("result")))
+ if (!lstrcmp(xmlGetAttrValue(iqNode, _T("type")), _T("result")))
item->jbt->bStreamActivated = TRUE;
if (item->jbt->hProxyEvent)
@@ -484,7 +484,7 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt)
mir_free(buffer);
(this->*jbt->pfnFinal)((jbt->state == JBT_DONE) ? TRUE : FALSE, jbt->ft);
jbt->ft = NULL;
- if ( !validStreamhost)
+ if (!validStreamhost)
m_ThreadInfo->send( XmlNodeIq(_T("error"), jbt->iqId, jbt->srcJID)
<< XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
<< XCHILDNS(_T("item-not-found"), _T("urn:ietf:params:xml:ns:xmpp-stanzas")));
@@ -674,7 +674,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
(this->*jbt->pfnFinal)((jbt->state==JBT_DONE)?TRUE:FALSE, jbt->ft);
jbt->ft = NULL;
- if ( !validStreamhost && szId && from) {
+ if (!validStreamhost && szId && from) {
debugLogA("bytestream_recv_connection session not completed");
m_ThreadInfo->send( XmlNodeIq(_T("error"), szId, from)
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 6eb923cbec..299e8e14a7 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -146,7 +146,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if ( !_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
jcbCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -160,7 +160,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo *pInfo)
return;
}
- if ( !m_clientCapsManager.SetClientCaps(pInfo->GetIqId(), jcbCaps))
+ if (!m_clientCapsManager.SetClientCaps(pInfo->GetIqId(), jcbCaps))
if (r)
r->m_jcbCachedCaps = jcbCaps;
@@ -192,7 +192,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
JabberCapsBits jcbToReturn = JABBER_RESOURCE_CAPS_NONE;
// get bare jid info only if where is no resources
- if ( !item || (item && !item->arResources.getCount())) {
+ if (!item || (item && !item->arResources.getCount())) {
jcbToReturn = GetResourceCapabilites(szBareJid, FALSE);
if (jcbToReturn & JABBER_RESOURCE_CAPS_ERROR)
jcbToReturn = JABBER_RESOURCE_CAPS_NONE;
@@ -203,7 +203,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
TCHAR szFullJid[JABBER_MAX_JID_LEN];
mir_sntprintf(szFullJid, JABBER_MAX_JID_LEN, _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
- if ( !(jcb & JABBER_RESOURCE_CAPS_ERROR))
+ if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
}
}
@@ -298,9 +298,9 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
// capability mode (version request + service discovery)
// no version info:
- if ( !r->m_tszSoftwareVersion && !r->m_tszSoftware) {
+ if (!r->m_tszSoftwareVersion && !r->m_tszSoftware) {
// version request not sent:
- if ( !r->m_dwVersionRequestTime) {
+ if (!r->m_dwVersionRequestTime) {
// send version query
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultVersion, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_HCONTACT | JABBER_IQ_PARSE_CHILD_TAG_NODE);
@@ -322,7 +322,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
r->m_dwVersionRequestTime = -1;
}
// no version information, try direct service discovery
- if ( !r->m_dwDiscoInfoRequestTime) {
+ if (!r->m_dwDiscoInfoRequestTime) {
// send disco#info query
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultCapsDiscoInfo, JABBER_IQ_TYPE_GET, fullJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE);
@@ -350,17 +350,17 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen
JabberCapsBits jcbMainCaps = m_clientCapsManager.GetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion);
if (jcbMainCaps == JABBER_RESOURCE_CAPS_ERROR) {
// Bombus hack:
- if ( !_tcscmp(r->m_tszSoftware, _T("Bombus")) || !_tcscmp(r->m_tszSoftware, _T("BombusMod"))) {
+ if (!_tcscmp(r->m_tszSoftware, _T("Bombus")) || !_tcscmp(r->m_tszSoftware, _T("BombusMod"))) {
jcbMainCaps = JABBER_CAPS_SI|JABBER_CAPS_SI_FT|JABBER_CAPS_IBB|JABBER_CAPS_MESSAGE_EVENTS|JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY|JABBER_CAPS_DATA_FORMS|JABBER_CAPS_LAST_ACTIVITY|JABBER_CAPS_VERSION|JABBER_CAPS_COMMANDS|JABBER_CAPS_VCARD_TEMP;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// Neos hack:
- else if ( !_tcscmp(r->m_tszSoftware, _T("neos"))) {
+ else if (!_tcscmp(r->m_tszSoftware, _T("neos"))) {
jcbMainCaps = JABBER_CAPS_OOB|JABBER_CAPS_MESSAGE_EVENTS|JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY|JABBER_CAPS_LAST_ACTIVITY|JABBER_CAPS_VERSION;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
}
// sim hack:
- else if ( !_tcscmp(r->m_tszSoftware, _T("sim"))) {
+ else if (!_tcscmp(r->m_tszSoftware, _T("sim"))) {
jcbMainCaps = JABBER_CAPS_OOB|JABBER_CAPS_VERSION|JABBER_CAPS_MESSAGE_EVENTS|JABBER_CAPS_MESSAGE_EVENTS_NO_DELIVERY;
m_clientCapsManager.SetClientCaps(r->m_tszSoftware, r->m_tszSoftwareVersion, jcbMainCaps);
} }
@@ -432,12 +432,12 @@ JabberCapsBits CJabberClientPartialCaps::GetCaps()
CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const TCHAR *szVer)
{
- if ( !m_pCaps || !szVer)
+ if (!m_pCaps || !szVer)
return NULL;
CJabberClientPartialCaps *pCaps = m_pCaps;
while (pCaps) {
- if ( !_tcscmp(szVer, pCaps->GetVersion()))
+ if (!_tcscmp(szVer, pCaps->GetVersion()))
break;
pCaps = pCaps->GetNext();
}
@@ -446,7 +446,7 @@ CJabberClientPartialCaps* CJabberClientCaps::FindByVersion(const TCHAR *szVer)
CJabberClientPartialCaps* CJabberClientCaps::FindById(int nIqId)
{
- if ( !m_pCaps || nIqId == -1)
+ if (!m_pCaps || nIqId == -1)
return NULL;
CJabberClientPartialCaps *pCaps = m_pCaps;
@@ -492,9 +492,9 @@ JabberCapsBits CJabberClientCaps::GetPartialCaps(TCHAR *szVer)
BOOL CJabberClientCaps::SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCaps, int nIqId /*= -1*/)
{
CJabberClientPartialCaps *pCaps = FindByVersion(szVer);
- if ( !pCaps) {
+ if (!pCaps) {
pCaps = new CJabberClientPartialCaps(szVer);
- if ( !pCaps)
+ if (!pCaps)
return FALSE;
pCaps->SetNext(m_pCaps);
m_pCaps = pCaps;
@@ -507,7 +507,7 @@ BOOL CJabberClientCaps::SetPartialCaps(const TCHAR *szVer, JabberCapsBits jcbCap
BOOL CJabberClientCaps::SetPartialCaps(int nIqId, JabberCapsBits jcbCaps)
{
CJabberClientPartialCaps *pCaps = FindById(nIqId);
- if ( !pCaps)
+ if (!pCaps)
return FALSE;
pCaps->SetCaps(jcbCaps, -1);
@@ -533,12 +533,12 @@ CJabberClientCapsManager::~CJabberClientCapsManager()
CJabberClientCaps * CJabberClientCapsManager::FindClient(const TCHAR *szNode)
{
- if ( !m_pClients || !szNode)
+ if (!m_pClients || !szNode)
return NULL;
CJabberClientCaps *pClient = m_pClients;
while (pClient) {
- if ( !_tcscmp(szNode, pClient->GetNode()))
+ if (!_tcscmp(szNode, pClient->GetNode()))
break;
pClient = pClient->GetNext();
}
@@ -557,7 +557,7 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szV
{
Lock();
CJabberClientCaps *pClient = FindClient(szNode);
- if ( !pClient) {
+ if (!pClient) {
Unlock();
ppro->debugLogA("CAPS: get no caps for: %S, %S", szNode, szVer);
return JABBER_RESOURCE_CAPS_UNINIT;
@@ -572,9 +572,9 @@ BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *s
{
Lock();
CJabberClientCaps *pClient = FindClient(szNode);
- if ( !pClient) {
+ if (!pClient) {
pClient = new CJabberClientCaps(szNode);
- if ( !pClient) {
+ if (!pClient) {
Unlock();
return FALSE;
}
@@ -590,7 +590,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *s
BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
{
Lock();
- if ( !m_pClients) {
+ if (!m_pClients) {
Unlock();
return FALSE;
}
@@ -617,7 +617,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
for (i=0; g_JabberFeatCapPairsExt[i].szFeature; i++) {
TCHAR szExtCap[ 512 ];
mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
- if ( !_tcscmp(szNode, szExtCap)) {
+ if (!_tcscmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
}
@@ -627,14 +627,14 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
TCHAR szExtCap[ 512 ];
mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
- if ( !_tcscmp(szNode, szExtCap)) {
+ if (!_tcscmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
}
}
// unknown node, not XEP-0115 request
- if ( !jcb)
+ if (!jcb)
return FALSE;
}
else {
@@ -643,7 +643,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
jcb |= ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
}
- if ( !ppro->m_options.AllowVersionRequests)
+ if (!ppro->m_options.AllowVersionRequests)
jcb &= ~JABBER_CAPS_VERSION;
XmlNodeIq iq(_T("result"), pInfo);
@@ -668,12 +668,12 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con
TCHAR *os = szOsBuffer;
if (ppro->m_options.ShowOSVersion) {
- if ( !GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
+ if (!GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
lstrcpyn(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
else {
TCHAR *szOsWindows = _T("Microsoft Windows");
size_t nOsWindowsLength = _tcslen(szOsWindows);
- if ( !_tcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
+ if (!_tcsnicmp(szOsBuffer, szOsWindows, nOsWindowsLength))
os += nOsWindowsLength + 1;
}
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index c19efb423d..abc5ac5dcf 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -143,7 +143,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
ptrT tszNick( getTStringA(hContact, "MyNick"));
if (tszNick != NULL) {
- if ( !lstrcmp(tszNick, szNick))
+ if (!lstrcmp(tszNick, szNick))
delSetting(hContact, "MyNick");
else
setTString(hContact, "MyNick", item->nick);
@@ -152,7 +152,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
ptrT passw( getTStringA(hContact, "Password"));
if (lstrcmp_null(passw, item->password)) {
- if ( !item->password || !item->password[0])
+ if (!item->password || !item->password[0])
delSetting(hContact, "Password");
else
setTString(hContact, "Password", item->password);
@@ -185,30 +185,30 @@ void CJabberProto::GcLogCreate(JABBER_LIST_ITEM *item)
void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus &user, TJabberGcLogInfoType type)
{
- if ( !item || !user || (item->bChatActive != 2)) return;
+ if (!item || !user || (item->bChatActive != 2)) return;
- TCHAR buf[512] = _T("");
+ CMString buf;
switch (type) {
case INFO_BAN:
if (m_options.GcLogBans)
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s is now banned."), user->m_tszResourceName);
+ buf.Format(TranslateT("User %s is now banned."), user->m_tszResourceName);
break;
case INFO_STATUS:
if (m_options.GcLogStatuses) {
TCHAR *ptszDescr = pcli->pfnGetStatusModeDescription(user->m_iStatus, 0);
if (user->m_tszStatusMessage)
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s with message: %s"),
+ buf.Format(TranslateT("User %s changed status to %s with message: %s"),
user->m_tszResourceName, ptszDescr, user->m_tszStatusMessage);
else
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("User %s changed status to %s"), user->m_tszResourceName, ptszDescr);
+ buf.Format(TranslateT("User %s changed status to %s"), user->m_tszResourceName, ptszDescr);
}
break;
case INFO_CONFIG:
if (m_options.GcLogConfig)
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Room configuration was changed."));
+ buf.Format(TranslateT("Room configuration was changed."));
break;
case INFO_AFFILIATION:
@@ -222,7 +222,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
case AFFILIATION_OUTCAST: name = TranslateT("Outcast"); break;
}
if (name)
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Affiliation of %s was changed to '%s'."), user->m_tszResourceName, name);
+ buf.Format(TranslateT("Affiliation of %s was changed to '%s'."), user->m_tszResourceName, name);
}
break;
@@ -237,22 +237,22 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
}
if (name)
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("Role of %s was changed to '%s'."), user->m_tszResourceName, name);
+ buf.Format(TranslateT("Role of %s was changed to '%s'."), user->m_tszResourceName, name);
}
break;
}
- if (*buf) {
+ if (!buf.IsEmpty()) {
+ buf.Replace(_T("%"), _T("%%"));
+
GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszNick = user->m_tszResourceName;
gce.ptszUID = user->m_tszResourceName;
- gce.ptszText = EscapeChatTags(buf);
+ gce.ptszText = buf;
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(0);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
-
- mir_free((void*)gce.ptszText); // Since we processed msgText and created a new string
}
}
@@ -383,14 +383,14 @@ static gc_item *sttFindGcMenuItem(GCMENUITEMS *items, DWORD id)
static void sttSetupGcMenuItem(GCMENUITEMS *items, DWORD id, bool disabled)
{
for (int i=0; i < items->nItems; i++)
- if ( !id || (items->Item[i].dwID == id))
+ if (!id || (items->Item[i].dwID == id))
items->Item[i].bDisabled = disabled;
}
static void sttShowGcMenuItem(GCMENUITEMS *items, DWORD id, int type)
{
for (int i=0; i < items->nItems; i++)
- if ( !id || (items->Item[i].dwID == id))
+ if (!id || (items->Item[i].dwID == id))
items->Item[i].uType = type;
}
@@ -519,8 +519,8 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
pResourceStatus me(NULL), him(NULL);
for (int i=0; i < item->arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *p = item->arResources[i];
- if ( !lstrcmp(p->m_tszResourceName, item->nick)) me = p;
- if ( !lstrcmp(p->m_tszResourceName, gcmi->pszUID)) him = p;
+ if (!lstrcmp(p->m_tszResourceName, item->nick)) me = p;
+ if (!lstrcmp(p->m_tszResourceName, gcmi->pszUID)) him = p;
}
if (gcmi->Type == MENU_ON_LOG) {
@@ -554,7 +554,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
for (; idx <= IDM_LINK9; ++idx)
sttFindGcMenuItem(gcmi, idx)->uType = 0;
- if ( !GetAsyncKeyState(VK_CONTROL)) {
+ if (!GetAsyncKeyState(VK_CONTROL)) {
if (me) {
sttSetupGcMenuItems(gcmi, sttModeratorItems, (me->m_role < ROLE_MODERATOR));
sttSetupGcMenuItems(gcmi, sttAdminItems, (me->m_affiliation < AFFILIATION_ADMIN));
@@ -622,7 +622,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam)
sttSetupGcMenuItem(gcmi, IDM_CPY_RJID, TRUE);
}
- if ( !force) {
+ if (!force) {
if (me->m_role < ROLE_MODERATOR || (me->m_affiliation <= him->m_affiliation))
sttSetupGcMenuItem(gcmi, IDM_KICK, TRUE);
@@ -727,9 +727,7 @@ public:
{
CSuper::OnInitDialog();
- TCHAR buf[256];
- mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s\nSend group chat invitation."), m_room);
- SetDlgItemText(m_hwnd, IDC_HEADERBAR, buf);
+ SetDlgItemText(m_hwnd, IDC_HEADERBAR, CMString().Format(TranslateT("%s\nSend group chat invitation."), m_room));
WindowSetIcon(m_hwnd, m_proto, "group");
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE,
@@ -756,7 +754,7 @@ public:
int i;
for (i=0; i < m_newJids.getCount(); i++)
- if ( !lstrcmp(m_newJids[i]->jid, buf))
+ if (!lstrcmp(m_newJids[i]->jid, buf))
break;
if (i != m_newJids.getCount())
return;
@@ -1004,8 +1002,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
enum { BAN_KICK_INTERVAL = 1000 };
static DWORD dwLastBanKickTime = 0;
- TCHAR szBuffer[1024];
- TCHAR szTitle[256];
+ CMString szBuffer, szTitle;
if ((gch->dwData >= CLISTMENUIDMIN) && (gch->dwData <= CLISTMENUIDMAX)) {
if (him->m_tszRealJid && *him->m_tszRealJid)
@@ -1065,10 +1062,10 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
case IDM_KICK:
if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
dwLastBanKickTime = GetTickCount();
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s: "), me->m_tszResourceName);
- mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Reason to kick %s"), him->m_tszResourceName);
+ szBuffer.Format(_T("%s: "), me->m_tszResourceName);
+ szTitle.Format(TranslateT("Reason to kick %s"), him->m_tszResourceName);
TCHAR *resourceName_copy = mir_tstrdup(him->m_tszResourceName); // copy resource name to prevent possible crash if user list rebuilds
- if (ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE, "gcReason_"))
+ if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
<< XCHILD(_T("item")) << XATTR(_T("nick"), resourceName_copy) << XATTR(_T("role"), _T("none"))
@@ -1144,15 +1141,14 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
TCHAR szVictimBareJid[JABBER_MAX_JID_LEN];
JabberStripJid(him->m_tszRealJid, szVictimBareJid, SIZEOF(szVictimBareJid));
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s: "), me->m_tszResourceName);
- mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Reason to ban %s"), him->m_tszResourceName);
+ szBuffer.Format(_T("%s: "), me->m_tszResourceName);
+ szTitle.Format(TranslateT("Reason to ban %s"), him->m_tszResourceName);
- if (ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE, "gcReason_")) {
+ if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
XmlNodeIq(_T("set"), ppro->SerialNext(), item->jid) << XQUERY(JABBER_FEAT_MUC_ADMIN)
<< XCHILD(_T("item")) << XATTR(_T("jid"), szVictimBareJid) << XATTR(_T("affiliation"), _T("outcast"))
<< XCHILD(_T("reason"), szBuffer));
- }
}
}
dwLastBanKickTime = GetTickCount();
@@ -1168,7 +1164,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
LISTFOREACH(i, ppro, LIST_CHATROOM)
{
if (JABBER_LIST_ITEM *item = ppro->ListGetItemPtrFromIndex(i))
- if ( !idx--) {
+ if (!idx--) {
szInviteTo = item->jid;
break;
}
@@ -1176,12 +1172,11 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
if (!szInviteTo) break;
- mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Invite %s to %s"), him->m_tszResourceName, szInviteTo);
- *szBuffer = 0;
- if (!ppro->EnterString(szBuffer, SIZEOF(szBuffer), szTitle, JES_MULTINE))
+ szTitle.Format(TranslateT("Invite %s to %s"), him->m_tszResourceName, szInviteTo);
+ if (!ppro->EnterString(szBuffer, szTitle, JES_MULTILINE))
break;
- mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s/%s"), item->jid, resourceName_copy);
+ szTitle.Format(_T("%s/%s"), item->jid, resourceName_copy);
XmlNode msg(_T("message"));
HXML invite = msg << XATTR(_T("to"), szTitle) << XATTRID(ppro->SerialNext())
@@ -1204,7 +1199,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
break;
case IDM_CPY_INROOMJID:
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s/%s"), item->jid, him->m_tszResourceName);
+ szBuffer.Format(_T("%s/%s"), item->jid, him->m_tszResourceName);
JabberCopyText((HWND)CallService(MS_CLUI_GETHWND, 0, 0), szBuffer);
break;
@@ -1245,8 +1240,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* gch)
{
- TCHAR szCaption[1024], szBuffer[1024];
- szBuffer[0] = 0;
+ CMString szBuffer, szTitle;
switch (gch->dwData) {
case IDM_LST_PARTICIPANT:
@@ -1274,37 +1268,20 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
break;
case IDM_TOPIC:
- mir_sntprintf(szCaption, SIZEOF(szCaption), TranslateT("Set topic for %s"), gch->pDest->ptszID);
- {
- LPCTSTR s = item->getTemp()->m_tszStatusMessage;
- size_t cbLen = 2048 + lstrlen(s) * 2;
- TCHAR *ptszBuf = (TCHAR*)_alloca(sizeof(TCHAR)* cbLen);
- if (s) {
- TCHAR *d = ptszBuf;
- for (size_t i = 0; i < cbLen && s[i] != 0; i++) {
- if (s[i] != '\n' || (i && s[i - 1] == '\r'))
- *d++ = s[i];
- else {
- *d++ = '\r';
- *d++ = '\n';
- }
- }
- *d = 0;
- }
- else *ptszBuf = 0;
-
- if (ppro->EnterString(ptszBuf, cbLen, szCaption, JES_RICHEDIT, "gcTopic_"))
- ppro->m_ThreadInfo->send(
+ szTitle.Format(TranslateT("Set topic for %s"), gch->pDest->ptszID);
+ szBuffer = item->getTemp()->m_tszStatusMessage;
+ szBuffer.Replace(_T("\n"), _T("\r\n"));
+ if (ppro->EnterString(szBuffer, szTitle, JES_RICHEDIT, "gcTopic_"))
+ ppro->m_ThreadInfo->send(
XmlNode(_T("message")) << XATTR(_T("to"), gch->pDest->ptszID) << XATTR(_T("type"), _T("groupchat"))
- << XCHILD(_T("subject"), ptszBuf));
- }
+ << XCHILD(_T("subject"), szBuffer));
break;
case IDM_NICK:
- mir_sntprintf(szCaption, SIZEOF(szCaption), TranslateT("Change nickname in %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Change nickname in %s"), gch->pDest->ptszID);
if (item->nick)
- _tcsncpy_s(szBuffer, SIZEOF(szBuffer), item->nick, _TRUNCATE);
- if (ppro->EnterString(szBuffer, SIZEOF(szBuffer), szCaption, JES_COMBO, "gcNick_")) {
+ szBuffer = item->nick;
+ if (ppro->EnterString(szBuffer, szTitle, JES_COMBO, "gcNick_")) {
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
if (item != NULL) {
TCHAR text[1024];
@@ -1339,13 +1316,11 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
break;
}
case IDM_DESTROY:
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
- if (!ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_MULTINE, "gcReason_"))
- break;
-
- ppro->m_ThreadInfo->send(
- XmlNodeIq(_T("set"), ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
- << XCHILD(_T("destroy")) << XCHILD(_T("reason"), szBuffer));
+ szTitle.Format(TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
+ if (ppro->EnterString(szBuffer, szTitle, JES_MULTILINE, "gcReason_"))
+ ppro->m_ThreadInfo->send(
+ XmlNodeIq(_T("set"), ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
+ << XCHILD(_T("destroy")) << XCHILD(_T("reason"), szBuffer));
case IDM_LEAVE:
ppro->GcQuit(item, 0, NULL);
@@ -1465,7 +1440,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////////////
-void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str, TCHAR* rsn)
+void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn)
{
const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? _T("jid") : _T("nick");
TCHAR *roomJid = jidListInfo->roomJid;
@@ -1475,7 +1450,7 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* s
}
}
-void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str)
+void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str)
{
const TCHAR *field = (jidListInfo->type == MUC_BANLIST || _tcschr(str, '@')) ? _T("jid") : _T("nick");
TCHAR *roomJid = jidListInfo->roomJid;
@@ -1508,7 +1483,7 @@ void CJabberProto::AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* s
}
}
-void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* jid)
+void CJabberProto::DeleteMucListItem(JABBER_MUC_JIDLIST_INFO *jidListInfo, const TCHAR *jid)
{
TCHAR *roomJid = jidListInfo->roomJid;
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 2e48555cbf..10f6663c31 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -107,57 +107,46 @@ bool CJabberProto::RecursiveCheckFilter(HXML node, DWORD flags)
{
int i;
- for (i=0; i < xmlGetAttrCount(node); i++)
- {
- if (JabberStrIStr(xmlGetAttr(node,i), m_filterInfo.pattern))
+ for (i = 0; i < xmlGetAttrCount(node); i++)
+ if (JabberStrIStr(xmlGetAttr(node, i), m_filterInfo.pattern))
return true;
- }
- for (i=0; i < xmlGetChildCount(node); i++) {
+ for (i = 0; i < xmlGetChildCount(node); i++)
if (RecursiveCheckFilter(xmlGetChild(node, i), flags))
return true;
- }
return false;
}
bool CJabberProto::FilterXml(HXML node, DWORD flags)
{
- if ( !m_filterInfo.msg && !lstrcmp(xmlGetName(node), _T("message"))) return false;
- if ( !m_filterInfo.presence && !lstrcmp(xmlGetName(node), _T("presence"))) return false;
- if ( !m_filterInfo.iq && !lstrcmp(xmlGetName(node), _T("iq"))) return false;
+ if (!m_filterInfo.msg && !lstrcmp(xmlGetName(node), _T("message"))) return false;
+ if (!m_filterInfo.presence && !lstrcmp(xmlGetName(node), _T("presence"))) return false;
+ if (!m_filterInfo.iq && !lstrcmp(xmlGetName(node), _T("iq"))) return false;
if (m_filterInfo.type == TFilterInfo::T_OFF) return true;
bool result = false;
EnterCriticalSection(&m_filterInfo.csPatternLock);
- switch (m_filterInfo.type)
- {
- case TFilterInfo::T_JID:
- {
- const TCHAR *attrValue = xmlGetAttrValue(node,(flags&JCPF_OUT)?_T("to"):_T("from"));
- if ( !attrValue) break;
-
+ const TCHAR *attrValue;
+ switch (m_filterInfo.type) {
+ case TFilterInfo::T_JID:
+ attrValue = xmlGetAttrValue(node, (flags & JCPF_OUT) ? _T("to") : _T("from"));
+ if (attrValue)
result = JabberStrIStr(attrValue, m_filterInfo.pattern) ? true : false;
- break;
- }
- case TFilterInfo::T_XMLNS:
- {
- if ( !xmlGetChildCount(node)) break;
-
- const TCHAR *attrValue = xmlGetAttrValue(xmlGetChild(node, 0), _T("xmlns"));
- if ( !attrValue)
- break;
+ break;
- result = JabberStrIStr(attrValue, m_filterInfo.pattern) ? true : false;
- break;
+ case TFilterInfo::T_XMLNS:
+ if (xmlGetChildCount(node)) {
+ attrValue = xmlGetAttrValue(xmlGetChild(node, 0), _T("xmlns"));
+ if (attrValue)
+ result = JabberStrIStr(attrValue, m_filterInfo.pattern) ? true : false;
}
+ break;
- case TFilterInfo::T_ANY:
- {
- result = RecursiveCheckFilter(node, flags);
- break;
- }
+ case TFilterInfo::T_ANY:
+ result = RecursiveCheckFilter(node, flags);
+ break;
}
LeaveCriticalSection(&m_filterInfo.csPatternLock);
@@ -166,11 +155,10 @@ bool CJabberProto::FilterXml(HXML node, DWORD flags)
static void sttAppendBufRaw(StringBuf *buf, const char *str)
{
- if ( !str) return;
+ if (!str) return;
int length = lstrlenA(str);
- if (buf->size - buf->offset < length+1)
- {
+ if (buf->size - buf->offset < length + 1) {
buf->size += (length + STRINGBUF_INCREMENT);
buf->buf = (char *)mir_realloc(buf->buf, buf->size);
}
@@ -182,25 +170,21 @@ static void sttAppendBufW(StringBuf *buf, const WCHAR *str)
{
char tmp[32];
- if ( !str) return;
+ if (!str) return;
sttAppendBufRaw(buf, "{\\uc1 ");
- for (const WCHAR *p = str; *p; ++p)
- {
- if ((*p == '\\') || (*p == '{') || (*p == '}'))
- {
+ for (const WCHAR *p = str; *p; ++p) {
+ if ((*p == '\\') || (*p == '{') || (*p == '}')) {
tmp[0] = '\\';
tmp[1] = (char)*p;
tmp[2] = 0;
- } else
- if (*p < 128)
- {
+ }
+ else if (*p < 128) {
tmp[0] = (char)*p;
tmp[1] = 0;
- } else
- {
- mir_snprintf(tmp, sizeof(tmp), "\\u%d ?", (int)*p);
}
+ else mir_snprintf(tmp, sizeof(tmp), "\\u%d ?", (int)*p);
+
sttAppendBufRaw(buf, tmp);
}
sttAppendBufRaw(buf, "}");
@@ -216,11 +200,8 @@ static void sttEmptyBuf(StringBuf *buf)
static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
- int i;
char *indentLevel = (char *)mir_alloc(128);
- mir_snprintf(indentLevel, 128, RTF_INDENT_FMT,
- (int)(indent*200)
- );
+ mir_snprintf(indentLevel, 128, RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -231,8 +212,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
sttAppendBufW(buf, (TCHAR*)xmlGetName(node));
sttAppendBufRaw(buf, RTF_ENDTAGNAME);
- for (i=0; i < xmlGetAttrCount(node); i++)
- {
+ for (int i = 0; i < xmlGetAttrCount(node); i++) {
TCHAR *attr = (TCHAR*)xmlGetAttrName(node, i);
sttAppendBufRaw(buf, " ");
sttAppendBufRaw(buf, RTF_BEGINATTRNAME);
@@ -245,17 +225,14 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
sttAppendBufRaw(buf, RTF_ENDATTRVAL);
}
- if (xmlGetChild(node) || xmlGetText(node))
- {
+ if (xmlGetChild(node) || xmlGetText(node)) {
sttAppendBufRaw(buf, ">");
if (xmlGetChild(node))
sttAppendBufRaw(buf, RTF_ENDTAG);
}
- if (xmlGetText(node))
- {
- if (xmlGetChildCount(node))
- {
+ if (xmlGetText(node)) {
+ if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
char *indentTextLevel = (char *)mir_alloc(128);
mir_snprintf(indentTextLevel, 128, RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
@@ -268,11 +245,10 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
sttAppendBufRaw(buf, RTF_ENDTEXT);
}
- for (i=0; i < xmlGetChildCount(node) ; i++)
- sttRtfAppendXml(buf, xmlGetChild(node ,i), flags & ~(JCPF_IN|JCPF_OUT), indent+1);
+ for (int i = 0; i < xmlGetChildCount(node); i++)
+ sttRtfAppendXml(buf, xmlGetChild(node, i), flags & ~(JCPF_IN | JCPF_OUT), indent + 1);
- if (xmlGetChildCount(node) || xmlGetText(node))
- {
+ if (xmlGetChildCount(node) || xmlGetText(node)) {
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
sttAppendBufRaw(buf, "</");
@@ -280,10 +256,8 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
sttAppendBufT(buf, xmlGetName(node));
sttAppendBufRaw(buf, RTF_ENDTAGNAME);
sttAppendBufRaw(buf, ">");
- } else
- {
- sttAppendBufRaw(buf, " />");
}
+ else sttAppendBufRaw(buf, " />");
sttAppendBufRaw(buf, RTF_ENDTAG);
mir_free(indentLevel);
@@ -294,8 +268,7 @@ DWORD CALLBACK sttStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, L
StringBuf *buf = (StringBuf *)dwCookie;
*pcb = 0;
- if (buf->streamOffset < buf->offset)
- {
+ if (buf->streamOffset < buf->offset) {
*pcb = min(cb, buf->offset - buf->streamOffset);
memcpy(pbBuff, buf->buf + buf->streamOffset, *pcb);
buf->streamOffset += *pcb;
@@ -332,12 +305,14 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo)
///////////////////////////////////////////////////////////////////////////////
// CJabberDlgConsole class
-static struct
+
+struct
{
int type;
TCHAR *title;
char *icon;
-} filter_modes[] =
+}
+static filter_modes[] =
{
{ TFilterInfo::T_JID, _T("JID"), "main" },
{ TFilterInfo::T_XMLNS, _T("xmlns"), "xmlconsole" },
@@ -387,20 +362,21 @@ void CJabberDlgConsole::OnInitDialog()
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetWindowText(GetDlgItem(m_hwnd, IDC_CB_FILTER), m_proto->m_filterInfo.pattern);
- static struct
+ struct
{
int idc;
char *title;
char *icon;
bool push;
BOOL pushed;
- } buttons[] =
+ }
+ static buttons[] =
{
- {IDC_BTN_MSG, "Messages", "pl_msg_allow", true, m_proto->m_filterInfo.msg},
- {IDC_BTN_PRESENCE, "Presences", "pl_prin_allow", true, m_proto->m_filterInfo.presence},
- {IDC_BTN_IQ, "Queries", "pl_iq_allow", true, m_proto->m_filterInfo.iq},
- {IDC_BTN_FILTER, "Filter mode", "sd_filter_apply", true, FALSE},
- {IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
+ { IDC_BTN_MSG, "Messages", "pl_msg_allow", true, m_proto->m_filterInfo.msg},
+ { IDC_BTN_PRESENCE, "Presences", "pl_prin_allow", true, m_proto->m_filterInfo.presence},
+ { IDC_BTN_IQ, "Queries", "pl_iq_allow", true, m_proto->m_filterInfo.iq},
+ { IDC_BTN_FILTER, "Filter mode", "sd_filter_apply", true, FALSE},
+ { IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
};
int i;
@@ -476,15 +452,12 @@ void CJabberDlgConsole::OnProtoRefresh(WPARAM, LPARAM lParam)
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_EXSETSEL, 0, (LPARAM)&oldSel);
// magic expression from tabsrmm :)
- if ((UINT)si.nPos >= (UINT)si.nMax-si.nPage-5 || si.nMax-si.nMin-si.nPage < 50)
- {
+ if ((UINT)si.nPos >= (UINT)si.nMax - si.nPage - 5 || si.nMax - si.nMin - si.nPage < 50) {
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
sel.cpMin = sel.cpMax = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_CONSOLE));
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_EXSETSEL, 0, (LPARAM)&sel);
- } else
- {
- SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_SETSCROLLPOS, 0, (LPARAM)&ptScroll);
}
+ else SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_SETSCROLLPOS, 0, (LPARAM)&ptScroll);
SendDlgItemMessage(m_hwnd, IDC_CONSOLE, WM_SETREDRAW, TRUE, 0);
InvalidateRect(GetDlgItem(m_hwnd, IDC_CONSOLE), NULL, FALSE);
@@ -492,42 +465,38 @@ void CJabberDlgConsole::OnProtoRefresh(WPARAM, LPARAM lParam)
int CJabberDlgConsole::Resizer(UTILRESIZECONTROL *urc)
{
- switch (urc->wId)
- {
- case IDC_CONSOLE:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
- case IDC_CONSOLEIN:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
-
- case IDC_BTN_MSG:
- case IDC_BTN_PRESENCE:
- case IDC_BTN_IQ:
- case IDC_BTN_FILTER:
- return RD_ANCHORX_LEFT|RD_ANCHORY_BOTTOM;
-
- case IDC_CB_FILTER:
- {
- RECT rc;
- GetWindowRect(GetDlgItem(m_hwnd, urc->wId), &rc);
- urc->rcItem.right += (urc->dlgNewSize.cx - urc->dlgOriginalSize.cx);
- urc->rcItem.top += (urc->dlgNewSize.cy - urc->dlgOriginalSize.cy);
- urc->rcItem.bottom = urc->rcItem.top + rc.bottom - rc.top;
- return 0;
- }
-
- case IDC_RESET:
- case IDOK:
- case IDC_BTN_FILTER_REFRESH:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ switch (urc->wId) {
+ case IDC_CONSOLE:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
+ case IDC_CONSOLEIN:
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+
+ case IDC_BTN_MSG:
+ case IDC_BTN_PRESENCE:
+ case IDC_BTN_IQ:
+ case IDC_BTN_FILTER:
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
+
+ case IDC_RESET:
+ case IDOK:
+ case IDC_BTN_FILTER_REFRESH:
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
+
+ case IDC_CB_FILTER:
+ RECT rc;
+ GetWindowRect(GetDlgItem(m_hwnd, urc->wId), &rc);
+ urc->rcItem.right += (urc->dlgNewSize.cx - urc->dlgOriginalSize.cx);
+ urc->rcItem.top += (urc->dlgNewSize.cy - urc->dlgOriginalSize.cy);
+ urc->rcItem.bottom = urc->rcItem.top + rc.bottom - rc.top;
+ return 0;
}
return CSuper::Resizer(urc);
}
INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_GETMINMAXINFO:
+ switch (msg) {
+ case WM_GETMINMAXINFO:
{
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
lpmmi->ptMinTrackSize.x = 300;
@@ -535,131 +504,104 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- {
- if ( !m_proto->m_bJabberOnline)
- {
- MessageBox(m_hwnd, TranslateT("Can't send data while you are offline."), TranslateT("Jabber Error"), MB_ICONSTOP|MB_OK);
- return TRUE;
- }
-
- int length = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_CONSOLEIN)) + 1;
- TCHAR *textToSend = (TCHAR *)mir_alloc(length * sizeof(TCHAR));
- GetWindowText(GetDlgItem(m_hwnd, IDC_CONSOLEIN), textToSend, length);
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ if (!m_proto->m_bJabberOnline)
+ MessageBox(m_hwnd, TranslateT("Can't send data while you are offline."), TranslateT("Jabber Error"), MB_ICONSTOP | MB_OK);
+ else {
+ int length = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_CONSOLEIN)) + 1;
+ TCHAR *textToSend = (TCHAR *)mir_alloc(length * sizeof(TCHAR));
+ GetWindowText(GetDlgItem(m_hwnd, IDC_CONSOLEIN), textToSend, length);
+
+ int bytesProcessed = 0;
+ XmlNode xmlTmp(textToSend, &bytesProcessed, NULL);
+ if (xmlTmp)
+ m_proto->m_ThreadInfo->send(xmlTmp);
+ else {
+ StringBuf buf = { 0 };
+ sttAppendBufRaw(&buf, RTF_HEADER);
+ sttAppendBufRaw(&buf, RTF_BEGINPLAINXML);
+ sttAppendBufT(&buf, TranslateT("Outgoing XML parsing error"));
+ sttAppendBufRaw(&buf, RTF_ENDPLAINXML);
+ sttAppendBufRaw(&buf, RTF_SEPARATOR);
+ sttAppendBufRaw(&buf, RTF_FOOTER);
+ SendMessage(m_hwnd, WM_JABBER_REFRESH, 0, (LPARAM)&buf);
+ sttEmptyBuf(&buf);
+ }
- int bytesProcessed = 0;
- XmlNode xmlTmp(textToSend, &bytesProcessed, NULL);
- if (xmlTmp)
- {
- m_proto->m_ThreadInfo->send(xmlTmp);
- }
- else
- {
- StringBuf buf = {0};
- sttAppendBufRaw(&buf, RTF_HEADER);
- sttAppendBufRaw(&buf, RTF_BEGINPLAINXML);
- sttAppendBufT(&buf, TranslateT("Outgoing XML parsing error"));
- sttAppendBufRaw(&buf, RTF_ENDPLAINXML);
- sttAppendBufRaw(&buf, RTF_SEPARATOR);
- sttAppendBufRaw(&buf, RTF_FOOTER);
- SendMessage(m_hwnd, WM_JABBER_REFRESH, 0, (LPARAM)&buf);
- sttEmptyBuf(&buf);
- }
+ mir_free(textToSend);
- mir_free(textToSend);
+ SendDlgItemMessage(m_hwnd, IDC_CONSOLEIN, WM_SETTEXT, 0, (LPARAM)_T(""));
+ }
+ return TRUE;
- SendDlgItemMessage(m_hwnd, IDC_CONSOLEIN, WM_SETTEXT, 0, (LPARAM)_T(""));
- return TRUE;
- }
+ case IDC_RESET:
+ SetDlgItemText(m_hwnd, IDC_CONSOLE, _T(""));
+ break;
- case IDC_RESET:
- {
- SetDlgItemText(m_hwnd, IDC_CONSOLE, _T(""));
- break;
- }
+ case IDC_BTN_MSG:
+ case IDC_BTN_PRESENCE:
+ case IDC_BTN_IQ:
+ m_proto->m_filterInfo.msg = IsDlgButtonChecked(m_hwnd, IDC_BTN_MSG);
+ m_proto->m_filterInfo.presence = IsDlgButtonChecked(m_hwnd, IDC_BTN_PRESENCE);
+ m_proto->m_filterInfo.iq = IsDlgButtonChecked(m_hwnd, IDC_BTN_IQ);
+ break;
- case IDC_BTN_MSG:
- case IDC_BTN_PRESENCE:
- case IDC_BTN_IQ:
- {
- m_proto->m_filterInfo.msg = IsDlgButtonChecked(m_hwnd, IDC_BTN_MSG);
- m_proto->m_filterInfo.presence = IsDlgButtonChecked(m_hwnd, IDC_BTN_PRESENCE);
- m_proto->m_filterInfo.iq = IsDlgButtonChecked(m_hwnd, IDC_BTN_IQ);
- break;
- }
+ case IDC_BTN_FILTER_REFRESH:
+ sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
+ break;
- case IDC_BTN_FILTER_REFRESH:
- {
- sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
- break;
- }
+ case IDC_CB_FILTER:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ int idx = SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETCURSEL, 0, 0);
+ int len = SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXTLEN, idx, 0) + 1;
- case IDC_BTN_FILTER:
- {
- int i;
- HMENU hMenu = CreatePopupMenu();
- for (i=0; i < SIZEOF(filter_modes); i++)
- {
- AppendMenu(hMenu,
- MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
- filter_modes[i].type+1, TranslateTS(filter_modes[i].title));
- }
- RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BTN_FILTER), &rc);
- CheckDlgButton(m_hwnd, IDC_BTN_FILTER, TRUE);
- int res = TrackPopupMenu(hMenu, TPM_RETURNCMD|TPM_BOTTOMALIGN, rc.left, rc.top, 0, m_hwnd, NULL);
- CheckDlgButton(m_hwnd, IDC_BTN_FILTER, FALSE);
- DestroyMenu(hMenu);
-
- if (res)
- {
- m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
- for (i=0; i < SIZEOF(filter_modes); i++)
- if (filter_modes[i].type == m_proto->m_filterInfo.type)
- {
- g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
- break;
- }
- EnableWindow(GetDlgItem(m_hwnd, IDC_CB_FILTER), (m_proto->m_filterInfo.type == TFilterInfo::T_OFF) ? FALSE : TRUE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_BTN_FILTER_REFRESH), (m_proto->m_filterInfo.type == TFilterInfo::T_OFF) ? FALSE : TRUE);
- }
+ EnterCriticalSection(&m_proto->m_filterInfo.csPatternLock);
- break;
+ if (len > SIZEOF(m_proto->m_filterInfo.pattern)) {
+ TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
+ SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
+ lstrcpyn(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
}
+ else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
+
+ LeaveCriticalSection(&m_proto->m_filterInfo.csPatternLock);
+ }
+ else if (HIWORD(wParam) == CBN_EDITCHANGE) {
+ EnterCriticalSection(&m_proto->m_filterInfo.csPatternLock);
+ GetWindowText(GetDlgItem(m_hwnd, IDC_CB_FILTER), m_proto->m_filterInfo.pattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ LeaveCriticalSection(&m_proto->m_filterInfo.csPatternLock);
+ }
+ break;
- case IDC_CB_FILTER:
- {
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- int idx = SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETCURSEL, 0, 0);
- int len = SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXTLEN, idx, 0) + 1;
-
- EnterCriticalSection(&m_proto->m_filterInfo.csPatternLock);
- if (len > SIZEOF(m_proto->m_filterInfo.pattern))
- {
- TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
- SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- lstrcpyn(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
- } else
- {
- SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
- }
- LeaveCriticalSection(&m_proto->m_filterInfo.csPatternLock);
- } else
- if (HIWORD(wParam) == CBN_EDITCHANGE)
- {
- EnterCriticalSection(&m_proto->m_filterInfo.csPatternLock);
- GetWindowText(GetDlgItem(m_hwnd, IDC_CB_FILTER), m_proto->m_filterInfo.pattern, SIZEOF(m_proto->m_filterInfo.pattern));
- LeaveCriticalSection(&m_proto->m_filterInfo.csPatternLock);
+ case IDC_BTN_FILTER:
+ int i;
+ HMENU hMenu = CreatePopupMenu();
+ for (i = 0; i < SIZEOF(filter_modes); i++)
+ AppendMenu(hMenu,
+ MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
+ filter_modes[i].type + 1, TranslateTS(filter_modes[i].title));
+
+ RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_BTN_FILTER), &rc);
+ CheckDlgButton(m_hwnd, IDC_BTN_FILTER, TRUE);
+ int res = TrackPopupMenu(hMenu, TPM_RETURNCMD | TPM_BOTTOMALIGN, rc.left, rc.top, 0, m_hwnd, NULL);
+ CheckDlgButton(m_hwnd, IDC_BTN_FILTER, FALSE);
+ DestroyMenu(hMenu);
+
+ if (res) {
+ m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
+ for (i = 0; i < SIZEOF(filter_modes); i++) {
+ if (filter_modes[i].type == m_proto->m_filterInfo.type) {
+ g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
+ break;
}
- break;
}
+ EnableWindow(GetDlgItem(m_hwnd, IDC_CB_FILTER), (m_proto->m_filterInfo.type == TFilterInfo::T_OFF) ? FALSE : TRUE);
+ EnableWindow(GetDlgItem(m_hwnd, IDC_BTN_FILTER_REFRESH), (m_proto->m_filterInfo.type == TFilterInfo::T_OFF) ? FALSE : TRUE);
}
- break;
}
+ break;
}
return CSuper::DlgProc(msg, wParam, lParam);
@@ -707,8 +649,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleConsole(WPARAM, LPARAM)
{
if (m_pDlgConsole)
SetForegroundWindow(m_pDlgConsole->GetHwnd());
- else
- if (m_hThreadConsole)
- PostThreadMessage(m_dwConsoleThreadId, WM_CREATECONSOLE, 0, 0);
+ else if (m_hThreadConsole)
+ PostThreadMessage(m_dwConsoleThreadId, WM_CREATECONSOLE, 0, 0);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp
index 22a1925bed..37dbbdb54a 100644
--- a/protocols/JabberG/src/jabber_disco.cpp
+++ b/protocols/JabberG/src/jabber_disco.cpp
@@ -170,7 +170,7 @@ void CJabberProto::OnIqResultServiceDiscoveryInfo(HXML iqNode, CJabberIqInfo *pI
{
m_SDManager.Lock();
CJabberSDNode *pNode = m_SDManager.FindByIqId(pInfo->GetIqId(), TRUE);
- if ( !pNode) {
+ if (!pNode) {
m_SDManager.Unlock();
return;
}
@@ -216,7 +216,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p
{
m_SDManager.Lock();
CJabberSDNode *pNode = m_SDManager.FindByIqId(pInfo->GetIqId(), FALSE);
- if ( !pNode) {
+ if (!pNode) {
m_SDManager.Unlock();
return;
}
@@ -258,7 +258,7 @@ void CJabberProto::OnIqResultServiceDiscoveryItems(HXML iqNode, CJabberIqInfo *p
void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !pInfo->m_pUserData) return;
+ if (!pInfo->m_pUserData) return;
m_SDManager.Lock();
if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
HXML query = xmlGetChild(iqNode , "query");
@@ -266,7 +266,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo
HXML feature;
int i;
for (i = 1; (feature = xmlGetNthChild(query, _T("feature"), i)) != NULL; i++) {
- if ( !lstrcmp(xmlGetAttrValue(feature, _T("var")), (TCHAR *)pInfo->m_pUserData)) {
+ if (!lstrcmp(xmlGetAttrValue(feature, _T("var")), (TCHAR *)pInfo->m_pUserData)) {
CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(pInfo->GetReceiver(), xmlGetAttrValue(iqNode, _T("node")), NULL);
SendBothRequests(pNode, NULL);
break;
@@ -278,7 +278,7 @@ void CJabberProto::OnIqResultServiceDiscoveryRootInfo(HXML iqNode, CJabberIqInfo
void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !pInfo->m_pUserData)
+ if (!pInfo->m_pUserData)
return;
XmlNode packet(NULL);
@@ -306,11 +306,11 @@ void CJabberProto::OnIqResultServiceDiscoveryRootItems(HXML iqNode, CJabberIqInf
BOOL CJabberProto::SendInfoRequest(CJabberSDNode *pNode, HXML parent)
{
- if ( !pNode || !m_bJabberOnline)
+ if (!pNode || !m_bJabberOnline)
return FALSE;
// disco#info
- if ( !pNode->GetInfoRequestId()) {
+ if (!pNode->GetInfoRequestId()) {
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetInfoRequestId(pInfo->GetIqId());
@@ -336,11 +336,11 @@ BOOL CJabberProto::SendInfoRequest(CJabberSDNode *pNode, HXML parent)
BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent)
{
- if ( !pNode || !m_bJabberOnline)
+ if (!pNode || !m_bJabberOnline)
return FALSE;
// disco#info
- if ( !pNode->GetInfoRequestId()) {
+ if (!pNode->GetInfoRequestId()) {
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryInfo, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetInfoRequestId(pInfo->GetIqId());
@@ -357,7 +357,7 @@ BOOL CJabberProto::SendBothRequests(CJabberSDNode *pNode, HXML parent)
}
// disco#items
- if ( !pNode->GetItemsRequestId()) {
+ if (!pNode->GetItemsRequestId()) {
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryItems, JABBER_IQ_TYPE_GET, pNode->GetJid());
pInfo->SetTimeout(30000);
pNode->SetItemsRequestId(pInfo->GetIqId());
@@ -385,9 +385,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
{
TCHAR szJid[JABBER_MAX_JID_LEN];
TCHAR szNode[ 512 ];
- if ( !GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, SIZEOF(szJid)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, SIZEOF(szJid)))
szJid[ 0 ] = 0;
- if ( !GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, SIZEOF(szNode)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, SIZEOF(szNode)))
szNode[ 0 ] = 0;
ComboAddRecentString(hwndDlg, IDC_COMBO_JID, "discoWnd_rcJid", szJid);
@@ -399,7 +399,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
m_SDManager.Lock();
m_SDManager.RemoveAll();
- if ( !lstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
+ if (!lstrcmp(szJid, _T(SD_FAKEJID_MYAGENTS))) {
sttBrowseMode = SD_BROWSE_MYAGENTS;
JABBER_LIST_ITEM *item = NULL;
LISTFOREACH(i, this, LIST_ROSTER)
@@ -417,7 +417,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
SendBothRequests(pNode, NULL);
} }
} }
- else if ( !lstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
+ else if (!lstrcmp(szJid, _T(SD_FAKEJID_CONFERENCES))) {
sttBrowseMode = SD_BROWSE_CONFERENCES;
TCHAR *szServerJid = mir_a2t(m_ThreadInfo->server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
@@ -428,7 +428,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if ( !lstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
+ else if (!lstrcmp(szJid, _T(SD_FAKEJID_AGENTS))) {
sttBrowseMode = SD_BROWSE_AGENTS;
TCHAR *szServerJid = mir_a2t(m_ThreadInfo->server);
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultServiceDiscoveryRootItems, JABBER_IQ_TYPE_GET, szServerJid);
@@ -439,7 +439,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg)
m_ThreadInfo->send(iq);
mir_free(szServerJid);
}
- else if ( !lstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
+ else if (!lstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) {
sttBrowseMode = SD_BROWSE_FAVORITES;
int count = getDword("discoWnd_favCount", 0);
for (int i=0; i < count; i++) {
@@ -485,7 +485,7 @@ BOOL CJabberProto::IsNodeRegistered(CJabberSDNode *pNode)
void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
{
- if ( !hItem || !pNode) return;
+ if (!hItem || !pNode) return;
int iIcon = -1, iOverlay = -1;
@@ -509,13 +509,13 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
for (int i=0; i < SIZEOF(sttNodeIcons); i++)
{
- if ( !sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
+ if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
if (sttNodeIcons[i].category)
{
CJabberSDIdentity *iIdentity;
for (iIdentity = pNode->GetFirstIdentity(); iIdentity; iIdentity = iIdentity->GetNext())
- if ( !lstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
+ if (!lstrcmp(iIdentity->GetCategory(), sttNodeIcons[i].category) &&
(!sttNodeIcons[i].type || !lstrcmp(iIdentity->GetType(), sttNodeIcons[i].type)))
{
iIcon = sttNodeIcons[i].listIndex;
@@ -528,7 +528,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
{
CJabberSDFeature *iFeature;
for (iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if ( !lstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature))
+ if (!lstrcmp(iFeature->GetVar(), sttNodeIcons[i].feature))
{
iIcon = sttNodeIcons[i].listIndex;
break;
@@ -542,18 +542,18 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode)
BOOL CJabberProto::SyncTree(HTREELISTITEM hIndex, CJabberSDNode *pNode)
{
- if ( !m_pDlgServiceDiscovery) return FALSE;
+ if (!m_pDlgServiceDiscovery) return FALSE;
CJabberSDNode* pTmp = pNode;
while (pTmp) {
- if ( !pTmp->GetTreeItemHandle()) {
+ if (!pTmp->GetTreeItemHandle()) {
HTREELISTITEM hNewItem = TreeList_AddItem(
GetDlgItem(m_pDlgServiceDiscovery->GetHwnd(), IDC_TREE_DISCO), hIndex,
pTmp->GetName() ? pTmp->GetName() : pTmp->GetJid(),
(LPARAM)pTmp);
TreeList_AppendColumn(hNewItem, pTmp->GetJid());
TreeList_AppendColumn(hNewItem, pTmp->GetNode());
- if ( !pTmp->GetInfoRequestId())
+ if (!pTmp->GetInfoRequestId())
TreeList_MakeFakeParent(hNewItem, TRUE);
else
TreeList_MakeFakeParent(hNewItem, FALSE);
@@ -899,7 +899,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *)
void CJabberDlgDiscovery::btnRefresh_OnClick(CCtrlButton *)
{
HTREELISTITEM hItem = (HTREELISTITEM)TreeList_GetActiveItem(GetDlgItem(m_hwnd, IDC_TREE_DISCO));
- if ( !hItem) return;
+ if (!hItem) return;
m_proto->m_SDManager.Lock();
XmlNode packet(NULL);
@@ -970,7 +970,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
while (pNode)
{
if (pNode->GetJid()) {
- if ( !pNode->GetTreeItemHandle()) {
+ if (!pNode->GetTreeItemHandle()) {
HTREELISTITEM hNewItem = TreeList_AddItem(
GetDlgItem(m_hwnd, IDC_TREE_DISCO), NULL,
pNode->GetName() ? pNode->GetName() : pNode->GetJid(),
@@ -1011,11 +1011,11 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
lvi.mask = LVIF_PARAM;
lvi.iItem = i;
ListView_GetItem(hwndList, &lvi);
- if ( !lvi.lParam)
+ if (!lvi.lParam)
continue;
CJabberSDNode *pNode = (CJabberSDNode *)TreeList_GetData((HTREELISTITEM)lvi.lParam);
- if ( !pNode || pNode->GetInfoRequestId())
+ if (!pNode || pNode->GetInfoRequestId())
continue;
m_proto->SendInfoRequest(pNode, packet);
@@ -1049,9 +1049,9 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
HTREELISTITEM hItem = TreeList_GetActiveItem(hwndList);
- if ( !hItem) break;
+ if (!hItem) break;
CJabberSDNode *pNode = (CJabberSDNode *)TreeList_GetData(hItem);
- if ( !pNode) break;
+ if (!pNode) break;
m_proto->ServiceDiscoveryShowMenu(pNode, hItem, pt);
}
@@ -1116,7 +1116,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case IDOK:
{
HWND hwndFocus = GetFocus();
- if ( !hwndFocus) return TRUE;
+ if (!hwndFocus) return TRUE;
if (GetWindowLongPtr(hwndFocus, GWL_ID) == IDC_TXT_FILTERTEXT)
PostMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_BTN_FILTERAPPLY, 0), 0);
else if (m_hwnd == (hwndFocus = GetParent(hwndFocus)))
@@ -1233,7 +1233,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
continue;
}
- if ( !items[i].feature) {
+ if (!items[i].feature) {
if (items[i].title) {
HANDLE hContact;
if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) {
@@ -1253,7 +1253,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
bool bFeatureOk = !bFilterItems;
if (bFilterItems)
for (CJabberSDFeature *iFeature = pNode->GetFirstFeature(); iFeature; iFeature = iFeature->GetNext())
- if ( !lstrcmp(iFeature->GetVar(), items[i].feature)) {
+ if (!lstrcmp(iFeature->GetVar(), items[i].feature)) {
bFeatureOk = true;
break;
}
@@ -1270,7 +1270,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
}
}
- if ( !GetMenuItemCount(hMenu)) {
+ if (!GetMenuItemCount(hMenu)) {
DestroyMenu(hMenu);
return;
}
@@ -1396,7 +1396,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
case SD_ACT_USERMENU:
{
HANDLE hContact = HContactFromJID(pNode->GetJid());
- if ( !hContact) {
+ if (!hContact) {
hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), TRUE, FALSE);
JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid());
item->bUseResource = TRUE;
@@ -1412,7 +1412,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM
{
TCHAR *jid = pNode->GetJid();
HANDLE hContact = HContactFromJID(pNode->GetJid());
- if ( !hContact) {
+ if (!hContact) {
JABBER_SEARCH_RESULT jsr={0};
mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), jid);
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
diff --git a/protocols/JabberG/src/jabber_disco.h b/protocols/JabberG/src/jabber_disco.h
index 9fbd833619..2514cf0119 100644
--- a/protocols/JabberG/src/jabber_disco.h
+++ b/protocols/JabberG/src/jabber_disco.h
@@ -294,11 +294,11 @@ public:
}
BOOL AddFeature(const TCHAR *szFeature)
{
- if ( !szFeature)
+ if (!szFeature)
return FALSE;
CJabberSDFeature *pFeature = new CJabberSDFeature(szFeature);
- if ( !pFeature)
+ if (!pFeature)
return FALSE;
pFeature->SetNext(m_pFeatures);
@@ -308,11 +308,11 @@ public:
}
BOOL AddIdentity(const TCHAR *szCategory, const TCHAR *szType, const TCHAR *szName)
{
- if ( !szCategory || !szType)
+ if (!szCategory || !szType)
return FALSE;
CJabberSDIdentity *pIdentity = new CJabberSDIdentity(szCategory, szType, szName);
- if ( !pIdentity)
+ if (!pIdentity)
return FALSE;
pIdentity->SetNext(m_pIdentities);
@@ -322,11 +322,11 @@ public:
}
BOOL AddChildNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName)
{
- if ( !szJid)
+ if (!szJid)
return FALSE;
CJabberSDNode *pNode = new CJabberSDNode(szJid, szNode, szName);
- if ( !pNode)
+ if (!pNode)
return FALSE;
pNode->SetNext(m_pChild);
@@ -336,7 +336,7 @@ public:
}
BOOL AppendString(TCHAR **ppBuffer, TCHAR *szString)
{
- if ( !*ppBuffer) {
+ if (!*ppBuffer) {
*ppBuffer = mir_tstrdup(szString);
return TRUE;
}
@@ -463,11 +463,11 @@ public:
}
CJabberSDNode* AddPrimaryNode(const TCHAR *szJid, const TCHAR *szNode, const TCHAR *szName)
{
- if ( !szJid)
+ if (!szJid)
return FALSE;
CJabberSDNode *pNode = new CJabberSDNode(szJid, szNode, szName);
- if ( !pNode)
+ if (!pNode)
return NULL;
pNode->SetNext(m_pPrimaryNodes);
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 5fbe6ad5bc..5d7c113baf 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM)
{
- if ( !m_bJabberOnline) // should never happen
+ if (!m_bJabberOnline) // should never happen
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -42,7 +42,7 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM)
return 0;
if (ListGetItemPtr(LIST_ROSTER, jid)) {
- if ( !_tcschr(jid, _T('@'))) {
+ if (!_tcschr(jid, _T('@'))) {
TCHAR szStrippedJid[JABBER_MAX_JID_LEN];
JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, SIZEOF(szStrippedJid));
TCHAR *szDog = _tcschr(szStrippedJid, _T('@'));
@@ -167,11 +167,11 @@ int __cdecl CJabberProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam)
if (strcmp(cws->szModule, "CList"))
return 0;
- if ( !strcmp(cws->szSetting, "Group"))
+ if (!strcmp(cws->szSetting, "Group"))
OnRenameGroup(cws, hContact);
- else if ( !strcmp(cws->szSetting, "MyHandle"))
+ else if (!strcmp(cws->szSetting, "MyHandle"))
OnRenameContact(cws, hContact);
- else if ( !strcmp(cws->szSetting, "NotOnList"))
+ else if (!strcmp(cws->szSetting, "NotOnList"))
OnAddContactForever(cws, hContact);
return 0;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index 797cb9a7c2..1975b126a7 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -126,7 +126,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
}
else if ((s=strchr(str, ':')) != NULL) {
*s = '\0';
- if ( !strcmp(str, "Content-Length"))
+ if (!strcmp(str, "Content-Length"))
ft->std.totalBytes = ft->std.currentFileSize = _atoi64(s+1);
} }
@@ -367,7 +367,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
debugLogA("FT Got: %s", str);
if (ft->state == FT_CONNECTING) {
// looking for "GET filename.ext HTTP/1.1"
- if ( !strncmp(str, "GET ", 4)) {
+ if (!strncmp(str, "GET ", 4)) {
for (t=str+4; *t!='\0' && *t!=' '; t++);
*t = '\0';
for (t=str+4; *t!='\0' && *t=='/'; t++);
@@ -460,7 +460,7 @@ filetransfer::~filetransfer()
{
ppro->debugLogA("Destroying file transfer session %08p", this);
- if ( !bCompleted)
+ if (!bCompleted)
ppro->ProtoBroadcastAck(std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, this, 0);
close();
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 761013f6e2..69f79832f8 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -114,7 +114,7 @@ void JabberFormCenterContent(HWND hwndStatic)
void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
{
- if ( !text) text = _T("");
+ if (!text) text = _T("");
int len = lstrlen(text);
int fixedLen = len;
@@ -210,19 +210,19 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
static TJabberFormControlType JabberFormTypeNameToId(const TCHAR *type)
{
- if ( !_tcscmp(type, _T("text-private")))
+ if (!_tcscmp(type, _T("text-private")))
return JFORM_CTYPE_TEXT_PRIVATE;
- if ( !_tcscmp(type, _T("text-multi")) || !_tcscmp(type, _T("jid-multi")))
+ if (!_tcscmp(type, _T("text-multi")) || !_tcscmp(type, _T("jid-multi")))
return JFORM_CTYPE_TEXT_MULTI;
- if ( !_tcscmp(type, _T("boolean")))
+ if (!_tcscmp(type, _T("boolean")))
return JFORM_CTYPE_BOOLEAN;
- if ( !_tcscmp(type, _T("list-single")))
+ if (!_tcscmp(type, _T("list-single")))
return JFORM_CTYPE_LIST_SINGLE;
- if ( !_tcscmp(type, _T("list-multi")))
+ if (!_tcscmp(type, _T("list-multi")))
return JFORM_CTYPE_LIST_MULTI;
- if ( !_tcscmp(type, _T("fixed")))
+ if (!_tcscmp(type, _T("fixed")))
return JFORM_CTYPE_FIXED;
- if ( !_tcscmp(type, _T("hidden")))
+ if (!_tcscmp(type, _T("hidden")))
return JFORM_CTYPE_HIDDEN;
// else
return JFORM_CTYPE_TEXT_SINGLE;
@@ -302,7 +302,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo
TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const TCHAR *labelStr, const TCHAR *valueStr)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
- if ( !controls)
+ if (!controls)
{
controls = new TJabberFormControlList(5);
SetWindowLongPtr(hwndStatic, GWLP_USERDATA, (LONG_PTR)controls);
@@ -419,7 +419,7 @@ void JabberFormAddListItem(TJabberFormControlInfo *item, TCHAR *text, bool selec
void JabberFormLayoutControls(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, int *formHeight)
{
TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA);
- if ( !controls) return;
+ if (!controls) return;
for (int i=0; i < controls->getCount(); i++)
{
@@ -476,18 +476,18 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
layout_info.ctrlHeight = 20;
layout_info.id = 0;
layout_info.width = frameRect.right - frameRect.left - 20;
- if ( !bCompact) layout_info.width -= 10;
+ if (!bCompact) layout_info.width -= 10;
layout_info.y_spacing = bCompact ? 1 : 5;
layout_info.maxLabelWidth = layout_info.width*2/5;
layout_info.offset = 10;
layout_info.y_pos = bCompact ? 0 : 14;
for (i=0; ; i++) {
HXML n = xmlGetChild(xNode ,i);
- if ( !n)
+ if (!n)
break;
if (xmlGetName(n)) {
- if ( !lstrcmp(xmlGetName(n), _T("field"))) {
+ if (!lstrcmp(xmlGetName(n), _T("field"))) {
varStr = xmlGetAttrValue(n, _T("var"));
if ((typeName = xmlGetAttrValue(n, _T("type"))) != NULL) {
if ((label = xmlGetAttrValue(n, _T("label"))) != NULL)
@@ -505,7 +505,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
size_t size = 1;
for (j=0; ; j++) {
v = xmlGetChild(n,j);
- if ( !v)
+ if (!v)
break;
if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v))
size += _tcslen(xmlGetText(v)) + 2;
@@ -514,7 +514,7 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
valueStr[0] = '\0';
for (j=0; ; j++) {
v = xmlGetChild(n,j);
- if ( !v)
+ if (!v)
break;
if (xmlGetName(v) && !lstrcmp(xmlGetName(v), _T("value")) && xmlGetText(v)) {
if (valueStr[0])
@@ -560,9 +560,9 @@ void JabberFormCreateUI(HWND hwndStatic, HXML xNode, int *formHeight, BOOL bComp
bool selected = false;
for (k=0; ; k++) {
vs = xmlGetChild(n,k);
- if ( !vs)
+ if (!vs)
break;
- if ( !lstrcmp(xmlGetName(vs), _T("value")) && xmlGetText(vs) && !_tcscmp(xmlGetText(vs), xmlGetText(v)))
+ if (!lstrcmp(xmlGetName(vs), _T("value")) && xmlGetText(vs) && !_tcscmp(xmlGetText(vs), xmlGetText(v)))
{
selected = true;
break;
@@ -604,7 +604,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
for (int i=0; ; i++) {
n = xmlGetChild(xNode ,i);
- if ( !n)
+ if (!n)
break;
fieldStr = NULL;
@@ -617,7 +617,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
hCtrl = GetDlgItem(hFrame, id);
HXML field = x << XCHILD(_T("field")) << XATTR(_T("var"), varName);
- if ( !_tcscmp(type, _T("text-multi")) || !_tcscmp(type, _T("jid-multi"))) {
+ if (!_tcscmp(type, _T("text-multi")) || !_tcscmp(type, _T("jid-multi"))) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1));
GetDlgItemText(hFrame, id, str, len+1);
@@ -631,27 +631,27 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
mir_free(str);
id++;
}
- else if ( !_tcscmp(type, _T("boolean"))) {
+ else if (!_tcscmp(type, _T("boolean"))) {
TCHAR buf[ 10 ];
_itot(IsDlgButtonChecked(hFrame, id) == BST_CHECKED ? 1 : 0, buf, 10);
field << XCHILD(_T("value"), buf);
id++;
}
- else if ( !_tcscmp(type, _T("list-single"))) {
+ else if (!_tcscmp(type, _T("list-single"))) {
len = GetWindowTextLength(GetDlgItem(hFrame, id));
str = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len+1));
GetDlgItemText(hFrame, id, str, len+1);
v = NULL;
for (j=0; ; j++) {
o = xmlGetChild(n,j);
- if ( !o)
+ if (!o)
break;
- if ( !lstrcmp(xmlGetName(o), _T("option"))) {
+ if (!lstrcmp(xmlGetName(o), _T("option"))) {
if ((v = xmlGetChild(o , "value")) != NULL && xmlGetText(v)) {
if ((str2 = xmlGetAttrValue(o, _T("label"))) == NULL)
str2 = xmlGetText(v);
- if ( !lstrcmp(str2, str))
+ if (!lstrcmp(str2, str))
break;
} } }
@@ -661,7 +661,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
mir_free(str);
id++;
}
- else if ( !_tcscmp(type, _T("list-multi"))) {
+ else if (!_tcscmp(type, _T("list-multi"))) {
int count = SendMessage(hCtrl, LB_GETCOUNT, 0, 0);
for (j=0; j<count; j++) {
if (SendMessage(hCtrl, LB_GETSEL, j, 0) > 0) {
@@ -671,7 +671,7 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
SendMessage(hCtrl, LB_GETTEXT, j, (LPARAM)str);
for (k=0; ; k++) {
o = xmlGetChild(n,k);
- if ( !o)
+ if (!o)
break;
if (xmlGetName(o) && !lstrcmp(xmlGetName(o), _T("option"))) {
@@ -679,14 +679,14 @@ HXML JabberFormGetData(HWND hwndStatic, HXML xNode)
if ((labelText = xmlGetAttrValue(o, _T("label"))) == NULL)
labelText = xmlGetText(v);
- if ( !lstrcmp(labelText, str))
+ if (!lstrcmp(labelText, str))
field << XCHILD(_T("value"), xmlGetText(v));
} } }
mir_free(str);
} } }
id++;
}
- else if ( !_tcscmp(type, _T("fixed")) || !_tcscmp(type, _T("hidden"))) {
+ else if (!_tcscmp(type, _T("fixed")) || !_tcscmp(type, _T("hidden"))) {
v = xmlGetChild(n, "value");
if (v != NULL && xmlGetText(v) != NULL)
field << XCHILD(_T("value"), xmlGetText(v));
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index fd75365239..8b3ab3f7df 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -78,7 +78,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
m_nextTooltipId = 0;
m_hhkFontsChanged = 0;
- if ( !proto->m_options.DisableFrame && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (!proto->m_options.DisableFrame && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
InitClass();
CLISTFrame frame = { sizeof(frame) };
@@ -116,7 +116,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
CJabberInfoFrame::~CJabberInfoFrame()
{
- if ( !m_hwnd) return;
+ if (!m_hwnd) return;
if (m_hhkFontsChanged) UnhookEvent(m_hhkFontsChanged);
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)m_frameId, 0);
@@ -265,14 +265,14 @@ void CJabberInfoFrame::ReloadFonts()
void CJabberInfoFrame::UpdateSize()
{
- if ( !m_hwnd || m_bLocked)
+ if (!m_hwnd || m_bLocked)
return;
int line_count = m_compact ? 1 : (m_pItems.getCount() - m_hiddenItemCount);
int height = 2 * SZ_FRAMEPADDING + line_count * (GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING) + (line_count - 1) * SZ_LINESPACING;
if (CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, m_frameId), 0) & F_VISIBLE) {
- if ( !ServiceExists(MS_SKIN_DRAWGLYPH)) {
+ if (!ServiceExists(MS_SKIN_DRAWGLYPH)) {
// crazy resizing for clist_nicer...
CallService(MS_CLIST_FRAMES_SHFRAME, m_frameId, 0);
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, m_frameId), height);
@@ -324,7 +324,7 @@ void CJabberInfoFrame::PaintSkinGlyph(HDC hdc, RECT *rc, char **glyphs, COLORREF
for (; *glyphs; ++glyphs) {
strncpy(rq.szObjectID, *glyphs, sizeof(rq.szObjectID));
- if ( !CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0))
+ if (!CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0))
return;
}
}
@@ -354,8 +354,8 @@ void CJabberInfoFrame::PaintCompact(HDC hdc)
CJabberInfoFrameItem &item = m_pItems[i];
SetRect(&item.m_rcItem, 0, 0, 0, 0);
- if ( !item.m_bShow) continue;
- if ( !item.m_bCompact) continue;
+ if (!item.m_bShow) continue;
+ if (!item.m_bCompact) continue;
int depth = 0;
for (char *p = item.m_pszName; p = strchr(p+1, '/'); ++depth) ;
@@ -408,7 +408,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc)
for (int i=0; i < m_pItems.getCount(); i++) {
CJabberInfoFrameItem &item = m_pItems[i];
- if ( !item.m_bShow) {
+ if (!item.m_bShow) {
SetRect(&item.m_rcItem, 0, 0, 0, 0);
continue;
}
@@ -491,8 +491,8 @@ void CJabberInfoFrame::RemoveInfoItem(char *pszName)
bool bUpdate = false;
size_t length = strlen(pszName);
for (int i=0; i < m_pItems.getCount(); i++)
- if ( !strncmp(m_pItems[i].m_pszName, pszName, length)) {
- if ( !m_pItems[i].m_bShow) --m_hiddenItemCount;
+ if (!strncmp(m_pItems[i].m_pszName, pszName, length)) {
+ if (!m_pItems[i].m_bShow) --m_hiddenItemCount;
RemoveTooltip(m_pItems[i].m_tooltipId);
m_pItems.remove(i);
bUpdate = true;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 2242b2624a..4fe4904462 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -127,7 +127,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
{
HXML siNode, featureNode, xNode, fieldNode, valueNode;
filetransfer *ft = (filetransfer *)pInfo->GetUserData();
- if ( !ft) return;
+ if (!ft) return;
if ((pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) && pInfo->m_szFrom && pInfo->m_szTo) {
if ((siNode = xmlGetChild(iqNode , "si")) != NULL) {
@@ -153,7 +153,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
ft->type = FT_BYTESTREAM;
ft->jbt = jbt;
ForkThread((MyThreadFunc)&CJabberProto::ByteSendThread, jbt);
- } else if ( !_tcscmp(xmlGetText(valueNode), JABBER_FEAT_IBB)) {
+ } else if (!_tcscmp(xmlGetText(valueNode), JABBER_FEAT_IBB)) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *) mir_alloc(sizeof (JABBER_IBB_TRANSFER));
ZeroMemory(jibb, sizeof(JABBER_IBB_TRANSFER));
jibb->srcJID = mir_tstrdup(pInfo->m_szTo);
@@ -270,7 +270,7 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft)
{
- if ( !success) {
+ if (!success) {
debugLogA("File transfer complete with error");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ft->state == FT_DENIED ? ACKRESULT_DENIED : ACKRESULT_FAILED, ft, 0);
}
@@ -298,7 +298,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
int i;
unsigned __int64 filesize;
- if ( !iqNode ||
+ if (!iqNode ||
(from = xmlGetAttrValue(iqNode, _T("from"))) == NULL ||
(str = xmlGetAttrValue(iqNode, _T("type"))) == NULL || _tcscmp(str, _T("set")) ||
(siNode = xmlGetChildByTag(iqNode, "si", "xmlns", JABBER_FEAT_SI)) == NULL)
@@ -319,15 +319,15 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
HXML optionNode = NULL;
JABBER_FT_TYPE ftType = FT_OOB;
- if ( !bIbbOnly) {
+ if (!bIbbOnly) {
for (i=0; ; i++) {
optionNode = xmlGetChild(fieldNode ,i);
- if ( !optionNode)
+ if (!optionNode)
break;
- if ( !lstrcmp(xmlGetName(optionNode), _T("option"))) {
+ if (!lstrcmp(xmlGetName(optionNode), _T("option"))) {
if ((n = xmlGetChild(optionNode , "value")) != NULL && xmlGetText(n)) {
- if ( !_tcscmp(xmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
+ if (!_tcscmp(xmlGetText(n), JABBER_FEAT_BYTESTREAMS)) {
ftType = FT_BYTESTREAM;
break;
} } } } }
@@ -336,12 +336,12 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
if (bIbbOnly || !optionNode) {
for (i=0; ; i++) {
optionNode = xmlGetChild(fieldNode ,i);
- if ( !optionNode)
+ if (!optionNode)
break;
- if ( !lstrcmp(xmlGetName(optionNode), _T("option"))) {
+ if (!lstrcmp(xmlGetName(optionNode), _T("option"))) {
if ((n = xmlGetChild(optionNode , "value")) != NULL && xmlGetText(n)) {
- if ( !_tcscmp(xmlGetText(n), JABBER_FEAT_IBB)) {
+ if (!_tcscmp(xmlGetText(n), JABBER_FEAT_IBB)) {
ftType = FT_IBB;
break;
} } } } }
@@ -391,7 +391,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode)
void CJabberProto::FtAcceptSiRequest(filetransfer *ft)
{
- if ( !m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
+ if (!m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
@@ -408,7 +408,7 @@ void CJabberProto::FtAcceptSiRequest(filetransfer *ft)
void CJabberProto::FtAcceptIbbRequest(filetransfer *ft)
{
- if ( !m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
+ if (!m_bJabberOnline || ft == NULL || ft->jid == NULL || ft->sid == NULL) return;
JABBER_LIST_ITEM *item;
if ((item=ListAdd(LIST_FTRECV, ft->sid)) != NULL) {
@@ -455,13 +455,13 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
const TCHAR *id = xmlGetAttrValue(iqNode, _T("id"));
const TCHAR *from = xmlGetAttrValue(iqNode, _T("from"));
const TCHAR *to = xmlGetAttrValue(iqNode, _T("to"));
- if ( !id || !from || !to) return FALSE;
+ if (!id || !from || !to) return FALSE;
HXML ibbNode = xmlGetChildByTag(iqNode, bOpen ? "open" : "close", "xmlns", JABBER_FEAT_IBB);
- if ( !ibbNode) return FALSE;
+ if (!ibbNode) return FALSE;
const TCHAR *sid = xmlGetAttrValue(ibbNode, _T("sid"));
- if ( !sid) return FALSE;
+ if (!sid) return FALSE;
// already closed?
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTRECV, sid);
@@ -475,7 +475,7 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
// open event
if (bOpen) {
- if ( !item->jibb) {
+ if (!item->jibb) {
JABBER_IBB_TRANSFER *jibb = (JABBER_IBB_TRANSFER *) mir_alloc(sizeof(JABBER_IBB_TRANSFER));
ZeroMemory(jibb, sizeof(JABBER_IBB_TRANSFER));
jibb->srcJID = mir_tstrdup(from);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index ad2091d41e..517519b3e8 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -166,12 +166,12 @@ struct JabberGcRecentInfo
private:
BOOL null_strequals(const TCHAR *str1, const TCHAR *str2)
{
- if ( !str1 && !str2) return TRUE;
- if ( !str1 && str2 && !*str2) return TRUE;
- if ( !str2 && str1 && !*str1) return TRUE;
+ if (!str1 && !str2) return TRUE;
+ if (!str1 && str2 && !*str2) return TRUE;
+ if (!str2 && str1 && !*str1) return TRUE;
- if ( !str1 && str2) return FALSE;
- if ( !str2 && str1) return FALSE;
+ if (!str1 && str2) return FALSE;
+ if (!str2 && str1) return FALSE;
return !lstrcmp(str1, str2);
}
@@ -634,7 +634,7 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
JABBER_LIST_ITEM *item = 0;
if (item = m_proto->ListGetItemPtrFromIndex(i))
- if ( !lstrcmp(item->type, _T("conference")))
+ if (!lstrcmp(item->type, _T("conference")))
AppendMenu(hMenu, MF_STRING, (UINT_PTR)item, item->name);
}
AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
@@ -742,26 +742,20 @@ struct JabberGroupchatChangeNicknameParam
static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
{
- JabberGroupchatChangeNicknameParam* param = (JabberGroupchatChangeNicknameParam*)arg;
+ JabberGroupchatChangeNicknameParam *param = (JabberGroupchatChangeNicknameParam*)arg;
if (param == NULL)
return;
JABBER_LIST_ITEM *item = param->ppro->ListGetItemPtr(LIST_CHATROOM, param->jid);
if (item != NULL) {
- TCHAR szBuffer[1024];
- TCHAR szCaption[1024];
- szBuffer[0] = _T('\0');
-
- TCHAR *roomName = item->name ? item->name : item->jid;
- mir_sntprintf(szCaption, SIZEOF(szCaption), TranslateT("Change nickname in <%s>"), roomName);
+ CMString szBuffer, szTitle;
+ szTitle.Format(TranslateT("Change nickname in <%s>"), item->name ? item->name : item->jid);
if (item->nick)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s"), item->nick);
+ szBuffer = item->nick;
- if (param->ppro->EnterString(szBuffer, SIZEOF(szBuffer), szCaption, JES_COMBO, "gcNick_")) {
- TCHAR text[1024];
+ if (param->ppro->EnterString(szBuffer, szTitle, JES_COMBO, "gcNick_")) {
replaceStrT(item->nick, szBuffer);
- mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), item->jid, szBuffer);
- param->ppro->SendPresenceTo(param->ppro->m_iStatus, text, NULL);
+ param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMString().Format(_T("%s/%s"), item->jid, szBuffer), NULL);
}
}
@@ -1113,11 +1107,14 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
}
else nick = NULL;
+ CMString tszText(msgText);
+ tszText.Replace(_T("%"), _T("%%"));
+
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = resource;
gce.ptszNick = nick;
gce.time = msgTime;
- gce.ptszText = EscapeChatTags((TCHAR*)msgText);
+ gce.ptszText = tszText;
gce.bIsMe = nick == NULL ? FALSE : (lstrcmp(resource, item->nick) == 0);
if (!isHistory)
@@ -1135,8 +1132,6 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
gcd.iType = GC_EVENT_SETSBTEXT;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
-
- mir_free((void*)gce.ptszText); // Since we processed msgText and created a new string
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp
index a6f1cd5254..54f936aab2 100644
--- a/protocols/JabberG/src/jabber_ibb.cpp
+++ b/protocols/JabberG/src/jabber_ibb.cpp
@@ -46,11 +46,11 @@ void JabberIbbFreeJibb(JABBER_IBB_TRANSFER *jibb)
BOOL CJabberProto::OnFtHandleIbbIq(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !_tcscmp(pInfo->GetChildNodeName(), _T("open")))
+ if (!_tcscmp(pInfo->GetChildNodeName(), _T("open")))
FtHandleIbbRequest(iqNode, TRUE);
- else if ( !_tcscmp(pInfo->GetChildNodeName(), _T("close")))
+ else if (!_tcscmp(pInfo->GetChildNodeName(), _T("close")))
FtHandleIbbRequest(iqNode, FALSE);
- else if ( !_tcscmp(pInfo->GetChildNodeName(), _T("data"))) {
+ else if (!_tcscmp(pInfo->GetChildNodeName(), _T("data"))) {
BOOL bOk = FALSE;
const TCHAR *sid = xmlGetAttrValue(pInfo->GetChildNode(), _T("sid"));
const TCHAR *seq = xmlGetAttrValue(pInfo->GetChildNode(), _T("seq"));
@@ -110,7 +110,7 @@ void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb)
BOOL bSent = (this->*jibb->pfnSend)(JABBER_IBB_BLOCK_SIZE, jibb->ft);
- if ( !jibb->bStreamClosed)
+ if (!jibb->bStreamClosed)
{
jibb->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 2973731361..df3c3ced7b 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -186,7 +186,7 @@ HICON CJabberProto::LoadIconEx(const char* name, bool big)
if (HICON result = g_LoadIconEx(name, big))
return result;
- if ( !strcmp(name, "main"))
+ if (!strcmp(name, "main"))
return Skin_GetIconByHandle(m_hProtoIcon, big);
return NULL;
@@ -228,7 +228,7 @@ static BOOL WildComparei(const TCHAR *name, const TCHAR *mask)
static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
{
- if ( !mask || !name)
+ if (!mask || !name)
return mask == name;
if (*mask != '|')
@@ -240,7 +240,7 @@ static BOOL MatchMask(const TCHAR *name, const TCHAR *mask)
while (mask[e] != '\0' && mask[e] != '|')
e++;
- temp[e]= _T('\0');
+ temp[e]= 0;
if (WildComparei(name, temp+s))
return TRUE;
@@ -319,7 +319,7 @@ int CJabberProto::LoadAdvancedIcons(int iID)
mir_sntprintf(Group, SIZEOF(Group), _T("Status Icons/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto);
- if ( !hAdvancedStatusIcon)
+ if (!hAdvancedStatusIcon)
hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
mir_cslock lck(m_csModeMsgMutex);
@@ -394,10 +394,10 @@ int CJabberProto::OnReloadIcons(WPARAM, LPARAM)
INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM)
{
HANDLE hContact=(HANDLE)wParam;
- if ( !hContact)
+ if (!hContact)
return -1;
- if ( !getByte(hContact, "IsTransported", 0))
+ if (!getByte(hContact, "IsTransported", 0))
return -1;
int iID = GetTransportProtoID( ptrT( getTStringA(hContact, "Transport")));
@@ -418,7 +418,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM)
BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact)
{
// check if transport is already set
- if ( !jid || !hContact)
+ if (!jid || !hContact)
return FALSE;
// strip domain part from jid
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index 9ebf4d0b8b..960f6bdf5a 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -65,7 +65,7 @@ BOOL CJabberIqManager::Start()
return FALSE;
m_hExpirerThread = ppro->ForkThreadEx(&CJabberProto::ExpirerThread, this, 0);
- if ( !m_hExpirerThread)
+ if (!m_hExpirerThread)
return FALSE;
return TRUE;
@@ -160,7 +160,7 @@ void CJabberIqManager::ExpirerThread()
delete pInfo;
}
- if ( !m_bExpirerThreadShutdownRequest) {
+ if (!m_bExpirerThreadShutdownRequest) {
CloseHandle(m_hExpirerThread);
m_hExpirerThread = NULL;
}
@@ -168,7 +168,7 @@ void CJabberIqManager::ExpirerThread()
void CJabberIqManager::ExpireInfo(CJabberIqInfo *pInfo, void*)
{
- if ( !pInfo)
+ if (!pInfo)
return;
if (pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_FROM)
@@ -255,13 +255,13 @@ BOOL CJabberIqManager::HandleIq(int nIqId, HXML pNode)
return FALSE;
const TCHAR *szType = xmlGetAttrValue(pNode, _T("type"));
- if ( !szType)
+ if (!szType)
return FALSE;
int nIqType = JABBER_IQ_TYPE_FAIL;
- if ( !_tcsicmp(szType, _T("result")))
+ if (!_tcsicmp(szType, _T("result")))
nIqType = JABBER_IQ_TYPE_RESULT;
- else if ( !_tcsicmp(szType, _T("error")))
+ else if (!_tcsicmp(szType, _T("error")))
nIqType = JABBER_IQ_TYPE_ERROR;
else
return FALSE;
@@ -314,14 +314,14 @@ BOOL CJabberIqManager::HandleIqPermanent(HXML pNode)
iqInfo.m_nIqType = JABBER_IQ_TYPE_FAIL;
if (!_tcsicmp(szType, _T("get")))
iqInfo.m_nIqType = JABBER_IQ_TYPE_GET;
- else if ( !_tcsicmp(szType, _T("set")))
+ else if (!_tcsicmp(szType, _T("set")))
iqInfo.m_nIqType = JABBER_IQ_TYPE_SET;
else
return FALSE;
if (pInfo->m_nIqTypes & iqInfo.m_nIqType) {
HXML pFirstChild = xmlGetChild(pNode , 0);
- if ( !pFirstChild || !xmlGetName(pFirstChild))
+ if (!pFirstChild || !xmlGetName(pFirstChild))
return FALSE;
const TCHAR *szTagName = xmlGetName(pFirstChild);
@@ -361,7 +361,7 @@ BOOL CJabberIqManager::HandleIqPermanent(HXML pNode)
CJabberIqInfo* CJabberIqManager::DetachInfo(int nIqId)
{
mir_cslock lck(m_cs);
- if ( !m_pIqs)
+ if (!m_pIqs)
return NULL;
CJabberIqInfo *pInfo = m_pIqs;
@@ -386,7 +386,7 @@ CJabberIqInfo* CJabberIqManager::DetachInfo(int nIqId)
CJabberIqInfo* CJabberIqManager::DetachInfo(void *pUserData)
{
mir_cslock lck(m_cs);
- if ( !m_pIqs)
+ if (!m_pIqs)
return NULL;
CJabberIqInfo *pInfo = m_pIqs;
@@ -411,7 +411,7 @@ CJabberIqInfo* CJabberIqManager::DetachInfo(void *pUserData)
CJabberIqInfo* CJabberIqManager::DetachExpired()
{
mir_cslock lck(m_cs);
- if ( !m_pIqs)
+ if (!m_pIqs)
return NULL;
DWORD dwCurrentTime = GetTickCount();
@@ -439,7 +439,7 @@ CJabberIqInfo* CJabberIqManager::DetachExpired()
BOOL CJabberIqManager::InsertIq(CJabberIqInfo *pInfo)
{
mir_cslock lck(m_cs);
- if ( !m_pIqs)
+ if (!m_pIqs)
m_pIqs = pInfo;
else {
if (m_pIqs->m_iPriority > pInfo->m_iPriority) {
@@ -470,7 +470,7 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler(
int iPriority)
{
CJabberIqPermanentInfo *pInfo = new CJabberIqPermanentInfo();
- if ( !pInfo)
+ if (!pInfo)
return NULL;
pInfo->m_pHandler = pHandler;
@@ -484,7 +484,7 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler(
pInfo->m_iPriority = iPriority;
mir_cslock lck(m_cs);
- if ( !m_pPermanentHandlers)
+ if (!m_pPermanentHandlers)
m_pPermanentHandlers = pInfo;
else {
if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
@@ -506,7 +506,7 @@ CJabberIqPermanentInfo* CJabberIqManager::AddPermanentHandler(
BOOL CJabberIqManager::DeletePermanentHandler(CJabberIqPermanentInfo *pInfo)
{
mir_cslock lck(m_cs);
- if ( !m_pPermanentHandlers)
+ if (!m_pPermanentHandlers)
return FALSE;
if (m_pPermanentHandlers == pInfo) { // check first item
@@ -531,7 +531,7 @@ BOOL CJabberIqManager::DeleteHandler(CJabberIqInfo *pInfo)
{
// returns TRUE when pInfo found, or FALSE otherwise
mir_cslockfull lck(m_cs);
- if ( !m_pIqs)
+ if (!m_pIqs)
return FALSE;
if (m_pIqs == pInfo) { // check first item
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 41c1127117..e83ad340ea 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -125,9 +125,9 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
OSVERSIONINFOEX osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi);
- if ( !bOsVersionInfoEx) {
+ if (!bOsVersionInfoEx) {
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if ( !GetVersionEx((OSVERSIONINFO*)&osvi))
+ if (!GetVersionEx((OSVERSIONINFO*)&osvi))
return FALSE;
}
@@ -322,10 +322,10 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
{
- if ( !pInfo->GetFrom())
+ if (!pInfo->GetFrom())
return TRUE;
- if ( !m_options.AllowVersionRequests)
+ if (!m_options.AllowVersionRequests)
return FALSE;
XmlNodeIq iq(_T("result"), pInfo);
@@ -335,7 +335,7 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo)
if (m_options.ShowOSVersion) {
TCHAR os[256] = {0};
- if ( !GetOSDisplayString(os, SIZEOF(os)))
+ if (!GetOSDisplayString(os, SIZEOF(os)))
lstrcpyn(os, _T("Microsoft Windows"), SIZEOF(os));
query << XCHILD(_T("os"), os);
}
@@ -436,7 +436,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo)
BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo)
{
- if ( !m_options.EnableAvatars)
+ if (!m_options.EnableAvatars)
return TRUE;
int pictureType = m_options.AvatarType;
@@ -497,20 +497,20 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
// RFC 3921 #7.2 Business Rules
if (pInfo->GetFrom()) {
TCHAR *szFrom = JabberPrepareJid(pInfo->GetFrom());
- if ( !szFrom)
+ if (!szFrom)
return TRUE;
TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
- if ( !szTo) {
+ if (!szTo) {
mir_free(szFrom);
return TRUE;
}
TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
- if (pDelimiter) *pDelimiter = _T('\0');
+ if (pDelimiter) *pDelimiter = 0;
pDelimiter = _tcschr(szTo, _T('/'));
- if (pDelimiter) *pDelimiter = _T('\0');
+ if (pDelimiter) *pDelimiter = 0;
BOOL bRetVal = _tcscmp(szFrom, szTo) == 0;
@@ -518,7 +518,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
mir_free(szTo);
// invalid JID
- if ( !bRetVal) {
+ if (!bRetVal) {
debugLogA("<iq/> attempt to hack via roster push from %S", pInfo->GetFrom());
return TRUE;
}
@@ -532,7 +532,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
debugLogA("<iq/> Got roster push, query has %d children", xmlGetChildCount(queryNode));
for (int i=0; ; i++) {
HXML itemNode = xmlGetChild(queryNode ,i);
- if ( !itemNode)
+ if (!itemNode)
break;
if (_tcscmp(xmlGetName(itemNode), _T("item")) != 0)
@@ -543,7 +543,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
continue;
// we will not add new account when subscription=remove
- if ( !_tcscmp(str, _T("to")) || !_tcscmp(str, _T("both")) || !_tcscmp(str, _T("from")) || !_tcscmp(str, _T("none"))) {
+ if (!_tcscmp(str, _T("to")) || !_tcscmp(str, _T("both")) || !_tcscmp(str, _T("from")) || !_tcscmp(str, _T("none"))) {
if ((name = xmlGetAttrValue(itemNode, _T("name"))) != NULL)
nick = mir_tstrdup(name);
else
@@ -575,7 +575,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
}
else db_unset(hContact, "CList", "MyHandle");
- if ( !m_options.IgnoreRosterGroups) {
+ if (!m_options.IgnoreRosterGroups) {
if (item->group != NULL) {
Clist_CreateGroup(0, item->group);
db_set_ts(hContact, "CList", "Group", item->group);
@@ -588,15 +588,15 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
}
if ((item=ListGetItemPtr(LIST_ROSTER, jid)) != NULL) {
- if ( !_tcscmp(str, _T("both"))) item->subscription = SUB_BOTH;
- else if ( !_tcscmp(str, _T("to"))) item->subscription = SUB_TO;
- else if ( !_tcscmp(str, _T("from"))) item->subscription = SUB_FROM;
+ if (!_tcscmp(str, _T("both"))) item->subscription = SUB_BOTH;
+ else if (!_tcscmp(str, _T("to"))) item->subscription = SUB_TO;
+ else if (!_tcscmp(str, _T("from"))) item->subscription = SUB_FROM;
else item->subscription = SUB_NONE;
debugLogA("Roster push for jid=%S, set subscription to %S", jid, str);
// subscription = remove is to remove from roster list
// but we will just set the contact to offline and not actually
// remove, so that history will be retained.
- if ( !_tcscmp(str, _T("remove"))) {
+ if (!_tcscmp(str, _T("remove"))) {
if ((hContact=HContactFromJID(jid)) != NULL) {
SetContactOfflineStatus(hContact);
ListRemove(LIST_ROSTER, jid);
@@ -616,11 +616,11 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
{
- if ( !pInfo->GetFrom() || !pInfo->GetHContact())
+ if (!pInfo->GetFrom() || !pInfo->GetHContact())
return TRUE;
HXML n = xmlGetChild(pInfo->GetChildNode(), "url");
- if ( !n || !xmlGetText(n))
+ if (!n || !xmlGetText(n))
return TRUE;
if (m_options.BsOnlyIBB) {
@@ -642,7 +642,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
// Parse the URL
TCHAR *str = (TCHAR*)xmlGetText(n); // URL of the file to get
- if ( !_tcsnicmp(str, _T("http://"), 7)) {
+ if (!_tcsnicmp(str, _T("http://"), 7)) {
TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
TCHAR text[1024];
@@ -699,7 +699,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !pInfo->GetChildNode())
+ if (!pInfo->GetChildNode())
return TRUE;
const TCHAR *szNode = xmlGetAttrValue(pInfo->GetChildNode(), _T("node"));
@@ -721,7 +721,7 @@ BOOL CJabberProto::OnHandleDiscoInfoRequest(HXML iqNode, CJabberIqInfo *pInfo)
BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !pInfo->GetChildNode())
+ if (!pInfo->GetChildNode())
return TRUE;
// ad-hoc commands check:
@@ -735,7 +735,7 @@ BOOL CJabberProto::OnHandleDiscoItemsRequest(HXML iqNode, CJabberIqInfo *pInfo)
if (szNode)
xmlAddAttr(resultQuery, _T("node"), szNode);
- if ( !szNode && m_options.EnableRemoteControl)
+ if (!szNode && m_options.EnableRemoteControl)
resultQuery << XCHILD(_T("item")) << XATTR(_T("jid"), m_ThreadInfo->fullJID)
<< XATTR(_T("node"), JABBER_FEAT_COMMANDS) << XATTR(_T("name"), _T("Ad-hoc commands"));
@@ -762,20 +762,20 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams)
BOOL CJabberProto::OnIqHttpAuth(HXML node, CJabberIqInfo *pInfo)
{
- if ( !m_options.AcceptHttpAuth)
+ if (!m_options.AcceptHttpAuth)
return TRUE;
- if ( !node || !pInfo->GetChildNode() || !pInfo->GetFrom() || !pInfo->GetIdStr())
+ if (!node || !pInfo->GetChildNode() || !pInfo->GetFrom() || !pInfo->GetIdStr())
return TRUE;
HXML pConfirm = xmlGetChild(node , "confirm");
- if ( !pConfirm)
+ if (!pConfirm)
return TRUE;
const TCHAR *szId = xmlGetAttrValue(pConfirm, _T("id"));
const TCHAR *szMethod = xmlGetAttrValue(pConfirm, _T("method"));
const TCHAR *szUrl = xmlGetAttrValue(pConfirm, _T("url"));
- if ( !szId || !szMethod || !szUrl)
+ if (!szId || !szMethod || !szUrl)
return TRUE;
CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams*)mir_calloc(sizeof(CJabberHttpAuthParams));
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 27ec3fcfbd..5e3cb859eb 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -49,7 +49,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*)
xmlGetAttrValue(identity, _T("type")),
xmlGetAttrValue(identity, _T("name")) };
- if ( !lstrcmp(tmp.category, _T("pubsub")) && !lstrcmp(tmp.type, _T("pep"))) {
+ if (!lstrcmp(tmp.category, _T("pubsub")) && !lstrcmp(tmp.type, _T("pep"))) {
m_bPepSupported = TRUE;
EnableMenuItems(TRUE);
@@ -68,7 +68,7 @@ void CJabberProto::OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo*)
continue;
for (int j = 0; g_JabberFeatCapPairs[j].szFeature; j++) {
- if ( !_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
+ if (!_tcscmp(g_JabberFeatCapPairs[j].szFeature, featureName)) {
m_ThreadInfo->jabberServerCaps |= g_JabberFeatCapPairs[j].jcbCap;
break;
}
@@ -215,7 +215,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo *pInfo)
if ((type=xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((queryNode=xmlGetChild(iqNode , "query")) == NULL) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
XmlNodeIq iq( AddIQ(&CJabberProto::OnIqResultSetAuth, JABBER_IQ_TYPE_SET));
HXML query = iq << XQUERY(_T("jabber:iq:auth"));
query << XCHILD(_T("username"), m_ThreadInfo->username);
@@ -242,7 +242,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo *pInfo)
m_ThreadInfo->send(iq);
}
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
m_ThreadInfo->send("</stream:stream>");
TCHAR text[128];
@@ -261,7 +261,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo *pInfo)
debugLogA("<iq/> iqIdSetAuth");
if ((type=xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
ptrT tszNick( getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", m_ThreadInfo->username);
@@ -269,7 +269,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo *pInfo)
OnLoggedIn();
}
// What to do if password error? etc...
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
TCHAR text[128];
m_ThreadInfo->send("</stream:stream>");
@@ -281,12 +281,12 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo *pInfo)
void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !m_ThreadInfo || !iqNode)
+ 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");
if (szJid) {
- if ( !_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
+ if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
debugLogA("Result Bind: %S confirmed ", m_ThreadInfo->fullJID);
else {
debugLogA("Result Bind: %S changed to %S", m_ThreadInfo->fullJID, szJid);
@@ -321,7 +321,7 @@ void CJabberProto::GroupchatJoinByHContact(HANDLE hContact, bool autojoin)
TCHAR *room = roomjid;
TCHAR *server = _tcschr(roomjid, '@');
- if ( !server)
+ if (!server)
return;
server[0] = 0; server++;
@@ -359,7 +359,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
return;
}
- if ( !_tcscmp(szGroupDelimeter, _T("\\"))) {
+ if (!_tcscmp(szGroupDelimeter, _T("\\"))) {
mir_free(szGroupDelimeter);
szGroupDelimeter = NULL;
}
@@ -373,7 +373,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
BOOL bIsTransport=FALSE;
HXML itemNode = xmlGetChild(queryNode ,i);
- if ( !itemNode)
+ if (!itemNode)
break;
if (_tcscmp(xmlGetName(itemNode), _T("item")))
@@ -383,9 +383,9 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
JABBER_SUBSCRIPTION sub;
if (str == NULL) sub = SUB_NONE;
- else if ( !_tcscmp(str, _T("both"))) sub = SUB_BOTH;
- else if ( !_tcscmp(str, _T("to"))) sub = SUB_TO;
- else if ( !_tcscmp(str, _T("from"))) sub = SUB_FROM;
+ else if (!_tcscmp(str, _T("both"))) sub = SUB_BOTH;
+ else if (!_tcscmp(str, _T("to"))) sub = SUB_TO;
+ else if (!_tcscmp(str, _T("from"))) sub = SUB_FROM;
else sub = SUB_NONE;
const TCHAR *jid = xmlGetAttrValue(itemNode, _T("jid"));
@@ -462,7 +462,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
}
else UpdateSubscriptionInfo(hContact, item);
- if ( !m_options.IgnoreRosterGroups) {
+ if (!m_options.IgnoreRosterGroups) {
if (item->group != NULL) {
Clist_CreateGroup(0, item->group);
@@ -542,11 +542,11 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*)
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((queryNode = xmlGetChild(iqNode , "query")) == NULL) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
if (m_hwndAgentRegInput)
SendMessage(m_hwndAgentRegInput, WM_JABBER_REGINPUT_ACTIVATE, 1 /*success*/, (LPARAM)xi.copyNode(iqNode));
}
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
if (m_hwndAgentRegInput) {
HXML errorNode = xmlGetChild(iqNode , "error");
TCHAR *str = JabberErrorMsg(errorNode);
@@ -564,7 +564,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*)
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
HANDLE hContact = HContactFromJID(from);
if (hContact != NULL)
setByte(hContact, "IsTransport", TRUE);
@@ -572,7 +572,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*)
if (m_hwndRegProgress)
SendMessage(m_hwndRegProgress, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Registration successful"));
}
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
if (m_hwndRegProgress) {
HXML errorNode = xmlGetChild(iqNode , "error");
TCHAR *str = JabberErrorMsg(errorNode);
@@ -674,7 +674,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
m_nJabberSearchID = -1;
if ((vCardNode = xmlGetChild(iqNode , "vCard")) != NULL) {
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
@@ -687,7 +687,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&jsr);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if ( !lstrcmp(type, _T("error")))
+ else if (!lstrcmp(type, _T("error")))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
else ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
@@ -726,24 +726,24 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
if ((vCardNode = xmlGetChild(iqNode , "vCard")) != NULL) {
for (int i=0; ; i++) {
n = xmlGetChild(vCardNode ,i);
- if ( !n)
+ if (!n)
break;
if (xmlGetName(n) == NULL) continue;
- if ( !_tcscmp(xmlGetName(n), _T("FN"))) {
+ if (!_tcscmp(xmlGetName(n), _T("FN"))) {
if (xmlGetText(n) != NULL) {
hasFn = true;
setTString(hContact, "FullName", xmlGetText(n));
}
}
- else if ( !lstrcmp(xmlGetName(n), _T("NICKNAME"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("NICKNAME"))) {
if (xmlGetText(n) != NULL) {
hasNick = true;
setTString(hContact, "Nick", xmlGetText(n));
}
}
- else if ( !lstrcmp(xmlGetName(n), _T("N"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("N"))) {
// First/Last name
- if ( !hasGiven && !hasFamily && !hasMiddle) {
+ if (!hasGiven && !hasFamily && !hasMiddle) {
if ((m=xmlGetChild(n, "GIVEN")) != NULL && xmlGetText(m) != NULL) {
hasGiven = true;
setTString(hContact, "FirstName", xmlGetText(m));
@@ -757,7 +757,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
setTString(hContact, "MiddleName", xmlGetText(m));
} }
}
- else if ( !lstrcmp(xmlGetName(n), _T("EMAIL"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("EMAIL"))) {
// E-mail address(es)
if ((m=xmlGetChild(n, "USERID")) == NULL) // Some bad client put e-mail directly in <EMAIL/> instead of <USERID/>
m = n;
@@ -784,9 +784,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
nEmail++;
}
}
- else if ( !lstrcmp(xmlGetName(n), _T("BDAY"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("BDAY"))) {
// Birthday
- if ( !hasBday && xmlGetText(n) != NULL) {
+ if (!hasBday && xmlGetText(n) != NULL) {
if (hContact != NULL) {
if (_stscanf(xmlGetText(n), _T("%d-%d-%d"), &nYear, &nMonth, &nDay) == 3) {
hasBday = true;
@@ -808,9 +808,9 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
setTString("BirthDate", xmlGetText(n));
} }
}
- else if ( !lstrcmp(xmlGetName(n), _T("GENDER"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("GENDER"))) {
// Gender
- if ( !hasGender && xmlGetText(n) != NULL) {
+ if (!hasGender && xmlGetText(n) != NULL) {
if (hContact != NULL) {
if (xmlGetText(n)[0] && strchr("mMfF", xmlGetText(n)[0]) != NULL) {
hasGender = true;
@@ -822,8 +822,8 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
setTString("GenderString", xmlGetText(n));
} }
}
- else if ( !lstrcmp(xmlGetName(n), _T("ADR"))) {
- if ( !hasHome && xmlGetChild(n, "HOME") != NULL) {
+ else if (!lstrcmp(xmlGetName(n), _T("ADR"))) {
+ if (!hasHome && xmlGetChild(n, "HOME") != NULL) {
// Home address
hasHome = true;
if ((m=xmlGetChild(n, "STREET")) != NULL && xmlGetText(m) != NULL) {
@@ -866,7 +866,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
setTString(hContact, "Country", xmlGetText(m));
} }
- if ( !hasWork && xmlGetChild(n, "WORK") != NULL) {
+ if (!hasWork && xmlGetChild(n, "WORK") != NULL) {
// Work address
hasWork = true;
if ((m=xmlGetChild(n, "STREET")) != NULL && xmlGetText(m) != NULL) {
@@ -909,15 +909,15 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
setTString(hContact, "CompanyCountry", xmlGetText(m));
} }
}
- else if ( !lstrcmp(xmlGetName(n), _T("TEL"))) {
+ else if (!lstrcmp(xmlGetName(n), _T("TEL"))) {
// Telephone/Fax/Cellular
if ((m=xmlGetChild(n, "NUMBER")) != NULL && xmlGetText(m) != NULL) {
if (hContact != NULL) {
- if ( !hasFax && xmlGetChild(n, "FAX") != NULL) {
+ if (!hasFax && xmlGetChild(n, "FAX") != NULL) {
hasFax = true;
setTString(hContact, "Fax", xmlGetText(m));
}
- else if ( !hasCell && xmlGetChild(n, "CELL") != NULL) {
+ else if (!hasCell && xmlGetChild(n, "CELL") != NULL) {
hasCell = true;
setTString(hContact, "Cellular", xmlGetText(m));
}
@@ -1013,7 +1013,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
if (!hasFn)
delSetting(hContact, "FullName");
// We are not deleting "Nick"
- // if ( !hasNick)
+ // if (!hasNick)
// delSetting(hContact, "Nick");
if (!hasGiven)
delSetting(hContact, "FirstName");
@@ -1133,7 +1133,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*)
void CJabberProto::OnIqResultSetVcard(HXML iqNode, CJabberIqInfo*)
{
debugLogA("<iq/> iqIdSetVcard");
- if ( !xmlGetAttrValue(iqNode, _T("type")))
+ if (!xmlGetAttrValue(iqNode, _T("type")))
return;
WindowNotify(WM_JABBER_REFRESH_VCARD);
@@ -1190,7 +1190,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo*)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if ( !lstrcmp(type, _T("error")))
+ else if (!lstrcmp(type, _T("error")))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1204,12 +1204,12 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
if ((type=xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((id = JabberGetPacketID(iqNode)) == -1) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
if ((queryNode=xmlGetChild(iqNode , "query")) == NULL) return;
if ((queryNode=xmlGetChild(queryNode , "x")) == NULL) return;
for (int i=0; ; i++) {
HXML itemNode = xmlGetChild(queryNode ,i);
- if ( !itemNode)
+ if (!itemNode)
break;
if (lstrcmp(xmlGetName(itemNode), _T("item")))
continue;
@@ -1220,7 +1220,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
for (int j=0; ; j++) {
HXML fieldNode = xmlGetChild(itemNode ,j);
- if ( !fieldNode)
+ if (!fieldNode)
break;
if (lstrcmp(xmlGetName(fieldNode), _T("field")))
@@ -1234,20 +1234,20 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
if (n == NULL)
continue;
- if ( !lstrcmp(fieldName, _T("jid"))) {
+ if (!lstrcmp(fieldName, _T("jid"))) {
_tcsncpy(jsr.jid, xmlGetText(n), SIZEOF(jsr.jid));
jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
debugLogA("Result jid = %S", jsr.jid);
}
- else if ( !lstrcmp(fieldName, _T("nickname")))
+ else if (!lstrcmp(fieldName, _T("nickname")))
jsr.hdr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
- else if ( !lstrcmp(fieldName, _T("fn")))
+ else if (!lstrcmp(fieldName, _T("fn")))
jsr.hdr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
- else if ( !lstrcmp(fieldName, _T("given")))
+ else if (!lstrcmp(fieldName, _T("given")))
jsr.hdr.firstName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
- else if ( !lstrcmp(fieldName, _T("family")))
+ else if (!lstrcmp(fieldName, _T("family")))
jsr.hdr.lastName = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
- else if ( !lstrcmp(fieldName, _T("email")))
+ else if (!lstrcmp(fieldName, _T("email")))
jsr.hdr.email = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
}
@@ -1256,7 +1256,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo*)
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
- else if ( !lstrcmp(type, _T("error")))
+ else if (!lstrcmp(type, _T("error")))
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
}
@@ -1268,11 +1268,11 @@ void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo *pInfo)
if (type == NULL)
return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
_tcsncpy(m_ThreadInfo->password, m_ThreadInfo->newPassword, SIZEOF(m_ThreadInfo->password));
MessageBox(NULL, TranslateT("Password is successfully changed. Don't forget to update your password in the Jabber protocol option."), TranslateT("Change Password"), MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND);
}
- else if ( !lstrcmp(type, _T("error")))
+ else if (!lstrcmp(type, _T("error")))
MessageBox(NULL, TranslateT("Password cannot be changed."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
}
@@ -1333,7 +1333,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*)
HXML queryNode = xmlGetChild(iqNode , "query");
if (queryNode != NULL) {
const TCHAR *xmlns = xmlGetAttrValue(queryNode, _T("xmlns"));
- if ( !lstrcmp(xmlns, JABBER_FEAT_AVATAR))
+ if (!lstrcmp(xmlns, JABBER_FEAT_AVATAR))
n = xmlGetChild(queryNode , "data");
}
}
@@ -1405,10 +1405,10 @@ void CJabberProto::OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mim
int pictureType;
if (mimeType != NULL) {
- if ( !lstrcmp(mimeType, _T("image/jpeg"))) pictureType = PA_FORMAT_JPEG;
- else if ( !lstrcmp(mimeType, _T("image/png"))) pictureType = PA_FORMAT_PNG;
- else if ( !lstrcmp(mimeType, _T("image/gif"))) pictureType = PA_FORMAT_GIF;
- else if ( !lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP;
+ if (!lstrcmp(mimeType, _T("image/jpeg"))) pictureType = PA_FORMAT_JPEG;
+ else if (!lstrcmp(mimeType, _T("image/png"))) pictureType = PA_FORMAT_PNG;
+ else if (!lstrcmp(mimeType, _T("image/gif"))) pictureType = PA_FORMAT_GIF;
+ else if (!lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP;
else {
LBL_ErrFormat:
debugLogA("Invalid mime type specified for picture: %S", mimeType);
@@ -1466,7 +1466,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo *pInfo)
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL)
return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
if (m_ThreadInfo && !(m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE)) {
m_ThreadInfo->jabberServerCaps |= JABBER_CAPS_PRIVATE_STORAGE;
EnableMenuItems(TRUE);
@@ -1524,7 +1524,7 @@ void CJabberProto::SetBookmarkRequest (XmlNodeIq& iq)
if (item == NULL || item->jid == NULL)
continue;
- if ( !lstrcmp(item->type, _T("conference"))) {
+ if (!lstrcmp(item->type, _T("conference"))) {
HXML itemNode = storage << XCHILD(_T("conference")) << XATTR(_T("jid"), item->jid);
if (item->name)
itemNode << XATTR(_T("name"), item->name);
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index fe0c255cb3..30c0fadc52 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -48,13 +48,13 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo)
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
- if ( !_tcscmp(type, _T("result"))) {
+ if (!_tcscmp(type, _T("result"))) {
if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
str = xmlGetAttrValue(queryNode, _T("xmlns"));
- if ( !lstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
+ if (!lstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
if ((xNode = xmlGetChild(queryNode , "x")) != NULL) {
str = xmlGetAttrValue(xNode, _T("xmlns"));
- if ( !lstrcmp(str, JABBER_FEAT_DATA_FORMS))
+ if (!lstrcmp(str, JABBER_FEAT_DATA_FORMS))
//LaunchForm(xNode);
FormCreateDialog(xNode, _T("Jabber Conference Room Configuration"), &CJabberProto::SetMucConfig, mir_tstrdup(from));
}
@@ -81,7 +81,7 @@ static void sttFillJidList(HWND hwndDlg)
}
jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if ( !jidListInfo)
+ if (!jidListInfo)
return;
hwndList = GetDlgItem(hwndDlg, IDC_LIST);
@@ -109,7 +109,7 @@ static void sttFillJidList(HWND hwndDlg)
lvi.iItem = 0;
for (i=0; ; i++) {
HXML itemNode = xmlGetChild(queryNode ,i);
- if ( !itemNode)
+ if (!itemNode)
break;
if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
@@ -325,28 +325,24 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
lvi.cchTextMax = sizeof(text);
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == (LPARAM)(-1)) {
- TCHAR szBuffer[ 1024 ];
- _tcscpy(szBuffer, dat->type2str());
- if ( !dat->ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_COMBO, "gcAddNick_"))
+ CMString szBuffer(dat->type2str());
+ if (!dat->ppro->EnterString(szBuffer, NULL, JES_COMBO, "gcAddNick_"))
break;
// Trim leading and trailing whitespaces
- TCHAR *p = szBuffer, *q;
- for (p = szBuffer; *p!='\0' && isspace(BYTE(*p)); p++);
- for (q = p; *q!='\0' && !isspace(BYTE(*q)); q++);
- if (*q != '\0') *q = '\0';
- if (*p == '\0')
+ szBuffer.Trim();
+ if (szBuffer.IsEmpty())
break;
- TCHAR rsn[ 1024 ];
- _tcscpy(rsn, dat->type2str());
+
+ CMString rsn(dat->type2str());
if (dat->type == MUC_BANLIST) {
- dat->ppro->EnterString(rsn, SIZEOF(rsn), TranslateT("Reason to ban") , JES_COMBO, "gcAddReason_");
+ dat->ppro->EnterString(rsn, TranslateT("Reason to ban"), JES_COMBO, "gcAddReason_");
if (szBuffer)
- dat->ppro->AddMucListItem(dat, p , rsn);
+ dat->ppro->AddMucListItem(dat, szBuffer, rsn);
else
- dat->ppro->AddMucListItem(dat, p);
+ dat->ppro->AddMucListItem(dat, szBuffer);
}
- else dat->ppro->AddMucListItem(dat, p);
+ else dat->ppro->AddMucListItem(dat, szBuffer);
}
else {
//delete
@@ -495,7 +491,7 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
if ((jidListInfo = new JABBER_MUC_JIDLIST_INFO) != NULL) {
jidListInfo->type = listType;
jidListInfo->ppro = this;
diff --git a/protocols/JabberG/src/jabber_libstr.cpp b/protocols/JabberG/src/jabber_libstr.cpp
index 40c0ded4b7..c1605395f3 100644
--- a/protocols/JabberG/src/jabber_libstr.cpp
+++ b/protocols/JabberG/src/jabber_libstr.cpp
@@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int lstrcmp_null(const TCHAR *s1, const TCHAR *s2)
{
- if ( !s1 && !s2) return 0;
- if ( !s1) return -1;
- if ( !s2) return 1;
+ if (!s1 && !s2) return 0;
+ if (!s1) return -1;
+ if (!s2) return 1;
return lstrcmp(s1, s2);
}
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp
index db07ac9dcd..47811c2aef 100644
--- a/protocols/JabberG/src/jabber_list.cpp
+++ b/protocols/JabberG/src/jabber_list.cpp
@@ -112,7 +112,7 @@ JABBER_LIST_ITEM *CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid)
TCHAR *q = NULL;
// strip resource name if any
//fyr
- if ( !((list== LIST_ROSTER) && ListGetItemPtr(LIST_CHATROOM, jid))) { // but only if it is not chat room contact
+ if (!((list== LIST_ROSTER) && ListGetItemPtr(LIST_CHATROOM, jid))) { // but only if it is not chat room contact
if (list != LIST_VCARD_TEMP) {
TCHAR *p;
if ((p = _tcschr(s, '@')) != NULL)
@@ -122,7 +122,7 @@ JABBER_LIST_ITEM *CJabberProto::ListAdd(JABBER_LIST list, const TCHAR *jid)
}
else bUseResource = true;
- if ( !bUseResource && list == LIST_ROSTER) {
+ if (!bUseResource && list == LIST_ROSTER) {
//if it is a chat room keep resource and made it resource sensitive
if (ChatRoomHContactFromJID(s)) {
if (q != NULL)
@@ -221,7 +221,7 @@ pResourceStatus JABBER_LIST_ITEM::findResource(const TCHAR *resourceName) const
for (int i=0; i < arResources.getCount(); i++) {
JABBER_RESOURCE_STATUS *r = arResources[i];
- if ( !_tcscmp(r->m_tszResourceName, resourceName))
+ if (!_tcscmp(r->m_tszResourceName, resourceName))
return r;
}
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index f20c6e2de5..9d1036b90f 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -79,7 +79,7 @@ static CJabberProto* JabberGetInstanceByHContact(HANDLE hContact)
return NULL;
for (int i=0; i < g_Instances.getCount(); i++)
- if ( !strcmp(szProto, g_Instances[i]->m_szModuleName))
+ if (!strcmp(szProto, g_Instances[i]->m_szModuleName))
return g_Instances[i];
return NULL;
@@ -362,7 +362,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
}
}
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
@@ -491,7 +491,7 @@ INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM)
INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM)
{
- if ( !wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
+ if (!wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen)
ptrT roomID( getTStringA((HANDLE)wParam, "ChatRoomID"));
if (roomID == NULL) return 0;
@@ -552,7 +552,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM)
INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
- if ( !getByte(hContact, "IsTransport", 0))
+ if (!getByte(hContact, "IsTransport", 0))
return 0;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid")));
@@ -568,7 +568,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM)
INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
- if ( !getByte(hContact, "IsTransport", 0))
+ if (!getByte(hContact, "IsTransport", 0))
return 0;
ptrT jid( getTStringA(hContact, "jid"));
@@ -752,7 +752,7 @@ void CJabberProto::MenuInit()
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
for (int i=0; i < SIZEOF(steps); i++) {
- if ( !steps[i]) {
+ if (!steps[i]) {
mi.position += 100000;
continue;
}
@@ -802,7 +802,7 @@ INT_PTR CJabberProto::OnMenuSetPriority(WPARAM, LPARAM, LPARAM dwDelta)
void CJabberProto::UpdatePriorityMenu(short priority)
{
- if ( !m_hMenuPriorityRoot || m_priorityMenuValSet && (priority == m_priorityMenuVal))
+ if (!m_hMenuPriorityRoot || m_priorityMenuValSet && (priority == m_priorityMenuVal))
return;
TCHAR szName[128];
@@ -935,7 +935,7 @@ void CJabberProto::CheckMenuItems()
{
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_FLAGS;
- if ( !m_menuItemsStatus)
+ if (!m_menuItemsStatus)
clmi.flags |= CMIF_GRAYED;
Menu_ModifyItem(m_hMenuChangePassword, &clmi);
@@ -973,7 +973,7 @@ void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item)
return;
HANDLE hContact = HContactFromJID(item->jid);
- if ( !hContact)
+ if (!hContact)
return;
StatusIconData sid = { sizeof(sid) };
@@ -987,7 +987,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
if (event->uType == MSG_WINDOW_EVT_OPEN) {
- if ( !hDialogsList)
+ if (!hDialogsList)
hDialogsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
WindowList_Add(hDialogsList, event->hwndWindow, event->hContact);
@@ -1004,11 +1004,11 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
DBVARIANT dbv;
BOOL bSupportTyping = FALSE;
- if ( !db_get(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
+ if (!db_get(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
}
- else if ( !db_get(NULL, "SRMsg", "DefaultTyping", &dbv)) {
+ else if (!db_get(NULL, "SRMsg", "DefaultTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
}
@@ -1039,7 +1039,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam)
return 0;
HANDLE hContact = (HANDLE)wParam;
- if ( !hContact)
+ if (!hContact)
return 0;
JABBER_LIST_ITEM *LI = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid")));
@@ -1089,7 +1089,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam)
INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM res)
{
- if ( !m_bJabberOnline || !wParam)
+ if (!m_bJabberOnline || !wParam)
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -1121,7 +1121,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM
INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPARAM res)
{
- if ( !m_bJabberOnline || !wParam)
+ if (!m_bJabberOnline || !wParam)
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -1142,10 +1142,9 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l
}
else jid = tszJid;
- TCHAR buf[1024] = _T("");
- EnterString(buf, SIZEOF(buf), TranslateT("Status Message"), JES_MULTINE);
-
- SendPresenceTo(res, jid, NULL, buf);
+ CMString szValue;
+ if (EnterString(szValue, TranslateT("Status Message"), JES_MULTILINE))
+ SendPresenceTo(res, jid, NULL, szValue);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp
index a5a9304e59..b0c7a9d9a4 100644
--- a/protocols/JabberG/src/jabber_message_manager.cpp
+++ b/protocols/JabberG/src/jabber_message_manager.cpp
@@ -65,15 +65,15 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea
LPCTSTR szType = xmlGetAttrValue(node, _T("type"));
if (szType) {
- if ( !_tcsicmp(szType, _T("normal")))
+ if (!_tcsicmp(szType, _T("normal")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_NORMAL;
- else if ( !_tcsicmp(szType, _T("error")))
+ else if (!_tcsicmp(szType, _T("error")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_ERROR;
- else if ( !_tcsicmp(szType, _T("chat")))
+ else if (!_tcsicmp(szType, _T("chat")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_CHAT;
- else if ( !_tcsicmp(szType, _T("groupchat")))
+ else if (!_tcsicmp(szType, _T("groupchat")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_GROUPCHAT;
- else if ( !_tcsicmp(szType, _T("headline")))
+ else if (!_tcsicmp(szType, _T("headline")))
messageInfo.m_nMessageType = JABBER_MESSAGE_TYPE_HEADLINE;
else
return FALSE;
@@ -144,7 +144,7 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler(
pInfo->m_iPriority = iPriority;
mir_cslock lck(m_cs);
- if ( !m_pPermanentHandlers)
+ if (!m_pPermanentHandlers)
m_pPermanentHandlers = pInfo;
else {
if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
@@ -165,7 +165,7 @@ CJabberMessagePermanentInfo* CJabberMessageManager::AddPermanentHandler(
bool CJabberMessageManager::DeletePermanentHandler(CJabberMessagePermanentInfo *pInfo)
{
mir_cslock lck(m_cs);
- if ( !m_pPermanentHandlers)
+ if (!m_pPermanentHandlers)
return FALSE;
if (m_pPermanentHandlers == pInfo) { // check first item
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 5f4fbb8415..ab035c8e3e 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -55,7 +55,7 @@ void JabberChatDllError()
int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2)
{
- if ( !lstrcmpi(jid1, jid2))
+ if (!lstrcmpi(jid1, jid2))
return 0;
// match only node@domain part
@@ -115,7 +115,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t
if ((q = _tcschr(p, '/')) != NULL)
*q = '\0';
- if ( !stripResource && q != NULL) // so that resource is not stripped
+ if (!stripResource && q != NULL) // so that resource is not stripped
*q = '/';
// We can't use JabberHContactFromJID() here because of the stripResource option
@@ -146,7 +146,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t
BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType)
{
- if ( !hContact)
+ if (!hContact)
return FALSE;
switch (btEventType) {
@@ -154,12 +154,12 @@ BOOL CJabberProto::AddDbPresenceEvent(HANDLE 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_options.LogPresence)
return FALSE;
break;
case JABBER_DB_EVENT_PRESENCE_ERROR:
- if ( !m_options.LogPresenceErrors)
+ if (!m_options.LogPresenceErrors)
return FALSE;
break;
}
@@ -194,7 +194,7 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL
if (hContact != NULL) {
char str[ 256 ];
DBVARIANT dbv;
- if ( !db_get_utf(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!db_get_utf(hContact, m_szModuleName, "jid", &dbv)) {
strncpy(str, dbv.pszVal, sizeof str);
str[ sizeof(str)-1 ] = 0;
db_free(&dbv);
@@ -224,7 +224,7 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid)
hContact = (HANDLE)db_find_first(m_szModuleName);
for (; hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) {
- if ( !getByte(hContact, "IsTransported", 0))
+ if (!getByte(hContact, "IsTransported", 0))
continue;
ptrT dbJid( getTStringA(hContact, "jid")); if (dbJid == NULL) continue;
@@ -235,7 +235,7 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid)
continue;
*p = 0;
- if ( !lstrcmp(jid, p+1) && !lstrcmp(dbJid, dbNick)) {
+ if (!lstrcmp(jid, p+1) && !lstrcmp(dbJid, dbNick)) {
*p = '@';
m_ThreadInfo->resolveID = SendGetVcard(dbJid);
m_ThreadInfo->resolveContact = hContact;
@@ -252,7 +252,7 @@ void CJabberProto::ResolveTransportNicks(const TCHAR *jid)
void CJabberProto::SetServerStatus(int iNewStatus)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return;
// change status
@@ -287,27 +287,6 @@ void CJabberProto::SetServerStatus(int iNewStatus)
// Process a string, and double all % characters, according to chat.dll's restrictions
// Returns a pointer to the new string (old one is not freed)
-TCHAR* EscapeChatTags(TCHAR* pszText)
-{
- int nChars = 0;
- for (TCHAR *p = pszText; (p = _tcschr(p, '%')) != NULL; p++)
- nChars++;
-
- if (nChars == 0)
- return mir_tstrdup(pszText);
-
- TCHAR *pszNewText = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(pszText) + 1 + nChars)), *s, *d;
- if (pszNewText == NULL)
- return mir_tstrdup(pszText);
-
- for (s = pszText, d = pszNewText; *s; s++) {
- if (*s == '%')
- *d++ = '%';
- *d++ = *s;
- }
- *d = 0;
- return pszNewText;
-}
TCHAR* UnEscapeChatTags(TCHAR* str_in)
{
@@ -342,7 +321,7 @@ static sttCapsNodeToName_Map[] =
void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item)
{
HANDLE hContact = HContactFromJID(item->jid);
- if ( !hContact)
+ if (!hContact)
return;
debugLogA("JabberUpdateMirVer: for jid %S", item->jid);
@@ -359,20 +338,20 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item)
void CJabberProto::FormatMirVer(pResourceStatus &resource, TCHAR *buf, int bufSize)
{
- if ( !buf || !bufSize) return;
- buf[ 0 ] = _T('\0');
- if ( !resource) return;
+ if (!buf || !bufSize) return;
+ buf[ 0 ] = 0;
+ if (!resource) return;
// jabber:iq:version info requested and exists?
if (resource->m_dwVersionRequestTime && resource->m_tszSoftware) {
debugLogA("JabberUpdateMirVer: for iq:version rc %S: %S", resource->m_tszResourceName, resource->m_tszSoftware);
- if ( !resource->m_tszSoftwareVersion || _tcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion))
+ if (!resource->m_tszSoftwareVersion || _tcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion))
lstrcpyn(buf, resource->m_tszSoftware, bufSize);
else
mir_sntprintf(buf, bufSize, _T("%s %s"), resource->m_tszSoftware, resource->m_tszSoftwareVersion);
}
// no version info and no caps info? set MirVer = resource name
- else if ( !resource->m_tszCapsNode || !resource->m_tszCapsVer) {
+ else if (!resource->m_tszCapsNode || !resource->m_tszCapsVer) {
debugLogA("JabberUpdateMirVer: for rc %S: %S", resource->m_tszResourceName, resource->m_tszResourceName);
if (resource->m_tszResourceName)
lstrcpyn(buf, resource->m_tszResourceName, bufSize);
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp
index 05b3cbf2ef..b6274917f3 100644
--- a/protocols/JabberG/src/jabber_notes.cpp
+++ b/protocols/JabberG/src/jabber_notes.cpp
@@ -33,9 +33,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static TCHAR *StrTrimCopy(TCHAR *str)
{
- if ( !str) return 0;
+ if (!str) return 0;
while (*str && _istspace(*str)) ++str;
- if ( !*str) return mir_tstrdup(str);
+ if (!*str) return mir_tstrdup(str);
TCHAR *res = mir_tstrdup(str);
for (TCHAR *p = res + lstrlen(res) - 1; p >= res; --p)
@@ -117,11 +117,11 @@ void CNoteItem::SetData(TCHAR *title, TCHAR *from, TCHAR *text, TCHAR *tags)
bool CNoteItem::HasTag(const TCHAR *szTag)
{
- if ( !szTag || !*szTag)
+ if (!szTag || !*szTag)
return true;
for (TCHAR *p = m_szTags; p && *p; p = p + lstrlen(p) + 1)
- if ( !lstrcmp(p, szTag))
+ if (!lstrcmp(p, szTag))
return true;
return false;
@@ -356,7 +356,7 @@ public:
{
if (m_adding) return FALSE;
if (lps->itemID == -1) return TRUE;
- if ( !lps->itemData) return TRUE;
+ if (!lps->itemData) return TRUE;
HDC hdc = lps->hDC;
CNoteItem *pNote = (CNoteItem *)lps->itemData;
@@ -408,7 +408,7 @@ public:
{
if (m_adding) return FALSE;
if (lps->itemID == -1) return TRUE;
- if ( !lps->itemData) return TRUE;
+ if (!lps->itemData) return TRUE;
HDC hdc = GetDC(m_hwnd);
CNoteItem *pNote = (CNoteItem *)lps->itemData;
@@ -501,7 +501,7 @@ private:
{
TCHAR *tags = m_proto->m_notes[i].GetTags();
for (TCHAR *tag = tags; tag && *tag; tag = tag + lstrlen(tag) + 1)
- if ( !tagSet.find(tag))
+ if (!tagSet.find(tag))
tagSet.insert(tag);
}
@@ -513,7 +513,7 @@ private:
InsertTag(htiRoot, tagSet[j], select);
}
- if ( !selected)
+ if (!selected)
m_tvFilter.SelectItem(htiRoot);
}
@@ -755,7 +755,7 @@ void CJabberProto::ProcessIncomingNote(CNoteItem *pNote, bool ok)
void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok)
{
- if ( !ok || !pNote->IsNotEmpty())
+ if (!ok || !pNote->IsNotEmpty())
{
delete pNote;
return;
@@ -796,12 +796,12 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok)
bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml)
{
- if ( !m_options.AcceptNotes)
+ if (!m_options.AcceptNotes)
return false;
- if ( !szFrom || !hXml) return true;
+ if (!szFrom || !hXml) return true;
CNoteItem *pItem = new CNoteItem(hXml, (TCHAR *)szFrom);
- if ( !pItem->IsNotEmpty())
+ if (!pItem->IsNotEmpty())
{
delete pItem;
return true;
@@ -832,7 +832,7 @@ INT_PTR __cdecl CJabberProto::OnIncomingNoteEvent(WPARAM, LPARAM lParam)
{
CLISTEVENT *pCle = (CLISTEVENT *)lParam;
CNoteItem *pNote = (CNoteItem *)pCle->lParam;
- if ( !pNote)
+ if (!pNote)
return 0;
CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pNote, &CJabberProto::ProcessIncomingNote);
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index a6219dccbe..c0e3276b53 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -477,7 +477,7 @@ protected:
for (i=0; g_LanguageCodes[i].szCode; i++) {
int iItem = m_cbLocale.AddString(TranslateTS(g_LanguageCodes[i].szDescription), (LPARAM)g_LanguageCodes[i].szCode);
- if ( !_tcscmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
+ if (!_tcscmp(m_proto->m_tszSelectedLang, g_LanguageCodes[i].szCode))
m_cbLocale.SetCurSel(iItem);
}
@@ -562,8 +562,9 @@ private:
void btnRegister_OnClick(CCtrlButton *)
{
- TCHAR buf[512] = _T(""), pass[512];
- if ( !m_proto->EnterString(buf, SIZEOF(buf), TranslateT("Confirm password"), JES_PASSWORD))
+ CMString buf;
+ TCHAR pass[512];
+ if (!m_proto->EnterString(buf, TranslateT("Confirm password"), JES_PASSWORD))
return;
m_txtPassword.GetText(pass, SIZEOF(pass));
@@ -610,7 +611,7 @@ private:
void btnChangePassword_OnClick(CCtrlButton *)
{
- if ( !m_proto->m_bJabberOnline) {
+ if (!m_proto->m_bJabberOnline) {
MessageBox(NULL,
TranslateT("You can change your password only when you are online"),
TranslateT("You must be online"), MB_OK | MB_ICONSTOP);
@@ -622,7 +623,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
- if ( !m_gotservers)
+ if (!m_gotservers)
mir_forkthread(QueryServerListThread, this);
}
@@ -675,13 +676,13 @@ private:
BOOL bManualHost = m_chkManualHost.GetState() == BST_CHECKED;
if (m_chkUseSsl.GetState() == BST_CHECKED) {
m_chkUseTls.Disable();
- if ( !bManualHost)
+ if (!bManualHost)
m_txtPort.SetInt(5223);
}
else {
- if ( !m_proto->m_options.Disable3920auth)
+ if (!m_proto->m_options.Disable3920auth)
m_chkUseTls.Enable();
- if ( !bManualHost)
+ if (!bManualHost)
m_txtPort.SetInt(5222);
}
}
@@ -727,10 +728,10 @@ private:
if (node) {
for (int i=0; ; i++) {
HXML n = xmlGetChild(node, i);
- if ( !n)
+ if (!n)
break;
- if ( !lstrcmp(xmlGetName(n), _T("item")))
+ if (!lstrcmp(xmlGetName(n), _T("item")))
if (const TCHAR *jid = xmlGetAttrValue(n, _T("jid")))
if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
m_cbServer.AddString(jid);
@@ -749,7 +750,7 @@ private:
HWND hwnd = wnd->GetHwnd();
bool bIsError = true;
- if ( !IsWindow(hwnd)) return;
+ if (!IsWindow(hwnd)) return;
NETLIBHTTPREQUEST request = {0};
request.cbSize = sizeof(request);
@@ -982,7 +983,7 @@ static int _RosterInsertListItem(HWND hList, const TCHAR * jid, const TCHAR * ni
static void _RosterListClear(HWND hwndDlg)
{
HWND hList = GetDlgItem(hwndDlg, IDC_ROSTER);
- if ( !hList)
+ if (!hList)
return;
ListView_DeleteAllItems(hList);
@@ -1049,7 +1050,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*)
TCHAR *p = _tcschr(tszJid, _T('@'));
if (p) {
p = _tcschr(tszJid, _T('/'));
- if (p) *p = _T('\0');
+ if (p) *p = 0;
}
if ( ListView_FindItem(hList, -1, &lvfi) == -1) {
ptrT tszName( db_get_tsa(hContact, "CList", "MyHandle"));
@@ -1068,7 +1069,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*)
if (rrud.bRRAction == RRA_SYNCROSTER) {
SetDlgItemText(rrud.hwndDlg, IDC_UPLOAD, TranslateT("Uploading..."));
HXML queryRoster = xmlGetChild(node , "query");
- if ( !queryRoster)
+ if (!queryRoster)
return;
XmlNodeIq iq( AddIQ(&CJabberProto::_RosterHandleGetRequest, JABBER_IQ_TYPE_SET));
@@ -1093,20 +1094,20 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*)
query << XCHILD(_T("item")) << XATTR(_T("jid"), jid) << XATTR(_T("subscription") ,_T("remove"));
itemCount++;
}
- else if ( !bRemove) {
+ else if (!bRemove) {
BOOL bPushed = itemRoster ? TRUE : FALSE;
- if ( !bPushed) {
+ if (!bPushed) {
const TCHAR *rosterName = xmlGetAttrValue(itemRoster, _T("name"));
- if ((rosterName != NULL || name[0]!=_T('\0')) && lstrcmpi(rosterName,name))
+ if ((rosterName != NULL || name[0]!=0) && lstrcmpi(rosterName,name))
bPushed=TRUE;
- if ( !bPushed) {
+ if (!bPushed) {
rosterName = xmlGetAttrValue(itemRoster, _T("subscription"));
- if ((rosterName != NULL || subscr[0]!=_T('\0')) && lstrcmpi(rosterName,subscr))
+ if ((rosterName != NULL || subscr[0]!=0) && lstrcmpi(rosterName,subscr))
bPushed=TRUE;
}
- if ( !bPushed) {
+ if (!bPushed) {
const TCHAR *rosterGroup = xmlGetText( xmlGetChild(itemRoster, "group"));
- if ((rosterGroup != NULL || group[0]!=_T('\0')) && lstrcmpi(rosterGroup,group))
+ if ((rosterGroup != NULL || group[0]!=0) && lstrcmpi(rosterGroup,group))
bPushed=TRUE;
}
}
@@ -1148,7 +1149,7 @@ void CJabberProto::_RosterSendRequest(HWND hwndDlg, BYTE rrAction)
static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel)
{
- if ( !bCancel)
+ if (!bCancel)
{
int len = GetWindowTextLength(hEditor) + 1;
TCHAR *buff=(TCHAR*)mir_alloc(len*sizeof(TCHAR));
@@ -1164,7 +1165,7 @@ static void _RosterItemEditEnd(HWND hEditor, ROSTEREDITDAT * edat, BOOL bCancel)
static LRESULT CALLBACK _RosterItemNewEditProc(HWND hEditor, UINT msg, WPARAM wParam, LPARAM lParam)
{
ROSTEREDITDAT * edat = (ROSTEREDITDAT *) GetWindowLongPtr(hEditor,GWLP_USERDATA);
- if ( !edat) return 0;
+ if (!edat) return 0;
switch(msg) {
case WM_KEYDOWN:
switch(wParam) {
@@ -1214,10 +1215,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg)
ofn.nMaxFile = SIZEOF(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("xml");
- if ( !GetSaveFileName(&ofn)) return;
+ if (!GetSaveFileName(&ofn)) return;
FILE * fp = fopent(filename,_T("w"));
- if ( !fp) return;
+ if (!fp) return;
HWND hList = GetDlgItem(hwndDlg, IDC_ROSTER);
int ListItemCount = ListView_GetItemCount(hList);
@@ -1278,11 +1279,11 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
ofn.nMaxFile = sizeof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "xml";
- if ( !GetOpenFileNameA(&ofn))
+ if (!GetOpenFileNameA(&ofn))
return;
FILE * fp=fopen(filename,"r");
- if ( !fp)
+ if (!fp)
return;
DWORD bufsize = _filelength(_fileno(fp));
@@ -1313,7 +1314,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
while (TRUE)
{
HXML Row = xmlGetNthChild(Table, _T("Row"), index++);
- if ( !Row)
+ if (!Row)
break;
BOOL bAdd=FALSE;
@@ -1325,7 +1326,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
HXML Data = (Cell) ? xmlGetChild(Cell , "Data") : XmlNode();
if (Data)
{
- if ( !lstrcmpi(xmlGetText(Data),_T("+"))) bAdd=TRUE;
+ if (!lstrcmpi(xmlGetText(Data),_T("+"))) bAdd=TRUE;
else if (lstrcmpi(xmlGetText(Data),_T("-"))) continue;
Cell = xmlGetNthChild(Row, _T("Cell"),2);
@@ -1334,7 +1335,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg)
if (Data)
{
jid=xmlGetText(Data);
- if ( !jid || lstrlen(jid)==0) continue;
+ if (!jid || lstrlen(jid)==0) continue;
}
Cell=xmlGetNthChild(Row,_T("Cell"),3);
@@ -1664,23 +1665,23 @@ protected:
lstrcpynA(manualServer, dbManualServer, SIZEOF(manualServer));
m_canregister = true;
- if ( !lstrcmpA(manualServer, "talk.google.com")) {
+ if (!lstrcmpA(manualServer, "talk.google.com")) {
m_cbType.SetCurSel(ACC_GTALK);
m_canregister = false;
}
- else if ( !lstrcmpA(server, "livejournal.com")) {
+ else if (!lstrcmpA(server, "livejournal.com")) {
m_cbType.SetCurSel(ACC_LJTALK);
m_canregister = false;
}
- else if ( !lstrcmpA(server, "chat.facebook.com")) {
+ else if (!lstrcmpA(server, "chat.facebook.com")) {
m_cbType.SetCurSel(ACC_FBOOK);
m_canregister = false;
}
- else if ( !lstrcmpA(manualServer, "xmpp.odnoklassniki.ru")) {
+ else if (!lstrcmpA(manualServer, "xmpp.odnoklassniki.ru")) {
m_cbType.SetCurSel(ACC_OK);
m_canregister = false;
}
- else if ( !lstrcmpA(server, "S.ms")) {
+ else if (!lstrcmpA(server, "S.ms")) {
m_cbType.SetCurSel(ACC_SMS);
m_canregister = false;
}
@@ -1740,7 +1741,7 @@ protected:
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
m_cbResource.GetText(szResource, SIZEOF(szResource));
- if ( !lstrcmp(szCompName, szResource))
+ if (!lstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
m_proto->m_options.HostNameAsResource = bUseHostnameAsResource;
@@ -1847,10 +1848,11 @@ private:
void btnRegister_OnClick(CCtrlButton *)
{
- TCHAR buf[512] = _T(""), pass[512];
- if ( !m_proto->EnterString(buf, SIZEOF(buf), TranslateT("Confirm password"), JES_PASSWORD))
+ CMString buf;
+ if (!m_proto->EnterString(buf, TranslateT("Confirm password"), JES_PASSWORD))
return;
+ TCHAR pass[512];
m_txtPassword.GetText(pass, SIZEOF(pass));
if (lstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
@@ -1885,7 +1887,7 @@ private:
void cbServer_OnDropdown(CCtrlCombo*)
{
- if ( !m_gotservers)
+ if (!m_gotservers)
mir_forkthread(QueryServerListThread, this);
}
@@ -1948,7 +1950,7 @@ private:
void CJabberDlgAccMgrUI::CheckRegistration()
{
- if ( !m_canregister) {
+ if (!m_canregister) {
m_btnRegister.Disable();
return;
}
@@ -2135,7 +2137,6 @@ void CJabberDlgAccMgrUI::setupSMS()
m_txtManualHost.Disable();
m_txtPort.Disable();
m_btnRegister.Disable();
- // m_cbResource.Disable();
}
void CJabberDlgAccMgrUI::RefreshServers(HXML node)
@@ -2147,17 +2148,16 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node)
if (bDropdown) m_cbServer.ShowDropdown(false);
m_cbServer.ResetContent();
- if (node)
- {
- for (int i=0; ; i++) {
+ if (node) {
+ for (int i = 0;; i++) {
HXML n = xmlGetChild(node, i);
- if ( !n)
+ if (!n)
break;
- if ( !lstrcmp(xmlGetName(n), _T("item")))
- if (const TCHAR *jid = xmlGetAttrValue(n, _T("jid")))
- if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
- m_cbServer.AddString(jid);
+ if (!lstrcmp(xmlGetName(n), _T("item")))
+ if (const TCHAR *jid = xmlGetAttrValue(n, _T("jid")))
+ if (m_cbServer.FindString(jid, -1, true) == CB_ERR)
+ m_cbServer.AddString(jid);
}
}
@@ -2173,10 +2173,10 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg)
HWND hwnd = wnd->GetHwnd();
bool bIsError = true;
- NETLIBHTTPREQUEST request = {0};
+ NETLIBHTTPREQUEST request = { 0 };
request.cbSize = sizeof(request);
request.requestType = REQUEST_GET;
- request.flags = NLHRF_GENERATEHOST|NLHRF_SMARTREMOVEHOST|NLHRF_SMARTAUTHHEADER|NLHRF_HTTP11;
+ request.flags = NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11;
request.szUrl = "http://xmpp.org/services/services.xml";
NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
@@ -2189,9 +2189,11 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg)
if (queryNode && IsWindow(hwnd)) {
SendMessage(hwnd, WM_JABBER_REFRESH, 0, (LPARAM)queryNode);
bIsError = false;
- } }
+ }
+ }
mir_free(ptszText);
- } }
+ }
+ }
if (result)
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)result);
@@ -2209,12 +2211,12 @@ INT_PTR CJabberProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
void CJabberProto::JabberUpdateDialogs(BOOL)
{
if (rrud.hwndDlg)
- SendMessage(rrud.hwndDlg, JM_STATUSCHANGED, 0,0);
+ SendMessage(rrud.hwndDlg, JM_STATUSCHANGED, 0, 0);
}
INT_PTR __cdecl CJabberProto::OnMenuOptions(WPARAM, LPARAM)
{
- OPENOPTIONSDIALOG ood = {0};
+ OPENOPTIONSDIALOG ood = { 0 };
ood.cbSize = sizeof(ood);
ood.pszGroup = "Network";
ood.pszPage = mir_t2a(m_tszUserName);
diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp
index c4e2d07612..ae063fcbbf 100644
--- a/protocols/JabberG/src/jabber_opttree.cpp
+++ b/protocols/JabberG/src/jabber_opttree.cpp
@@ -143,9 +143,9 @@ void CCtrlTreeOpts::OnInit()
}
hItem = FindNamedItem(hSection, pItemName);
- if ( !sectionName || !hItem)
+ if (!sectionName || !hItem)
{
- if ( !hItem)
+ if (!hItem)
{
TVINSERTSTRUCT tvis = {0};
@@ -175,7 +175,7 @@ void CCtrlTreeOpts::OnInit()
}
}
hItem = InsertItem(&tvis);
- if ( !sectionName)
+ if (!sectionName)
m_options[i]->m_hItem = hItem;
}
}
diff --git a/protocols/JabberG/src/jabber_presence_manager.cpp b/protocols/JabberG/src/jabber_presence_manager.cpp
index aadde39091..680f852532 100644
--- a/protocols/JabberG/src/jabber_presence_manager.cpp
+++ b/protocols/JabberG/src/jabber_presence_manager.cpp
@@ -34,20 +34,13 @@ BOOL CJabberPresenceManager::FillPermanentHandlers()
BOOL CJabberPresenceManager::HandlePresencePermanent(HXML node, ThreadData *pThreadData)
{
- BOOL bStopHandling = FALSE;
- Lock();
- CJabberPresencePermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo && !bStopHandling) {
+ mir_cslock lck(m_cs);
+ for (CJabberPresencePermanentInfo *pInfo = m_pPermanentHandlers; pInfo; pInfo = pInfo->m_pNext) {
CJabberPresenceInfo presenceInfo;
presenceInfo.m_pUserData = pInfo->m_pUserData;
-
- if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &presenceInfo)) {
- bStopHandling = TRUE;
- break;
- }
- pInfo = pInfo->m_pNext;
+ if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &presenceInfo))
+ return true;
}
- Unlock();
- return bStopHandling;
+ return false;
}
diff --git a/protocols/JabberG/src/jabber_presence_manager.h b/protocols/JabberG/src/jabber_presence_manager.h
index 81ab98b7ab..97e9077c8a 100644
--- a/protocols/JabberG/src/jabber_presence_manager.h
+++ b/protocols/JabberG/src/jabber_presence_manager.h
@@ -98,16 +98,13 @@ public:
}
~CJabberPresenceManager()
{
- Lock();
CJabberPresencePermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo)
- {
+ while (pInfo) {
CJabberPresencePermanentInfo *pTmp = pInfo->m_pNext;
delete pInfo;
pInfo = pTmp;
}
m_pPermanentHandlers = NULL;
- Unlock();
DeleteCriticalSection(&m_cs);
}
BOOL Start()
@@ -118,18 +115,10 @@ public:
{
return TRUE;
}
- void Lock()
- {
- EnterCriticalSection(&m_cs);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_cs);
- }
CJabberPresencePermanentInfo* AddPermanentHandler(JABBER_PRESENCE_HANDLER pHandler, void *pUserData = NULL, PRESENCE_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT)
{
CJabberPresencePermanentInfo* pInfo = new CJabberPresencePermanentInfo();
- if ( !pInfo)
+ if (!pInfo)
return NULL;
pInfo->m_pHandler = pHandler;
@@ -137,16 +126,15 @@ public:
pInfo->m_pUserDataFree = pUserDataFree;
pInfo->m_iPriority = iPriority;
- Lock();
- if ( !m_pPermanentHandlers)
+ mir_cslock lck(m_cs);
+ if (!m_pPermanentHandlers)
m_pPermanentHandlers = pInfo;
- else
- {
+ else {
if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
pInfo->m_pNext = m_pPermanentHandlers;
m_pPermanentHandlers = pInfo;
- } else
- {
+ }
+ else {
CJabberPresencePermanentInfo* pTmp = m_pPermanentHandlers;
while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
pTmp = pTmp->m_pNext;
@@ -154,42 +142,34 @@ public:
pTmp->m_pNext = pInfo;
}
}
- Unlock();
return pInfo;
}
BOOL DeletePermanentHandler(CJabberPresencePermanentInfo *pInfo)
{ // returns TRUE when pInfo found, or FALSE otherwise
- Lock();
- if ( !m_pPermanentHandlers)
- {
- Unlock();
+ mir_cslock lck(m_cs);
+ if (!m_pPermanentHandlers)
return FALSE;
- }
- if (m_pPermanentHandlers == pInfo) // check first item
- {
+
+ if (m_pPermanentHandlers == pInfo) { // check first item
m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
delete pInfo;
- Unlock();
return TRUE;
- } else
- {
- CJabberPresencePermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext)
- {
- if (pTmp->m_pNext == pInfo)
- {
- pTmp->m_pNext = pTmp->m_pNext->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- }
- pTmp = pTmp->m_pNext;
+ }
+
+ CJabberPresencePermanentInfo *pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext) {
+ if (pTmp->m_pNext == pInfo) {
+ pTmp->m_pNext = pTmp->m_pNext->m_pNext;
+ delete pInfo;
+ return TRUE;
}
+ pTmp = pTmp->m_pNext;
}
- Unlock();
+
return FALSE;
}
+
BOOL HandlePresencePermanent(HXML node, ThreadData *pThreadData);
BOOL FillPermanentHandlers();
};
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 9db38d69bb..910aff524b 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
BOOL CJabberProto::OnIqRequestPrivacyLists(HXML, CJabberIqInfo *pInfo)
{
if (pInfo->GetIqType() == JABBER_IQ_TYPE_SET) {
- if ( !m_pDlgPrivacyLists) {
+ if (!m_pDlgPrivacyLists) {
m_privacyListManager.RemoveAllLists();
QueryPrivacyLists();
}
@@ -55,9 +55,9 @@ void CJabberProto::OnIqResultPrivacyListModify(HXML, CJabberIqInfo *pInfo)
pParam->m_bAllOk = FALSE;
InterlockedDecrement(&pParam->m_dwCount);
- if ( !pParam->m_dwCount) {
+ if (!pParam->m_dwCount) {
TCHAR szText[ 512 ];
- if ( !pParam->m_bAllOk)
+ if (!pParam->m_bAllOk)
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Error occurred while applying changes"));
else
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Privacy lists successfully saved"));
@@ -87,7 +87,7 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*)
if (list == NULL)
return;
TCHAR *szListName = (TCHAR*)xmlGetAttrValue(list, _T("name"));
- if ( !szListName)
+ if (!szListName)
return;
mir_cslockfull lck(m_privacyListManager.m_cs);
@@ -104,11 +104,11 @@ void CJabberProto::OnIqResultPrivacyList(HXML iqNode, CJabberIqInfo*)
const TCHAR *itemType = xmlGetAttrValue(item, _T("type"));
PrivacyListRuleType nItemType = Else;
if (itemType) {
- if ( !_tcsicmp(itemType, _T("jid")))
+ if (!_tcsicmp(itemType, _T("jid")))
nItemType = Jid;
- else if ( !_tcsicmp(itemType, _T("group")))
+ else if (!_tcsicmp(itemType, _T("group")))
nItemType = Group;
- else if ( !_tcsicmp(itemType, _T("subscription")))
+ else if (!_tcsicmp(itemType, _T("subscription")))
nItemType = Subscription;
}
@@ -185,7 +185,7 @@ void CJabberProto::OnIqResultPrivacyListActive(HXML iqNode, CJabberIqInfo *pInfo
CMString szText;
- if ( !_tcscmp(type, _T("result"))) {
+ if (!_tcscmp(type, _T("result"))) {
mir_cslock lck(m_privacyListManager.m_cs);
if (pList) {
m_privacyListManager.SetActiveListName(pList->GetListName());
@@ -219,10 +219,10 @@ void CJabberProto::OnIqResultPrivacyListDefault(HXML iqNode, CJabberIqInfo *pInf
return;
TCHAR szText[ 512 ];
- szText[0] = _T('\0');
+ szText[0] = 0;
{
mir_cslock lck(m_privacyListManager.m_cs);
- if ( !_tcscmp(type, _T("result"))) {
+ if (!_tcscmp(type, _T("result"))) {
CPrivacyList *pList = (CPrivacyList *)pInfo->GetUserData();
if (pList) {
m_privacyListManager.SetDefaultListName(pList->GetListName());
@@ -387,7 +387,7 @@ public:
SendDlgItemMessage(m_hwnd, IDC_COMBO_ACTION, CB_SETCURSEL, m_pRule->GetAction() ? 1 : 0, 0);
DWORD dwPackets = m_pRule->GetPackets();
- if ( !dwPackets)
+ if (!dwPackets)
dwPackets = JABBER_PL_RULE_TYPE_ALL;
if (dwPackets & JABBER_PL_RULE_TYPE_IQ)
SendDlgItemMessage(m_hwnd, IDC_CHECK_QUERIES, BM_SETCHECK, BST_CHECKED, 0);
@@ -404,7 +404,7 @@ public:
void cbType_OnChange(CCtrlData*)
{
- if ( !m_pRule) return;
+ if (!m_pRule) return;
LRESULT nCurSel = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
if (nCurSel == CB_ERR)
@@ -526,7 +526,7 @@ public:
dwPackets |= JABBER_PL_RULE_TYPE_PRESENCE_OUT;
if (BST_CHECKED == SendDlgItemMessage(m_hwnd, IDC_CHECK_QUERIES, BM_GETCHECK, 0, 0))
dwPackets |= JABBER_PL_RULE_TYPE_IQ;
- if ( !dwPackets)
+ if (!dwPackets)
dwPackets = JABBER_PL_RULE_TYPE_ALL;
m_pRule->SetPackets(dwPackets);
@@ -878,14 +878,14 @@ void CJabberDlgPrivacyLists::OnProtoRefresh(WPARAM, LPARAM)
CPrivacyList *pList = m_proto->m_privacyListManager.GetFirstList();
while (pList) {
- if ( !pList->IsDeleted()) {
+ if (!pList->IsDeleted()) {
nItemId = SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_ADDSTRING, 0, (LPARAM)pList->GetListName());
SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETITEMDATA, nItemId, (LPARAM)pList);
}
pList = pList->GetNext();
}
- if ( !szCurrentSelectedList || (SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)szCurrentSelectedList) == LB_ERR))
+ if (!szCurrentSelectedList || (SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SELECTSTRING, -1, (LPARAM)szCurrentSelectedList) == LB_ERR))
SendDlgItemMessage(m_hwnd, IDC_LB_LISTS, LB_SETCURSEL, 0, 0);
if (szCurrentSelectedList)
mir_free(szCurrentSelectedList);
@@ -1004,7 +1004,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
szPackets[ 0 ] = '\0';
DWORD dwPackets = pRule->GetPackets();
- if ( !dwPackets)
+ if (!dwPackets)
dwPackets = JABBER_PL_RULE_TYPE_ALL;
if (dwPackets == JABBER_PL_RULE_TYPE_ALL)
_tcscpy(szPackets, _T("all"));
@@ -1059,7 +1059,7 @@ void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCH
void CJabberDlgPrivacyLists::DrawRuleAction(HDC hdc, COLORREF clLine1, COLORREF, CPrivacyListRule *pRule, RECT *rc)
{
DrawNextRulePart(hdc, clLine1, pRule->GetAction() ? TranslateT("allow ") : TranslateT("deny "), rc);
- if ( !pRule->GetPackets() || (pRule->GetPackets() == JABBER_PL_RULE_TYPE_ALL))
+ if (!pRule->GetPackets() || (pRule->GetPackets() == JABBER_PL_RULE_TYPE_ALL))
DrawNextRulePart(hdc, clLine1, TranslateT("all."), rc);
else {
bool needComma = false;
@@ -1125,7 +1125,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis)
SetBkMode(lpdis->hDC, TRANSPARENT);
RECT rc;
- if ( !pRule) {
+ if (!pRule) {
rc = lpdis->rcItem;
rc.left += 25;
@@ -1238,14 +1238,14 @@ void CJabberDlgPrivacyLists::DrawLists(LPDRAWITEMSTRUCT lpdis)
bool bDefault = false;
TCHAR *szName;
- if ( !pList) {
- if ( !szActive) bActive = true;
- if ( !szDefault) bDefault = true;
+ if (!pList) {
+ if (!szActive) bActive = true;
+ if (!szDefault) bDefault = true;
szName = TranslateT("<none>");
}
else {
- if ( !lstrcmp(pList->GetListName(), szActive)) bActive = true;
- if ( !lstrcmp(pList->GetListName(), szDefault)) bDefault = true;
+ if (!lstrcmp(pList->GetListName(), szActive)) bActive = true;
+ if (!lstrcmp(pList->GetListName(), szDefault)) bDefault = true;
szName = pList->GetListName();
}
@@ -1302,7 +1302,7 @@ void CJabberDlgPrivacyLists::CListFilter(HWND)
{
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *proto = GetContactProto(hContact);
- if ( !proto || lstrcmpA(proto, m_proto->m_szModuleName))
+ if (!proto || lstrcmpA(proto, m_proto->m_szModuleName))
if (HANDLE hItem = m_clcClist.FindContact(hContact))
m_clcClist.DeleteItem(hItem);
}
@@ -1327,7 +1327,7 @@ HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, TCHAR *jid)
return m_clcClist.FindContact(hContact);
HANDLE hItem = clc_info.findJid(jid);
- if ( !hItem) {
+ if (!hItem) {
CLCINFOITEM cii = {0};
cii.cbSize = sizeof(cii);
cii.pszText = jid;
@@ -1366,7 +1366,7 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList)
for (int iJid = 0; iJid < clc_info.newJids.getCount(); ++iJid)
CListResetIcons(hwndList, clc_info.newJids[iJid]->hItem, bHideIcons);
- if ( !pList)
+ if (!pList)
goto lbl_return;
for (CPrivacyListRule *pRule = pList->GetFirstRule(); pRule; pRule = pRule->GetNext()) {
@@ -1381,10 +1381,10 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList)
break;
case Subscription:
- if ( !lstrcmp(pRule->GetValue(), _T("none"))) hItem = clc_info.hItemSubNone;
- else if ( !lstrcmp(pRule->GetValue(), _T("from"))) hItem = clc_info.hItemSubFrom;
- else if ( !lstrcmp(pRule->GetValue(), _T("to"))) hItem = clc_info.hItemSubTo;
- else if ( !lstrcmp(pRule->GetValue(), _T("both"))) hItem = clc_info.hItemSubBoth;
+ if (!lstrcmp(pRule->GetValue(), _T("none"))) hItem = clc_info.hItemSubNone;
+ else if (!lstrcmp(pRule->GetValue(), _T("from"))) hItem = clc_info.hItemSubFrom;
+ else if (!lstrcmp(pRule->GetValue(), _T("to"))) hItem = clc_info.hItemSubTo;
+ else if (!lstrcmp(pRule->GetValue(), _T("both"))) hItem = clc_info.hItemSubBoth;
break;
case Else:
@@ -1396,7 +1396,7 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList)
continue;
DWORD dwPackets = pRule->GetPackets();
- if ( !dwPackets) dwPackets = JABBER_PL_RULE_TYPE_ALL;
+ if (!dwPackets) dwPackets = JABBER_PL_RULE_TYPE_ALL;
CListSetupIcons(hwndList, hItem, 0, dwPackets & JABBER_PL_RULE_TYPE_MESSAGE, pRule->GetAction());
CListSetupIcons(hwndList, hItem, 1, dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_IN, pRule->GetAction());
CListSetupIcons(hwndList, hItem, 2, dwPackets & JABBER_PL_RULE_TYPE_PRESENCE_OUT, pRule->GetAction());
@@ -1413,19 +1413,19 @@ DWORD CJabberDlgPrivacyLists::CListGetPackets(HWND, HANDLE hItem, bool bAction)
int iIcon = m_clcClist.GetExtraImage(hItem, 0);
if (bAction && (iIcon == 1)) result |= JABBER_PL_RULE_TYPE_MESSAGE;
- else if ( !bAction && (iIcon == 2)) result |= JABBER_PL_RULE_TYPE_MESSAGE;
+ else if (!bAction && (iIcon == 2)) result |= JABBER_PL_RULE_TYPE_MESSAGE;
iIcon = m_clcClist.GetExtraImage(hItem, 1);
if (bAction && (iIcon == 3)) result |= JABBER_PL_RULE_TYPE_PRESENCE_IN;
- else if ( !bAction && (iIcon == 4)) result |= JABBER_PL_RULE_TYPE_PRESENCE_IN;
+ else if (!bAction && (iIcon == 4)) result |= JABBER_PL_RULE_TYPE_PRESENCE_IN;
iIcon = m_clcClist.GetExtraImage(hItem, 2);
if (bAction && (iIcon == 5)) result |= JABBER_PL_RULE_TYPE_PRESENCE_OUT;
- else if ( !bAction && (iIcon == 6)) result |= JABBER_PL_RULE_TYPE_PRESENCE_OUT;
+ else if (!bAction && (iIcon == 6)) result |= JABBER_PL_RULE_TYPE_PRESENCE_OUT;
iIcon = m_clcClist.GetExtraImage(hItem, 3);
if (bAction && (iIcon == 7)) result |= JABBER_PL_RULE_TYPE_IQ;
- else if ( !bAction && (iIcon == 8)) result |= JABBER_PL_RULE_TYPE_IQ;
+ else if (!bAction && (iIcon == 8)) result |= JABBER_PL_RULE_TYPE_IQ;
return result;
}
@@ -1600,7 +1600,7 @@ BOOL CJabberDlgPrivacyLists::CanExit()
if (clc_info.bChanged)
bModified = TRUE;
- if ( !bModified)
+ if (!bModified)
return TRUE;
if (IDYES == MessageBox(m_hwnd, TranslateT("Privacy lists are not saved, discard any changes and exit?"), TranslateT("Are you sure?"), MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2))
@@ -1883,7 +1883,7 @@ void CJabberDlgPrivacyLists::btnRemoveList_OnClick(CCtrlButton *)
void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *)
{
- if ( !m_proto->m_bJabberOnline) {
+ if (!m_proto->m_bJabberOnline) {
SetStatusText(TranslateT("Unable to save list because you are currently offline."));
return;
}
@@ -1898,7 +1898,7 @@ void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *)
while (pList) {
if (pList->IsModified()) {
CPrivacyListRule* pRule = pList->GetFirstRule();
- if ( !pRule)
+ if (!pRule)
pList->SetDeleted();
if (pList->IsDeleted()) {
pList->RemoveAllRules();
@@ -1906,7 +1906,7 @@ void CJabberDlgPrivacyLists::btnApply_OnClick(CCtrlButton *)
}
pList->SetModified(FALSE);
- if ( !pUserData)
+ if (!pUserData)
pUserData = new CPrivacyListModifyUserParam();
pUserData->m_dwCount++;
diff --git a/protocols/JabberG/src/jabber_privacy.h b/protocols/JabberG/src/jabber_privacy.h
index 1c06a5f56d..8e7656dbbe 100644
--- a/protocols/JabberG/src/jabber_privacy.h
+++ b/protocols/JabberG/src/jabber_privacy.h
@@ -198,7 +198,7 @@ public:
BOOL AddRule(PrivacyListRuleType type, const TCHAR *szValue, BOOL bAction, DWORD dwOrder, DWORD dwPackets)
{
CPrivacyListRule *pRule = new CPrivacyListRule(m_proto, type, szValue, bAction, dwOrder, dwPackets);
- if ( !pRule)
+ if (!pRule)
return FALSE;
pRule->SetNext(m_pRules);
m_pRules = pRule;
@@ -212,7 +212,7 @@ public:
}
BOOL RemoveRule(CPrivacyListRule *pRuleToRemove)
{
- if ( !m_pRules)
+ if (!m_pRules)
return FALSE;
if (m_pRules == pRuleToRemove) {
@@ -237,9 +237,9 @@ public:
BOOL Reorder()
{
// 0 or 1 rules?
- if ( !m_pRules)
+ if (!m_pRules)
return TRUE;
- if ( !m_pRules->GetNext()) {
+ if (!m_pRules->GetNext()) {
m_pRules->SetOrder(100);
return TRUE;
}
@@ -254,7 +254,7 @@ public:
// create pointer array for sort procedure
CPrivacyListRule **pRules = (CPrivacyListRule **)mir_alloc(dwCount * sizeof(CPrivacyListRule *));
- if ( !pRules)
+ if (!pRules)
return FALSE;
DWORD dwPos = 0;
pRule = m_pRules;
@@ -371,7 +371,7 @@ public:
{
CPrivacyList *pList = m_pLists;
while (pList) {
- if ( !_tcscmp(pList->GetListName(), szListName))
+ if (!_tcscmp(pList->GetListName(), szListName))
return pList;
pList = pList->GetNext();
}
@@ -411,7 +411,7 @@ public:
{
CPrivacyList *pList = m_pLists;
while (pList) {
- if ( !pList->IsLoaded())
+ if (!pList->IsLoaded())
return FALSE;
pList = pList->GetNext();
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 276777df2e..bd0800245d 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -258,7 +258,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
SetContactOfflineStatus(hContact);
- if ( !getByte(hContact, "IsTransport", 0))
+ if (!getByte(hContact, "IsTransport", 0))
continue;
ptrT jid( getTStringA(hContact, "jid"));
@@ -347,7 +347,7 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
else {
// already exist
// Set up a dummy "NotOnList" when adding permanently only
- if ( !(flags & PALF_TEMPORARY))
+ if (!(flags & PALF_TEMPORARY))
db_set_b(hContact, "CList", "NotOnList", 1);
}
@@ -406,7 +406,7 @@ HANDLE __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDL
int CJabberProto::Authorize(HANDLE hDbEvent)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 1;
DBEVENTINFO dbei = { sizeof(dbei) };
@@ -454,7 +454,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent)
int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 1;
debugLogA("Entering AuthDeny");
@@ -517,7 +517,7 @@ HANDLE __cdecl CJabberProto::ChangeInfo(int /*iInfoType*/, void*)
HANDLE __cdecl CJabberProto::FileAllow(HANDLE /*hContact*/, HANDLE hTransfer, const TCHAR *szPath)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
filetransfer *ft = (filetransfer*)hTransfer;
@@ -573,7 +573,7 @@ int __cdecl CJabberProto::FileCancel(HANDLE /*hContact*/, HANDLE hTransfer)
int __cdecl CJabberProto::FileDeny(HANDLE, HANDLE hTransfer, const TCHAR *)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 1;
filetransfer *ft = (filetransfer*)hTransfer;
@@ -602,7 +602,7 @@ int __cdecl CJabberProto::FileDeny(HANDLE, HANDLE hTransfer, const TCHAR *)
int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const TCHAR **szFilename)
{
filetransfer *ft = (filetransfer*)hTransfer;
- if ( !m_bJabberOnline || ft == NULL)
+ if (!m_bJabberOnline || ft == NULL)
return 1;
if (*action == FILERESUME_RENAME)
@@ -645,11 +645,11 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact)
int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/)
{
- if ( !m_bJabberOnline || isChatRoom(hContact))
+ if (!m_bJabberOnline || isChatRoom(hContact))
return 1;
TCHAR jid[JABBER_MAX_JID_LEN];
- if ( !GetClientJID(hContact, jid, SIZEOF(jid)))
+ if (!GetClientJID(hContact, jid, SIZEOF(jid)))
return 1;
if (m_ThreadInfo) {
@@ -674,7 +674,7 @@ int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/)
if (pDelimiter) {
*pDelimiter = 0;
pDelimiter++;
- if ( !*pDelimiter)
+ if (!*pDelimiter)
pDelimiter = NULL;
}
JABBER_LIST_ITEM *tmpItem = NULL;
@@ -759,7 +759,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
debugLogA("JabberBasicSearch called with lParam = '%s'", szJid);
JABBER_SEARCH_BASIC *jsb;
- if ( !m_bJabberOnline || (jsb=(JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
+ if (!m_bJabberOnline || (jsb=(JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
return 0;
if (_tcschr(szJid, '@') == NULL) {
@@ -796,7 +796,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email)
{
- if ( !m_bJabberOnline || email == NULL)
+ if (!m_bJabberOnline || email == NULL)
return 0;
ptrA szServerName( getStringA("Jud"));
@@ -812,7 +812,7 @@ HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email)
HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return NULL;
BOOL bIsExtFormat = m_options.ExtendedSearch;
@@ -899,7 +899,7 @@ int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts
return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if ( !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
return 0;
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
@@ -925,7 +925,7 @@ int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts
HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescription, TCHAR** ppszFiles)
{
- if ( !m_bJabberOnline) return 0;
+ if (!m_bJabberOnline) return 0;
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return 0;
@@ -951,7 +951,7 @@ HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescriptio
}
// fix for very smart clients, like gajim
- if ( !m_options.BsDirect && !m_options.BsProxyManual) {
+ if (!m_options.BsDirect && !m_options.BsProxyManual) {
// disable bytestreams
jcb &= ~JABBER_CAPS_BYTESTREAMS;
}
@@ -1036,7 +1036,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n";
int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
{
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if ( !m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID"));
ForkThread(&CJabberProto::SendMessageAckThread, param);
return 1;
@@ -1045,7 +1045,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc
TCHAR *msg;
int isEncrypted, id = SerialNext();
- if ( !strncmp(pszSrc, PGP_PROLOG, strlen(PGP_PROLOG))) {
+ if (!strncmp(pszSrc, PGP_PROLOG, strlen(PGP_PROLOG))) {
const char* szEnd = strstr(pszSrc, PGP_EPILOG);
char* tempstring = (char*)alloca(strlen(pszSrc) + 1);
size_t nStrippedLength = strlen(pszSrc) - strlen(PGP_PROLOG) - (szEnd ? strlen(szEnd) : 0);
@@ -1074,7 +1074,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc
msgType = _T("chat");
XmlNode m(_T("message")); xmlAddAttr(m, _T("type"), msgType);
- if ( !isEncrypted)
+ if (!isEncrypted)
m << XCHILD(_T("body"), msg);
else {
m << XCHILD(_T("body"), _T("[This message is encrypted.]"));
@@ -1104,7 +1104,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc
// if message delivery check disabled in settings
!m_options.MsgAck || !getByte(hContact, "MsgAck", TRUE))
{
- if ( !lstrcmp(msgType, _T("groupchat")))
+ if (!lstrcmp(msgType, _T("groupchat")))
xmlAddAttr(m, _T("to"), szClientJid);
else {
id = SerialNext();
@@ -1151,7 +1151,7 @@ int __cdecl CJabberProto::SetApparentMode(HANDLE hContact, int mode)
return 1;
setWord(hContact, "ApparentMode", (WORD)mode);
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
ptrT jid( getTStringA(hContact, "jid"));
@@ -1350,10 +1350,10 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg)
int __cdecl CJabberProto::UserIsTyping(HANDLE hContact, int type)
{
- if ( !m_bJabberOnline) return 0;
+ if (!m_bJabberOnline) return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if ( !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
return 0;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szClientJid);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 89931f1bbf..73d56674f7 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -43,7 +43,7 @@ struct CJabberProto;
enum TJabberGcLogInfoType { INFO_BAN, INFO_STATUS, INFO_CONFIG, INFO_AFFILIATION, INFO_ROLE };
// for JabberEnterString
-enum { JES_MULTINE, JES_COMBO, JES_RICHEDIT, JES_PASSWORD };
+enum { JES_MULTILINE, JES_COMBO, JES_RICHEDIT, JES_PASSWORD };
typedef UNIQUE_MAP<TCHAR,TCharKeyCmp> U_TCHAR_MAP;
@@ -357,9 +357,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void AdminSet(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal);
void AdminGet(const TCHAR *to, const TCHAR *ns, const TCHAR *var, const TCHAR *varVal, JABBER_IQ_HANDLER foo);
void AdminSetReason(const TCHAR *to, const TCHAR *ns, const TCHAR *szItem, const TCHAR *itemVal, const TCHAR *var, const TCHAR *varVal, const TCHAR *rsn);
- void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str);
- void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* str , TCHAR* rsn);
- void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, TCHAR* jid);
+ void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str);
+ void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* str, const TCHAR* rsn);
+ void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const TCHAR* jid);
//---- jabber_console.cpp ------------------------------------------------------------
@@ -765,7 +765,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
HANDLE HContactFromJID(const TCHAR *jid , BOOL bStripResource = 3);
HANDLE ChatRoomHContactFromJID(const TCHAR *jid);
void SendVisibleInvisiblePresence(BOOL invisible);
- void SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR *msg = NULL);
+ void SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg = NULL);
void SendPresence(int m_iStatus, bool bSendToAll);
void StringAppend(char* *str, int *sizeAlloced, const char* fmt, ...);
void RebuildInfoFrame(void);
@@ -775,9 +775,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
TCHAR* GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen);
void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
- void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, TCHAR *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
- BOOL EnterString(TCHAR *result, size_t resultLen, TCHAR *caption=NULL, int type=0, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0);
- BOOL IsMyOwnJID(LPCTSTR szJID);
+ void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount=JABBER_DEFAULT_RECENT_COUNT);
+ BOOL EnterString(CMString &result, LPCTSTR caption, int type, char *windowName=NULL, int recentCount=JABBER_DEFAULT_RECENT_COUNT, int timeout=0);
+ bool IsMyOwnJID(LPCTSTR szJID);
void __cdecl LoadHttpAvatars(void* param);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index aff935a131..6c53d6b819 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -42,7 +42,7 @@ CJabberAdhocSession::CJabberAdhocSession(CJabberProto* global)
BOOL CJabberProto::IsRcRequestAllowedByACL(CJabberIqInfo *pInfo)
{
- if ( !pInfo || !pInfo->GetFrom())
+ if (!pInfo || !pInfo->GetFrom())
return FALSE;
return IsMyOwnJID(pInfo->GetFrom());
@@ -50,16 +50,16 @@ BOOL CJabberProto::IsRcRequestAllowedByACL(CJabberIqInfo *pInfo)
BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !pInfo->GetChildNode())
+ if (!pInfo->GetChildNode())
return TRUE;
- if ( !m_options.EnableRemoteControl || !IsRcRequestAllowedByACL(pInfo)) {
+ if (!m_options.EnableRemoteControl || !IsRcRequestAllowedByACL(pInfo)) {
// FIXME: send error and return
return TRUE;
}
const TCHAR *szNode = xmlGetAttrValue(pInfo->GetChildNode(), _T("node"));
- if ( !szNode)
+ if (!szNode)
return TRUE;
m_adhocManager.HandleCommandRequest(iqNode, pInfo, (TCHAR*)szNode);
@@ -68,10 +68,10 @@ BOOL CJabberProto::HandleAdhocCommandRequest(HXML iqNode, CJabberIqInfo *pInfo)
BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
- if ( !szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
+ if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
- if ( !_tcscmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!_tcscmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(_T("result"), pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_ITEMS) << XATTR(_T("node"), JABBER_FEAT_COMMANDS);
@@ -79,7 +79,7 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T
CJabberAdhocNode* pNode = GetFirstNode();
while (pNode) {
TCHAR *szJid = pNode->GetJid();
- if ( !szJid)
+ if (!szJid)
szJid = m_pProto->m_ThreadInfo->fullJID;
resultQuery << XCHILD(_T("item")) << XATTR(_T("jid"), szJid)
@@ -97,11 +97,11 @@ BOOL CJabberAdhocManager::HandleItemsRequest(HXML, CJabberIqInfo *pInfo, const T
BOOL CJabberAdhocManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, const TCHAR *szNode)
{
- if ( !szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
+ if (!szNode || !m_pProto->m_options.EnableRemoteControl || !m_pProto->IsRcRequestAllowedByACL(pInfo))
return FALSE;
// FIXME: same code twice
- if ( !_tcscmp(szNode, JABBER_FEAT_COMMANDS)) {
+ if (!_tcscmp(szNode, JABBER_FEAT_COMMANDS)) {
XmlNodeIq iq(_T("result"), pInfo);
HXML resultQuery = iq << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), JABBER_FEAT_COMMANDS);
resultQuery << XCHILD(_T("identity")) << XATTR(_T("name"), _T("Ad-hoc commands"))
@@ -144,7 +144,7 @@ BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo
Lock();
CJabberAdhocNode* pNode = FindNode(szNode);
- if ( !pNode) {
+ if (!pNode) {
Unlock();
m_pProto->m_ThreadInfo->send(
@@ -160,7 +160,7 @@ BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo
CJabberAdhocSession* pSession = NULL;
if (szSessionId) {
pSession = FindSession(szSessionId);
- if ( !pSession) {
+ if (!pSession) {
Unlock();
XmlNodeIq iq(_T("error"), pInfo);
@@ -174,7 +174,7 @@ BOOL CJabberAdhocManager::HandleCommandRequest(HXML iqNode, CJabberIqInfo *pInfo
else
pSession = AddNewSession();
- if ( !pSession) {
+ if (!pSession) {
Unlock();
m_pProto->m_ThreadInfo->send(
@@ -336,11 +336,11 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc
// result form here
HXML commandNode = pInfo->GetChildNode();
HXML xNode = xmlGetChildByTag(commandNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
HXML fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status")), valueNode;
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
LPCTSTR ptszValue = xmlGetText( xmlGetChild(fieldNode , "value"));
@@ -348,13 +348,13 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
int status;
- if ( !_tcscmp(ptszValue, _T("away"))) status = ID_STATUS_AWAY;
- else if ( !_tcscmp(ptszValue, _T("xa"))) status = ID_STATUS_NA;
- else if ( !_tcscmp(ptszValue, _T("dnd"))) status = ID_STATUS_DND;
- else if ( !_tcscmp(ptszValue, _T("chat"))) status = ID_STATUS_FREECHAT;
- else if ( !_tcscmp(ptszValue, _T("online"))) status = ID_STATUS_ONLINE;
- else if ( !_tcscmp(ptszValue, _T("invisible"))) status = ID_STATUS_INVISIBLE;
- else if ( !_tcscmp(ptszValue, _T("offline"))) status = ID_STATUS_OFFLINE;
+ if (!_tcscmp(ptszValue, _T("away"))) status = ID_STATUS_AWAY;
+ else if (!_tcscmp(ptszValue, _T("xa"))) status = ID_STATUS_NA;
+ else if (!_tcscmp(ptszValue, _T("dnd"))) status = ID_STATUS_DND;
+ else if (!_tcscmp(ptszValue, _T("chat"))) status = ID_STATUS_FREECHAT;
+ else if (!_tcscmp(ptszValue, _T("online"))) status = ID_STATUS_ONLINE;
+ else if (!_tcscmp(ptszValue, _T("invisible"))) status = ID_STATUS_INVISIBLE;
+ else if (!_tcscmp(ptszValue, _T("offline"))) status = ID_STATUS_OFFLINE;
else
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
@@ -437,7 +437,7 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
// result form here
HXML commandNode = pInfo->GetChildNode();
HXML xNode = xmlGetChildByTag(commandNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
// Automatically Accept File Transfers
@@ -478,7 +478,7 @@ int CJabberProto::RcGetUnreadEventsCount()
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
int nGetTextResult = db_event_get(hDbEvent, &dbei);
- if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
+ if (!nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
TCHAR *szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
nEventsSent++;
@@ -496,7 +496,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
TCHAR szMsg[ 1024 ];
if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
- if ( !nUnreadEvents) {
+ if (!nUnreadEvents) {
mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
@@ -538,7 +538,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe
// result form here
HXML commandNode = pInfo->GetChildNode();
HXML xNode = xmlGetChildByTag(commandNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
BOOL bRemoveCListEvents = TRUE;
@@ -677,7 +677,7 @@ int CJabberProto::AdhocQuitMirandaHandler(HXML, CJabberIqInfo *pInfo, CJabberAdh
// result form here
HXML commandNode = pInfo->GetChildNode();
HXML xNode = xmlGetChildByTag(commandNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
HXML fieldNode, valueNode;
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe
}
}
- if ( !nChatsCount) {
+ if (!nChatsCount) {
TCHAR szMsg[ 1024 ];
mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no group chats to leave"));
@@ -757,7 +757,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe
// result form here
HXML commandNode = pInfo->GetChildNode();
HXML xNode = xmlGetChildByTag(commandNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
- if ( !xNode)
+ if (!xNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
// Groupchat list here:
diff --git a/protocols/JabberG/src/jabber_rc.h b/protocols/JabberG/src/jabber_rc.h
index 6409d66eed..526598a5d6 100644
--- a/protocols/JabberG/src/jabber_rc.h
+++ b/protocols/JabberG/src/jabber_rc.h
@@ -169,7 +169,7 @@ protected:
{
CJabberAdhocSession* pSession = m_pSessions;
while (pSession) {
- if ( !_tcscmp(pSession->GetSessionId(), szSession))
+ if (!_tcscmp(pSession->GetSessionId(), szSession))
return pSession;
pSession = pSession->GetNext();
}
@@ -179,7 +179,7 @@ protected:
CJabberAdhocSession* AddNewSession()
{
CJabberAdhocSession* pSession = new CJabberAdhocSession(m_pProto);
- if ( !pSession)
+ if (!pSession)
return NULL;
pSession->SetNext(m_pSessions);
@@ -192,7 +192,7 @@ protected:
{
CJabberAdhocNode* pNode = m_pNodes;
while (pNode) {
- if ( !_tcscmp(pNode->GetNode(), szNode))
+ if (!_tcscmp(pNode->GetNode(), szNode))
return pNode;
pNode = pNode->GetNext();
}
@@ -201,7 +201,7 @@ protected:
BOOL RemoveSession(CJabberAdhocSession* pSession)
{
- if ( !m_pSessions)
+ if (!m_pSessions)
return FALSE;
if (pSession == m_pSessions) {
@@ -226,7 +226,7 @@ protected:
BOOL _ExpireSession(DWORD dwExpireTime)
{
- if ( !m_pSessions)
+ if (!m_pSessions)
return FALSE;
CJabberAdhocSession* pSession = m_pSessions;
@@ -277,11 +277,11 @@ public:
BOOL AddNode(TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler)
{
CJabberAdhocNode* pNode = new CJabberAdhocNode(m_pProto, szJid, szNode, szName, pHandler);
- if ( !pNode)
+ if (!pNode)
return FALSE;
Lock();
- if ( !m_pNodes)
+ if (!m_pNodes)
m_pNodes = pNode;
else {
CJabberAdhocNode* pTmp = m_pNodes;
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index cca0c20468..1a7584c0a1 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -87,7 +87,7 @@ static int JabberSearchFrameProc(HWND hwnd, int msg, WPARAM wParam, LPARAM lPara
//
static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat)
{
- if ( !FieldDat || !FieldDat->Label || !FieldDat->Var)
+ if (!FieldDat || !FieldDat->Label || !FieldDat->Var)
return FALSE;
HFONT hFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0);
@@ -109,7 +109,7 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat)
HWND hwndVar=CreateWindowEx(0|WS_EX_CLIENTEDGE,_T("EDIT"),(LPCTSTR)FieldDat->defValue,WS_CHILD|WS_TABSTOP, CornerX+5, CornerY + Order*40+14, width ,20,hwndParent,NULL,hInst,0);
SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont,0);
SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont,0);
- if ( !FieldDat->bHidden) {
+ if (!FieldDat->bHidden) {
ShowWindow(hwndLabel,SW_SHOW);
ShowWindow(hwndVar,SW_SHOW);
EnableWindow(hwndLabel,!FieldDat->bReadOnly);
@@ -134,14 +134,14 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat)
void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo)
{
- if ( !searchHandleDlg)
+ if (!searchHandleDlg)
return;
LPCTSTR type = xmlGetAttrValue(iqNode, _T("type"));
if (type == NULL)
return;
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
HXML queryNode = xmlGetNthChild(iqNode, _T("query"), 1);
HXML xNode = xmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
@@ -157,10 +157,10 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo)
int Order=0;
for (int i=0; ; i++) {
HXML chNode = xmlGetChild(queryNode, i);
- if ( !chNode)
+ if (!chNode)
break;
- if ( !_tcsicmp(xmlGetName(chNode), _T("instructions")) && xmlGetText(chNode))
+ if (!_tcsicmp(xmlGetName(chNode), _T("instructions")) && xmlGetText(chNode))
SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,TranslateTS(xmlGetText(chNode)));
else if (xmlGetName(chNode)) {
Data *MyData=(Data*)malloc(sizeof(Data));
@@ -183,7 +183,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode, CJabberIqInfo *pInfo)
PostMessage(searchHandleDlg,WM_USER+10,0,0);
ShowWindow(searchHandleDlg,SW_SHOW);
}
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
const TCHAR *code=NULL;
const TCHAR *description=NULL;
TCHAR buff[255];
@@ -252,13 +252,13 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M
for (i=0; i < nUsersFound; i++) {
TCHAR buff[200]=_T("");
- Results.jsr.jid[0]=_T('\0');
+ Results.jsr.jid[0]=0;
U_TCHAR_MAP * pmUserData = (U_TCHAR_MAP *) plUsersInfo->operator [](i);
for (int j=0; j < nFieldCount; j++) {
TCHAR* var = ListOfFields[j];
TCHAR* value = pmUserData->operator [](var);
Results.pszFields[j] = value ? value : (TCHAR *)_T(" ");
- if ( !_tcsicmp(var,_T("jid")) && value)
+ if (!_tcsicmp(var,_T("jid")) && value)
_tcsncpy(Results.jsr.jid, value, SIZEOF(Results.jsr.jid));
}
{
@@ -309,7 +309,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo)
return;
}
- if ( !lstrcmp(type, _T("result"))) {
+ if (!lstrcmp(type, _T("result"))) {
HXML queryNode = xmlGetNthChild(iqNode, _T("query"), 1);
HXML xNode = xmlGetChildByTag(queryNode, "x", "xmlns", JABBER_FEAT_DATA_FORMS);
if (xNode) {
@@ -332,7 +332,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo)
while (HXML fieldNode = xmlGetNthChild(itemNode, _T("field"), j++)) {
if (TCHAR* var = (TCHAR*)xmlGetAttrValue(fieldNode, _T("var"))) {
if (TCHAR* Text = (TCHAR*)xmlGetText(xmlGetChild(fieldNode, _T("value")))) {
- if ( !mColumnsNames[var])
+ if (!mColumnsNames[var])
mColumnsNames.insert(var,var);
pUserColumn->insert(var,Text);
} } }
@@ -354,7 +354,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo)
for (int j=0; ; j++) {
HXML child = xmlGetChild(itemNode, j);
- if ( !child)
+ if (!child)
break;
const TCHAR *szColumnName = xmlGetName(child);
@@ -369,7 +369,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode, CJabberIqInfo *pInfo)
SearchResults.insert((void*)pUserColumn);
} }
}
- else if ( !lstrcmp(type, _T("error"))) {
+ else if (!lstrcmp(type, _T("error"))) {
const TCHAR *code = NULL;
const TCHAR *description = NULL;
TCHAR buff[255];
@@ -406,7 +406,7 @@ static BOOL CALLBACK DeleteChildWindowsProc(HWND hwnd, LPARAM)
static void JabberSearchFreeData(HWND hwndDlg, JabberSearchData * dat)
{
//lock
- if ( !dat->fSearchRequestIsXForm && dat->nJSInfCount && dat->pJSInf) {
+ if (!dat->fSearchRequestIsXForm && dat->nJSInfCount && dat->pJSInf) {
for (int i=0; i < dat->nJSInfCount; i++) {
if (dat->pJSInf[i].hwndValueItem)
DestroyWindow(dat->pJSInf[i].hwndValueItem);
@@ -463,7 +463,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData * dat)
SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,m_bJabberOnline ? TranslateT("Please wait...\r\nConnecting search server...") : TranslateT("You have to be connected to server"));
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
searchHandleDlg = hwndDlg;
@@ -712,11 +712,11 @@ HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent)
HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
{
- if ( !m_bJabberOnline || !hwndDlg)
+ if (!m_bJabberOnline || !hwndDlg)
return 0; //error
JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if ( !dat)
+ if (!dat)
return 0; //error
// check if server connected (at least one field exists)
@@ -750,7 +750,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg)
for (int i=0; i<dat->nJSInfCount; i++) {
TCHAR szFieldValue[100];
GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue));
- if (szFieldValue[0] != _T('\0')) {
+ if (szFieldValue[0] != 0) {
xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue);
fRequestNotEmpty=TRUE;
} } }
diff --git a/protocols/JabberG/src/jabber_search.h b/protocols/JabberG/src/jabber_search.h
index 029a30c26d..b1d5378684 100644
--- a/protocols/JabberG/src/jabber_search.h
+++ b/protocols/JabberG/src/jabber_search.h
@@ -163,7 +163,7 @@ public:
int index=_Records.getIndex(rec);
if (index<0)
{
- if ( !_Records.insert(rec)) delete rec;
+ if (!_Records.insert(rec)) delete rec;
else
{
index=_Records.getIndex(rec);
@@ -184,7 +184,7 @@ public:
if (index<0)
{
_KEYTYPE* newKey=CopyProc(Key);
- if ( !_Records.insert(rec))
+ if (!_Records.insert(rec))
{
delete rec;
DestroyProc(newKey);
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp
index c38b515965..7abcd96ef7 100644
--- a/protocols/JabberG/src/jabber_secur.cpp
+++ b/protocols/JabberG/src/jabber_secur.cpp
@@ -35,11 +35,11 @@ TNtlmAuth::TNtlmAuth(ThreadData* info, const char* mechanism, const TCHAR *hostn
szHostName = hostname;
const TCHAR *szProvider;
- if ( !strcmp(mechanism, "GSS-SPNEGO"))
+ if (!strcmp(mechanism, "GSS-SPNEGO"))
szProvider = _T("Negotiate");
- else if ( !strcmp(mechanism, "GSSAPI"))
+ else if (!strcmp(mechanism, "GSSAPI"))
szProvider = _T("GSSAPI");
- else if ( !strcmp(mechanism, "NTLM"))
+ else if (!strcmp(mechanism, "NTLM"))
szProvider = _T("NTLM");
else {
bIsValid = false;
@@ -48,7 +48,7 @@ TNtlmAuth::TNtlmAuth(ThreadData* info, const char* mechanism, const TCHAR *hostn
TCHAR szSpn[ 1024 ] = _T("");
if (strcmp(mechanism, "NTLM")) {
- if ( !getSpn(szSpn, SIZEOF(szSpn)) && !strcmp(mechanism, "GSSAPI")) {
+ if (!getSpn(szSpn, SIZEOF(szSpn)) && !strcmp(mechanism, "GSSAPI")) {
bIsValid = false;
return;
} }
@@ -68,7 +68,7 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
TCHAR szFullUserName[128] = _T("");
ULONG szFullUserNameLen = SIZEOF(szFullUserName);
- if ( !GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
+ if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[ 0 ] = 0;
szFullUserNameLen = SIZEOF(szFullUserName);
GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
@@ -105,7 +105,7 @@ bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
char* TNtlmAuth::getInitialRequest()
{
- if ( !hProvider)
+ if (!hProvider)
return NULL;
// This generates login method advertisement packet
@@ -120,7 +120,7 @@ char* TNtlmAuth::getInitialRequest()
char* TNtlmAuth::getChallenge(const TCHAR *challenge)
{
- if ( !hProvider)
+ if (!hProvider)
return NULL;
char *text = (!lstrcmp(challenge, _T("="))) ? mir_strdup("") : mir_t2a(challenge), *result;
@@ -254,7 +254,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge)
ptrA chl((char*)mir_base64_decode( _T2A(challenge), &chlLen));
char *r = strstr(chl, "r=");
- if ( !r)
+ if (!r)
return NULL;
char *e = strchr(r, ','); if (e) *e = 0;
diff --git a/protocols/JabberG/src/jabber_send_manager.cpp b/protocols/JabberG/src/jabber_send_manager.cpp
index a877e64821..0ada2e018a 100644
--- a/protocols/JabberG/src/jabber_send_manager.cpp
+++ b/protocols/JabberG/src/jabber_send_manager.cpp
@@ -34,20 +34,13 @@ BOOL CJabberSendManager::FillPermanentHandlers()
BOOL CJabberSendManager::HandleSendPermanent(HXML node, ThreadData *pThreadData)
{
- BOOL bStopHandling = FALSE;
- Lock();
- CJabberSendPermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo && !bStopHandling) {
+ mir_cslock lck(m_cs);
+ for (CJabberSendPermanentInfo *pInfo = m_pPermanentHandlers; pInfo; pInfo = pInfo->m_pNext) {
CJabberSendInfo sendInfo;
sendInfo.m_pUserData = pInfo->m_pUserData;
-
- if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &sendInfo)) {
- bStopHandling = TRUE;
- break;
- }
- pInfo = pInfo->m_pNext;
+ if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &sendInfo))
+ return true;
}
- Unlock();
- return bStopHandling;
+ return false;
}
diff --git a/protocols/JabberG/src/jabber_send_manager.h b/protocols/JabberG/src/jabber_send_manager.h
index 12acf10cdb..eee8647ca2 100644
--- a/protocols/JabberG/src/jabber_send_manager.h
+++ b/protocols/JabberG/src/jabber_send_manager.h
@@ -98,16 +98,13 @@ public:
}
~CJabberSendManager()
{
- Lock();
CJabberSendPermanentInfo *pInfo = m_pPermanentHandlers;
- while (pInfo)
- {
+ while (pInfo) {
CJabberSendPermanentInfo *pTmp = pInfo->m_pNext;
delete pInfo;
pInfo = pTmp;
}
m_pPermanentHandlers = NULL;
- Unlock();
DeleteCriticalSection(&m_cs);
}
BOOL Start()
@@ -118,18 +115,10 @@ public:
{
return TRUE;
}
- void Lock()
- {
- EnterCriticalSection(&m_cs);
- }
- void Unlock()
- {
- LeaveCriticalSection(&m_cs);
- }
CJabberSendPermanentInfo* AddPermanentHandler(JABBER_SEND_HANDLER pHandler, void *pUserData = NULL, SEND_USER_DATA_FREE_FUNC pUserDataFree = NULL, int iPriority = JH_PRIORITY_DEFAULT)
{
CJabberSendPermanentInfo* pInfo = new CJabberSendPermanentInfo();
- if ( !pInfo)
+ if (!pInfo)
return NULL;
pInfo->m_pHandler = pHandler;
@@ -137,16 +126,15 @@ public:
pInfo->m_pUserDataFree = pUserDataFree;
pInfo->m_iPriority = iPriority;
- Lock();
- if ( !m_pPermanentHandlers)
+ mir_cslock lck(m_cs);
+ if (!m_pPermanentHandlers)
m_pPermanentHandlers = pInfo;
- else
- {
+ else {
if (m_pPermanentHandlers->m_iPriority > pInfo->m_iPriority) {
pInfo->m_pNext = m_pPermanentHandlers;
m_pPermanentHandlers = pInfo;
- } else
- {
+ }
+ else {
CJabberSendPermanentInfo* pTmp = m_pPermanentHandlers;
while (pTmp->m_pNext && pTmp->m_pNext->m_iPriority <= pInfo->m_iPriority)
pTmp = pTmp->m_pNext;
@@ -154,40 +142,29 @@ public:
pTmp->m_pNext = pInfo;
}
}
- Unlock();
-
return pInfo;
}
BOOL DeletePermanentHandler(CJabberSendPermanentInfo *pInfo)
{ // returns TRUE when pInfo found, or FALSE otherwise
- Lock();
- if ( !m_pPermanentHandlers)
- {
- Unlock();
+ mir_cslock lck(m_cs);
+ if (!m_pPermanentHandlers)
return FALSE;
- }
- if (m_pPermanentHandlers == pInfo) // check first item
- {
+
+ if (m_pPermanentHandlers == pInfo) { // check first item
m_pPermanentHandlers = m_pPermanentHandlers->m_pNext;
delete pInfo;
- Unlock();
return TRUE;
- } else
- {
- CJabberSendPermanentInfo* pTmp = m_pPermanentHandlers;
- while (pTmp->m_pNext)
- {
- if (pTmp->m_pNext == pInfo)
- {
- pTmp->m_pNext = pTmp->m_pNext->m_pNext;
- delete pInfo;
- Unlock();
- return TRUE;
- }
- pTmp = pTmp->m_pNext;
+ }
+
+ CJabberSendPermanentInfo* pTmp = m_pPermanentHandlers;
+ while (pTmp->m_pNext) {
+ if (pTmp->m_pNext == pInfo) {
+ pTmp->m_pNext = pTmp->m_pNext->m_pNext;
+ delete pInfo;
+ return TRUE;
}
+ pTmp = pTmp->m_pNext;
}
- Unlock();
return FALSE;
}
BOOL HandleSendPermanent(HXML node, ThreadData *pThreadData);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index 6d14f917b0..582f977e73 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -80,7 +80,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatar(WPARAM wParam, LPARAM lParam)
if (buf == NULL || size <= 0)
return -1;
- if ( !m_options.EnableAvatars)
+ if (!m_options.EnableAvatars)
return -2;
GetAvatarFileName(NULL, buf, size);
@@ -118,7 +118,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_options.EnableAvatars)
return GAIR_NOAVATAR;
PROTO_AVATAR_INFORMATIONT* AI = (PROTO_AVATAR_INFORMATIONT*)lParam;
@@ -359,7 +359,7 @@ static void appendString(bool bIsTipper, const TCHAR *tszTitle, const TCHAR *tsz
INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lParam)
{
- if ( !wParam || !lParam)
+ if (!wParam || !lParam)
return 0; //room global tooltip not supported yet
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, (TCHAR*)wParam);
@@ -378,7 +378,7 @@ INT_PTR __cdecl CJabberProto::JabberGCGetToolTipText(WPARAM wParam, LPARAM lPara
// Affiliation: Affiliation
TCHAR outBuf[2048];
- outBuf[0]=_T('\0');
+ outBuf[0]=0;
bool bIsTipper = db_get_b(NULL, "Tab_SRMsg", "adv_TipperTooltip", 0) && ServiceExists("mToolTip/HideTip");
@@ -428,7 +428,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
for (++szJid; *szJid == _T('/'); ++szJid);
// empty jid?
- if ( !*szJid)
+ if (!*szJid)
return 1;
// command code
@@ -443,9 +443,9 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
*(szSecondParam++) = 0;
// no command or message command
- if ( !szCommand || (szCommand && !_tcsicmp(szCommand, _T("message")))) {
+ if (!szCommand || (szCommand && !_tcsicmp(szCommand, _T("message")))) {
// message
- if ( !ServiceExists(MS_MSG_SENDMESSAGEW))
+ if (!ServiceExists(MS_MSG_SENDMESSAGEW))
return 1;
TCHAR *szMsgBody = NULL;
@@ -471,7 +471,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
}
if (!_tcsicmp(szCommand, _T("roster"))) {
- if ( !HContactFromJID(szJid)) {
+ if (!HContactFromJID(szJid)) {
JABBER_SEARCH_RESULT jsr = { 0 };
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
@@ -489,23 +489,23 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
}
// chat join invitation
- if ( !_tcsicmp(szCommand, _T("join"))) {
+ if (!_tcsicmp(szCommand, _T("join"))) {
GroupchatJoinRoomByJid(NULL, szJid);
return 0;
}
// service discovery request
- if ( !_tcsicmp(szCommand, _T("disco"))) {
+ if (!_tcsicmp(szCommand, _T("disco"))) {
OnMenuHandleServiceDiscovery(0, (LPARAM)szJid);
return 0;
}
// ad-hoc commands
- if ( !_tcsicmp(szCommand, _T("command"))) {
+ if (!_tcsicmp(szCommand, _T("command"))) {
if (szSecondParam) {
- if ( !_tcsnicmp(szSecondParam, _T("node="), 5)) {
+ if (!_tcsnicmp(szSecondParam, _T("node="), 5)) {
szSecondParam += 5;
- if ( !*szSecondParam)
+ if (!*szSecondParam)
szSecondParam = NULL;
}
else szSecondParam = NULL;
@@ -516,7 +516,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
}
// send file
- if ( !_tcsicmp(szCommand, _T("sendfile"))) {
+ if (!_tcsicmp(szCommand, _T("sendfile"))) {
if (!ServiceExists(MS_FILE_SENDFILE))
return 1;
@@ -535,7 +535,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam)
// XEP-0224 support (Attention/Nudge)
INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM wParam, LPARAM)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
HANDLE hContact = (HANDLE)wParam;
@@ -560,12 +560,12 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM wParam, LPARAM)
BOOL CJabberProto::SendHttpAuthReply(CJabberHttpAuthParams *pParams, BOOL bAuthorized)
{
- if ( !m_bJabberOnline || !pParams || !m_ThreadInfo)
+ if (!m_bJabberOnline || !pParams || !m_ThreadInfo)
return FALSE;
if (pParams->m_nType == CJabberHttpAuthParams::IQ) {
XmlNodeIq iq(bAuthorized ? _T("result") : _T("error"), pParams->m_szIqId, pParams->m_szFrom);
- if ( !bAuthorized) {
+ if (!bAuthorized) {
iq << XCHILDNS(_T("confirm"), JABBER_FEAT_HTTP_AUTH) << XATTR(_T("id"), pParams->m_szId)
<< XATTR(_T("method"), pParams->m_szMethod) << XATTR(_T("url"), pParams->m_szUrl);
iq << XCHILD(_T("error")) << XATTRI(_T("code"), 401) << XATTR(_T("type"), _T("auth"))
@@ -576,7 +576,7 @@ BOOL CJabberProto::SendHttpAuthReply(CJabberHttpAuthParams *pParams, BOOL bAutho
else if (pParams->m_nType == CJabberHttpAuthParams::MSG) {
XmlNode msg(_T("message"));
msg << XATTR(_T("to"), pParams->m_szFrom);
- if ( !bAuthorized)
+ if (!bAuthorized)
msg << XATTR(_T("type"), _T("error"));
if (pParams->m_szThreadId)
msg << XCHILD(_T("thread"), pParams->m_szThreadId);
@@ -584,7 +584,7 @@ BOOL CJabberProto::SendHttpAuthReply(CJabberHttpAuthParams *pParams, BOOL bAutho
msg << XCHILDNS(_T("confirm"), JABBER_FEAT_HTTP_AUTH) << XATTR(_T("id"), pParams->m_szId)
<< XATTR(_T("method"), pParams->m_szMethod) << XATTR(_T("url"), pParams->m_szUrl);
- if ( !bAuthorized)
+ if (!bAuthorized)
msg << XCHILD(_T("error")) << XATTRI(_T("code"), 401) << XATTR(_T("type"), _T("auth"))
<< XCHILDNS(_T("not-authorized"), _T("urn:ietf:params:xml:xmpp-stanzas"));
@@ -665,11 +665,11 @@ INT_PTR __cdecl CJabberProto::OnHttpAuthRequest(WPARAM wParam, LPARAM lParam)
{
CLISTEVENT *pCle = (CLISTEVENT *)lParam;
CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams *)pCle->lParam;
- if ( !pParams)
+ if (!pParams)
return 0;
CJabberDlgHttpAuth *pDlg = new CJabberDlgHttpAuth(this, (HWND)wParam, pParams);
- if ( !pDlg) {
+ if (!pDlg) {
pParams->Free();
mir_free(pParams);
return 0;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 1d344ad783..e39a37ebdd 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -134,7 +134,7 @@ static VOID CALLBACK JabberOfflineChatWindows(void* param)
void CJabberProto::OnPingReply(HXML, CJabberIqInfo *pInfo)
{
- if ( !pInfo)
+ if (!pInfo)
return;
if (pInfo->GetIqType() == JABBER_IQ_TYPE_FAIL) {
// disconnect because of timeout
@@ -209,7 +209,7 @@ void CJabberProto::xmlStreamInitializeNow(ThreadData* info)
if (m_tszSelectedLang)
xmlAddAttr(stream, _T("xml:lang"), m_tszSelectedLang);
- if ( !m_options.Disable3920auth)
+ if (!m_options.Disable3920auth)
xmlAddAttr(stream, _T("version"), _T("1.0"));
LPTSTR xmlQuery = xi.toString(n, NULL);
@@ -300,7 +300,7 @@ LBL_FatalError:
if (m_options.HostNameAsResource) {
DWORD dwCompNameLen = SIZEOF(info->resource)-1;
- if ( !GetComputerName(info->resource, &dwCompNameLen))
+ if (!GetComputerName(info->resource, &dwCompNameLen))
_tcscpy(info->resource, _T("Miranda"));
}
else {
@@ -411,7 +411,7 @@ LBL_FatalError:
// Determine local IP
if (info->useSSL) {
debugLogA("Intializing SSL connection");
- if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, 0)) {
+ if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, 0)) {
debugLogA("SSL intialization failed");
if (info->type == JABBER_SESSION_NORMAL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
@@ -445,7 +445,7 @@ LBL_FatalError:
// cache values
DWORD dwConnectionKeepAliveInterval = m_options.ConnectionKeepAliveInterval;
for (;;) {
- if ( !info->useZlib || info->zRecvReady) {
+ if (!info->useZlib || info->zRecvReady) {
DWORD dwIdle = GetTickCount() - m_lastTicks;
if (dwIdle >= dwConnectionKeepAliveInterval)
dwIdle = dwConnectionKeepAliveInterval - 10; // now!
@@ -507,7 +507,7 @@ recvRest:
if (xmlGetName(root) == NULL) {
for (int i=0; ; i++) {
HXML n = xmlGetChild(root , i);
- if ( !n)
+ if (!n)
break;
OnProcessProtocol(n, info);
}
@@ -651,7 +651,7 @@ void CJabberProto::PerformAuthentication(ThreadData* info)
if (m_AuthMechs.isSpnegoAvailable) {
m_AuthMechs.isSpnegoAvailable = false;
auth = new TNtlmAuth(info, "GSS-SPNEGO");
- if ( !auth->isValid()) {
+ if (!auth->isValid()) {
delete auth;
auth = NULL;
} }
@@ -659,7 +659,7 @@ void CJabberProto::PerformAuthentication(ThreadData* info)
if (auth == NULL && m_AuthMechs.isNtlmAvailable) {
m_AuthMechs.isNtlmAvailable = false;
auth = new TNtlmAuth(info, "NTLM");
- if ( !auth->isValid()) {
+ if (!auth->isValid()) {
delete auth;
auth = NULL;
} }
@@ -667,12 +667,12 @@ void CJabberProto::PerformAuthentication(ThreadData* info)
if (auth == NULL && m_AuthMechs.isKerberosAvailable) {
m_AuthMechs.isKerberosAvailable = false;
auth = new TNtlmAuth(info, "GSSAPI", m_AuthMechs.m_gssapiHostName);
- if ( !auth->isValid()) {
+ if (!auth->isValid()) {
delete auth;
auth = NULL;
} else {
request = auth->getInitialRequest();
- if ( !request) {
+ if (!request) {
delete auth;
auth = NULL;
} } }
@@ -715,7 +715,7 @@ void CJabberProto::PerformAuthentication(ThreadData* info)
info->auth = auth;
- if ( !request) request = auth->getInitialRequest();
+ if (!request) request = auth->getInitialRequest();
info->send(XmlNode(_T("auth"), _A2T(request)) << XATTR(_T("xmlns"), _T("urn:ietf:params:xml:ns:xmpp-sasl"))
<< XATTR(_T("mechanism"), _A2T(auth->getName())));
mir_free(request);
@@ -730,32 +730,32 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info)
for (int i=0; ;i++) {
HXML n = xmlGetChild(node ,i);
- if ( !n)
+ if (!n)
break;
- if ( !_tcscmp(xmlGetName(n), _T("starttls"))) {
- if ( !info->useSSL && m_options.UseTLS) {
+ if (!_tcscmp(xmlGetName(n), _T("starttls"))) {
+ if (!info->useSSL && m_options.UseTLS) {
debugLogA("Requesting TLS");
info->send(XmlNode(xmlGetName(n)) << XATTR(_T("xmlns"), _T("urn:ietf:params:xml:ns:xmpp-tls")));
return;
} }
- if ( !_tcscmp(xmlGetName(n), _T("compression")) && m_options.EnableZlib == TRUE) {
+ if (!_tcscmp(xmlGetName(n), _T("compression")) && m_options.EnableZlib == TRUE) {
debugLogA("Server compression available");
for (int k=0; ; k++) {
HXML c = xmlGetChild(n,k);
- if ( !c)
+ if (!c)
break;
- if ( !_tcscmp(xmlGetName(c), _T("method"))) {
- if ( !_tcscmp(xmlGetText(c), _T("zlib")) && info->zlibInit() == TRUE) {
+ if (!_tcscmp(xmlGetName(c), _T("method"))) {
+ if (!_tcscmp(xmlGetText(c), _T("zlib")) && info->zlibInit() == TRUE) {
debugLogA("Requesting Zlib compression");
info->send(XmlNode(_T("compress")) << XATTR(_T("xmlns"), _T("http://jabber.org/protocol/compress"))
<< XCHILD(_T("method"), _T("zlib")));
return;
} } } }
- if ( !_tcscmp(xmlGetName(n), _T("mechanisms"))) {
+ if (!_tcscmp(xmlGetName(n), _T("mechanisms"))) {
m_AuthMechs.isPlainAvailable = false;
m_AuthMechs.isPlainOldAvailable = false;
m_AuthMechs.isMd5Available = false;
@@ -769,19 +769,19 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info)
//JabberLog("%d mechanisms\n",n->numChild);
for (int k=0; ; k++) {
HXML c = xmlGetChild(n,k);
- if ( !c)
+ if (!c)
break;
- if ( !_tcscmp(xmlGetName(c), _T("mechanism"))) {
+ if (!_tcscmp(xmlGetName(c), _T("mechanism"))) {
LPCTSTR ptszMechanism = xmlGetText(c);
- if ( !_tcscmp(ptszMechanism, _T("PLAIN"))) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
- else if ( !_tcscmp(ptszMechanism, _T("DIGEST-MD5"))) m_AuthMechs.isMd5Available = true;
- else if ( !_tcscmp(ptszMechanism, _T("SCRAM-SHA-1"))) m_AuthMechs.isScramAvailable = true;
- else if ( !_tcscmp(ptszMechanism, _T("NTLM"))) m_AuthMechs.isNtlmAvailable = true;
- else if ( !_tcscmp(ptszMechanism, _T("GSS-SPNEGO"))) m_AuthMechs.isSpnegoAvailable = true;
- else if ( !_tcscmp(ptszMechanism, _T("GSSAPI"))) m_AuthMechs.isKerberosAvailable = true;
+ if (!_tcscmp(ptszMechanism, _T("PLAIN"))) m_AuthMechs.isPlainOldAvailable = m_AuthMechs.isPlainAvailable = true;
+ else if (!_tcscmp(ptszMechanism, _T("DIGEST-MD5"))) m_AuthMechs.isMd5Available = true;
+ else if (!_tcscmp(ptszMechanism, _T("SCRAM-SHA-1"))) m_AuthMechs.isScramAvailable = true;
+ else if (!_tcscmp(ptszMechanism, _T("NTLM"))) m_AuthMechs.isNtlmAvailable = true;
+ else if (!_tcscmp(ptszMechanism, _T("GSS-SPNEGO"))) m_AuthMechs.isSpnegoAvailable = true;
+ else if (!_tcscmp(ptszMechanism, _T("GSSAPI"))) m_AuthMechs.isKerberosAvailable = true;
}
- else if ( !_tcscmp(xmlGetName(c), _T("hostname"))) {
+ else if (!_tcscmp(xmlGetName(c), _T("hostname"))) {
const TCHAR *mech = xmlGetAttrValue(c, _T("mechanism"));
if (mech && _tcsicmp(mech, _T("GSSAPI")) == 0) {
m_AuthMechs.m_gssapiHostName = mir_tstrdup(xmlGetText(c));
@@ -789,9 +789,9 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info)
}
}
}
- else if ( !_tcscmp(xmlGetName(n), _T("register"))) isRegisterAvailable = true;
- else if ( !_tcscmp(xmlGetName(n), _T("auth" ))) m_AuthMechs.isAuthAvailable = true;
- else if ( !_tcscmp(xmlGetName(n), _T("session" ))) m_AuthMechs.isSessionAvailable = true;
+ else if (!_tcscmp(xmlGetName(n), _T("register"))) isRegisterAvailable = true;
+ else if (!_tcscmp(xmlGetName(n), _T("auth" ))) m_AuthMechs.isAuthAvailable = true;
+ else if (!_tcscmp(xmlGetName(n), _T("session" ))) m_AuthMechs.isSessionAvailable = true;
}
if (areMechanismsDefined) {
@@ -826,7 +826,7 @@ void CJabberProto::OnProcessFailure(HXML node, ThreadData* info)
const TCHAR *type;
//failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\"
if ((type = xmlGetAttrValue(node, _T("xmlns"))) == NULL) return;
- if ( !_tcscmp(type, _T("urn:ietf:params:xml:ns:xmpp-sasl"))) {
+ if (!_tcscmp(type, _T("urn:ietf:params:xml:ns:xmpp-sasl"))) {
PerformAuthentication(info);
} }
@@ -838,14 +838,14 @@ void CJabberProto::OnProcessError(HXML node, ThreadData* info)
bool skipMsg = false;
//failure xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\"
- if ( !xmlGetChild(node ,0))
+ if (!xmlGetChild(node ,0))
return;
buff = (TCHAR *)mir_alloc(1024*sizeof(TCHAR));
pos=0;
for (i=0; ; i++) {
HXML n = xmlGetChild(node , i);
- if ( !n)
+ if (!n)
break;
const TCHAR *name = xmlGetName(n);
@@ -855,13 +855,13 @@ void CJabberProto::OnProcessError(HXML node, ThreadData* info)
else
pos += mir_sntprintf(buff+pos, 1024-pos, _T("%s\r\n"), name);
- if ( !_tcscmp(name, _T("conflict")))
+ if (!_tcscmp(name, _T("conflict")))
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- else if ( !_tcscmp(name, _T("see-other-host"))) {
+ else if (!_tcscmp(name, _T("see-other-host"))) {
skipMsg = true;
}
}
- if ( !skipMsg) MsgPopup(NULL, buff, TranslateT("Jabber Error"));
+ if (!skipMsg) MsgPopup(NULL, buff, TranslateT("Jabber Error"));
mir_free(buff);
info->send("</stream:stream>");
}
@@ -875,8 +875,8 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info)
if ((type = xmlGetAttrValue(node, _T("xmlns"))) == NULL)
return;
- if ( !_tcscmp(type, _T("urn:ietf:params:xml:ns:xmpp-sasl"))) {
- if ( !info->auth->validateLogin(xmlGetText(node))) {
+ if (!_tcscmp(type, _T("urn:ietf:params:xml:ns:xmpp-sasl"))) {
+ if (!info->auth->validateLogin(xmlGetText(node))) {
info->send("</stream:stream>");
return;
}
@@ -910,34 +910,34 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData* info)
{
OnConsoleProcessXml(node, JCPF_IN);
- if ( !lstrcmp(xmlGetName(node), _T("proceed")))
+ if (!lstrcmp(xmlGetName(node), _T("proceed")))
OnProcessProceed(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("compressed")))
+ else if (!lstrcmp(xmlGetName(node), _T("compressed")))
OnProcessCompressed(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("stream:features")))
+ else if (!lstrcmp(xmlGetName(node), _T("stream:features")))
OnProcessFeatures(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("stream:stream")))
+ else if (!lstrcmp(xmlGetName(node), _T("stream:stream")))
OnProcessStreamOpening(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("success")))
+ else if (!lstrcmp(xmlGetName(node), _T("success")))
OnProcessSuccess(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("failure")))
+ else if (!lstrcmp(xmlGetName(node), _T("failure")))
OnProcessFailure(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("stream:error")))
+ else if (!lstrcmp(xmlGetName(node), _T("stream:error")))
OnProcessError(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("challenge")))
+ else if (!lstrcmp(xmlGetName(node), _T("challenge")))
OnProcessChallenge(node, info);
else if (info->type == JABBER_SESSION_NORMAL) {
- if ( !lstrcmp(xmlGetName(node), _T("message")))
+ if (!lstrcmp(xmlGetName(node), _T("message")))
OnProcessMessage(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("presence")))
+ else if (!lstrcmp(xmlGetName(node), _T("presence")))
OnProcessPresence(node, info);
- else if ( !lstrcmp(xmlGetName(node), _T("iq")))
+ else if (!lstrcmp(xmlGetName(node), _T("iq")))
OnProcessIq(node);
else
debugLogA("Invalid top-level tag (only <message/> <presence/> and <iq/> allowed)");
}
else if (info->type == JABBER_SESSION_REGISTER) {
- if ( !lstrcmp(xmlGetName(node), _T("iq")))
+ if (!lstrcmp(xmlGetName(node), _T("iq")))
OnProcessRegIq(node, info);
else
debugLogA("Invalid top-level tag (only <iq/> allowed)");
@@ -949,7 +949,7 @@ void CJabberProto::OnProcessProceed(HXML node, ThreadData* info)
if ((type = xmlGetAttrValue(node, _T("xmlns"))) != NULL && !lstrcmp(type, _T("error")))
return;
- if ( !lstrcmp(type, _T("urn:ietf:params:xml:ns:xmpp-tls"))) {
+ if (!lstrcmp(type, _T("urn:ietf:params:xml:ns:xmpp-tls"))) {
debugLogA("Starting TLS...");
char* gtlk = strstr(info->manualHost, "google.com");
@@ -959,7 +959,7 @@ void CJabberProto::OnProcessProceed(HXML node, ThreadData* info)
NETLIBSSL ssl = {0};
ssl.cbSize = sizeof(ssl);
ssl.host = isHosted ? info->manualHost : info->server;
- if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, (LPARAM)&ssl)) {
+ if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, (LPARAM)&ssl)) {
debugLogA("SSL initialization failed");
info->send("</stream:stream>");
info->shutdown();
@@ -990,17 +990,17 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData* info)
void CJabberProto::OnProcessPubsubEvent(HXML node)
{
const TCHAR *from = xmlGetAttrValue(node, _T("from"));
- if ( !from)
+ if (!from)
return;
HXML eventNode = xmlGetChildByTag(node, "event", "xmlns", JABBER_FEAT_PUBSUB_EVENT);
- if ( !eventNode)
+ if (!eventNode)
return;
m_pepServices.ProcessEvent(from, eventNode);
HANDLE hContact = HContactFromJID(from);
- if ( !hContact)
+ if (!hContact)
return;
HXML itemsNode;
@@ -1012,7 +1012,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node)
}
HXML tuneNode = XPath(itemsNode, _T("item/tune[@xmlns='") JABBER_FEAT_USER_TUNE _T("']"));
- if ( !tuneNode)
+ if (!tuneNode)
return;
const TCHAR *szArtist = XPathT(tuneNode, "artist");
@@ -1022,7 +1022,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node)
const TCHAR *szTrack = XPathT(tuneNode, "track");
TCHAR szLengthInTime[32];
- szLengthInTime[0] = _T('\0');
+ szLengthInTime[0] = 0;
if (szLength) {
int nLength = _ttoi(szLength);
mir_sntprintf(szLengthInTime, SIZEOF(szLengthInTime), _T("%02d:%02d:%02d"),
@@ -1038,7 +1038,7 @@ DWORD JabberGetLastContactMessageTime(HANDLE hContact)
{
// TODO: time cache can improve performance
HANDLE hDbEvent = db_event_last(hContact);
- if ( !hDbEvent)
+ if (!hDbEvent)
return 0;
DWORD dwTime = 0;
@@ -1048,7 +1048,7 @@ DWORD JabberGetLastContactMessageTime(HANDLE hContact)
if (dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
int nGetTextResult = db_event_get(hDbEvent, &dbei);
- if ( !nGetTextResult)
+ if (!nGetTextResult)
dwTime = dbei.timestamp;
mir_free(dbei.pBlob);
}
@@ -1082,7 +1082,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
{
HXML xNode, n;
- if ( !xmlGetName(node) || _tcscmp(xmlGetName(node), _T("message")))
+ if (!xmlGetName(node) || _tcscmp(xmlGetName(node), _T("message")))
return;
LPCTSTR from, type = xmlGetAttrValue(node, _T("type"));
@@ -1125,7 +1125,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
if (ptszSubject && *ptszSubject) {
size_t cbLen = (szMessage ? _tcslen(szMessage) : 0) + _tcslen(ptszSubject) + 128;
TCHAR *szTmp = (TCHAR *)alloca(sizeof(TCHAR) * cbLen);
- szTmp[0] = _T('\0');
+ szTmp[0] = 0;
if (szMessage)
_tcscat(szTmp, _T("Subject: "));
_tcscat(szTmp, ptszSubject);
@@ -1198,7 +1198,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
// XEP-0224 support (Attention/Nudge)
if (xmlGetChildByTag(node, "attention", "xmlns", JABBER_FEAT_ATTENTION) ||
xmlGetChildByTag(node, "attention", "xmlns", JABBER_FEAT_ATTENTION_0)) {
- if ( !hContact)
+ if (!hContact)
hContact = CreateTemporaryContact(from, chatItem);
if (hContact)
NotifyEventHooks(m_hEventNudge, (WPARAM)hContact, 0);
@@ -1221,11 +1221,11 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
const TCHAR *szId = xmlGetAttrValue(n, _T("id"));
const TCHAR *szMethod = xmlGetAttrValue(n, _T("method"));
const TCHAR *szUrl = xmlGetAttrValue(n, _T("url"));
- if ( !szId || !szMethod || !szUrl)
+ if (!szId || !szMethod || !szUrl)
return;
CJabberHttpAuthParams *pParams = (CJabberHttpAuthParams *)mir_alloc(sizeof(CJabberHttpAuthParams));
- if ( !pParams)
+ if (!pParams)
return;
ZeroMemory(pParams, sizeof(CJabberHttpAuthParams));
@@ -1251,11 +1251,11 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
if (ptszXmlns == NULL)
continue;
- if ( !_tcscmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
+ if (!_tcscmp(ptszXmlns, JABBER_FEAT_MIRANDA_NOTES)) {
if (OnIncomingNote(from, xmlGetChild(xNode, "note")))
return;
}
- else if ( !_tcscmp(ptszXmlns, _T("jabber:x:encrypted"))) {
+ else if (!_tcscmp(ptszXmlns, _T("jabber:x:encrypted"))) {
LPCTSTR ptszText = xmlGetText(xNode);
if (ptszText == NULL)
return;
@@ -1267,12 +1267,12 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
mir_sntprintf(tempstring, len, _T("%s%s%s"), prolog, ptszText, epilog);
szMessage = tempstring;
}
- else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
+ else if (!_tcscmp(ptszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) {
const TCHAR *ptszTimeStamp = xmlGetAttrValue(xNode, _T("stamp"));
if (ptszTimeStamp != NULL)
msgTime = JabberIsoToUnixTime(ptszTimeStamp);
}
- else if ( !_tcscmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
+ else if (!_tcscmp(ptszXmlns, JABBER_FEAT_MESSAGE_EVENTS)) {
// set events support only if we discovered caps and if events not already set
JabberCapsBits jcbCaps = GetResourceCapabilites(from, TRUE);
@@ -1487,7 +1487,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid)
return;
int status = ID_STATUS_OFFLINE;
- if ( !item->arResources.getCount()) {
+ if (!item->arResources.getCount()) {
// set offline only if jid has resources
if (_tcschr(jid, '/') == NULL)
status = item->getTemp()->m_iStatus;
@@ -1546,7 +1546,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
LPCTSTR from, show;
TCHAR *nick;
- if ( !node || !xmlGetName(node) ||_tcscmp(xmlGetName(node), _T("presence"))) return;
+ if (!node || !xmlGetName(node) ||_tcscmp(xmlGetName(node), _T("presence"))) return;
if ((from = xmlGetAttrValue(node, _T("from"))) == NULL) return;
if (m_presenceManager.HandlePresencePermanent(node, info))
@@ -1563,7 +1563,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
TCHAR szBareOurJid[JABBER_MAX_JID_LEN];
JabberStripJid(info->fullJID, szBareOurJid, SIZEOF(szBareOurJid));
- if ( !_tcsicmp(szBareFrom, szBareOurJid))
+ if (!_tcsicmp(szBareFrom, szBareOurJid))
bSelfPresence = TRUE;
LPCTSTR type = xmlGetAttrValue(node, _T("type"));
@@ -1572,14 +1572,14 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
return;
if ((hContact = HContactFromJID(from)) == NULL) {
- if ( !_tcsicmp(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
+ if (!_tcsicmp(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
debugLogA("SKIP Receive presence online from %S (who is not in my roster and not in list - skiping)", from);
mir_free(nick);
return;
}
hContact = DBCreateContact(from, nick, TRUE, TRUE);
}
- if ( !ListGetItemPtr(LIST_ROSTER, from)) {
+ if (!ListGetItemPtr(LIST_ROSTER, from)) {
debugLogA("Receive presence online from %S (who is not in my roster)", from);
ListAdd(LIST_ROSTER, from);
}
@@ -1587,10 +1587,10 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
int status = ID_STATUS_ONLINE;
if ((showNode = xmlGetChild(node , "show")) != NULL) {
if ((show = xmlGetText(showNode)) != NULL) {
- if ( !_tcscmp(show, _T("away"))) status = ID_STATUS_AWAY;
- else if ( !_tcscmp(show, _T("xa"))) status = ID_STATUS_NA;
- else if ( !_tcscmp(show, _T("dnd"))) status = ID_STATUS_DND;
- else if ( !_tcscmp(show, _T("chat"))) status = ID_STATUS_FREECHAT;
+ if (!_tcscmp(show, _T("away"))) status = ID_STATUS_AWAY;
+ else if (!_tcscmp(show, _T("xa"))) status = ID_STATUS_NA;
+ else if (!_tcscmp(show, _T("dnd"))) status = ID_STATUS_DND;
+ else if (!_tcscmp(show, _T("chat"))) status = ID_STATUS_FREECHAT;
}
}
@@ -1618,7 +1618,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
debugLogA("Avatar enabled");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
- if ( !lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("jabber:x:avatar"))) {
+ if (!lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("jabber:x:avatar"))) {
LPCTSTR ptszHash = xmlGetText( xmlGetChild(xNode , "hash"));
if (ptszHash != NULL) {
delSetting(hContact,"AvatarXVcard");
@@ -1634,10 +1634,10 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
else removedAvatar = true;
}
}
- if ( !hasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
+ if (!hasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
debugLogA("Not hasXAvatar");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
- if ( !lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("vcard-temp:x:update"))) {
+ if (!lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("vcard-temp:x:update"))) {
if ((xNode = xmlGetChild(xNode , "photo")) != NULL) {
LPCTSTR txt = xmlGetText(xNode);
if (txt != NULL && txt[0] != 0) {
@@ -1654,7 +1654,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
else removedAvatar = true;
} } } }
- if ( !hasAvatar && removedAvatar) {
+ if (!hasAvatar && removedAvatar) {
debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
@@ -1665,7 +1665,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
return;
}
- if ( !_tcscmp(type, _T("unavailable"))) {
+ if (!_tcscmp(type, _T("unavailable"))) {
hContact = HContactFromJID(from);
if ((item = ListGetItemPtr(LIST_ROSTER, from)) != NULL) {
ListRemoveResource(LIST_ROSTER, from);
@@ -1679,7 +1679,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
// set status only if no more available resources
- if ( !item->arResources.getCount()) {
+ if (!item->arResources.getCount()) {
item->getTemp()->m_iStatus = ID_STATUS_OFFLINE;
item->getTemp()->m_tszStatusMessage = mir_tstrdup(xmlGetText( xmlGetChild(node , "status")));
}
@@ -1695,7 +1695,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
return;
}
- if ( !_tcscmp(type, _T("subscribe"))) {
+ if (!_tcscmp(type, _T("subscribe"))) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBE);
@@ -1732,19 +1732,19 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
return;
}
- if ( !_tcscmp(type, _T("unsubscribe")))
+ if (!_tcscmp(type, _T("unsubscribe")))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBE);
- if ( !_tcscmp(type, _T("unsubscribed")))
+ if (!_tcscmp(type, _T("unsubscribed")))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_UNSUBSCRIBED);
- if ( !_tcscmp(type, _T("error")))
+ if (!_tcscmp(type, _T("error")))
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_ERROR);
- if ( !_tcscmp(type, _T("subscribed"))) {
+ if (!_tcscmp(type, _T("subscribed"))) {
if (hContact = HContactFromJID(from))
AddDbPresenceEvent(hContact, JABBER_DB_EVENT_PRESENCE_SUBSCRIBED);
@@ -1843,7 +1843,7 @@ void CJabberProto::OnProcessIq(HXML node)
HXML queryNode;
const TCHAR *type, *xmlns;
- if ( !xmlGetName(node) || _tcscmp(xmlGetName(node), _T("iq"))) return;
+ if (!xmlGetName(node) || _tcscmp(xmlGetName(node), _T("iq"))) return;
if ((type=xmlGetAttrValue(node, _T("type"))) == NULL) return;
int id = JabberGetPacketID(node);
@@ -1864,7 +1864,7 @@ void CJabberProto::OnProcessIq(HXML node)
return;
// RECVED: <iq type='error'> ...
- if ( !_tcscmp(type, _T("error"))) {
+ if (!_tcscmp(type, _T("error"))) {
debugLogA("XXX on entry");
// Check for file transfer deny by comparing idStr with ft->iqId
LISTFOREACH(i, this, LIST_FILE)
@@ -1896,12 +1896,12 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData* info)
HXML errorNode;
const TCHAR *type;
- if ( !xmlGetName(node) || _tcscmp(xmlGetName(node), _T("iq"))) return;
+ if (!xmlGetName(node) || _tcscmp(xmlGetName(node), _T("iq"))) return;
if ((type=xmlGetAttrValue(node, _T("type"))) == NULL) return;
int id = JabberGetPacketID(node);
- if ( !_tcscmp(type, _T("result"))) {
+ if (!_tcscmp(type, _T("result"))) {
// RECVED: result of the request for registration mechanism
// ACTION: send account registration information
@@ -1924,7 +1924,7 @@ void CJabberProto::OnProcessRegIq(HXML node, ThreadData* info)
info->reg_done = TRUE;
} }
- else if ( !_tcscmp(type, _T("error"))) {
+ else if (!_tcscmp(type, _T("error"))) {
errorNode = xmlGetChild(node , "error");
TCHAR *str = JabberErrorMsg(errorNode);
SendMessage(info->reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)str);
diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp
index 4e8fd70935..3f864deb60 100644
--- a/protocols/JabberG/src/jabber_treelist.cpp
+++ b/protocols/JabberG/src/jabber_treelist.cpp
@@ -201,7 +201,7 @@ HTREELISTITEM TreeList_GetActiveItem(HWND hwnd)
HTREELISTITEM TreeList_AddItem(HWND hwnd, HTREELISTITEM hParent, TCHAR *text, LPARAM nodeDdata)
{
TTreeList_Data *data = (TTreeList_Data *)sttTreeList_GeWindowData(hwnd);
- if ( !hParent) hParent = data->root;
+ if (!hParent) hParent = data->root;
TTreeList_ItemInfo *item = new TTreeList_ItemInfo;
item->data = nodeDdata;
@@ -359,7 +359,7 @@ BOOL TreeList_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, UINT id
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;
+ if (!hItem->subItems.getCount() && !(hItem->flags & TLIF_FAKEPARENT)) break;
data->hItemSelected = hItem;
NMTREEVIEW nmtv;
@@ -480,7 +480,7 @@ static int sttTreeList_SortItems_Cmp5(const void *p1, const void *p2) { return -
static void sttTreeList_SortItems(HTREELISTITEM hItem, LPARAM data)
{
- if ( !hItem->subItems.getCount()) return;
+ if (!hItem->subItems.getCount()) return;
typedef int (__cdecl *TQSortCmp)(const void *, const void *);
static TQSortCmp funcs[] =
@@ -499,7 +499,7 @@ static void sttTreeList_ResetIndex(HTREELISTITEM hItem, LPARAM data)
{
hItem->flags &= ~TLIF_HASITEM;
- if ( !hItem->parent || (hItem->parent->flags & TLIF_VISIBLE) && (hItem->parent->flags & TLIF_EXPANDED))
+ if (!hItem->parent || (hItem->parent->flags & TLIF_VISIBLE) && (hItem->parent->flags & TLIF_EXPANDED))
hItem->flags |= TLIF_VISIBLE;
else
hItem->flags &= ~TLIF_VISIBLE;
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index d30f5c4fa4..77262da4f2 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -45,7 +45,7 @@ struct UserInfoStringBuf
~UserInfoStringBuf() { mir_free(buf); }
void append(TCHAR *str) {
- if ( !str) return;
+ if (!str) return;
int length = lstrlen(str);
if (size - offset < length + 1) {
@@ -159,7 +159,7 @@ void sttCleanupInfo(HWND hwndTree, int stage)
hItem = hItemTmp;
else {
while (1) {
- if ( !(hItem = TreeView_GetParent(hwndTree, hItem))) break;
+ if (!(hItem = TreeView_GetParent(hwndTree, hItem))) break;
if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) {
hItem = hItemTmp;
break;
@@ -261,7 +261,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
int len = lstrlen(buf);
if (len > 0) buf[len-1] = 0;
}
- else if ( !r->m_dwIdleStartTime)
+ else if (!r->m_dwIdleStartTime)
lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf));
else
lstrcpyn(buf, TranslateT("<not specified>"), SIZEOF(buf));
@@ -272,7 +272,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
mir_sntprintf(buf, SIZEOF(buf), _T("%s/%s"), item->jid, r->m_tszResourceName);
JabberCapsBits jcb = ppro->GetResourceCapabilites(buf, TRUE);
- if ( !(jcb & JABBER_RESOURCE_CAPS_ERROR)) {
+ if (!(jcb & JABBER_RESOURCE_CAPS_ERROR)) {
HTREEITEM htiCaps = sttFillInfoLine(hwndTree, htiResource, ppro->LoadIconEx("main"), NULL, TranslateT("Client capabilities"), sttInfoLineId(resource, INFOLINE_CAPS));
int i;
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
@@ -369,7 +369,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
int len = lstrlen(buf);
if (len > 0) buf[len-1] = 0;
}
- else if ( !r->m_dwIdleStartTime)
+ else if (!r->m_dwIdleStartTime)
lstrcpyn(buf, TranslateT("unknown"), SIZEOF(buf));
else
lstrcpyn(buf, TranslateT("<not specified>"), SIZEOF(buf));
@@ -395,7 +395,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
for (int i=0; i < item->arResources.getCount(); i++)
sttFillResourceInfo(ppro, hwndTree, htiRoot, item, i+1);
}
- else if ( !_tcschr(item->jid, _T('@')) || (r->m_iStatus != ID_STATUS_OFFLINE))
+ else if (!_tcschr(item->jid, _T('@')) || (r->m_iStatus != ID_STATUS_OFFLINE))
sttFillResourceInfo(ppro, hwndTree, htiRoot, item, 0);
sttCleanupInfo(hwndTree, 1);
@@ -414,7 +414,7 @@ static void sttGetNodeText(HWND hwndTree, HTREEITEM hti, UserInfoStringBuf *buf,
tvi.hItem = hti;
tvi.cchTextMax = 256;
tvi.pszText = buf->allocate(tvi.cchTextMax);
- if ( !TreeView_GetItem(hwndTree, &tvi)) { // failure, maybe item was removed...
+ if (!TreeView_GetItem(hwndTree, &tvi)) { // failure, maybe item was removed...
buf->buf[ buf->offset ] = 0;
buf->actualize();
return;
@@ -446,7 +446,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
if (CallService(MS_DB_CONTACT_IS, (WPARAM)lParam, 0))
dat->hContact = (HANDLE)lParam;
- else if ( !IsBadReadPtr((void*)lParam, sizeof(JABBER_LIST_ITEM))) {
+ else if (!IsBadReadPtr((void*)lParam, sizeof(JABBER_LIST_ITEM))) {
dat->hContact = NULL;
dat->item = (JABBER_LIST_ITEM *)lParam;
}
@@ -465,17 +465,17 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
break;
case WM_JABBER_REFRESH:
- if ( !dat) break;
+ if (!dat) break;
- if ( !dat->item) {
+ if (!dat->item) {
ptrT jid( dat->ppro->getTStringA(dat->hContact, "jid"));
if (jid == NULL)
break;
- if ( !(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)))
+ if (!(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)))
dat->item = dat->ppro->ListGetItemPtr(LIST_ROSTER, jid);
- if ( !dat->item) {
+ if (!dat->item) {
HWND hwndTree = GetDlgItem(hwndDlg, IDC_TV_INFO);
TreeView_DeleteAllItems(hwndTree);
HTREEITEM htiRoot = sttFillInfoLine(hwndTree, NULL, dat->ppro->LoadIconEx("main"), _T("JID"), jid, sttInfoLineId(0, INFOLINE_NAME), true);
@@ -560,7 +560,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
if (dat->hContact != NULL) {
ptrT jid( dat->ppro->getTStringA(dat->hContact, "jid"));
if (jid != NULL)
- if ( !(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)))
+ if (!(dat->item = dat->ppro->ListGetItemPtr(LIST_VCARD_TEMP, jid)))
dat->item = dat->ppro->ListGetItemPtr(LIST_ROSTER, jid);
}
break;
@@ -710,9 +710,9 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
break;
case WM_PAINT:
- if ( !photoInfo->ppro->m_bJabberOnline)
+ if (!photoInfo->ppro->m_bJabberOnline)
SetDlgItemText(hwndDlg, IDC_CANVAS, TranslateT("<Photo not available while offline>"));
- else if ( !photoInfo->hBitmap)
+ else if (!photoInfo->hBitmap)
SetDlgItemText(hwndDlg, IDC_CANVAS, TranslateT("<No photo>"));
else {
BITMAP bm;
@@ -797,7 +797,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
{
- if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName))
+ if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName))
return 0;
HANDLE hContact = (HANDLE)lParam;
@@ -841,7 +841,7 @@ void JabberUserInfoInit()
void JabberUserInfoUpdate(HANDLE hContact)
{
- if ( !hContact)
+ if (!hContact)
WindowList_BroadcastAsync(hUserInfoList, WM_JABBER_REFRESH, 0, 0);
else if (HWND hwnd = WindowList_Find(hUserInfoList, hContact))
PostMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 4738ecfd4a..07814849e3 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -135,9 +135,9 @@ TCHAR* JabberPrepareJid(LPCTSTR jid)
{
if (jid == NULL) return NULL;
TCHAR *szNewJid = mir_tstrdup(jid);
- if ( !szNewJid) return NULL;
+ if (!szNewJid) return NULL;
TCHAR *pDelimiter = _tcschr(szNewJid, _T('/'));
- if (pDelimiter) *pDelimiter = _T('\0');
+ if (pDelimiter) *pDelimiter = 0;
CharLower(szNewJid);
if (pDelimiter) *pDelimiter = _T('/');
return szNewJid;
@@ -162,7 +162,7 @@ char* __stdcall JabberUrlDecode(char *str)
for (p=q=str; *p!='\0'; p++,q++) {
if (*p == '<') {
// skip CDATA
- if ( !strncmp(p, "<![CDATA[", 9)) {
+ if (!strncmp(p, "<![CDATA[", 9)) {
p += 9;
char *tail = strstr(p, "]]>");
size_t count = tail ? (tail-p) : strlen(p);
@@ -173,11 +173,11 @@ char* __stdcall JabberUrlDecode(char *str)
else *q = *p;
}
else if (*p == '&') {
- if ( !strncmp(p, "&amp;", 5)) { *q = '&'; p += 4; }
- else if ( !strncmp(p, "&apos;", 6)) { *q = '\''; p += 5; }
- else if ( !strncmp(p, "&gt;", 4)) { *q = '>'; p += 3; }
- else if ( !strncmp(p, "&lt;", 4)) { *q = '<'; p += 3; }
- else if ( !strncmp(p, "&quot;", 6)) { *q = '"'; p += 5; }
+ if (!strncmp(p, "&amp;", 5)) { *q = '&'; p += 4; }
+ else if (!strncmp(p, "&apos;", 6)) { *q = '\''; p += 5; }
+ else if (!strncmp(p, "&gt;", 4)) { *q = '>'; p += 3; }
+ else if (!strncmp(p, "&lt;", 4)) { *q = '<'; p += 3; }
+ else if (!strncmp(p, "&quot;", 6)) { *q = '"'; p += 5; }
else { *q = *p; }
}
else *q = *p;
@@ -194,11 +194,11 @@ void __stdcall JabberUrlDecodeW(WCHAR *str)
WCHAR *p, *q;
for (p=q=str; *p!='\0'; p++,q++) {
if (*p == '&') {
- if ( !wcsncmp(p, L"&amp;", 5)) { *q = '&'; p += 4; }
- else if ( !wcsncmp(p, L"&apos;", 6)) { *q = '\''; p += 5; }
- else if ( !wcsncmp(p, L"&gt;", 4)) { *q = '>'; p += 3; }
- else if ( !wcsncmp(p, L"&lt;", 4)) { *q = '<'; p += 3; }
- else if ( !wcsncmp(p, L"&quot;", 6)) { *q = '"'; p += 5; }
+ if (!wcsncmp(p, L"&amp;", 5)) { *q = '&'; p += 4; }
+ else if (!wcsncmp(p, L"&apos;", 6)) { *q = '\''; p += 5; }
+ else if (!wcsncmp(p, L"&gt;", 4)) { *q = '>'; p += 3; }
+ else if (!wcsncmp(p, L"&lt;", 4)) { *q = '<'; p += 3; }
+ else if (!wcsncmp(p, L"&quot;", 6)) { *q = '"'; p += 5; }
else { *q = *p; }
}
else {
@@ -505,7 +505,7 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode)
void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible)
{
- if ( !m_bJabberOnline) return;
+ if (!m_bJabberOnline) return;
LISTFOREACH(i, this, LIST_ROSTER)
{
@@ -577,9 +577,9 @@ time_t __stdcall JabberIsoToUnixTime(const TCHAR *stamp)
return (time_t) 0;
}
-void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR *msg)
+void CJabberProto::SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg)
{
- if ( !m_bJabberOnline) return;
+ if (!m_bJabberOnline) return;
// Send <presence/> update for status (we won't handle ID_STATUS_OFFLINE here)
short iPriority = (short)getWord("Priority", 0);
@@ -718,7 +718,7 @@ int __stdcall JabberGetPacketID(HXML n)
const TCHAR *str = xmlGetAttrValue(n, _T("id"));
if (str)
- if ( !_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID)-1))
+ if (!_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID)-1))
result = _ttoi(str + SIZEOF(JABBER_IQID)-1);
return result;
@@ -786,7 +786,7 @@ TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen)
LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
{
if (LPCTSTR ptszType = xmlGetText( xmlGetChild(node , "TYPE")))
- if ( !_tcscmp(ptszType, _T("image/jpeg")) ||
+ if (!_tcscmp(ptszType, _T("image/jpeg")) ||
!_tcscmp(ptszType, _T("image/png")) ||
!_tcscmp(ptszType, _T("image/gif")) ||
!_tcscmp(ptszType, _T("image/bmp")))
@@ -847,7 +847,7 @@ TStringPairs::~TStringPairs()
const char* TStringPairs::operator[](const char* key) const
{
for (int i=0; i < numElems; i++)
- if ( !strcmp(elems[i].name, key))
+ if (!strcmp(elems[i].name, key))
return elems[i].value;
return "";
@@ -866,13 +866,13 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par
SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, tszRecent);
}
- if ( !SendDlgItemMessage(hwndDlg, idcCombo, CB_GETCOUNT, 0, 0))
+ if (!SendDlgItemMessage(hwndDlg, idcCombo, CB_GETCOUNT, 0, 0))
SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, (LPARAM)_T(""));
}
-void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, TCHAR *string, int recentCount)
+void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const TCHAR *string, int recentCount)
{
- if ( !string || !*string)
+ if (!string || !*string)
return;
if (SendDlgItemMessage(hwndDlg, idcCombo, CB_FINDSTRING, (WPARAM)-1, (LPARAM)string) != CB_ERR)
return;
@@ -895,11 +895,11 @@ void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param
static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param)
{
CJabberProto *ppro = (CJabberProto *)param;
- if ( !ppro->m_pInfoFrame)
+ if (!ppro->m_pInfoFrame)
return;
ppro->m_pInfoFrame->LockUpdates();
- if ( !ppro->m_bJabberOnline) {
+ if (!ppro->m_bJabberOnline) {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
ppro->m_pInfoFrame->RemoveInfoItem("$/Transports");
ppro->m_pInfoFrame->UpdateInfoItem("$/JID", LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS), TranslateT("Offline"));
@@ -907,7 +907,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param)
else {
ppro->m_pInfoFrame->UpdateInfoItem("$/JID", LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS), ppro->m_szJabberJID);
- if ( !ppro->m_bPepSupported)
+ if (!ppro->m_bPepSupported)
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP");
else {
ppro->m_pInfoFrame->RemoveInfoItem("$/PEP/");
@@ -994,9 +994,10 @@ const TCHAR *JabberStrIStr(const TCHAR *str, const TCHAR *substr)
////////////////////////////////////////////////////////////////////////
// clipboard processing
-void JabberCopyText(HWND hwnd, TCHAR *text)
+
+void JabberCopyText(HWND hwnd, const TCHAR *text)
{
- if ( !hwnd || !text) return;
+ if (!hwnd || !text) return;
OpenClipboard(hwnd);
EmptyClipboard();
@@ -1011,20 +1012,18 @@ void JabberCopyText(HWND hwnd, TCHAR *text)
/////////////////////////////////////////////////////////////////////////////////////////
// One string entry dialog
-struct JabberEnterStringParams
+struct JabberEnterStringParam
{
CJabberProto *ppro;
- int type;
- TCHAR *caption;
- TCHAR *result;
- size_t resultLen;
- char *windowName;
- int recentCount;
- int timeout;
-
- int idcControl;
- int height;
+ int type;
+ LPCTSTR caption;
+ CMString &result;
+ char *windowName;
+ int recentCount;
+ int timeout;
+ int idcControl;
+ int height;
};
static int sttEnterStringResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
@@ -1033,25 +1032,25 @@ static int sttEnterStringResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
case IDC_TXT_MULTILINE:
case IDC_TXT_COMBO:
case IDC_TXT_RICHEDIT:
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP|RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP | RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDOK:
case IDCANCEL:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- JabberEnterStringParams *params = (JabberEnterStringParams *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ JabberEnterStringParam *params = (JabberEnterStringParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIconBig(SKINICON_OTHER_RENAME));
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_RENAME));
- params = (JabberEnterStringParams *)lParam;
+ params = (JabberEnterStringParam *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)params);
SetWindowText(hwndDlg, params->caption);
{
@@ -1059,19 +1058,19 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
switch (params->type) {
case JES_PASSWORD:
params->idcControl = IDC_TXT_PASSWORD;
- params->height = rc.bottom-rc.top;
+ params->height = rc.bottom - rc.top;
break;
- case JES_MULTINE:
+ case JES_MULTILINE:
params->idcControl = IDC_TXT_MULTILINE;
params->height = 0;
- rc.bottom += (rc.bottom-rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOMOVE|SWP_NOREPOSITION);
+ rc.bottom += (rc.bottom - rc.top) * 2;
+ SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
break;
case JES_COMBO:
params->idcControl = IDC_TXT_COMBO;
- params->height = rc.bottom-rc.top;
+ params->height = rc.bottom - rc.top;
if (params->windowName && params->recentCount)
params->ppro->ComboLoadRecentStrings(hwndDlg, IDC_TXT_COMBO, params->windowName, params->recentCount);
break;
@@ -1081,8 +1080,8 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_TXT_RICHEDIT, EM_SETEVENTMASK, 0, ENM_LINK);
params->height = 0;
- rc.bottom += (rc.bottom-rc.top) * 2;
- SetWindowPos(hwndDlg, NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOMOVE|SWP_NOREPOSITION);
+ rc.bottom += (rc.bottom - rc.top) * 2;
+ SetWindowPos(hwndDlg, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOREPOSITION);
break;
}
}
@@ -1128,7 +1127,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
case WM_SIZE:
{
- UTILRESIZEDIALOG urd = {0};
+ UTILRESIZEDIALOG urd = { 0 };
urd.cbSize = sizeof(urd);
urd.hInstance = hInst;
urd.hwndDlg = hwndDlg;
@@ -1171,25 +1170,6 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
case WM_COMMAND:
switch (LOWORD(wParam)) {
- case IDOK:
- GetDlgItemText(hwndDlg, params->idcControl, params->result, (int)params->resultLen);
- params->result[ params->resultLen-1 ] = 0;
-
- if ((params->type == JES_COMBO) && params->windowName && params->recentCount)
- params->ppro->ComboAddRecentString(hwndDlg, IDC_TXT_COMBO, params->windowName, params->result, params->recentCount);
- if (params->windowName)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
-
- EndDialog(hwndDlg, 1);
- break;
-
- case IDCANCEL:
- if (params->windowName)
- Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
-
- EndDialog(hwndDlg, 0);
- break;
-
case IDC_TXT_MULTILINE:
case IDC_TXT_RICHEDIT:
if ((HIWORD(wParam) != EN_SETFOCUS) && (HIWORD(wParam) != EN_KILLFOCUS)) {
@@ -1204,28 +1184,42 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
KillTimer(hwndDlg, 1001);
}
break;
+
+ case IDCANCEL:
+ if (params->windowName)
+ Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
+
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case IDOK:
+ HWND hWnd = GetDlgItem(hwndDlg, params->idcControl);
+ int len = GetWindowTextLength(hWnd);
+ params->result.Truncate(len);
+ GetWindowText(hWnd, params->result.GetBuffer(), len);
+
+ if ((params->type == JES_COMBO) && params->windowName && params->recentCount)
+ params->ppro->ComboAddRecentString(hwndDlg, IDC_TXT_COMBO, params->windowName, params->result, params->recentCount);
+ if (params->windowName)
+ Utils_SaveWindowPosition(hwndDlg, NULL, params->ppro->m_szModuleName, params->windowName);
+
+ EndDialog(hwndDlg, 1);
+ break;
}
}
return FALSE;
}
-BOOL CJabberProto::EnterString(TCHAR *result, size_t resultLen, TCHAR *caption, int type, char *windowName, int recentCount, int timeout)
+BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
{
- bool free_caption = false;
- if ( !caption || caption == result) {
- free_caption = true;
- caption = mir_tstrdup(result);
- result[0] = _T('\0');
+ if (caption == NULL) {
+ caption = NEWTSTR_ALLOCA(result.GetString());
+ result.Empty();
}
- JabberEnterStringParams params = { this, type, caption, result, resultLen, windowName, recentCount, timeout };
-
- BOOL bRetVal = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_INPUT), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(&params));
-
- if (free_caption) mir_free(caption);
-
- return bRetVal;
+ JabberEnterStringParam param = { this, type, caption, result, windowName, recentCount, timeout };
+ return DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_INPUT), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(&param));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1244,52 +1238,46 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime)
// skip '-' chars
TCHAR *szStamp = NEWTSTR_ALLOCA(ptszTimeStamp);
int si = 0, sj = 0;
- while (1) {
+ while (true) {
if (szStamp[si] == _T('-'))
si++;
- else
- if ( !(szStamp[sj++] = szStamp[si++]))
- break;
+ else if (!(szStamp[sj++] = szStamp[si++]))
+ break;
};
msgTime = JabberIsoToUnixTime(szStamp);
return msgTime != 0;
}
-BOOL CJabberProto::IsMyOwnJID(LPCTSTR szJID)
+bool CJabberProto::IsMyOwnJID(LPCTSTR szJID)
{
if (m_ThreadInfo == NULL)
- return FALSE;
+ return false;
- TCHAR *szFrom = JabberPrepareJid(szJID);
- if ( !szFrom)
- return FALSE;
+ ptrT szFrom(JabberPrepareJid(szJID));
+ if (szFrom == NULL)
+ return false;
- TCHAR *szTo = JabberPrepareJid(m_ThreadInfo->fullJID);
- if ( !szTo) {
- mir_free(szFrom);
- return FALSE;
- }
+ ptrT szTo(JabberPrepareJid(m_ThreadInfo->fullJID));
+ if (szTo == NULL)
+ return false;
TCHAR *pDelimiter = _tcschr(szFrom, _T('/'));
- if (pDelimiter) *pDelimiter = _T('\0');
+ if (pDelimiter)
+ *pDelimiter = 0;
pDelimiter = _tcschr(szTo, _T('/'));
- if (pDelimiter) *pDelimiter = _T('\0');
-
- BOOL bRetVal = _tcscmp(szFrom, szTo) == 0;
-
- mir_free(szFrom);
- mir_free(szTo);
+ if (pDelimiter)
+ *pDelimiter = 0;
- return bRetVal;
+ return _tcscmp(szFrom, szTo) == 0;
}
void __cdecl CJabberProto::LoadHttpAvatars(void* param)
{
OBJLIST<JABBER_HTTP_AVATARS> &avs = *(OBJLIST<JABBER_HTTP_AVATARS>*)param;
HANDLE hHttpCon = NULL;
- for (int i=0; i < avs.getCount(); i++) {
- NETLIBHTTPREQUEST nlhr = {0};
+ for (int i = 0; i < avs.getCount(); i++) {
+ NETLIBHTTPREQUEST nlhr = { 0 };
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT;
@@ -1308,14 +1296,14 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
AI.hContact = avs[i].hContact;
if (getByte(AI.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
- TCHAR tszFileName[ MAX_PATH ];
+ TCHAR tszFileName[MAX_PATH];
GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
DeleteFile(tszFileName);
}
setByte(AI.hContact, "AvatarType", pictureType);
- char buffer[2*MIR_SHA1_HASH_SIZE+1];
+ char buffer[2 * MIR_SHA1_HASH_SIZE + 1];
BYTE digest[MIR_SHA1_HASH_SIZE];
mir_sha1_ctx sha;
mir_sha1_init(&sha);
@@ -1323,9 +1311,9 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
mir_sha1_finish(&sha, digest);
bin2hex(digest, sizeof(digest), buffer);
- ptrA cmpsha( getStringA(AI.hContact, "AvatarSaved"));
+ ptrA cmpsha(getStringA(AI.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
- TCHAR tszFileName[ MAX_PATH ];
+ TCHAR tszFileName[MAX_PATH];
GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
_tcsncpy(AI.filename, tszFileName, SIZEOF(AI.filename));
FILE* out = _tfopen(tszFileName, _T("wb"));
@@ -1334,7 +1322,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
fclose(out);
setString(AI.hContact, "AvatarSaved", buffer);
ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
- debugLogA("Broadcast new avatar: %s",AI.filename);
+ debugLogA("Broadcast new avatar: %s", AI.filename);
}
else ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
}
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index dea65d74a2..a150a6439a 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int CJabberProto::SendGetVcard(const TCHAR *jid)
{
- if ( !m_bJabberOnline) return 0;
+ if (!m_bJabberOnline) return 0;
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultGetVcard, JABBER_IQ_TYPE_GET, jid);
m_ThreadInfo->send( XmlNodeIq(pInfo) << XCHILDNS(_T("vCard"), JABBER_FEAT_VCARD_TEMP)
@@ -101,7 +101,7 @@ static INT_PTR CALLBACK PersonalDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !ppro->m_vCardUpdates)
+ if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
} }
@@ -164,7 +164,7 @@ static INT_PTR CALLBACK HomeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !ppro->m_vCardUpdates)
+ if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
} }
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !ppro->m_vCardUpdates)
+ if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
} }
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
switch (msg) {
case WM_INITDIALOG:
- if ( !lParam) break; // Launched from userinfo
+ if (!lParam) break; // Launched from userinfo
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_LOAD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPEN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_LOAD, BUTTONSETASFLATBTN, TRUE, 0);
@@ -464,7 +464,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
case PSN_APPLY:
dat->ppro->m_vCardUpdates &= ~(1UL<<iPageId);
dat->ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !dat->ppro->m_vCardUpdates)
+ if (!dat->ppro->m_vCardUpdates)
dat->ppro->SetServerVcard(dat->ppro->m_bPhotoChanged, dat->ppro->m_szPhotoFileName);
break;
} }
@@ -494,7 +494,7 @@ static INT_PTR CALLBACK NoteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch (msg) {
case WM_INITDIALOG:
- if ( !lParam) break; // Launched from userinfo
+ if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
@@ -522,7 +522,7 @@ static INT_PTR CALLBACK NoteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !ppro->m_vCardUpdates)
+ if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
} }
@@ -692,7 +692,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
switch(msg) {
case WM_INITDIALOG:
- if ( !lParam) break; // Launched from userinfo
+ if (!lParam) break; // Launched from userinfo
ppro = (CJabberProto*)lParam;
{
LVCOLUMN lvc;
@@ -782,7 +782,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
case PSN_APPLY:
ppro->m_vCardUpdates &= ~(1UL<<iPageId);
ppro->SaveVcardToDB(hwndDlg, iPageId);
- if ( !ppro->m_vCardUpdates)
+ if (!ppro->m_vCardUpdates)
ppro->SetServerVcard(ppro->m_bPhotoChanged, ppro->m_szPhotoFileName);
break;
}
@@ -1018,7 +1018,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char *tag, char *key)
void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
{
- if ( !m_bJabberOnline) return;
+ if (!m_bJabberOnline) return;
int i;
char idstr[33];
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp
index 2060fd7273..7d4208a2cc 100644
--- a/protocols/JabberG/src/jabber_xml.cpp
+++ b/protocols/JabberG/src/jabber_xml.cpp
@@ -246,15 +246,15 @@ HXML __fastcall xmlGetNthChild(HXML hXml, LPCTSTR tag, int nth)
{
int i, num;
- if ( !hXml || tag == NULL || _tcslen(tag) <= 0 || nth < 1)
+ if (!hXml || tag == NULL || _tcslen(tag) <= 0 || nth < 1)
return NULL;
num = 1;
for (i=0; ; i++) {
HXML n = xi.getChild(hXml, i);
- if ( !n)
+ if (!n)
break;
- if ( !lstrcmp(tag, xmlGetName(n))) {
+ if (!lstrcmp(tag, xmlGetName(n))) {
if (num == nth)
return n;
@@ -278,7 +278,7 @@ LPCTSTR __fastcall xmlGetText(HXML xml)
void XPath::ProcessPath(LookupInfo &info, bool bCreate)
{
- if ( !info.nodeName) return;
+ if (!info.nodeName) return;
TCHAR *nodeName = (TCHAR *)alloca(sizeof(TCHAR) * (info.nodeName.length+1));
lstrcpyn(nodeName, info.nodeName.p, info.nodeName.length+1);
@@ -320,7 +320,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate)
case S_START:
{
ProcessPath(info, bCreate);
- if ( !m_hXml)
+ if (!m_hXml)
{
state = S_FINAL_ERROR;
break;
@@ -503,7 +503,7 @@ XPath::PathType XPath::LookupImpl(bool bCreate)
}
}
- if ( !*p && (state < S_FINAL))
+ if (!*p && (state < S_FINAL))
{
state = S_FINAL_ERROR;
}
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index b5280a5b4f..4f8eb9c674 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -334,11 +334,11 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam)
FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(COLOR_WINDOW));
}
- if ( !mode->m_subitem || (lpdis->itemState & ODS_COMBOBOXEDIT)) {
+ if (!mode->m_subitem || (lpdis->itemState & ODS_COMBOBOXEDIT)) {
TCHAR text[128];
if (mode->m_subitem) {
for (int i = lpdis->itemData; i >= 0; --i)
- if ( !m_modes[i].m_subitem) {
+ if (!m_modes[i].m_subitem) {
mir_sntprintf(text, SIZEOF(text), _T("%s [%s]"), m_modes[i].m_title, mode->m_title);
break;
}
@@ -415,7 +415,7 @@ void CPepService::ResetPublish()
void CPepService::ForceRepublishOnLogin()
{
- if ( !m_wasPublished)
+ if (!m_wasPublished)
Publish();
}
@@ -489,7 +489,7 @@ void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text)
if (m_szText) mir_free(m_szText);
m_szText = text ? mir_tstrdup(text) : NULL;
- if ( !m_hMenuItem) return;
+ if (!m_hMenuItem) return;
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR | CMIM_ICON | CMIM_NAME;
@@ -617,9 +617,9 @@ CPepMood::~CPepMood()
void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode)
{
HANDLE hContact = NULL, hSelfContact = NULL;
- if ( !m_proto->IsMyOwnJID(from)) {
+ if (!m_proto->IsMyOwnJID(from)) {
hContact = m_proto->HContactFromJID(from);
- if ( !hContact) return;
+ if (!hContact) return;
}
else hSelfContact = m_proto->HContactFromJID(from);
@@ -631,11 +631,11 @@ void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode)
}
HXML n, moodNode = XPath(itemsNode, _T("item/mood[@xmlns='") JABBER_FEAT_USER_MOOD _T("']"));
- if ( !moodNode) return;
+ if (!moodNode) return;
LPCTSTR moodType = NULL, moodText = NULL;
for (int i=0; n = xmlGetChild(moodNode, i); i++) {
- if ( !_tcscmp(xmlGetName(n), _T("text")))
+ if (!_tcscmp(xmlGetName(n), _T("text")))
moodText = xmlGetText(n);
else
moodType = xmlGetName(n);
@@ -647,7 +647,7 @@ void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode)
SetMood(hContact, moodType, fixedText);
mir_free(fixedText);
- if ( !hContact && m_mode >= 0)
+ if (!hContact && m_mode >= 0)
ForceRepublishOnLogin();
}
@@ -678,7 +678,7 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
char* p = mir_t2a(szMood);
for (int i = 1; i < SIZEOF(g_arrMoods); i++)
- if ( !lstrcmpA(g_arrMoods[i].szTag, p)) {
+ if (!lstrcmpA(g_arrMoods[i].szTag, p)) {
mood = i;
break;
}
@@ -689,7 +689,7 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
return;
}
- if ( !hContact) {
+ if (!hContact) {
m_mode = mood;
replaceStrT(m_text, szText);
@@ -734,14 +734,14 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
void CPepMood::ShowSetDialog(BYTE bQuiet)
{
- if ( !bQuiet) {
+ if (!bQuiet) {
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
for (int i = 1; i < SIZEOF(g_arrMoods); i++)
dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName));
dlg.SetActiveStatus(m_mode, m_text);
dlg.DoModal();
- if ( !dlg.OkClicked())
+ if (!dlg.OkClicked())
return;
m_mode = dlg.GetStatusMode();
@@ -866,7 +866,7 @@ inline char *ActivityGetId(int id)
// -1 if not found, otherwise activity number
static int ActivityCheck(LPCTSTR szFirstNode, LPCTSTR szSecondNode)
{
- if ( !szFirstNode) return 0;
+ if (!szFirstNode) return 0;
char *s1 = mir_t2a(szFirstNode), *s2 = mir_t2a(szSecondNode);
@@ -876,13 +876,13 @@ static int ActivityCheck(LPCTSTR szFirstNode, LPCTSTR szSecondNode)
if (g_arrActivities[i].szFirst && !strcmp(s1, g_arrActivities[i].szFirst)) {
// first part found
nFirst = i;
- if ( !s2) {
+ if (!s2) {
nSecond = i;
break;
}
i++; // move to next
while (g_arrActivities[i].szSecond) {
- if ( !strcmp(g_arrActivities[i].szSecond, s2)) {
+ if (!strcmp(g_arrActivities[i].szSecond, s2)) {
nSecond = i;
break;
}
@@ -925,7 +925,7 @@ char *ActivityGetFirst(int id)
char *ActivityGetFirst(char *szId)
{
- if ( !szId) return NULL;
+ if (!szId) return NULL;
int id = SIZEOF(g_arrActivities) - 1;
bool found_second = false;
@@ -995,9 +995,9 @@ CPepActivity::~CPepActivity()
void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode)
{
HANDLE hContact = NULL, hSelfContact = NULL;
- if ( !m_proto->IsMyOwnJID(from)) {
+ if (!m_proto->IsMyOwnJID(from)) {
hContact = m_proto->HContactFromJID(from);
- if ( !hContact) return;
+ if (!hContact) return;
}
else hSelfContact = m_proto->HContactFromJID(from);
@@ -1009,7 +1009,7 @@ void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode)
}
HXML actNode = XPath(itemsNode, _T("item/activity[@xmlns='") JABBER_FEAT_USER_ACTIVITY _T("']"));
- if ( !actNode)
+ if (!actNode)
return;
LPCTSTR szText = XPathT(actNode, "text");
@@ -1032,7 +1032,7 @@ void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode)
SetActivity(hContact, szFirstNode, szSecondNode, fixedText);
mir_free(fixedText);
- if ( !hContact && m_mode >= 0)
+ if (!hContact && m_mode >= 0)
ForceRepublishOnLogin();
}
@@ -1075,7 +1075,7 @@ void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecon
TCHAR activityTitle[128];
ActivityBuildTitle(activity, activityTitle, SIZEOF(activityTitle));
- if ( !hContact) {
+ if (!hContact) {
m_mode = activity;
replaceStrT(m_text, szText);
@@ -1115,7 +1115,7 @@ void CPepActivity::ShowSetDialog(BYTE bQuiet)
dlg.SetActiveStatus(m_mode, m_text);
dlg.DoModal();
- if ( !dlg.OkClicked()) return;
+ if (!dlg.OkClicked()) return;
m_mode = dlg.GetStatusMode();
if (m_mode >= 0) {
@@ -1152,10 +1152,10 @@ HICON CJabberProto::GetXStatusIcon(int bStatus, UINT flags)
INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam)
{
- if ( !m_bJabberOnline)
+ if (!m_bJabberOnline)
return 0;
- if ( !wParam)
+ if (!wParam)
wParam = ((CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->m_mode;
if (wParam < 1 || wParam >= SIZEOF(g_arrMoods))
@@ -1173,7 +1173,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam)
BOOL CJabberProto::SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri)
{
- if ( !m_bJabberOnline || !m_bPepSupported)
+ if (!m_bJabberOnline || !m_bPepSupported)
return FALSE;
XmlNodeIq iq(_T("set"), SerialNext());
@@ -1196,7 +1196,7 @@ BOOL CJabberProto::SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource
void CJabberProto::SetContactTune(HANDLE hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack)
{
- if ( !szArtist && !szTitle) {
+ if (!szArtist && !szTitle) {
delSetting(hContact, "ListeningTo");
ResetAdvStatus(hContact, ADVSTATUS_TUNE);
return;
@@ -1253,7 +1253,7 @@ void overrideStr(TCHAR*& dest, const TCHAR *src, BOOL unicode, const TCHAR *def
INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
{
LISTENINGTOINFO *cm = (LISTENINGTOINFO *)lParam;
- if ( !cm || cm->cbSize != sizeof(LISTENINGTOINFO)) {
+ if (!cm || cm->cbSize != sizeof(LISTENINGTOINFO)) {
SendPepTune(NULL, NULL, NULL, NULL, NULL, NULL);
delSetting("ListeningTo");
}
@@ -1270,7 +1270,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
overrideStr(szLength, cm->ptszLength, unicode);
TCHAR szLengthInSec[ 32 ];
- szLengthInSec[ 0 ] = _T('\0');
+ szLengthInSec[ 0 ] = 0;
if (szLength) {
unsigned int multiplier = 1, result = 0;
for (TCHAR *p = szLength; *p; p++)
@@ -1283,7 +1283,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam)
result += (_ttoi(szTmp) * multiplier);
multiplier /= 60;
szTmp = _tcschr(szTmp, _T(':'));
- if ( !szTmp)
+ if (!szTmp)
break;
szTmp++;
}
@@ -1331,7 +1331,7 @@ void CJabberProto::XStatusInit()
INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam)
{
- if ( !m_bPepSupported || !m_bJabberOnline)
+ if (!m_bPepSupported || !m_bJabberOnline)
return 1;
CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam;
@@ -1413,7 +1413,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam)
INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM wParam, LPARAM lParam)
{
- if ( !m_bPepSupported || !m_bJabberOnline)
+ if (!m_bPepSupported || !m_bJabberOnline)
return 1;
CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam;
diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h
index cf24554007..6caa4117b4 100644
--- a/protocols/JabberG/src/jabber_xstatus.h
+++ b/protocols/JabberG/src/jabber_xstatus.h
@@ -115,7 +115,7 @@ public:
CPepService *Find(TCHAR *node)
{
for (int i=0; i < getCount(); i++)
- if ( !lstrcmp((*this)[i].GetNode(), node))
+ if (!lstrcmp((*this)[i].GetNode(), node))
return &((*this)[i]);
return NULL;
}
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp
index a345e2b564..1005903432 100644
--- a/protocols/JabberG/src/ui_utils.cpp
+++ b/protocols/JabberG/src/ui_utils.cpp
@@ -163,7 +163,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_CLOSE:
m_lresult = FALSE;
OnClose();
- if ( !m_lresult) {
+ if (!m_lresult) {
if (m_isModal)
EndDialog(m_hwnd, 0);
else
@@ -483,7 +483,7 @@ void CCtrlData::OnInit()
void CCtrlData::NotifyChange()
{
- if ( !m_parentWnd || m_parentWnd->IsInitialized()) m_changed = true;
+ if (!m_parentWnd || m_parentWnd->IsInitialized()) m_changed = true;
if (m_parentWnd) {
m_parentWnd->OnChange(this);
if (m_parentWnd->IsInitialized())
@@ -1353,7 +1353,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str)
if (str) {
for (int j = 0; j < 10; ++j) {
GetItemText(i, j, buf, SIZEOF(buf));
- if ( !*buf)
+ if (!*buf)
break;
if (_tcsstr(buf, str)) {
@@ -1603,7 +1603,7 @@ void CCtrlTreeView::TranslateTree()
hItem = hItemTmp;
else {
while (true) {
- if ( !(hItem = GetParent(hItem)))
+ if (!(hItem = GetParent(hItem)))
break;
if (hItemTmp = GetNextSibling(hItem)) {
hItem = hItemTmp;
@@ -1624,7 +1624,7 @@ HTREEITEM CCtrlTreeView::FindNamedItem(HTREEITEM hItem, const TCHAR *name)
else
tvi.hItem = GetRoot();
- if ( !name)
+ if (!name)
return tvi.hItem;
tvi.mask = TVIF_TEXT;
@@ -1634,7 +1634,7 @@ HTREEITEM CCtrlTreeView::FindNamedItem(HTREEITEM hItem, const TCHAR *name)
while (tvi.hItem) {
GetItem(&tvi);
- if ( !lstrcmp(tvi.pszText, name))
+ if (!lstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = GetNextSibling(tvi.hItem);
@@ -1937,7 +1937,7 @@ void CCtrlPages::AddPage(TCHAR *ptszName, HICON hIcon, CCallback<void> onCreate,
tci.pszText = ptszName;
if (hIcon)
{
- if ( !m_hIml)
+ if (!m_hIml)
{
m_hIml = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1);
TabCtrl_SetImageList(m_hwnd, m_hIml);
@@ -1975,7 +1975,7 @@ void CCtrlPages::AttachDialog(int iPage, CDlgBase *pDlg)
void CCtrlPages::ShowPage(CDlgBase *pDlg)
{
- if ( !pDlg) return;
+ if (!pDlg) return;
RECT rc;
GetClientRect(m_hwnd, &rc);
@@ -2273,7 +2273,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SETTEXT:
if (m_show_label && IsWindowUnicode(m_hwnd)) {
TCHAR *szTitle = (TCHAR *)lParam;
- if ( !_tcsstr(szTitle, m_proto_interface->m_tszUserName)) {
+ if (!_tcsstr(szTitle, m_proto_interface->m_tszUserName)) {
UpdateProtoTitle(szTitle);
return TRUE;
}
@@ -2310,7 +2310,7 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
{
- if ( !m_show_label) return;
+ if (!m_show_label) return;
int curLength;
const TCHAR *curText;
@@ -2326,7 +2326,7 @@ void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
curText = tmp;
}
- if ( !_tcsstr(curText, m_proto_interface->m_tszUserName)) {
+ if (!_tcsstr(curText, m_proto_interface->m_tszUserName)) {
int length = curLength + lstrlen(m_proto_interface->m_tszUserName) + 256;
TCHAR *text = (TCHAR *)_alloca(length * sizeof(TCHAR));
mir_sntprintf(text, length, _T("%s [%s: %s]"), curText, TranslateT("Account"), m_proto_interface->m_tszUserName);