From 5434c7b224bafd30c382f0590a55c921dfedea54 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 27 Jan 2013 18:11:22 +0000 Subject: - fix for the Jabber chat's Member Info dialog - ++i -> i++ git-svn-id: http://svn.miranda-ng.org/main/trunk@3310 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/MString.h | 2 +- protocols/JabberG/src/jabber_byte.cpp | 2 +- protocols/JabberG/src/jabber_chat.cpp | 241 ++++++++++++++--------------- protocols/JabberG/src/jabber_console.cpp | 37 +++-- protocols/JabberG/src/jabber_disco.cpp | 14 +- protocols/JabberG/src/jabber_form.cpp | 6 +- protocols/JabberG/src/jabber_frame.cpp | 8 +- protocols/JabberG/src/jabber_groupchat.cpp | 6 +- protocols/JabberG/src/jabber_icolib.cpp | 2 +- protocols/JabberG/src/jabber_iqid_muc.cpp | 2 +- protocols/JabberG/src/jabber_menu.cpp | 12 +- protocols/JabberG/src/jabber_misc.cpp | 2 +- protocols/JabberG/src/jabber_notes.cpp | 8 +- protocols/JabberG/src/jabber_opt.cpp | 10 +- protocols/JabberG/src/jabber_opttree.cpp | 6 +- protocols/JabberG/src/jabber_privacy.cpp | 14 +- protocols/JabberG/src/jabber_proto.cpp | 4 +- protocols/JabberG/src/jabber_thread.cpp | 4 +- protocols/JabberG/src/jabber_treelist.cpp | 2 +- protocols/JabberG/src/jabber_userinfo.cpp | 4 +- protocols/JabberG/src/jabber_util.cpp | 6 +- protocols/JabberG/src/jabber_xstatus.cpp | 8 +- protocols/JabberG/src/jabber_xstatus.h | 16 +- protocols/JabberG/src/ui_utils.cpp | 6 +- 24 files changed, 207 insertions(+), 215 deletions(-) diff --git a/protocols/JabberG/src/MString.h b/protocols/JabberG/src/MString.h index 5864b13327..eef6a9a4f3 100644 --- a/protocols/JabberG/src/MString.h +++ b/protocols/JabberG/src/MString.h @@ -1176,7 +1176,7 @@ public: } else { XCHAR* p=pszBuffer; - for (int i=0 ; i < nLength ;++i) + for (int i=0 ; i < nLength ;i++) { for (int j=0 ; j < nBaseTypeCharLen ;++j) { diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 63160e8985..e3809ee27c 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -226,7 +226,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) query << XCHILD(_T("streamhost")) << XATTR(_T("jid"), m_ThreadInfo->fullJID) << XATTR(_T("host"), _A2T(localAddr)) << XATTRI(_T("port"), nlb.wPort); NETLIBIPLIST* ihaddr = (NETLIBIPLIST*)CallService(MS_NETLIB_GETMYIP, 1, 0); - for (unsigned i = 0; i < ihaddr->cbNum; ++i) + for (unsigned i = 0; i < ihaddr->cbNum; i++) if (strcmp(localAddr, ihaddr->szIp[i])) query << XCHILD(_T("streamhost")) << XATTR(_T("jid"), m_ThreadInfo->fullJID) << XATTR(_T("host"), _A2T(ihaddr->szIp[i])) << XATTRI(_T("port"), nlb.wPort); diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 94252d1047..95cb55072b 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -127,8 +127,8 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM* item) GCEVENT gce = {0}; // translate string for menus (this can't be done in initializer) - for (i = 0; i < SIZEOF(sttAffiliationItems); ++i) sttAffiliationItems[i].translate(); - for (i = 0; i < SIZEOF(sttRoleItems); ++i) sttRoleItems[i].translate(); + for (i = 0; i < SIZEOF(sttAffiliationItems); i++) sttAffiliationItems[i].translate(); + for (i = 0; i < SIZEOF(sttRoleItems); i++) sttRoleItems[i].translate(); TCHAR* szNick = JabberNickFromJID(item->jid); gcw.cbSize = sizeof(GCSESSION); @@ -411,7 +411,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM* item, int code, HXML reason) static struct gc_item *sttFindGcMenuItem(GCMENUITEMS *items, DWORD id) { - for (int i = 0; i < items->nItems; ++i) + for (int i = 0; i < items->nItems; i++) if (items->Item[i].dwID == id) return items->Item + i; return NULL; @@ -419,14 +419,14 @@ static struct gc_item *sttFindGcMenuItem(GCMENUITEMS *items, DWORD id) static void sttSetupGcMenuItem(GCMENUITEMS *items, DWORD id, bool disabled) { - for (int i = 0; i < items->nItems; ++i) + for (int i = 0; i < items->nItems; i++) 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) + for (int i = 0; i < items->nItems; i++) if ( !id || (items->Item[i].dwID == id)) items->Item[i].uType = type; } @@ -622,13 +622,13 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) for (; idx <= IDM_LINK9; ++idx) sttFindGcMenuItem(gcmi, idx)->uType = 0; - for (i = 0; i < SIZEOF(sttAffiliationItems); ++i) { + for (i = 0; i < SIZEOF(sttAffiliationItems); i++) { struct gc_item *item = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id); item->uType = (him->affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM; item->bDisabled = !(force || sttAffiliationItems[i].check(me, him)); } - for (i = 0; i < SIZEOF(sttRoleItems); ++i) { + for (i = 0; i < SIZEOF(sttRoleItems); i++) { struct gc_item *item = sttFindGcMenuItem(gcmi, sttRoleItems[i].id); item->uType = (him->role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM; item->bDisabled = !(force || sttRoleItems[i].check(me, him)); @@ -755,7 +755,7 @@ public: ~CGroupchatInviteDlg() { - for (int i = 0; i < m_newJids.getCount(); ++i) + for (int i = 0; i < m_newJids.getCount(); i++) mir_free(m_newJids[i]); mir_free(m_room); } @@ -792,7 +792,7 @@ public: } int i; - for (i = 0; i < m_newJids.getCount(); ++i) + for (i = 0; i < m_newJids.getCount(); i++) if ( !lstrcmp(m_newJids[i]->jid, buf)) break; if (i != m_newJids.getCount()) @@ -840,7 +840,7 @@ public: } // invite others - for (int i = 0; i < m_newJids.getCount(); ++i) + for (int i = 0; i < m_newJids.getCount(); i++) if (SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)m_newJids[i]->hItem, 0)) InviteUser(m_newJids[i]->jid, text); @@ -879,77 +879,78 @@ struct TUserInfoData static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TUserInfoData *dat = (TUserInfoData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + int value; switch (msg) { case WM_INITDIALOG: - { - int i, idx; - TCHAR buf[256]; - TranslateDialogDefault(hwndDlg); + { + int i, idx; + TCHAR buf[256]; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - dat = (TUserInfoData *)lParam; - WindowSetIcon(hwndDlg, dat->ppro, "group"); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + dat = (TUserInfoData *)lParam; - LOGFONT lf; - GetObject((HFONT)SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_GETFONT, 0, 0), sizeof(lf), &lf); - lf.lfWeight = FW_BOLD; - HFONT hfnt = CreateFontIndirect(&lf); - SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_SETFONT, (WPARAM)hfnt, TRUE); + WindowSetIcon(hwndDlg, dat->ppro, "group"); - SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE)); - SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0); + LOGFONT lf; + GetObject((HFONT)SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_GETFONT, 0, 0), sizeof(lf), &lf); + lf.lfWeight = FW_BOLD; + HFONT hfnt = CreateFontIndirect(&lf); + SendDlgItemMessage(hwndDlg, IDC_TXT_NICK, WM_SETFONT, (WPARAM)hfnt, TRUE); - SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE)); - SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONSETASFLATBTN, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0); + SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE)); + SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0); - SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)LoadSkinnedProtoIcon(dat->ppro->m_szModuleName, dat->him->status), 0); + SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedIcon(SKINICON_EVENT_FILE)); + SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONSETASFLATBTN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BUTTONADDTOOLTIP, (WPARAM)"Apply", 0); - mir_sntprintf(buf, SIZEOF(buf), _T("%s %s"), TranslateT("Member Info:"), dat->him->resourceName); - SetWindowText(hwndDlg, buf); + SendDlgItemMessage(hwndDlg, IDC_ICO_STATUS, STM_SETICON, (WPARAM)LoadSkinnedProtoIcon(dat->ppro->m_szModuleName, dat->him->status), 0); - mir_sntprintf(buf, SIZEOF(buf), _T("%s\n%s %s %s"), TranslateT("Member Information"), dat->him->resourceName, TranslateT("from"), dat->item->jid); - SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf); + mir_sntprintf(buf, SIZEOF(buf), _T("%s %s"), TranslateT("Member Info:"), dat->him->resourceName); + SetWindowText(hwndDlg, buf); - SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->resourceName); - SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->szRealJid ? dat->him->szRealJid : TranslateT("Real JID not available")); - SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->statusMessage); + mir_sntprintf(buf, SIZEOF(buf), _T("%s\n%s %s %s"), TranslateT("Member Information"), dat->him->resourceName, TranslateT("from"), dat->item->jid); + SetDlgItemText(hwndDlg, IDC_HEADERBAR, buf); - for (i = 0; i < SIZEOF(sttRoleItems); ++i) - { - if ((sttRoleItems[i].value == dat->him->role) || sttRoleItems[i].check(dat->me, dat->him)) + SetDlgItemText(hwndDlg, IDC_TXT_NICK, dat->him->resourceName); + SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->szRealJid ? dat->him->szRealJid : TranslateT("Real JID not available")); + SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->statusMessage); + + for (i = 0; i < SIZEOF(sttRoleItems); i++) { - SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA, - idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title), - sttRoleItems[i].value); - if (sttRoleItems[i].value == dat->him->role) - SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0); + if ((sttRoleItems[i].value == dat->him->role) || sttRoleItems[i].check(dat->me, dat->him)) + { + SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA, + idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title), + sttRoleItems[i].value); + if (sttRoleItems[i].value == dat->him->role) + SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0); + } } - } - for (i = 0; i < SIZEOF(sttAffiliationItems); ++i) - { - if ((sttAffiliationItems[i].value == dat->him->affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) + for (i = 0; i < SIZEOF(sttAffiliationItems); i++) { - SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA, - idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title), - sttAffiliationItems[i].value); - if (sttAffiliationItems[i].value == dat->him->affiliation) - SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETCURSEL, idx, 0); + if ((sttAffiliationItems[i].value == dat->him->affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) + { + SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA, + idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title), + sttAffiliationItems[i].value); + if (sttAffiliationItems[i].value == dat->him->affiliation) + SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETCURSEL, idx, 0); + } } - } - - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ROLE), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_AFFILIATION), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ROLE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_AFFILIATION), FALSE); + } break; - } case WM_COMMAND: - if ( !dat)break; + if ( !dat) + break; switch (LOWORD(wParam)) { case IDCANCEL: @@ -957,80 +958,74 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break; case IDC_TXT_AFFILIATION: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - int value = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETITEMDATA, + if (HIWORD(wParam) == CBN_SELCHANGE) { + value = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETCURSEL, 0, 0), 0); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_AFFILIATION), dat->him->affiliation != value); } break; case IDC_BTN_AFFILIATION: - { - int value = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETCURSEL, 0, 0), 0); - if (dat->him->affiliation == value) break; + value = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETITEMDATA, + SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_GETCURSEL, 0, 0), 0); + if (dat->him->affiliation == value) + break; - switch (value) - { - TCHAR szBareJid[ JABBER_MAX_JID_LEN ]; - JabberStripJid(dat->him->szRealJid, szBareJid, SIZEOF(szBareJid)); - case AFFILIATION_NONE: - if (dat->him->szRealJid) - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("none")); - else - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("none")); - break; - case AFFILIATION_MEMBER: - if (dat->him->szRealJid) - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("member")); - else - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("member")); - break; - case AFFILIATION_ADMIN: - if (dat->him->szRealJid) - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("admin")); - else - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("admin")); - break; - case AFFILIATION_OWNER: - if (dat->him->szRealJid) - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("owner")); - else - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("owner")); - break; - } + TCHAR szBareJid[ JABBER_MAX_JID_LEN ]; + JabberStripJid(dat->him->szRealJid, szBareJid, SIZEOF(szBareJid)); + + switch (value) { + case AFFILIATION_NONE: + if (dat->him->szRealJid) + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("none")); + else + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("none")); + break; + case AFFILIATION_MEMBER: + if (dat->him->szRealJid) + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("member")); + else + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("member")); + break; + case AFFILIATION_ADMIN: + if (dat->him->szRealJid) + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("admin")); + else + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("admin")); + break; + case AFFILIATION_OWNER: + if (dat->him->szRealJid) + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("jid"), szBareJid, _T("affiliation"), _T("owner")); + else + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("affiliation"), _T("owner")); } break; case IDC_TXT_ROLE: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - int value = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETITEMDATA, + if (HIWORD(wParam) == CBN_SELCHANGE) { + value = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETCURSEL, 0, 0), 0); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_ROLE), dat->him->role != value); } break; case IDC_BTN_ROLE: - { - int value = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETCURSEL, 0, 0), 0); - if (dat->him->role == value) break; + value = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETITEMDATA, + SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_GETCURSEL, 0, 0), 0); + if (dat->him->role == value) + break; - switch (value) { - case ROLE_VISITOR: - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("visitor")); - break; - case ROLE_PARTICIPANT: - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("participant")); - break; - case ROLE_MODERATOR: - dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("moderator")); - break; - } + switch (value) { + case ROLE_VISITOR: + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("visitor")); + break; + case ROLE_PARTICIPANT: + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("participant")); + break; + case ROLE_MODERATOR: + dat->ppro->AdminSet(dat->item->jid, xmlnsAdmin, _T("nick"), dat->him->resourceName, _T("role"), _T("moderator")); + break; } - break; } break; @@ -1039,16 +1034,14 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break; case WM_DESTROY: - { - WindowFreeIcon(hwndDlg); - g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, 0)); - g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, 0)); - TUserInfoData *dat = (TUserInfoData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - if ( !dat)break; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); - mir_free(dat); - break; - } + WindowFreeIcon(hwndDlg); + g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_AFFILIATION, BM_SETIMAGE, IMAGE_ICON, 0)); + g_ReleaseIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_ROLE, BM_SETIMAGE, IMAGE_ICON, 0)); + TUserInfoData *dat = (TUserInfoData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + if ( !dat)break; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); + mir_free(dat); + break; } return FALSE; } diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 6a804623a6..38ee266f3f 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -106,13 +106,13 @@ bool CJabberProto::RecursiveCheckFilter(HXML node, DWORD flags) { int i; - for (i = 0; i < xmlGetAttrCount(node); ++i) + 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; } @@ -267,7 +267,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) sttAppendBufRaw(buf, RTF_ENDTEXT); } - for (i = 0; i < xmlGetChildCount(node) ; ++i) + for (i = 0; i < xmlGetChildCount(node) ; i++) sttRtfAppendXml(buf, xmlGetChild(node ,i), flags & ~(JCPF_IN|JCPF_OUT), indent+1); if (xmlGetChildCount(node) || xmlGetText(node)) @@ -314,9 +314,9 @@ static void sttJabberConsoleRebuildStrings(CJabberProto* ppro, HWND hwndCombo) SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0); - for (i = 0; g_JabberFeatCapPairs[i].szFeature; ++i) + for (i = 0; g_JabberFeatCapPairs[i].szFeature; i++) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairs[i].szFeature); - for (i = 0; g_JabberFeatCapPairsExt[i].szFeature; ++i) + for (i = 0; g_JabberFeatCapPairsExt[i].szFeature; i++) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairsExt[i].szFeature); LISTFOREACH_NODEF(i, ppro, LIST_ROSTER) @@ -369,8 +369,6 @@ void CJabberDlgConsole::OnInitDialog() { CSuper::OnInitDialog(); - int i; - WindowSetIcon(m_hwnd, m_proto, "xmlconsole"); SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); SendDlgItemMessage(m_hwnd, IDC_CONSOLE, EM_EXLIMITTEXT, 0, 0x80000000); @@ -399,14 +397,15 @@ void CJabberDlgConsole::OnInitDialog() BOOL pushed; } 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}, }; - for (i = 0; i < SIZEOF(buttons); ++i) - { + + int i; + for (i = 0; i < SIZEOF(buttons); i++) { SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon)); SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0); @@ -414,13 +413,13 @@ void CJabberDlgConsole::OnInitDialog() if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, TRUE); } - for (i = 0; i < SIZEOF(filter_modes); ++i) - if (filter_modes[i].type == m_proto->m_filterInfo.type) - { + 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))); 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); @@ -604,7 +603,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { int i; HMENU hMenu = CreatePopupMenu(); - for (i = 0; i < SIZEOF(filter_modes); ++i) + for (i = 0; i < SIZEOF(filter_modes); i++) { AppendMenu(hMenu, MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0), @@ -619,7 +618,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (res) { m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1); - for (i = 0; i < SIZEOF(filter_modes); ++i) + 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))); diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index e65d1c512e..21c8d75f3c 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -440,7 +440,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) else if ( !lstrcmp(szJid, _T(SD_FAKEJID_FAVORITES))) { sttBrowseMode = SD_BROWSE_FAVORITES; int count = JGetDword(NULL, "discoWnd_favCount", 0); - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; i++) { DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; @@ -507,7 +507,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) iOverlay = SD_OVERLAY_NONE; } - for (int i = 0; i < SIZEOF(sttNodeIcons); ++i) + for (int i = 0; i < SIZEOF(sttNodeIcons); i++) { if ( !sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue; @@ -682,7 +682,7 @@ void CJabberDlgDiscovery::OnInitDialog() TreeList_Create(hwndList); TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0); - for (i = 0; i < SIZEOF(sttNodeIcons); ++i) + for (i = 0; i < SIZEOF(sttNodeIcons); i++) { bool needDestroy = false; HICON hIcon; @@ -808,7 +808,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) { HMENU hMenu = CreatePopupMenu(); int count = m_proto->JGetDword(NULL, "discoWnd_favCount", 0); - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; i++) { DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; @@ -877,7 +877,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) if (res == 1) { int count = m_proto->JGetDword(NULL, "discoWnd_favCount", 0); - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); @@ -1021,7 +1021,7 @@ INT_PTR CJabberDlgDiscovery::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_proto->m_SDManager.Lock(); XmlNode packet(NULL); - for (int i = iFirst; i <= iLast; ++i) + for (int i = iFirst; i <= iLast; i++) { LVITEM lvi = {0}; lvi.mask = LVIF_PARAM; @@ -1227,7 +1227,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM HMENU hMenu = CreatePopupMenu(); BOOL lastSeparator = TRUE; bool bFilterItems = !GetAsyncKeyState(VK_CONTROL); - for (int i = 0; i < SIZEOF(items); ++i) + for (int i = 0; i < SIZEOF(items); i++) { JABBER_LIST_ITEM *rosterItem = NULL; diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index cbdee873fc..550de8fa58 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -117,14 +117,14 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) int len = lstrlen(text); int fixedLen = len; - for (int i = 1; i < len; ++i) + for (int i = 1; i < len; i++) if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r'))) ++fixedLen; TCHAR *fixedText = NULL; if (fixedLen != len) { fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen+1)); TCHAR *p = fixedText; - for (int i = 0; i < len; ++i) { + for (int i = 0; i < len; i++) { *p = text[i]; if (i && (text[i] == _T('\n')) && (text[i] != _T('\r'))) { *p++ = _T('\r'); @@ -421,7 +421,7 @@ void JabberFormLayoutControls(HWND hwndStatic, TJabberFormLayoutInfo *layout_inf TJabberFormControlList *controls = (TJabberFormControlList *)GetWindowLongPtr(hwndStatic, GWLP_USERDATA); if ( !controls) return; - for (int i = 0; i < controls->getCount(); ++i) + for (int i = 0; i < controls->getCount(); i++) { if ((*controls)[i]->hLabel) SetWindowPos((*controls)[i]->hLabel, 0, diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index f5e4b2aadc..c4f263e52e 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -200,7 +200,7 @@ LRESULT CJabberInfoFrame::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONDOWN: { POINT pt = { LOWORD(lParam), HIWORD(lParam) }; - for (int i = 0; i < m_pItems.getCount(); ++i) + for (int i = 0; i < m_pItems.getCount(); i++) if (m_pItems[i].m_onEvent && PtInRect(&m_pItems[i].m_rcItem, pt)) { m_clickedItem = i; return 0; @@ -413,7 +413,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc) int line_height = cy_icon + SZ_LINEPADDING; int cy = SZ_FRAMEPADDING; - for (int i = 0; i < m_pItems.getCount(); ++i) { + for (int i = 0; i < m_pItems.getCount(); i++) { CJabberInfoFrameItem &item = m_pItems[i]; if ( !item.m_bShow) { @@ -483,7 +483,7 @@ void CJabberInfoFrame::ShowInfoItem(char *pszName, bool bShow) { bool bUpdate = false; size_t length = strlen(pszName); - for (int i = 0; i < m_pItems.getCount(); ++i) + for (int i = 0; i < m_pItems.getCount(); i++) if ((m_pItems[i].m_bShow != bShow) && !strncmp(m_pItems[i].m_pszName, pszName, length)) { m_pItems[i].m_bShow = bShow; m_hiddenItemCount += bShow ? -1 : 1; @@ -498,7 +498,7 @@ void CJabberInfoFrame::RemoveInfoItem(char *pszName) { bool bUpdate = false; size_t length = strlen(pszName); - for (int i = 0; i < m_pItems.getCount(); ++i) + 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; RemoveTooltip(m_pItems[i].m_tooltipId); diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index e30f358b21..fed73bbbd7 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -279,7 +279,7 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con int i = 0; bool found = false; - for (i = 0 ; i < 5; ++i) + for (i = 0 ; i < 5; i++) { if ( !info.loadRecent(i)) continue; @@ -448,7 +448,7 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount) RECT rc; int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL }; - for (int i = 0; i < SIZEOF(ctrls); ++i) + for (int i = 0; i < SIZEOF(ctrls); i++) { GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc); MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2); @@ -548,7 +548,7 @@ void CJabberDlgGcJoin::OnInitDialog() m_proto->ComboLoadRecentStrings(m_hwnd, IDC_SERVER, "joinWnd_rcSvr"); int i = 0; - for (; i < 5; ++i) + for (; i < 5; i++) { TCHAR jid[JABBER_MAX_JID_LEN]; JabberGcRecentInfo info(m_proto); diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index c3d5c709ba..e68d467793 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -182,7 +182,7 @@ static IconItem iconList[] = void CJabberProto::IconsInit(void) { m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable)); - for (int i = 0; i < SIZEOF(TransportProtoTable); ++i) + for (int i = 0; i < SIZEOF(TransportProtoTable); i++) m_transportProtoTableStartIndex[i] = -1; IconItemT protoIcon = { m_tszUserName, "main", IDI_JABBER }; diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 689ce8ef54..6532cea953 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -191,7 +191,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w {IDC_BTN_FILTERAPPLY, "Apply filter", "sd_filter_apply", false}, {IDC_BTN_FILTERRESET, "Reset filter", "sd_filter_reset", false}, }; - for (int i = 0; i < SIZEOF(buttons); ++i) + for (int i = 0; i < SIZEOF(buttons); i++) { SendDlgItemMessage(hwndDlg, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(buttons[i].icon)); SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0); diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 0ee785ef41..f43f4ab012 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -312,7 +312,7 @@ void g_MenuInit(void) mi.flags |= CMIF_ROOTHANDLE; mi.flags &= ~CMIF_ICONFROMICOLIB; - for (int i = 0; i < SIZEOF(PresenceModeArray); ++i) + for (int i = 0; i < SIZEOF(PresenceModeArray); i++) { char buf[] = "Jabber/DirectPresenceX"; buf[SIZEOF(buf)-2] = '0' + i; @@ -399,7 +399,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) return 0; sttEnableMenuItem(g_hMenuDirectPresence[0], TRUE); - for (int i = 0; i < SIZEOF(PresenceModeArray); ++i) + for (int i = 0; i < SIZEOF(PresenceModeArray); i++) { CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_ICON|CMIM_FLAGS; @@ -467,7 +467,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) mi.pszContactOwner = m_szModuleName; TCHAR szTmp[512]; - for (int i = 0; i < nMenuResourceItemsNew; ++i) { + for (int i = 0; i < nMenuResourceItemsNew; i++) { mir_snprintf(tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i); if (i >= m_nMenuResourceItems) { JCreateServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i); @@ -836,7 +836,7 @@ void CJabberProto::MenuInit() JCreateServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0); int steps[] = { 10, 5, 1, 0, -1, -5, -10 }; - for (int i = 0; i < SIZEOF(steps); ++i) { + for (int i = 0; i < SIZEOF(steps); i++) { if ( !steps[i]) { mi.position += 100000; continue; @@ -1154,7 +1154,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam) AppendMenu(hMenu, MF_STRING, MENUITEM_SERVER, TranslateT("Highest priority (server's choice)")); AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); - for (int i = 0; i < LI->resourceCount; ++i) + for (int i = 0; i < LI->resourceCount; i++) AppendMenu(hMenu, MF_STRING, MENUITEM_RESOURCES+i, LI->resource[i].resourceName); if (LI->resourceMode == RSMODE_LASTSEEN) @@ -1275,7 +1275,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) CLISTMENUITEM clmi = { sizeof(clmi) }; int nItems = 0, lastItemId = 0; - for (int i = 0; i < g_Instances.getCount(); ++i) { + for (int i = 0; i < g_Instances.getCount(); i++) { clmi.flags = CMIM_FLAGS; CJabberProto* ppro = g_Instances[i]; diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 106c837ef9..b9ee0af8ce 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -503,7 +503,7 @@ void CJabberProto::FormatMirVer(JABBER_RESOURCE_STATUS *resource, TCHAR *buf, in int i; // search through known software list - for (i = 0; i < SIZEOF(sttCapsNodeToName_Map); ++i) + for (i = 0; i < SIZEOF(sttCapsNodeToName_Map); i++) if (_tcsstr(resource->szCapsNode, sttCapsNodeToName_Map[i].node)) { mir_sntprintf(buf, bufSize, _T("%s %s"), sttCapsNodeToName_Map[i].name, resource->szCapsVer); diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 86585d9823..dfc991e622 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -148,7 +148,7 @@ void CNoteList::LoadXml(HXML hXml) m_bIsModified = false; int count = xmlGetChildCount(hXml); - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; i++) { CNoteItem *pNote = new CNoteItem(xi.getChild(hXml, i)); if (pNote->IsNotEmpty()) @@ -163,7 +163,7 @@ void CNoteList::SaveXml(HXML hXmlParent) m_bIsModified = false; CNoteList &me = *this; - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) { HXML hXmlItem = hXmlParent << XCHILD(_T("note")); hXmlItem << XATTR(_T("from"), me[i].GetFrom()) << XATTR(_T("tags"), me[i].GetTagsStr()); @@ -495,7 +495,7 @@ private: void PopulateTags(HTREEITEM htiRoot, TCHAR *szActiveTag) { LIST tagSet(5, _tcscmp); - for (int i = 0; i < m_proto->m_notes.getCount(); ++i) + for (int i = 0; i < m_proto->m_notes.getCount(); i++) { TCHAR *tags = m_proto->m_notes[i].GetTags(); for (TCHAR *tag = tags; tag && *tag; tag = tag + lstrlen(tag) + 1) @@ -550,7 +550,7 @@ private: void ListItems(const TCHAR *tag) { m_lstNotes.ResetContent(); - for (int i = 0; i < m_proto->m_notes.getCount(); ++i) + for (int i = 0; i < m_proto->m_notes.getCount(); i++) if (m_proto->m_notes[i].HasTag(tag)) InsertItem(m_proto->m_notes[i]); EnableControls(); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index d86da765e8..2a157dd128 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -460,7 +460,7 @@ protected: // fill predefined resources TCHAR* szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") }; - for (i = 0; i < SIZEOF(szResources); ++i) + for (i = 0; i < SIZEOF(szResources); i++) m_cbResource.AddString(szResources[i]); // append computer name to the resource list @@ -479,7 +479,7 @@ protected: } else m_cbResource.SetText(_T("Miranda")); - for (i = 0; g_LanguageCodes[i].szCode; ++i) + 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)) @@ -740,7 +740,7 @@ private: m_cbServer.ResetContent(); if (node) { - for (int i = 0; ; ++i) { + for (int i = 0; ; i++) { HXML n = xmlGetChild(node, i); if ( !n) break; @@ -1708,7 +1708,7 @@ protected: // fill predefined resources TCHAR* szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") }; - for (i = 0; i < SIZEOF(szResources); ++i) + for (i = 0; i < SIZEOF(szResources); i++) m_cbResource.AddString(szResources[i]); // append computer name to the resource list @@ -2227,7 +2227,7 @@ void CJabberDlgAccMgrUI::RefreshServers(HXML node) m_cbServer.ResetContent(); if (node) { - for (int i = 0; ; ++i) { + for (int i = 0; ; i++) { HXML n = xmlGetChild(node, i); if ( !n) break; diff --git a/protocols/JabberG/src/jabber_opttree.cpp b/protocols/JabberG/src/jabber_opttree.cpp index 3184571b95..717ecd5d5f 100644 --- a/protocols/JabberG/src/jabber_opttree.cpp +++ b/protocols/JabberG/src/jabber_opttree.cpp @@ -35,7 +35,7 @@ CCtrlTreeOpts::CCtrlTreeOpts(CDlgBase* dlg, int ctrlId): CCtrlTreeOpts::~CCtrlTreeOpts() { - for (int i = 0; i < m_options.getCount(); ++i) + for (int i = 0; i < m_options.getCount(); i++) delete m_options[i]; m_options.destroy(); } @@ -197,7 +197,7 @@ void CCtrlTreeOpts::OnApply() { CCtrlTreeView::OnApply(); - for (int i = 0; i < m_options.getCount(); ++i) + for (int i = 0; i < m_options.getCount(); i++) { TVITEMEX tvi; GetItem(m_options[i]->m_hItem, &tvi); @@ -231,7 +231,7 @@ void CCtrlTreeOpts::ProcessItemClick(HTREEITEM hti) case IMG_NORCHECK: { int i; - for (i = 0; i < m_options.getCount(); ++i) + for (i = 0; i < m_options.getCount(); i++) { if (m_options[i]->m_groupId == m_options[tvi.lParam]->m_groupId) { diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 8f03e6e7ec..f6cddcd8a9 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -693,7 +693,7 @@ protected: TCLCInfo(): newJids(1, TJidData::cmp), bChanged(false), pList(0) {} ~TCLCInfo() { - for (int i = 0; i < newJids.getCount(); ++i) + for (int i = 0; i < newJids.getCount(); i++) { mir_free(newJids[i]->jid); mir_free(newJids[i]); @@ -992,7 +992,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) }; int i, totalWidth = -5; // spacing for last item - for (i = 0; i < SIZEOF(items); ++i) + for (i = 0; i < SIZEOF(items); i++) { SIZE sz = {0}; items[i].text = TranslateTS(items[i].textEng); @@ -1004,7 +1004,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) RECT rc = lpdis->rcItem; rc.left = (rc.left + rc.right - totalWidth)/2; - for (i = 0; i < SIZEOF(items); ++i) + for (i = 0; i < SIZEOF(items); i++) { DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(items[i].icon), 16, 16, 0, NULL, DI_NORMAL); @@ -1399,7 +1399,7 @@ HANDLE CJabberDlgPrivacyLists::CListFindGroupByName(TCHAR *name) HANDLE hGroup = 0; - for (int i= 0; !hGroup; ++i) + for (int i= 0; !hGroup; i++) { _itoa(i, idstr, 10); @@ -1417,7 +1417,7 @@ HANDLE CJabberDlgPrivacyLists::CListFindGroupByName(TCHAR *name) void CJabberDlgPrivacyLists::CListResetIcons(HWND, HANDLE hItem, bool hide) { - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; i++) m_clcClist.SetExtraImage(hItem, i, hide ? EMPTY_EXTRA_ICON : 0); } @@ -2230,7 +2230,7 @@ INT_PTR __cdecl CJabberProto::menuSetPrivacyList(WPARAM, LPARAM, LPARAM iList) if (iList) { pList = m_privacyListManager.GetFirstList(); - for (int i = 1; pList && (i < iList); ++i) + for (int i = 1; pList && (i < iList); i++) pList = pList->GetNext(); } @@ -2304,7 +2304,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) m_hPrivacyMenuItems.insert(Menu_AddProtoMenuItem(&mi)); for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) { - ++i; + i++; mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i); if (i > m_privacyMenuServiceAllocated) { diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 77b6664938..c389dab12b 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -864,7 +864,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) const TCHAR *p = _tcsstr(szJid, szServer); if (p == NULL) { bool numericjid = true; - for (const TCHAR *i = szJid; *i && numericjid; ++i) + for (const TCHAR *i = szJid; *i && numericjid; i++) numericjid = (*i >= '0') && (*i <= '9'); mir_free(szServer); @@ -1021,7 +1021,7 @@ int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts // m << XCHILD(_T("body"), msg); HXML x = m << XCHILDNS(_T("x"), _T(JABBER_FEAT_ROSTER_EXCHANGE)); - for (int i = 0; i < nContacts; ++i) { + for (int i = 0; i < nContacts; i++) { if ( !JGetStringT(hContactsList[i], "jid", &dbv)) { x << XCHILD(_T("item")) << XATTR(_T("action"), _T("add")) << XATTR(_T("jid"), dbv.ptszVal); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 272f3ece51..47ecb1366e 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -184,7 +184,7 @@ void ThreadData::xmpp_client_query(void) dnsList.insert(&rec->Data.Srv); } - for (int i = 0; i < dnsList.getCount(); ++i) { + for (int i = 0; i < dnsList.getCount(); i++) { WORD dnsPort = port == 0 || port == 5222 ? dnsList[i]->wPort : port; char* dnsHost = dnsList[i]->pNameTarget; @@ -1403,7 +1403,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) { TCHAR chkJID[JABBER_MAX_JID_LEN] = _T("@"); JabberStripJid(from, chkJID + 1, SIZEOF(chkJID) - 1); - for (int i = 1; ; ++i) { + for (int i = 1; ; i++) { HXML iNode = xmlGetNthChild(xNode , _T("item"), i); if (iNode == NULL) break; const TCHAR *action = xmlGetAttrValue(iNode, _T("action")); diff --git a/protocols/JabberG/src/jabber_treelist.cpp b/protocols/JabberG/src/jabber_treelist.cpp index f98422c8bc..97ceec54aa 100644 --- a/protocols/JabberG/src/jabber_treelist.cpp +++ b/protocols/JabberG/src/jabber_treelist.cpp @@ -510,7 +510,7 @@ static void sttTreeList_ResetIndex(HTREELISTITEM hItem, LPARAM data) static void sttTreeList_FilterItems(HTREELISTITEM hItem, LPARAM data) { int i = 0; - for (i = 0; i < hItem->text.getCount(); ++i) + for (i = 0; i < hItem->text.getCount(); i++) if (JabberStrIStr(hItem->text[i], (TCHAR *)data)) break; diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 09aa3094b6..c84ebf81a3 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -396,7 +396,7 @@ static void sttFillUserInfo(CJabberProto* ppro, HWND hwndTree, JABBER_LIST_ITEM // resources if (item->resourceCount) { - for (int i = 0; i < item->resourceCount; ++i) + for (int i = 0; i < item->resourceCount; i++) sttFillResourceInfo(ppro, hwndTree, htiRoot, item, i+1); } else if ( !_tcschr(item->jid, _T('@')) || (item->itemResource.status != ID_STATUS_OFFLINE)) @@ -410,7 +410,7 @@ static void sttFillUserInfo(CJabberProto* ppro, HWND hwndTree, JABBER_LIST_ITEM static void sttGetNodeText(HWND hwndTree, HTREEITEM hti, UserInfoStringBuf *buf, int indent = 0) { - for (int i = 0; i < indent; ++i) + for (int i = 0; i < indent; i++) buf->append(_T("\t")); TVITEMEX tvi = {0}; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index a80be6ce88..a5b41add1e 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -590,7 +590,7 @@ TCHAR* __stdcall JabberErrorMsg(HXML errorNode, int* pErrorCode) if (str == NULL) str = xmlGetText(xmlGetChild(errorNode, _T("text"))); if (str == NULL) { - for (int i = 0; ; ++i) { + for (int i = 0; ; i++) { HXML c = xmlGetChild(errorNode, i); if (c == NULL) break; const TCHAR *attr = xmlGetAttrValue(c, _T("xmlns")); @@ -1169,7 +1169,7 @@ const char* TStringPairs::operator[](const char* key) const void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount) { - for (int i = 0; i < recentCount; ++i) { + for (int i = 0; i < recentCount; i++) { DBVARIANT dbv; char setting[MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "%s%d", param, i); @@ -1742,7 +1742,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) { OBJLIST &avs = *(OBJLIST*)param; HANDLE hHttpCon = NULL; - for (int i = 0; i < avs.getCount(); ++i) + for (int i = 0; i < avs.getCount(); i++) { NETLIBHTTPREQUEST nlhr = {0}; nlhr.cbSize = sizeof(nlhr); diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index de76a2d27e..3d7e7b09eb 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -235,7 +235,7 @@ void CJabberDlgPepSimple::OnInitDialog() SetWindowText(m_hwnd, m_title); m_txtDescription.Enable(false); - for (int i = 0; i < m_modes.getCount(); ++i) { + for (int i = 0; i < m_modes.getCount(); i++) { int idx = m_cbModes.AddString(m_modes[i].m_title, i); if ((m_modes[i].m_id == m_active) || !idx) { m_prevSelected = idx; @@ -691,7 +691,7 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText if (szMood) { char* p = mir_t2a(szMood); - for (int i = 1; i < SIZEOF(g_arrMoods); ++i) + for (int i = 1; i < SIZEOF(g_arrMoods); i++) if ( !lstrcmpA(g_arrMoods[i].szTag, p)) { mood = i; break; @@ -750,7 +750,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) { if ( !bQuiet) { CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood")); - for (int i = 1; i < SIZEOF(g_arrMoods); ++i) + 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); @@ -1122,7 +1122,7 @@ void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecon void CPepActivity::ShowSetDialog(BYTE bQuiet) { CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity")); - for (int i = 0; i < SIZEOF(g_arrActivities); ++i) + for (int i = 0; i < SIZEOF(g_arrActivities); i++) if (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond) dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateTS(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL)); diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index bf50a4e538..c9ffc03edd 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -65,7 +65,7 @@ public: void ProcessEvent(const TCHAR *from, HXML eventNode) { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) { CPepService &pepSvc = (*this)[i]; HXML itemsNode = xmlGetChildByTag(eventNode, _T("items"), _T("node"), pepSvc.GetNode()); @@ -76,43 +76,43 @@ public: void InitGui() { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) (*this)[i].InitGui(); } void RebuildMenu() { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) (*this)[i].RebuildMenu(); } void ResetExtraIcon(HANDLE hContact) { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) (*this)[i].ResetExtraIcon(hContact); } void PublishAll() { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) (*this)[i].Publish(); } void RetractAll() { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) (*this)[i].Retract(); } void ResetPublishAll() { - for(int i = 0; i < getCount(); ++i) + for(int i = 0; i < getCount(); i++) (*this)[i].ResetPublish(); } CPepService *Find(TCHAR *node) { - for (int i = 0; i < getCount(); ++i) + for (int i = 0; i < getCount(); i++) 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 ac7bde98e0..6bf22f9f30 100644 --- a/protocols/JabberG/src/ui_utils.cpp +++ b/protocols/JabberG/src/ui_utils.cpp @@ -260,7 +260,7 @@ void CDlgBase::AddControl(CCtrlBase *ctrl) void CDlgBase::NotifyControls(void (CCtrlBase::*fn)()) { - for (int i = 0; i < m_controls.getCount(); ++i) + for (int i = 0; i < m_controls.getCount(); i++) (m_controls[i]->*fn)(); } @@ -1463,7 +1463,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str) { TCHAR buf[256]; int count = GetItemCount(); - for (int i = 0; i < count; ++i) + for (int i = 0; i < count; i++) { bool found = false; @@ -2229,7 +2229,7 @@ BOOL CCtrlPages::OnNotify(int /*idCtrl*/, NMHDR *pnmh) void CCtrlPages::OnDestroy() { int count = TabCtrl_GetItemCount(m_hwnd); - for (int i = 0; i < count ; ++i) + for (int i = 0; i < count ; i++) { TCITEM tci = {0}; tci.mask = TCIF_PARAM; -- cgit v1.2.3