void CLoginDlg::OnOK() { BOOL invis = options.flags.test(UF_LOGIN_INVIS); BOOL storePasswd = options.flags.test(UF_STORE_PASSWD); UpdateData(); if (m_invis != invis || m_storePasswd != storePasswd) { options.flags.set(UF_LOGIN_INVIS, m_invis); options.flags.set(UF_STORE_PASSWD, m_storePasswd); IcqDB::saveOptions(options); } QID qid; CString str; int i = m_cmbUser.GetCurSel(); m_cmbUser.GetLBText(i, str); qid.parse(str); IcqConfig::addUser(qid); CMyDlg::OnOK(); }
int CMsgTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CTreeView::OnCreate(lpCreateStruct) == -1) return -1; CTreeCtrl &tree = GetTreeCtrl(); tree.SetImageList(&getApp()->smallImageList, TVSIL_NORMAL); tree.SetItemHeight(24); IcqUser &myInfo = icqLink->myInfo; CString str; str.Format("%s(%s)", myInfo.qid.toString(), myInfo.nick.c_str()); HTREEITEM root = tree.InsertItem(str, getApp()->getFaceIndex(myInfo.face), getApp()->getFaceIndex(myInfo.face, STATUS_AWAY), NULL); MyICQCtrl &outbar = ((CIcqDlg *) AfxGetMainWnd())->outbarCtrl; int n = outbar.getFolderCount(); QID *qid; CString name; int image; HTREEITEM stranger = NULL; StrList qidList; IcqDB::getMsgQIDList(qidList); for (int i = 0; i < n; ++i) { outbar.getFolderName(i, name); image = getApp()->iconIndex(ICON_FOLDER); HTREEITEM parent = tree.InsertItem(name, image, image, root); int nrItems = outbar.getItemCount(i); for (int j = 0; j < nrItems; ++j) { IcqContact *c = outbar.contact(i, j); str.Format("%s (%s)", c->qid.toString(), c->nick.c_str()); HTREEITEM hItem = tree.InsertItem(str, getApp()->getFaceIndex(c->face), getApp()->getFaceIndex(c->face, STATUS_AWAY), parent); qid = new QID(c->qid); tree.SetItemData(hItem, (DWORD) qid); qidList.remove(c->qid.toString()); } if (i == n - 2) stranger = parent; } HTREEITEM item; // Add the remaining UINs to the stranger folder StrList::iterator it; for (it = qidList.begin(); it != qidList.end(); ++it) { const char *s = (*it).c_str(); qid = new QID; if (!qid->parse(s)) { delete qid; continue; } item = tree.InsertItem(s, getApp()->getFaceIndex(0), getApp()->getFaceIndex(0, STATUS_AWAY), stranger); tree.SetItemData(item, (DWORD) qid); } str.LoadString(IDS_SYSMSG); image = getApp()->iconIndex(ICON_SYSMSG); item = tree.InsertItem(str, image, image, root); qid = new QID; tree.SetItemData(item, (DWORD) qid); return 0; }