void CJabberDlgBookmarks::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon(m_hwnd, m_proto, "bookmarks"); m_btnAdd.Disable(); m_btnEdit.Disable(); m_btnRemove.Disable(); m_lvBookmarks.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER); HIMAGELIST hIml = m_lvBookmarks.CreateImageList(LVSIL_SMALL); ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("group")); ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_EVENT_URL)); m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120)); m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->getWord("bookmarksWnd_cx1", 210)); m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->getWord("bookmarksWnd_cx2", 90)); m_lvBookmarks.EnableGroupView(TRUE); m_lvBookmarks.AddGroup(0, TranslateT("Conferences")); m_lvBookmarks.AddGroup(1, TranslateT("Links")); Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "bookmarksWnd_"); }
void OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon(m_hwnd, m_proto, "openid"); SetDlgItemText(m_hwnd, IDC_TXT_URL, m_pParams->m_szUrl); SetDlgItemText(m_hwnd, IDC_TXT_FROM, m_pParams->m_szFrom); SetDlgItemText(m_hwnd, IDC_TXT_ID, m_pParams->m_szId); SetDlgItemText(m_hwnd, IDC_TXT_METHOD, m_pParams->m_szMethod); }
void CJabberDlgNotes::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon( m_hwnd, m_proto, "notes" ); LOGFONT lf, lfTmp; m_hfntNormal = (HFONT)GetStockObject(DEFAULT_GUI_FONT); GetObject(m_hfntNormal, sizeof(lf), &lf); lfTmp = lf; lfTmp.lfWeight = FW_BOLD; m_hfntBold = CreateFontIndirect(&lfTmp); lfTmp = lf; lfTmp.lfHeight *= 0.8; m_hfntSmall = CreateFontIndirect(&lfTmp); m_lstNotes.SetFonts(m_hfntNormal, m_hfntSmall, m_hfntBold); Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "notesWnd_"); }
void CJabberDlgNoteItem::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon(m_hwnd, m_proto, "notes"); if (m_fnProcess) { CMString buf; if (m_fnProcess == &CJabberProto::ProcessIncomingNote) buf.Format(TranslateT("Incoming note from %s"), m_pNote->GetFrom()); else buf.Format(TranslateT("Send note to %s"), m_pNote->GetFrom()); SetWindowText(m_hwnd, buf); } m_txtTitle.SetText(m_pNote->GetTitle()); m_txtText.SetText(m_pNote->GetText()); m_txtTags.SetText(m_pNote->GetTagsStr()); }
void CJabberDlgNoteItem::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon( m_hwnd, m_proto, "notes" ); if (m_fnProcess) { TCHAR buf[256]; if (m_fnProcess == &CJabberProto::ProcessIncomingNote) mir_sntprintf(buf, SIZEOF(buf), TranslateT("Incoming note from %s"), m_pNote->GetFrom()); else mir_sntprintf(buf, SIZEOF(buf), TranslateT("Send note to %s"), m_pNote->GetFrom()); SetWindowText(m_hwnd, buf); } m_txtTitle.SetText(m_pNote->GetTitle()); m_txtText.SetText(m_pNote->GetText()); m_txtTags.SetText(m_pNote->GetTagsStr()); }
static INT_PTR CALLBACK JabberChangePasswordDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam ) { CJabberProto* ppro = (CJabberProto*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA ); switch ( msg ) { case WM_INITDIALOG: ppro = (CJabberProto*)lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, ( LONG_PTR )lParam ); WindowSetIcon( hwndDlg, ppro, "key" ); TranslateDialogDefault( hwndDlg ); if ( ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL ) { TCHAR text[1024]; mir_sntprintf( text, SIZEOF( text ), _T("%s %s@") _T(TCHAR_STR_PARAM), TranslateT( "Set New Password for" ), ppro->m_ThreadInfo->username, ppro->m_ThreadInfo->server ); SetWindowText( hwndDlg, text ); } return TRUE; case WM_COMMAND: switch ( LOWORD( wParam )) { case IDOK: if ( ppro->m_bJabberOnline && ppro->m_ThreadInfo!=NULL ) { TCHAR newPasswd[512], text[512]; GetDlgItemText( hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF( newPasswd )); GetDlgItemText( hwndDlg, IDC_NEWPASSWD2, text, SIZEOF( text )); if ( _tcscmp( newPasswd, text )) { MessageBox( hwndDlg, TranslateT( "New password does not match." ), TranslateT( "Change Password" ), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND ); break; } GetDlgItemText( hwndDlg, IDC_OLDPASSWD, text, SIZEOF( text )); if ( _tcscmp( text, ppro->m_ThreadInfo->password )) { MessageBox( hwndDlg, TranslateT( "Current password is incorrect." ), TranslateT( "Change Password" ), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND ); break; } _tcsncpy( ppro->m_ThreadInfo->newPassword, newPasswd, SIZEOF( ppro->m_ThreadInfo->newPassword )); int iqId = ppro->SerialNext(); ppro->IqAdd( iqId, IQ_PROC_NONE, &CJabberProto::OnIqResultSetPassword ); XmlNodeIq iq( _T("set"), iqId, _A2T(ppro->m_ThreadInfo->server)); HXML q = iq << XQUERY( _T(JABBER_FEAT_REGISTER)); q << XCHILD( _T("username"), ppro->m_ThreadInfo->username ); q << XCHILD( _T("password"), newPasswd ); ppro->m_ThreadInfo->send( iq ); } DestroyWindow( hwndDlg ); break; case IDCANCEL: DestroyWindow( hwndDlg ); break; } break; case WM_CLOSE: DestroyWindow( hwndDlg ); break; case WM_DESTROY: ppro->m_hwndJabberChangePassword = NULL; WindowFreeIcon( hwndDlg ); break; } return FALSE; }
void CJabberDlgGcJoin::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon(m_hwnd, m_proto, "group"); JabberGcRecentInfo *info = NULL; if (m_jid) info = new JabberGcRecentInfo(m_proto, m_jid); else if(OpenClipboard(m_hwnd)) { HANDLE hData = GetClipboardData(CF_UNICODETEXT); if (hData) { TCHAR *buf = (TCHAR *)GlobalLock(hData); if (buf && _tcschr(buf, _T('@')) && !_tcschr(buf, _T(' '))) info = new JabberGcRecentInfo(m_proto, buf); GlobalUnlock(hData); } CloseClipboard(); } if (info) { info->fillForm(m_hwnd); delete info; } ptrT tszNick(m_proto->getTStringA("Nick")); if (tszNick == NULL) tszNick = JabberNickFromJID(m_proto->m_szJabberJID); SetDlgItemText(m_hwnd, IDC_NICK, tszNick); TEXTMETRIC tm = { 0 }; HDC hdc = GetDC(m_hwnd); GetTextMetrics(hdc, &tm); ReleaseDC(m_hwnd, hdc); sttTextLineHeight = tm.tmHeight; SendDlgItemMessage(m_hwnd, IDC_ROOM, CB_SETITEMHEIGHT, -1, sttTextLineHeight - 1); LOGFONT lf = { 0 }; HFONT hfnt = (HFONT)SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_GETFONT, 0, 0); GetObject(hfnt, sizeof(lf), &lf); lf.lfWeight = FW_BOLD; SendDlgItemMessage(m_hwnd, IDC_TXT_RECENT, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), TRUE); SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx("bookmarks")); SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONADDTOOLTIP, (WPARAM)"Bookmarks", 0); SendDlgItemMessage(m_hwnd, IDC_BOOKMARKS, BUTTONSETASPUSHBTN, TRUE, 0); m_proto->ComboLoadRecentStrings(m_hwnd, IDC_SERVER, "joinWnd_rcSvr"); int i; for (i = 0; i < 5; i++) { TCHAR jid[JABBER_MAX_JID_LEN]; JabberGcRecentInfo info(m_proto); if (!info.loadRecent(i)) break; mir_sntprintf(jid, _countof(jid), _T("%s@%s (%s)"), info.room, info.server, info.nick ? info.nick : TranslateT("<no nick>")); SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid); } sttJoinDlgShowRecentItems(m_hwnd, i); }
//////////////////////////////////////////////////////////////////////////////// // User Util Dlg Page : Data INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { GGUSERUTILDLGDATA *dat = (GGUSERUTILDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); WindowSetIcon(hwndDlg, "settings"); dat = (GGUSERUTILDLGDATA *)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); if (dat) SetDlgItemTextA(hwndDlg, IDC_EMAIL, dat->email); // Readup email return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_PASSWORD: case IDC_CPASSWORD: case IDC_CONFIRM: { char pass[128], cpass[128]; BOOL enable; GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, sizeof(cpass)); enable = strlen(pass) && strlen(cpass) && !strcmp(cpass, pass); if (dat && dat->mode == GG_USERUTIL_REMOVE) EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE); else EnableWindow(GetDlgItem(hwndDlg, IDOK), enable); break; } case IDOK: { char pass[128], cpass[128], email[128]; GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, sizeof(cpass)); GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); EndDialog(hwndDlg, IDOK); // Check dialog box mode if (!dat) break; switch (dat->mode) { case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break; case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break; case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break; case GG_USERUTIL_EMAIL: gg_dochemail(dat->gg, dat->uin, dat->pass, dat->email, email); break; } break; } case IDCANCEL: EndDialog(hwndDlg, IDCANCEL); break; } break; case WM_DESTROY: WindowFreeIcon(hwndDlg); break; } return FALSE; }
static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: { CLCINFOITEM cii = {0}; HANDLE hMetaContactsEvent; SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)lParam); TranslateDialogDefault(hwndDlg); WindowSetIcon(hwndDlg, "conference"); gg_gc_resetclistopts(GetDlgItem(hwndDlg, IDC_CLIST)); // Hook MetaContacts event (if available) hMetaContactsEvent = HookEventMessage(ME_MC_SUBCONTACTSCHANGED, hwndDlg, HM_SUBCONTACTSCHANGED); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hMetaContactsEvent); } return TRUE; case WM_COMMAND: { switch (LOWORD(wParam)) { case IDOK: { HWND hwndList = GetDlgItem(hwndDlg, IDC_CLIST); GGPROTO* gg = (GGPROTO*)GetWindowLongPtr(hwndDlg, DWLP_USER); int count = 0, i = 0; // Check if connected if (!gg->isonline()) { MessageBox(NULL, TranslateT("You have to be connected to open new conference."), gg->m_tszUserName, MB_OK | MB_ICONSTOP); } else if (hwndList && (count = gg_gc_countcheckmarks(hwndList)) >= 2) { // Create new participiants table TCHAR* chat; uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t)); gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count); for (HANDLE hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { HANDLE hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support participants[i++] = db_get_dw(hMetaContact ? hMetaContact : hContact, gg->m_szModuleName, GG_KEY_UIN, 0); } } if (count > i) i = count; chat = gg->gc_getchat(0, participants, count); if (chat) { GCDEST gcd = { gg->m_szModuleName, chat, GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce); } free(participants); } } case IDCANCEL: DestroyWindow(hwndDlg); break; } break; } case WM_NOTIFY: { switch(((NMHDR*)lParam)->idFrom) { case IDC_CLIST: { switch(((NMHDR*)lParam)->code) { case CLN_OPTIONSCHANGED: gg_gc_resetclistopts(GetDlgItem(hwndDlg, IDC_CLIST)); break; case CLN_NEWCONTACT: case CLN_CONTACTMOVED: case CLN_LISTREBUILT: { char* szProto; uin_t uin; GGPROTO* gg = (GGPROTO*)GetWindowLongPtr(hwndDlg, DWLP_USER); if (!gg) break; // Delete non-gg contacts for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { HANDLE hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support if (hMetaContact) { szProto = gg->m_szModuleName; uin = (uin_t)gg->getDword(hMetaContact, GG_KEY_UIN, 0); } else { szProto = GetContactProto(hContact); uin = (uin_t)gg->getDword(hContact, GG_KEY_UIN, 0); } if (szProto == NULL || lstrcmpA(szProto, gg->m_szModuleName) || !uin || uin == gg->getDword(GG_KEY_UIN, 0)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_DELETEITEM, (WPARAM)hItem, 0); } } } break; case CLN_CHECKCHANGED: EnableWindow(GetDlgItem(hwndDlg, IDOK), gg_gc_countcheckmarks(GetDlgItem(hwndDlg, IDC_CLIST)) >= 2); break; } break; } } break; } case HM_SUBCONTACTSCHANGED: { HWND hwndList = GetDlgItem(hwndDlg, IDC_CLIST); SendMessage(hwndList, CLM_AUTOREBUILD, 0, 0); EnableWindow(GetDlgItem(hwndDlg, IDOK), gg_gc_countcheckmarks(hwndList) >= 2); break; } case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_DESTROY: { HANDLE hMetaContactsEvent = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hMetaContactsEvent) UnhookEvent(hMetaContactsEvent); WindowFreeIcon(hwndDlg); break; } } return FALSE; }