int FillTree(HWND hwnd) { ProtocolData *PD; TVINSERTSTRUCT tvis; tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; TreeView_DeleteAllItems(hwnd); int n; PROTOACCOUNT** pa; Proto_EnumAccounts(&n, &pa); for (int i = 0; i < n; i++) { if (Proto_IsAccountEnabled(pa[i])) { PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData)); PD->RealName = pa[i]->szModuleName; PD->enabled = IsProtoIM(pa[i]); PD->show = PD->enabled ? (plSets->ProtoDisabled(PD->RealName) ? 1 : 0) : 100; tvis.item.lParam = (LPARAM)PD; tvis.item.pszText = pa[i]->tszAccountName; tvis.item.iImage = tvis.item.iSelectedImage = PD->show; TreeView_InsertItem(hwnd, &tvis); } } return 0; }
static int ClcAccountsChanged(WPARAM, LPARAM) { int i, cnt; for (i=0, cnt=0; i < accounts.getCount(); i++) if (Proto_IsAccountEnabled(accounts[i])) cnt++; cli.hClcProtoCount = cnt; cli.clcProto = (ClcProtoStatus *) mir_realloc(cli.clcProto, sizeof(ClcProtoStatus) * cli.hClcProtoCount); for (i=0, cnt=0; i < accounts.getCount(); i++) { if (Proto_IsAccountEnabled(accounts[i])) { cli.clcProto[cnt].szProto = accounts[i]->szModuleName; cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETSTATUS, 0, 0); ++cnt; } } return 0; }
static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) { protoModeMsgFlags = 0; for (int i=0; i < accounts.getCount(); i++) { if (!Proto_IsAccountEnabled(accounts[i])) continue; protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0); } return 0; }
static int AutoAwayEvent(WPARAM, LPARAM lParam) { MIRANDA_IDLE_INFO mii = { sizeof(mii) }; CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); if (mii.idlesoundsoff) iBreakSounds = (lParam & IDF_ISIDLE) != 0; // we don't need to switch the status if (mii.aaStatus == 0) return 0; int numAccounts; PROTOACCOUNT** accounts; Proto_EnumAccounts(&numAccounts, &accounts); for (int i = 0; i < numAccounts; i++) { PROTOACCOUNT *pa = accounts[i]; if (!Proto_IsAccountEnabled(pa) || Proto_IsAccountLocked(pa)) continue; int currentstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0); int statusbits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); int status = mii.aaStatus; if (!(statusbits & Proto_Status2Flag(status))) { // the protocol doesnt support the given status if (statusbits & Proto_Status2Flag(ID_STATUS_AWAY)) status = ID_STATUS_AWAY; } if (lParam & IDF_ISIDLE) { if (currentstatus != ID_STATUS_ONLINE && currentstatus != ID_STATUS_FREECHAT) continue; // save old status of account and set to given status db_set_w(NULL, AA_MODULE, pa->szModuleName, currentstatus); Proto_SetStatus(pa->szModuleName, status); } else { int oldstatus = db_get_w(NULL, AA_MODULE, pa->szModuleName, 0); if (oldstatus != ID_STATUS_ONLINE && oldstatus != ID_STATUS_FREECHAT) continue; // returning from idle and this accout was set away, set it back db_unset(NULL, AA_MODULE, pa->szModuleName); if (!mii.aaLock) Proto_SetStatus(pa->szModuleName, oldstatus); } } return 0; }
static void GetProtocolStrings(CMString& buffer) { PROTOACCOUNT **accList; int accCount; int i, j; Proto_EnumAccounts(&accCount, &accList); int protoCount; PROTOCOLDESCRIPTOR **protoList; Proto_EnumProtocols(&protoCount, &protoList); int protoCountMy = 0; char** protoListMy = (char**)alloca((protoCount + accCount) * sizeof(char*)); for (i = 0; i < protoCount; i++) { if (protoList[i]->type != PROTOTYPE_PROTOCOL) continue; protoListMy[protoCountMy++] = protoList[i]->szName; } for (j = 0; j < accCount; j++) { for (i = 0; i < protoCountMy; i++) if (!mir_strcmp(protoListMy[i], accList[j]->szProtoName)) break; if (i == protoCountMy) protoListMy[protoCountMy++] = accList[j]->szProtoName; } ProtoCount *protos = (ProtoCount*)alloca(sizeof(ProtoCount) * protoCountMy); memset(protos, 0, sizeof(ProtoCount) * protoCountMy); for (j = 0; j < accCount; j++) for (i = 0; i < protoCountMy; i++) if (!mir_strcmp(protoListMy[i], accList[j]->szProtoName)) { protos[i].nloaded = accList[j]->bDynDisabled != 0; if (Proto_IsAccountEnabled(accList[j])) ++protos[i].countse; else ++protos[i].countsd; break; } for (i = 0; i < protoCountMy; i++) buffer.AppendFormat(TEXT("%-24s %d - Enabled %d - Disabled %sLoaded\r\n"), (TCHAR*)_A2T(protoListMy[i]), protos[i].countse, protos[i].countsd, protos[i].nloaded ? _T("Not ") : _T("")); }
int fnGetProtocolVisibility(const char *accName) { if (accName) { PROTOACCOUNT *pa = Proto_GetAccount(accName); if (pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) && pa->ppro) { PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(pa->szProtoName); if (pd == NULL || pd->type != PROTOTYPE_PROTOCOL) return FALSE; return (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0)); } } return FALSE; }
static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) { protoModeMsgFlags = 0; int nAccounts; PROTOACCOUNT** accounts; ProtoEnumAccounts(&nAccounts, &accounts); for (int i = 0; i < nAccounts; i++) { if (!Proto_IsAccountEnabled(accounts[i])) continue; protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0); } return 0; }
void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) { if (szProto == NULL) { for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT* pa = accounts[i]; if (!Proto_IsAccountEnabled(pa)) continue; if ((CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) && !Proto_IsAccountLocked(pa)) CallProtoService(pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg); } } else CallProtoService(szProto, PS_SETAWAYMSGT, statusMode,(LPARAM)msg); }
int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams) { if (szProto == NULL) { int failures = 0; dat->searchCount = 0; dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount()); for (int i=0; i < accounts.getCount();i++) { PROTOACCOUNT *pa = accounts[i]; if (!Proto_IsAccountEnabled(pa)) continue; DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(caps&requiredCapability)) continue; dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoServiceInt(NULL,pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[dat->searchCount].szProto = pa->szModuleName; if (dat->search[dat->searchCount].hProcess == NULL) failures++; else dat->searchCount++; } if (failures) { //infuriatingly vague error message. fixme. if (dat->searchCount == 0) { forkthread(BeginSearchFailed, 0, NULL); mir_free(dat->search); dat->search = NULL; return 1; } } } else { dat->search = (struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo)); dat->searchCount = 1; dat->search[0].hProcess = (HANDLE)CallProtoServiceInt(NULL,szProto, szSearchService, 0, (LPARAM)pvSearchParams); dat->search[0].szProto = szProto; if (dat->search[0].hProcess == NULL) { //infuriatingly vague error message. fixme. PROTOACCOUNT *pa = Proto_GetAccount(szProto); forkthread(BeginSearchFailed, 0, mir_tstrdup(pa->tszAccountName)); mir_free(dat->search); dat->search = NULL; dat->searchCount = 0; return 1; } } return 0; }
void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile) { if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName)) { CMString displayName(acc->tszAccountName ? acc->tszAccountName : A2T_SM(acc->szModuleName)); CMString PhysProtoName, paths; DBVARIANT dbv; if (db_get_ts(NULL, acc->szModuleName, "AM_BaseProto", &dbv) == 0) { PhysProtoName = _T("AllProto"); PhysProtoName += dbv.ptszVal; db_free(&dbv); } if (!PhysProtoName.IsEmpty()) paths = g_SmileyCategories.GetSmileyCategory(PhysProtoName) ? g_SmileyCategories.GetSmileyCategory(PhysProtoName)->GetFilename() : _T(""); if (paths.IsEmpty()) { const char* packnam = acc->szProtoName; if (mir_strcmp(packnam, "JABBER") == 0) packnam = "JGMail"; else if (strstr(packnam, "SIP") != NULL) packnam = "MSN"; char path[MAX_PATH]; mir_snprintf(path, "Smileys\\nova\\%s.msl", packnam); paths = A2T_SM(path); CMString patha; pathToAbsolute(paths, patha); if (_taccess(patha.c_str(), 0) != 0) paths = defaultFile; } CMString tname(A2T_SM(acc->szModuleName)); AddCategory(tname, displayName, acc->bIsVirtual ? smcVirtualProto : smcProto, paths); } }
INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, LPARAM lParam) { struct TAccMgrData *dat = (struct TAccMgrData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch(message) { case WM_INITDIALOG: { TAccMgrData *dat = (TAccMgrData *)mir_alloc(sizeof(TAccMgrData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); TranslateDialogDefault(hwndDlg); Window_SetIcon_IcoLib( hwndDlg, SKINICON_OTHER_ACCMGR ); Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("New account")); Button_SetIcon_IcoLib(hwndDlg, IDC_EDIT, SKINICON_OTHER_RENAME, LPGEN("Edit")); Button_SetIcon_IcoLib(hwndDlg, IDC_REMOVE, SKINICON_OTHER_DELETE, LPGEN("Remove account")); Button_SetIcon_IcoLib(hwndDlg, IDC_OPTIONS, SKINICON_OTHER_OPTIONS, LPGEN( "Configure...")); Button_SetIcon_IcoLib(hwndDlg, IDC_UPGRADE, SKINICON_OTHER_ACCMGR, LPGEN("Upgrade account")); EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_UPGRADE), FALSE); { LOGFONT lf; HDC hdc; HFONT hfnt; TEXTMETRIC tm; GetObject((HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0), sizeof(lf), &lf); dat->hfntText = CreateFontIndirect(&lf); GetObject((HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0), sizeof(lf), &lf); lf.lfWeight = FW_BOLD; dat->hfntTitle = CreateFontIndirect(&lf); hdc = GetDC(hwndDlg); hfnt = ( HFONT )SelectObject(hdc, dat->hfntTitle); GetTextMetrics(hdc, &tm); dat->titleHeight = tm.tmHeight; SelectObject(hdc, dat->hfntText); GetTextMetrics(hdc, &tm); dat->textHeight = tm.tmHeight; SelectObject(hdc, hfnt); ReleaseDC(hwndDlg, hdc); dat->normalHeight = 4 + max(dat->titleHeight, GetSystemMetrics(SM_CYSMICON)); dat->selectedHeight = dat->normalHeight + 4 + 2 * dat->textHeight; SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, (WPARAM)dat->hfntTitle, 0); SendDlgItemMessage(hwndDlg, IDC_TXT_ACCOUNT, WM_SETFONT, (WPARAM)dat->hfntTitle, 0); SendDlgItemMessage(hwndDlg, IDC_TXT_ADDITIONAL, WM_SETFONT, (WPARAM)dat->hfntTitle, 0); } dat->iSelected = -1; sttSubclassAccList(GetDlgItem(hwndDlg, IDC_ACCLIST), TRUE); SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 ); Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, "AccMgr", ""); } return TRUE; case WM_CTLCOLORSTATIC: switch ( GetDlgCtrlID(( HWND )lParam )) { case IDC_WHITERECT: case IDC_NAME: SetBkColor(( HDC )wParam, GetSysColor( COLOR_WINDOW )); return ( INT_PTR )GetSysColorBrush( COLOR_WINDOW ); } break; case WM_MEASUREITEM: { LPMEASUREITEMSTRUCT lps = (LPMEASUREITEMSTRUCT)lParam; PROTOACCOUNT *acc = (PROTOACCOUNT *)lps->itemData; if ((lps->CtlID != IDC_ACCLIST) || !acc) break; lps->itemWidth = 10; lps->itemHeight = dat->normalHeight; } return TRUE; case WM_DRAWITEM: { int tmp, size, length; TCHAR *text; HICON hIcon; HBRUSH hbrBack; SIZE sz; int cxIcon = GetSystemMetrics(SM_CXSMICON); int cyIcon = GetSystemMetrics(SM_CYSMICON); LPDRAWITEMSTRUCT lps = (LPDRAWITEMSTRUCT)lParam; PROTOACCOUNT *acc = (PROTOACCOUNT *)lps->itemData; if ((lps->CtlID != IDC_ACCLIST) || (lps->itemID == -1) || !acc) break; SetBkMode(lps->hDC, TRANSPARENT); if (lps->itemState & ODS_SELECTED) { hbrBack = GetSysColorBrush(COLOR_HIGHLIGHT); SetTextColor(lps->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); } else { hbrBack = GetSysColorBrush(COLOR_WINDOW); SetTextColor(lps->hDC, GetSysColor(COLOR_WINDOWTEXT)); } FillRect(lps->hDC, &lps->rcItem, hbrBack); lps->rcItem.left += 2; lps->rcItem.top += 2; lps->rcItem.bottom -= 2; if ( acc->bOldProto ) tmp = SKINICON_OTHER_ON; else if ( acc->bDynDisabled ) tmp = SKINICON_OTHER_OFF; else tmp = acc->bIsEnabled ? SKINICON_OTHER_TICK : SKINICON_OTHER_NOTICK; hIcon = LoadSkinnedIcon(tmp); DrawIconEx(lps->hDC, lps->rcItem.left, lps->rcItem.top, hIcon, cxIcon, cyIcon, 0, hbrBack, DI_NORMAL); IconLib_ReleaseIcon(hIcon, 0); lps->rcItem.left += cxIcon + 2; if (acc->ppro) { hIcon = acc->ppro->GetIcon( PLI_PROTOCOL | PLIF_SMALL ); DrawIconEx(lps->hDC, lps->rcItem.left, lps->rcItem.top, hIcon, cxIcon, cyIcon, 0, hbrBack, DI_NORMAL); DestroyIcon(hIcon); } lps->rcItem.left += cxIcon + 2; length = SendDlgItemMessage(hwndDlg, IDC_ACCLIST, LB_GETTEXTLEN, lps->itemID, 0); size = max(length+1, 256); text = (TCHAR *)_alloca(sizeof(TCHAR) * size); SendDlgItemMessage(hwndDlg, IDC_ACCLIST, LB_GETTEXT, lps->itemID, (LPARAM)text); SelectObject(lps->hDC, dat->hfntTitle); tmp = lps->rcItem.bottom; lps->rcItem.bottom = lps->rcItem.top + max(cyIcon, dat->titleHeight); DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_END_ELLIPSIS|DT_VCENTER); lps->rcItem.bottom = tmp; GetTextExtentPoint32(lps->hDC, text, length, &sz); lps->rcItem.top += max(cxIcon, sz.cy) + 2; if (lps->itemID == (unsigned)dat->iSelected) { SelectObject(lps->hDC, dat->hfntText); mir_sntprintf(text, size, _T("%s: ") _T(TCHAR_STR_PARAM), TranslateT("Protocol"), acc->szProtoName); length = lstrlen(text); DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_END_ELLIPSIS); GetTextExtentPoint32(lps->hDC, text, length, &sz); lps->rcItem.top += sz.cy + 2; if (acc->ppro && Proto_IsProtocolLoaded(acc->szProtoName)) { char *szIdName; TCHAR *tszIdName; CONTACTINFO ci = { 0 }; szIdName = (char *)acc->ppro->GetCaps( PFLAG_UNIQUEIDTEXT, 0 ); tszIdName = szIdName ? mir_a2t(szIdName) : mir_tstrdup(TranslateT("Account ID")); ci.cbSize = sizeof(ci); ci.hContact = NULL; ci.szProto = acc->szModuleName; ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR; if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) { switch (ci.type) { case CNFT_ASCIIZ: mir_sntprintf( text, size, _T("%s: %s"), tszIdName, ci.pszVal ); mir_free(ci.pszVal); break; case CNFT_DWORD: mir_sntprintf( text, size, _T("%s: %d"), tszIdName, ci.dVal ); break; } } else mir_sntprintf(text, size, _T("%s: %s"), tszIdName, TranslateT("<unknown>")); mir_free(tszIdName); } else mir_sntprintf(text, size, TranslateT("Protocol is not loaded.")); length = lstrlen(text); DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_END_ELLIPSIS); GetTextExtentPoint32(lps->hDC, text, length, &sz); lps->rcItem.top += sz.cy + 2; } } return TRUE; case WM_MY_REFRESH: { HWND hList = GetDlgItem(hwndDlg, IDC_ACCLIST); int i = ListBox_GetCurSel(hList); PROTOACCOUNT *acc = (i == LB_ERR) ? NULL : (PROTOACCOUNT *)ListBox_GetItemData(hList, i); dat->iSelected = -1; SendMessage( hList, LB_RESETCONTENT, 0, 0 ); for (i = 0; i < accounts.getCount(); ++i) { int iItem = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM)accounts[i]->tszAccountName); SendMessage(hList, LB_SETITEMDATA, iItem, (LPARAM)accounts[i]); if (accounts[i] == acc) ListBox_SetCurSel(hList, iItem); } dat->iSelected = ListBox_GetCurSel(hList); // -1 if error => nothing selected in our case if (dat->iSelected >= 0) sttSelectItem(dat, hList, dat->iSelected); else if (acc && acc->hwndAccMgrUI) ShowWindow(acc->hwndAccMgrUI, SW_HIDE); sttUpdateAccountInfo(hwndDlg, dat); } break; case WM_CONTEXTMENU: if ( GetWindowLongPtr(( HWND )wParam, GWL_ID ) == IDC_ACCLIST ) { HWND hwndList = GetDlgItem( hwndDlg, IDC_ACCLIST ); POINT pt = { (signed short)LOWORD( lParam ), (signed short)HIWORD( lParam ) }; int iItem = ListBox_GetCurSel( hwndList ); if (( pt.x == -1 ) && ( pt.y == -1 )) { if (iItem != LB_ERR) { RECT rc; ListBox_GetItemRect( hwndList, iItem, &rc ); pt.x = rc.left + GetSystemMetrics(SM_CXSMICON) + 4; pt.y = rc.top + 4 + max(GetSystemMetrics(SM_CXSMICON), dat->titleHeight); ClientToScreen( hwndList, &pt ); } } else { // menu was activated with mouse => find item under cursor & set focus to our control. POINT ptItem = pt; ScreenToClient( hwndList, &ptItem ); iItem = (short)LOWORD(SendMessage(hwndList, LB_ITEMFROMPOINT, 0, MAKELPARAM(ptItem.x, ptItem.y))); if (iItem != LB_ERR) { ListBox_SetCurSel(hwndList, iItem); sttUpdateAccountInfo(hwndDlg, dat); sttSelectItem(dat, hwndList, iItem); SetFocus(hwndList); } } if ( iItem != LB_ERR ) { PROTOACCOUNT* pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, iItem); HMENU hMenu = CreatePopupMenu(); if ( !pa->bOldProto && !pa->bDynDisabled ) AppendMenu(hMenu, MF_STRING, 1, TranslateT("Rename")); AppendMenu(hMenu, MF_STRING, 3, TranslateT("Delete")); if ( Proto_IsAccountEnabled( pa )) AppendMenu(hMenu, MF_STRING, 4, TranslateT("Configure")); if ( pa->bOldProto || pa->bDynDisabled ) AppendMenu(hMenu, MF_STRING, 5, TranslateT("Upgrade")); AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); AppendMenu(hMenu, MF_STRING, 0, TranslateT("Cancel")); switch (TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL )) { case 1: PostMessage(hwndList, WM_MY_RENAME, 0, 0); break; case 2: sttClickButton(hwndDlg, IDC_EDIT); break; case 3: sttClickButton(hwndDlg, IDC_REMOVE); break; case 4: sttClickButton(hwndDlg, IDC_OPTIONS); break; case 5: sttClickButton(hwndDlg, IDC_UPGRADE); break; } DestroyMenu( hMenu ); } } break; case WM_COMMAND: switch( LOWORD(wParam)) { case IDC_ACCLIST: { HWND hwndList = GetDlgItem(hwndDlg, IDC_ACCLIST); switch (HIWORD(wParam)) { case LBN_SELCHANGE: sttUpdateAccountInfo(hwndDlg, dat); sttSelectItem(dat, hwndList, ListBox_GetCurSel(hwndList)); SetFocus(hwndList); break; case LBN_DBLCLK: PostMessage(hwndList, WM_MY_RENAME, 0, 0); break; case LBN_MY_CHECK: { PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, lParam); if ( pa ) { if ( pa->bOldProto || pa->bDynDisabled) break; pa->bIsEnabled = !pa->bIsEnabled; if ( pa->bIsEnabled ) { if ( ActivateAccount( pa )) { pa->ppro->OnEvent( EV_PROTO_ONLOAD, 0, 0 ); if (!DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", FALSE)) pa->ppro->OnEvent( EV_PROTO_ONMENU, 0, 0 ); } else pa->type = PROTOTYPE_DISPROTO; } else { DWORD dwStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0); if (dwStatus >= ID_STATUS_ONLINE) { if (IDCANCEL == ::MessageBox(hwndDlg, TranslateT("Account is online. Disable account?"), TranslateT("Accounts"), MB_OKCANCEL)) { pa->bIsEnabled = 1; //stay enabled } } if ( !pa->bIsEnabled ) DeactivateAccount( pa, true, false ); } WriteDbAccounts(); NotifyEventHooks( hAccListChanged, PRAC_CHECKED, ( LPARAM )pa ); sttUpdateAccountInfo(hwndDlg, dat); RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE); } } break; case LBN_MY_RENAME: { int iItem = ListBox_GetCurSel(hwndList); PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, iItem); if ( pa ) { mir_free(pa->tszAccountName); pa->tszAccountName = (TCHAR*)lParam; WriteDbAccounts(); NotifyEventHooks(hAccListChanged, PRAC_CHANGED, (LPARAM)pa); ListBox_DeleteString(hwndList, iItem); iItem = ListBox_AddString(hwndList, pa->tszAccountName); ListBox_SetItemData(hwndList, iItem, (LPARAM)pa); ListBox_SetCurSel(hwndList, iItem); sttSelectItem(dat, hwndList, iItem); RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE); } else mir_free((TCHAR*)lParam); } break; } } break; case IDC_ADD: { AccFormDlgParam param = { PRAC_ADDED, NULL }; if ( IDOK == DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m )) SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 ); } break; case IDC_EDIT: { HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST ); int idx = ListBox_GetCurSel( hList ); if ( idx != -1 ) PostMessage(hList, WM_MY_RENAME, 0, 0); } break; case IDC_REMOVE: { HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST ); int idx = ListBox_GetCurSel( hList ); if ( idx != -1 ) { PROTOACCOUNT* pa = ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx ); TCHAR buf[ 200 ]; mir_sntprintf( buf, SIZEOF(buf), TranslateT( "Account %s is being deleted" ), pa->tszAccountName ); if (pa->bOldProto) { MessageBox( NULL, TranslateT( "You need to disable plugin to delete this account" ), buf, MB_ICONERROR | MB_OK ); break; } if ( IDYES == MessageBox( NULL, TranslateT( errMsg ), buf, MB_ICONSTOP | MB_DEFBUTTON2 | MB_YESNO )) { // lock controls to avoid changes during remove process ListBox_SetCurSel( hList, -1 ); sttUpdateAccountInfo( hwndDlg, dat ); EnableWindow( hList, FALSE ); EnableWindow( GetDlgItem(hwndDlg, IDC_ADD), FALSE ); ListBox_SetItemData( hList, idx, 0 ); accounts.remove( pa ); CheckProtocolOrder(); WriteDbAccounts(); NotifyEventHooks( hAccListChanged, PRAC_REMOVED, ( LPARAM )pa ); UnloadAccount( pa, true, true ); SendMessage( hwndDlg, WM_MY_REFRESH, 0, 0 ); EnableWindow( hList, TRUE ); EnableWindow( GetDlgItem(hwndDlg, IDC_ADD), TRUE ); } } } break; case IDC_OPTIONS: { HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST ); int idx = ListBox_GetCurSel( hList ); if ( idx != -1 ) { PROTOACCOUNT* pa = ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx ); if ( pa->bOldProto ) { OPENOPTIONSDIALOG ood; ood.cbSize = sizeof(ood); ood.pszGroup = "Network"; ood.pszPage = pa->szModuleName; ood.pszTab = NULL; CallService( MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood ); } else OpenAccountOptions( pa ); } } break; case IDC_UPGRADE: { HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST ); int idx = ListBox_GetCurSel( hList ); if ( idx != -1 ) { AccFormDlgParam param = { PRAC_UPGRADED, ( PROTOACCOUNT* )ListBox_GetItemData( hList, idx ) }; DialogBoxParam( hMirandaInst, MAKEINTRESOURCE(IDD_ACCFORM), hwndDlg, AccFormDlgProc, (LPARAM)¶m ); } } break; case IDC_LNK_NETWORK: { PSHNOTIFY pshn = {0}; pshn.hdr.code = PSN_APPLY; pshn.hdr.hwndFrom = hwndDlg; SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&pshn); OPENOPTIONSDIALOG ood = {0}; ood.cbSize = sizeof(ood); ood.pszPage = "Network"; CallService( MS_OPT_OPENOPTIONS, 0, (LPARAM)&ood ); break; } case IDC_LNK_ADDONS: CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)"http://addons.miranda-im.org/"); break; case IDOK: { PSHNOTIFY pshn = {0}; pshn.hdr.code = PSN_APPLY; pshn.hdr.hwndFrom = hwndDlg; SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&pshn); DestroyWindow(hwndDlg); break; } case IDCANCEL: { PSHNOTIFY pshn = {0}; pshn.hdr.code = PSN_RESET; pshn.hdr.hwndFrom = hwndDlg; SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&pshn); DestroyWindow(hwndDlg); break; } } case PSM_CHANGED: { HWND hList = GetDlgItem( hwndDlg, IDC_ACCLIST ); int idx = ListBox_GetCurSel( hList ); if ( idx != -1 ) { PROTOACCOUNT *acc = (PROTOACCOUNT *)ListBox_GetItemData(hList, idx); if (acc) { acc->bAccMgrUIChanged = TRUE; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; } case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { int i; PSHNOTIFY pshn = {0}; pshn.hdr.code = PSN_APPLY; for (i = 0; i < accounts.getCount(); ++i) { if ( accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged ) { pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI; SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn); accounts[i]->bAccMgrUIChanged = FALSE; } } return TRUE; } case PSN_RESET: { int i; PSHNOTIFY pshn = {0}; pshn.hdr.code = PSN_RESET; for (i = 0; i < accounts.getCount(); ++i) { if ( accounts[i]->hwndAccMgrUI && accounts[i]->bAccMgrUIChanged ) { pshn.hdr.hwndFrom = accounts[i]->hwndAccMgrUI; SendMessage(accounts[i]->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn); accounts[i]->bAccMgrUIChanged = FALSE; } } return TRUE; } } break; } break; case WM_DESTROY: { for (int i = 0; i < accounts.getCount(); ++i) { accounts[i]->bAccMgrUIChanged = FALSE; if (accounts[i]->hwndAccMgrUI) { DestroyWindow(accounts[i]->hwndAccMgrUI); accounts[i]->hwndAccMgrUI = NULL; } } } Window_FreeIcon_IcoLib( hwndDlg ); Button_FreeIcon_IcoLib( hwndDlg, IDC_ADD ); Button_FreeIcon_IcoLib( hwndDlg, IDC_EDIT ); Button_FreeIcon_IcoLib( hwndDlg, IDC_REMOVE ); Button_FreeIcon_IcoLib( hwndDlg, IDC_OPTIONS ); Button_FreeIcon_IcoLib( hwndDlg, IDC_UPGRADE ); Utils_SaveWindowPosition( hwndDlg, NULL, "AccMgr", ""); sttSubclassAccList(GetDlgItem(hwndDlg, IDC_ACCLIST), FALSE); DeleteObject(dat->hfntTitle); DeleteObject(dat->hfntText); mir_free(dat); hAccMgr = NULL; break; } return FALSE; }
static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_USER + 1: { MCONTACT hContact = wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && mir_strcmpi(ws->szModule, "CList") == 0 && mir_strcmpi(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED); } } break; case WM_DESTROY: UnhookEvent((HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwndDlg, IDC_SORTBYNAME, !db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) && !db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (!(caps & CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); if (!(caps & CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); if (caps & CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); if (caps & CLUIF_HASAUTOHIDEOPTION) { ShowWindow(GetDlgItem(hwndDlg, IDC_AUTOHIDE), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_STAUTOHIDESECS), SW_HIDE); } } SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL, "CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) { EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE); } SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); { ptrA szPrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus")); int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0); int count; PROTOACCOUNT **accs; Proto_EnumAccounts(&count, &accs); for (int i = 0; i < count; i++) { if (!Proto_IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i]); if (!mir_strcmp(szPrimaryStatus, accs[i]->szModuleName)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); } } if (CB_ERR == SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", 550), 0)); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_AUTOHIDE) { EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); } if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)); } if (LOWORD(wParam) == IDC_DISABLEBLINK) { EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKSPIN), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); EnableWindow(GetDlgItem(hwndDlg, IDC_STMSDELAY), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); } if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && HIWORD(wParam) != EN_CHANGE) break; if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; if (LOWORD(wParam) == IDC_BLINKTIME && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: db_set_b(NULL, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (caps & CLUIF_HIDEEMPTYGROUPS) db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); if (caps & CLUIF_DISABLEGROUPS) db_set_b(NULL, "CList", "UseGroups", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); if (!(caps & CLUIF_HASONTOPOPTION)) { db_set_b(NULL, "CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if (!(caps & CLUIF_HASAUTOHIDEOPTION)) { db_set_b(NULL, "CList", "AutoHide", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); db_set_w(NULL, "CList", "HideTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); } } db_set_b(NULL, "CList", "SortByStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS)); db_set_b(NULL, "CList", "SortByProto", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO)); db_set_b(NULL, "CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); db_set_b(NULL, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); db_set_b(NULL, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); db_set_b(NULL, "CList", "AlwaysMulti", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI)); db_set_b(NULL, "CList", "TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI))); db_set_w(NULL, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); db_set_w(NULL, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); db_set_b(NULL, "CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); { int cur = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0); PROTOACCOUNT *pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cur, 0); if (pa == NULL) db_unset(NULL, "CList", "PrimaryStatus"); else db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName); } pcli->pfnTrayIconIconsChanged(); pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */ pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); /* force reshuffle */ return TRUE; } break; } break; } return FALSE; }
int GetContactName(MCONTACT hContact, const char *proto, TCHAR *value, int maxlen) { if (!value) return 0; if (!hContact) { mir_tstrncpy(value, TranslateT("Settings"), maxlen); return 1; } char *szProto = (char*)proto; char tmp[FLD_SIZE]; TCHAR name[NAME_SIZE]; name[0] = 0; if (hContact && (!proto || !proto[0])) if (!db_get_static(hContact, "Protocol", "p", tmp, _countof(tmp))) szProto = tmp; for (int i = 0; i < NAMEORDERCOUNT - 1; i++) { switch (nameOrder[i]) { case 0: // custom name GetValue(hContact, "CList", "MyHandle", name, _countof(name)); break; case 1: // nick if (!szProto) break; GetValue(hContact, szProto, "Nick", name, _countof(name)); break; case 2: // First Name // if (!szProto) break; // GetValue(hContact, szProto, "FirstName", name, _countof(name)); break; case 3: // E-mail if (!szProto) break; GetValue(hContact, szProto, "e-mail", name, _countof(name)); break; case 4: // Last Name // GetValue(hContact, szProto, "LastName", name, _countof(name)); break; case 5: // Unique id if (szProto) { // protocol must define a PFLAG_UNIQUEIDSETTING char *uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) GetValue(hContact, szProto, uid, name, _countof(name)); } break; case 6: // first + last name if (szProto) { GetValue(hContact, szProto, "FirstName", name, _countof(name)); int len = (int)mir_tstrlen(name); if (len + 2 < _countof(name)) { if (len) mir_tstrncat(name, _T(" "), _countof(name)); len++; GetValue(hContact, szProto, "LastName", &name[len], _countof(name) - len); } } break; } if (name[0]) break; } if (!name[0]) mir_tstrncpy(name, TranslateT("<UNKNOWN>"), _countof(name)); if (szProto && szProto[0]) { if (g_Order) mir_sntprintf(value, maxlen, _T("(%s) %s"), _A2T(szProto), name); else mir_sntprintf(value, maxlen, _T("%s (%s)"), name, _A2T(szProto)); } else mir_tstrncpy(value, name, maxlen); PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (!Proto_IsAccountEnabled(pa)) { mir_tstrncat(value, _T(" "), maxlen); mir_tstrncat(value, TranslateT("[UNLOADED]"), maxlen); } return 1; }
INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) { StatusMenuExecParam *smep = (StatusMenuExecParam*)wParam; if (smep != NULL) { if (smep->custom) { if (smep->svc && *smep->svc) CallService(smep->svc, 0, (LPARAM)smep->hMenuItem); } else { if (smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL) { PMO_IntMenuItem pimi; char *prot = smep->proto; char szHumanName[64] = { 0 }; PROTOACCOUNT *acc = Proto_GetAccount(smep->proto); bool bIsLocked = !Proto_IsAccountLocked(acc); db_set_b(NULL, prot, "LockMainStatus", bIsLocked); CallProtoServiceInt(NULL, smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName); pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex); PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root; mir_free(pimi->mi.pszName); mir_free(root->mi.pszName); if (bIsLocked) { TCHAR buf[256]; pimi->mi.flags |= CMIF_CHECKED; if (cli.bDisplayLocked) { mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s (locked)"), acc->tszAccountName); pimi->mi.ptszName = mir_tstrdup(buf); root->mi.ptszName = mir_tstrdup(buf); } else { pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName); root->mi.ptszName = mir_tstrdup(acc->tszAccountName); } } else { pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName); root->mi.ptszName = mir_tstrdup(acc->tszAccountName); pimi->mi.flags &= ~CMIF_CHECKED; } if (cli.hwndStatus) InvalidateRect(cli.hwndStatus, NULL, TRUE); } else if (smep->proto != NULL) { Proto_SetStatus(smep->proto, smep->status); NotifyEventHooks(hStatusModeChangeEvent, smep->status, (LPARAM)smep->proto); } else { int MenusProtoCount = 0; for (int i = 0; i < accounts.getCount(); i++) if (cli.pfnGetProtocolVisibility(accounts[i]->szModuleName)) MenusProtoCount++; cli.currentDesiredStatusMode = smep->status; for (int j = 0; j < accounts.getCount(); j++) { PROTOACCOUNT *pa = accounts[j]; if (!Proto_IsAccountEnabled(pa)) continue; if (MenusProtoCount > 1 && Proto_IsAccountLocked(pa)) continue; Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode); } NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0); db_set_w(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode); return 1; } } } return 0; }
bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) { PROTOACCOUNT** pAccounts; int iRealAccCount, iAccCount = 0; Proto_EnumAccounts(&iRealAccCount, &pAccounts); for (int i = 0; i < iRealAccCount; i++) { if (!Proto_IsAccountEnabled(pAccounts[i])) continue; DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (dwCaps & PF1_BASICSEARCH || dwCaps & PF1_EXTSEARCH || dwCaps & PF1_SEARCHBYEMAIL || dwCaps & PF1_SEARCHBYNAME) iAccCount++; } if (iAccCount == 0) { if (GetParent(hdlg) == NULL) DestroyWindow(hdlg); else EndDialog(hdlg, 0); return false; } SIZE textSize; RECT rc; int iIndex = 0, cbWidth = 0; HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, iAccCount, 0); ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_SETIMAGELIST, 0, (LPARAM)hIml)); SendDlgItemMessage(hdlg, IDC_PROTO, CB_RESETCONTENT, 0, 0); COMBOBOXEXITEM cbei = { 0 }; cbei.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM; HDC hdc = GetDC(hdlg); SelectObject(hdc, (HFONT)SendDlgItemMessage(hdlg, IDC_PROTO, WM_GETFONT, 0, 0)); for (int i = 0; i < iRealAccCount; i++) { if (!Proto_IsAccountEnabled(pAccounts[i])) continue; DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (!(dwCaps & PF1_BASICSEARCH) && !(dwCaps & PF1_EXTSEARCH) && !(dwCaps & PF1_SEARCHBYEMAIL) && !(dwCaps & PF1_SEARCHBYNAME)) continue; cbei.pszText = pAccounts[i]->tszAccountName; GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize); if (textSize.cx > cbWidth) cbWidth = textSize.cx; HICON hIcon = (HICON)CallProtoService(pAccounts[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(hIml, hIcon); DestroyIcon(hIcon); cbei.lParam = (LPARAM)pAccounts[i]->szModuleName; SendDlgItemMessage(hdlg, IDC_PROTO, CBEM_INSERTITEM, 0, (LPARAM)&cbei); if (cbei.lParam && !mir_strcmp(acs->proto, pAccounts[i]->szModuleName)) iIndex = cbei.iItem; cbei.iItem++; } cbWidth += 32; SendDlgItemMessage(hdlg, IDC_PROTO, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc); if ((rc.right - rc.left) < cbWidth) SendDlgItemMessage(hdlg, IDC_PROTO, CB_SETDROPPEDWIDTH, cbWidth, 0); SendDlgItemMessage(hdlg, IDC_PROTO, CB_SETCURSEL, iIndex, 0); SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_PROTO, CBN_SELCHANGE), (LPARAM)GetDlgItem(hdlg, IDC_PROTO)); if (iAccCount == 1) SetFocus(GetDlgItem(hdlg, IDC_USERID)); return true; }
static INT_PTR Proto_GetContactBaseProto(WPARAM wParam, LPARAM) { PROTOACCOUNT *pa = Proto_GetAccount(wParam); return (INT_PTR)(Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL); }
INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_USER + 1: { MCONTACT hContact = wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *)lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && mir_strcmpi(ws->szModule, "CList") == 0 && mir_strcmpi(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0 ? BST_CHECKED : BST_UNCHECKED); } break; case WM_DESTROY: UnhookEvent((HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; case WM_INITDIALOG: opt_gen_opts_changed = 0; TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); CheckDlgButton(hwndDlg, IDC_ONTOP, cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, cfg::getByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, cfg::getByte("CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, cfg::getByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, cfg::getByte("CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (!(caps & CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); if (!(caps & CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); if (caps & CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); if (caps & CLUIF_HASAUTOHIDEOPTION) { } } CheckDlgButton(hwndDlg, IDC_SHOWBOTTOMBUTTONS, cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CLISTSUNKEN, cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_EVENTAREAAUTOHIDE, cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_EVENTAREASUNKEN, (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONECLK, cfg::getByte("CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, cfg::getByte("CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONTCYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CYCLE, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MULTITRAY, cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, cfg::getByte("CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ICONBLINK, cfg::getByte("CList", "NoIconBlink", 0) == 1 ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) { Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) { Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, FALSE); } if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) { Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, FALSE); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, FALSE); Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, FALSE); } SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1)); SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0)); { ptrA szPrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus")); int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0); int count; PROTOACCOUNT **accs; Proto_EnumAccounts(&count, &accs); for (int i = 0; i < count; i++) { if (!Proto_IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i]); if (!mir_strcmp(szPrimaryStatus, accs[i]->szModuleName)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); } } if (CB_ERR == (int)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250)); SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(cfg::getWord("CList", "IconFlashTime", 550), 0)); CheckDlgButton(hwndDlg, IDC_NOTRAYINFOTIPS, cfg::dat.bNoTrayTips ? 1 : 0); CheckDlgButton(hwndDlg, IDC_APPLYLASTVIEWMODE, cfg::getByte("CList", "AutoApplyLastViewMode", 0) ? BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { Utils::enableDlgControl(hwndDlg, IDC_PRIMARYSTATUS, IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIME, IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); Utils::enableDlgControl(hwndDlg, IDC_CYCLETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_CYCLE)); Utils::enableDlgControl(hwndDlg, IDC_ALWAYSMULTI, IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)); } if (LOWORD(wParam) == IDC_CYCLETIME && HIWORD(wParam) != EN_CHANGE) break; if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE) break; if (LOWORD(wParam) == IDC_CYCLETIME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; if (LOWORD(wParam) == IDC_BLINKTIME && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); opt_gen_opts_changed = TRUE; break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: if (!opt_gen_opts_changed) return TRUE; cfg::writeByte("CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); if (caps & CLUIF_HIDEEMPTYGROUPS) cfg::writeByte("CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); if (caps & CLUIF_DISABLEGROUPS) cfg::writeByte("CList", "UseGroups", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); if (!(caps & CLUIF_HASONTOPOPTION)) { cfg::writeByte("CList", "OnTop", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } } cfg::writeByte("CList", "ConfirmDelete", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONFIRMDELETE)); cfg::writeByte("CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK)); cfg::writeByte("CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS)); cfg::writeByte("CList", "AlwaysMulti", (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI)); cfg::writeByte("CList", "TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI))); cfg::writeWord("CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0)); cfg::writeWord("CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0)); cfg::writeByte("CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK)); cfg::writeByte("CList", "NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ICONBLINK)); cfg::writeByte("CList", "AutoApplyLastViewMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPLYLASTVIEWMODE)); __setFlag(CLUI_FRAME_EVENTAREASUNKEN, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREASUNKEN)); __setFlag(CLUI_FRAME_AUTOHIDENOTIFY, IsDlgButtonChecked(hwndDlg, IDC_EVENTAREAAUTOHIDE)); __setFlag(CLUI_FRAME_SHOWBOTTOMBUTTONS, IsDlgButtonChecked(hwndDlg, IDC_SHOWBOTTOMBUTTONS)); __setFlag(CLUI_FRAME_CLISTSUNKEN, IsDlgButtonChecked(hwndDlg, IDC_CLISTSUNKEN)); cfg::dat.bNoTrayTips = IsDlgButtonChecked(hwndDlg, IDC_NOTRAYINFOTIPS) ? 1 : 0; cfg::writeByte("CList", "NoTrayTips", (BYTE)cfg::dat.bNoTrayTips); { int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0); PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0); if (!pa) db_unset(NULL, "CList", "PrimaryStatus"); else cfg::writeString(NULL, "CList", "PrimaryStatus", pa->szModuleName); } pcli->pfnTrayIconIconsChanged(); cfg::writeDword("CLUI", "Frameflags", cfg::dat.dwFlags); ConfigureFrame(); ConfigureCLUIGeometry(1); ConfigureEventArea(); HideShowNotifyFrame(); SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); LoadContactTree(); /* this won't do job properly since it only really works when changes happen */ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); opt_gen_opts_changed = 0; return TRUE; } break; } break; } return FALSE; }